	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function alloc_ldt
_alloc_ldt:                             ## @alloc_ldt
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
                                        ## kill: def $esi killed $esi def $rsi
	movl	(%rdi), %r12d
	xorl	%r13d, %r13d
	cmpl	%esi, %r12d
	jge	LBB0_14
## %bb.1:
	movq	%rdi, %r14
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_LDT_ENTRY_SIZE@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	movl	%ecx, %eax
	cltd
	idivl	%edi
	movl	%eax, %ebx
	leal	(%rsi,%rbx), %eax
	decl	%eax
	negl	%ebx
	andl	%eax, %ebx
	imull	%ebx, %edi
	cmpl	%ecx, %edi
	jle	LBB0_3
## %bb.2:
	callq	_vmalloc
	jmp	LBB0_4
LBB0_3:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	___get_free_page
LBB0_4:
	movq	%rax, %r15
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	testl	%r12d, %r12d
	je	LBB0_8
## %bb.7:
	movq	8(%r14), %rsi
	movl	(%r13), %edx
	imull	%r12d, %edx
	movq	%r15, %rdi
	callq	_memcpy
LBB0_8:
	movq	8(%r14), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	(%r13), %eax
	movl	%ebx, %edx
	subl	%r12d, %edx
	imull	%eax, %edx
	imull	%r12d, %eax
	movslq	%eax, %rdi
	addq	%r15, %rdi
	xorl	%r13d, %r13d
	xorl	%esi, %esi
	callq	_memset
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_paravirt_alloc_ldt
	movq	%r15, 8(%r14)
	xorl	%eax, %eax
	callq	_wmb
	movl	%ebx, (%r14)
	xorl	%eax, %eax
	callq	_wmb
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_10
## %bb.9:
	movq	%r14, %rdi
	callq	_load_LDT
LBB0_10:
	testl	%r12d, %r12d
	je	LBB0_14
## %bb.11:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_paravirt_free_ldt
	movq	_LDT_ENTRY_SIZE@GOTPCREL(%rip), %rax
	imull	(%rax), %r12d
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jle	LBB0_13
## %bb.12:
	movq	%rbx, %rdi
	callq	_vfree
	jmp	LBB0_14
LBB0_5:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_14
LBB0_13:
	movq	%rbx, %rdi
	callq	_virt_to_page
	movl	%eax, %edi
	callq	_put_page
LBB0_14:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_LDT_ENTRY_SIZE,4,2             ## @LDT_ENTRY_SIZE
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_current,8,3                    ## @current
	.comm	_flush_ldt,4,2                  ## @flush_ldt
	.no_dead_strip	_alloc_ldt
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function alloc_ldt
_alloc_ldt:                             ; @alloc_ldt
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	ldr	w19, [x0]
	cmp	w19, w1
	b.ge	LBB0_13
; %bb.1:
	mov	x21, x2
	mov	x20, x0
Lloh0:
	adrp	x25, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x25, [x25, _PAGE_SIZE@GOTPAGEOFF]
	ldr	w8, [x25]
Lloh2:
	adrp	x26, _LDT_ENTRY_SIZE@GOTPAGE
Lloh3:
	ldr	x26, [x26, _LDT_ENTRY_SIZE@GOTPAGEOFF]
	ldr	w9, [x26]
	sdiv	w10, w8, w9
	add	w11, w1, w10
	sub	w11, w11, #1
	neg	w10, w10
	and	w22, w11, w10
	mul	w0, w22, w9
	cmp	w0, w8
	b.le	LBB0_10
; %bb.2:
	bl	_vmalloc
	mov	x24, x0
	cbz	x0, LBB0_11
LBB0_3:
	cbz	w19, LBB0_5
; %bb.4:
	ldr	x1, [x20, #8]
	ldr	w8, [x26]
	mul	w2, w8, w19
	mov	x0, x24
	bl	_memcpy
LBB0_5:
	ldr	x23, [x20, #8]
	ldr	w8, [x26]
	mul	w9, w8, w19
	add	x0, x24, w9, sxtw
	sub	w9, w22, w19
	mul	w2, w8, w9
	mov	w1, #0
	bl	_memset
	mov	x0, x24
	mov	x1, x22
	bl	_paravirt_alloc_ldt
	str	x24, [x20, #8]
	bl	_wmb
	str	w22, [x20]
	bl	_wmb
	cbz	w21, LBB0_7
; %bb.6:
	mov	x0, x20
	bl	_load_LDT
LBB0_7:
	cbz	w19, LBB0_13
; %bb.8:
	mov	x0, x23
	mov	x1, x19
	bl	_paravirt_free_ldt
	ldr	w8, [x26]
	mul	w8, w8, w19
	ldr	w9, [x25]
	mov	x0, x23
	cmp	w8, w9
	b.le	LBB0_12
; %bb.9:
	bl	_vfree
	b	LBB0_13
LBB0_10:
Lloh4:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh6:
	ldr	w0, [x8]
	bl	___get_free_page
	mov	x24, x0
	cbnz	x0, LBB0_3
LBB0_11:
Lloh7:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_14
LBB0_12:
	bl	_virt_to_page
	bl	_put_page
LBB0_13:
	mov	w0, #0
LBB0_14:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_LDT_ENTRY_SIZE,4,2             ; @LDT_ENTRY_SIZE
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_current,8,3                    ; @current
	.comm	_flush_ldt,4,2                  ; @flush_ldt
	.no_dead_strip	_alloc_ldt
.subsections_via_symbols
