	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_user_ldt_alloc                 ## -- Begin function user_ldt_alloc
	.p2align	4, 0x90
_user_ldt_alloc:                        ## @user_ldt_alloc
	.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
	movl	%esi, %r15d
	movq	%rdi, %r14
	movq	_MA_OWNED@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_dt_lock@GOTPCREL(%rip), %rdi
	callq	_mtx_assert
	testl	%r15d, %r15d
	je	LBB0_1
LBB0_2:
	movq	_dt_lock@GOTPCREL(%rip), %rdi
	callq	_mtx_unlock
	movq	_M_SUBPROC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r15d, -44(%rbp)                ## 4-byte Spill
	movq	_M_WAITOK@GOTPCREL(%rip), %r15
	movl	(%r15), %edx
	movl	$16, %edi
	callq	_malloc
	movq	%rax, %rbx
	movq	_max_ldt_segment@GOTPCREL(%rip), %rax
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	movl	(%rax), %r12d
	leal	(,%r12,4), %r13d
	movq	_M_ZERO@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	orl	(%r15), %esi
	movl	%r13d, %edi
	callq	_kmem_malloc
	movq	%rax, %r14
	movq	%rax, 8(%rbx)
	movslq	%r13d, %r15
	addq	%rax, %r15
	movq	%rax, %rdi
	movq	%r15, %rsi
	xorl	%edx, %edx
	callq	_pmap_pti_add_kva
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movl	$1, (%rbx)
	movq	%r14, -72(%rbp)
	leal	-1(,%r12,4), %eax
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	movl	%eax, -112(%rbp)
	movq	_SDT_SYSLDT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -76(%rbp)
	movq	_SEL_KPL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -80(%rbp)
	movl	$1, -108(%rbp)
	xorps	%xmm0, %xmm0
	movups	%xmm0, -104(%rbp)
	movq	$0, -88(%rbp)
	movq	_dt_lock@GOTPCREL(%rip), %rdi
	callq	_mtx_lock
	movq	8(%r12), %rbx
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_5
## %bb.3:
	testq	%rbx, %rbx
	je	LBB0_5
## %bb.4:
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_pmap_pti_remove_kva
	movq	%r14, %rdi
	movl	%r13d, %esi
	callq	_kmem_free
	movq	_M_SUBPROC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_free
	jmp	LBB0_8
LBB0_1:
	movq	8(%r14), %rbx
	testq	%rbx, %rbx
	jne	LBB0_8
	jmp	LBB0_2
LBB0_5:
	testq	%rbx, %rbx
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	je	LBB0_7
## %bb.6:
	movq	8(%rbx), %rdi
	movq	8(%r14), %rsi
	movq	_max_ldt_segment@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	shll	$2, %edx
	callq	_bcopy
	movq	%rbx, %rdi
	callq	_user_ldt_derefl
LBB0_7:
	xorl	%eax, %eax
	callq	_critical_enter
	leaq	16(%r12), %rsi
	leaq	-112(%rbp), %rdi
	callq	_ssdtosyssd
	xorl	%eax, %eax
	callq	_atomic_thread_fence_rel
	movq	%r14, 8(%r12)
	xorl	%eax, %eax
	callq	_critical_exit
	movq	_set_user_ldt_rv@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movl	(%r12), %ecx
	xorl	%edi, %edi
	xorl	%edx, %edx
	callq	_smp_rendezvous
	movq	8(%r12), %rbx
LBB0_8:
	movq	%rbx, %rax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_dt_lock,4,2                    ## @dt_lock
	.comm	_MA_OWNED,4,2                   ## @MA_OWNED
	.comm	_M_SUBPROC,4,2                  ## @M_SUBPROC
	.comm	_M_WAITOK,4,2                   ## @M_WAITOK
	.comm	_max_ldt_segment,4,2            ## @max_ldt_segment
	.comm	_M_ZERO,4,2                     ## @M_ZERO
	.comm	_SDT_SYSLDT,4,2                 ## @SDT_SYSLDT
	.comm	_SEL_KPL,4,2                    ## @SEL_KPL
	.comm	_set_user_ldt_rv,8,3            ## @set_user_ldt_rv
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_user_ldt_alloc                 ; -- Begin function user_ldt_alloc
	.p2align	2
_user_ldt_alloc:                        ; @user_ldt_alloc
	.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	x21, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _MA_OWNED@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MA_OWNED@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x0, _dt_lock@GOTPAGE
Lloh4:
	ldr	x0, [x0, _dt_lock@GOTPAGEOFF]
	bl	_mtx_assert
	cbz	w21, LBB0_4
LBB0_1:
Lloh5:
	adrp	x23, _dt_lock@GOTPAGE
Lloh6:
	ldr	x23, [x23, _dt_lock@GOTPAGEOFF]
	mov	x0, x23
	bl	_mtx_unlock
Lloh7:
	adrp	x26, _M_SUBPROC@GOTPAGE
Lloh8:
	ldr	x26, [x26, _M_SUBPROC@GOTPAGEOFF]
	ldr	w1, [x26]
Lloh9:
	adrp	x24, _M_WAITOK@GOTPAGE
Lloh10:
	ldr	x24, [x24, _M_WAITOK@GOTPAGEOFF]
	ldr	w2, [x24]
	mov	w0, #16
	bl	_malloc
	mov	x20, x0
Lloh11:
	adrp	x27, _max_ldt_segment@GOTPAGE
Lloh12:
	ldr	x27, [x27, _max_ldt_segment@GOTPAGEOFF]
	ldr	w8, [x27]
	lsl	w22, w8, #2
	ldr	w8, [x24]
Lloh13:
	adrp	x9, _M_ZERO@GOTPAGE
Lloh14:
	ldr	x9, [x9, _M_ZERO@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
	orr	w1, w9, w8
	mov	x0, x22
	bl	_kmem_malloc
	mov	x24, x0
	str	x0, [x20, #8]
	add	x25, x0, w22, sxtw
	mov	x1, x25
	mov	w2, #0
	bl	_pmap_pti_add_kva
	mov	w8, #1
	str	w8, [x20]
	str	x24, [sp, #40]
Lloh16:
	adrp	x9, _SDT_SYSLDT@GOTPAGE
Lloh17:
	ldr	x9, [x9, _SDT_SYSLDT@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
Lloh19:
	adrp	x10, _SEL_KPL@GOTPAGE
Lloh20:
	ldr	x10, [x10, _SEL_KPL@GOTPAGEOFF]
Lloh21:
	ldr	w10, [x10]
	stp	w10, w9, [sp, #32]
	sub	w9, w22, #1
	stp	w9, w8, [sp]
	stp	xzr, xzr, [sp, #16]
	str	xzr, [sp, #8]
	mov	x0, x23
	bl	_mtx_lock
	ldr	x23, [x19, #8]
	cbnz	w21, LBB0_5
; %bb.2:
	cbz	x23, LBB0_5
; %bb.3:
	mov	x0, x24
	mov	x1, x25
	bl	_pmap_pti_remove_kva
	mov	x0, x24
	mov	x1, x22
	bl	_kmem_free
	ldr	w1, [x26]
	mov	x0, x20
	bl	_free
	b	LBB0_8
LBB0_4:
	ldr	x23, [x19, #8]
	cbnz	x23, LBB0_8
	b	LBB0_1
LBB0_5:
	cbz	x23, LBB0_7
; %bb.6:
	ldr	x0, [x23, #8]
	ldr	x1, [x20, #8]
	ldr	w8, [x27]
	lsl	w2, w8, #2
	bl	_bcopy
	mov	x0, x23
	bl	_user_ldt_derefl
LBB0_7:
	bl	_critical_enter
	add	x1, x19, #16
	mov	x0, sp
	bl	_ssdtosyssd
	bl	_atomic_thread_fence_rel
	str	x20, [x19, #8]
	bl	_critical_exit
Lloh22:
	adrp	x8, _set_user_ldt_rv@GOTPAGE
Lloh23:
	ldr	x8, [x8, _set_user_ldt_rv@GOTPAGEOFF]
Lloh24:
	ldr	x1, [x8]
	ldr	w3, [x19]
	mov	x0, #0
	mov	x2, #0
	bl	_smp_rendezvous
	ldr	x23, [x19, #8]
LBB0_8:
	mov	x0, x23
	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 AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_dt_lock,4,2                    ; @dt_lock
	.comm	_MA_OWNED,4,2                   ; @MA_OWNED
	.comm	_M_SUBPROC,4,2                  ; @M_SUBPROC
	.comm	_M_WAITOK,4,2                   ; @M_WAITOK
	.comm	_max_ldt_segment,4,2            ; @max_ldt_segment
	.comm	_M_ZERO,4,2                     ; @M_ZERO
	.comm	_SDT_SYSLDT,4,2                 ; @SDT_SYSLDT
	.comm	_SEL_KPL,4,2                    ; @SEL_KPL
	.comm	_set_user_ldt_rv,8,3            ; @set_user_ldt_rv
.subsections_via_symbols
