	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_write_out_file                 ## -- Begin function write_out_file
	.p2align	4, 0x90
_write_out_file:                        ## @write_out_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, %r15
	movq	%rsi, %r12
	movq	%rdi, %r14
	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, %r13
	movq	_errno@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	movq	24(%r12), %rdi
	testq	%rdi, %rdi
	je	LBB0_9
## %bb.1:
	movq	_BLOCK_FLAG_HAVEHDR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12)
	je	LBB0_5
## %bb.2:
	movq	%r12, %rdi
	callq	_get_file_crc
	testq	%rax, %rax
	jne	LBB0_8
## %bb.3:
	movq	8(%r12), %rdi
	callq	_HOST_TO_LE32
	movq	%rax, -72(%rbp)
	movq	16(%r12), %rdi
	callq	_HOST_TO_LE32
	movq	%rax, -80(%rbp)
	leaq	-80(%rbp), %rsi
	movl	$16, %edx
	movq	%r14, %rdi
	movq	%r15, %rcx
	callq	_write_out_data
	movq	%rax, %rcx
	movl	$-1, %eax
	testq	%rcx, %rcx
	jne	LBB0_10
## %bb.4:
	movq	24(%r12), %rdi
LBB0_5:
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	leaq	L_.str(%rip), %rsi
	callq	_fopen
	movq	%rax, %r14
	movq	_errno@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_12
## %bb.6:
	movq	24(%r12), %rdx
	leaq	L_.str.1(%rip), %rsi
LBB0_7:
	movl	$1, %edi
	callq	_errmsg
LBB0_8:
	movl	$-1, %eax
	jmp	LBB0_10
LBB0_12:
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	16(%r12), %r15
	testq	%r15, %r15
	je	LBB0_16
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	cmpq	%rbx, %r15
	cmovbq	%r15, %rbx
	movq	$0, (%rax)
	movq	%r13, %rdi
	movq	%rbx, %rsi
	movl	$1, %edx
	movq	%r14, %rcx
	callq	_fread
	movq	_errno@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	jne	LBB0_18
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%r13, %rsi
	movq	%rbx, %rdx
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	callq	_write_out_data
	testq	%rax, %rax
	jne	LBB0_8
## %bb.15:                              ##   in Loop: Header=BB0_13 Depth=1
	subq	%rbx, %r15
	movq	_errno@GOTPCREL(%rip), %rax
	jne	LBB0_13
LBB0_16:
	movq	%r14, %rdi
	callq	_fclose
	xorl	%edi, %edi
	movl	$4, %esi
	callq	_ALIGN
	subq	16(%r12), %rax
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%rax, %rsi
	movl	$255, %edx
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	callq	_write_out_padding
	movq	%rax, %rcx
	movl	$-1, %eax
	testq	%rcx, %rcx
	jne	LBB0_10
## %bb.17:
	movq	24(%r12), %rdx
	leaq	L_.str.3(%rip), %rsi
	movl	$1, %edi
	callq	_dbgmsg
LBB0_9:
	xorl	%eax, %eax
LBB0_10:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_19
## %bb.11:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_18:
	movq	24(%r12), %rdx
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_7
LBB0_19:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_FILE_BUF_LEN,4,2               ## @FILE_BUF_LEN
	.comm	_errno,8,3                      ## @errno
	.comm	_BLOCK_FLAG_HAVEHDR,4,2         ## @BLOCK_FLAG_HAVEHDR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"r"

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

L_.str.2:                               ## @.str.2
	.asciz	"unable to read from file: %s"

L_.str.3:                               ## @.str.3
	.asciz	"file %s written out"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_write_out_file                 ; -- Begin function write_out_file
	.p2align	2
_write_out_file:                        ; @write_out_file
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [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 w25, -72
	.cfi_offset w26, -80
	sub	sp, sp, #32
	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, #-72]
Lloh3:
	adrp	x8, _FILE_BUF_LEN@GOTPAGE
Lloh4:
	ldr	x8, [x8, _FILE_BUF_LEN@GOTPAGEOFF]
Lloh5:
	ldr	w22, [x8]
	mov	x9, x22
Lloh6:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh7:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x8, sp
	add	x9, x22, #15
	and	x9, x9, #0x1fffffff0
	sub	x23, x8, x9
	mov	sp, x23
Lloh8:
	adrp	x25, _errno@GOTPAGE
Lloh9:
	ldr	x25, [x25, _errno@GOTPAGEOFF]
	str	xzr, [x25]
	ldr	x0, [x1, #24]
	cbz	x0, LBB0_9
; %bb.1:
	ldr	w8, [x19]
Lloh10:
	adrp	x9, _BLOCK_FLAG_HAVEHDR@GOTPAGE
Lloh11:
	ldr	x9, [x9, _BLOCK_FLAG_HAVEHDR@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_5
; %bb.2:
	mov	x0, x19
	bl	_get_file_crc
	cbnz	x0, LBB0_8
; %bb.3:
	ldr	x0, [x19, #8]
	bl	_HOST_TO_LE32
	stur	x0, [x29, #-80]
	ldr	x0, [x19, #16]
	bl	_HOST_TO_LE32
	stur	x0, [x29, #-88]
	sub	x1, x29, #88
	mov	x0, x21
	mov	w2, #16
	mov	x3, x20
	bl	_write_out_data
	cbnz	x0, LBB0_8
; %bb.4:
	ldr	x0, [x19, #24]
LBB0_5:
Lloh13:
	adrp	x1, l_.str@PAGE
Lloh14:
	add	x1, x1, l_.str@PAGEOFF
	bl	_fopen
	ldr	x8, [x25]
	cbz	x8, LBB0_11
; %bb.6:
	ldr	x2, [x19, #24]
Lloh15:
	adrp	x1, l_.str.1@PAGE
Lloh16:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_7:
	mov	w0, #1
	bl	_errmsg
LBB0_8:
	mov	w0, #-1
LBB0_9:
	ldur	x8, [x29, #-72]
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_18
; %bb.10:
	sub	sp, x29, #64
	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	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_11:
	mov	x24, x0
	ldr	x26, [x19, #16]
	cbz	x26, LBB0_15
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	cmp	x26, x22
	csel	x22, x26, x22, lo
	str	xzr, [x25]
	mov	x0, x23
	mov	x1, x22
	mov	w2, #1
	mov	x3, x24
	bl	_fread
	ldr	x8, [x25]
	cbnz	x8, LBB0_17
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	mov	x0, x21
	mov	x1, x23
	mov	x2, x22
	mov	x3, x20
	bl	_write_out_data
	cbnz	x0, LBB0_8
; %bb.14:                               ;   in Loop: Header=BB0_12 Depth=1
	subs	x26, x26, x22
	b.ne	LBB0_12
LBB0_15:
	mov	x0, x24
	bl	_fclose
	mov	x0, #0
	mov	w1, #4
	bl	_ALIGN
	ldr	x8, [x19, #16]
	sub	x1, x0, x8
	mov	x0, x21
	mov	w2, #255
	mov	x3, x20
	bl	_write_out_padding
	cbnz	x0, LBB0_8
; %bb.16:
	ldr	x2, [x19, #24]
Lloh20:
	adrp	x1, l_.str.3@PAGE
Lloh21:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w0, #1
	bl	_dbgmsg
	mov	w0, #0
	b	LBB0_9
LBB0_17:
	ldr	x2, [x19, #24]
Lloh22:
	adrp	x1, l_.str.2@PAGE
Lloh23:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_7
LBB0_18:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_FILE_BUF_LEN,4,2               ; @FILE_BUF_LEN
	.comm	_errno,8,3                      ; @errno
	.comm	_BLOCK_FLAG_HAVEHDR,4,2         ; @BLOCK_FLAG_HAVEHDR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"r"

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

l_.str.2:                               ; @.str.2
	.asciz	"unable to read from file: %s"

l_.str.3:                               ; @.str.3
	.asciz	"file %s written out"

.subsections_via_symbols
