	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vmw_ttm_map_dma
_vmw_ttm_map_dma:                       ## @vmw_ttm_map_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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	88(%rdi), %r12
	movq	%r12, %rdi
	callq	_vmw_mem_glob
	movq	$1, -72(%rbp)
	xorl	%ebx, %ebx
	cmpl	$0, (%r14)
	jne	LBB0_18
## %bb.1:
	movq	%rax, %r15
	movl	(%r12), %eax
	movl	%eax, 16(%r14)
	movl	80(%r14), %ecx
	movl	%ecx, 48(%r14)
	movq	72(%r14), %rcx
	movq	%rcx, 24(%r14)
	movl	64(%r14), %ecx
	movl	%ecx, 52(%r14)
	leaq	56(%r14), %r13
	movq	%r13, 32(%r14)
	andl	$-2, %eax
	cmpl	$128, %eax
	jne	LBB0_10
## %bb.2:
	xorl	%edi, %edi
	cmpq	$0, _vmw_ttm_map_dma.sgl_size(%rip)
	sete	%dil
	callq	_unlikely
	testl	%eax, %eax
	je	LBB0_3
## %bb.4:
	movl	$4, %edi
	callq	_ttm_round_pot
	movq	%rax, _vmw_ttm_map_dma.sgl_size(%rip)
	movl	$4, %edi
	callq	_ttm_round_pot
	movq	%rax, _vmw_ttm_map_dma.sgt_size(%rip)
	jmp	LBB0_5
LBB0_3:
	movq	_vmw_ttm_map_dma.sgt_size(%rip), %rax
LBB0_5:
	movq	24(%r14), %rsi
	imulq	_vmw_ttm_map_dma.sgl_size(%rip), %rsi
	addq	%rax, %rsi
	movq	%rsi, 8(%r14)
	leaq	-72(%rbp), %rdx
	movq	%r15, %rdi
	callq	_ttm_mem_global_alloc
	movl	%eax, %ebx
	xorl	%edi, %edi
	testl	%eax, %eax
	setne	%dil
	callq	_unlikely
	testl	%eax, %eax
	jne	LBB0_18
## %bb.6:
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	movq	24(%r14), %rbx
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movq	%rbx, %r15
	shlq	%cl, %r15
	movl	48(%r14), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movq	8(%r12), %rax
	movl	(%rax), %edi
	callq	_dma_get_max_seg_size
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, (%rsp)
	movq	%r13, %rdi
	movl	-52(%rbp), %esi                 ## 4-byte Reload
	movq	%rbx, %rdx
	xorl	%ecx, %ecx
	movq	%r15, %r8
	movl	%eax, %r9d
	callq	___sg_alloc_table_from_pages
	movl	%eax, %ebx
	xorl	%edi, %edi
	testl	%eax, %eax
	setne	%dil
	callq	_unlikely
	testl	%eax, %eax
	jne	LBB0_17
## %bb.7:
	movq	24(%r14), %r15
	subq	56(%r14), %r15
	jbe	LBB0_9
## %bb.8:
	imulq	_vmw_ttm_map_dma.sgl_size(%rip), %r15
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%r15, %rsi
	callq	_ttm_mem_global_free
	subq	%r15, 8(%r14)
LBB0_9:
	movq	%r14, %rdi
	callq	_vmw_ttm_map_for_dma
	movl	%eax, %ebx
	xorl	%edi, %edi
	testl	%eax, %eax
	setne	%dil
	callq	_unlikely
	testl	%eax, %eax
	je	LBB0_10
## %bb.16:
	movq	32(%r14), %rdi
	callq	_sg_free_table
	movq	$0, 32(%r14)
LBB0_17:
	movq	8(%r14), %rsi
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_ttm_mem_global_free
	jmp	LBB0_18
LBB0_10:
	leaq	16(%r14), %rsi
	movq	$0, 40(%r14)
	leaq	-48(%rbp), %rbx
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_vmw_piter_start
	movq	%rbx, %rdi
	callq	_vmw_piter_next
	testq	%rax, %rax
	je	LBB0_15
## %bb.11:
	movq	$-1, %rbx
	leaq	-48(%rbp), %r12
	movq	_PAGE_SIZE@GOTPCREL(%rip), %r13
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_12 Depth=1
	movq	%r12, %rdi
	callq	_vmw_piter_next
	movq	%r15, %rbx
	testq	%rax, %rax
	je	LBB0_15
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	callq	_vmw_piter_dma_addr
	movq	%rax, %r15
	addq	(%r13), %rbx
	cmpq	%rbx, %rax
	je	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	incq	40(%r14)
	jmp	LBB0_14
LBB0_15:
	movl	$1, (%r14)
	xorl	%ebx, %ebx
LBB0_18:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_vmw_ttm_map_dma.sgl_size,8,3 ## @vmw_ttm_map_dma.sgl_size
.zerofill __DATA,__bss,_vmw_ttm_map_dma.sgt_size,8,3 ## @vmw_ttm_map_dma.sgt_size
	.comm	_PAGE_SHIFT,8,3                 ## @PAGE_SHIFT
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_PAGE_SIZE,8,3                  ## @PAGE_SIZE
	.no_dead_strip	_vmw_ttm_map_dma
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vmw_ttm_map_dma
_vmw_ttm_map_dma:                       ; @vmw_ttm_map_dma
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x0
	ldr	x21, [x0, #88]
	mov	x0, x21
	bl	_vmw_mem_glob
	mov	w8, #1
	str	x8, [sp, #8]
	ldr	w8, [x19]
	cbz	w8, LBB0_2
; %bb.1:
	mov	w23, #0
	b	LBB0_19
LBB0_2:
	ldr	w8, [x21]
	str	w8, [x19, #16]
	ldr	w9, [x19, #80]
	ldr	x10, [x19, #72]
	ldr	w11, [x19, #64]
	stp	w9, w11, [x19, #48]
	add	x22, x19, #56
	stp	x10, x22, [x19, #24]
	and	w8, w8, #0xfffffffe
	cmp	w8, #128
	b.ne	LBB0_13
; %bb.3:
	mov	x20, x0
	adrp	x26, _vmw_ttm_map_dma.sgl_size@PAGE
	ldr	x8, [x26, _vmw_ttm_map_dma.sgl_size@PAGEOFF]
	cmp	x8, #0
	cset	w0, eq
	bl	_unlikely
	cbz	w0, LBB0_5
; %bb.4:
	mov	w0, #4
	bl	_ttm_round_pot
	str	x0, [x26, _vmw_ttm_map_dma.sgl_size@PAGEOFF]
	mov	w0, #4
	bl	_ttm_round_pot
	adrp	x8, _vmw_ttm_map_dma.sgt_size@PAGE
	str	x0, [x8, _vmw_ttm_map_dma.sgt_size@PAGEOFF]
	b	LBB0_6
LBB0_5:
Lloh0:
	adrp	x8, _vmw_ttm_map_dma.sgt_size@PAGE
Lloh1:
	ldr	x0, [x8, _vmw_ttm_map_dma.sgt_size@PAGEOFF]
LBB0_6:
	ldr	x8, [x26, _vmw_ttm_map_dma.sgl_size@PAGEOFF]
	ldr	x9, [x19, #24]
	madd	x1, x9, x8, x0
	str	x1, [x19, #8]
	add	x2, sp, #8
	mov	x0, x20
	bl	_ttm_mem_global_alloc
	mov	x23, x0
	cmp	w0, #0
	cset	w0, ne
	bl	_unlikely
	cbnz	w0, LBB0_19
; %bb.7:
	ldr	w23, [x19, #48]
	ldr	x24, [x19, #24]
Lloh2:
	adrp	x8, _PAGE_SHIFT@GOTPAGE
Lloh3:
	ldr	x8, [x8, _PAGE_SHIFT@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	lsl	x25, x24, x8
	ldr	x8, [x21, #8]
	ldr	w0, [x8]
	bl	_dma_get_max_seg_size
	mov	x5, x0
Lloh5:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh7:
	ldr	w6, [x8]
	mov	x0, x22
	mov	x1, x23
	mov	x2, x24
	mov	w3, #0
	mov	x4, x25
	bl	___sg_alloc_table_from_pages
	mov	x23, x0
	cmp	w0, #0
	cset	w0, ne
	bl	_unlikely
	cbnz	w0, LBB0_12
; %bb.8:
	ldr	x8, [x19, #24]
	ldr	x9, [x19, #56]
	subs	x8, x8, x9
	b.ls	LBB0_10
; %bb.9:
	ldr	x9, [x26, _vmw_ttm_map_dma.sgl_size@PAGEOFF]
	mul	x21, x9, x8
	mov	x0, x20
	mov	x1, x21
	bl	_ttm_mem_global_free
	ldr	x8, [x19, #8]
	sub	x8, x8, x21
	str	x8, [x19, #8]
LBB0_10:
	mov	x0, x19
	bl	_vmw_ttm_map_for_dma
	mov	x23, x0
	cmp	w0, #0
	cset	w0, ne
	bl	_unlikely
	cbz	w0, LBB0_13
; %bb.11:
	ldr	x0, [x19, #32]
	bl	_sg_free_table
	str	xzr, [x19, #32]
LBB0_12:
	ldr	x1, [x19, #8]
	mov	x0, x20
	bl	_ttm_mem_global_free
	b	LBB0_19
LBB0_13:
	add	x1, x19, #16
	str	xzr, [x19, #40]
	mov	x0, sp
	mov	w2, #0
	bl	_vmw_piter_start
	mov	x0, sp
	bl	_vmw_piter_next
	cbz	x0, LBB0_18
; %bb.14:
	mov	x22, #-1
Lloh8:
	adrp	x21, _PAGE_SIZE@GOTPAGE
Lloh9:
	ldr	x21, [x21, _PAGE_SIZE@GOTPAGEOFF]
	b	LBB0_16
LBB0_15:                                ;   in Loop: Header=BB0_16 Depth=1
	mov	x0, sp
	bl	_vmw_piter_next
	mov	x22, x20
	cbz	x0, LBB0_18
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, sp
	bl	_vmw_piter_dma_addr
	mov	x20, x0
	ldr	x8, [x21]
	add	x8, x8, x22
	cmp	x0, x8
	b.eq	LBB0_15
; %bb.17:                               ;   in Loop: Header=BB0_16 Depth=1
	ldr	x8, [x19, #40]
	add	x8, x8, #1
	str	x8, [x19, #40]
	b	LBB0_15
LBB0_18:
	mov	w23, #0
	mov	w8, #1
	str	w8, [x19]
LBB0_19:
	mov	x0, x23
	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
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdr	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_vmw_ttm_map_dma.sgl_size,8,3 ; @vmw_ttm_map_dma.sgl_size
.zerofill __DATA,__bss,_vmw_ttm_map_dma.sgt_size,8,3 ; @vmw_ttm_map_dma.sgt_size
	.comm	_PAGE_SHIFT,8,3                 ; @PAGE_SHIFT
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_PAGE_SIZE,8,3                  ; @PAGE_SIZE
	.no_dead_strip	_vmw_ttm_map_dma
.subsections_via_symbols
