	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function atmel_hsmc_nand_select_chip
_atmel_hsmc_nand_select_chip:           ## @atmel_hsmc_nand_select_chip
	.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
	movl	%esi, %r12d
	movq	%rdi, %rbx
	callq	_nand_to_mtd
	movq	%rax, %r15
	movq	%rbx, %rdi
	callq	_to_atmel_nand
	movq	%rax, %r13
	movl	4(%rbx), %edi
	callq	_to_hsmc_nand_controller
	movq	%rax, %r14
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_atmel_nand_select_chip
	movq	(%r13), %rax
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	(%rax), %rax
	movq	_ATMEL_NAND_NATIVE_RB@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.3:
	movq	_atmel_hsmc_nand_dev_ready@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rbx)
LBB0_4:
	movl	(%r14), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	_ATMEL_HSMC_NFC_CFG@GOTPCREL(%rip), %rax
	movq	_ATMEL_HSMC_NFC_CFG_PAGESIZE_MASK@GOTPCREL(%rip), %rcx
	movq	_ATMEL_HSMC_NFC_CFG_SPARESIZE_MASK@GOTPCREL(%rip), %rdx
	movl	(%rdx), %ebx
	orl	(%rcx), %ebx
	movl	(%rax), %r13d
	movq	_ATMEL_HSMC_NFC_CFG_RSPARE@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movq	_ATMEL_HSMC_NFC_CFG_WSPARE@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movl	4(%r15), %edi
	callq	_ATMEL_HSMC_NFC_CFG_PAGESIZE
	movl	%eax, %r12d
	movl	(%r15), %edi
	callq	_ATMEL_HSMC_NFC_CFG_SPARESIZE
	orl	%eax, %r12d
	movq	_ATMEL_HSMC_NFC_CFG_RSPARE@GOTPCREL(%rip), %rax
	orl	(%rax), %r12d
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	%r13d, %esi
	movl	%ebx, %edx
	movl	%r12d, %ecx
	callq	_regmap_update_bits
	movq	_ATMEL_HSMC_NFC_CTRL_EN@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_1:
	movq	_ATMEL_HSMC_NFC_CTRL_DIS@GOTPCREL(%rip), %rax
LBB0_5:
	movl	(%r14), %edi
	movq	_ATMEL_HSMC_NFC_CTRL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	(%rax), %edx
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_regmap_write                   ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_ATMEL_HSMC_NFC_CTRL,4,2        ## @ATMEL_HSMC_NFC_CTRL
	.comm	_ATMEL_HSMC_NFC_CTRL_DIS,4,2    ## @ATMEL_HSMC_NFC_CTRL_DIS
	.comm	_ATMEL_NAND_NATIVE_RB,8,3       ## @ATMEL_NAND_NATIVE_RB
	.comm	_atmel_hsmc_nand_dev_ready,4,2  ## @atmel_hsmc_nand_dev_ready
	.comm	_ATMEL_HSMC_NFC_CFG,4,2         ## @ATMEL_HSMC_NFC_CFG
	.comm	_ATMEL_HSMC_NFC_CFG_PAGESIZE_MASK,4,2 ## @ATMEL_HSMC_NFC_CFG_PAGESIZE_MASK
	.comm	_ATMEL_HSMC_NFC_CFG_SPARESIZE_MASK,4,2 ## @ATMEL_HSMC_NFC_CFG_SPARESIZE_MASK
	.comm	_ATMEL_HSMC_NFC_CFG_RSPARE,4,2  ## @ATMEL_HSMC_NFC_CFG_RSPARE
	.comm	_ATMEL_HSMC_NFC_CFG_WSPARE,4,2  ## @ATMEL_HSMC_NFC_CFG_WSPARE
	.comm	_ATMEL_HSMC_NFC_CTRL_EN,4,2     ## @ATMEL_HSMC_NFC_CTRL_EN
	.no_dead_strip	_atmel_hsmc_nand_select_chip
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function atmel_hsmc_nand_select_chip
_atmel_hsmc_nand_select_chip:           ; @atmel_hsmc_nand_select_chip
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x22, x1
	mov	x21, x0
	bl	_nand_to_mtd
	mov	x20, x0
	mov	x0, x21
	bl	_to_atmel_nand
	mov	x23, x0
	ldr	w0, [x21, #4]
	bl	_to_hsmc_nand_controller
	mov	x19, x0
	mov	x0, x21
	mov	x1, x22
	bl	_atmel_nand_select_chip
	ldr	x8, [x23]
	cbz	x8, LBB0_4
; %bb.1:
	ldr	x8, [x8]
Lloh0:
	adrp	x9, _ATMEL_NAND_NATIVE_RB@GOTPAGE
Lloh1:
	ldr	x9, [x9, _ATMEL_NAND_NATIVE_RB@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.2:
Lloh3:
	adrp	x8, _atmel_hsmc_nand_dev_ready@GOTPAGE
Lloh4:
	ldr	x8, [x8, _atmel_hsmc_nand_dev_ready@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	str	w8, [x21]
LBB0_3:
Lloh6:
	adrp	x8, _ATMEL_HSMC_NFC_CFG@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ATMEL_HSMC_NFC_CFG@GOTPAGEOFF]
	ldr	w21, [x19]
Lloh8:
	ldr	w22, [x8]
Lloh9:
	adrp	x8, _ATMEL_HSMC_NFC_CFG_PAGESIZE_MASK@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ATMEL_HSMC_NFC_CFG_PAGESIZE_MASK@GOTPAGEOFF]
Lloh11:
	adrp	x9, _ATMEL_HSMC_NFC_CFG_SPARESIZE_MASK@GOTPAGE
Lloh12:
	ldr	x9, [x9, _ATMEL_HSMC_NFC_CFG_SPARESIZE_MASK@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
Lloh14:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh15:
	adrp	x25, _ATMEL_HSMC_NFC_CFG_RSPARE@GOTPAGE
Lloh16:
	ldr	x25, [x25, _ATMEL_HSMC_NFC_CFG_RSPARE@GOTPAGEOFF]
	ldr	w9, [x25]
	orr	w8, w8, w9
Lloh17:
	adrp	x9, _ATMEL_HSMC_NFC_CFG_WSPARE@GOTPAGE
Lloh18:
	ldr	x9, [x9, _ATMEL_HSMC_NFC_CFG_WSPARE@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	orr	w23, w8, w9
	ldr	w0, [x20, #4]
	bl	_ATMEL_HSMC_NFC_CFG_PAGESIZE
	mov	x24, x0
	ldr	w0, [x20]
	bl	_ATMEL_HSMC_NFC_CFG_SPARESIZE
	orr	w8, w0, w24
	ldr	w9, [x25]
	orr	w3, w8, w9
	mov	x0, x21
	mov	x1, x22
	mov	x2, x23
	bl	_regmap_update_bits
Lloh20:
	adrp	x8, _ATMEL_HSMC_NFC_CTRL_EN@GOTPAGE
Lloh21:
	ldr	x8, [x8, _ATMEL_HSMC_NFC_CTRL_EN@GOTPAGEOFF]
	b	LBB0_5
LBB0_4:
Lloh22:
	adrp	x8, _ATMEL_HSMC_NFC_CTRL_DIS@GOTPAGE
Lloh23:
	ldr	x8, [x8, _ATMEL_HSMC_NFC_CTRL_DIS@GOTPAGEOFF]
LBB0_5:
Lloh24:
	adrp	x9, _ATMEL_HSMC_NFC_CTRL@GOTPAGE
Lloh25:
	ldr	x9, [x9, _ATMEL_HSMC_NFC_CTRL@GOTPAGEOFF]
	ldr	w0, [x19]
Lloh26:
	ldr	w1, [x9]
	ldr	w2, [x8]
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_regmap_write
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh13
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_ATMEL_HSMC_NFC_CTRL,4,2        ; @ATMEL_HSMC_NFC_CTRL
	.comm	_ATMEL_HSMC_NFC_CTRL_DIS,4,2    ; @ATMEL_HSMC_NFC_CTRL_DIS
	.comm	_ATMEL_NAND_NATIVE_RB,8,3       ; @ATMEL_NAND_NATIVE_RB
	.comm	_atmel_hsmc_nand_dev_ready,4,2  ; @atmel_hsmc_nand_dev_ready
	.comm	_ATMEL_HSMC_NFC_CFG,4,2         ; @ATMEL_HSMC_NFC_CFG
	.comm	_ATMEL_HSMC_NFC_CFG_PAGESIZE_MASK,4,2 ; @ATMEL_HSMC_NFC_CFG_PAGESIZE_MASK
	.comm	_ATMEL_HSMC_NFC_CFG_SPARESIZE_MASK,4,2 ; @ATMEL_HSMC_NFC_CFG_SPARESIZE_MASK
	.comm	_ATMEL_HSMC_NFC_CFG_RSPARE,4,2  ; @ATMEL_HSMC_NFC_CFG_RSPARE
	.comm	_ATMEL_HSMC_NFC_CFG_WSPARE,4,2  ; @ATMEL_HSMC_NFC_CFG_WSPARE
	.comm	_ATMEL_HSMC_NFC_CTRL_EN,4,2     ; @ATMEL_HSMC_NFC_CTRL_EN
	.no_dead_strip	_atmel_hsmc_nand_select_chip
.subsections_via_symbols
