	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function atmel_nfc_wait
_atmel_nfc_wait:                        ## @atmel_nfc_wait
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %ebx
	movq	%rdi, %r14
	testl	%edx, %edx
	jne	LBB0_2
## %bb.1:
	movq	_DEFAULT_TIMEOUT_MS@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_2:
	testl	%esi, %esi
	je	LBB0_4
## %bb.3:
	movl	4(%r14), %r15d
	movq	_ATMEL_HSMC_NFC_SR@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	leaq	8(%r14), %rdi
	callq	_atmel_nfc_op_done
	imull	$1000, %ebx, %r9d               ## imm = 0x3E8
	movl	%r15d, %edi
	movl	%r12d, %esi
	movl	%eax, %ecx
	xorl	%r8d, %r8d
	callq	_regmap_read_poll_timeout
	movl	%eax, %ebx
	jmp	LBB0_5
LBB0_4:
	leaq	16(%r14), %r15
	movq	%r15, %rdi
	callq	_init_completion
	movl	4(%r14), %edi
	movq	_ATMEL_HSMC_NFC_IER@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_ATMEL_HSMC_NFC_SR_ERRORS@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	orl	8(%r14), %edx
	callq	_regmap_write
	movl	%ebx, %edi
	callq	_msecs_to_jiffies
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_wait_for_completion_timeout
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rcx
	xorl	%ebx, %ebx
	subl	(%rcx), %ebx
	xorl	%ecx, %ecx
	testl	%eax, %eax
	cmovnel	%ecx, %ebx
	movl	4(%r14), %edi
	movq	_ATMEL_HSMC_NFC_IDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$-1, %edx
	callq	_regmap_write
LBB0_5:
	movl	12(%r14), %eax
	movq	_ATMEL_HSMC_NFC_SR_DTOE@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_7
## %bb.6:
	movl	(%r14), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movl	12(%r14), %eax
LBB0_7:
	movq	_ATMEL_HSMC_NFC_SR_UNDEF@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_9
## %bb.8:
	movl	(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movl	12(%r14), %eax
LBB0_9:
	movq	_ATMEL_HSMC_NFC_SR_AWB@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_11
## %bb.10:
	movl	(%r14), %edi
	leaq	L_.str.2(%rip), %rsi
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movl	12(%r14), %eax
LBB0_11:
	movq	_ATMEL_HSMC_NFC_SR_NFCASE@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_13
## %bb.12:
	movl	(%r14), %edi
	leaq	L_.str.3(%rip), %rsi
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_13:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DEFAULT_TIMEOUT_MS,4,2         ## @DEFAULT_TIMEOUT_MS
	.comm	_ATMEL_HSMC_NFC_SR,4,2          ## @ATMEL_HSMC_NFC_SR
	.comm	_ATMEL_HSMC_NFC_IER,4,2         ## @ATMEL_HSMC_NFC_IER
	.comm	_ATMEL_HSMC_NFC_SR_ERRORS,4,2   ## @ATMEL_HSMC_NFC_SR_ERRORS
	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.comm	_ATMEL_HSMC_NFC_IDR,4,2         ## @ATMEL_HSMC_NFC_IDR
	.comm	_ATMEL_HSMC_NFC_SR_DTOE,4,2     ## @ATMEL_HSMC_NFC_SR_DTOE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Waiting NAND R/B Timeout\n"

	.comm	_ATMEL_HSMC_NFC_SR_UNDEF,4,2    ## @ATMEL_HSMC_NFC_SR_UNDEF
L_.str.1:                               ## @.str.1
	.asciz	"Access to an undefined area\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_ATMEL_HSMC_NFC_SR_AWB,4,2      ## @ATMEL_HSMC_NFC_SR_AWB
L_.str.2:                               ## @.str.2
	.asciz	"Access while busy\n"

	.comm	_ATMEL_HSMC_NFC_SR_NFCASE,4,2   ## @ATMEL_HSMC_NFC_SR_NFCASE
L_.str.3:                               ## @.str.3
	.asciz	"Wrong access size\n"

	.no_dead_strip	_atmel_nfc_wait
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function atmel_nfc_wait
_atmel_nfc_wait:                        ; @atmel_nfc_wait
	.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	x19, x0
Lloh0:
	adrp	x8, _DEFAULT_TIMEOUT_MS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DEFAULT_TIMEOUT_MS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w2, #0
	csel	w20, w8, w2, eq
Lloh3:
	adrp	x23, _ETIMEDOUT@GOTPAGE
Lloh4:
	ldr	x23, [x23, _ETIMEDOUT@GOTPAGEOFF]
	cbz	w1, LBB0_2
; %bb.1:
	ldr	w21, [x19, #4]
Lloh5:
	adrp	x8, _ATMEL_HSMC_NFC_SR@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ATMEL_HSMC_NFC_SR@GOTPAGEOFF]
Lloh7:
	ldr	w22, [x8]
	add	x0, x19, #8
	bl	_atmel_nfc_op_done
	mov	x3, x0
	mov	w8, #1000
	mul	w5, w20, w8
	mov	x0, x21
	mov	x1, x22
	mov	w4, #0
	bl	_regmap_read_poll_timeout
	mov	x20, x0
	b	LBB0_3
LBB0_2:
	add	x21, x19, #16
	mov	x0, x21
	bl	_init_completion
Lloh8:
	adrp	x8, _ATMEL_HSMC_NFC_IER@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ATMEL_HSMC_NFC_IER@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	ldp	w0, w8, [x19, #4]
Lloh11:
	adrp	x9, _ATMEL_HSMC_NFC_SR_ERRORS@GOTPAGE
Lloh12:
	ldr	x9, [x9, _ATMEL_HSMC_NFC_SR_ERRORS@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	orr	w2, w9, w8
	bl	_regmap_write
	mov	x0, x20
	bl	_msecs_to_jiffies
	mov	x1, x0
	mov	x0, x21
	bl	_wait_for_completion_timeout
	ldr	w8, [x23]
	cmp	w0, #0
	csneg	w20, wzr, w8, ne
	ldr	w0, [x19, #4]
Lloh14:
	adrp	x8, _ATMEL_HSMC_NFC_IDR@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ATMEL_HSMC_NFC_IDR@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	mov	w2, #-1
	bl	_regmap_write
LBB0_3:
	ldr	w8, [x19, #12]
Lloh17:
	adrp	x9, _ATMEL_HSMC_NFC_SR_DTOE@GOTPAGE
Lloh18:
	ldr	x9, [x9, _ATMEL_HSMC_NFC_SR_DTOE@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_5
; %bb.4:
	ldr	w0, [x19]
Lloh20:
	adrp	x1, l_.str@PAGE
Lloh21:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	ldr	w8, [x23]
	neg	w20, w8
	ldr	w8, [x19, #12]
LBB0_5:
Lloh22:
	adrp	x9, _ATMEL_HSMC_NFC_SR_UNDEF@GOTPAGE
Lloh23:
	ldr	x9, [x9, _ATMEL_HSMC_NFC_SR_UNDEF@GOTPAGEOFF]
Lloh24:
	ldr	w9, [x9]
Lloh25:
	adrp	x21, _EIO@GOTPAGE
Lloh26:
	ldr	x21, [x21, _EIO@GOTPAGEOFF]
	tst	w9, w8
	b.eq	LBB0_7
; %bb.6:
	ldr	w0, [x19]
Lloh27:
	adrp	x1, l_.str.1@PAGE
Lloh28:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	ldr	w8, [x21]
	neg	w20, w8
	ldr	w8, [x19, #12]
LBB0_7:
Lloh29:
	adrp	x9, _ATMEL_HSMC_NFC_SR_AWB@GOTPAGE
Lloh30:
	ldr	x9, [x9, _ATMEL_HSMC_NFC_SR_AWB@GOTPAGEOFF]
Lloh31:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_9
; %bb.8:
	ldr	w0, [x19]
Lloh32:
	adrp	x1, l_.str.2@PAGE
Lloh33:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_err
	ldr	w8, [x21]
	neg	w20, w8
	ldr	w8, [x19, #12]
LBB0_9:
Lloh34:
	adrp	x9, _ATMEL_HSMC_NFC_SR_NFCASE@GOTPAGE
Lloh35:
	ldr	x9, [x9, _ATMEL_HSMC_NFC_SR_NFCASE@GOTPAGEOFF]
Lloh36:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_11
; %bb.10:
	ldr	w0, [x19]
Lloh37:
	adrp	x1, l_.str.3@PAGE
Lloh38:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_err
	ldr	w8, [x21]
	neg	w20, w8
LBB0_11:
	mov	x0, x20
	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 AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpAdd	Lloh37, Lloh38
	.cfi_endproc
                                        ; -- End function
	.comm	_DEFAULT_TIMEOUT_MS,4,2         ; @DEFAULT_TIMEOUT_MS
	.comm	_ATMEL_HSMC_NFC_SR,4,2          ; @ATMEL_HSMC_NFC_SR
	.comm	_ATMEL_HSMC_NFC_IER,4,2         ; @ATMEL_HSMC_NFC_IER
	.comm	_ATMEL_HSMC_NFC_SR_ERRORS,4,2   ; @ATMEL_HSMC_NFC_SR_ERRORS
	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.comm	_ATMEL_HSMC_NFC_IDR,4,2         ; @ATMEL_HSMC_NFC_IDR
	.comm	_ATMEL_HSMC_NFC_SR_DTOE,4,2     ; @ATMEL_HSMC_NFC_SR_DTOE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Waiting NAND R/B Timeout\n"

	.comm	_ATMEL_HSMC_NFC_SR_UNDEF,4,2    ; @ATMEL_HSMC_NFC_SR_UNDEF
l_.str.1:                               ; @.str.1
	.asciz	"Access to an undefined area\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_ATMEL_HSMC_NFC_SR_AWB,4,2      ; @ATMEL_HSMC_NFC_SR_AWB
l_.str.2:                               ; @.str.2
	.asciz	"Access while busy\n"

	.comm	_ATMEL_HSMC_NFC_SR_NFCASE,4,2   ; @ATMEL_HSMC_NFC_SR_NFCASE
l_.str.3:                               ; @.str.3
	.asciz	"Wrong access size\n"

	.no_dead_strip	_atmel_nfc_wait
.subsections_via_symbols
