	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_atf_utils_copy_file            ## -- Begin function atf_utils_copy_file
	.p2align	4, 0x90
_atf_utils_copy_file:                   ## @atf_utils_copy_file
	.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
	subq	$1048, %rsp                     ## imm = 0x418
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_O_RDONLY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%eax, %eax
	callq	_open
	movl	%eax, %r15d
	xorl	%edi, %edi
	cmpl	$-1, %eax
	setne	%dil
	leaq	L_.str(%rip), %rsi
	movq	%rbx, -1088(%rbp)               ## 8-byte Spill
	movq	%rbx, %rdx
	callq	_ATF_REQUIRE_MSG
	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	$511, %edx                      ## imm = 0x1FF
	xorl	%eax, %eax
	callq	_open
	xorl	%edi, %edi
	movl	%eax, -1076(%rbp)               ## 4-byte Spill
	cmpl	$-1, %eax
	setne	%dil
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %r12
	movq	%r14, %rdx
	callq	_ATF_REQUIRE_MSG
	leaq	-1072(%rbp), %rsi
	movl	%r15d, %r13d
	movl	%r15d, %edi
	movl	$1024, %edx                     ## imm = 0x400
	callq	_read
	movl	%eax, %r14d
	testl	%eax, %eax
	jle	LBB0_1
## %bb.2:
	leaq	-1072(%rbp), %rbx
	movl	-1076(%rbp), %r15d              ## 4-byte Reload
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	%r15d, %edi
	movq	%rbx, %rsi
	movl	%r14d, %edx
	callq	_write
	xorl	%edi, %edi
	cmpl	%r14d, %eax
	sete	%dil
	leaq	L_.str.2(%rip), %rsi
	movq	%r12, %rdx
	callq	_ATF_REQUIRE_MSG
	movl	%r13d, %edi
	movq	%rbx, %rsi
	movl	$1024, %edx                     ## imm = 0x400
	callq	_read
	movl	%eax, %r14d
	testl	%eax, %eax
	jg	LBB0_3
	jmp	LBB0_4
LBB0_1:
	movl	-1076(%rbp), %r15d              ## 4-byte Reload
LBB0_4:
	xorl	%edi, %edi
	cmpl	$-1, %r14d
	setne	%dil
	leaq	L_.str.3(%rip), %rsi
	movq	-1088(%rbp), %rbx               ## 8-byte Reload
	movq	%rbx, %rdx
	callq	_ATF_REQUIRE_MSG
	leaq	-1080(%rbp), %rsi
	movl	%r13d, %edi
	callq	_fstat
	xorl	%edi, %edi
	cmpl	$-1, %eax
	setne	%dil
	leaq	L_.str.4(%rip), %rsi
	movq	%rbx, %rdx
	callq	_ATF_REQUIRE_MSG
	movl	-1080(%rbp), %esi
	movl	%r15d, %edi
	callq	_fchmod
	xorl	%edi, %edi
	cmpl	$-1, %eax
	setne	%dil
	leaq	L_.str.5(%rip), %rsi
	movq	%r12, %rdx
	callq	_ATF_REQUIRE_MSG
	movl	%r15d, %edi
	callq	_close
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_5
## %bb.6:
	movl	%r13d, %edi
	addq	$1048, %rsp                     ## imm = 0x418
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_close                          ## TAILCALL
LBB0_5:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_O_RDONLY,4,2                   ## @O_RDONLY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to open source file during copy (%s)"

	.comm	_O_WRONLY,4,2                   ## @O_WRONLY
	.comm	_O_CREAT,4,2                    ## @O_CREAT
	.comm	_O_TRUNC,4,2                    ## @O_TRUNC
L_.str.1:                               ## @.str.1
	.asciz	"Failed to open destination file during copy (%s)"

L_.str.2:                               ## @.str.2
	.asciz	"Failed to write to %s during copy"

L_.str.3:                               ## @.str.3
	.asciz	"Failed to read from %s during copy"

L_.str.4:                               ## @.str.4
	.asciz	"Failed to stat source file %s during copy"

L_.str.5:                               ## @.str.5
	.asciz	"Failed to chmod destination file %s during copy"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_atf_utils_copy_file            ; -- Begin function atf_utils_copy_file
	.p2align	2
_atf_utils_copy_file:                   ; @atf_utils_copy_file
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -72
	.cfi_offset w28, -80
	sub	sp, sp, #1056
	mov	x20, x1
	mov	x21, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-72]
Lloh3:
	adrp	x8, _O_RDONLY@GOTPAGE
Lloh4:
	ldr	x8, [x8, _O_RDONLY@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	bl	_open
	mov	x19, x0
	cmn	w0, #1
	cset	w0, ne
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x21
	bl	_ATF_REQUIRE_MSG
Lloh8:
	adrp	x8, _O_WRONLY@GOTPAGE
Lloh9:
	ldr	x8, [x8, _O_WRONLY@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
Lloh11:
	adrp	x9, _O_CREAT@GOTPAGE
Lloh12:
	ldr	x9, [x9, _O_CREAT@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh14:
	adrp	x9, _O_TRUNC@GOTPAGE
Lloh15:
	ldr	x9, [x9, _O_TRUNC@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	orr	w1, w8, w9
	mov	w8, #511
	str	x8, [sp]
	mov	x0, x20
	bl	_open
	mov	x22, x0
	cmn	w0, #1
	cset	w0, ne
Lloh17:
	adrp	x1, l_.str.1@PAGE
Lloh18:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x20
	bl	_ATF_REQUIRE_MSG
	add	x1, sp, #24
	mov	x0, x19
	mov	w2, #1024
	bl	_read
	mov	x24, x0
	cmp	w0, #1
	b.lt	LBB0_3
; %bb.1:
Lloh19:
	adrp	x23, l_.str.2@PAGE
Lloh20:
	add	x23, x23, l_.str.2@PAGEOFF
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	add	x1, sp, #24
	mov	x0, x22
	mov	x2, x24
	bl	_write
	cmp	w0, w24
	cset	w0, eq
	mov	x1, x23
	mov	x2, x20
	bl	_ATF_REQUIRE_MSG
	add	x1, sp, #24
	mov	x0, x19
	mov	w2, #1024
	bl	_read
	mov	x24, x0
	cmp	w0, #0
	b.gt	LBB0_2
LBB0_3:
	cmn	w24, #1
	cset	w0, ne
Lloh21:
	adrp	x1, l_.str.3@PAGE
Lloh22:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x2, x21
	bl	_ATF_REQUIRE_MSG
	add	x1, sp, #16
	mov	x0, x19
	bl	_fstat
	cmn	w0, #1
	cset	w0, ne
Lloh23:
	adrp	x1, l_.str.4@PAGE
Lloh24:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x2, x21
	bl	_ATF_REQUIRE_MSG
	ldr	w1, [sp, #16]
	mov	x0, x22
	bl	_fchmod
	cmn	w0, #1
	cset	w0, ne
Lloh25:
	adrp	x1, l_.str.5@PAGE
Lloh26:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x2, x20
	bl	_ATF_REQUIRE_MSG
	mov	x0, x22
	bl	_close
	ldur	x8, [x29, #-72]
Lloh27:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh28:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh29:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_5
; %bb.4:
	mov	x0, x19
	add	sp, sp, #1056
	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
	ldp	x28, x27, [sp], #80             ; 16-byte Folded Reload
	b	_close
LBB0_5:
	bl	___stack_chk_fail
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_O_RDONLY,4,2                   ; @O_RDONLY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to open source file during copy (%s)"

	.comm	_O_WRONLY,4,2                   ; @O_WRONLY
	.comm	_O_CREAT,4,2                    ; @O_CREAT
	.comm	_O_TRUNC,4,2                    ; @O_TRUNC
l_.str.1:                               ; @.str.1
	.asciz	"Failed to open destination file during copy (%s)"

l_.str.2:                               ; @.str.2
	.asciz	"Failed to write to %s during copy"

l_.str.3:                               ; @.str.3
	.asciz	"Failed to read from %s during copy"

l_.str.4:                               ; @.str.4
	.asciz	"Failed to stat source file %s during copy"

l_.str.5:                               ; @.str.5
	.asciz	"Failed to chmod destination file %s during copy"

.subsections_via_symbols
