	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ttm_populate_and_map_pages     ## -- Begin function ttm_populate_and_map_pages
	.p2align	4, 0x90
_ttm_populate_and_map_pages:            ## @ttm_populate_and_map_pages
	.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, %r14
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	leaq	8(%rsi), %rdi
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdx, %rsi
	callq	_ttm_pool_populate
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	testl	%eax, %eax
	jne	LBB0_1
## %bb.2:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %eax
	testl	%eax, %eax
	je	LBB0_20
## %bb.3:
	xorl	%r13d, %r13d
                                        ## implicit-def: $ecx
                                        ## kill: killed $ecx
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_6 Depth=1
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_ttm_pool_unpopulate
	xorl	%ecx, %ecx
	movq	_EFAULT@GOTPCREL(%rip), %rax
	subl	(%rax), %ecx
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movl	$-1, %r13d
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	testq	%rax, %rax
	jne	LBB0_1
LBB0_5:                                 ##   in Loop: Header=BB0_6 Depth=1
	incl	%r13d
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %eax
	cmpl	%eax, %r13d
	jae	LBB0_20
LBB0_6:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_8 Depth 2
                                        ##     Child Loop BB0_14 Depth 2
                                        ##     Child Loop BB0_17 Depth 2
	movq	16(%r14), %rcx
	movl	%r13d, %r12d
	movq	(%rcx,%r12,8), %rsi
	leal	1(%r13), %edx
	movl	$1, %r15d
	cmpl	%eax, %edx
	jae	LBB0_11
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	%eax, %r8d
	subl	%r13d, %r8d
	addl	$-2, %r8d
	addq	$2, %r8
	negl	%eax
	addq	%r12, %rax
	movl	$1, %r15d
	movq	%rsi, %rdi
	.p2align	4, 0x90
LBB0_8:                                 ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	leal	(%r12,%r15), %edx
	addq	$4, %rdi
	cmpq	(%rcx,%rdx,8), %rdi
	jne	LBB0_11
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=2
	incq	%r15
	movl	%eax, %edx
	addl	%r15d, %edx
	jne	LBB0_8
## %bb.10:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	%r8, %r15
LBB0_11:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	imulq	%r15, %rcx
	movq	_DMA_BIDIRECTIONAL@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_dma_map_page
	movq	(%r14), %rcx
	movq	%rax, (%rcx,%r12,8)
	movq	%rbx, %rdi
	movq	%rax, %rsi
	callq	_dma_mapping_error
	testq	%rax, %rax
	je	LBB0_15
## %bb.12:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	testl	%r13d, %r13d
	movq	_PAGE_SIZE@GOTPCREL(%rip), %r15
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	_DMA_BIDIRECTIONAL@GOTPCREL(%rip), %r13
	je	LBB0_4
## %bb.13:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	(%r14), %rax
	.p2align	4, 0x90
LBB0_14:                                ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	-8(%rax,%r12,8), %rsi
	movq	(%r15), %rdx
	movl	(%r13), %ecx
	movq	%rbx, %rdi
	callq	_dma_unmap_page
	movq	(%r14), %rax
	movq	$0, -8(%rax,%r12,8)
	decq	%r12
	jne	LBB0_14
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_6 Depth=1
	cmpq	$2, %r15
	jb	LBB0_5
## %bb.16:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	(%r14), %rcx
	movq	(%rcx,%r12,8), %rdx
	movl	$2, %ebx
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rdi
	.p2align	4, 0x90
LBB0_17:                                ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	addq	(%rdi), %rdx
	leal	(%rbx,%r13), %esi
	decl	%esi
	movq	%rdx, (%rcx,%rsi,8)
	movl	%ebx, %esi
	incl	%ebx
	cmpq	%rsi, %r15
	ja	LBB0_17
## %bb.18:                              ##   in Loop: Header=BB0_6 Depth=1
	addl	%ebx, %r13d
	addl	$-2, %r13d
	testq	%rax, %rax
	je	LBB0_5
	jmp	LBB0_1
LBB0_20:
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
LBB0_1:
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,8,3                  ## @PAGE_SIZE
	.comm	_DMA_BIDIRECTIONAL,4,2          ## @DMA_BIDIRECTIONAL
	.comm	_EFAULT,4,2                     ## @EFAULT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ttm_populate_and_map_pages     ; -- Begin function ttm_populate_and_map_pages
	.p2align	2
_ttm_populate_and_map_pages:            ; @ttm_populate_and_map_pages
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x1
	mov	x20, x0
	add	x21, x1, #8
	mov	x0, x21
	mov	x1, x2
	bl	_ttm_pool_populate
	mov	x22, x0
	cbnz	w0, LBB0_20
; %bb.1:
	ldr	w9, [x21]
	cbz	w9, LBB0_19
; %bb.2:
	mov	w27, #0
Lloh0:
	adrp	x24, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x24, [x24, _PAGE_SIZE@GOTPAGEOFF]
Lloh2:
	adrp	x25, _DMA_BIDIRECTIONAL@GOTPAGE
Lloh3:
	ldr	x25, [x25, _DMA_BIDIRECTIONAL@GOTPAGEOFF]
                                        ; implicit-def: $w22
	b	LBB0_5
LBB0_3:                                 ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x21
	bl	_ttm_pool_unpopulate
Lloh4:
	adrp	x8, _EFAULT@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w22, w8
	mov	w27, #-1
	cbnz	x23, LBB0_20
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	w27, w27, #1
	ldr	w9, [x21]
	cmp	w27, w9
	b.hs	LBB0_19
LBB0_5:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
                                        ;     Child Loop BB0_14 Depth 2
                                        ;     Child Loop BB0_17 Depth 2
	ldr	x8, [x19, #16]
	mov	w28, w27
	ldr	x1, [x8, w27, uxtw #3]
	add	w10, w27, #1
	cmp	w10, w9
	b.hs	LBB0_10
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	sub	w10, w9, w27
	sub	w10, w10, #2
	add	x10, x10, #2
	neg	w9, w9
	add	x9, x28, x9
	mov	w26, #1
	mov	x11, x1
LBB0_7:                                 ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	add	w12, w28, w26
	add	x11, x11, #4
	ldr	x12, [x8, w12, uxtw #3]
	cmp	x11, x12
	b.ne	LBB0_11
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=2
	add	x26, x26, #1
	cmn	w9, w26
	b.ne	LBB0_7
; %bb.9:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x26, x10
	b	LBB0_11
LBB0_10:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	w26, #1
LBB0_11:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x24]
	mul	x3, x8, x26
	ldr	w4, [x25]
	mov	x0, x20
	mov	w2, #0
	bl	_dma_map_page
	mov	x1, x0
	ldr	x8, [x19]
	str	x0, [x8, x28, lsl #3]
	mov	x0, x20
	bl	_dma_mapping_error
	mov	x23, x0
	cbz	x0, LBB0_15
; %bb.12:                               ;   in Loop: Header=BB0_5 Depth=1
	cbz	w27, LBB0_3
; %bb.13:                               ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x19]
	lsl	x9, x28, #3
	sub	x22, x9, #8
LBB0_14:                                ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x1, [x8, x22]
	ldr	x2, [x24]
	ldr	w3, [x25]
	mov	x0, x20
	bl	_dma_unmap_page
	ldr	x8, [x19]
	str	xzr, [x8, x22]
	sub	x22, x22, #8
	cmn	x22, #8
	b.ne	LBB0_14
	b	LBB0_3
LBB0_15:                                ;   in Loop: Header=BB0_5 Depth=1
	cmp	x26, #2
	b.lo	LBB0_4
; %bb.16:                               ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x19]
	ldr	x9, [x8, x28, lsl #3]
	mov	w10, #2
LBB0_17:                                ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x11, [x24]
	add	x9, x11, x9
	add	w11, w27, w10
	sub	w11, w11, #1
	str	x9, [x8, w11, uxtw #3]
	add	w11, w10, #1
	cmp	x26, w10, uxtw
	mov	x10, x11
	b.hi	LBB0_17
; %bb.18:                               ;   in Loop: Header=BB0_5 Depth=1
	add	w8, w27, w11
	sub	w27, w8, #2
	cbz	x23, LBB0_4
	b	LBB0_20
LBB0_19:
	mov	w22, #0
LBB0_20:
	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
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,8,3                  ; @PAGE_SIZE
	.comm	_DMA_BIDIRECTIONAL,4,2          ; @DMA_BIDIRECTIONAL
	.comm	_EFAULT,4,2                     ; @EFAULT
.subsections_via_symbols
