	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gru_steal_context              ## -- Begin function gru_steal_context
	.p2align	4, 0x90
_gru_steal_context:                     ## @gru_steal_context
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movl	(%rdi), %eax
	testl	%eax, %eax
	jns	LBB0_2
## %bb.1:
	xorl	%eax, %eax
	callq	_uv_numa_blade_id
LBB0_2:
	movl	4(%r14), %ecx
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	movl	8(%r14), %r15d
	movq	_gru_base@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cltq
	movq	(%rcx,%rax,8), %rbx
	leaq	4(%rbx), %r12
	movq	%r12, %rdi
	callq	_spin_lock
	movl	(%rbx), %edi
	callq	_next_ctxnum
	movq	8(%rbx), %rsi
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	testl	%eax, %eax
	movq	%r14, -112(%rbp)                ## 8-byte Spill
	movq	%r12, -96(%rbp)                 ## 8-byte Spill
	jne	LBB0_4
## %bb.3:
	movq	%rbx, %rdi
	callq	_next_gru
	movq	%rax, %rsi
LBB0_4:
	movq	%rsi, 8(%rbx)
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, (%rbx)
	movslq	%eax, %rcx
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	xorl	%r14d, %r14d
	movq	_GRU_NUM_CCH@GOTPCREL(%rip), %r13
	movl	%eax, %ebx
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movq	%rsi, %r12
	movq	%r15, -104(%rbp)                ## 8-byte Spill
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_12 Depth 2
	movq	%r12, %rdi
	movq	-112(%rbp), %rsi                ## 8-byte Reload
	callq	_gru_check_chiplet_assignment
	testq	%rax, %rax
	je	LBB0_6
## %bb.9:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	(%r13), %ecx
	movq	%r12, %rdi
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	movl	%r15d, %edx
	callq	_check_gru_resources
	testq	%rax, %rax
	jne	LBB0_21
## %bb.10:                              ##   in Loop: Header=BB0_5 Depth=1
	leaq	12(%r12), %rdi
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	callq	_spin_lock
	movl	(%r13), %eax
	cmpl	%eax, %ebx
	jge	LBB0_18
## %bb.11:                              ##   in Loop: Header=BB0_5 Depth=1
	movl	%r14d, %ecx
	movq	%r13, %r14
	cmpq	-64(%rbp), %r12                 ## 8-byte Folded Reload
	sete	%r15b
	movl	%ecx, -84(%rbp)                 ## 4-byte Spill
	andb	%cl, %r15b
	movslq	%ebx, %rbx
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_12 Depth=2
	movl	(%r14), %eax
LBB0_16:                                ##   in Loop: Header=BB0_12 Depth=2
	incq	%rbx
	movslq	%eax, %rcx
	cmpq	%rcx, %rbx
	jge	LBB0_17
LBB0_12:                                ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpq	%rbx, -80(%rbp)                 ## 8-byte Folded Reload
	sete	%cl
	testb	%cl, %r15b
	jne	LBB0_17
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=2
	movq	16(%r12), %rcx
	movq	(%rcx,%rbx,8), %r13
	testq	%r13, %r13
	je	LBB0_16
## %bb.14:                              ##   in Loop: Header=BB0_12 Depth=2
	movq	%r13, %rdi
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	callq	_is_gts_stealable
	testq	%rax, %rax
	je	LBB0_15
	jmp	LBB0_23
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_5 Depth=1
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_5 Depth=1
	movq	-104(%rbp), %r15                ## 8-byte Reload
	movq	%r14, %r13
	movl	-84(%rbp), %r14d                ## 4-byte Reload
LBB0_18:                                ##   in Loop: Header=BB0_5 Depth=1
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_spin_unlock
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	cmpq	%rcx, %r12
	sete	%al
	andb	%r14b, %al
	cmpb	$1, %al
	jne	LBB0_7
## %bb.19:                              ##   in Loop: Header=BB0_5 Depth=1
	cmpl	-44(%rbp), %ebx                 ## 4-byte Folded Reload
	je	LBB0_20
LBB0_7:                                 ##   in Loop: Header=BB0_5 Depth=1
	cmpq	%rcx, %r12
	sete	%al
	testb	%al, %r14b
	jne	LBB0_8
## %bb.22:                              ##   in Loop: Header=BB0_5 Depth=1
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movq	%r12, %rsi
	callq	_next_gru
	movq	%rax, %r12
	movb	$1, %r14b
	xorl	%ebx, %ebx
	jmp	LBB0_5
LBB0_23:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_spin_unlock
	movq	-96(%rbp), %rdi                 ## 8-byte Reload
	callq	_spin_unlock
	movq	-112(%rbp), %rax                ## 8-byte Reload
	incl	16(%rax)
	movq	_jiffies@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 12(%r13)
	movq	%r13, %rdi
	callq	_is_kernel_context
	xorl	%esi, %esi
	testq	%rax, %rax
	sete	%sil
	movq	%r13, %rdi
	callq	_gru_unload_context
	movq	%r13, %rdi
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	callq	_gts_stolen
	jmp	LBB0_24
LBB0_8:
	movq	%rcx, %r12
	jmp	LBB0_21
LBB0_20:
	movq	%rcx, %r12
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, %ebx
LBB0_21:
	movq	-96(%rbp), %rdi                 ## 8-byte Reload
	callq	_spin_unlock
	movq	_steal_context_failed@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_STAT
	xorl	%r13d, %r13d
LBB0_24:
	movq	_grudev@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movl	4(%r12), %edi
	movl	8(%r12), %r15d
	callq	_hweight64
                                        ## kill: def $eax killed $eax def $rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movl	(%r12), %edi
	callq	_hweight64
                                        ## kill: def $eax killed $eax def $rax
	subq	$8, %rsp
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edi
	movl	%r15d, %edx
	movl	%ebx, %ecx
	movq	%r13, %r8
	movl	-48(%rbp), %r9d                 ## 4-byte Reload
	pushq	%rax
	pushq	-80(%rbp)                       ## 8-byte Folded Reload
	pushq	-104(%rbp)                      ## 8-byte Folded Reload
	callq	_gru_dbg
	addq	$104, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_gru_base,8,3                   ## @gru_base
	.comm	_GRU_NUM_CCH,4,2                ## @GRU_NUM_CCH
	.comm	_jiffies,4,2                    ## @jiffies
	.comm	_steal_context_failed,4,2       ## @steal_context_failed
	.comm	_grudev,4,2                     ## @grudev
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"stole gid %d, ctxnum %d from gts %p. Need cb %d, ds %d; avail cb %ld, ds %ld\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gru_steal_context              ; -- Begin function gru_steal_context
	.p2align	2
_gru_steal_context:                     ; @gru_steal_context
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x25, x0
	ldr	w0, [x0]
	tbz	w0, #31, LBB0_2
; %bb.1:
	bl	_uv_numa_blade_id
LBB0_2:
	ldp	w23, w8, [x25, #4]
	str	w8, [sp, #44]                   ; 4-byte Folded Spill
Lloh0:
	adrp	x8, _gru_base@GOTPAGE
Lloh1:
	ldr	x8, [x8, _gru_base@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	ldr	x24, [x8, w0, sxtw #3]
	add	x19, x24, #4
	mov	x0, x19
	bl	_spin_lock
	ldr	w0, [x24]
	bl	_next_ctxnum
                                        ; kill: def $w0 killed $w0 def $x0
	ldr	x27, [x24, #8]
	str	x0, [sp, #32]                   ; 8-byte Folded Spill
	str	x19, [sp, #8]                   ; 8-byte Folded Spill
	cbnz	w0, LBB0_4
; %bb.3:
	mov	x0, x24
	mov	x1, x27
	bl	_next_gru
	mov	x27, x0
LBB0_4:
	mov	w20, #0
	str	x27, [x24, #8]
	ldr	x21, [sp, #32]                  ; 8-byte Folded Reload
	str	w21, [x24]
	sxtw	x19, w21
                                        ; kill: def $w21 killed $w21 killed $x21 def $x21
	mov	x22, x27
Lloh3:
	adrp	x26, _GRU_NUM_CCH@GOTPAGE
Lloh4:
	ldr	x26, [x26, _GRU_NUM_CCH@GOTPAGEOFF]
	str	w23, [sp, #20]                  ; 4-byte Folded Spill
	str	x25, [sp, #24]                  ; 8-byte Folded Spill
LBB0_5:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_11 Depth 2
	mov	x0, x22
	mov	x1, x25
	bl	_gru_check_chiplet_assignment
	cbz	x0, LBB0_16
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w3, [x26]
	mov	x0, x22
	mov	x1, x23
	ldr	w2, [sp, #44]                   ; 4-byte Folded Reload
	bl	_check_gru_resources
	cbnz	x0, LBB0_21
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	add	x25, x22, #12
	mov	x0, x25
	bl	_spin_lock
	ldr	w8, [x26]
	cmp	w21, w8
	b.ge	LBB0_15
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	cmp	x22, x27
	cset	w9, eq
	and	w23, w20, w9
                                        ; kill: def $w21 killed $w21 killed $x21 def $x21
	sxtw	x21, w21
	b	LBB0_11
LBB0_9:                                 ;   in Loop: Header=BB0_11 Depth=2
	ldr	w8, [x26]
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=2
	add	x21, x21, #1
	cmp	x21, w8, sxtw
	b.ge	LBB0_14
LBB0_11:                                ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	cmp	x19, x21
	cset	w9, eq
	and	w9, w23, w9
	tbnz	w9, #0, LBB0_14
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=2
	ldr	x9, [x22, #16]
	ldr	x28, [x9, x21, lsl #3]
	cbz	x28, LBB0_10
; %bb.13:                               ;   in Loop: Header=BB0_11 Depth=2
	mov	x0, x28
	mov	x1, x24
	bl	_is_gts_stealable
	cbz	x0, LBB0_9
	b	LBB0_18
LBB0_14:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w23, [sp, #20]                  ; 4-byte Folded Reload
LBB0_15:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x25
	bl	_spin_unlock
	cmp	x22, x27
	cset	w8, eq
	and	w8, w20, w8
	cmp	w8, #1
	ldp	x25, x8, [sp, #24]              ; 16-byte Folded Reload
	ccmp	w21, w8, #0, eq
	b.eq	LBB0_20
LBB0_16:                                ;   in Loop: Header=BB0_5 Depth=1
	cmp	x22, x27
	cset	w8, eq
	and	w8, w20, w8
	tbnz	w8, #0, LBB0_19
; %bb.17:                               ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x24
	mov	x1, x22
	bl	_next_gru
	mov	x22, x0
	mov	w21, #0
	mov	w20, #1
	b	LBB0_5
LBB0_18:
	mov	x0, x25
	bl	_spin_unlock
	ldr	x0, [sp, #8]                    ; 8-byte Folded Reload
	bl	_spin_unlock
	ldr	x9, [sp, #24]                   ; 8-byte Folded Reload
	ldr	w8, [x9, #16]
	add	w8, w8, #1
	str	w8, [x9, #16]
Lloh5:
	adrp	x8, _jiffies@GOTPAGE
Lloh6:
	ldr	x8, [x8, _jiffies@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	str	w8, [x28, #12]
	mov	x0, x28
	bl	_is_kernel_context
	cmp	x0, #0
	cset	w1, eq
	mov	x0, x28
	bl	_gru_unload_context
	mov	x0, x28
	mov	x1, x24
	bl	_gts_stolen
	b	LBB0_22
LBB0_19:
	mov	x22, x27
	b	LBB0_21
LBB0_20:
	mov	x22, x27
	ldr	x21, [sp, #32]                  ; 8-byte Folded Reload
                                        ; kill: def $w21 killed $w21 killed $x21 def $x21
LBB0_21:
	ldr	x0, [sp, #8]                    ; 8-byte Folded Reload
	bl	_spin_unlock
Lloh8:
	adrp	x8, _steal_context_failed@GOTPAGE
Lloh9:
	ldr	x8, [x8, _steal_context_failed@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
	bl	_STAT
	mov	x28, #0
LBB0_22:
Lloh11:
	adrp	x8, _grudev@GOTPAGE
Lloh12:
	ldr	x8, [x8, _grudev@GOTPAGEOFF]
Lloh13:
	ldr	w23, [x8]
	ldp	w0, w24, [x22, #4]
	bl	_hweight64
	mov	x25, x0
	ldr	w0, [x22]
	bl	_hweight64
	str	w0, [sp]
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x23
	mov	x2, x24
	mov	x3, x21
	mov	x4, x28
	ldr	w5, [sp, #20]                   ; 4-byte Folded Reload
	ldr	w6, [sp, #44]                   ; 4-byte Folded Reload
	mov	x7, x25
	bl	_gru_dbg
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_gru_base,8,3                   ; @gru_base
	.comm	_GRU_NUM_CCH,4,2                ; @GRU_NUM_CCH
	.comm	_jiffies,4,2                    ; @jiffies
	.comm	_steal_context_failed,4,2       ; @steal_context_failed
	.comm	_grudev,4,2                     ; @grudev
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"stole gid %d, ctxnum %d from gts %p. Need cb %d, ds %d; avail cb %ld, ds %ld\n"

.subsections_via_symbols
