	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nvkm_mem_new_host
_nvkm_mem_new_host:                     ## @nvkm_mem_new_host
	.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	%r8, %r12
	movq	%rdi, %r14
	movq	%r8, -64(%rbp)
	movl	%r9d, -52(%rbp)
	movq	16(%rdi), %rax
	movslq	%esi, %rsi
	movl	(%rax,%rsi,4), %eax
	movq	_NVKM_MEM_COHERENT@GOTPCREL(%rip), %rsi
	testl	%eax, (%rsi)
	je	LBB0_2
## %bb.1:
	movq	_NVKM_MEM_UNCACHED@GOTPCREL(%rip), %rsi
	testl	%eax, (%rsi)
	je	LBB0_3
LBB0_2:
	movq	_NVKM_MEM_TARGET_NCOH@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_3:
	movq	_NVKM_MEM_TARGET_HOST@GOTPCREL(%rip), %rax
LBB0_4:
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rsi
	cmpl	%edx, (%rsi)
	jne	LBB0_18
## %bb.5:
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movq	___GFP_ZERO@GOTPCREL(%rip), %rcx
	movq	8(%r14), %rdx
	movq	_ENOSYS@GOTPCREL(%rip), %rsi
	xorl	%ebx, %ebx
	movq	_GFP_USER@GOTPCREL(%rip), %rdi
	movl	(%rcx), %ecx
	subl	(%rsi), %ebx
	orl	(%rdi), %ecx
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	movq	(%rdx), %rcx
	movq	%rcx, -72(%rbp)                 ## 8-byte Spill
	movl	(%rax), %r15d
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$40, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_25
## %bb.6:
	movq	%rax, %r13
	movq	16(%rbp), %rax
	movl	%r15d, (%r13)
	movq	%r14, 32(%r13)
	movq	%r13, %r15
	addq	$24, %r15
	movq	%r15, (%rax)
	movl	(%r12), %ecx
	movq	8(%r12), %r8
	leaq	-64(%rbp), %rsi
	leaq	-52(%rbp), %rdx
	movl	%ebx, %edi
	xorl	%r9d, %r9d
	pushq	$0
	pushq	$0
	callq	_nvif_unpack
	addq	$16, %rsp
	testl	%eax, %eax
	je	LBB0_9
## %bb.7:
	movl	(%r12), %ecx
	leaq	-64(%rbp), %rsi
	leaq	-52(%rbp), %rdx
	movl	%eax, %edi
	callq	_nvif_unvers
	testl	%eax, %eax
	je	LBB0_11
## %bb.8:
	movl	%eax, %ebx
	movq	%r13, %rdi
	callq	_kfree
	jmp	LBB0_27
LBB0_9:
	cmpq	$0, 8(%r12)
	je	LBB0_15
## %bb.10:
	movq	_nvkm_mem_dma@GOTPCREL(%rip), %rdi
	movq	%r15, %rsi
	callq	_nvkm_memory_ctor
	movq	8(%r12), %rax
	movq	%rax, 16(%r13)
	jmp	LBB0_16
LBB0_11:
	movq	_nvkm_mem_dma@GOTPCREL(%rip), %rdi
	movq	%r15, %rsi
	callq	_nvkm_memory_ctor
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	callq	_ALIGN
	movl	%eax, %r15d
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	sarl	%cl, %r15d
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edx
	movl	%r15d, %edi
	movl	$8, %esi
	callq	_kvmalloc_array
	movq	%rax, 8(%r13)
	testq	%rax, %rax
	je	LBB0_25
## %bb.12:
	movl	(%rbx), %edx
	movl	%r15d, %edi
	movl	$4, %esi
	callq	_kvmalloc_array
	movq	%rax, 16(%r13)
	testq	%rax, %rax
	je	LBB0_25
## %bb.13:
	cmpl	$33, (%r14)
	jl	LBB0_19
## %bb.14:
	movq	_GFP_HIGHUSER@GOTPCREL(%rip), %rax
	jmp	LBB0_20
LBB0_15:
	movq	_nvkm_mem_sgl@GOTPCREL(%rip), %rdi
	movq	%r15, %rsi
	callq	_nvkm_memory_ctor
	movl	(%r12), %eax
	movl	%eax, 28(%r13)
LBB0_16:
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	callq	_IS_ALIGNED
	testl	%eax, %eax
	je	LBB0_18
## %bb.17:
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	sarl	%cl, %ebx
	movl	%ebx, 4(%r13)
	xorl	%ebx, %ebx
	jmp	LBB0_27
LBB0_18:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_26
LBB0_19:
	movq	_GFP_DMA32@GOTPCREL(%rip), %rax
LBB0_20:
	movl	-48(%rbp), %ecx                 ## 4-byte Reload
	orl	(%rax), %ecx
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	movl	$0, 4(%r13)
	testl	%r15d, %r15d
	je	LBB0_28
## %bb.21:
	movq	_DMA_BIDIRECTIONAL@GOTPCREL(%rip), %r12
LBB0_22:                                ## =>This Inner Loop Header: Depth=1
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	callq	_alloc_page
	testq	%rax, %rax
	je	LBB0_25
## %bb.23:                              ##   in Loop: Header=BB0_22 Depth=1
	movq	%rax, %rbx
	movq	8(%r14), %rax
	movq	(%rax), %rdi
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	(%r12), %r8d
	movq	%rbx, %rsi
	xorl	%edx, %edx
	callq	_dma_map_page
	movq	16(%r13), %rcx
	movslq	4(%r13), %rdx
	movl	%eax, (%rcx,%rdx,4)
	movslq	4(%r13), %rax
	movl	(%rcx,%rax,4), %esi
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	callq	_dma_mapping_error
	testq	%rax, %rax
	jne	LBB0_29
## %bb.24:                              ##   in Loop: Header=BB0_22 Depth=1
	movq	8(%r13), %rax
	movslq	4(%r13), %rcx
	movq	%rbx, (%rax,%rcx,8)
	leal	1(%rcx), %eax
	xorl	%ebx, %ebx
	movl	%eax, 4(%r13)
	decl	%r15d
	jne	LBB0_22
	jmp	LBB0_27
LBB0_28:
	xorl	%ebx, %ebx
	jmp	LBB0_27
LBB0_29:
	movq	%rbx, %rdi
	callq	___free_page
LBB0_25:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_26:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_27:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOSYS,4,2                     ## @ENOSYS
	.comm	_GFP_USER,4,2                   ## @GFP_USER
	.comm	___GFP_ZERO,4,2                 ## @__GFP_ZERO
	.comm	_NVKM_MEM_COHERENT,4,2          ## @NVKM_MEM_COHERENT
	.comm	_NVKM_MEM_UNCACHED,4,2          ## @NVKM_MEM_UNCACHED
	.comm	_NVKM_MEM_TARGET_HOST,4,2       ## @NVKM_MEM_TARGET_HOST
	.comm	_NVKM_MEM_TARGET_NCOH,4,2       ## @NVKM_MEM_TARGET_NCOH
	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_nvkm_mem_dma,4,2               ## @nvkm_mem_dma
	.comm	_nvkm_mem_sgl,4,2               ## @nvkm_mem_sgl
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_GFP_HIGHUSER,4,2               ## @GFP_HIGHUSER
	.comm	_GFP_DMA32,4,2                  ## @GFP_DMA32
	.comm	_DMA_BIDIRECTIONAL,4,2          ## @DMA_BIDIRECTIONAL
	.no_dead_strip	_nvkm_mem_new_host
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nvkm_mem_new_host
_nvkm_mem_new_host:                     ; @nvkm_mem_new_host
	.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
	mov	x24, x6
	mov	x23, x4
	mov	x22, x3
	mov	x19, x0
	str	x4, [sp, #24]
	str	w5, [sp, #20]
	ldr	x8, [x0, #16]
	ldr	w8, [x8, w1, sxtw #2]
Lloh0:
	adrp	x9, _NVKM_MEM_COHERENT@GOTPAGE
Lloh1:
	ldr	x9, [x9, _NVKM_MEM_COHERENT@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.1:
Lloh3:
	adrp	x9, _NVKM_MEM_UNCACHED@GOTPAGE
Lloh4:
	ldr	x9, [x9, _NVKM_MEM_UNCACHED@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_3
LBB0_2:
Lloh6:
	adrp	x8, _NVKM_MEM_TARGET_NCOH@GOTPAGE
Lloh7:
	ldr	x8, [x8, _NVKM_MEM_TARGET_NCOH@GOTPAGEOFF]
	b	LBB0_4
LBB0_3:
Lloh8:
	adrp	x8, _NVKM_MEM_TARGET_HOST@GOTPAGE
Lloh9:
	ldr	x8, [x8, _NVKM_MEM_TARGET_HOST@GOTPAGEOFF]
LBB0_4:
Lloh10:
	adrp	x26, _PAGE_SHIFT@GOTPAGE
Lloh11:
	ldr	x26, [x26, _PAGE_SHIFT@GOTPAGEOFF]
	ldr	w9, [x26]
	cmp	w9, w2
	b.ne	LBB0_21
; %bb.5:
Lloh12:
	adrp	x9, _ENOSYS@GOTPAGE
Lloh13:
	ldr	x9, [x9, _ENOSYS@GOTPAGEOFF]
	ldr	x10, [x19, #8]
Lloh14:
	ldr	w25, [x9]
Lloh15:
	adrp	x9, _GFP_USER@GOTPAGE
Lloh16:
	ldr	x9, [x9, _GFP_USER@GOTPAGEOFF]
Lloh17:
	adrp	x11, ___GFP_ZERO@GOTPAGE
Lloh18:
	ldr	x11, [x11, ___GFP_ZERO@GOTPAGEOFF]
	ldr	x10, [x10]
	str	x10, [sp, #8]                   ; 8-byte Folded Spill
Lloh19:
	ldr	w9, [x9]
	str	w9, [sp, #4]                    ; 4-byte Folded Spill
Lloh20:
	ldr	w28, [x11]
	ldr	w27, [x8]
Lloh21:
	adrp	x21, _GFP_KERNEL@GOTPAGE
Lloh22:
	ldr	x21, [x21, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	w0, #40
	bl	_kzalloc
	cbz	x0, LBB0_24
; %bb.6:
	mov	x20, x0
	neg	w0, w25
	str	w27, [x20]
	str	x19, [x20, #32]
	add	x25, x20, #24
	str	x25, [x24]
	ldp	x3, x4, [x23]
	add	x1, sp, #24
	add	x2, sp, #20
	mov	w5, #0
	mov	w6, #0
	mov	w7, #0
	bl	_nvif_unpack
	cbz	w0, LBB0_9
; %bb.7:
	ldr	w3, [x23]
	add	x1, sp, #24
	add	x2, sp, #20
	bl	_nvif_unvers
	cbz	w0, LBB0_11
; %bb.8:
	mov	x23, x0
	mov	x0, x20
	bl	_kfree
	b	LBB0_26
LBB0_9:
	ldr	x8, [x23, #8]
	cbz	x8, LBB0_18
; %bb.10:
Lloh23:
	adrp	x0, _nvkm_mem_dma@GOTPAGE
Lloh24:
	ldr	x0, [x0, _nvkm_mem_dma@GOTPAGEOFF]
	mov	x1, x25
	bl	_nvkm_memory_ctor
	ldr	x8, [x23, #8]
	str	x8, [x20, #16]
	b	LBB0_19
LBB0_11:
Lloh25:
	adrp	x0, _nvkm_mem_dma@GOTPAGE
Lloh26:
	ldr	x0, [x0, _nvkm_mem_dma@GOTPAGEOFF]
	mov	x1, x25
	bl	_nvkm_memory_ctor
Lloh27:
	adrp	x27, _PAGE_SIZE@GOTPAGE
Lloh28:
	ldr	x27, [x27, _PAGE_SIZE@GOTPAGEOFF]
	ldr	w1, [x27]
	mov	x0, x22
	bl	_ALIGN
	ldr	w8, [x26]
	asr	w22, w0, w8
	ldr	w2, [x21]
	mov	x0, x22
	mov	w1, #8
	bl	_kvmalloc_array
	str	x0, [x20, #8]
	cbz	x0, LBB0_24
; %bb.12:
	ldr	w2, [x21]
	mov	x0, x22
	mov	w1, #4
	bl	_kvmalloc_array
	str	x0, [x20, #16]
	cbz	x0, LBB0_24
; %bb.13:
	ldr	w8, [x19]
Lloh29:
	adrp	x9, _GFP_HIGHUSER@GOTPAGE
Lloh30:
	ldr	x9, [x9, _GFP_HIGHUSER@GOTPAGEOFF]
Lloh31:
	adrp	x10, _GFP_DMA32@GOTPAGE
Lloh32:
	ldr	x10, [x10, _GFP_DMA32@GOTPAGEOFF]
	cmp	w8, #32
	csel	x8, x9, x10, gt
	ldr	w8, [x8]
	str	wzr, [x20, #4]
	cbz	w22, LBB0_22
; %bb.14:
	ldr	w9, [sp, #4]                    ; 4-byte Folded Reload
	orr	w9, w28, w9
	orr	w24, w9, w8
Lloh33:
	adrp	x21, _DMA_BIDIRECTIONAL@GOTPAGE
Lloh34:
	ldr	x21, [x21, _DMA_BIDIRECTIONAL@GOTPAGEOFF]
	ldr	x26, [sp, #8]                   ; 8-byte Folded Reload
LBB0_15:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x24
	bl	_alloc_page
	cbz	x0, LBB0_24
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=1
	mov	x25, x0
	ldr	x8, [x19, #8]
	ldr	x0, [x8]
	ldr	w3, [x27]
	ldr	w4, [x21]
	mov	x1, x25
	mov	w2, #0
	bl	_dma_map_page
	ldr	x8, [x20, #16]
	ldrsw	x9, [x20, #4]
	str	w0, [x8, x9, lsl #2]
	ldrsw	x9, [x20, #4]
	ldr	w1, [x8, x9, lsl #2]
	mov	x0, x26
	bl	_dma_mapping_error
	cbnz	x0, LBB0_23
; %bb.17:                               ;   in Loop: Header=BB0_15 Depth=1
	mov	w23, #0
	ldr	x8, [x20, #8]
	ldrsw	x9, [x20, #4]
	str	x25, [x8, x9, lsl #3]
	add	w8, w9, #1
	str	w8, [x20, #4]
	subs	w22, w22, #1
	b.ne	LBB0_15
	b	LBB0_26
LBB0_18:
Lloh35:
	adrp	x0, _nvkm_mem_sgl@GOTPAGE
Lloh36:
	ldr	x0, [x0, _nvkm_mem_sgl@GOTPAGEOFF]
	mov	x1, x25
	bl	_nvkm_memory_ctor
	ldr	w8, [x23]
	str	w8, [x20, #28]
LBB0_19:
Lloh37:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh38:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh39:
	ldr	w1, [x8]
	mov	x0, x22
	bl	_IS_ALIGNED
	cbz	w0, LBB0_21
; %bb.20:
	mov	w23, #0
	ldr	w8, [x26]
	asr	w8, w22, w8
	str	w8, [x20, #4]
	b	LBB0_26
LBB0_21:
Lloh40:
	adrp	x8, _EINVAL@GOTPAGE
Lloh41:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_25
LBB0_22:
	mov	w23, #0
	b	LBB0_26
LBB0_23:
	mov	x0, x25
	bl	___free_page
LBB0_24:
Lloh42:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh43:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_25:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_26:
	mov	x0, x23
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh19
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpLdrGot	Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh40, Lloh41
	.loh AdrpLdrGot	Lloh42, Lloh43
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOSYS,4,2                     ; @ENOSYS
	.comm	_GFP_USER,4,2                   ; @GFP_USER
	.comm	___GFP_ZERO,4,2                 ; @__GFP_ZERO
	.comm	_NVKM_MEM_COHERENT,4,2          ; @NVKM_MEM_COHERENT
	.comm	_NVKM_MEM_UNCACHED,4,2          ; @NVKM_MEM_UNCACHED
	.comm	_NVKM_MEM_TARGET_HOST,4,2       ; @NVKM_MEM_TARGET_HOST
	.comm	_NVKM_MEM_TARGET_NCOH,4,2       ; @NVKM_MEM_TARGET_NCOH
	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_nvkm_mem_dma,4,2               ; @nvkm_mem_dma
	.comm	_nvkm_mem_sgl,4,2               ; @nvkm_mem_sgl
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_GFP_HIGHUSER,4,2               ; @GFP_HIGHUSER
	.comm	_GFP_DMA32,4,2                  ; @GFP_DMA32
	.comm	_DMA_BIDIRECTIONAL,4,2          ; @DMA_BIDIRECTIONAL
	.no_dead_strip	_nvkm_mem_new_host
.subsections_via_symbols
