	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_savage_dma_alloc               ## -- Begin function savage_dma_alloc
	.p2align	4, 0x90
_savage_dma_alloc:                      ## @savage_dma_alloc
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %ebx
	movq	%rdi, %r15
	movl	(%rdi), %r13d
	movq	_SAVAGE_DMA_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	16(%rdi), %rax
	leaq	(%r13,%r13,2), %rcx
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movl	(%rax,%rcx,8), %ecx
	movl	%esi, %r12d
	subl	%ecx, %r12d
	leal	(%rbx,%rsi), %eax
	decl	%eax
	subl	%r12d, %eax
	xorl	%edx, %edx
	divl	%esi
	movl	%eax, %r14d
	leaq	L_.str(%rip), %rdi
	movl	%r13d, %esi
	movl	%ecx, %edx
	movl	%ebx, %ecx
	movl	%r12d, %r8d
	movl	%eax, %r9d
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	movq	%r14, %rax
	movq	%r15, %r9
	movl	%r13d, %ecx
	addl	%eax, %ecx
	cmpl	4(%r15), %ecx
	jae	LBB0_2
## %bb.1:
	movq	16(%r9), %rsi
	movq	24(%r9), %rcx
	movq	_SAVAGE_DMA_PAGE_SIZE@GOTPCREL(%rip), %r11
	movl	(%r11), %edx
	imull	%r13d, %edx
	shlq	$2, %rdx
	addq	(%rcx), %rdx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	(%rsi,%rdi,8), %ecx
	leaq	(%rdx,%rcx,4), %r14
	cmpl	%ebx, %r12d
	cmovael	%ebx, %r12d
	addl	%r12d, %ecx
	movl	%ecx, (%rsi,%rdi,8)
	subl	%r12d, %ebx
	leal	1(%r13), %esi
	testl	%eax, %eax
	je	LBB0_10
LBB0_11:
	movl	(%r11), %ecx
	testb	$1, %al
	jne	LBB0_13
## %bb.12:
                                        ## implicit-def: $r8
	movl	%eax, %edx
	cmpl	$1, %eax
	jne	LBB0_15
	jmp	LBB0_17
LBB0_2:
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	leal	-1(%rbx), %r15d
	movq	%r9, %rdi
	movq	%r9, %r12
	callq	*40(%r9)
	movq	%r12, %r9
	movq	_SAVAGE_DMA_PAGE_SIZE@GOTPCREL(%rip), %r11
	movl	(%r11), %ecx
	addl	%ecx, %r15d
	xorl	%esi, %esi
	movl	%r15d, %eax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $eax killed $eax def $rax
	movl	4(%r12), %edi
	cmpl	%edi, %r13d
	jae	LBB0_8
## %bb.3:
	movl	32(%r9), %ecx
	movq	16(%r9), %r8
	movl	%edi, %edx
	subl	%r13d, %edx
	movq	%r13, %r10
	notq	%r10
	testb	$1, %dl
	je	LBB0_5
## %bb.4:
	movl	%ecx, 16(%r8,%r14,8)
	movl	$0, (%r8,%r14,8)
	movq	$0, 8(%r8,%r14,8)
	incq	%r13
LBB0_5:
	addq	%rdi, %r10
	je	LBB0_8
## %bb.6:
	subq	%r13, %rdi
	leaq	(,%r13,2), %rdx
	addq	%r13, %rdx
	leaq	(%r8,%rdx,8), %rdx
	addq	$40, %rdx
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	%ecx, -24(%rdx)
	movl	$0, -40(%rdx)
	movq	$0, -32(%rdx)
	movl	%ecx, (%rdx)
	movl	$0, -16(%rdx)
	movq	$0, -8(%rdx)
	addq	$48, %rdx
	addq	$-2, %rdi
	jne	LBB0_7
LBB0_8:
	movq	24(%r9), %rcx
	movq	(%rcx), %r14
	movl	$0, 8(%r9)
	testl	%eax, %eax
	jne	LBB0_11
LBB0_10:
	movq	16(%r9), %r8
	jmp	LBB0_17
LBB0_13:
	movq	16(%r9), %r8
	movl	%esi, %edx
	leaq	(%rdx,%rdx,2), %rdx
	cmpl	%ecx, %ebx
	cmovbl	%ebx, %ecx
	movl	%ecx, (%r8,%rdx,8)
	movl	(%r11), %ecx
	subl	%ecx, %ebx
	incl	%esi
	leal	-1(%rax), %edx
	cmpl	$1, %eax
	je	LBB0_17
LBB0_15:
	movq	16(%r9), %r8
	.p2align	4, 0x90
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	movl	%esi, %edi
	leaq	(%rdi,%rdi,2), %rdi
	cmpl	%ecx, %ebx
	cmovbl	%ebx, %ecx
	movl	%ecx, (%r8,%rdi,8)
	movl	(%r11), %ecx
	subl	%ecx, %ebx
	leal	1(%rsi), %edi
	leaq	(%rdi,%rdi,2), %rdi
	cmpl	%ecx, %ebx
	cmovbl	%ebx, %ecx
	movl	%ecx, (%r8,%rdi,8)
	movl	(%r11), %ecx
	subl	%ecx, %ebx
	addl	$2, %esi
	addl	$-2, %edx
	jne	LBB0_16
LBB0_17:
	decl	%esi
	movl	%esi, (%r9)
	leaq	(%rsi,%rsi,2), %rcx
	movl	(%r8,%rcx,8), %edx
	leaq	L_.str.1(%rip), %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	movl	%ebx, %ecx
	xorl	%eax, %eax
	movq	%r9, %rbx
	callq	_DRM_DEBUG
	movl	(%rbx), %esi
	movq	%rbx, %rdi
	callq	_savage_dma_wait
	movq	%r14, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SAVAGE_DMA_PAGE_SIZE,4,2       ## @SAVAGE_DMA_PAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cur=%u, cur->used=%u, n=%u, rest=%u, nr_pages=%u\n"

L_.str.1:                               ## @.str.1
	.asciz	"cur=%u, cur->used=%u, n=%u\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_savage_dma_alloc               ; -- Begin function savage_dma_alloc
	.p2align	2
_savage_dma_alloc:                      ; @savage_dma_alloc
	.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	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x23, _SAVAGE_DMA_PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x23, [x23, _SAVAGE_DMA_PAGE_SIZE@GOTPAGEOFF]
	ldr	w22, [x0]
	ldr	x8, [x0, #16]
	mov	w9, #24
	umull	x9, w22, w9
	ldr	w2, [x8, x9]
	ldr	w8, [x23]
	sub	w25, w8, w2
	sub	w21, w1, #1
	add	w9, w21, w8
	sub	w9, w9, w25
	udiv	w24, w9, w8
	stp	x25, x24, [sp]
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x22
	mov	x3, x20
	bl	_DRM_DEBUG
	ldr	w8, [x19, #4]
	add	w9, w24, w22
	cmp	w9, w8
	b.hs	LBB0_4
; %bb.1:
	ldp	x9, x8, [x19, #16]
	ldr	x8, [x8]
	ldr	w10, [x23]
	mul	w10, w10, w22
	add	x8, x8, w10, uxtw #2
	mov	w10, #24
	mul	x10, x22, x10
	ldr	w11, [x9, x10]
	add	x21, x8, x11, lsl #2
	cmp	w25, w20
	csel	w8, w25, w20, lo
	add	w11, w11, w8
	str	w11, [x9, x10]
	sub	w20, w20, w8
	add	w8, w22, #1
	cbz	w24, LBB0_13
LBB0_2:
	ldr	w10, [x23]
	ldr	x9, [x19, #16]
	mov	w11, #24
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	umull	x12, w8, w11
	cmp	w20, w10
	csel	w10, w20, w10, lo
	str	w10, [x9, x12]
	ldr	w10, [x23]
	sub	w20, w20, w10
	add	w8, w8, #1
	subs	w24, w24, #1
	b.ne	LBB0_3
	b	LBB0_14
LBB0_4:
	ldr	x8, [x19, #40]
	mov	x0, x19
	blr	x8
	ldr	w8, [x23]
	add	w10, w21, w8
	ldr	w9, [x19, #4]
	udiv	w24, w10, w8
	cmp	w22, w9
	b.hs	LBB0_12
; %bb.5:
	ldr	w8, [x19, #32]
	ldr	x10, [x19, #16]
	sub	x12, x9, x22
	cmp	x12, #4
	b.hs	LBB0_7
; %bb.6:
	mov	x11, x22
	b	LBB0_10
LBB0_7:
	and	x13, x12, #0xfffffffffffffffc
	add	x11, x13, x22
	mov	w14, #24
	madd	x14, x22, x14, x10
	mov	x15, x13
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	str	w8, [x14, #16]
	str	w8, [x14, #40]
	str	w8, [x14, #64]
	str	w8, [x14, #88]
	str	wzr, [x14]
	str	wzr, [x14, #24]
	str	wzr, [x14, #48]
	str	wzr, [x14, #72]
	str	xzr, [x14, #8]
	str	xzr, [x14, #32]
	str	xzr, [x14, #56]
	str	xzr, [x14, #80]
	add	x14, x14, #96
	subs	x15, x15, #4
	b.ne	LBB0_8
; %bb.9:
	cmp	x12, x13
	b.eq	LBB0_12
LBB0_10:
	mov	w12, #24
	madd	x10, x11, x12, x10
	add	x10, x10, #16
	sub	x9, x9, x11
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	str	w8, [x10]
	stur	wzr, [x10, #-16]
	stur	xzr, [x10, #-8]
	add	x10, x10, #24
	subs	x9, x9, #1
	b.ne	LBB0_11
LBB0_12:
	mov	w8, #0
	ldr	x9, [x19, #24]
	ldr	x21, [x9]
	str	wzr, [x19, #8]
	cbnz	w24, LBB0_2
LBB0_13:
	ldr	x9, [x19, #16]
LBB0_14:
	sub	w1, w8, #1
	str	w1, [x19]
	mov	w8, #24
	umull	x8, w1, w8
	ldr	w2, [x9, x8]
Lloh4:
	adrp	x0, l_.str.1@PAGE
Lloh5:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x3, x20
	bl	_DRM_DEBUG
	ldr	w1, [x19]
	mov	x0, x19
	bl	_savage_dma_wait
	mov	x0, x21
	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 AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_SAVAGE_DMA_PAGE_SIZE,4,2       ; @SAVAGE_DMA_PAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cur=%u, cur->used=%u, n=%u, rest=%u, nr_pages=%u\n"

l_.str.1:                               ; @.str.1
	.asciz	"cur=%u, cur->used=%u, n=%u\n"

.subsections_via_symbols
