	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ath6kl_upload_board_file
_ath6kl_upload_board_file:              ## @ath6kl_upload_board_file
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	xorl	%edi, %edi
	cmpq	$0, 24(%r15)
	sete	%dil
	callq	_WARN_ON
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	movq	_ENOENT@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
LBB0_28:
	subl	(%rax), %ebx
	jmp	LBB0_29
LBB0_3:
	movq	32(%r15), %rdx
	testq	%rdx, %rdx
	je	LBB0_7
## %bb.4:
	movq	%rdx, -40(%rbp)
	movq	_hi_board_data@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_ath6kl_bmi_write_hi32
LBB0_5:
	movq	_hi_board_ext_data@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-48(%rbp), %rdx
	movq	%r15, %rdi
	callq	_ath6kl_bmi_read_hi32
	testl	%eax, %eax
	je	LBB0_10
## %bb.6:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_9
LBB0_7:
	movq	_hi_board_data@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-40(%rbp), %rdx
	movq	%r15, %rdi
	callq	_ath6kl_bmi_read_hi32
	testl	%eax, %eax
	je	LBB0_5
## %bb.8:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rdi
LBB0_9:
	xorl	%eax, %eax
	callq	_ath6kl_err
LBB0_29:
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	movl	(%r15), %eax
	movq	-48(%rbp), %rdx
	cmpl	$129, %eax
	jne	LBB0_13
## %bb.11:
	testq	%rdx, %rdx
	jne	LBB0_13
## %bb.12:
	leaq	L_.str(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_ath6kl_err
	jmp	LBB0_27
LBB0_13:
	cmpl	$128, %eax
	je	LBB0_17
## %bb.14:
	cmpl	$129, %eax
	jne	LBB0_23
## %bb.15:
	movq	_AR6003_BOARD_DATA_SZ@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
	movq	_AR6003_BOARD_EXT_DATA_SZ@GOTPCREL(%rip), %rax
	movq	(%rax), %r12
	leaq	(%r12,%r14), %rax
	cmpq	%rax, 8(%r15)
	jle	LBB0_19
## %bb.16:
	movq	_AR6003_BOARD_EXT_DATA_SZ_V2@GOTPCREL(%rip), %rax
	jmp	LBB0_18
LBB0_17:
	movq	_AR6004_BOARD_DATA_SZ@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
	movq	_AR6004_BOARD_EXT_DATA_SZ@GOTPCREL(%rip), %rax
LBB0_18:
	movq	(%rax), %r12
LBB0_19:
	testq	%rdx, %rdx
	je	LBB0_25
## %bb.20:
	leaq	(%r12,%r14), %rax
	cmpq	%rax, 8(%r15)
	jne	LBB0_25
## %bb.21:
	movq	_ATH6KL_DBG_BOOT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.2(%rip), %rsi
	movq	%r12, %rcx
	callq	_ath6kl_dbg
	movq	-48(%rbp), %rsi
	leaq	(,%r14,4), %rdx
	addq	24(%r15), %rdx
	movq	%r15, %rdi
	movq	%r12, %rcx
	callq	_ath6kl_bmi_write
	testl	%eax, %eax
	je	LBB0_24
## %bb.22:
	movl	%eax, %ebx
	leaq	L_.str.3(%rip), %rdi
	jmp	LBB0_32
LBB0_23:
	movl	$1, %edi
	callq	_WARN_ON
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_24:
	shlq	$16, %r12
	orq	$1, %r12
	movq	_hi_board_ext_data_config@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movq	%r12, %rdx
	callq	_ath6kl_bmi_write_hi32
LBB0_25:
	movq	8(%r15), %rsi
	cmpq	%r14, %rsi
	jge	LBB0_30
## %bb.26:
	leaq	L_.str.4(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_ath6kl_err
LBB0_27:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_28
LBB0_30:
	movq	_ATH6KL_DBG_BOOT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	-40(%rbp), %rdx
	leaq	L_.str.5(%rip), %rsi
	movq	%r14, %rcx
	callq	_ath6kl_dbg
	movq	-40(%rbp), %rsi
	movq	24(%r15), %rdx
	movq	%r15, %rdi
	movq	%r14, %rcx
	callq	_ath6kl_bmi_write
	testl	%eax, %eax
	je	LBB0_33
## %bb.31:
	movl	%eax, %ebx
	leaq	L_.str.6(%rip), %rdi
LBB0_32:
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	_ath6kl_err
	jmp	LBB0_29
LBB0_33:
	movq	16(%r15), %rax
	movq	_AR6004_HW_1_3_VERSION@GOTPCREL(%rip), %rcx
	movq	_AR6004_HW_3_0_VERSION@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rax
	movl	$1, %edx
	cmoveq	%r14, %rdx
	cmpq	(%rcx), %rax
	cmoveq	%r14, %rdx
	movq	_hi_board_data_initialized@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_ath6kl_bmi_write_hi32
	xorl	%ebx, %ebx
	jmp	LBB0_29
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOENT,4,2                     ## @ENOENT
	.comm	_hi_board_data,4,2              ## @hi_board_data
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to get board file target address.\n"

	.comm	_hi_board_ext_data,4,2          ## @hi_board_ext_data
L_.str.1:                               ## @.str.1
	.asciz	"Failed to get extended board file target address.\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_AR6003_BOARD_DATA_SZ,8,3       ## @AR6003_BOARD_DATA_SZ
	.comm	_AR6003_BOARD_EXT_DATA_SZ,8,3   ## @AR6003_BOARD_EXT_DATA_SZ
	.comm	_AR6003_BOARD_EXT_DATA_SZ_V2,8,3 ## @AR6003_BOARD_EXT_DATA_SZ_V2
	.comm	_AR6004_BOARD_DATA_SZ,8,3       ## @AR6004_BOARD_DATA_SZ
	.comm	_AR6004_BOARD_EXT_DATA_SZ,8,3   ## @AR6004_BOARD_EXT_DATA_SZ
	.comm	_ATH6KL_DBG_BOOT,4,2            ## @ATH6KL_DBG_BOOT
L_.str.2:                               ## @.str.2
	.asciz	"writing extended board data to 0x%x (%d B)\n"

L_.str.3:                               ## @.str.3
	.asciz	"Failed to write extended board data: %d\n"

	.comm	_hi_board_ext_data_config,4,2   ## @hi_board_ext_data_config
L_.str.4:                               ## @.str.4
	.asciz	"Too small board file: %zu\n"

L_.str.5:                               ## @.str.5
	.asciz	"writing board file to 0x%x (%d B)\n"

L_.str.6:                               ## @.str.6
	.asciz	"Board file bmi write failed: %d\n"

	.comm	_AR6004_HW_1_3_VERSION,8,3      ## @AR6004_HW_1_3_VERSION
	.comm	_AR6004_HW_3_0_VERSION,8,3      ## @AR6004_HW_3_0_VERSION
	.comm	_hi_board_data_initialized,4,2  ## @hi_board_data_initialized
	.no_dead_strip	_ath6kl_upload_board_file
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ath6kl_upload_board_file
_ath6kl_upload_board_file:              ; @ath6kl_upload_board_file
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x19, x0
	ldr	x8, [x0, #24]
	cmp	x8, #0
	cset	w0, eq
	bl	_WARN_ON
	cbz	x0, LBB0_3
; %bb.1:
Lloh0:
	adrp	x8, _ENOENT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
LBB0_2:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_10
LBB0_3:
	ldr	x2, [x19, #32]
	cbz	x2, LBB0_7
; %bb.4:
	str	x2, [sp, #24]
Lloh2:
	adrp	x8, _hi_board_data@GOTPAGE
Lloh3:
	ldr	x8, [x8, _hi_board_data@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_ath6kl_bmi_write_hi32
LBB0_5:
Lloh5:
	adrp	x8, _hi_board_ext_data@GOTPAGE
Lloh6:
	ldr	x8, [x8, _hi_board_ext_data@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	add	x2, sp, #16
	mov	x0, x19
	bl	_ath6kl_bmi_read_hi32
	cbz	w0, LBB0_11
; %bb.6:
	mov	x21, x0
Lloh8:
	adrp	x0, l_.str.1@PAGE
Lloh9:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_9
LBB0_7:
Lloh10:
	adrp	x8, _hi_board_data@GOTPAGE
Lloh11:
	ldr	x8, [x8, _hi_board_data@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	add	x2, sp, #24
	mov	x0, x19
	bl	_ath6kl_bmi_read_hi32
	cbz	w0, LBB0_5
; %bb.8:
	mov	x21, x0
Lloh13:
	adrp	x0, l_.str@PAGE
Lloh14:
	add	x0, x0, l_.str@PAGEOFF
LBB0_9:
	bl	_ath6kl_err
LBB0_10:
	mov	x0, x21
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_11:
	ldr	w8, [x19]
	ldr	x2, [sp, #16]
	cmp	w8, #129
	b.ne	LBB0_14
; %bb.12:
	cbnz	x2, LBB0_14
; %bb.13:
Lloh15:
	adrp	x0, l_.str@PAGE
Lloh16:
	add	x0, x0, l_.str@PAGEOFF
	b	LBB0_26
LBB0_14:
	cmp	w8, #128
	b.eq	LBB0_17
; %bb.15:
	cmp	w8, #129
	b.ne	LBB0_22
; %bb.16:
Lloh17:
	adrp	x8, _AR6003_BOARD_DATA_SZ@GOTPAGE
Lloh18:
	ldr	x8, [x8, _AR6003_BOARD_DATA_SZ@GOTPAGEOFF]
Lloh19:
	ldr	x20, [x8]
Lloh20:
	adrp	x8, _AR6003_BOARD_EXT_DATA_SZ@GOTPAGE
Lloh21:
	ldr	x8, [x8, _AR6003_BOARD_EXT_DATA_SZ@GOTPAGEOFF]
Lloh22:
	ldr	x8, [x8]
	ldr	x9, [x19, #8]
Lloh23:
	adrp	x10, _AR6003_BOARD_EXT_DATA_SZ_V2@GOTPAGE
Lloh24:
	ldr	x10, [x10, _AR6003_BOARD_EXT_DATA_SZ_V2@GOTPAGEOFF]
Lloh25:
	ldr	x10, [x10]
	add	x11, x8, x20
	cmp	x9, x11
	csel	x22, x10, x8, gt
	b	LBB0_18
LBB0_17:
Lloh26:
	adrp	x8, _AR6004_BOARD_DATA_SZ@GOTPAGE
Lloh27:
	ldr	x8, [x8, _AR6004_BOARD_DATA_SZ@GOTPAGEOFF]
Lloh28:
	ldr	x20, [x8]
Lloh29:
	adrp	x8, _AR6004_BOARD_EXT_DATA_SZ@GOTPAGE
Lloh30:
	ldr	x8, [x8, _AR6004_BOARD_EXT_DATA_SZ@GOTPAGEOFF]
Lloh31:
	ldr	x22, [x8]
LBB0_18:
	cbz	x2, LBB0_24
; %bb.19:
	ldr	x8, [x19, #8]
	add	x9, x22, x20
	cmp	x8, x9
	b.ne	LBB0_24
; %bb.20:
Lloh32:
	adrp	x8, _ATH6KL_DBG_BOOT@GOTPAGE
Lloh33:
	ldr	x8, [x8, _ATH6KL_DBG_BOOT@GOTPAGEOFF]
Lloh34:
	ldr	w0, [x8]
Lloh35:
	adrp	x1, l_.str.2@PAGE
Lloh36:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x3, x22
	bl	_ath6kl_dbg
	ldr	x1, [sp, #16]
	ldr	x8, [x19, #24]
	add	x2, x8, x20, lsl #2
	mov	x0, x19
	mov	x3, x22
	bl	_ath6kl_bmi_write
	cbz	w0, LBB0_23
; %bb.21:
	mov	x21, x0
	str	x21, [sp]
Lloh37:
	adrp	x0, l_.str.3@PAGE
Lloh38:
	add	x0, x0, l_.str.3@PAGEOFF
	b	LBB0_9
LBB0_22:
	mov	w0, #1
	bl	_WARN_ON
	b	LBB0_27
LBB0_23:
	mov	w2, #1
	bfi	x2, x22, #16, #48
Lloh39:
	adrp	x8, _hi_board_ext_data_config@GOTPAGE
Lloh40:
	ldr	x8, [x8, _hi_board_ext_data_config@GOTPAGEOFF]
Lloh41:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_ath6kl_bmi_write_hi32
LBB0_24:
	ldr	x8, [x19, #8]
	cmp	x8, x20
	b.ge	LBB0_28
; %bb.25:
	str	x8, [sp]
Lloh42:
	adrp	x0, l_.str.4@PAGE
Lloh43:
	add	x0, x0, l_.str.4@PAGEOFF
LBB0_26:
	bl	_ath6kl_err
LBB0_27:
Lloh44:
	adrp	x8, _EINVAL@GOTPAGE
Lloh45:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_2
LBB0_28:
Lloh46:
	adrp	x8, _ATH6KL_DBG_BOOT@GOTPAGE
Lloh47:
	ldr	x8, [x8, _ATH6KL_DBG_BOOT@GOTPAGEOFF]
Lloh48:
	ldr	w0, [x8]
	ldr	x2, [sp, #24]
Lloh49:
	adrp	x1, l_.str.5@PAGE
Lloh50:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x3, x20
	bl	_ath6kl_dbg
	ldr	x1, [sp, #24]
	ldr	x2, [x19, #24]
	mov	x0, x19
	mov	x3, x20
	bl	_ath6kl_bmi_write
	mov	x21, x0
	cbz	w0, LBB0_30
; %bb.29:
	str	x21, [sp]
Lloh51:
	adrp	x0, l_.str.6@PAGE
Lloh52:
	add	x0, x0, l_.str.6@PAGEOFF
	bl	_ath6kl_err
                                        ; kill: def $w21 killed $w21 killed $x21 def $x21
	b	LBB0_10
LBB0_30:
	ldr	x8, [x19, #16]
Lloh53:
	adrp	x9, _AR6004_HW_1_3_VERSION@GOTPAGE
Lloh54:
	ldr	x9, [x9, _AR6004_HW_1_3_VERSION@GOTPAGEOFF]
Lloh55:
	ldr	x9, [x9]
Lloh56:
	adrp	x10, _AR6004_HW_3_0_VERSION@GOTPAGE
Lloh57:
	ldr	x10, [x10, _AR6004_HW_3_0_VERSION@GOTPAGEOFF]
Lloh58:
	ldr	x10, [x10]
	cmp	x8, x10
	ccmp	x8, x9, #4, ne
	csinc	x2, x20, xzr, eq
Lloh59:
	adrp	x8, _hi_board_data_initialized@GOTPAGE
Lloh60:
	ldr	x8, [x8, _hi_board_data_initialized@GOTPAGEOFF]
Lloh61:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_ath6kl_bmi_write_hi32
	b	LBB0_10
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpAdd	Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpAdd	Lloh42, Lloh43
	.loh AdrpLdrGot	Lloh44, Lloh45
	.loh AdrpAdd	Lloh49, Lloh50
	.loh AdrpLdrGotLdr	Lloh46, Lloh47, Lloh48
	.loh AdrpAdd	Lloh51, Lloh52
	.loh AdrpLdrGotLdr	Lloh59, Lloh60, Lloh61
	.loh AdrpLdrGotLdr	Lloh56, Lloh57, Lloh58
	.loh AdrpLdrGotLdr	Lloh53, Lloh54, Lloh55
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOENT,4,2                     ; @ENOENT
	.comm	_hi_board_data,4,2              ; @hi_board_data
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to get board file target address.\n"

	.comm	_hi_board_ext_data,4,2          ; @hi_board_ext_data
l_.str.1:                               ; @.str.1
	.asciz	"Failed to get extended board file target address.\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_AR6003_BOARD_DATA_SZ,8,3       ; @AR6003_BOARD_DATA_SZ
	.comm	_AR6003_BOARD_EXT_DATA_SZ,8,3   ; @AR6003_BOARD_EXT_DATA_SZ
	.comm	_AR6003_BOARD_EXT_DATA_SZ_V2,8,3 ; @AR6003_BOARD_EXT_DATA_SZ_V2
	.comm	_AR6004_BOARD_DATA_SZ,8,3       ; @AR6004_BOARD_DATA_SZ
	.comm	_AR6004_BOARD_EXT_DATA_SZ,8,3   ; @AR6004_BOARD_EXT_DATA_SZ
	.comm	_ATH6KL_DBG_BOOT,4,2            ; @ATH6KL_DBG_BOOT
l_.str.2:                               ; @.str.2
	.asciz	"writing extended board data to 0x%x (%d B)\n"

l_.str.3:                               ; @.str.3
	.asciz	"Failed to write extended board data: %d\n"

	.comm	_hi_board_ext_data_config,4,2   ; @hi_board_ext_data_config
l_.str.4:                               ; @.str.4
	.asciz	"Too small board file: %zu\n"

l_.str.5:                               ; @.str.5
	.asciz	"writing board file to 0x%x (%d B)\n"

l_.str.6:                               ; @.str.6
	.asciz	"Board file bmi write failed: %d\n"

	.comm	_AR6004_HW_1_3_VERSION,8,3      ; @AR6004_HW_1_3_VERSION
	.comm	_AR6004_HW_3_0_VERSION,8,3      ; @AR6004_HW_3_0_VERSION
	.comm	_hi_board_data_initialized,4,2  ; @hi_board_data_initialized
	.no_dead_strip	_ath6kl_upload_board_file
.subsections_via_symbols
