	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function lsapi_reopen_stderr2
_lsapi_reopen_stderr2:                  ## @lsapi_reopen_stderr2
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	_O_WRONLY@GOTPCREL(%rip), %rax
	movq	_O_CREAT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	movq	%rdi, %r14
	movq	_O_APPEND@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movl	$420, %edx                      ## imm = 0x1A4
	callq	_open
	cmpl	$2, %eax
	je	LBB0_4
## %bb.1:
	movl	%eax, %ebx
	cmpl	$-1, %eax
	jne	LBB0_3
## %bb.2:
	leaq	L_.str(%rip), %rsi
	xorl	%edi, %edi
	movq	%r14, %rdx
	callq	_LSAPI_perror_r
	movl	$-1, %eax
	jmp	LBB0_8
LBB0_3:
	movl	%ebx, %edi
	movl	$2, %esi
	callq	_dup2
	movl	%ebx, %edi
	callq	_close
	movl	$2, %edi
	movl	$1, %esi
	callq	_dup2
LBB0_4:
	movq	_s_stderr_log_path@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_7
## %bb.5:
	cmpq	%r14, %rdi
	je	LBB0_7
## %bb.6:
	callq	_free
	movq	$0, (%rbx)
LBB0_7:
	movq	%r14, %rdi
	callq	_strdup
	movq	%rax, (%rbx)
	xorl	%eax, %eax
LBB0_8:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_O_WRONLY,4,2                   ## @O_WRONLY
	.comm	_O_CREAT,4,2                    ## @O_CREAT
	.comm	_O_APPEND,4,2                   ## @O_APPEND
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to open custom stderr log"

	.comm	_s_stderr_log_path,8,3          ## @s_stderr_log_path
	.no_dead_strip	_lsapi_reopen_stderr2
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function lsapi_reopen_stderr2
_lsapi_reopen_stderr2:                  ; @lsapi_reopen_stderr2
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
Lloh0:
	adrp	x8, _O_WRONLY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _O_WRONLY@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _O_CREAT@GOTPAGE
Lloh4:
	ldr	x9, [x9, _O_CREAT@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh6:
	adrp	x9, _O_APPEND@GOTPAGE
Lloh7:
	ldr	x9, [x9, _O_APPEND@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	orr	w1, w8, w9
	mov	w2, #420
	bl	_open
	cmp	w0, #2
	b.eq	LBB0_4
; %bb.1:
	mov	x20, x0
	cmn	w0, #1
	b.ne	LBB0_3
; %bb.2:
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, #0
	mov	x2, x19
	bl	_LSAPI_perror_r
	mov	w0, #-1
	b	LBB0_7
LBB0_3:
	mov	x0, x20
	mov	w1, #2
	bl	_dup2
	mov	x0, x20
	bl	_close
	mov	w0, #2
	mov	w1, #1
	bl	_dup2
LBB0_4:
Lloh11:
	adrp	x20, _s_stderr_log_path@GOTPAGE
Lloh12:
	ldr	x20, [x20, _s_stderr_log_path@GOTPAGEOFF]
	ldr	x0, [x20]
	cmp	x0, #0
	ccmp	x0, x19, #4, ne
	b.eq	LBB0_6
; %bb.5:
	bl	_free
	str	xzr, [x20]
LBB0_6:
	mov	x0, x19
	bl	_strdup
	mov	x8, x0
	mov	w0, #0
	str	x8, [x20]
LBB0_7:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_O_WRONLY,4,2                   ; @O_WRONLY
	.comm	_O_CREAT,4,2                    ; @O_CREAT
	.comm	_O_APPEND,4,2                   ; @O_APPEND
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to open custom stderr log"

	.comm	_s_stderr_log_path,8,3          ; @s_stderr_log_path
	.no_dead_strip	_lsapi_reopen_stderr2
.subsections_via_symbols
