	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gem_context_register
_gem_context_register:                  ## @gem_context_register
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %r12
	movq	%rsi, 16(%rdi)
	movq	8(%rdi), %rax
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	%r14, (%rax)
LBB0_2:
	movq	_current@GOTPCREL(%rip), %r15
	movq	(%r15), %rdi
	movq	_PIDTYPE_PID@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_get_task_pid
	movl	%eax, (%r12)
	movq	_GFP_KERNEL@GOTPCREL(%rip), %r13
	movl	(%r13), %ebx
	movq	(%r15), %rcx
	movl	(%rcx), %r15d
	movl	%eax, %edi
	callq	_pid_nr
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %edi
	movl	%r15d, %edx
	movl	%eax, %ecx
	callq	_kasprintf
	movl	%eax, 4(%r12)
	testl	%eax, %eax
	je	LBB0_3
## %bb.4:
	movq	%r14, %rdi
	callq	_mutex_lock
	leaq	4(%r14), %rdi
	movl	(%r13), %r8d
	movq	%r12, %rsi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_idr_alloc
	movl	%eax, %r15d
	movq	%r14, %rdi
	callq	_mutex_unlock
	testl	%r15d, %r15d
	jns	LBB0_7
## %bb.5:
	leaq	4(%r12), %rdi
	callq	_fetch_and_zero
	movl	%eax, %edi
	callq	_kfree
	jmp	LBB0_6
LBB0_3:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_6:
	movq	%r12, %rdi
	callq	_fetch_and_zero
	movl	%eax, %edi
	callq	_put_pid
LBB0_7:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_current,8,3                    ## @current
	.comm	_PIDTYPE_PID,4,2                ## @PIDTYPE_PID
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s[%d]"

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

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gem_context_register
_gem_context_register:                  ; @gem_context_register
	.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	x20, x1
	mov	x19, x0
	str	x1, [x0, #16]
	ldr	x8, [x0, #8]
	cbz	x8, LBB0_2
; %bb.1:
	str	x20, [x8]
LBB0_2:
Lloh0:
	adrp	x22, _current@GOTPAGE
Lloh1:
	ldr	x22, [x22, _current@GOTPAGEOFF]
	ldr	x0, [x22]
Lloh2:
	adrp	x8, _PIDTYPE_PID@GOTPAGE
Lloh3:
	ldr	x8, [x8, _PIDTYPE_PID@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	bl	_get_task_pid
	str	w0, [x19]
Lloh5:
	adrp	x23, _GFP_KERNEL@GOTPAGE
Lloh6:
	ldr	x23, [x23, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w21, [x23]
	ldr	x8, [x22]
	ldr	w22, [x8]
	bl	_pid_nr
	mov	x3, x0
Lloh7:
	adrp	x1, l_.str@PAGE
Lloh8:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	mov	x2, x22
	bl	_kasprintf
	mov	x22, x19
	str	w0, [x22, #4]!
	cbz	w0, LBB0_5
; %bb.3:
	mov	x0, x20
	bl	_mutex_lock
	add	x0, x20, #4
	ldr	w4, [x23]
	mov	x1, x19
	mov	w2, #0
	mov	w3, #0
	bl	_idr_alloc
	mov	x21, x0
	mov	x0, x20
	bl	_mutex_unlock
	tbz	w21, #31, LBB0_7
; %bb.4:
	mov	x0, x22
	bl	_fetch_and_zero
	bl	_kfree
	b	LBB0_6
LBB0_5:
Lloh9:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_6:
	mov	x0, x19
	bl	_fetch_and_zero
	bl	_put_pid
LBB0_7:
	mov	x0, x21
	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 AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_current,8,3                    ; @current
	.comm	_PIDTYPE_PID,4,2                ; @PIDTYPE_PID
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s[%d]"

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