	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cd_alloc
_cd_alloc:                              ## @cd_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %r15
	cmpq	$0, 16(%rdi)
	je	LBB0_2
## %bb.1:
	movq	8(%r15), %rbx
	movq	(%rbx), %rax
	movq	16(%rbx), %rcx
	leaq	(%rax,%r14), %rdx
	addq	8(%rbx), %rcx
	cmpq	%rcx, %rdx
	jbe	LBB0_10
LBB0_2:
	movl	$1, %edi
	movl	$32, %esi
	callq	_calloc
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%rax, %rbx
	movq	$65536, 16(%rax)                ## imm = 0x10000
	movl	$65536, %edi                    ## imm = 0x10000
	callq	_malloc
	movq	%rax, 8(%rbx)
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movq	%rax, (%rbx)
	leaq	8(%r15), %rcx
	cmpq	$0, 16(%r15)
	je	LBB0_7
## %bb.8:
	movq	(%rcx), %rdx
	addq	$24, %rdx
	jmp	LBB0_9
LBB0_3:
	xorl	%eax, %eax
	jmp	LBB0_11
LBB0_5:
	movq	%rbx, %rdi
	callq	_free
	xorl	%eax, %eax
	jmp	LBB0_11
LBB0_7:
	movq	%rcx, %rdx
	leaq	16(%r15), %rcx
LBB0_9:
	movq	%rbx, (%rdx)
	movq	%rbx, (%rcx)
LBB0_10:
	movq	%rax, %rcx
	addq	%r14, %rcx
	movq	%rcx, (%rbx)
	addq	%r14, (%r15)
LBB0_11:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_cd_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cd_alloc
_cd_alloc:                              ; @cd_alloc
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x20, x1
	mov	x19, x0
	mov	x22, x0
	ldr	x8, [x22, #16]!
	cbz	x8, LBB0_2
; %bb.1:
	ldr	x21, [x19, #8]
	ldp	x0, x8, [x21]
	add	x9, x0, x20
	ldr	x10, [x21, #16]
	add	x8, x10, x8
	cmp	x9, x8
	b.ls	LBB0_9
LBB0_2:
	mov	w0, #1
	mov	w1, #32
	bl	_calloc
	cbz	x0, LBB0_10
; %bb.3:
	mov	x21, x0
	mov	w8, #65536
	str	x8, [x0, #16]
	mov	w0, #65536
	bl	_malloc
	str	x0, [x21, #8]
	cbz	x0, LBB0_6
; %bb.4:
	str	x0, [x21]
	ldr	x9, [x19, #16]
	add	x8, x19, #8
	cbz	x9, LBB0_7
; %bb.5:
	ldr	x9, [x8]
	add	x9, x9, #24
	b	LBB0_8
LBB0_6:
	mov	x0, x21
	bl	_free
	mov	x0, #0
	b	LBB0_10
LBB0_7:
	mov	x9, x8
	mov	x8, x22
LBB0_8:
	str	x21, [x9]
	str	x21, [x8]
LBB0_9:
	add	x8, x0, x20
	str	x8, [x21]
	ldr	x8, [x19]
	add	x8, x8, x20
	str	x8, [x19]
LBB0_10:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_cd_alloc
.subsections_via_symbols
