	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function i2400m_fw_dnload
_i2400m_fw_dnload:                      ## @i2400m_fw_dnload
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r13d
	movq	%rdx, %r15
	movq	%rsi, %rbx
	movq	%rdi, %r12
	callq	_i2400m_dev
	movl	(%r12), %r14d
	leaq	L_.str(%rip), %rdx
	movl	$5, %edi
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	%rax, %rsi
	movq	%r12, %rcx
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movq	%rbx, %r8
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	%r15, %r9
	callq	_d_fnstart
	movl	$1, 4(%r12)
	xorl	%eax, %eax
	callq	_wmb
	testl	%r14d, %r14d
	je	LBB0_21
## %bb.1:
	decl	%r14d
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_20:                                ##   in Loop: Header=BB0_2 Depth=1
	orl	%r13d, %r15d
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	leaq	L_.str.7(%rip), %rsi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movq	_I2400M_BRI_SOFT@GOTPCREL(%rip), %rax
	orl	(%rax), %r15d
	movl	%r15d, %r13d
	addl	$-1, %r14d
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	jae	LBB0_21
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	_I2400M_BRI_MAC_REINIT@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	testl	%r13d, %r15d
	je	LBB0_5
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%r12, %rdi
	movl	%r13d, %esi
	callq	_i2400m_bootrom_init
	testl	%eax, %eax
	js	LBB0_22
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_I2400M_BRI_MAC_REINIT@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	_EBADF@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	%r12, %rdi
	callq	_i2400m_bcf_hdr_find
	movq	%r12, %rdi
	testq	%rax, %rax
	je	LBB0_17
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%rax, %r12
	movq	%rax, %rsi
	callq	_i2400m_dnload_init
	movl	%eax, %ebx
	movq	_ERESTARTSYS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%ebx, %eax
	je	LBB0_20
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	testl	%ebx, %ebx
	js	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r12), %edi
	callq	_le32_to_cpu
	movslq	%eax, %rdx
	shlq	$2, %rdx
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	callq	_i2400m_dnload_bcf
	movl	%eax, %ebx
	movq	_ERESTARTSYS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%ebx, %eax
	je	LBB0_20
## %bb.10:                              ##   in Loop: Header=BB0_2 Depth=1
	testl	%ebx, %ebx
	js	LBB0_11
## %bb.12:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%r12, %rsi
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	movl	%ebx, %ecx
	callq	_i2400m_dnload_finalize
	movl	%eax, %ebx
	movq	_ERESTARTSYS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%ebx, %eax
	je	LBB0_20
## %bb.13:
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	movl	8(%r12), %ecx
	testl	%ebx, %ebx
	js	LBB0_14
## %bb.16:
	leaq	L_.str.5(%rip), %rdx
	movl	$2, %edi
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rsi
	callq	_d_printf
	movl	$0, 4(%r12)
	xorl	%eax, %eax
	callq	_wmb
	movq	-56(%rbp), %r9                  ## 8-byte Reload
	jmp	LBB0_19
LBB0_21:
	movq	_ERESTARTSYS@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	leaq	L_.str.1(%rip), %rsi
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	movq	-56(%rbp), %r9                  ## 8-byte Reload
	jmp	LBB0_19
LBB0_17:
	negl	%ebx
	movq	-56(%rbp), %r9                  ## 8-byte Reload
	movq	%rdi, %r12
	jmp	LBB0_18
LBB0_22:
	movl	%eax, %ebx
	leaq	L_.str.2(%rip), %rsi
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movq	-56(%rbp), %r9                  ## 8-byte Reload
	jmp	LBB0_19
LBB0_8:
	movq	-56(%rbp), %r9                  ## 8-byte Reload
	movq	-64(%rbp), %r12                 ## 8-byte Reload
LBB0_18:
	movq	-48(%rbp), %r14                 ## 8-byte Reload
LBB0_19:
	movl	%ebx, (%rsp)
	leaq	L_.str.6(%rip), %rdx
	movl	$5, %edi
	movq	%r14, %rsi
	movq	%r12, %rcx
	movq	-72(%rbp), %r8                  ## 8-byte Reload
	callq	_d_fnend
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	movl	8(%r12), %edx
	leaq	L_.str.3(%rip), %rsi
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	jmp	LBB0_15
LBB0_14:
	leaq	L_.str.4(%rip), %rsi
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	movl	%ecx, %edx
LBB0_15:
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	_dev_err
	movq	-56(%rbp), %r9                  ## 8-byte Reload
	jmp	LBB0_19
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"(i2400m %p bcf %p fw size %zu)\n"

	.comm	_ERESTARTSYS,4,2                ## @ERESTARTSYS
L_.str.1:                               ## @.str.1
	.asciz	"device rebooted too many times, aborting\n"

	.comm	_I2400M_BRI_MAC_REINIT,4,2      ## @I2400M_BRI_MAC_REINIT
L_.str.2:                               ## @.str.2
	.asciz	"bootrom init failed: %d\n"

	.comm	_EBADF,4,2                      ## @EBADF
L_.str.3:                               ## @.str.3
	.asciz	"fw %s: download failed: %d\n"

L_.str.4:                               ## @.str.4
	.asciz	"fw %s: download finalization failed: %d\n"

L_.str.5:                               ## @.str.5
	.asciz	"fw %s successfully uploaded\n"

L_.str.6:                               ## @.str.6
	.asciz	"(i2400m %p bcf %p size %zu) = %d\n"

L_.str.7:                               ## @.str.7
	.asciz	"device rebooted, %d tries left\n"

	.comm	_I2400M_BRI_SOFT,4,2            ## @I2400M_BRI_SOFT
	.no_dead_strip	_i2400m_fw_dnload
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function i2400m_fw_dnload
_i2400m_fw_dnload:                      ; @i2400m_fw_dnload
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x23, x3
	mov	x24, x2
	mov	x20, x1
	mov	x21, x0
	bl	_i2400m_dev
	mov	x22, x0
	ldr	w19, [x21]
Lloh0:
	adrp	x2, l_.str@PAGE
Lloh1:
	add	x2, x2, l_.str@PAGEOFF
	mov	w0, #5
	mov	x1, x22
	mov	x3, x21
	mov	x4, x20
	str	x24, [sp, #24]                  ; 8-byte Folded Spill
	mov	x5, x24
	bl	_d_fnstart
	mov	w8, #1
	str	w8, [x21, #4]
	bl	_wmb
Lloh2:
	adrp	x27, _ERESTARTSYS@GOTPAGE
Lloh3:
	ldr	x27, [x27, _ERESTARTSYS@GOTPAGEOFF]
	cbz	w19, LBB0_14
; %bb.1:
	sub	w28, w19, #1
Lloh4:
	adrp	x19, _I2400M_BRI_MAC_REINIT@GOTPAGE
Lloh5:
	ldr	x19, [x19, _I2400M_BRI_MAC_REINIT@GOTPAGEOFF]
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	orr	w23, w25, w23
	str	x28, [sp]
	mov	x0, x22
Lloh6:
	adrp	x1, l_.str.7@PAGE
Lloh7:
	add	x1, x1, l_.str.7@PAGEOFF
	bl	_dev_err
Lloh8:
	adrp	x8, _I2400M_BRI_SOFT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _I2400M_BRI_SOFT@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	orr	w23, w23, w8
	sub	w28, w28, #1
	cmn	w28, #1
	b.eq	LBB0_14
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w25, [x19]
	tst	w25, w23
	b.eq	LBB0_6
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x21
	mov	x1, x23
	bl	_i2400m_bootrom_init
	tbnz	w0, #31, LBB0_18
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w25, [x19]
LBB0_6:                                 ;   in Loop: Header=BB0_3 Depth=1
Lloh11:
	adrp	x8, _EBADF@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EBADF@GOTPAGEOFF]
Lloh13:
	ldr	w24, [x8]
	mov	x0, x21
	bl	_i2400m_bcf_hdr_find
	cbz	x0, LBB0_17
; %bb.7:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x26, x0
	mov	x0, x21
	mov	x1, x26
	bl	_i2400m_dnload_init
	ldr	w8, [x27]
	cmn	w0, w8
	b.eq	LBB0_2
; %bb.8:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x24, x0
	tbnz	w0, #31, LBB0_16
; %bb.9:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w0, [x26]
	bl	_le32_to_cpu
                                        ; kill: def $w0 killed $w0 def $x0
	sbfiz	x2, x0, #2, #32
	mov	x0, x21
	mov	x1, x20
	bl	_i2400m_dnload_bcf
	ldr	w8, [x27]
	cmn	w0, w8
	b.eq	LBB0_2
; %bb.10:                               ;   in Loop: Header=BB0_3 Depth=1
	mov	x24, x0
	tbnz	w0, #31, LBB0_19
; %bb.11:                               ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x21
	mov	x1, x26
	mov	x2, x20
	mov	x3, x24
	bl	_i2400m_dnload_finalize
	ldr	w8, [x27]
	cmn	w0, w8
	b.eq	LBB0_2
; %bb.12:
	mov	x24, x0
	ldr	w3, [x21, #8]
	tbnz	w0, #31, LBB0_20
; %bb.13:
Lloh14:
	adrp	x2, l_.str.5@PAGE
Lloh15:
	add	x2, x2, l_.str.5@PAGEOFF
	mov	w0, #2
	mov	x1, x22
                                        ; kill: def $w3 killed $w3 killed $x3
	bl	_d_printf
	str	wzr, [x21, #4]
	bl	_wmb
	b	LBB0_16
LBB0_14:
	ldr	w8, [x27]
	neg	w24, w8
Lloh16:
	adrp	x1, l_.str.1@PAGE
Lloh17:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_15:
	mov	x0, x22
	bl	_dev_err
LBB0_16:
Lloh18:
	adrp	x2, l_.str.6@PAGE
Lloh19:
	add	x2, x2, l_.str.6@PAGEOFF
	mov	w0, #5
	mov	x1, x22
	mov	x3, x21
	mov	x4, x20
	ldr	x5, [sp, #24]                   ; 8-byte Folded Reload
	mov	x6, x24
	bl	_d_fnend
	mov	x0, x24
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_17:
	neg	w24, w24
	b	LBB0_16
LBB0_18:
	mov	x24, x0
	str	x24, [sp]
Lloh20:
	adrp	x1, l_.str.2@PAGE
Lloh21:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_15
LBB0_19:
	mov	x8, x24
	ldr	w9, [x21, #8]
	stp	x9, x8, [sp]
Lloh22:
	adrp	x1, l_.str.3@PAGE
Lloh23:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_15
LBB0_20:
	mov	x8, x24
	stp	x3, x8, [sp]
Lloh24:
	adrp	x1, l_.str.4@PAGE
Lloh25:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_15
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"(i2400m %p bcf %p fw size %zu)\n"

	.comm	_ERESTARTSYS,4,2                ; @ERESTARTSYS
l_.str.1:                               ; @.str.1
	.asciz	"device rebooted too many times, aborting\n"

	.comm	_I2400M_BRI_MAC_REINIT,4,2      ; @I2400M_BRI_MAC_REINIT
l_.str.2:                               ; @.str.2
	.asciz	"bootrom init failed: %d\n"

	.comm	_EBADF,4,2                      ; @EBADF
l_.str.3:                               ; @.str.3
	.asciz	"fw %s: download failed: %d\n"

l_.str.4:                               ; @.str.4
	.asciz	"fw %s: download finalization failed: %d\n"

l_.str.5:                               ; @.str.5
	.asciz	"fw %s successfully uploaded\n"

l_.str.6:                               ; @.str.6
	.asciz	"(i2400m %p bcf %p size %zu) = %d\n"

l_.str.7:                               ; @.str.7
	.asciz	"device rebooted, %d tries left\n"

	.comm	_I2400M_BRI_SOFT,4,2            ; @I2400M_BRI_SOFT
	.no_dead_strip	_i2400m_fw_dnload
.subsections_via_symbols
