	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function emem_trunc
_emem_trunc:                            ## @emem_trunc
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	(%rdi), %rbx
	testl	%esi, %esi
	je	LBB0_1
## %bb.2:
	movslq	%r14d, %r13
	movq	(%rbx), %r12
	movq	8(%rbx), %rax
	movq	16(%rbx), %r15
	cmpq	%r13, %rax
	jb	LBB0_4
## %bb.3:
	shrq	%rax
	cmpq	%r13, %rax
	jbe	LBB0_9
LBB0_4:
	movq	%r12, -48(%rbp)                 ## 8-byte Spill
	movq	%r12, %rdi
	movl	%r14d, %esi
	callq	_realloc
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movq	%rax, %r12
	subq	-48(%rbp), %r15                 ## 8-byte Folded Reload
	movq	8(%rbx), %rax
	cmpq	%r13, %rax
	jae	LBB0_8
## %bb.7:
	leaq	(%r12,%rax), %rdi
	movl	%r14d, %edx
	subl	%eax, %edx
	xorl	%esi, %esi
	callq	_memset
LBB0_8:
	movq	%r13, 8(%rbx)
	movq	%r12, (%rbx)
	addq	%r12, %r15
	movq	%r15, 16(%rbx)
	jmp	LBB0_9
LBB0_1:
	movq	(%rbx), %rdi
	callq	_free
	xorps	%xmm0, %xmm0
	movups	%xmm0, (%rbx)
	movq	$0, 16(%rbx)
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
	xorl	%r15d, %r15d
LBB0_9:
	movl	%r14d, 24(%rbx)
	subq	%r12, %r15
	xorl	%eax, %eax
	cmpq	%r13, %r15
	jle	LBB0_11
## %bb.10:
	addq	%r13, %r12
	movq	%r12, 16(%rbx)
	jmp	LBB0_11
LBB0_5:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_11:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_emem_trunc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function emem_trunc
_emem_trunc:                            ; @emem_trunc
	.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	x19, x1
	ldr	x22, [x0]
	cbz	w1, LBB0_6
; %bb.1:
	sxtw	x23, w19
	ldp	x21, x8, [x22]
	lsr	x9, x8, #1
	ldr	x24, [x22, #16]
	cmp	x8, x23
	ccmp	x9, x23, #2, hs
	b.ls	LBB0_7
; %bb.2:
	mov	x0, x21
	mov	x1, x19
	bl	_realloc
	cbz	x0, LBB0_11
; %bb.3:
	mov	x20, x0
	sub	x21, x24, x21
	ldr	x8, [x22, #8]
	cmp	x8, x23
	b.hs	LBB0_5
; %bb.4:
	add	x0, x20, x8
	sub	w2, w19, w8
	mov	w1, #0
	bl	_memset
LBB0_5:
	stp	x20, x23, [x22]
	add	x24, x20, x21
	str	x24, [x22, #16]
	b	LBB0_8
LBB0_6:
	ldr	x0, [x22]
	bl	_free
	mov	x23, #0
	mov	x20, #0
	mov	x24, #0
	stp	xzr, xzr, [x22, #8]
	str	xzr, [x22]
	b	LBB0_8
LBB0_7:
	mov	x20, x21
LBB0_8:
	str	w19, [x22, #24]
	sub	x8, x24, x20
	cmp	x8, x23
	b.le	LBB0_10
; %bb.9:
	mov	w0, #0
	add	x8, x20, x23
	str	x8, [x22, #16]
	b	LBB0_12
LBB0_10:
	mov	w0, #0
	b	LBB0_12
LBB0_11:
Lloh0:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
LBB0_12:
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_emem_trunc
.subsections_via_symbols
