	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function btmrvl_sdio_host_to_card
_btmrvl_sdio_host_to_card:              ## @btmrvl_sdio_host_to_card
	.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	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	8(%rdi), %r12
	testq	%r12, %r12
	je	LBB0_9
## %bb.1:
	movq	%rdi, %rbx
	movl	(%r12), %edi
	testl	%edi, %edi
	je	LBB0_9
## %bb.2:
	movl	%edx, %r15d
	movq	_BTSDIO_DMA_ALIGN@GOTPCREL(%rip), %r14
	movslq	(%r14), %rsi
	leaq	-1(%rsi), %rax
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	testq	%rcx, %rax
	je	LBB0_5
## %bb.3:
	movl	%r15d, %edi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_ALIGN_SZ
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	%eax, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_12
## %bb.4:
	movl	(%r14), %esi
	movq	%rax, %rdi
	callq	_ALIGN_ADDR
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	%rax, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movl	%r15d, %edx
	callq	_memcpy
	movl	(%r12), %edi
LBB0_5:
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	_SDIO_BLOCK_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	%r15, -72(%rbp)                 ## 8-byte Spill
	addl	%r14d, %r15d
	decl	%r15d
	callq	_sdio_claim_host
	movl	%r15d, %eax
	cltd
	idivl	%r14d
	subl	%edx, %r15d
	xorl	%r13d, %r13d
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_7 Depth=1
	testl	%r14d, %r14d
	je	LBB0_10
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r12), %edi
	movl	4(%r12), %esi
	movq	%rbx, %rdx
	movl	%r15d, %ecx
	callq	_sdio_writesb
	movl	%eax, %r14d
	testl	%eax, %eax
	jns	LBB0_6
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movl	%r15d, %ebx
	leal	1(%r13), %r15d
	leaq	L_.str.1(%rip), %rdi
	movl	%r15d, %esi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_BT_ERR
	movq	_DUMP_PREFIX_OFFSET@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.2(%rip), %rdi
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
                                        ## kill: def $ecx killed $ecx killed $rcx
	callq	_print_hex_dump_bytes
	xorl	%r14d, %r14d
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	movq	_MAX_WRITE_IOMEM_RETRY@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r13d
	movl	%r15d, %r13d
	movl	%ebx, %r15d
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	jl	LBB0_6
	jmp	LBB0_11
LBB0_9:
	leaq	L_.str(%rip), %rdi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_BT_ERR
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_13:
	subl	(%rax), %r14d
	jmp	LBB0_14
LBB0_10:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	$0, (%rax)
	xorl	%r14d, %r14d
LBB0_11:
	movl	(%r12), %edi
	callq	_sdio_release_host
LBB0_14:
	movl	%r14d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"card or function is NULL!"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_BTSDIO_DMA_ALIGN,4,2           ## @BTSDIO_DMA_ALIGN
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_SDIO_BLOCK_SIZE,4,2            ## @SDIO_BLOCK_SIZE
L_.str.1:                               ## @.str.1
	.asciz	"i=%d writesb failed: %d"

L_.str.2:                               ## @.str.2
	.space	1

	.comm	_DUMP_PREFIX_OFFSET,4,2         ## @DUMP_PREFIX_OFFSET
	.comm	_EIO,4,2                        ## @EIO
	.comm	_MAX_WRITE_IOMEM_RETRY,4,2      ## @MAX_WRITE_IOMEM_RETRY
	.no_dead_strip	_btmrvl_sdio_host_to_card
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function btmrvl_sdio_host_to_card
_btmrvl_sdio_host_to_card:              ; @btmrvl_sdio_host_to_card
	.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
	ldr	x27, [x0, #8]
	cbz	x27, LBB0_5
; %bb.1:
	mov	x22, x0
	ldr	w0, [x27]
	cbz	w0, LBB0_5
; %bb.2:
	mov	x20, x2
	mov	x21, x1
Lloh0:
	adrp	x19, _BTSDIO_DMA_ALIGN@GOTPAGE
Lloh1:
	ldr	x19, [x19, _BTSDIO_DMA_ALIGN@GOTPAGEOFF]
	ldrsw	x1, [x19]
	sub	x8, x1, #1
	tst	x8, x21
	b.eq	LBB0_7
; %bb.3:
	mov	x0, x20
                                        ; kill: def $w1 killed $w1 killed $x1
	bl	_ALIGN_SZ
Lloh2:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	bl	_kzalloc
	cbz	x0, LBB0_15
; %bb.4:
	str	x22, [sp, #24]                  ; 8-byte Folded Spill
	ldr	w1, [x19]
	bl	_ALIGN_ADDR
	mov	x22, x0
	mov	x1, x21
	mov	x2, x20
	bl	_memcpy
	ldr	w0, [x27]
	b	LBB0_8
LBB0_5:
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	bl	_BT_ERR
Lloh7:
	adrp	x8, _EINVAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_6:
	ldr	w8, [x8]
	neg	w26, w8
	b	LBB0_14
LBB0_7:
	str	x22, [sp, #24]                  ; 8-byte Folded Spill
	mov	x22, x21
LBB0_8:
Lloh9:
	adrp	x8, _SDIO_BLOCK_SIZE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _SDIO_BLOCK_SIZE@GOTPAGEOFF]
Lloh11:
	ldr	w19, [x8]
	add	w8, w20, w19
	sub	w23, w8, #1
	bl	_sdio_claim_host
	mov	w28, #0
	sdiv	w8, w23, w19
	mul	w23, w8, w19
Lloh12:
	adrp	x24, _EIO@GOTPAGE
Lloh13:
	ldr	x24, [x24, _EIO@GOTPAGEOFF]
Lloh14:
	adrp	x19, _MAX_WRITE_IOMEM_RETRY@GOTPAGE
Lloh15:
	ldr	x19, [x19, _MAX_WRITE_IOMEM_RETRY@GOTPAGEOFF]
	b	LBB0_10
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=1
	cbz	w26, LBB0_12
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldp	w0, w1, [x27]
	mov	x2, x22
	mov	x3, x23
	bl	_sdio_writesb
	mov	x26, x0
	tbz	w0, #31, LBB0_9
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	add	w25, w28, #1
	stp	x25, x26, [sp]
Lloh16:
	adrp	x0, l_.str.1@PAGE
Lloh17:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_BT_ERR
Lloh18:
	adrp	x8, _DUMP_PREFIX_OFFSET@GOTPAGE
Lloh19:
	ldr	x8, [x8, _DUMP_PREFIX_OFFSET@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
Lloh21:
	adrp	x0, l_.str.2@PAGE
Lloh22:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x2, x21
	mov	x3, x20
	bl	_print_hex_dump_bytes
	ldr	w8, [x24]
	neg	w26, w8
	ldr	w8, [x19]
	cmp	w28, w8
	mov	x28, x25
	b.lt	LBB0_9
	b	LBB0_13
LBB0_12:
	ldr	x8, [sp, #24]                   ; 8-byte Folded Reload
	str	wzr, [x8]
LBB0_13:
	ldr	w0, [x27]
	bl	_sdio_release_host
LBB0_14:
	mov	x0, x26
	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_15:
Lloh23:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh24:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_6
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"card or function is NULL!"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_BTSDIO_DMA_ALIGN,4,2           ; @BTSDIO_DMA_ALIGN
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_SDIO_BLOCK_SIZE,4,2            ; @SDIO_BLOCK_SIZE
l_.str.1:                               ; @.str.1
	.asciz	"i=%d writesb failed: %d"

l_.str.2:                               ; @.str.2
	.space	1

	.comm	_DUMP_PREFIX_OFFSET,4,2         ; @DUMP_PREFIX_OFFSET
	.comm	_EIO,4,2                        ; @EIO
	.comm	_MAX_WRITE_IOMEM_RETRY,4,2      ; @MAX_WRITE_IOMEM_RETRY
	.no_dead_strip	_btmrvl_sdio_host_to_card
.subsections_via_symbols
