	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function __c2port_write_flash_erase
___c2port_write_flash_erase:            ## @__c2port_write_flash_erase
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movq	%rdi, %rbx
	movq	_C2PORT_FPDAT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_c2port_write_ar
	movq	_C2PORT_DEVICE_ERASE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_c2port_write_dr
	movq	%rbx, %rdi
	callq	_c2port_poll_in_busy
	testl	%eax, %eax
	js	LBB0_9
## %bb.1:
	movq	%rbx, %rdi
	callq	_c2port_poll_out_ready
	testl	%eax, %eax
	js	LBB0_9
## %bb.2:
	leaq	-16(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_c2port_read_dr
	testl	%eax, %eax
	js	LBB0_9
## %bb.3:
	movq	-16(%rbp), %rax
	movq	_C2PORT_COMMAND_OK@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.5:
	movq	%rbx, %rdi
	movl	$222, %esi
	callq	_c2port_write_dr
	movq	%rbx, %rdi
	callq	_c2port_poll_in_busy
	testl	%eax, %eax
	js	LBB0_9
## %bb.6:
	movq	%rbx, %rdi
	movl	$173, %esi
	callq	_c2port_write_dr
	movq	%rbx, %rdi
	callq	_c2port_poll_in_busy
	testl	%eax, %eax
	js	LBB0_9
## %bb.7:
	movq	%rbx, %rdi
	movl	$165, %esi
	callq	_c2port_write_dr
	movq	%rbx, %rdi
	callq	_c2port_poll_in_busy
	testl	%eax, %eax
	js	LBB0_9
## %bb.8:
	movq	%rbx, %rdi
	callq	_c2port_poll_out_ready
	movl	%eax, %ecx
	sarl	$31, %eax
	andl	%ecx, %eax
	jmp	LBB0_9
LBB0_4:
	movq	_EBUSY@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_C2PORT_FPDAT,4,2               ## @C2PORT_FPDAT
	.comm	_C2PORT_DEVICE_ERASE,4,2        ## @C2PORT_DEVICE_ERASE
	.comm	_C2PORT_COMMAND_OK,8,3          ## @C2PORT_COMMAND_OK
	.comm	_EBUSY,4,2                      ## @EBUSY
	.no_dead_strip	___c2port_write_flash_erase
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function __c2port_write_flash_erase
___c2port_write_flash_erase:            ; @__c2port_write_flash_erase
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	mov	x19, x0
Lloh0:
	adrp	x8, _C2PORT_FPDAT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _C2PORT_FPDAT@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_c2port_write_ar
Lloh3:
	adrp	x8, _C2PORT_DEVICE_ERASE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _C2PORT_DEVICE_ERASE@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_c2port_write_dr
	mov	x0, x19
	bl	_c2port_poll_in_busy
	tbnz	w0, #31, LBB0_9
; %bb.1:
	mov	x0, x19
	bl	_c2port_poll_out_ready
	tbnz	w0, #31, LBB0_9
; %bb.2:
	add	x1, sp, #8
	mov	x0, x19
	bl	_c2port_read_dr
	tbnz	w0, #31, LBB0_9
; %bb.3:
	ldr	x8, [sp, #8]
Lloh6:
	adrp	x9, _C2PORT_COMMAND_OK@GOTPAGE
Lloh7:
	ldr	x9, [x9, _C2PORT_COMMAND_OK@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_8
; %bb.4:
	mov	x0, x19
	mov	w1, #222
	bl	_c2port_write_dr
	mov	x0, x19
	bl	_c2port_poll_in_busy
	tbnz	w0, #31, LBB0_9
; %bb.5:
	mov	x0, x19
	mov	w1, #173
	bl	_c2port_write_dr
	mov	x0, x19
	bl	_c2port_poll_in_busy
	tbnz	w0, #31, LBB0_9
; %bb.6:
	mov	x0, x19
	mov	w1, #165
	bl	_c2port_write_dr
	mov	x0, x19
	bl	_c2port_poll_in_busy
	tbnz	w0, #31, LBB0_9
; %bb.7:
	mov	x0, x19
	bl	_c2port_poll_out_ready
	cmp	w0, #0
	csel	w0, w0, wzr, lt
	b	LBB0_9
LBB0_8:
Lloh9:
	adrp	x8, _EBUSY@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_9:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_C2PORT_FPDAT,4,2               ; @C2PORT_FPDAT
	.comm	_C2PORT_DEVICE_ERASE,4,2        ; @C2PORT_DEVICE_ERASE
	.comm	_C2PORT_COMMAND_OK,8,3          ; @C2PORT_COMMAND_OK
	.comm	_EBUSY,4,2                      ; @EBUSY
	.no_dead_strip	___c2port_write_flash_erase
.subsections_via_symbols
