	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ish_fw_xfer_direct_dma
_ish_fw_xfer_direct_dma:                ## @ish_fw_xfer_direct_dma
	.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	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r15d
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movl	4(%rdi), %edi
	callq	_ishtp_get_pci_device
	movq	%rax, %r13
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movl	(%rbx), %edi
	movslq	%r15d, %rsi
	movq	_dma_buf_size_limit@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	callq	_min3
	movq	_L1_CACHE_BYTES@GOTPCREL(%rip), %rcx
	xorl	%r12d, %r12d
	xorl	%r15d, %r15d
	subl	(%rcx), %r15d
	andl	%eax, %r15d
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movq	_GFP_DMA32@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	movl	%r15d, %edi
	callq	_kmalloc
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r13, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movl	%r15d, %edx
	callq	_dma_map_single
	movq	%rax, %rbx
	movq	%r13, %rdi
	movq	%rax, %rsi
	callq	_dma_mapping_error
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movq	%r14, %rdi
	callq	_cl_data_to_dev
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edi
	callq	_dev_err
	movl	$1, (%r14)
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
LBB0_9:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_kfree
	jmp	LBB0_10
LBB0_1:
	movl	$1, (%r14)
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r12d
	jmp	LBB0_10
LBB0_4:
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	movq	%r14, -88(%rbp)                 ## 8-byte Spill
	movq	_LOADER_CMD_XFER_FRAGMENT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -96(%rbp)
	movq	_LOADER_XFER_MODE_DIRECT_DMA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -100(%rbp)
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	%rbx, -120(%rbp)
	movq	%r13, %r14
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	movl	(%r13), %eax
	testl	%eax, %eax
	jle	LBB0_11
## %bb.5:
	xorl	%esi, %esi
	movq	%r14, -80(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	leal	(%rsi,%r12), %ecx
	movl	%eax, %r15d
	subl	%esi, %r15d
	xorl	%edx, %edx
	cmpl	%eax, %ecx
	cmovll	%r12d, %r15d
	setge	%dl
	movl	%edx, -112(%rbp)
	movl	%esi, -108(%rbp)
	movl	%r15d, -104(%rbp)
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movslq	%esi, %rsi
	shlq	$2, %rsi
	addq	8(%r13), %rsi
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movl	%r15d, %edx
	callq	_memcpy
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movl	%r12d, %edx
	callq	_dma_sync_single_for_device
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_clflush_cache_range
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	callq	_cl_data_to_dev
	movl	-108(%rbp), %edx
	movl	-104(%rbp), %ecx
	movl	-112(%rbp), %r8d
	movq	-120(%rbp), %r9
	movl	%eax, %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_dbg
	movq	%rbx, %rdi
	leaq	-120(%rbp), %rsi
	movl	$32, %edx
	leaq	-128(%rbp), %rcx
	movl	$4, %r8d
	callq	_loader_cl_send
	testl	%eax, %eax
	js	LBB0_8
## %bb.6:                               ##   in Loop: Header=BB0_7 Depth=1
	addl	-72(%rbp), %r15d                ## 4-byte Folded Reload
	movl	(%r13), %eax
	movl	%r15d, %esi
	cmpl	%r15d, %eax
	movq	-80(%rbp), %r14                 ## 8-byte Reload
	jg	LBB0_7
LBB0_11:
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_dma_unmap_single
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_kfree
	xorl	%r12d, %r12d
LBB0_10:
	movl	%r12d, %eax
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movl	%eax, %r12d
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	movl	$1, (%rax)
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	-80(%rbp), %rdi                 ## 8-byte Reload
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_dma_unmap_single
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_dma_buf_size_limit,8,3         ## @dma_buf_size_limit
	.comm	_L1_CACHE_BYTES,4,2             ## @L1_CACHE_BYTES
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_GFP_DMA32,4,2                  ## @GFP_DMA32
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_DMA_TO_DEVICE,4,2              ## @DMA_TO_DEVICE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"DMA map failed\n"

	.comm	_LOADER_CMD_XFER_FRAGMENT,4,2   ## @LOADER_CMD_XFER_FRAGMENT
	.comm	_LOADER_XFER_MODE_DIRECT_DMA,4,2 ## @LOADER_XFER_MODE_DIRECT_DMA
L_.str.1:                               ## @.str.1
	.asciz	"xfer_mode=dma offset=0x%08x size=0x%x is_last=%d ddr_phys_addr=0x%016llx\n"

	.no_dead_strip	_ish_fw_xfer_direct_dma
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ish_fw_xfer_direct_dma
_ish_fw_xfer_direct_dma:                ; @ish_fw_xfer_direct_dma
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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	x22, x1
	mov	x19, x0
	ldr	w0, [x0, #4]
	bl	_ishtp_get_pci_device
	mov	x21, x0
	ldr	w0, [x22]
	sxtw	x1, w20
Lloh0:
	adrp	x8, _dma_buf_size_limit@GOTPAGE
Lloh1:
	ldr	x8, [x8, _dma_buf_size_limit@GOTPAGEOFF]
Lloh2:
	ldr	x2, [x8]
	bl	_min3
Lloh3:
	adrp	x8, _L1_CACHE_BYTES@GOTPAGE
Lloh4:
	ldr	x8, [x8, _L1_CACHE_BYTES@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, _GFP_KERNEL@GOTPAGE
Lloh7:
	ldr	x9, [x9, _GFP_KERNEL@GOTPAGEOFF]
	neg	w8, w8
	and	w23, w0, w8
Lloh8:
	ldr	w8, [x9]
Lloh9:
	adrp	x9, _GFP_DMA32@GOTPAGE
Lloh10:
	ldr	x9, [x9, _GFP_DMA32@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	orr	w1, w9, w8
	mov	x0, x23
	bl	_kmalloc
	cbz	x0, LBB0_4
; %bb.1:
	mov	x20, x0
Lloh12:
	adrp	x28, _DMA_TO_DEVICE@GOTPAGE
Lloh13:
	ldr	x28, [x28, _DMA_TO_DEVICE@GOTPAGEOFF]
	ldr	w3, [x28]
	mov	x0, x21
	mov	x1, x20
	mov	x2, x23
	bl	_dma_map_single
	mov	x24, x0
	mov	x0, x21
	mov	x1, x24
	bl	_dma_mapping_error
	cbz	x0, LBB0_5
; %bb.2:
	mov	x0, x19
	bl	_cl_data_to_dev
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	mov	w8, #1
	str	w8, [x19]
Lloh16:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	neg	w27, w8
LBB0_3:
	mov	x0, x20
	bl	_kfree
	b	LBB0_10
LBB0_4:
	mov	w8, #1
	str	w8, [x19]
Lloh19:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh20:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	neg	w27, w8
	b	LBB0_10
LBB0_5:
Lloh22:
	adrp	x8, _LOADER_CMD_XFER_FRAGMENT@GOTPAGE
Lloh23:
	ldr	x8, [x8, _LOADER_CMD_XFER_FRAGMENT@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
Lloh25:
	adrp	x9, _LOADER_XFER_MODE_DIRECT_DMA@GOTPAGE
Lloh26:
	ldr	x9, [x9, _LOADER_XFER_MODE_DIRECT_DMA@GOTPAGEOFF]
Lloh27:
	ldr	w9, [x9]
	stp	w9, w8, [sp, #28]
	str	x24, [sp, #8]
	ldr	w8, [x22]
	cmp	w8, #1
	b.lt	LBB0_9
; %bb.6:
	mov	w25, #0
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	sub	w9, w8, w25
	add	w10, w25, w23
	cmp	w10, w8
	cset	w8, ge
	csel	w26, w23, w9, lt
	stp	w8, w25, [sp, #16]
	str	w26, [sp, #24]
	ldr	x8, [x22, #8]
	add	x1, x8, w25, sxtw #2
	mov	x0, x20
	mov	x2, x26
	bl	_memcpy
	ldr	w3, [x28]
	mov	x0, x21
	mov	x1, x24
	mov	x2, x23
	bl	_dma_sync_single_for_device
	mov	x0, x20
	mov	x1, x23
	bl	_clflush_cache_range
	mov	x0, x19
	bl	_cl_data_to_dev
	ldp	w2, w3, [sp, #20]
	ldr	w4, [sp, #16]
	ldr	x5, [sp, #8]
Lloh28:
	adrp	x1, l_.str.1@PAGE
Lloh29:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
	add	x1, sp, #8
	add	x3, sp, #40
	mov	x0, x19
	mov	w2, #32
	mov	w4, #4
	bl	_loader_cl_send
	tbnz	w0, #31, LBB0_11
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	w8, [x22]
	add	w25, w26, w25
	cmp	w8, w25
	b.gt	LBB0_7
LBB0_9:
	ldr	w3, [x28]
	mov	x0, x21
	mov	x1, x24
	mov	x2, x23
	bl	_dma_unmap_single
	mov	x0, x20
	bl	_kfree
	mov	w27, #0
LBB0_10:
	mov	x0, x27
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_11:
	mov	x27, x0
	mov	w8, #1
	str	w8, [x19]
	ldr	w3, [x28]
	mov	x0, x21
	mov	x1, x24
	mov	x2, x23
	bl	_dma_unmap_single
	b	LBB0_3
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_dma_buf_size_limit,8,3         ; @dma_buf_size_limit
	.comm	_L1_CACHE_BYTES,4,2             ; @L1_CACHE_BYTES
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_GFP_DMA32,4,2                  ; @GFP_DMA32
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_DMA_TO_DEVICE,4,2              ; @DMA_TO_DEVICE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"DMA map failed\n"

	.comm	_LOADER_CMD_XFER_FRAGMENT,4,2   ; @LOADER_CMD_XFER_FRAGMENT
	.comm	_LOADER_XFER_MODE_DIRECT_DMA,4,2 ; @LOADER_XFER_MODE_DIRECT_DMA
l_.str.1:                               ; @.str.1
	.asciz	"xfer_mode=dma offset=0x%08x size=0x%x is_last=%d ddr_phys_addr=0x%016llx\n"

	.no_dead_strip	_ish_fw_xfer_direct_dma
.subsections_via_symbols
