	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function setflashmode
_setflashmode:                          ## @setflashmode
	.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, %rbx
	movq	_FLAG_FLASHING@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	8(%rbx), %r14
	movq	%r14, %rsi
	callq	_set_bit
	movq	_SWS0@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	_FLASH_COMMAND@GOTPCREL(%rip), %r13
	movl	(%r13), %edx
	movq	%rbx, %rdi
	callq	_OUT4500
	movq	_SWS1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r13), %edx
	movq	%rbx, %rdi
	callq	_OUT4500
	movq	_probe@GOTPCREL(%rip), %rax
	movl	$16, %r15d
	cmpq	$0, (%rax)
	jne	LBB0_2
## %bb.1:
	movq	_SWS2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r13), %edx
	movq	%rbx, %rdi
	callq	_OUT4500
	xorl	%r15d, %r15d
	movq	_SWS3@GOTPCREL(%rip), %r12
LBB0_2:
	movl	(%r12), %esi
	movl	(%r13), %edx
	movq	%rbx, %rdi
	callq	_OUT4500
	movq	_COMMAND@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	%r15d, %edx
	callq	_OUT4500
	movl	$500, %edi                      ## imm = 0x1F4
	callq	_msleep
	movq	%rbx, %rdi
	callq	_waitbusy
	movl	%eax, %ecx
	xorl	%eax, %eax
	testl	%ecx, %ecx
	jne	LBB0_4
## %bb.3:
	movq	_FLAG_FLASHING@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r14, %rsi
	callq	_clear_bit
	movq	(%rbx), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_airo_print_info
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_4:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_FLAG_FLASHING,4,2              ## @FLAG_FLASHING
	.comm	_SWS0,4,2                       ## @SWS0
	.comm	_FLASH_COMMAND,4,2              ## @FLASH_COMMAND
	.comm	_SWS1,4,2                       ## @SWS1
	.comm	_probe,8,3                      ## @probe
	.comm	_COMMAND,4,2                    ## @COMMAND
	.comm	_SWS2,4,2                       ## @SWS2
	.comm	_SWS3,4,2                       ## @SWS3
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Waitbusy hang after setflash mode"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_setflashmode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function setflashmode
_setflashmode:                          ; @setflashmode
	.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	x22, _FLAG_FLASHING@GOTPAGE
Lloh1:
	ldr	x22, [x22, _FLAG_FLASHING@GOTPAGEOFF]
	ldr	w0, [x22]
	add	x20, x19, #8
	mov	x1, x20
	bl	_set_bit
Lloh2:
	adrp	x24, _SWS0@GOTPAGE
Lloh3:
	ldr	x24, [x24, _SWS0@GOTPAGEOFF]
	ldr	w1, [x24]
Lloh4:
	adrp	x23, _FLASH_COMMAND@GOTPAGE
Lloh5:
	ldr	x23, [x23, _FLASH_COMMAND@GOTPAGEOFF]
	ldr	w2, [x23]
	mov	x0, x19
	bl	_OUT4500
Lloh6:
	adrp	x8, _SWS1@GOTPAGE
Lloh7:
	ldr	x8, [x8, _SWS1@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	ldr	w2, [x23]
	mov	x0, x19
	bl	_OUT4500
Lloh9:
	adrp	x8, _probe@GOTPAGE
Lloh10:
	ldr	x8, [x8, _probe@GOTPAGEOFF]
Lloh11:
	ldr	x8, [x8]
	cbz	x8, LBB0_2
; %bb.1:
	mov	w21, #16
	b	LBB0_3
LBB0_2:
Lloh12:
	adrp	x8, _SWS2@GOTPAGE
Lloh13:
	ldr	x8, [x8, _SWS2@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	ldr	w2, [x23]
	mov	x0, x19
	bl	_OUT4500
	mov	w21, #0
Lloh15:
	adrp	x24, _SWS3@GOTPAGE
Lloh16:
	ldr	x24, [x24, _SWS3@GOTPAGEOFF]
LBB0_3:
	ldr	w1, [x24]
	ldr	w2, [x23]
	mov	x0, x19
	bl	_OUT4500
Lloh17:
	adrp	x8, _COMMAND@GOTPAGE
Lloh18:
	ldr	x8, [x8, _COMMAND@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x21
	bl	_OUT4500
	mov	w0, #500
	bl	_msleep
	mov	x0, x19
	bl	_waitbusy
	cbz	w0, LBB0_5
; %bb.4:
	mov	w0, #0
	b	LBB0_6
LBB0_5:
	ldr	w0, [x22]
	mov	x1, x20
	bl	_clear_bit
	ldr	x8, [x19]
	ldr	w0, [x8]
Lloh20:
	adrp	x1, l_.str@PAGE
Lloh21:
	add	x1, x1, l_.str@PAGEOFF
	bl	_airo_print_info
Lloh22:
	adrp	x8, _EIO@GOTPAGE
Lloh23:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_6:
	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 AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_FLAG_FLASHING,4,2              ; @FLAG_FLASHING
	.comm	_SWS0,4,2                       ; @SWS0
	.comm	_FLASH_COMMAND,4,2              ; @FLASH_COMMAND
	.comm	_SWS1,4,2                       ; @SWS1
	.comm	_probe,8,3                      ; @probe
	.comm	_COMMAND,4,2                    ; @COMMAND
	.comm	_SWS2,4,2                       ; @SWS2
	.comm	_SWS3,4,2                       ; @SWS3
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Waitbusy hang after setflash mode"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_setflashmode
.subsections_via_symbols
