	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kvm_task_switch                ## -- Begin function kvm_task_switch
	.p2align	4, 0x90
_kvm_task_switch:                       ## @kvm_task_switch
	.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	%r8d, -68(%rbp)                 ## 4-byte Spill
	movl	%ecx, -72(%rbp)                 ## 4-byte Spill
	movl	%edx, %r14d
	movl	%esi, %r13d
	movq	%rdi, %r12
	movq	_VCPU_SREG_TR@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	callq	_get_segment_base
	movl	%eax, %ebx
	movl	(%r15), %esi
	movq	%r12, %rdi
	callq	_get_segment_selector
	movl	%eax, %r15d
	movq	%r12, %rdi
	movl	%ebx, %esi
	xorl	%edx, %edx
	callq	_kvm_mmu_gva_to_gpa_write
	movl	%eax, %ebx
	leaq	-56(%rbp), %rdx
	movq	%r12, %rdi
	movl	%r13d, %esi
	callq	_load_guest_segment_descriptor
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	xorl	%eax, %eax
	jmp	LBB0_25
LBB0_2:
	movl	%r13d, -44(%rbp)                ## 4-byte Spill
	leaq	-88(%rbp), %rdx
	movq	%r12, %rdi
	movl	%r15d, %esi
	callq	_load_guest_segment_descriptor
	testq	%rax, %rax
	movl	$0, %eax
	jne	LBB0_25
## %bb.3:
	movl	%r15d, -60(%rbp)                ## 4-byte Spill
	movq	_TASK_SWITCH_IRET@GOTPCREL(%rip), %r13
	movl	%r14d, %r15d
	cmpl	%r14d, (%r13)
	je	LBB0_8
## %bb.4:
	movq	_kvm_x86_ops@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%r12, %rdi
	callq	*(%rax)
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	andl	$3, %edx
	movl	-56(%rbp), %ecx
	cmpl	%ecx, %edx
	jg	LBB0_6
## %bb.5:
	cmpl	%ecx, %eax
	jg	LBB0_6
LBB0_8:
	cmpl	$0, -48(%rbp)
	je	LBB0_10
## %bb.9:
	leaq	-56(%rbp), %rdi
	callq	_get_desc_limit
	cmpl	$102, %eax
	jg	LBB0_11
LBB0_10:
	movq	_TS_VECTOR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	andl	$65532, %edx                    ## imm = 0xFFFC
	movq	%r12, %rdi
	jmp	LBB0_7
LBB0_6:
	movq	_GP_VECTOR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
LBB0_7:
	callq	_kvm_queue_exception_e
	movl	$1, %eax
	jmp	LBB0_25
LBB0_11:
	movl	(%r13), %eax
	cmpl	%r15d, %eax
	je	LBB0_13
## %bb.12:
	movq	_TASK_SWITCH_JMP@GOTPCREL(%rip), %rcx
	cmpl	%r15d, (%rcx)
	jne	LBB0_14
LBB0_13:
	andb	$-3, -84(%rbp)
	leaq	-88(%rbp), %rdx
	movq	%r12, %rdi
	movl	-60(%rbp), %esi                 ## 4-byte Reload
	callq	_save_guest_segment_descriptor
	movl	(%r13), %eax
LBB0_14:
	cmpl	%r15d, %eax
	jne	LBB0_16
## %bb.15:
	movq	_kvm_x86_ops@GOTPCREL(%rip), %r15
	movq	(%r15), %rax
	movq	%r12, %rdi
	callq	*8(%rax)
	movq	(%r15), %rcx
	movl	%r14d, %r15d
	movq	_X86_EFLAGS_NT@GOTPCREL(%rip), %rdx
	movl	(%rdx), %esi
	notl	%esi
	andl	%eax, %esi
	movq	%r12, %rdi
	callq	*24(%rcx)
LBB0_16:
	movq	_TASK_SWITCH_CALL@GOTPCREL(%rip), %rcx
	movq	_TASK_SWITCH_GATE@GOTPCREL(%rip), %rax
	cmpl	%r15d, (%rax)
	movl	$65535, %edx                    ## imm = 0xFFFF
	movl	-60(%rbp), %eax                 ## 4-byte Reload
	cmovel	%eax, %edx
	cmpl	%r15d, (%rcx)
	cmovel	%eax, %edx
	testb	$8, -52(%rbp)
	movq	_VCPU_SREG_TR@GOTPCREL(%rip), %r13
	jne	LBB0_17
## %bb.18:
	leaq	-56(%rbp), %r8
	movq	%r12, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movl	%ebx, %ecx
	callq	_kvm_task_switch_16
	jmp	LBB0_19
LBB0_17:
	movl	-68(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, (%rsp)
	leaq	-56(%rbp), %r8
	movq	%r12, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movl	%ebx, %ecx
	movl	-72(%rbp), %r9d                 ## 4-byte Reload
	callq	_kvm_task_switch_32
LBB0_19:
                                        ## kill: def $eax killed $eax def $rax
	movq	%rax, %r15
	movq	_TASK_SWITCH_CALL@GOTPCREL(%rip), %rax
	cmpl	%r14d, (%rax)
	je	LBB0_21
## %bb.20:
	movq	_TASK_SWITCH_GATE@GOTPCREL(%rip), %rax
	cmpl	%r14d, (%rax)
	jne	LBB0_22
LBB0_21:
	movq	_kvm_x86_ops@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rax
	movq	%r12, %rdi
	callq	*8(%rax)
	movq	(%rbx), %rcx
	movq	_X86_EFLAGS_NT@GOTPCREL(%rip), %rdx
	orl	(%rdx), %eax
	movq	%r12, %rdi
	movl	%eax, %esi
	callq	*24(%rcx)
LBB0_22:
	movq	_TASK_SWITCH_IRET@GOTPCREL(%rip), %rax
	cmpl	%r14d, (%rax)
	movl	-44(%rbp), %r14d                ## 4-byte Reload
	je	LBB0_24
## %bb.23:
	orb	$2, -52(%rbp)
	leaq	-56(%rbp), %rdx
	movq	%r12, %rdi
	movl	%r14d, %esi
	callq	_save_guest_segment_descriptor
LBB0_24:
	movq	_kvm_x86_ops@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	16(%rax), %rbx
	movq	%r12, %rdi
	callq	_kvm_read_cr0
	movq	_X86_CR0_TS@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	%r12, %rdi
	movl	%eax, %esi
	callq	*%rbx
	leaq	-56(%rbp), %rdi
	leaq	-64(%rbp), %rbx
	movl	%r14d, %esi
	movq	%rbx, %rdx
	callq	_seg_desct_to_kvm_desct
	movl	$11, -64(%rbp)
	movl	(%r13), %edx
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	_kvm_set_segment
	movq	%r15, %rax
LBB0_25:
                                        ## kill: def $eax killed $eax killed $rax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_VCPU_SREG_TR,4,2               ## @VCPU_SREG_TR
	.comm	_TASK_SWITCH_IRET,4,2           ## @TASK_SWITCH_IRET
	.comm	_kvm_x86_ops,8,3                ## @kvm_x86_ops
	.comm	_GP_VECTOR,4,2                  ## @GP_VECTOR
	.comm	_TS_VECTOR,4,2                  ## @TS_VECTOR
	.comm	_TASK_SWITCH_JMP,4,2            ## @TASK_SWITCH_JMP
	.comm	_X86_EFLAGS_NT,4,2              ## @X86_EFLAGS_NT
	.comm	_TASK_SWITCH_CALL,4,2           ## @TASK_SWITCH_CALL
	.comm	_TASK_SWITCH_GATE,4,2           ## @TASK_SWITCH_GATE
	.comm	_X86_CR0_TS,4,2                 ## @X86_CR0_TS
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kvm_task_switch                ; -- Begin function kvm_task_switch
	.p2align	2
_kvm_task_switch:                       ; @kvm_task_switch
	.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	x22, x4
	mov	x23, x3
	mov	x21, x2
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x26, _VCPU_SREG_TR@GOTPAGE
Lloh1:
	ldr	x26, [x26, _VCPU_SREG_TR@GOTPAGEOFF]
	ldr	w1, [x26]
	bl	_get_segment_base
	mov	x24, x0
	ldr	w1, [x26]
	mov	x0, x19
	bl	_get_segment_selector
	mov	x25, x0
	mov	x0, x19
	mov	x1, x24
	mov	x2, #0
	bl	_kvm_mmu_gva_to_gpa_write
	mov	x24, x0
	add	x2, sp, #8
	mov	x0, x19
	mov	x1, x20
	bl	_load_guest_segment_descriptor
	cbnz	x0, LBB0_2
; %bb.1:
	add	x2, sp, #24
	mov	x0, x19
	mov	x1, x25
	bl	_load_guest_segment_descriptor
	cbz	x0, LBB0_4
LBB0_2:
	mov	w22, #0
LBB0_3:
	mov	x0, x22
	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
LBB0_4:
Lloh2:
	adrp	x27, _TASK_SWITCH_IRET@GOTPAGE
Lloh3:
	ldr	x27, [x27, _TASK_SWITCH_IRET@GOTPAGEOFF]
	ldr	w8, [x27]
	cmp	w8, w21
	b.eq	LBB0_7
; %bb.5:
Lloh4:
	adrp	x8, _kvm_x86_ops@GOTPAGE
Lloh5:
	ldr	x8, [x8, _kvm_x86_ops@GOTPAGEOFF]
Lloh6:
	ldr	x8, [x8]
	ldr	x8, [x8]
	mov	x0, x19
	blr	x8
	and	w9, w20, #0x3
	ldr	w8, [sp, #8]
	cmp	w9, w8
	b.gt	LBB0_10
; %bb.6:
	cmp	w0, w8
	b.gt	LBB0_10
LBB0_7:
	ldr	w8, [sp, #16]
	cbz	w8, LBB0_9
; %bb.8:
	add	x0, sp, #8
	bl	_get_desc_limit
	cmp	w0, #102
	b.gt	LBB0_12
LBB0_9:
Lloh7:
	adrp	x8, _TS_VECTOR@GOTPAGE
Lloh8:
	ldr	x8, [x8, _TS_VECTOR@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	and	w2, w20, #0xfffc
	mov	x0, x19
	b	LBB0_11
LBB0_10:
Lloh10:
	adrp	x8, _GP_VECTOR@GOTPAGE
Lloh11:
	ldr	x8, [x8, _GP_VECTOR@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
LBB0_11:
	bl	_kvm_queue_exception_e
	mov	w22, #1
	b	LBB0_3
LBB0_12:
	ldr	w8, [x27]
Lloh13:
	adrp	x9, _TASK_SWITCH_JMP@GOTPAGE
Lloh14:
	ldr	x9, [x9, _TASK_SWITCH_JMP@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
	cmp	w8, w21
	ccmp	w9, w21, #4, ne
	b.ne	LBB0_14
; %bb.13:
	ldr	w8, [sp, #28]
	and	w8, w8, #0xfffffffd
	str	w8, [sp, #28]
	add	x2, sp, #24
	mov	x0, x19
	mov	x1, x25
	bl	_save_guest_segment_descriptor
	ldr	w8, [x27]
LBB0_14:
Lloh16:
	adrp	x10, _X86_EFLAGS_NT@GOTPAGE
Lloh17:
	ldr	x10, [x10, _X86_EFLAGS_NT@GOTPAGEOFF]
	cmp	w8, w21
	b.ne	LBB0_16
; %bb.15:
Lloh18:
	adrp	x28, _kvm_x86_ops@GOTPAGE
Lloh19:
	ldr	x28, [x28, _kvm_x86_ops@GOTPAGEOFF]
	ldr	x8, [x28]
	ldr	x8, [x8, #8]
	mov	x0, x19
	blr	x8
	ldr	x8, [x28]
	ldr	x8, [x8, #24]
Lloh20:
	adrp	x9, _X86_EFLAGS_NT@GOTPAGE
Lloh21:
	ldr	x9, [x9, _X86_EFLAGS_NT@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	bic	w1, w0, w9
	mov	x0, x19
	blr	x8
Lloh23:
	adrp	x10, _X86_EFLAGS_NT@GOTPAGE
Lloh24:
	ldr	x10, [x10, _X86_EFLAGS_NT@GOTPAGEOFF]
LBB0_16:
Lloh25:
	adrp	x28, _TASK_SWITCH_CALL@GOTPAGE
Lloh26:
	ldr	x28, [x28, _TASK_SWITCH_CALL@GOTPAGEOFF]
	ldr	w8, [x28]
Lloh27:
	adrp	x9, _TASK_SWITCH_GATE@GOTPAGE
Lloh28:
	ldr	x9, [x9, _TASK_SWITCH_GATE@GOTPAGEOFF]
Lloh29:
	ldr	w9, [x9]
	cmp	w9, w21
	ccmp	w8, w21, #4, ne
	mov	w8, #65535
	csel	w2, w25, w8, eq
	ldrb	w8, [sp, #12]
	mov	x25, x10
	add	x4, sp, #8
	mov	x0, x19
	mov	x1, x20
	mov	x3, x24
	tbnz	w8, #3, LBB0_18
; %bb.17:
	bl	_kvm_task_switch_16
	b	LBB0_19
LBB0_18:
	mov	x5, x23
	mov	x6, x22
	bl	_kvm_task_switch_32
LBB0_19:
	mov	x22, x0
	ldr	w8, [x28]
	cmp	w8, w21
	b.eq	LBB0_21
; %bb.20:
Lloh30:
	adrp	x8, _TASK_SWITCH_GATE@GOTPAGE
Lloh31:
	ldr	x8, [x8, _TASK_SWITCH_GATE@GOTPAGEOFF]
Lloh32:
	ldr	w8, [x8]
	cmp	w8, w21
	b.ne	LBB0_22
LBB0_21:
Lloh33:
	adrp	x23, _kvm_x86_ops@GOTPAGE
Lloh34:
	ldr	x23, [x23, _kvm_x86_ops@GOTPAGEOFF]
	ldr	x8, [x23]
	ldr	x8, [x8, #8]
	mov	x0, x19
	blr	x8
	ldr	x8, [x23]
	ldr	x8, [x8, #24]
	ldr	w9, [x25]
	orr	w1, w9, w0
	mov	x0, x19
	blr	x8
LBB0_22:
	ldr	w8, [x27]
	cmp	w8, w21
	b.eq	LBB0_24
; %bb.23:
	ldr	w8, [sp, #12]
	orr	w8, w8, #0x2
	str	w8, [sp, #12]
	add	x2, sp, #8
	mov	x0, x19
	mov	x1, x20
	bl	_save_guest_segment_descriptor
LBB0_24:
Lloh35:
	adrp	x8, _kvm_x86_ops@GOTPAGE
Lloh36:
	ldr	x8, [x8, _kvm_x86_ops@GOTPAGEOFF]
Lloh37:
	ldr	x8, [x8]
	ldr	x21, [x8, #16]
	mov	x0, x19
	bl	_kvm_read_cr0
Lloh38:
	adrp	x8, _X86_CR0_TS@GOTPAGE
Lloh39:
	ldr	x8, [x8, _X86_CR0_TS@GOTPAGEOFF]
Lloh40:
	ldr	w8, [x8]
	orr	w1, w8, w0
	mov	x0, x19
	blr	x21
	add	x0, sp, #8
	add	x2, sp, #40
	mov	x1, x20
	bl	_seg_desct_to_kvm_desct
	mov	w8, #11
	str	w8, [sp, #40]
	ldr	w2, [x26]
	add	x1, sp, #40
	mov	x0, x19
	bl	_kvm_set_segment
	b	LBB0_3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.cfi_endproc
                                        ; -- End function
	.comm	_VCPU_SREG_TR,4,2               ; @VCPU_SREG_TR
	.comm	_TASK_SWITCH_IRET,4,2           ; @TASK_SWITCH_IRET
	.comm	_kvm_x86_ops,8,3                ; @kvm_x86_ops
	.comm	_GP_VECTOR,4,2                  ; @GP_VECTOR
	.comm	_TS_VECTOR,4,2                  ; @TS_VECTOR
	.comm	_TASK_SWITCH_JMP,4,2            ; @TASK_SWITCH_JMP
	.comm	_X86_EFLAGS_NT,4,2              ; @X86_EFLAGS_NT
	.comm	_TASK_SWITCH_CALL,4,2           ; @TASK_SWITCH_CALL
	.comm	_TASK_SWITCH_GATE,4,2           ; @TASK_SWITCH_GATE
	.comm	_X86_CR0_TS,4,2                 ; @X86_CR0_TS
.subsections_via_symbols
