	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function calgary_alloc_coherent
_calgary_alloc_coherent:                ## @calgary_alloc_coherent
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r13d
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
	movq	%rsi, %rbx
	movq	%rdi, %r15
	callq	_find_iommu_table
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	callq	_PAGE_ALIGN
	movq	%rax, %r12
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
	movq	%r12, %rdi
	callq	_get_order
	movq	___GFP_DMA@GOTPCREL(%rip), %rcx
	movq	___GFP_HIGHMEM@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edi
	orl	(%rcx), %edi
	movq	___GFP_DMA32@GOTPCREL(%rip), %rcx
	orl	(%rcx), %edi
	notl	%edi
	andl	%r13d, %edi
	movl	%eax, %esi
	callq	___get_free_pages
	testq	%rax, %rax
	je	LBB0_4
## %bb.1:
	movq	%rax, %rbx
	movq	%r12, %r13
	movl	%r14d, %ecx
	shrq	%cl, %r13
	movq	%rax, %rdi
	xorl	%esi, %esi
	movq	%r12, %rdx
	callq	_memset
	movq	_DMA_BIDIRECTIONAL@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r15, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movq	%rbx, %rdx
	movl	%r13d, %ecx
	callq	_iommu_alloc
	movq	_bad_dma_address@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_2
## %bb.3:
	movq	%r12, %rdi
	callq	_get_order
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_free_pages
LBB0_4:
	xorl	%ebx, %ebx
	jmp	LBB0_5
LBB0_2:
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, (%rcx)
LBB0_5:
	movq	%rbx, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SHIFT,8,3                 ## @PAGE_SHIFT
	.comm	___GFP_DMA,4,2                  ## @__GFP_DMA
	.comm	___GFP_HIGHMEM,4,2              ## @__GFP_HIGHMEM
	.comm	___GFP_DMA32,4,2                ## @__GFP_DMA32
	.comm	_DMA_BIDIRECTIONAL,4,2          ## @DMA_BIDIRECTIONAL
	.comm	_bad_dma_address,8,3            ## @bad_dma_address
	.no_dead_strip	_calgary_alloc_coherent
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function calgary_alloc_coherent
_calgary_alloc_coherent:                ; @calgary_alloc_coherent
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x22, x3
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
	bl	_find_iommu_table
	mov	x23, x0
	mov	x0, x20
	bl	_PAGE_ALIGN
	mov	x20, x0
Lloh0:
	adrp	x8, _PAGE_SHIFT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PAGE_SHIFT@GOTPAGEOFF]
Lloh2:
	ldr	x24, [x8]
	bl	_get_order
	mov	x1, x0
Lloh3:
	adrp	x8, ___GFP_DMA@GOTPAGE
Lloh4:
	ldr	x8, [x8, ___GFP_DMA@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, ___GFP_HIGHMEM@GOTPAGE
Lloh7:
	ldr	x9, [x9, ___GFP_HIGHMEM@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh9:
	adrp	x9, ___GFP_DMA32@GOTPAGE
Lloh10:
	ldr	x9, [x9, ___GFP_DMA32@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	orr	w8, w8, w9
	bic	w0, w22, w8
	bl	___get_free_pages
	mov	x22, x0
	cbz	x0, LBB0_4
; %bb.1:
	lsr	x24, x20, x24
	mov	x0, x22
	mov	w1, #0
	mov	x2, x20
	bl	_memset
Lloh12:
	adrp	x8, _DMA_BIDIRECTIONAL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _DMA_BIDIRECTIONAL@GOTPAGEOFF]
Lloh14:
	ldr	w4, [x8]
	mov	x0, x21
	mov	x1, x23
	mov	x2, x22
	mov	x3, x24
	bl	_iommu_alloc
Lloh15:
	adrp	x8, _bad_dma_address@GOTPAGE
Lloh16:
	ldr	x8, [x8, _bad_dma_address@GOTPAGEOFF]
Lloh17:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_3
; %bb.2:
	mov	x0, x20
	bl	_get_order
	mov	x1, x0
	mov	x0, x22
	bl	_free_pages
	mov	x22, #0
	b	LBB0_4
LBB0_3:
	str	x0, [x19]
LBB0_4:
	mov	x0, x22
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SHIFT,8,3                 ; @PAGE_SHIFT
	.comm	___GFP_DMA,4,2                  ; @__GFP_DMA
	.comm	___GFP_HIGHMEM,4,2              ; @__GFP_HIGHMEM
	.comm	___GFP_DMA32,4,2                ; @__GFP_DMA32
	.comm	_DMA_BIDIRECTIONAL,4,2          ; @DMA_BIDIRECTIONAL
	.comm	_bad_dma_address,8,3            ; @bad_dma_address
	.no_dead_strip	_calgary_alloc_coherent
.subsections_via_symbols
