	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function log_ref_setup
_log_ref_setup:                         ## @log_ref_setup
	.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	%r8, %r14
	movq	%rcx, %r12
	movl	%edx, %r13d
	movq	%rsi, %rbx
	movq	_STRBUF_INIT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)
	leaq	-48(%rbp), %r15
	movq	%r15, %rsi
	movq	%rbx, %rdx
	callq	_files_reflog_path
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_strbuf_detach
	movq	%rax, %r15
	testl	%r13d, %r13d
	jne	LBB0_2
## %bb.1:
	movq	%rbx, %rdi
	callq	_should_autocreate_reflog
	testq	%rax, %rax
	je	LBB0_8
LBB0_2:
	movq	_open_or_create_logfile@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movq	%r12, %rdx
	callq	_raceproof_create_file
	testq	%rax, %rax
	je	LBB0_5
## %bb.3:
	movq	_errno@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	_ENOENT@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdi
	jne	LBB0_6
## %bb.4:
	callq	_strerror
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_14
LBB0_5:
	cmpl	$0, (%r12)
	jns	LBB0_9
	jmp	LBB0_10
LBB0_6:
	movq	_EISDIR@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdi
	jne	LBB0_13
## %bb.7:
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_strbuf_addf
	jmp	LBB0_15
LBB0_8:
	movq	_O_APPEND@GOTPCREL(%rip), %rax
	movq	_O_WRONLY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	movq	%r15, %rdi
	movl	$438, %edx                      ## imm = 0x1B6
	callq	_open
	movl	%eax, (%r12)
	testl	%eax, %eax
	js	LBB0_11
LBB0_9:
	movq	%r15, %rdi
	callq	_adjust_shared_perm
LBB0_10:
	xorl	%ebx, %ebx
	jmp	LBB0_16
LBB0_11:
	movq	_errno@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	_ENOENT@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	cmpq	(%rax), %rdi
	je	LBB0_16
## %bb.12:
	movq	_EISDIR@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdi
	je	LBB0_16
LBB0_13:
	callq	_strerror
	leaq	L_.str.2(%rip), %rsi
LBB0_14:
	movq	%r14, %rdi
	movq	%r15, %rdx
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_strbuf_addf
LBB0_15:
	movl	$-1, %ebx
LBB0_16:
	movq	%r15, %rdi
	callq	_free
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_STRBUF_INIT,4,2                ## @STRBUF_INIT
	.comm	_open_or_create_logfile,4,2     ## @open_or_create_logfile
	.comm	_errno,8,3                      ## @errno
	.comm	_ENOENT,8,3                     ## @ENOENT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unable to create directory for '%s': %s"

	.comm	_EISDIR,8,3                     ## @EISDIR
L_.str.1:                               ## @.str.1
	.asciz	"there are still logs under '%s'"

L_.str.2:                               ## @.str.2
	.asciz	"unable to append to '%s': %s"

	.comm	_O_APPEND,4,2                   ## @O_APPEND
	.comm	_O_WRONLY,4,2                   ## @O_WRONLY
	.no_dead_strip	_log_ref_setup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function log_ref_setup
_log_ref_setup:                         ; @log_ref_setup
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x20, x4
	mov	x21, x3
	mov	x23, x2
	mov	x22, x1
Lloh0:
	adrp	x8, _STRBUF_INIT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _STRBUF_INIT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [sp, #8]
	add	x1, sp, #8
	mov	x2, x22
	bl	_files_reflog_path
	add	x0, sp, #8
	mov	x1, #0
	bl	_strbuf_detach
	mov	x19, x0
	cbnz	w23, LBB0_2
; %bb.1:
	mov	x0, x22
	bl	_should_autocreate_reflog
	cbz	x0, LBB0_8
LBB0_2:
Lloh3:
	adrp	x8, _open_or_create_logfile@GOTPAGE
Lloh4:
	ldr	x8, [x8, _open_or_create_logfile@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x21
	bl	_raceproof_create_file
	cbz	x0, LBB0_5
; %bb.3:
Lloh6:
	adrp	x8, _errno@GOTPAGE
Lloh7:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh8:
	ldr	x0, [x8]
Lloh9:
	adrp	x8, _ENOENT@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
Lloh11:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_6
; %bb.4:
	bl	_strerror
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh12:
	adrp	x1, l_.str@PAGE
Lloh13:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_13
LBB0_5:
	ldr	w8, [x21]
	tbz	w8, #31, LBB0_9
	b	LBB0_10
LBB0_6:
Lloh14:
	adrp	x8, _EISDIR@GOTPAGE
Lloh15:
	ldr	x8, [x8, _EISDIR@GOTPAGEOFF]
Lloh16:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_12
; %bb.7:
Lloh17:
	adrp	x1, l_.str.1@PAGE
Lloh18:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_13
LBB0_8:
Lloh19:
	adrp	x8, _O_APPEND@GOTPAGE
Lloh20:
	ldr	x8, [x8, _O_APPEND@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
Lloh22:
	adrp	x9, _O_WRONLY@GOTPAGE
Lloh23:
	ldr	x9, [x9, _O_WRONLY@GOTPAGEOFF]
Lloh24:
	ldr	w9, [x9]
	orr	w1, w9, w8
	mov	x0, x19
	mov	w2, #438
	bl	_open
	str	w0, [x21]
	tbnz	w0, #31, LBB0_11
LBB0_9:
	mov	x0, x19
	bl	_adjust_shared_perm
LBB0_10:
	mov	w20, #0
	b	LBB0_14
LBB0_11:
Lloh25:
	adrp	x8, _errno@GOTPAGE
Lloh26:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh27:
	ldr	x0, [x8]
Lloh28:
	adrp	x8, _ENOENT@GOTPAGE
Lloh29:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
Lloh30:
	ldr	x8, [x8]
Lloh31:
	adrp	x9, _EISDIR@GOTPAGE
Lloh32:
	ldr	x9, [x9, _EISDIR@GOTPAGEOFF]
Lloh33:
	ldr	x9, [x9]
	cmp	x0, x8
	ccmp	x0, x9, #4, ne
	b.eq	LBB0_10
LBB0_12:
	bl	_strerror
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh34:
	adrp	x1, l_.str.2@PAGE
Lloh35:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_13:
	mov	x0, x20
	mov	x2, x19
	bl	_strbuf_addf
	mov	w20, #-1
LBB0_14:
	mov	x0, x19
	bl	_free
	mov	x0, x20
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.comm	_STRBUF_INIT,4,2                ; @STRBUF_INIT
	.comm	_open_or_create_logfile,4,2     ; @open_or_create_logfile
	.comm	_errno,8,3                      ; @errno
	.comm	_ENOENT,8,3                     ; @ENOENT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unable to create directory for '%s': %s"

	.comm	_EISDIR,8,3                     ; @EISDIR
l_.str.1:                               ; @.str.1
	.asciz	"there are still logs under '%s'"

l_.str.2:                               ; @.str.2
	.asciz	"unable to append to '%s': %s"

	.comm	_O_APPEND,4,2                   ; @O_APPEND
	.comm	_O_WRONLY,4,2                   ; @O_WRONLY
	.no_dead_strip	_log_ref_setup
.subsections_via_symbols
