	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vm_handle_hlt
_vm_handle_hlt:                         ## @vm_handle_hlt
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, -68(%rbp)                 ## 4-byte Spill
	movl	%esi, %r14d
	movq	%rdi, %r15
	movl	%esi, %edi
	movq	%r15, %rsi
	callq	_CPU_ISSET
	xorl	%edi, %edi
	testl	%eax, %eax
	sete	%dil
	leaq	L_.str(%rip), %rsi
	callq	_KASSERT
	movq	24(%r15), %r12
	movslq	%r14d, %rbx
	shlq	$4, %rbx
	leaq	(%r12,%rbx), %r13
	movq	%r13, %rdi
	callq	_vcpu_lock
	cmpq	$0, 16(%r15)
	je	LBB0_2
## %bb.1:
	movq	%r13, %rdi
	callq	_vcpu_unlock
	jmp	LBB0_24
LBB0_2:
	movq	%r13, -64(%rbp)                 ## 8-byte Spill
	leaq	(%r12,%rbx), %rax
	addq	$8, %rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	leaq	4(%r15), %rax
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	xorl	%eax, %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_3 Depth=1
	leaq	L_.str.3(%rip), %r13
LBB0_19:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	_ticks@GOTPCREL(%rip), %r12
	movl	(%r12), %ebx
	movq	_VCPU_SLEEPING@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_vcpu_require_state_locked
	movq	_hz@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%rdi, %rsi
	movq	%r13, %rdx
	callq	_msleep_spin
	movq	_VCPU_FROZEN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_vcpu_require_state_locked
	movq	_VCPU_IDLE_TICKS@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	(%r12), %ecx
	subl	%ebx, %ecx
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_vmm_stat_incr
	cmpq	$0, 16(%r15)
	jne	LBB0_20
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	$0, 8(%r15)
	jne	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movb	$1, %al
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	cmpq	$0, (%rax)
	jne	LBB0_20
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_vm_nmi_pending
	testq	%rax, %rax
	jne	LBB0_20
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	-68(%rbp), %ebx                 ## 4-byte Reload
	testl	%ebx, %ebx
	jne	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_vm_extint_pending
	testq	%rax, %rax
	jne	LBB0_20
## %bb.9:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movl	-4(%rax), %edi
	xorl	%esi, %esi
	callq	_vlapic_pending_intr
	testq	%rax, %rax
	jne	LBB0_20
LBB0_10:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_vcpu_should_yield
	testq	%rax, %rax
	jne	LBB0_20
## %bb.11:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_vcpu_debugged
	testq	%rax, %rax
	jne	LBB0_20
## %bb.12:                              ##   in Loop: Header=BB0_3 Depth=1
	testl	%ebx, %ebx
	je	LBB0_13
## %bb.14:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	%r15, %rdi
	movl	%r14d, %esi
	leaq	L_.str.2(%rip), %rdx
	callq	_VCPU_CTR0
	cmpl	$0, -56(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_17
## %bb.15:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	_halt_detection_enabled@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_3 Depth=1
	movl	%r14d, %edi
	movq	%r15, %rsi
	callq	_CPU_SET_ATOMIC
	movl	$1, %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
LBB0_17:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	%r15, %rdi
	movq	-88(%rbp), %rsi                 ## 8-byte Reload
	callq	_CPU_CMP
	testq	%rax, %rax
	je	LBB0_25
## %bb.18:                              ##   in Loop: Header=BB0_3 Depth=1
	leaq	L_.str.1(%rip), %r13
	jmp	LBB0_19
LBB0_4:
	movb	$1, %al
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
LBB0_20:
	cmpl	$0, -56(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_22
LBB0_21:
	movl	%r14d, %edi
	movq	%r15, %rsi
	callq	_CPU_CLR_ATOMIC
LBB0_22:
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_vcpu_unlock
	cmpb	$0, -44(%rbp)                   ## 1-byte Folded Reload
	jne	LBB0_24
## %bb.23:
	movq	_VM_SUSPEND_HALT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_vm_suspend
LBB0_24:
	xorl	%eax, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_25:
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	cmpl	$0, -56(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_21
	jmp	LBB0_22
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"vcpu already halted"

L_.str.1:                               ## @.str.1
	.asciz	"vmhalt"

L_.str.2:                               ## @.str.2
	.asciz	"Halted"

	.comm	_halt_detection_enabled,8,3     ## @halt_detection_enabled
L_.str.3:                               ## @.str.3
	.asciz	"vmidle"

	.comm	_ticks,4,2                      ## @ticks
	.comm	_VCPU_SLEEPING,4,2              ## @VCPU_SLEEPING
	.comm	_hz,4,2                         ## @hz
	.comm	_VCPU_FROZEN,4,2                ## @VCPU_FROZEN
	.comm	_VCPU_IDLE_TICKS,4,2            ## @VCPU_IDLE_TICKS
	.comm	_VM_SUSPEND_HALT,4,2            ## @VM_SUSPEND_HALT
	.no_dead_strip	_vm_handle_hlt
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vm_handle_hlt
_vm_handle_hlt:                         ; @vm_handle_hlt
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x22, x2
	mov	x20, x1
	mov	x19, x0
	mov	x0, x1
	mov	x1, x19
	bl	_CPU_ISSET
	cmp	w0, #0
	cset	w0, eq
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_KASSERT
	ldr	x8, [x19, #24]
	add	x21, x8, w20, sxtw #4
	mov	x0, x21
	bl	_vcpu_lock
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_2
; %bb.1:
	mov	x0, x21
	bl	_vcpu_unlock
	b	LBB0_23
LBB0_2:
	mov	w26, #0
	add	x27, x21, #8
	add	x8, x21, #4
	str	x8, [sp, #8]                    ; 8-byte Folded Spill
	add	x23, x19, #4
Lloh2:
	adrp	x24, _ticks@GOTPAGE
Lloh3:
	ldr	x24, [x24, _ticks@GOTPAGEOFF]
	b	LBB0_5
LBB0_3:                                 ;   in Loop: Header=BB0_5 Depth=1
Lloh4:
	adrp	x25, l_.str.3@PAGE
Lloh5:
	add	x25, x25, l_.str.3@PAGEOFF
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	w28, [x24]
Lloh6:
	adrp	x8, _VCPU_SLEEPING@GOTPAGE
Lloh7:
	ldr	x8, [x8, _VCPU_SLEEPING@GOTPAGEOFF]
Lloh8:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x1, x20
	bl	_vcpu_require_state_locked
Lloh9:
	adrp	x8, _hz@GOTPAGE
Lloh10:
	ldr	x8, [x8, _hz@GOTPAGEOFF]
Lloh11:
	ldr	w3, [x8]
	mov	x0, x21
	mov	x1, x21
	mov	x2, x25
	bl	_msleep_spin
Lloh12:
	adrp	x8, _VCPU_FROZEN@GOTPAGE
Lloh13:
	ldr	x8, [x8, _VCPU_FROZEN@GOTPAGEOFF]
Lloh14:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x1, x20
	bl	_vcpu_require_state_locked
Lloh15:
	adrp	x8, _VCPU_IDLE_TICKS@GOTPAGE
Lloh16:
	ldr	x8, [x8, _VCPU_IDLE_TICKS@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
	ldr	w8, [x24]
	sub	w3, w8, w28
	mov	x0, x19
	mov	x1, x20
	bl	_vmm_stat_incr
	ldr	x8, [x19, #16]
	cbnz	x8, LBB0_19
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #8]
	cbnz	x8, LBB0_19
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x27]
	cbnz	x8, LBB0_19
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x19
	mov	x1, x20
	bl	_vm_nmi_pending
	cbnz	x0, LBB0_19
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	cbnz	w22, LBB0_11
; %bb.9:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x19
	mov	x1, x20
	bl	_vm_extint_pending
	cbnz	x0, LBB0_19
; %bb.10:                               ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	ldr	w0, [x8]
	mov	x1, #0
	bl	_vlapic_pending_intr
	cbnz	x0, LBB0_19
LBB0_11:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x19
	mov	x1, x20
	bl	_vcpu_should_yield
	cbnz	x0, LBB0_19
; %bb.12:                               ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x19
	mov	x1, x20
	bl	_vcpu_debugged
	cbnz	x0, LBB0_19
; %bb.13:                               ;   in Loop: Header=BB0_5 Depth=1
	cbz	w22, LBB0_3
; %bb.14:                               ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x19
	mov	x1, x20
Lloh18:
	adrp	x2, l_.str.2@PAGE
Lloh19:
	add	x2, x2, l_.str.2@PAGEOFF
	bl	_VCPU_CTR0
	cbnz	w26, LBB0_17
; %bb.15:                               ;   in Loop: Header=BB0_5 Depth=1
Lloh20:
	adrp	x8, _halt_detection_enabled@GOTPAGE
Lloh21:
	ldr	x8, [x8, _halt_detection_enabled@GOTPAGEOFF]
Lloh22:
	ldr	x8, [x8]
	cbz	x8, LBB0_17
; %bb.16:                               ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x20
	mov	x1, x19
	bl	_CPU_SET_ATOMIC
	mov	w26, #1
LBB0_17:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x19
	mov	x1, x23
	bl	_CPU_CMP
	cbz	x0, LBB0_24
; %bb.18:                               ;   in Loop: Header=BB0_5 Depth=1
Lloh23:
	adrp	x25, l_.str.1@PAGE
Lloh24:
	add	x25, x25, l_.str.1@PAGEOFF
	b	LBB0_4
LBB0_19:
	mov	w22, #1
	cbz	w26, LBB0_21
LBB0_20:
	mov	x0, x20
	mov	x1, x19
	bl	_CPU_CLR_ATOMIC
LBB0_21:
	mov	x0, x21
	bl	_vcpu_unlock
	tbnz	w22, #0, LBB0_23
; %bb.22:
Lloh25:
	adrp	x8, _VM_SUSPEND_HALT@GOTPAGE
Lloh26:
	ldr	x8, [x8, _VM_SUSPEND_HALT@GOTPAGEOFF]
Lloh27:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_vm_suspend
LBB0_23:
	mov	w0, #0
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_24:
	mov	w22, #0
	cbnz	w26, LBB0_20
	b	LBB0_21
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"vcpu already halted"

l_.str.1:                               ; @.str.1
	.asciz	"vmhalt"

l_.str.2:                               ; @.str.2
	.asciz	"Halted"

	.comm	_halt_detection_enabled,8,3     ; @halt_detection_enabled
l_.str.3:                               ; @.str.3
	.asciz	"vmidle"

	.comm	_ticks,4,2                      ; @ticks
	.comm	_VCPU_SLEEPING,4,2              ; @VCPU_SLEEPING
	.comm	_hz,4,2                         ; @hz
	.comm	_VCPU_FROZEN,4,2                ; @VCPU_FROZEN
	.comm	_VCPU_IDLE_TICKS,4,2            ; @VCPU_IDLE_TICKS
	.comm	_VM_SUSPEND_HALT,4,2            ; @VM_SUSPEND_HALT
	.no_dead_strip	_vm_handle_hlt
.subsections_via_symbols
