	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function atmel_nand_controller_add_nand
_atmel_nand_controller_add_nand:        ## @atmel_nand_controller_add_nand
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r15
	leaq	16(%rsi), %r14
	movq	%r14, %rdi
	callq	_nand_to_mtd
	movq	%rax, %r13
	movq	8(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_3
## %bb.1:
	callq	_gpiod_get_value
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movl	4(%r15), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_info
	xorl	%r12d, %r12d
	jmp	LBB0_8
LBB0_3:
	movq	8(%r15), %rax
	movq	(%rax), %rax
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	*(%rax)
	movl	4(%rbx), %esi
	movq	%r14, %rdi
	callq	_nand_scan
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	movl	%eax, %r12d
	movl	4(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edx
	callq	_dev_err
	jmp	LBB0_8
LBB0_5:
	xorl	%r12d, %r12d
	movq	%r13, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_mtd_device_register
	testl	%eax, %eax
	je	LBB0_7
## %bb.6:
	movl	%eax, %r13d
	movl	4(%r15), %edi
	leaq	L_.str.2(%rip), %rsi
	movl	%eax, %edx
	callq	_dev_err
	movq	%r14, %rdi
	callq	_nand_cleanup
	movl	%r13d, %r12d
	jmp	LBB0_8
LBB0_7:
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_list_add_tail
LBB0_8:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"No SmartMedia card inserted.\n"

L_.str.1:                               ## @.str.1
	.asciz	"NAND scan failed: %d\n"

L_.str.2:                               ## @.str.2
	.asciz	"Failed to register mtd device: %d\n"

	.no_dead_strip	_atmel_nand_controller_add_nand
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function atmel_nand_controller_add_nand
_atmel_nand_controller_add_nand:        ; @atmel_nand_controller_add_nand
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x21, x1
	mov	x20, x0
	add	x19, x1, #16
	mov	x0, x19
	bl	_nand_to_mtd
	mov	x23, x0
	ldr	x0, [x21, #8]
	cbz	x0, LBB0_3
; %bb.1:
	bl	_gpiod_get_value
	cbz	x0, LBB0_3
; %bb.2:
	ldr	w0, [x20, #4]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_info
	mov	w22, #0
	b	LBB0_8
LBB0_3:
	ldr	x8, [x20, #8]
	ldr	x8, [x8]
	ldr	x8, [x8]
	mov	x0, x20
	mov	x1, x21
	blr	x8
	ldr	w1, [x21, #4]
	mov	x0, x19
	bl	_nand_scan
	cbz	w0, LBB0_5
; %bb.4:
	mov	x22, x0
	ldr	w0, [x20, #4]
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x22
	bl	_dev_err
	b	LBB0_8
LBB0_5:
	mov	x0, x23
	mov	x1, #0
	mov	w2, #0
	bl	_mtd_device_register
	mov	x22, x0
	cbz	w0, LBB0_7
; %bb.6:
	ldr	w0, [x20, #4]
Lloh4:
	adrp	x1, l_.str.2@PAGE
Lloh5:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x2, x22
	bl	_dev_err
	mov	x0, x19
	bl	_nand_cleanup
	b	LBB0_8
LBB0_7:
	mov	x0, x21
	mov	x1, x20
	bl	_list_add_tail
LBB0_8:
	mov	x0, x22
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"No SmartMedia card inserted.\n"

l_.str.1:                               ; @.str.1
	.asciz	"NAND scan failed: %d\n"

l_.str.2:                               ; @.str.2
	.asciz	"Failed to register mtd device: %d\n"

	.no_dead_strip	_atmel_nand_controller_add_nand
.subsections_via_symbols
