	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cb_open
_cb_open:                               ## @cb_open
	.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
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_PATH_MAX@GOTPCREL(%rip), %r13
	movl	(%r13), %ebx
	movq	%rbx, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r12
	movq	_host_base@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	testl	%esi, %esi
	je	LBB0_1
## %bb.2:
	movq	%r12, %rdi
	movl	%ebx, %edx
	callq	_strlcpy
	movq	%r12, %rdi
	callq	_strlen
	cltq
	cmpb	$47, -1(%rax,%r12)
	jne	LBB0_4
## %bb.3:
	movq	%r12, %rdi
	callq	_strlen
	cltq
	movb	$0, -1(%rax,%r12)
LBB0_4:
	movl	(%r13), %edx
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_strlcat
	movl	$40, %edi
	callq	_malloc
	movq	%rax, %r15
	movq	%rax, %rbx
	addq	$24, %rbx
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	_stat
	testq	%rax, %rax
	js	LBB0_5
## %bb.6:
	movl	24(%r15), %edi
	movl	28(%r15), %eax
	movl	%eax, 32(%r15)
	callq	_S_ISDIR
	testq	%rax, %rax
	je	LBB0_9
## %bb.7:
	movl	$1, (%r15)
	movq	%r12, %rdi
	callq	_opendir
	movl	%eax, 16(%r15)
	testl	%eax, %eax
	jne	LBB0_8
	jmp	LBB0_11
LBB0_1:
	movq	_ENOENT@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_5:
	movq	%r15, %rdi
	callq	_free
	movq	_errno@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_9:
	movl	(%rbx), %edi
	callq	_S_ISREG
	testq	%rax, %rax
	je	LBB0_11
## %bb.10:
	movl	$0, (%r15)
	movq	_O_RDONLY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_open
	movq	%rax, 8(%r15)
	testq	%rax, %rax
	js	LBB0_11
LBB0_8:
	movq	%r15, (%r14)
	xorl	%eax, %eax
	jmp	LBB0_13
LBB0_11:
	movq	%r15, %rdi
	callq	_free
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_12:
	movl	(%rax), %eax
LBB0_13:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_15
## %bb.14:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_15:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_PATH_MAX,4,2                   ## @PATH_MAX
	.comm	_host_base,4,2                  ## @host_base
	.comm	_ENOENT,4,2                     ## @ENOENT
	.comm	_errno,4,2                      ## @errno
	.comm	_O_RDONLY,4,2                   ## @O_RDONLY
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_cb_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cb_open
_cb_open:                               ; @cb_open
	.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
	sub	sp, sp, #16
	mov	x19, x2
	mov	x21, x1
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-40]
Lloh3:
	adrp	x22, _PATH_MAX@GOTPAGE
Lloh4:
	ldr	x22, [x22, _PATH_MAX@GOTPAGEOFF]
	ldr	w2, [x22]
	mov	x9, x2
Lloh5:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh6:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x8, sp
	add	x9, x2, #15
	and	x9, x9, #0x1fffffff0
	sub	x20, x8, x9
	mov	sp, x20
Lloh7:
	adrp	x8, _host_base@GOTPAGE
Lloh8:
	ldr	x8, [x8, _host_base@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	cbz	w1, LBB0_6
; %bb.1:
	mov	x0, x20
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_strlcpy
	mov	x0, x20
	bl	_strlen
	add	x8, x20, w0, sxtw
	ldurb	w8, [x8, #-1]
	cmp	w8, #47
	b.ne	LBB0_3
; %bb.2:
	mov	x0, x20
	bl	_strlen
	add	x8, x20, w0, sxtw
	sturb	wzr, [x8, #-1]
LBB0_3:
	ldr	w2, [x22]
	mov	x0, x20
	mov	x1, x21
	bl	_strlcat
	mov	w0, #40
	bl	_malloc
	mov	x21, x0
	add	x22, x0, #24
	mov	x0, x20
	mov	x1, x22
	bl	_stat
	tbnz	x0, #63, LBB0_7
; %bb.4:
	ldp	w0, w8, [x21, #24]
	str	w8, [x21, #32]
	bl	_S_ISDIR
	cbz	x0, LBB0_8
; %bb.5:
	mov	w8, #1
	str	w8, [x21]
	mov	x0, x20
	bl	_opendir
	str	w0, [x21, #16]
	cbnz	w0, LBB0_10
	b	LBB0_11
LBB0_6:
Lloh10:
	adrp	x8, _ENOENT@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
	b	LBB0_12
LBB0_7:
	mov	x0, x21
	bl	_free
Lloh12:
	adrp	x8, _errno@GOTPAGE
Lloh13:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
	b	LBB0_12
LBB0_8:
	ldr	w0, [x22]
	bl	_S_ISREG
	cbz	x0, LBB0_11
; %bb.9:
	str	wzr, [x21]
Lloh14:
	adrp	x8, _O_RDONLY@GOTPAGE
Lloh15:
	ldr	x8, [x8, _O_RDONLY@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_open
	str	x0, [x21, #8]
	tbnz	x0, #63, LBB0_11
LBB0_10:
	mov	w0, #0
	str	x21, [x19]
	b	LBB0_13
LBB0_11:
	mov	x0, x21
	bl	_free
Lloh17:
	adrp	x8, _EINVAL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_12:
	ldr	w0, [x8]
LBB0_13:
	ldur	x8, [x29, #-40]
Lloh19:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh20:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh21:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_15
; %bb.14:
	sub	sp, x29, #32
	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
LBB0_15:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_PATH_MAX,4,2                   ; @PATH_MAX
	.comm	_host_base,4,2                  ; @host_base
	.comm	_ENOENT,4,2                     ; @ENOENT
	.comm	_errno,4,2                      ; @errno
	.comm	_O_RDONLY,4,2                   ; @O_RDONLY
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_cb_open
.subsections_via_symbols
