	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cyapa_gen3_bl_enter
_cyapa_gen3_bl_enter:                   ## @cyapa_gen3_bl_enter
	.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	%rdi, %r13
	movl	$500, %esi                      ## imm = 0x1F4
	callq	_cyapa_poll_state
	testl	%eax, %eax
	jne	LBB0_16
## %bb.1:
	movq	(%r13), %rcx
	movq	_CYAPA_STATE_BL_IDLE@GOTPCREL(%rip), %r14
	xorl	%eax, %eax
	cmpq	(%r14), %rcx
	je	LBB0_16
## %bb.2:
	movq	_CYAPA_STATE_OP@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rcx
	jne	LBB0_14
## %bb.3:
	movl	$0, 8(%r13)
	movq	_CYAPA_STATE_NO_DEVICE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%r13)
	movq	_CYAPA_CMD_SOFT_RESET@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movl	$1, %edx
	callq	_cyapa_write_byte
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	movq	_EIO@GOTPCREL(%rip), %rcx
	jmp	LBB0_15
LBB0_5:
	movl	$25000, %edi                    ## imm = 0x61A8
	movl	$50000, %esi                    ## imm = 0xC350
	callq	_usleep_range
	movl	$2000, %ebx                     ## imm = 0x7D0
	movq	_BL_STATUS_WATCHDOG@GOTPCREL(%rip), %r12
	movq	_ETIMEDOUT@GOTPCREL(%rip), %r15
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_6 Depth=1
	movl	$100, %edi
	callq	_msleep
	movl	$-100, %ecx
LBB0_11:                                ##   in Loop: Header=BB0_6 Depth=1
	addl	%ecx, %ebx
	jle	LBB0_12
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	movl	$500, %esi                      ## imm = 0x1F4
	callq	_cyapa_poll_state
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	$-500, %ecx                     ## imm = 0xFE0C
	movl	(%r15), %edx
	addl	%eax, %edx
	je	LBB0_11
	jmp	LBB0_16
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_6 Depth=1
	movq	(%r13), %rax
	cmpq	(%r14), %rax
	jne	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	16(%r13), %rax
	movq	_REG_BL_STATUS@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%r12), %edx
	testl	%edx, (%rax,%rcx,4)
	jne	LBB0_10
	jmp	LBB0_13
LBB0_12:
	movq	(%r13), %rax
	cmpq	(%r14), %rax
	jne	LBB0_14
LBB0_13:
	movq	16(%r13), %rcx
	movq	_REG_BL_STATUS@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movl	(%r12), %esi
	movl	$0, %eax
	testl	%esi, (%rcx,%rdx,4)
	je	LBB0_16
LBB0_14:
	movq	_EAGAIN@GOTPCREL(%rip), %rcx
LBB0_15:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_16:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CYAPA_STATE_BL_IDLE,8,3        ## @CYAPA_STATE_BL_IDLE
	.comm	_CYAPA_STATE_OP,8,3             ## @CYAPA_STATE_OP
	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.comm	_CYAPA_STATE_NO_DEVICE,8,3      ## @CYAPA_STATE_NO_DEVICE
	.comm	_CYAPA_CMD_SOFT_RESET,4,2       ## @CYAPA_CMD_SOFT_RESET
	.comm	_EIO,4,2                        ## @EIO
	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.comm	_REG_BL_STATUS,8,3              ## @REG_BL_STATUS
	.comm	_BL_STATUS_WATCHDOG,4,2         ## @BL_STATUS_WATCHDOG
	.no_dead_strip	_cyapa_gen3_bl_enter
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cyapa_gen3_bl_enter
_cyapa_gen3_bl_enter:                   ; @cyapa_gen3_bl_enter
	.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
	mov	w1, #500
	bl	_cyapa_poll_state
	cbnz	w0, LBB0_18
; %bb.1:
	ldr	x8, [x19]
Lloh0:
	adrp	x20, _CYAPA_STATE_BL_IDLE@GOTPAGE
Lloh1:
	ldr	x20, [x20, _CYAPA_STATE_BL_IDLE@GOTPAGEOFF]
	ldr	x9, [x20]
	cmp	x8, x9
	b.ne	LBB0_3
LBB0_2:
	mov	w0, #0
	b	LBB0_18
LBB0_3:
Lloh2:
	adrp	x9, _CYAPA_STATE_OP@GOTPAGE
Lloh3:
	ldr	x9, [x9, _CYAPA_STATE_OP@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_16
; %bb.4:
Lloh5:
	adrp	x8, _CYAPA_STATE_NO_DEVICE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _CYAPA_STATE_NO_DEVICE@GOTPAGEOFF]
	str	wzr, [x19, #8]
Lloh7:
	ldr	x8, [x8]
	str	x8, [x19]
Lloh8:
	adrp	x8, _CYAPA_CMD_SOFT_RESET@GOTPAGE
Lloh9:
	ldr	x8, [x8, _CYAPA_CMD_SOFT_RESET@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #1
	bl	_cyapa_write_byte
	cbz	w0, LBB0_6
; %bb.5:
Lloh11:
	adrp	x8, _EIO@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_17
LBB0_6:
	mov	w0, #25000
	mov	w1, #50000
	bl	_usleep_range
	mov	w23, #2000
Lloh13:
	adrp	x22, _REG_BL_STATUS@GOTPAGE
Lloh14:
	ldr	x22, [x22, _REG_BL_STATUS@GOTPAGEOFF]
Lloh15:
	adrp	x21, _BL_STATUS_WATCHDOG@GOTPAGE
Lloh16:
	ldr	x21, [x21, _BL_STATUS_WATCHDOG@GOTPAGEOFF]
Lloh17:
	adrp	x24, _ETIMEDOUT@GOTPAGE
Lloh18:
	ldr	x24, [x24, _ETIMEDOUT@GOTPAGEOFF]
	b	LBB0_9
LBB0_7:                                 ;   in Loop: Header=BB0_9 Depth=1
	mov	w0, #100
	bl	_msleep
	mov	w8, #-100
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=1
	add	w23, w23, w8
	cmp	w23, #0
	b.le	LBB0_14
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	w1, #500
	bl	_cyapa_poll_state
	cbz	w0, LBB0_12
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	ldr	w8, [x24]
	cmn	w0, w8
	b.ne	LBB0_18
; %bb.11:                               ;   in Loop: Header=BB0_9 Depth=1
	mov	w8, #-500
	b	LBB0_8
LBB0_12:                                ;   in Loop: Header=BB0_9 Depth=1
	ldr	x8, [x19]
	ldr	x9, [x20]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.13:                               ;   in Loop: Header=BB0_9 Depth=1
	ldr	x8, [x19, #16]
	ldr	x9, [x22]
	ldr	w8, [x8, x9, lsl #2]
	ldr	w9, [x21]
	tst	w9, w8
	b.ne	LBB0_7
	b	LBB0_15
LBB0_14:
	ldr	x8, [x19]
	ldr	x9, [x20]
	cmp	x8, x9
	b.ne	LBB0_16
LBB0_15:
	ldr	x8, [x19, #16]
	ldr	x9, [x22]
	ldr	w8, [x8, x9, lsl #2]
	ldr	w9, [x21]
	tst	w9, w8
	b.eq	LBB0_2
LBB0_16:
Lloh19:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
LBB0_17:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_18:
	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	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_CYAPA_STATE_BL_IDLE,8,3        ; @CYAPA_STATE_BL_IDLE
	.comm	_CYAPA_STATE_OP,8,3             ; @CYAPA_STATE_OP
	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.comm	_CYAPA_STATE_NO_DEVICE,8,3      ; @CYAPA_STATE_NO_DEVICE
	.comm	_CYAPA_CMD_SOFT_RESET,4,2       ; @CYAPA_CMD_SOFT_RESET
	.comm	_EIO,4,2                        ; @EIO
	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.comm	_REG_BL_STATUS,8,3              ; @REG_BL_STATUS
	.comm	_BL_STATUS_WATCHDOG,4,2         ; @BL_STATUS_WATCHDOG
	.no_dead_strip	_cyapa_gen3_bl_enter
.subsections_via_symbols
