	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_image_writeout_file            ## -- Begin function image_writeout_file
	.p2align	4, 0x90
_image_writeout_file:                   ## @image_writeout_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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, -72(%rbp)                 ## 8-byte Spill
	movq	%rsi, %r12
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_FILE_BUF_LEN@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	%rbx, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r14
	movq	8(%r12), %rdi
	xorl	%r15d, %r15d
	testq	%rdi, %rdi
	je	LBB0_15
## %bb.1:
	cmpq	$0, (%r12)
	je	LBB0_15
## %bb.2:
	movq	_errno@GOTPCREL(%rip), %r15
	movq	$0, (%r15)
	leaq	L_.str(%rip), %rsi
	callq	_fopen
	cmpq	$0, (%r15)
	je	LBB0_4
## %bb.3:
	movq	8(%r12), %rsi
	leaq	L_.str.1(%rip), %rdi
	callq	_ERRS
	movq	_ERR_FATAL@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	jmp	LBB0_15
LBB0_4:
	movq	(%r12), %r15
	testq	%r15, %r15
	je	LBB0_10
## %bb.5:
	movq	%r12, -56(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	%rbx, %r15
	cmovbq	%r15, %rbx
	movq	_errno@GOTPCREL(%rip), %r13
	movq	$0, (%r13)
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movl	$1, %edx
	movq	%rax, %r12
	movq	%rax, %rcx
	callq	_fread
	cmpq	$0, (%r13)
	jne	LBB0_11
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%r14, %rsi
	movq	%rbx, %rdx
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	callq	_write_out_data
	testl	%eax, %eax
	jne	LBB0_12
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	subq	%rbx, %r15
	movq	%r12, %rax
	jne	LBB0_6
LBB0_10:
	xorl	%r15d, %r15d
	jmp	LBB0_14
LBB0_11:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %rsi
	leaq	L_.str.2(%rip), %rdi
	callq	_ERRS
	movq	_ERR_FATAL@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	jmp	LBB0_13
LBB0_12:
	movl	%eax, %r15d
LBB0_13:
	movq	%r12, %rax
LBB0_14:
	movq	%rax, %rdi
	callq	_fclose
LBB0_15:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_17
## %bb.16:
	movl	%r15d, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_17:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_FILE_BUF_LEN,4,2               ## @FILE_BUF_LEN
	.comm	_errno,8,3                      ## @errno
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"r"

L_.str.1:                               ## @.str.1
	.asciz	"unable to open file: %s"

	.comm	_ERR_FATAL,4,2                  ## @ERR_FATAL
L_.str.2:                               ## @.str.2
	.asciz	"unable to read from file: %s"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_image_writeout_file            ; -- Begin function image_writeout_file
	.p2align	2
_image_writeout_file:                   ; @image_writeout_file
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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 w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	sub	sp, sp, #16
	mov	x20, x2
	mov	x19, 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, #-88]
Lloh3:
	adrp	x8, _FILE_BUF_LEN@GOTPAGE
Lloh4:
	ldr	x8, [x8, _FILE_BUF_LEN@GOTPAGEOFF]
Lloh5:
	ldr	w23, [x8]
	mov	x9, x23
Lloh6:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh7:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x8, sp
	add	x9, x23, #15
	and	x9, x9, #0x1fffffff0
	sub	x24, x8, x9
	mov	sp, x24
	ldr	x0, [x1, #8]
	cbz	x0, LBB0_4
; %bb.1:
	ldr	x8, [x19]
	cbz	x8, LBB0_4
; %bb.2:
Lloh8:
	adrp	x26, _errno@GOTPAGE
Lloh9:
	ldr	x26, [x26, _errno@GOTPAGEOFF]
	str	xzr, [x26]
Lloh10:
	adrp	x1, l_.str@PAGE
Lloh11:
	add	x1, x1, l_.str@PAGEOFF
	bl	_fopen
	ldr	x8, [x26]
	cbz	x8, LBB0_7
; %bb.3:
	ldr	x1, [x19, #8]
Lloh12:
	adrp	x0, l_.str.1@PAGE
Lloh13:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_ERRS
Lloh14:
	adrp	x8, _ERR_FATAL@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ERR_FATAL@GOTPAGEOFF]
Lloh16:
	ldr	w25, [x8]
	b	LBB0_5
LBB0_4:
	mov	w25, #0
LBB0_5:
	ldur	x8, [x29, #-88]
Lloh17:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh18:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh19:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_15
; %bb.6:
	mov	x0, x25
	sub	sp, x29, #80
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_7:
	mov	x22, x0
	ldr	x27, [x19]
	cbz	x27, LBB0_11
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	cmp	x27, x23
	csel	x23, x27, x23, lo
	str	xzr, [x26]
	mov	x0, x24
	mov	x1, x23
	mov	w2, #1
	mov	x3, x22
	bl	_fread
	ldr	x8, [x26]
	cbnz	x8, LBB0_12
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	mov	x0, x21
	mov	x1, x24
	mov	x2, x23
	mov	x3, x20
	bl	_write_out_data
	cbnz	w0, LBB0_13
; %bb.10:                               ;   in Loop: Header=BB0_8 Depth=1
	subs	x27, x27, x23
	b.ne	LBB0_8
LBB0_11:
	mov	w25, #0
	b	LBB0_14
LBB0_12:
	ldr	x1, [x19, #8]
Lloh20:
	adrp	x0, l_.str.2@PAGE
Lloh21:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_ERRS
Lloh22:
	adrp	x8, _ERR_FATAL@GOTPAGE
Lloh23:
	ldr	x8, [x8, _ERR_FATAL@GOTPAGEOFF]
Lloh24:
	ldr	w25, [x8]
	b	LBB0_14
LBB0_13:
	mov	x25, x0
LBB0_14:
	mov	x0, x22
	bl	_fclose
	b	LBB0_5
LBB0_15:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_FILE_BUF_LEN,4,2               ; @FILE_BUF_LEN
	.comm	_errno,8,3                      ; @errno
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"r"

l_.str.1:                               ; @.str.1
	.asciz	"unable to open file: %s"

	.comm	_ERR_FATAL,4,2                  ; @ERR_FATAL
l_.str.2:                               ; @.str.2
	.asciz	"unable to read from file: %s"

.subsections_via_symbols
