	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function brcmf_usb_dl_writeimage
_brcmf_usb_dl_writeimage:               ## @brcmf_usb_dl_writeimage
	.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	%edx, %ecx
	movq	%rsi, %rbx
	movq	%rdi, %r13
	movq	_USB@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%r12d, %r12d
	movq	%rbx, %rdx
	movl	%ecx, -52(%rbp)                 ## 4-byte Spill
	xorl	%eax, %eax
	callq	_brcmf_dbg
	movq	_TRX_RDL_CHUNK@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_GFP_ATOMIC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kmalloc
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movq	_DL_START@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-48(%rbp), %rdx
	movq	%r13, %rdi
	movl	$8, %ecx
	callq	_brcmf_usb_dl_cmd
	movl	-44(%rbp), %edi
	callq	_le32_to_cpu
	movq	%rax, %rbx
	movl	-48(%rbp), %edi
	callq	_le32_to_cpu
	movq	_DL_WAITING@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rbx
	jne	LBB0_19
## %bb.3:
	movl	-52(%rbp), %r14d                ## 4-byte Reload
	movq	_DL_GETSTATE@GOTPCREL(%rip), %r12
	xorl	%edx, %edx
	movq	%r14, -80(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	%r14, %rax
	je	LBB0_5
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=1
	movl	%edx, %ecx
	cmpq	%rcx, %rax
	jne	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_4 Depth=1
	movl	-52(%rbp), %eax                 ## 4-byte Reload
                                        ## kill: def $eax killed $eax def $rax
	subl	%edx, %eax
	movq	_TRX_RDL_CHUNK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	cmpl	%ecx, %eax
	cmovael	%ecx, %eax
	leal	-4(%rax), %r15d
	testb	$63, %al
	cmovnel	%eax, %r15d
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rsi
	movl	%edx, %r12d
	movl	%r15d, %edx
	callq	_memcpy
	movq	%r13, %rdi
	movq	%r14, %rsi
	movl	%r15d, %edx
	callq	_brcmf_usb_dl_send_bulk
	testq	%rax, %rax
	jne	LBB0_9
## %bb.10:                              ##   in Loop: Header=BB0_4 Depth=1
	movl	%r15d, %eax
	addq	%rax, %rbx
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	addl	%r15d, %r12d
	movl	%r12d, %r15d
	movq	-80(%rbp), %r14                 ## 8-byte Reload
	movq	_DL_GETSTATE@GOTPCREL(%rip), %r12
	jmp	LBB0_11
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_4 Depth=1
	movl	%edx, %r15d
LBB0_11:                                ##   in Loop: Header=BB0_4 Depth=1
	movl	(%r12), %esi
	movq	%r13, %rdi
	leaq	-48(%rbp), %rdx
	movl	$8, %ecx
	callq	_brcmf_usb_dl_cmd
	testl	%eax, %eax
	jne	LBB0_12
## %bb.13:                              ##   in Loop: Header=BB0_4 Depth=1
	movl	-44(%rbp), %edi
	callq	_le32_to_cpu
	movq	%rax, %rbx
	movl	-48(%rbp), %edi
	callq	_le32_to_cpu
	movq	_DL_BAD_HDR@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rbx
	je	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_4 Depth=1
	movl	%r15d, %edx
	movq	_DL_BAD_CRC@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rbx
	jne	LBB0_4
LBB0_15:
	leaq	L_.str.4(%rip), %rdi
	xorl	%r12d, %r12d
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	_brcmf_err
	jmp	LBB0_16
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r12d
	jmp	LBB0_18
LBB0_19:
	leaq	L_.str.1(%rip), %rdi
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	callq	_brcmf_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r12d
	jmp	LBB0_18
LBB0_5:
	movq	_USB@GOTPCREL(%rip), %r15
	xorl	%r12d, %r12d
	jmp	LBB0_18
LBB0_12:
	movl	%eax, %ebx
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_brcmf_err
	movl	%ebx, %r12d
	jmp	LBB0_17
LBB0_9:
	leaq	L_.str.2(%rip), %rdi
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	callq	_brcmf_err
LBB0_16:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r12d
LBB0_17:
	movq	_USB@GOTPCREL(%rip), %r15
LBB0_18:
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_kfree
	movl	(%r15), %edi
	leaq	L_.str.5(%rip), %rsi
	movl	%r12d, %edx
	xorl	%eax, %eax
	callq	_brcmf_dbg
	movl	%r12d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_USB,4,2                        ## @USB
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Enter, fw %p, len %d\n"

	.comm	_TRX_RDL_CHUNK,4,2              ## @TRX_RDL_CHUNK
	.comm	_GFP_ATOMIC,4,2                 ## @GFP_ATOMIC
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_DL_START,4,2                   ## @DL_START
	.comm	_DL_WAITING,8,3                 ## @DL_WAITING
L_.str.1:                               ## @.str.1
	.asciz	"Failed to DL_START\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.2:                               ## @.str.2
	.asciz	"send_bulk failed\n"

	.comm	_DL_GETSTATE,4,2                ## @DL_GETSTATE
L_.str.3:                               ## @.str.3
	.asciz	"DL_GETSTATE Failed\n"

	.comm	_DL_BAD_HDR,8,3                 ## @DL_BAD_HDR
	.comm	_DL_BAD_CRC,8,3                 ## @DL_BAD_CRC
L_.str.4:                               ## @.str.4
	.asciz	"Bad Hdr or Bad CRC state %d\n"

L_.str.5:                               ## @.str.5
	.asciz	"Exit, err=%d\n"

	.no_dead_strip	_brcmf_usb_dl_writeimage
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function brcmf_usb_dl_writeimage
_brcmf_usb_dl_writeimage:               ; @brcmf_usb_dl_writeimage
	.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	x20, x2
	mov	x21, x1
	mov	x22, x0
Lloh0:
	adrp	x24, _USB@GOTPAGE
Lloh1:
	ldr	x24, [x24, _USB@GOTPAGEOFF]
	ldr	w0, [x24]
	stp	x1, x20, [sp]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	bl	_brcmf_dbg
Lloh4:
	adrp	x8, _TRX_RDL_CHUNK@GOTPAGE
Lloh5:
	ldr	x8, [x8, _TRX_RDL_CHUNK@GOTPAGEOFF]
Lloh6:
	ldr	w0, [x8]
Lloh7:
	adrp	x8, _GFP_ATOMIC@GOTPAGE
Lloh8:
	ldr	x8, [x8, _GFP_ATOMIC@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	bl	_kmalloc
	mov	x19, x0
	cbz	x0, LBB0_10
; %bb.1:
Lloh10:
	adrp	x8, _DL_START@GOTPAGE
Lloh11:
	ldr	x8, [x8, _DL_START@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	add	x2, sp, #24
	mov	x0, x22
	mov	w3, #8
	bl	_brcmf_usb_dl_cmd
	ldr	w0, [sp, #28]
	bl	_le32_to_cpu
	mov	x23, x0
	ldr	w0, [sp, #24]
	bl	_le32_to_cpu
Lloh13:
	adrp	x8, _DL_WAITING@GOTPAGE
Lloh14:
	ldr	x8, [x8, _DL_WAITING@GOTPAGEOFF]
Lloh15:
	ldr	x8, [x8]
	cmp	x23, x8
	b.ne	LBB0_11
; %bb.2:
	mov	w26, #0
Lloh16:
	adrp	x27, _DL_GETSTATE@GOTPAGE
Lloh17:
	ldr	x27, [x27, _DL_GETSTATE@GOTPAGEOFF]
Lloh18:
	adrp	x28, _DL_BAD_HDR@GOTPAGE
Lloh19:
	ldr	x28, [x28, _DL_BAD_HDR@GOTPAGEOFF]
Lloh20:
	adrp	x24, _DL_BAD_CRC@GOTPAGE
Lloh21:
	ldr	x24, [x24, _DL_BAD_CRC@GOTPAGEOFF]
	mov	w25, w20
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	cmp	x0, x25
	b.eq	LBB0_13
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	cmp	x0, w26, uxtw
	b.ne	LBB0_7
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
Lloh22:
	adrp	x8, _TRX_RDL_CHUNK@GOTPAGE
Lloh23:
	ldr	x8, [x8, _TRX_RDL_CHUNK@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	sub	w9, w20, w26
	cmp	w9, w8
	csel	w8, w9, w8, lo
	sub	w9, w8, #4
	tst	w8, #0x3f
	csel	w23, w9, w8, eq
	mov	x0, x19
	mov	x1, x21
	mov	x2, x23
	bl	_memcpy
	mov	x0, x22
	mov	x1, x19
	mov	x2, x23
	bl	_brcmf_usb_dl_send_bulk
	cbnz	x0, LBB0_15
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	add	x21, x21, w23, uxtw
	add	w26, w23, w26
LBB0_7:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w1, [x27]
	add	x2, sp, #24
	mov	x0, x22
	mov	w3, #8
	bl	_brcmf_usb_dl_cmd
	cbnz	w0, LBB0_14
; %bb.8:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w0, [sp, #28]
	bl	_le32_to_cpu
	mov	x23, x0
	ldr	w0, [sp, #24]
	bl	_le32_to_cpu
	ldr	x8, [x28]
	ldr	x9, [x24]
	cmp	x23, x8
	ccmp	x23, x9, #4, ne
	b.ne	LBB0_3
; %bb.9:
	str	x23, [sp]
Lloh25:
	adrp	x0, l_.str.4@PAGE
Lloh26:
	add	x0, x0, l_.str.4@PAGEOFF
	b	LBB0_16
LBB0_10:
Lloh27:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh28:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_12
LBB0_11:
Lloh29:
	adrp	x0, l_.str.1@PAGE
Lloh30:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_brcmf_err
Lloh31:
	adrp	x8, _EINVAL@GOTPAGE
Lloh32:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_12:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_18
LBB0_13:
	mov	w23, #0
	b	LBB0_17
LBB0_14:
	mov	x23, x0
Lloh33:
	adrp	x0, l_.str.3@PAGE
Lloh34:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_brcmf_err
	b	LBB0_17
LBB0_15:
Lloh35:
	adrp	x0, l_.str.2@PAGE
Lloh36:
	add	x0, x0, l_.str.2@PAGEOFF
LBB0_16:
	bl	_brcmf_err
Lloh37:
	adrp	x8, _EINVAL@GOTPAGE
Lloh38:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh39:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_17:
Lloh40:
	adrp	x24, _USB@GOTPAGE
Lloh41:
	ldr	x24, [x24, _USB@GOTPAGEOFF]
LBB0_18:
	mov	x0, x19
	bl	_kfree
	ldr	w0, [x24]
	str	x23, [sp]
Lloh42:
	adrp	x1, l_.str.5@PAGE
Lloh43:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_brcmf_dbg
	mov	x0, x23
	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
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpAdd	Lloh33, Lloh34
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh40, Lloh41
	.loh AdrpAdd	Lloh42, Lloh43
	.cfi_endproc
                                        ; -- End function
	.comm	_USB,4,2                        ; @USB
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Enter, fw %p, len %d\n"

	.comm	_TRX_RDL_CHUNK,4,2              ; @TRX_RDL_CHUNK
	.comm	_GFP_ATOMIC,4,2                 ; @GFP_ATOMIC
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_DL_START,4,2                   ; @DL_START
	.comm	_DL_WAITING,8,3                 ; @DL_WAITING
l_.str.1:                               ; @.str.1
	.asciz	"Failed to DL_START\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.2:                               ; @.str.2
	.asciz	"send_bulk failed\n"

	.comm	_DL_GETSTATE,4,2                ; @DL_GETSTATE
l_.str.3:                               ; @.str.3
	.asciz	"DL_GETSTATE Failed\n"

	.comm	_DL_BAD_HDR,8,3                 ; @DL_BAD_HDR
	.comm	_DL_BAD_CRC,8,3                 ; @DL_BAD_CRC
l_.str.4:                               ; @.str.4
	.asciz	"Bad Hdr or Bad CRC state %d\n"

l_.str.5:                               ; @.str.5
	.asciz	"Exit, err=%d\n"

	.no_dead_strip	_brcmf_usb_dl_writeimage
.subsections_via_symbols
