	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function wl1271_boot_upload_firmware_chunk
_wl1271_boot_upload_firmware_chunk:     ## @wl1271_boot_upload_firmware_chunk
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
                                        ## kill: def $ecx killed $ecx def $rcx
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	movq	%rdx, %r12
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r15
	movq	_DEBUG_BOOT@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%r13d, %r13d
	xorl	%eax, %eax
	callq	_wl1271_debug
	movl	(%rbx), %edi
	movq	_CHUNK_SIZE@GOTPCREL(%rip), %r14
	movq	(%r14), %rcx
	leaq	L_.str.1(%rip), %rsi
	movq	%r12, %rdx
	xorl	%eax, %eax
	callq	_wl1271_debug
	movq	%r12, -48(%rbp)                 ## 8-byte Spill
	testb	$3, %r12b
	je	LBB0_2
## %bb.1:
	leaq	L_.str.2(%rip), %rdi
	callq	_wl1271_error
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %r13d
	jmp	LBB0_30
LBB0_2:
	movq	(%r14), %rdi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%rax, %rbx
	movq	_PART_DOWN@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	shlq	$3, %rsi
	addq	(%r15), %rsi
	leaq	-96(%rbp), %r13
	movl	$8, %edx
	movq	%r13, %rdi
	callq	_memcpy
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	%eax, -96(%rbp)
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_wlcore_set_partition
	testl	%eax, %eax
	js	LBB0_28
## %bb.5:
	movq	_CHUNK_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	cmpq	-48(%rbp), %rcx                 ## 8-byte Folded Reload
	jbe	LBB0_7
## %bb.6:
	xorl	%edi, %edi
	movq	-64(%rbp), %r13                 ## 8-byte Reload
	jmp	LBB0_18
LBB0_3:
	leaq	L_.str.3(%rip), %rdi
	callq	_wl1271_error
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_30
LBB0_7:
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movq	%r15, -88(%rbp)                 ## 8-byte Spill
	movq	(%r15), %rax
	movq	_PART_DOWN@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movl	4(%rax,%rdx,8), %r14d
	xorl	%r15d, %r15d
	movq	-64(%rbp), %r13                 ## 8-byte Reload
	movq	-80(%rbp), %r12                 ## 8-byte Reload
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_8 Depth=1
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	xorl	%edx, %edx
	divq	%rcx
LBB0_16:                                ##   in Loop: Header=BB0_8 Depth=1
	movq	-64(%rbp), %r13                 ## 8-byte Reload
	movl	-68(%rbp), %r14d                ## 4-byte Reload
	cmpq	%r15, %rax
	jbe	LBB0_17
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	leal	2(%r15), %eax
	imull	%ecx, %eax
	addl	%r13d, %eax
	cmpl	%r14d, %eax
	jle	LBB0_12
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	movl	%r15d, %ebx
	imull	%ecx, %ebx
	leal	(%rbx,%r13), %eax
	movq	-88(%rbp), %rdi                 ## 8-byte Reload
	movq	(%rdi), %rcx
	movq	_PART_DOWN@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movl	4(%rcx,%rdx,8), %r14d
	movl	%eax, -96(%rbp)
	leaq	-96(%rbp), %rsi
	callq	_wlcore_set_partition
	testl	%eax, %eax
	js	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_8 Depth=1
	addl	%ebx, %r14d
	movq	_CHUNK_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	-64(%rbp), %r13                 ## 8-byte Reload
LBB0_12:                                ##   in Loop: Header=BB0_8 Depth=1
	movl	%r14d, -68(%rbp)                ## 4-byte Spill
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movq	%rcx, %rbx
	imulq	%r15, %rbx
	addl	%ebx, %r13d
	addq	-56(%rbp), %rbx                 ## 8-byte Folded Reload
	movq	%r12, %rdi
	movq	%rbx, %rsi
	movq	%rcx, %rdx
	callq	_memcpy
	movq	_DEBUG_BOOT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.4(%rip), %rsi
	movq	%rbx, %rdx
	movl	%r13d, %ecx
	xorl	%eax, %eax
	callq	_wl1271_debug
	movq	_CHUNK_SIZE@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rcx
	movq	-88(%rbp), %rdi                 ## 8-byte Reload
	movl	%r13d, %esi
	movq	%r12, %rdx
	xorl	%r8d, %r8d
	callq	_wlcore_write
	testl	%eax, %eax
	js	LBB0_10
## %bb.13:                              ##   in Loop: Header=BB0_8 Depth=1
	incq	%r15
	movq	(%rbx), %rcx
	orq	%rcx, %r14
	shrq	$32, %r14
	jne	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	-48(%rbp), %rax                 ## 8-byte Reload
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $eax killed $eax def $rax
	jmp	LBB0_16
LBB0_10:
	movl	%eax, %r13d
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_29
LBB0_17:
	movl	%r15d, %edi
	movq	-88(%rbp), %r15                 ## 8-byte Reload
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
LBB0_18:
	imulq	%rcx, %rdi
	addq	%rdi, -56(%rbp)                 ## 8-byte Folded Spill
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	orq	%rcx, %rax
	shrq	$32, %rax
	movq	_DEBUG_BOOT@GOTPCREL(%rip), %r14
	je	LBB0_19
## %bb.20:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	xorl	%edx, %edx
	divq	%rcx
	jmp	LBB0_21
LBB0_19:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $edx killed $edx def $rdx
LBB0_21:
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	addl	%edi, %r13d
	movq	%rbx, %rdi
	callq	_memcpy
	movl	(%r14), %edi
	movq	_CHUNK_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	orq	%rcx, %rax
	shrq	$32, %rax
	je	LBB0_22
## %bb.23:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	xorl	%edx, %edx
	divq	%rcx
	jmp	LBB0_24
LBB0_22:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $edx killed $edx def $rdx
LBB0_24:
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	leaq	L_.str.5(%rip), %rsi
	movl	%r13d, %r8d
	xorl	%eax, %eax
	callq	_wl1271_debug
	movq	_CHUNK_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	orq	%rcx, %rax
	shrq	$32, %rax
	je	LBB0_25
## %bb.26:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	xorl	%edx, %edx
	divq	%rcx
	movq	%rdx, %rcx
	jmp	LBB0_27
LBB0_25:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
	movl	%edx, %ecx
LBB0_27:
	movq	%r15, %rdi
	movl	%r13d, %esi
	movq	%rbx, %rdx
	xorl	%r8d, %r8d
	callq	_wlcore_write
LBB0_28:
	movl	%eax, %r13d
LBB0_29:
	movq	%rbx, %rdi
	callq	_kfree
LBB0_30:
	movl	%r13d, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DEBUG_BOOT,4,2                 ## @DEBUG_BOOT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"starting firmware upload"

L_.str.1:                               ## @.str.1
	.asciz	"fw_data_len %zd chunk_size %d"

	.comm	_CHUNK_SIZE,8,3                 ## @CHUNK_SIZE
L_.str.2:                               ## @.str.2
	.asciz	"firmware length not multiple of four"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.3:                               ## @.str.3
	.asciz	"allocation for firmware upload chunk failed"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_PART_DOWN,8,3                  ## @PART_DOWN
L_.str.4:                               ## @.str.4
	.asciz	"uploading fw chunk 0x%p to 0x%x"

L_.str.5:                               ## @.str.5
	.asciz	"uploading fw last chunk (%zd B) 0x%p to 0x%x"

	.no_dead_strip	_wl1271_boot_upload_firmware_chunk
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function wl1271_boot_upload_firmware_chunk
_wl1271_boot_upload_firmware_chunk:     ; @wl1271_boot_upload_firmware_chunk
	.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	x22, x3
	mov	x20, x2
	mov	x23, x1
	mov	x19, x0
Lloh0:
	adrp	x24, _DEBUG_BOOT@GOTPAGE
Lloh1:
	ldr	x24, [x24, _DEBUG_BOOT@GOTPAGEOFF]
	ldr	w0, [x24]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	bl	_wl1271_debug
	ldr	w0, [x24]
Lloh4:
	adrp	x27, _CHUNK_SIZE@GOTPAGE
Lloh5:
	ldr	x27, [x27, _CHUNK_SIZE@GOTPAGEOFF]
	ldr	x8, [x27]
	stp	x20, x8, [sp]
Lloh6:
	adrp	x1, l_.str.1@PAGE
Lloh7:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_wl1271_debug
	tst	x20, #0x3
	b.eq	LBB0_3
; %bb.1:
Lloh8:
	adrp	x0, l_.str.2@PAGE
Lloh9:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_wl1271_error
Lloh10:
	adrp	x8, _EIO@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_2:
	ldr	w8, [x8]
	neg	w25, w8
	b	LBB0_17
LBB0_3:
	ldr	x0, [x27]
Lloh12:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	bl	_kmalloc
	cbz	x0, LBB0_7
; %bb.4:
	mov	x21, x0
	ldr	x8, [x19]
Lloh15:
	adrp	x9, _PART_DOWN@GOTPAGE
Lloh16:
	ldr	x9, [x9, _PART_DOWN@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	add	x1, x8, x9, lsl #3
	add	x0, sp, #24
	mov	w2, #8
	bl	_memcpy
	str	w22, [sp, #24]
	add	x1, sp, #24
	mov	x0, x19
	bl	_wlcore_set_partition
	tbnz	w0, #31, LBB0_16
; %bb.5:
	ldr	x2, [x27]
	cmp	x2, x20
	b.ls	LBB0_8
; %bb.6:
	mov	x8, #0
	b	LBB0_15
LBB0_7:
Lloh18:
	adrp	x0, l_.str.3@PAGE
Lloh19:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_wl1271_error
Lloh20:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh21:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_2
LBB0_8:
	mov	x24, #0
	ldr	x8, [x19]
Lloh22:
	adrp	x9, _PART_DOWN@GOTPAGE
Lloh23:
	ldr	x9, [x9, _PART_DOWN@GOTPAGEOFF]
Lloh24:
	ldr	x9, [x9]
	add	x8, x8, x9, lsl #3
	ldr	w28, [x8, #4]
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	add	w8, w24, #2
	madd	w8, w8, w2, w22
	cmp	w8, w28
	b.le	LBB0_12
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	mul	w26, w24, w2
	add	w8, w26, w22
	ldr	x9, [x19]
Lloh25:
	adrp	x10, _PART_DOWN@GOTPAGE
Lloh26:
	ldr	x10, [x10, _PART_DOWN@GOTPAGEOFF]
Lloh27:
	ldr	x10, [x10]
	add	x9, x9, x10, lsl #3
	ldr	w28, [x9, #4]
	str	w8, [sp, #24]
	add	x1, sp, #24
	mov	x0, x19
	bl	_wlcore_set_partition
	tbnz	w0, #31, LBB0_16
; %bb.11:                               ;   in Loop: Header=BB0_9 Depth=1
	add	w28, w28, w26
	ldr	x2, [x27]
LBB0_12:                                ;   in Loop: Header=BB0_9 Depth=1
	mul	x8, x2, x24
	add	w25, w8, w22
	add	x26, x23, x8
	mov	x0, x21
	mov	x1, x26
	bl	_memcpy
Lloh28:
	adrp	x8, _DEBUG_BOOT@GOTPAGE
Lloh29:
	ldr	x8, [x8, _DEBUG_BOOT@GOTPAGEOFF]
Lloh30:
	ldr	w0, [x8]
	stp	x26, x25, [sp]
Lloh31:
	adrp	x1, l_.str.4@PAGE
Lloh32:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_wl1271_debug
	ldr	x3, [x27]
	mov	x0, x19
	mov	x1, x25
	mov	x2, x21
	mov	w4, #0
	bl	_wlcore_write
	tbnz	w0, #31, LBB0_16
; %bb.13:                               ;   in Loop: Header=BB0_9 Depth=1
	add	x24, x24, #1
	ldr	x2, [x27]
	udiv	x8, x20, x2
	cmp	x8, x24
	b.hi	LBB0_9
; %bb.14:
	and	x8, x24, #0xffffffff
Lloh33:
	adrp	x24, _DEBUG_BOOT@GOTPAGE
Lloh34:
	ldr	x24, [x24, _DEBUG_BOOT@GOTPAGEOFF]
LBB0_15:
	mul	x8, x2, x8
	add	w22, w8, w22
	add	x23, x23, x8
	udiv	x8, x20, x2
	msub	x2, x8, x2, x20
	mov	x0, x21
	mov	x1, x23
	bl	_memcpy
	ldr	w0, [x24]
	ldr	x8, [x27]
	udiv	x9, x20, x8
	msub	x8, x9, x8, x20
	stp	x23, x22, [sp, #8]
	str	x8, [sp]
Lloh35:
	adrp	x1, l_.str.5@PAGE
Lloh36:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_wl1271_debug
	ldr	x8, [x27]
	udiv	x9, x20, x8
	msub	x3, x9, x8, x20
	mov	x0, x19
	mov	x1, x22
	mov	x2, x21
	mov	w4, #0
	bl	_wlcore_write
LBB0_16:
	mov	x25, x0
	mov	x0, x21
	bl	_kfree
LBB0_17:
	mov	x0, x25
	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 AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpAdd	Lloh35, Lloh36
	.cfi_endproc
                                        ; -- End function
	.comm	_DEBUG_BOOT,4,2                 ; @DEBUG_BOOT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"starting firmware upload"

l_.str.1:                               ; @.str.1
	.asciz	"fw_data_len %zd chunk_size %d"

	.comm	_CHUNK_SIZE,8,3                 ; @CHUNK_SIZE
l_.str.2:                               ; @.str.2
	.asciz	"firmware length not multiple of four"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.3:                               ; @.str.3
	.asciz	"allocation for firmware upload chunk failed"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_PART_DOWN,8,3                  ; @PART_DOWN
l_.str.4:                               ; @.str.4
	.asciz	"uploading fw chunk 0x%p to 0x%x"

l_.str.5:                               ; @.str.5
	.asciz	"uploading fw last chunk (%zd B) 0x%p to 0x%x"

	.no_dead_strip	_wl1271_boot_upload_firmware_chunk
.subsections_via_symbols
