	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gru_handle_user_call_os        ## -- Begin function gru_handle_user_call_os
	.p2align	4, 0x90
_gru_handle_user_call_os:               ## @gru_handle_user_call_os
	.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	%rdi, %rbx
	movq	_EINVAL@GOTPCREL(%rip), %r13
	xorl	%r15d, %r15d
	xorl	%r12d, %r12d
	subl	(%r13), %r12d
	movq	_call_os@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_STAT
	movq	%rbx, %rdi
	callq	_get_cb_number
	movl	%eax, %r14d
	movq	_GRU_HANDLE_STRIDE@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	decq	%rax
	testq	%rbx, %rax
	jne	LBB0_2
## %bb.1:
	movq	_GRU_NUM_CB@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r14d
	jge	LBB0_2
## %bb.3:
	movq	%rbx, %rdi
	callq	_gru_find_lock_gts
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	movq	%rax, %r15
	movq	_grudev@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	8(%r15), %rax
	testq	%rax, %rax
	je	LBB0_6
## %bb.7:
	movl	(%rax), %ecx
	jmp	LBB0_8
LBB0_2:
	subl	(%r13), %r15d
	movl	%r15d, %r12d
	jmp	LBB0_15
LBB0_4:
	xorl	%r12d, %r12d
	subl	(%r13), %r12d
	jmp	LBB0_15
LBB0_6:
	movl	$-1, %ecx
LBB0_8:
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdx
	movq	%r15, %r8
	callq	_gru_dbg
	movq	_GRU_CBR_AU_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	imull	(%r15), %eax
	cmpl	%eax, %r14d
	jge	LBB0_14
## %bb.9:
	movq	%r15, %rdi
	callq	_gru_check_context_placement
	cmpq	$0, 8(%r15)
	je	LBB0_12
## %bb.10:
	cmpq	$0, 16(%r15)
	je	LBB0_12
## %bb.11:
	movq	$0, 16(%r15)
	movq	%r15, %rdi
	callq	_gru_update_cch
LBB0_12:
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_thread_cbr_number
	movq	8(%r15), %rdi
	testq	%rdi, %rdi
	je	LBB0_14
## %bb.13:
	movl	%eax, %esi
	callq	_get_tfh_by_index
	movq	%rax, %rbx
	movq	8(%r15), %rax
	movl	4(%rax), %edi
	movl	4(%r15), %esi
	movl	%r14d, %edx
	callq	_get_gseg_base_address_cb
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_gru_user_dropin
	movl	%eax, %r12d
LBB0_14:
	movq	%r15, %rdi
	callq	_gru_unlock_gts
LBB0_15:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_call_os,4,2                    ## @call_os
	.comm	_GRU_HANDLE_STRIDE,4,2          ## @GRU_HANDLE_STRIDE
	.comm	_GRU_NUM_CB,4,2                 ## @GRU_NUM_CB
	.comm	_grudev,4,2                     ## @grudev
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"address 0x%lx, gid %d, gts 0x%p\n"

	.comm	_GRU_CBR_AU_SIZE,4,2            ## @GRU_CBR_AU_SIZE
	.comm	_EAGAIN,4,2                     ## @EAGAIN
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gru_handle_user_call_os        ; -- Begin function gru_handle_user_call_os
	.p2align	2
_gru_handle_user_call_os:               ; @gru_handle_user_call_os
	.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	x22, x0
Lloh0:
	adrp	x21, _EINVAL@GOTPAGE
Lloh1:
	ldr	x21, [x21, _EINVAL@GOTPAGEOFF]
	ldr	w23, [x21]
Lloh2:
	adrp	x8, _call_os@GOTPAGE
Lloh3:
	ldr	x8, [x8, _call_os@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
	bl	_STAT
	mov	x0, x22
	bl	_get_cb_number
Lloh5:
	adrp	x8, _GRU_HANDLE_STRIDE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _GRU_HANDLE_STRIDE@GOTPAGEOFF]
Lloh7:
	ldrsw	x8, [x8]
	sub	x8, x8, #1
	and	x8, x8, x22
Lloh8:
	adrp	x9, _GRU_NUM_CB@GOTPAGE
Lloh9:
	ldr	x9, [x9, _GRU_NUM_CB@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	cmp	x8, #0
	ccmp	w0, w9, #0, eq
	b.ge	LBB0_4
; %bb.1:
	mov	x20, x0
	mov	x0, x22
	bl	_gru_find_lock_gts
	cbz	x0, LBB0_4
; %bb.2:
	mov	x19, x0
	neg	w21, w23
Lloh11:
	adrp	x8, _grudev@GOTPAGE
Lloh12:
	ldr	x8, [x8, _grudev@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_5
; %bb.3:
	ldr	w3, [x8]
	b	LBB0_6
LBB0_4:
	ldr	w8, [x21]
	neg	w21, w8
	b	LBB0_14
LBB0_5:
	mov	w3, #-1
LBB0_6:
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x22
	mov	x4, x19
	bl	_gru_dbg
	ldr	w8, [x19]
Lloh16:
	adrp	x9, _GRU_CBR_AU_SIZE@GOTPAGE
Lloh17:
	ldr	x9, [x9, _GRU_CBR_AU_SIZE@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	mul	w8, w9, w8
	cmp	w20, w8
	b.ge	LBB0_13
; %bb.7:
	mov	x0, x19
	bl	_gru_check_context_placement
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_10
; %bb.8:
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_10
; %bb.9:
	str	xzr, [x19, #16]
	mov	x0, x19
	bl	_gru_update_cch
LBB0_10:
Lloh19:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
Lloh21:
	ldr	w21, [x8]
	mov	x0, x19
	mov	x1, x20
	bl	_thread_cbr_number
	mov	x1, x0
	ldr	x0, [x19, #8]
	cbz	x0, LBB0_12
; %bb.11:
	bl	_get_tfh_by_index
	mov	x21, x0
	ldr	x8, [x19, #8]
	ldr	w0, [x8, #4]
	ldr	w1, [x19, #4]
	mov	x2, x20
	bl	_get_gseg_base_address_cb
	mov	x2, x0
	mov	x0, x19
	mov	x1, x21
	bl	_gru_user_dropin
	mov	x21, x0
	b	LBB0_13
LBB0_12:
	neg	w21, w21
LBB0_13:
	mov	x0, x19
	bl	_gru_unlock_gts
LBB0_14:
	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 AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_call_os,4,2                    ; @call_os
	.comm	_GRU_HANDLE_STRIDE,4,2          ; @GRU_HANDLE_STRIDE
	.comm	_GRU_NUM_CB,4,2                 ; @GRU_NUM_CB
	.comm	_grudev,4,2                     ; @grudev
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"address 0x%lx, gid %d, gts 0x%p\n"

	.comm	_GRU_CBR_AU_SIZE,4,2            ; @GRU_CBR_AU_SIZE
	.comm	_EAGAIN,4,2                     ; @EAGAIN
.subsections_via_symbols
