	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function arm_smmu_domain_finalise_s1
_arm_smmu_domain_finalise_s1:           ## @arm_smmu_domain_finalise_s1
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	24(%rdi), %r12
	movl	(%r12), %edi
	movl	8(%r12), %esi
	callq	_arm_smmu_bitmap_alloc
	movl	%eax, %r14d
	testl	%eax, %eax
	js	LBB0_4
## %bb.1:
	movl	4(%r12), %edi
	movq	_CTXDESC_CD_DWORDS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	shll	$3, %esi
	leaq	20(%rbx), %rdx
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movq	___GFP_ZERO@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	callq	_dmam_alloc_coherent
	movl	%eax, 16(%rbx)
	testl	%eax, %eax
	je	LBB0_2
## %bb.3:
	movl	%r14d, 12(%rbx)
	movq	16(%r15), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%rbx)
	movl	8(%r15), %eax
	movl	%eax, 4(%rbx)
	movq	(%r15), %rax
	movl	(%rax), %eax
	movl	%eax, (%rbx)
	xorl	%r14d, %r14d
	jmp	LBB0_4
LBB0_2:
	movl	4(%r12), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_warn
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movl	(%r12), %edi
	movl	%r14d, %esi
	callq	_arm_smmu_bitmap_free
	movl	%ebx, %r14d
LBB0_4:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CTXDESC_CD_DWORDS,4,2          ## @CTXDESC_CD_DWORDS
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	___GFP_ZERO,4,2                 ## @__GFP_ZERO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to allocate context descriptor\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_arm_smmu_domain_finalise_s1
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function arm_smmu_domain_finalise_s1
_arm_smmu_domain_finalise_s1:           ; @arm_smmu_domain_finalise_s1
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x21, x1
	mov	x20, x0
	ldr	x22, [x0, #24]
	ldr	w0, [x22]
	ldr	w1, [x22, #8]
	bl	_arm_smmu_bitmap_alloc
	mov	x19, x0
	tbnz	w0, #31, LBB0_4
; %bb.1:
	ldr	w0, [x22, #4]
Lloh0:
	adrp	x8, _CTXDESC_CD_DWORDS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CTXDESC_CD_DWORDS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	lsl	w1, w8, #3
Lloh3:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
	add	x2, x20, #20
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, ___GFP_ZERO@GOTPAGE
Lloh7:
	ldr	x9, [x9, ___GFP_ZERO@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	orr	w3, w9, w8
	bl	_dmam_alloc_coherent
	str	w0, [x20, #16]
	cbz	w0, LBB0_3
; %bb.2:
	str	w19, [x20, #12]
	ldr	x8, [x21, #16]
	ldr	w8, [x8]
	ldr	w9, [x21, #8]
	stp	w9, w8, [x20, #4]
	ldr	x8, [x21]
	ldr	w8, [x8]
	str	w8, [x20]
	mov	w19, #0
	b	LBB0_4
LBB0_3:
	ldr	w0, [x22, #4]
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_warn
Lloh11:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	neg	w20, w8
	ldr	w0, [x22]
	mov	x1, x19
	bl	_arm_smmu_bitmap_free
	mov	x19, x20
LBB0_4:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_CTXDESC_CD_DWORDS,4,2          ; @CTXDESC_CD_DWORDS
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	___GFP_ZERO,4,2                 ; @__GFP_ZERO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to allocate context descriptor\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_arm_smmu_domain_finalise_s1
.subsections_via_symbols
