	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function snd_trident_alloc_sg_pages
_snd_trident_alloc_sg_pages:            ## @snd_trident_alloc_sg_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, %r13
	movq	%rdi, %r14
	movq	(%rsi), %rbx
	movl	(%rbx), %eax
	testl	%eax, %eax
	jle	LBB0_2
## %bb.1:
	movq	_SNDRV_TRIDENT_MAX_PAGES@GOTPCREL(%rip), %rcx
	movq	_SNDRV_TRIDENT_PAGE_SIZE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	imull	(%rcx), %edx
	xorl	%edi, %edi
	cmpl	%edx, %eax
	setg	%dil
	jmp	LBB0_3
LBB0_2:
	movl	$1, %edi
LBB0_3:
	callq	_snd_BUG_ON
	testq	%rax, %rax
	jne	LBB0_4
## %bb.5:
	movq	(%r14), %r15
	xorl	%edi, %edi
	testq	%r15, %r15
	sete	%dil
	callq	_snd_BUG_ON
	testq	%rax, %rax
	je	LBB0_7
LBB0_4:
	xorl	%ebx, %ebx
LBB0_17:
	movq	%rbx, %rax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	%r15, %rdi
	callq	_mutex_lock
	movl	(%rbx), %esi
	movq	%r15, %rdi
	callq	_search_empty
	testq	%rax, %rax
	je	LBB0_15
## %bb.8:
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_firstpg
	movl	%eax, %r12d
	movq	%rbx, %rdi
	callq	_lastpg
	cmpl	%eax, %r12d
	jg	LBB0_16
## %bb.9:
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	%r14, -80(%rbp)                 ## 8-byte Spill
	movq	%r12, -72(%rbp)                 ## 8-byte Spill
	leal	-1(%r12), %eax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movzbl	(%rax), %ecx
	movl	%r12d, %eax
	shll	%cl, %eax
	movslq	%eax, %rbx
	movq	%r13, %rdi
	movq	%rbx, %rsi
	callq	_snd_pcm_sgbuf_get_addr
	movl	%eax, %r15d
	movq	%r13, %r14
	movq	%r13, %rdi
	movq	%rbx, %rsi
	callq	_snd_pcm_sgbuf_get_ptr
	movq	%rax, %r13
	movl	%r15d, %edi
	callq	_is_valid_page
	testl	%eax, %eax
	je	LBB0_14
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	leal	(%rax,%r12), %esi
	movq	-80(%rbp), %rdi                 ## 8-byte Reload
	movq	%r13, %rdx
	movl	%r15d, %ecx
	callq	_set_tlb_bus
	leal	1(%r12), %ebx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_lastpg
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	addl	%r12d, %ecx
	incl	%ecx
	movl	%ebx, %r12d
	cmpl	%eax, %ecx
	movq	%r14, %r13
	jl	LBB0_10
## %bb.12:
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_16
LBB0_14:
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	___snd_util_mem_free
LBB0_15:
	xorl	%ebx, %ebx
LBB0_16:
	movq	%r15, %rdi
	callq	_mutex_unlock
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_SNDRV_TRIDENT_MAX_PAGES,4,2    ## @SNDRV_TRIDENT_MAX_PAGES
	.comm	_SNDRV_TRIDENT_PAGE_SIZE,4,2    ## @SNDRV_TRIDENT_PAGE_SIZE
	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
	.no_dead_strip	_snd_trident_alloc_sg_pages
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function snd_trident_alloc_sg_pages
_snd_trident_alloc_sg_pages:            ; @snd_trident_alloc_sg_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
	ldr	x22, [x1]
	ldr	w8, [x22]
	cmp	w8, #1
	b.lt	LBB0_2
; %bb.1:
Lloh0:
	adrp	x9, _SNDRV_TRIDENT_MAX_PAGES@GOTPAGE
Lloh1:
	ldr	x9, [x9, _SNDRV_TRIDENT_MAX_PAGES@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
Lloh3:
	adrp	x10, _SNDRV_TRIDENT_PAGE_SIZE@GOTPAGE
Lloh4:
	ldr	x10, [x10, _SNDRV_TRIDENT_PAGE_SIZE@GOTPAGEOFF]
Lloh5:
	ldr	w10, [x10]
	mul	w9, w10, w9
	cmp	w8, w9
	cset	w0, gt
	bl	_snd_BUG_ON
	cbnz	x0, LBB0_4
	b	LBB0_3
LBB0_2:
	mov	w0, #1
	bl	_snd_BUG_ON
	cbnz	x0, LBB0_4
LBB0_3:
	ldr	x21, [x20]
	cmp	x21, #0
	cset	w0, eq
	bl	_snd_BUG_ON
	cbz	x0, LBB0_6
LBB0_4:
	mov	x22, #0
LBB0_5:
	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
LBB0_6:
	mov	x0, x21
	bl	_mutex_lock
	ldr	w1, [x22]
	mov	x0, x21
	bl	_search_empty
	mov	x22, x0
	cbz	x0, LBB0_12
; %bb.7:
	mov	x0, x22
	bl	_firstpg
	mov	x23, x0
	mov	x0, x22
	bl	_lastpg
	cmp	w23, w0
	b.gt	LBB0_12
; %bb.8:
	mov	w26, #0
Lloh6:
	adrp	x27, _PAGE_SHIFT@GOTPAGE
Lloh7:
	ldr	x27, [x27, _PAGE_SHIFT@GOTPAGEOFF]
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x27]
	lsl	w8, w26, w8
	sxtw	x25, w8
	mov	x0, x19
	mov	x1, x25
	bl	_snd_pcm_sgbuf_get_addr
	mov	x24, x0
	mov	x0, x19
	mov	x1, x25
	bl	_snd_pcm_sgbuf_get_ptr
	mov	x25, x0
	mov	x0, x24
	bl	_is_valid_page
	cbz	w0, LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	add	w1, w23, w26
	mov	x0, x20
	mov	x2, x25
	mov	x3, x24
	bl	_set_tlb_bus
	add	w26, w26, #1
	mov	x0, x22
	bl	_lastpg
	add	w8, w23, w26
	sub	w8, w8, #1
	cmp	w8, w0
	b.lt	LBB0_9
	b	LBB0_12
LBB0_11:
	mov	x0, x21
	mov	x1, x22
	bl	___snd_util_mem_free
	mov	x22, #0
LBB0_12:
	mov	x0, x21
	bl	_mutex_unlock
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_SNDRV_TRIDENT_MAX_PAGES,4,2    ; @SNDRV_TRIDENT_MAX_PAGES
	.comm	_SNDRV_TRIDENT_PAGE_SIZE,4,2    ; @SNDRV_TRIDENT_PAGE_SIZE
	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
	.no_dead_strip	_snd_trident_alloc_sg_pages
.subsections_via_symbols
