	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ath6kl_bmi_read                ## -- Begin function ath6kl_bmi_read
	.p2align	4, 0x90
_ath6kl_bmi_read:                       ## @ath6kl_bmi_read
	.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
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	movq	%rsi, %r13
	movq	%rsi, -64(%rbp)
	movq	_BMI_READ_MEMORY@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%rsi, -72(%rbp)
	cmpq	$0, 24(%rdi)
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_ath6kl_err
	movq	_EACCES@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_2:
	movq	%rdx, %rbx
	movq	%rdi, %r14
	movq	(%rdi), %rdx
	addq	$24, %rdx
	cmpq	8(%rdi), %rdx
	jle	LBB0_5
## %bb.3:
	movl	$1, %edi
	callq	_WARN_ON
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_4:
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
LBB0_13:
	movl	%r12d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	16(%r14), %rdi
	xorl	%r12d, %r12d
	xorl	%esi, %esi
	callq	_memset
	movq	_ATH6KL_DBG_BMI@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	movq	%r13, %rdx
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rcx
	callq	_ath6kl_dbg
	testq	%r15, %r15
	je	LBB0_13
## %bb.6:
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %r15
	movq	(%r14), %rax
	cmpq	%rax, %r13
	cmovlq	%r13, %rax
	movq	%rax, -48(%rbp)
	movq	16(%r14), %rdi
	movl	$8, %edx
	leaq	-72(%rbp), %rsi
	callq	_memcpy
	movq	16(%r14), %rdi
	addq	$64, %rdi
	movl	$8, %edx
	leaq	-64(%rbp), %rsi
	callq	_memcpy
	movq	16(%r14), %rdi
	subq	$-128, %rdi
	movl	$8, %edx
	leaq	-48(%rbp), %rsi
	callq	_memcpy
	movq	16(%r14), %rsi
	movl	$24, %edx
	movq	%r14, %rdi
	callq	_ath6kl_hif_bmi_write
	testl	%eax, %eax
	jne	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	movq	16(%r14), %rsi
	movq	-48(%rbp), %rdx
	movq	%r14, %rdi
	callq	_ath6kl_hif_bmi_read
	testl	%eax, %eax
	jne	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	%r12, %rax
	subq	%r13, %rax
	movq	%r15, %rbx
	leaq	(%r15,%rax,8), %rdi
	movq	16(%r14), %rsi
	movq	-48(%rbp), %rdx
	callq	_memcpy
	movq	-48(%rbp), %rax
	addq	%rax, -64(%rbp)
	subq	%rax, %r13
	jne	LBB0_7
## %bb.12:
	xorl	%r12d, %r12d
	jmp	LBB0_13
LBB0_8:
	movl	%eax, %r12d
	leaq	L_.str.2(%rip), %rdi
	movl	%eax, %esi
	callq	_ath6kl_err
	jmp	LBB0_13
LBB0_10:
	movl	%eax, %ebx
	leaq	L_.str.3(%rip), %rdi
	movl	%eax, %esi
	callq	_ath6kl_err
	movl	%ebx, %r12d
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.comm	_BMI_READ_MEMORY,8,3            ## @BMI_READ_MEMORY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"bmi done sent already, cmd %d disallowed\n"

	.comm	_EACCES,4,2                     ## @EACCES
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ATH6KL_DBG_BMI,4,2             ## @ATH6KL_DBG_BMI
L_.str.1:                               ## @.str.1
	.asciz	"bmi read memory: device: addr: 0x%x, len: %d\n"

L_.str.2:                               ## @.str.2
	.asciz	"Unable to write to the device: %d\n"

L_.str.3:                               ## @.str.3
	.asciz	"Unable to read from the device: %d\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ath6kl_bmi_read                ; -- Begin function ath6kl_bmi_read
	.p2align	2
_ath6kl_bmi_read:                       ; @ath6kl_bmi_read
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x22, x1
	str	x1, [sp, #24]
Lloh0:
	adrp	x8, _BMI_READ_MEMORY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _BMI_READ_MEMORY@GOTPAGEOFF]
Lloh2:
	ldr	x1, [x8]
	str	x1, [sp, #16]
	ldr	x8, [x0, #24]
	cbz	x8, LBB0_2
; %bb.1:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
                                        ; kill: def $w1 killed $w1 killed $x1
	bl	_ath6kl_err
Lloh5:
	adrp	x8, _EACCES@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EACCES@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:
	mov	x20, x2
	mov	x21, x0
	ldp	x8, x9, [x0]
	add	x2, x8, #24
	cmp	x2, x9
	b.le	LBB0_6
; %bb.3:
	mov	w0, #1
	bl	_WARN_ON
Lloh7:
	adrp	x8, _EINVAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_4:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_5:
	mov	x0, x22
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_6:
	mov	x19, x3
	ldr	x0, [x21, #16]
	mov	w1, #0
	bl	_memset
Lloh9:
	adrp	x8, _ATH6KL_DBG_BMI@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ATH6KL_DBG_BMI@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
Lloh12:
	adrp	x1, l_.str.1@PAGE
Lloh13:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x22
	mov	x3, x19
	bl	_ath6kl_dbg
	cbz	x19, LBB0_11
; %bb.7:
	mov	x23, x19
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x21]
	cmp	x23, x8
	csel	x8, x23, x8, lt
	str	x8, [sp, #8]
	ldr	x0, [x21, #16]
	add	x1, sp, #16
	mov	w2, #8
	bl	_memcpy
	ldr	x8, [x21, #16]
	add	x0, x8, #64
	add	x1, sp, #24
	mov	w2, #8
	bl	_memcpy
	ldr	x8, [x21, #16]
	add	x0, x8, #128
	add	x1, sp, #8
	mov	w2, #8
	bl	_memcpy
	ldr	x1, [x21, #16]
	mov	x0, x21
	mov	w2, #24
	bl	_ath6kl_hif_bmi_write
	cbnz	w0, LBB0_12
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	ldr	x1, [x21, #16]
	ldr	x2, [sp, #8]
	mov	x0, x21
	bl	_ath6kl_hif_bmi_read
	cbnz	w0, LBB0_13
; %bb.10:                               ;   in Loop: Header=BB0_8 Depth=1
	sub	x8, x19, x23
	add	x0, x20, x8, lsl #3
	ldr	x1, [x21, #16]
	ldr	x2, [sp, #8]
	bl	_memcpy
	ldr	x8, [sp, #8]
	ldr	x9, [sp, #24]
	add	x9, x9, x8
	str	x9, [sp, #24]
	subs	x23, x23, x8
	b.ne	LBB0_8
LBB0_11:
	mov	w22, #0
	b	LBB0_5
LBB0_12:
	mov	x22, x0
Lloh14:
	adrp	x0, l_.str.2@PAGE
Lloh15:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_14
LBB0_13:
	mov	x22, x0
Lloh16:
	adrp	x0, l_.str.3@PAGE
Lloh17:
	add	x0, x0, l_.str.3@PAGEOFF
LBB0_14:
	mov	x1, x22
	bl	_ath6kl_err
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_BMI_READ_MEMORY,8,3            ; @BMI_READ_MEMORY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"bmi done sent already, cmd %d disallowed\n"

	.comm	_EACCES,4,2                     ; @EACCES
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ATH6KL_DBG_BMI,4,2             ; @ATH6KL_DBG_BMI
l_.str.1:                               ; @.str.1
	.asciz	"bmi read memory: device: addr: 0x%x, len: %d\n"

l_.str.2:                               ; @.str.2
	.asciz	"Unable to write to the device: %d\n"

l_.str.3:                               ; @.str.3
	.asciz	"Unable to read from the device: %d\n"

.subsections_via_symbols
