	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sm_register_device             ## -- Begin function sm_register_device
	.p2align	4, 0x90
_sm_register_device:                    ## @sm_register_device
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %ebx
	movq	%rdi, %r14
	callq	_mtd_to_nand
	movq	%rax, %r15
	movq	_NAND_SKIP_BBTSCAN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 8(%r15)
	movq	_sm_controller_ops@GOTPCREL(%rip), %rax
	movq	%rax, (%r15)
	testl	%ebx, %ebx
	jne	LBB0_1
## %bb.2:
	movq	_nand_xd_flash_ids@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_1:
	movq	_nand_smartmedia_flash_ids@GOTPCREL(%rip), %rax
LBB0_3:
	movq	(%rax), %rdx
	movq	%r15, %rdi
	movl	$1, %esi
	callq	_nand_scan_with_ids
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_6
## %bb.4:
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_mtd_device_register
	testl	%eax, %eax
	je	LBB0_6
## %bb.5:
	movl	%eax, %r14d
	movq	%r15, %rdi
	callq	_nand_cleanup
	movl	%r14d, %ebx
LBB0_6:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_SKIP_BBTSCAN,4,2          ## @NAND_SKIP_BBTSCAN
	.comm	_sm_controller_ops,4,2          ## @sm_controller_ops
	.comm	_nand_smartmedia_flash_ids,8,3  ## @nand_smartmedia_flash_ids
	.comm	_nand_xd_flash_ids,8,3          ## @nand_xd_flash_ids
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sm_register_device             ; -- Begin function sm_register_device
	.p2align	2
_sm_register_device:                    ; @sm_register_device
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x21, x1
	mov	x20, x0
	bl	_mtd_to_nand
	mov	x19, x0
Lloh0:
	adrp	x8, _NAND_SKIP_BBTSCAN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NAND_SKIP_BBTSCAN@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	ldr	w9, [x0, #8]
	orr	w8, w9, w8
	str	w8, [x0, #8]
Lloh3:
	adrp	x8, _sm_controller_ops@GOTPAGE
Lloh4:
	ldr	x8, [x8, _sm_controller_ops@GOTPAGEOFF]
Lloh5:
	adrp	x9, _nand_smartmedia_flash_ids@GOTPAGE
Lloh6:
	ldr	x9, [x9, _nand_smartmedia_flash_ids@GOTPAGEOFF]
	str	x8, [x0]
Lloh7:
	adrp	x8, _nand_xd_flash_ids@GOTPAGE
Lloh8:
	ldr	x8, [x8, _nand_xd_flash_ids@GOTPAGEOFF]
	cmp	w21, #0
	csel	x8, x8, x9, eq
	ldr	x2, [x8]
	mov	w1, #1
	bl	_nand_scan_with_ids
	mov	x21, x0
	cbnz	w0, LBB0_3
; %bb.1:
	mov	x0, x20
	mov	x1, #0
	mov	w2, #0
	bl	_mtd_device_register
	mov	x21, x0
	cbz	w0, LBB0_3
; %bb.2:
	mov	x0, x19
	bl	_nand_cleanup
LBB0_3:
	mov	x0, x21
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_SKIP_BBTSCAN,4,2          ; @NAND_SKIP_BBTSCAN
	.comm	_sm_controller_ops,4,2          ; @sm_controller_ops
	.comm	_nand_smartmedia_flash_ids,8,3  ; @nand_smartmedia_flash_ids
	.comm	_nand_xd_flash_ids,8,3          ; @nand_xd_flash_ids
.subsections_via_symbols
