	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_atf_utils_redirect             ## -- Begin function atf_utils_redirect
	.p2align	4, 0x90
_atf_utils_redirect:                    ## @atf_utils_redirect
	.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
	movl	%edi, %r15d
	movq	_STDOUT_FILENO@GOTPCREL(%rip), %rax
	cmpl	%edi, (%rax)
	jne	LBB0_2
## %bb.1:
	movq	_stdout@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_2:
	movq	_STDERR_FILENO@GOTPCREL(%rip), %rax
	cmpl	%r15d, (%rax)
	jne	LBB0_5
## %bb.3:
	movq	_stderr@GOTPCREL(%rip), %rax
LBB0_4:
	movl	(%rax), %edi
	callq	_fflush
LBB0_5:
	movq	_O_WRONLY@GOTPCREL(%rip), %rax
	movq	_O_CREAT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	movq	_O_TRUNC@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movq	%r14, %rdi
	movl	$420, %edx                      ## imm = 0x1A4
	callq	_open
	movl	%eax, %ebx
	cmpl	$-1, %eax
	je	LBB0_6
## %bb.7:
	cmpl	%r15d, %ebx
	jne	LBB0_8
	jmp	LBB0_10
LBB0_6:
	movq	_EXIT_FAILURE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	_err
	cmpl	%r15d, %ebx
	je	LBB0_10
LBB0_8:
	movl	%ebx, %edi
	movl	%r15d, %esi
	callq	_dup2
	cmpl	$-1, %eax
	jne	LBB0_10
## %bb.9:
	movq	_EXIT_FAILURE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_err
LBB0_10:
	movl	%ebx, %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_close                          ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_STDOUT_FILENO,4,2              ## @STDOUT_FILENO
	.comm	_stdout,4,2                     ## @stdout
	.comm	_STDERR_FILENO,4,2              ## @STDERR_FILENO
	.comm	_stderr,4,2                     ## @stderr
	.comm	_O_WRONLY,4,2                   ## @O_WRONLY
	.comm	_O_CREAT,4,2                    ## @O_CREAT
	.comm	_O_TRUNC,4,2                    ## @O_TRUNC
	.comm	_EXIT_FAILURE,4,2               ## @EXIT_FAILURE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Cannot create %s"

L_.str.1:                               ## @.str.1
	.asciz	"Cannot redirect to fd %d"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_atf_utils_redirect             ; -- Begin function atf_utils_redirect
	.p2align	2
_atf_utils_redirect:                    ; @atf_utils_redirect
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _STDOUT_FILENO@GOTPAGE
Lloh1:
	ldr	x8, [x8, _STDOUT_FILENO@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w0
	b.ne	LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _stdout@GOTPAGE
Lloh4:
	ldr	x8, [x8, _stdout@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:
Lloh5:
	adrp	x8, _STDERR_FILENO@GOTPAGE
Lloh6:
	ldr	x8, [x8, _STDERR_FILENO@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	cmp	w8, w19
	b.ne	LBB0_5
; %bb.3:
Lloh8:
	adrp	x8, _stderr@GOTPAGE
Lloh9:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
LBB0_4:
	ldr	w0, [x8]
	bl	_fflush
LBB0_5:
Lloh10:
	adrp	x8, _O_WRONLY@GOTPAGE
Lloh11:
	ldr	x8, [x8, _O_WRONLY@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
Lloh13:
	adrp	x9, _O_CREAT@GOTPAGE
Lloh14:
	ldr	x9, [x9, _O_CREAT@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh16:
	adrp	x9, _O_TRUNC@GOTPAGE
Lloh17:
	ldr	x9, [x9, _O_TRUNC@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	orr	w1, w8, w9
	mov	x0, x20
	mov	w2, #420
	bl	_open
	mov	x21, x0
	cmn	w0, #1
	b.eq	LBB0_7
; %bb.6:
	cmp	w21, w19
	b.ne	LBB0_8
	b	LBB0_10
LBB0_7:
Lloh19:
	adrp	x8, _EXIT_FAILURE@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EXIT_FAILURE@GOTPAGEOFF]
Lloh21:
	ldr	w0, [x8]
	str	x20, [sp]
Lloh22:
	adrp	x1, l_.str@PAGE
Lloh23:
	add	x1, x1, l_.str@PAGEOFF
	bl	_err
	cmp	w21, w19
	b.eq	LBB0_10
LBB0_8:
	mov	x0, x21
	mov	x1, x19
	bl	_dup2
	cmn	w0, #1
	b.ne	LBB0_10
; %bb.9:
Lloh24:
	adrp	x8, _EXIT_FAILURE@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EXIT_FAILURE@GOTPAGEOFF]
Lloh26:
	ldr	w0, [x8]
	str	x19, [sp]
Lloh27:
	adrp	x1, l_.str.1@PAGE
Lloh28:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_err
LBB0_10:
	mov	x0, x21
	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
	add	sp, sp, #64
	b	_close
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_STDOUT_FILENO,4,2              ; @STDOUT_FILENO
	.comm	_stdout,4,2                     ; @stdout
	.comm	_STDERR_FILENO,4,2              ; @STDERR_FILENO
	.comm	_stderr,4,2                     ; @stderr
	.comm	_O_WRONLY,4,2                   ; @O_WRONLY
	.comm	_O_CREAT,4,2                    ; @O_CREAT
	.comm	_O_TRUNC,4,2                    ; @O_TRUNC
	.comm	_EXIT_FAILURE,4,2               ; @EXIT_FAILURE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Cannot create %s"

l_.str.1:                               ; @.str.1
	.asciz	"Cannot redirect to fd %d"

.subsections_via_symbols
