	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_tegra_drm_alloc                ## -- Begin function tegra_drm_alloc
	.p2align	4, 0x90
_tegra_drm_alloc:                       ## @tegra_drm_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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rdi, %r13
	cmpq	$0, 16(%rdi)
	je	LBB0_2
## %bb.1:
	leaq	8(%r13), %rdi
	callq	_iova_align
	jmp	LBB0_3
LBB0_2:
	movq	%rsi, %rdi
	callq	_PAGE_ALIGN
LBB0_3:
	movq	%rax, %r15
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movq	___GFP_ZERO@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
	orl	(%rax), %ebx
	xorl	%eax, %eax
	cmpq	$0, 16(%r13)
	jne	LBB0_5
## %bb.4:
	movq	_GFP_DMA@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_5:
	orl	%eax, %ebx
	movq	%r15, %rdi
	callq	_get_order
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	___get_free_pages
	testq	%rax, %rax
	je	LBB0_6
## %bb.8:
	movq	%rax, %r12
	cmpq	$0, 16(%r13)
	je	LBB0_9
## %bb.11:
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	leaq	8(%r13), %rbx
	movb	(%r13), %cl
	movq	%r15, %rsi
	shrq	%cl, %rsi
	movl	12(%r13), %edx
	movq	%rbx, %rdi
	movl	$1, %ecx
	callq	_alloc_iova
	testq	%rax, %rax
	je	LBB0_12
## %bb.13:
	movq	%rax, %r14
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	movq	%rax, %rsi
	callq	_iova_dma_addr
	movl	%eax, %ebx
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	%ebx, (%rax)
	movq	16(%r13), %r13
	movq	%r12, %rdi
	callq	_virt_to_phys
	movq	_IOMMU_READ@GOTPCREL(%rip), %rcx
	movq	_IOMMU_WRITE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %r8d
	orl	(%rcx), %r8d
	movq	%r13, %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	movq	%r15, %rcx
	callq	_iommu_map
	testl	%eax, %eax
	jns	LBB0_10
## %bb.14:
	movl	%eax, %ebx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	%r14, %rsi
	callq	___free_iova
	jmp	LBB0_15
LBB0_6:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	subl	(%rax), %edi
	jmp	LBB0_7
LBB0_9:
	movq	%r12, %rdi
	callq	_virt_to_phys
	movl	%eax, (%r14)
LBB0_10:
	movq	%r12, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_15:
	movq	%r15, %rdi
	callq	_get_order
	movq	%r12, %rdi
	movl	%eax, %esi
	callq	_free_pages
	movl	%ebx, %edi
LBB0_7:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_PTR                        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	___GFP_ZERO,4,2                 ## @__GFP_ZERO
	.comm	_GFP_DMA,4,2                    ## @GFP_DMA
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_IOMMU_READ,4,2                 ## @IOMMU_READ
	.comm	_IOMMU_WRITE,4,2                ## @IOMMU_WRITE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_tegra_drm_alloc                ; -- Begin function tegra_drm_alloc
	.p2align	2
_tegra_drm_alloc:                       ; @tegra_drm_alloc
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x21, x2
	mov	x22, x0
	ldr	x8, [x0, #16]
	cbz	x8, LBB0_2
; %bb.1:
	add	x0, x22, #8
	bl	_iova_align
	b	LBB0_3
LBB0_2:
	mov	x0, x1
	bl	_PAGE_ALIGN
LBB0_3:
	mov	x19, x0
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, ___GFP_ZERO@GOTPAGE
Lloh4:
	ldr	x9, [x9, ___GFP_ZERO@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	orr	w8, w9, w8
	ldr	x9, [x22, #16]
Lloh6:
	adrp	x10, _GFP_DMA@GOTPAGE
Lloh7:
	ldr	x10, [x10, _GFP_DMA@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
	cmp	x9, #0
	csel	w9, w10, wzr, eq
	orr	w20, w8, w9
	bl	_get_order
	mov	x1, x0
	mov	x0, x20
	bl	___get_free_pages
	cbz	x0, LBB0_8
; %bb.4:
	mov	x20, x0
	ldr	x8, [x22, #16]
	cbz	x8, LBB0_9
; %bb.5:
	add	x23, x22, #8
	ldr	x8, [x22]
	lsr	x1, x19, x8
	ldr	w2, [x22, #12]
	mov	x0, x23
	mov	w3, #1
	bl	_alloc_iova
	cbz	x0, LBB0_11
; %bb.6:
	mov	x24, x0
	mov	x0, x23
	mov	x1, x24
	bl	_iova_dma_addr
	mov	x25, x0
	str	w0, [x21]
	ldr	x21, [x22, #16]
	mov	x0, x20
	bl	_virt_to_phys
	mov	x2, x0
Lloh9:
	adrp	x8, _IOMMU_READ@GOTPAGE
Lloh10:
	ldr	x8, [x8, _IOMMU_READ@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
Lloh12:
	adrp	x9, _IOMMU_WRITE@GOTPAGE
Lloh13:
	ldr	x9, [x9, _IOMMU_WRITE@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	orr	w4, w9, w8
	mov	x0, x21
	mov	x1, x25
	mov	x3, x19
	bl	_iommu_map
	tbz	w0, #31, LBB0_10
; %bb.7:
	mov	x21, x0
	mov	x0, x23
	mov	x1, x24
	bl	___free_iova
	b	LBB0_12
LBB0_8:
Lloh15:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh16:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_13
LBB0_9:
	mov	x0, x20
	bl	_virt_to_phys
	str	w0, [x21]
LBB0_10:
	mov	x0, x20
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_11:
Lloh18:
	adrp	x8, _EBUSY@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_12:
	mov	x0, x19
	bl	_get_order
	mov	x1, x0
	mov	x0, x20
	bl	_free_pages
	mov	x0, x21
LBB0_13:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_ERR_PTR
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	___GFP_ZERO,4,2                 ; @__GFP_ZERO
	.comm	_GFP_DMA,4,2                    ; @GFP_DMA
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_IOMMU_READ,4,2                 ; @IOMMU_READ
	.comm	_IOMMU_WRITE,4,2                ; @IOMMU_WRITE
.subsections_via_symbols
