	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvr2_context_create            ## -- Begin function pvr2_context_create
	.p2align	4, 0x90
_pvr2_context_create:                   ## @pvr2_context_create
	.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	%rdx, %r12
	movq	%rsi, %r14
	movq	%rdi, %r15
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$40, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_8
## %bb.1:
	movq	%rax, %rbx
	movq	_PVR2_TRACE_CTXT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdx
	callq	_pvr2_trace
	movq	%r12, (%rbx)
	movq	%rbx, %rdi
	addq	$32, %rdi
	callq	_mutex_init
	movq	_pvr2_context_mutex@GOTPCREL(%rip), %r12
	movq	%r12, %rdi
	callq	_mutex_lock
	movq	_pvr2_context_exist_last@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rax
	movq	%rax, 24(%rbx)
	movq	$0, 16(%rbx)
	movq	%rbx, (%rcx)
	testq	%rax, %rax
	jne	LBB0_4
## %bb.2:
	movq	_pvr2_context_exist_first@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_4:
	addq	$16, %rax
LBB0_5:
	movq	%rbx, (%rax)
	movq	%r12, %rdi
	callq	_mutex_unlock
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_pvr2_hdw_create
	movl	%eax, 8(%rbx)
	testl	%eax, %eax
	je	LBB0_7
## %bb.6:
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_pvr2_context_set_notify
	jmp	LBB0_9
LBB0_7:
	movq	%rbx, %rdi
	callq	_pvr2_context_destroy
LBB0_8:
	xorl	%ebx, %ebx
LBB0_9:
	movq	%rbx, %rax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_PVR2_TRACE_CTXT,4,2            ## @PVR2_TRACE_CTXT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"pvr2_context %p (create)"

	.comm	_pvr2_context_mutex,4,2         ## @pvr2_context_mutex
	.comm	_pvr2_context_exist_last,8,3    ## @pvr2_context_exist_last
	.comm	_pvr2_context_exist_first,8,3   ## @pvr2_context_exist_first
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvr2_context_create            ; -- Begin function pvr2_context_create
	.p2align	2
_pvr2_context_create:                   ; @pvr2_context_create
	.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	x22, x2
	mov	x20, x1
	mov	x21, x0
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #40
	bl	_kzalloc
	mov	x19, x0
	cbz	x0, LBB0_4
; %bb.1:
Lloh3:
	adrp	x8, _PVR2_TRACE_CTXT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PVR2_TRACE_CTXT@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x19
	bl	_pvr2_trace
	str	x22, [x19]
	add	x0, x19, #32
	bl	_mutex_init
Lloh8:
	adrp	x22, _pvr2_context_mutex@GOTPAGE
Lloh9:
	ldr	x22, [x22, _pvr2_context_mutex@GOTPAGEOFF]
	mov	x0, x22
	bl	_mutex_lock
Lloh10:
	adrp	x8, _pvr2_context_exist_last@GOTPAGE
Lloh11:
	ldr	x8, [x8, _pvr2_context_exist_last@GOTPAGEOFF]
	ldr	x9, [x8]
	stp	xzr, x9, [x19, #16]
	str	x19, [x8]
	add	x8, x9, #16
Lloh12:
	adrp	x10, _pvr2_context_exist_first@GOTPAGE
Lloh13:
	ldr	x10, [x10, _pvr2_context_exist_first@GOTPAGEOFF]
	cmp	x9, #0
	csel	x8, x10, x8, eq
	str	x19, [x8]
	mov	x0, x22
	bl	_mutex_unlock
	mov	x0, x21
	mov	x1, x20
	bl	_pvr2_hdw_create
	str	w0, [x19, #8]
	cbz	w0, LBB0_3
; %bb.2:
	mov	x0, x19
	mov	w1, #1
	bl	_pvr2_context_set_notify
	b	LBB0_4
LBB0_3:
	mov	x0, x19
	bl	_pvr2_context_destroy
	mov	x19, #0
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	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_PVR2_TRACE_CTXT,4,2            ; @PVR2_TRACE_CTXT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"pvr2_context %p (create)"

	.comm	_pvr2_context_mutex,4,2         ; @pvr2_context_mutex
	.comm	_pvr2_context_exist_last,8,3    ; @pvr2_context_exist_last
	.comm	_pvr2_context_exist_first,8,3   ; @pvr2_context_exist_first
.subsections_via_symbols
