	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_fpu_kern_leave                 ## -- Begin function fpu_kern_leave
	.p2align	4, 0x90
_fpu_kern_leave:                        ## @fpu_kern_leave
	.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	%rsi, %r14
	movq	(%rdi), %r15
	movq	_PCB_FPUNOSAVE@GOTPCREL(%rip), %r12
	movl	(%r12), %eax
	testl	%eax, (%r15)
	je	LBB0_2
## %bb.1:
	movq	%rdi, %rbx
	xorl	%edi, %edi
	testq	%r14, %r14
	sete	%dil
	leaq	L_.str(%rip), %rsi
	callq	_KASSERT
	movq	_fpcurthread@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_PCPU_GET
	xorl	%edi, %edi
	testq	%rax, %rax
	sete	%dil
	leaq	L_.str.1(%rip), %rsi
	callq	_KASSERT
	movq	%rbx, %rdi
	callq	_CRITICAL_ASSERT
	movq	_PCB_FPUINITDONE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	orl	(%r12), %esi
	movq	%r15, %rdi
	callq	_clear_pcb_flags
	xorl	%eax, %eax
	callq	_start_emulating
	movq	8(%r15), %rbx
	jmp	LBB0_8
LBB0_2:
	movq	_FPU_KERN_CTX_INUSE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %eax
	xorl	%edi, %edi
	andl	(%r14), %eax
	setne	%dil
	leaq	L_.str.2(%rip), %rsi
	callq	_KASSERT
	movl	(%rbx), %eax
	notl	%eax
	andl	%eax, (%r14)
	xorl	%ebx, %ebx
	xorl	%edi, %edi
	callq	_is_fpu_kern_thread
	movq	_FPU_KERN_CTX_DUMMY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	andl	(%r14), %ecx
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	testl	%ecx, %ecx
	jne	LBB0_18
	jmp	LBB0_5
LBB0_3:
	movl	%ecx, %ebx
LBB0_5:
	xorl	%edi, %edi
	testl	%ebx, %ebx
	sete	%dil
	leaq	L_.str.3(%rip), %rsi
	callq	_KASSERT
	xorl	%eax, %eax
	callq	_critical_enter
	movq	_curthread@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	movq	_fpcurthread@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_PCPU_GET
	cmpq	%rax, %rbx
	jne	LBB0_7
## %bb.6:
	xorl	%eax, %eax
	callq	_fpudrop
LBB0_7:
	movq	8(%r14), %rbx
	movq	%rbx, 8(%r15)
LBB0_8:
	movq	%r15, %rdi
	callq	_get_pcb_user_save_pcb
	cmpq	%rax, %rbx
	jne	LBB0_13
## %bb.9:
	movq	_PCB_USERFPUINITDONE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_PCB_FPUINITDONE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	testl	%eax, (%r15)
	je	LBB0_11
## %bb.10:
	movq	%r15, %rdi
	callq	_set_pcb_flags
	movq	_PCB_KERNFPU@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	jmp	LBB0_12
LBB0_13:
	movq	_FPU_KERN_CTX_FPUINITDONE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_PCB_FPUINITDONE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	testl	%eax, (%r14)
	je	LBB0_15
## %bb.14:
	movq	%r15, %rdi
	callq	_set_pcb_flags
	jmp	LBB0_16
LBB0_11:
	movq	_PCB_KERNFPU@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
LBB0_12:
	movq	%r15, %rdi
	callq	_clear_pcb_flags
	jmp	LBB0_17
LBB0_15:
	movq	%r15, %rdi
	callq	_clear_pcb_flags
LBB0_16:
	movq	%r15, %rdi
	callq	_PCB_USER_FPU
	xorl	%edi, %edi
	testl	%eax, %eax
	sete	%dil
	leaq	L_.str.4(%rip), %rsi
	callq	_KASSERT
LBB0_17:
	xorl	%eax, %eax
	callq	_critical_exit
LBB0_18:
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PCB_FPUNOSAVE,4,2              ## @PCB_FPUNOSAVE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"non-null ctx after FPU_KERN_NOCTX"

	.comm	_fpcurthread,4,2                ## @fpcurthread
L_.str.1:                               ## @.str.1
	.asciz	"non-NULL fpcurthread for PCB_FPUNOSAVE"

	.comm	_PCB_FPUINITDONE,4,2            ## @PCB_FPUINITDONE
	.comm	_FPU_KERN_CTX_INUSE,4,2         ## @FPU_KERN_CTX_INUSE
L_.str.2:                               ## @.str.2
	.asciz	"leaving not inuse ctx"

	.comm	_FPU_KERN_CTX_DUMMY,4,2         ## @FPU_KERN_CTX_DUMMY
L_.str.3:                               ## @.str.3
	.asciz	"dummy ctx"

	.comm	_curthread,8,3                  ## @curthread
	.comm	_PCB_USERFPUINITDONE,4,2        ## @PCB_USERFPUINITDONE
	.comm	_PCB_KERNFPU,4,2                ## @PCB_KERNFPU
	.comm	_FPU_KERN_CTX_FPUINITDONE,4,2   ## @FPU_KERN_CTX_FPUINITDONE
L_.str.4:                               ## @.str.4
	.asciz	"unpaired fpu_kern_leave"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_fpu_kern_leave                 ; -- Begin function fpu_kern_leave
	.p2align	2
_fpu_kern_leave:                        ; @fpu_kern_leave
	.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
	ldr	x19, [x0]
	ldr	w8, [x19]
Lloh0:
	adrp	x23, _PCB_FPUNOSAVE@GOTPAGE
Lloh1:
	ldr	x23, [x23, _PCB_FPUNOSAVE@GOTPAGEOFF]
	ldr	w9, [x23]
Lloh2:
	adrp	x22, _PCB_FPUINITDONE@GOTPAGE
Lloh3:
	ldr	x22, [x22, _PCB_FPUINITDONE@GOTPAGEOFF]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.1:
	mov	x21, x0
	cmp	x20, #0
	cset	w0, eq
Lloh4:
	adrp	x1, l_.str@PAGE
Lloh5:
	add	x1, x1, l_.str@PAGEOFF
	bl	_KASSERT
Lloh6:
	adrp	x8, _fpcurthread@GOTPAGE
Lloh7:
	ldr	x8, [x8, _fpcurthread@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	bl	_PCPU_GET
	cmp	x0, #0
	cset	w0, eq
Lloh9:
	adrp	x1, l_.str.1@PAGE
Lloh10:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_KASSERT
	mov	x0, x21
	bl	_CRITICAL_ASSERT
	ldr	w8, [x23]
	ldr	w9, [x22]
	orr	w1, w9, w8
	mov	x0, x19
	bl	_clear_pcb_flags
	bl	_start_emulating
	ldr	x21, [x19, #8]
	b	LBB0_7
LBB0_2:
	ldr	w8, [x20]
Lloh11:
	adrp	x21, _FPU_KERN_CTX_INUSE@GOTPAGE
Lloh12:
	ldr	x21, [x21, _FPU_KERN_CTX_INUSE@GOTPAGEOFF]
	ldr	w9, [x21]
	tst	w9, w8
	cset	w0, ne
Lloh13:
	adrp	x1, l_.str.2@PAGE
Lloh14:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_KASSERT
	ldr	w8, [x21]
	ldr	w9, [x20]
	bic	w8, w9, w8
	str	w8, [x20]
	mov	w0, #0
	bl	_is_fpu_kern_thread
	ldr	w8, [x20]
Lloh15:
	adrp	x9, _FPU_KERN_CTX_DUMMY@GOTPAGE
Lloh16:
	ldr	x9, [x9, _FPU_KERN_CTX_DUMMY@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	and	w8, w9, w8
	cbz	x0, LBB0_4
; %bb.3:
	cbnz	w8, LBB0_17
LBB0_4:
	cmp	w8, #0
	cset	w0, eq
Lloh18:
	adrp	x1, l_.str.3@PAGE
Lloh19:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_KASSERT
	bl	_critical_enter
Lloh20:
	adrp	x8, _curthread@GOTPAGE
Lloh21:
	ldr	x8, [x8, _curthread@GOTPAGEOFF]
Lloh22:
	ldr	x21, [x8]
Lloh23:
	adrp	x8, _fpcurthread@GOTPAGE
Lloh24:
	ldr	x8, [x8, _fpcurthread@GOTPAGEOFF]
Lloh25:
	ldr	w0, [x8]
	bl	_PCPU_GET
	cmp	x21, x0
	b.ne	LBB0_6
; %bb.5:
	bl	_fpudrop
LBB0_6:
	ldr	x21, [x20, #8]
	str	x21, [x19, #8]
LBB0_7:
	mov	x0, x19
	bl	_get_pcb_user_save_pcb
	cmp	x21, x0
	b.ne	LBB0_10
; %bb.8:
	ldr	w8, [x19]
Lloh26:
	adrp	x9, _PCB_USERFPUINITDONE@GOTPAGE
Lloh27:
	ldr	x9, [x9, _PCB_USERFPUINITDONE@GOTPAGEOFF]
Lloh28:
	ldr	w9, [x9]
	ldr	w1, [x22]
	tst	w9, w8
	b.eq	LBB0_12
; %bb.9:
	mov	x0, x19
	bl	_set_pcb_flags
Lloh29:
	adrp	x8, _PCB_KERNFPU@GOTPAGE
Lloh30:
	ldr	x8, [x8, _PCB_KERNFPU@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x8]
	b	LBB0_13
LBB0_10:
	ldr	w8, [x20]
Lloh32:
	adrp	x9, _FPU_KERN_CTX_FPUINITDONE@GOTPAGE
Lloh33:
	ldr	x9, [x9, _FPU_KERN_CTX_FPUINITDONE@GOTPAGEOFF]
Lloh34:
	ldr	w9, [x9]
	ldr	w1, [x22]
	mov	x0, x19
	tst	w9, w8
	b.eq	LBB0_14
; %bb.11:
	bl	_set_pcb_flags
	b	LBB0_15
LBB0_12:
Lloh35:
	adrp	x8, _PCB_KERNFPU@GOTPAGE
Lloh36:
	ldr	x8, [x8, _PCB_KERNFPU@GOTPAGEOFF]
Lloh37:
	ldr	w8, [x8]
	orr	w1, w8, w1
LBB0_13:
	mov	x0, x19
	bl	_clear_pcb_flags
	b	LBB0_16
LBB0_14:
	bl	_clear_pcb_flags
LBB0_15:
	mov	x0, x19
	bl	_PCB_USER_FPU
	cmp	w0, #0
	cset	w0, eq
Lloh38:
	adrp	x1, l_.str.4@PAGE
Lloh39:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_KASSERT
LBB0_16:
	bl	_critical_exit
LBB0_17:
	mov	w0, #0
	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 AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpAdd	Lloh38, Lloh39
	.cfi_endproc
                                        ; -- End function
	.comm	_PCB_FPUNOSAVE,4,2              ; @PCB_FPUNOSAVE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"non-null ctx after FPU_KERN_NOCTX"

	.comm	_fpcurthread,4,2                ; @fpcurthread
l_.str.1:                               ; @.str.1
	.asciz	"non-NULL fpcurthread for PCB_FPUNOSAVE"

	.comm	_PCB_FPUINITDONE,4,2            ; @PCB_FPUINITDONE
	.comm	_FPU_KERN_CTX_INUSE,4,2         ; @FPU_KERN_CTX_INUSE
l_.str.2:                               ; @.str.2
	.asciz	"leaving not inuse ctx"

	.comm	_FPU_KERN_CTX_DUMMY,4,2         ; @FPU_KERN_CTX_DUMMY
l_.str.3:                               ; @.str.3
	.asciz	"dummy ctx"

	.comm	_curthread,8,3                  ; @curthread
	.comm	_PCB_USERFPUINITDONE,4,2        ; @PCB_USERFPUINITDONE
	.comm	_PCB_KERNFPU,4,2                ; @PCB_KERNFPU
	.comm	_FPU_KERN_CTX_FPUINITDONE,4,2   ; @FPU_KERN_CTX_FPUINITDONE
l_.str.4:                               ; @.str.4
	.asciz	"unpaired fpu_kern_leave"

.subsections_via_symbols
