	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_usb_flashwrite                 ## -- Begin function usb_flashwrite
	.p2align	4, 0x90
_usb_flashwrite:                        ## @usb_flashwrite
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	movq	%rdx, %r15
	movl	%esi, %r12d
	movl	%edi, %ebx
	callq	___usbgecko_exi_wait
	movl	%r12d, %eax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	xorl	%r14d, %r14d
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	%r14, -56(%rbp)                 ## 8-byte Folded Reload
	je	LBB0_2
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	$170, %edx
	movl	%ebx, %edi
	movl	$21845, %esi                    ## imm = 0x5555
	callq	___flashwritecommand
	testl	%eax, %eax
	je	LBB0_9
## %bb.4:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	$85, %edx
	movl	%ebx, %edi
	movl	$10922, %esi                    ## imm = 0x2AAA
	callq	___flashwritecommand
	testl	%eax, %eax
	je	LBB0_9
## %bb.5:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	$160, %edx
	movl	%ebx, %edi
	movl	$21845, %esi                    ## imm = 0x5555
	callq	___flashwritecommand
	testl	%eax, %eax
	je	LBB0_9
## %bb.6:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	leaq	(%rax,%r14), %r13
	movq	(%r15,%r14,8), %rdx
	movl	%ebx, %edi
	movl	%r13d, %esi
	callq	___flashwritecommand
	testl	%eax, %eax
	je	LBB0_9
## %bb.7:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	$20, %edi
	callq	_usleep
	movl	%ebx, %edi
	movl	%r13d, %esi
	leaq	-64(%rbp), %rdx
	callq	___flashreadcommand
	testl	%eax, %eax
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	-64(%rbp), %rax
	leaq	1(%r14), %rcx
	cmpq	(%r15,%r14,8), %rax
	movq	%rcx, %r14
	je	LBB0_1
	jmp	LBB0_9
LBB0_2:
	movl	$1, %r12d
LBB0_9:
	movl	%ebx, %edi
	callq	_EXI_Unlock
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_usb_flashwrite                 ; -- Begin function usb_flashwrite
	.p2align	2
_usb_flashwrite:                        ; @usb_flashwrite
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x20, x3
	mov	x21, x2
	mov	x22, x1
	mov	x19, x0
	bl	___usbgecko_exi_wait
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	cbz	x20, LBB0_10
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	x0, x19
	mov	w1, #21845
	mov	w2, #170
	bl	___flashwritecommand
	cbz	w0, LBB0_8
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	x0, x19
	mov	w1, #10922
	mov	w2, #85
	bl	___flashwritecommand
	cbz	w0, LBB0_8
; %bb.4:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	x0, x19
	mov	w1, #21845
	mov	w2, #160
	bl	___flashwritecommand
	cbz	w0, LBB0_8
; %bb.5:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	x2, [x21]
	mov	x0, x19
	mov	x1, x22
	bl	___flashwritecommand
	cbz	w0, LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	w0, #20
	bl	_usleep
	add	x2, sp, #8
	mov	x0, x19
	mov	x1, x22
	bl	___flashreadcommand
	cbz	w0, LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_1 Depth=1
	add	w22, w22, #1
	ldr	x8, [sp, #8]
	ldr	x9, [x21], #8
	sub	x20, x20, #1
	cmp	x8, x9
	b.eq	LBB0_1
LBB0_8:
	mov	w20, #0
LBB0_9:
	mov	x0, x19
	bl	_EXI_Unlock
	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
	add	sp, sp, #64
	ret
LBB0_10:
	mov	w20, #1
	b	LBB0_9
	.cfi_endproc
                                        ; -- End function
.subsections_via_symbols
