	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function amdgpu_ctx_alloc
_amdgpu_ctx_alloc:                      ## @amdgpu_ctx_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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, -72(%rbp)                  ## 8-byte Spill
	movl	%ecx, %r13d
	movq	%rdx, %rbx
	movq	%rsi, %r15
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	movq	_GFP_KERNEL@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movl	$4, %edi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r12
	movl	%r13d, -44(%rbp)                ## 4-byte Spill
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	%r15, %rdi
	callq	_mutex_lock
	leaq	4(%r15), %r13
	movq	_AMDGPU_VM_MAX_NUM_CTX@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	(%r14), %r8d
	movq	%r13, %rdi
	movq	%r12, %rsi
	movl	$1, %edx
	callq	_idr_alloc
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	movl	%ebx, %eax
	movq	-72(%rbp), %r14                 ## 8-byte Reload
	movq	%rax, (%r14)
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movq	%r12, %rcx
	callq	_amdgpu_ctx_init
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_6
## %bb.5:
	movq	(%r14), %rsi
	movq	%r13, %rdi
	callq	_idr_remove
	movq	$0, (%r14)
	movq	%r12, %rdi
	callq	_kfree
LBB0_6:
	movq	%r15, %rdi
	callq	_mutex_unlock
	jmp	LBB0_7
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_7
LBB0_3:
	movq	%r15, %rdi
	callq	_mutex_unlock
	movq	%r12, %rdi
	callq	_kfree
LBB0_7:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_AMDGPU_VM_MAX_NUM_CTX,4,2      ## @AMDGPU_VM_MAX_NUM_CTX
	.no_dead_strip	_amdgpu_ctx_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function amdgpu_ctx_alloc
_amdgpu_ctx_alloc:                      ; @amdgpu_ctx_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	x20, x4
	mov	x24, x3
	mov	x23, x2
	mov	x19, x1
	mov	x25, x0
Lloh0:
	adrp	x22, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x22, [x22, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	w0, #4
	bl	_kmalloc
	cbz	x0, LBB0_5
; %bb.1:
	mov	x21, x0
	mov	x0, x19
	bl	_mutex_lock
	add	x26, x19, #4
Lloh2:
	adrp	x8, _AMDGPU_VM_MAX_NUM_CTX@GOTPAGE
Lloh3:
	ldr	x8, [x8, _AMDGPU_VM_MAX_NUM_CTX@GOTPAGEOFF]
Lloh4:
	ldr	w3, [x8]
	ldr	w4, [x22]
	mov	x0, x26
	mov	x1, x21
	mov	w2, #1
	bl	_idr_alloc
	mov	x22, x0
	tbnz	w0, #31, LBB0_6
; %bb.2:
	mov	w8, w22
	str	x8, [x20]
	mov	x0, x25
	mov	x1, x24
	mov	x2, x23
	mov	x3, x21
	bl	_amdgpu_ctx_init
	mov	x22, x0
	cbz	w0, LBB0_4
; %bb.3:
	ldr	x1, [x20]
	mov	x0, x26
	bl	_idr_remove
	str	xzr, [x20]
	mov	x0, x21
	bl	_kfree
LBB0_4:
	mov	x0, x19
	bl	_mutex_unlock
	b	LBB0_7
LBB0_5:
Lloh5:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_7
LBB0_6:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x21
	bl	_kfree
LBB0_7:
	mov	x0, x22
	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
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_AMDGPU_VM_MAX_NUM_CTX,4,2      ; @AMDGPU_VM_MAX_NUM_CTX
	.no_dead_strip	_amdgpu_ctx_alloc
.subsections_via_symbols
