	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function copyToOutputBuf
_copyToOutputBuf:                       ## @copyToOutputBuf
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	testq	%rdi, %rdi
	je	LBB0_9
## %bb.1:
	movq	%rdi, %rbx
	movl	4(%rdi), %esi
	testl	%esi, %esi
	je	LBB0_9
## %bb.2:
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_DBG
	movl	4(%rbx), %edi
	leaq	L_.str.2(%rip), %rsi
	callq	_fopen
	testq	%rax, %rax
	je	LBB0_10
## %bb.3:
	movq	%rax, %r14
	movq	%rax, %rdi
	callq	_rewind
	movq	_SEEK_END@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_fseek
	movq	%r14, %rdi
	callq	_ftell
	movl	%eax, %r12d
	movq	%r14, %rdi
	callq	_rewind
	testl	%r12d, %r12d
	jle	LBB0_11
## %bb.4:
	movq	_is_header@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	_header_sz@GOTPCREL(%rip), %rax
	movslq	(%rax), %r13
	movl	%r13d, %eax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movl	$0, %r15d
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	testq	%rcx, %rcx
	jne	LBB0_6
## %bb.5:
	movq	_footer_sz@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movl	%r12d, %r15d
LBB0_6:
	leaq	L_.str.5(%rip), %rdi
	movl	%r12d, %esi
	xorl	%eax, %eax
	callq	_DBG
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	leal	(%rax,%r12), %edi
	movl	%edi, (%rbx)
	callq	_malloc
	movq	%rax, 8(%rbx)
	testq	%rax, %rax
	je	LBB0_12
## %bb.7:
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	testq	%rcx, %rcx
	cmoveq	%rcx, %r13
	movl	%r15d, %ecx
	addq	%rcx, %rax
	movq	%rax, %rdi
	xorl	%esi, %esi
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_memset
	addq	8(%rbx), %r13
	movq	%r13, %rdi
	movl	$1, %esi
	movl	%r12d, %edx
	movq	%r14, %rcx
	callq	_fread
	cmpl	%r12d, %eax
	jne	LBB0_13
## %bb.8:
	leaq	L_.str.8(%rip), %rdi
	xorl	%eax, %eax
	callq	_DBG
	movq	%r14, %rdi
	callq	_fclose
	jmp	LBB0_17
LBB0_9:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_ERR
	jmp	LBB0_16
LBB0_10:
	movl	4(%rbx), %esi
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_ERR
	jmp	LBB0_16
LBB0_11:
	movl	4(%rbx), %esi
	leaq	L_.str.4(%rip), %rdi
	jmp	LBB0_14
LBB0_12:
	leaq	L_.str.6(%rip), %rdi
	xorl	%eax, %eax
	callq	_ERR
	jmp	LBB0_15
LBB0_13:
	movl	4(%rbx), %esi
	leaq	L_.str.7(%rip), %rdi
LBB0_14:
	xorl	%eax, %eax
	callq	_ERR
LBB0_15:
	movq	%r14, %rdi
	callq	_fclose
LBB0_16:
	movl	$-1, %r15d
LBB0_17:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Invalid pointer provided!\n"

L_.str.1:                               ## @.str.1
	.asciz	"Opening file: %s\n"

L_.str.2:                               ## @.str.2
	.asciz	"rb"

L_.str.3:                               ## @.str.3
	.asciz	"Error opening file: %s\n"

	.comm	_SEEK_END,4,2                   ## @SEEK_END
L_.str.4:                               ## @.str.4
	.asciz	"Error getting filesize: %s\n"

	.comm	_is_header,8,3                  ## @is_header
	.comm	_header_sz,4,2                  ## @header_sz
	.comm	_footer_sz,4,2                  ## @footer_sz
L_.str.5:                               ## @.str.5
	.asciz	"Filesize: %i\n"

L_.str.6:                               ## @.str.6
	.asciz	"Out of memory!\n"

L_.str.7:                               ## @.str.7
	.asciz	"Error reading file %s\n"

L_.str.8:                               ## @.str.8
	.asciz	"File: read successful\n"

	.no_dead_strip	_copyToOutputBuf
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function copyToOutputBuf
_copyToOutputBuf:                       ; @copyToOutputBuf
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.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
	cbz	x0, LBB0_7
; %bb.1:
	mov	x20, x0
	ldr	w8, [x0, #4]
	cbz	w8, LBB0_7
; %bb.2:
	str	x8, [sp]
Lloh0:
	adrp	x0, l_.str.1@PAGE
Lloh1:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DBG
	ldr	w0, [x20, #4]
Lloh2:
	adrp	x1, l_.str.2@PAGE
Lloh3:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_fopen
	cbz	x0, LBB0_9
; %bb.3:
	mov	x19, x0
	bl	_rewind
Lloh4:
	adrp	x8, _SEEK_END@GOTPAGE
Lloh5:
	ldr	x8, [x8, _SEEK_END@GOTPAGEOFF]
Lloh6:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x1, #0
	bl	_fseek
	mov	x0, x19
	bl	_ftell
	mov	x22, x0
	mov	x0, x19
	bl	_rewind
	cmp	w22, #0
	b.le	LBB0_10
; %bb.4:
Lloh7:
	adrp	x8, _is_header@GOTPAGE
Lloh8:
	ldr	x8, [x8, _is_header@GOTPAGEOFF]
Lloh9:
	ldr	x24, [x8]
Lloh10:
	adrp	x8, _header_sz@GOTPAGE
Lloh11:
	ldr	x8, [x8, _header_sz@GOTPAGEOFF]
Lloh12:
	ldrsw	x25, [x8]
Lloh13:
	adrp	x8, _footer_sz@GOTPAGE
Lloh14:
	ldr	x8, [x8, _footer_sz@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	cmp	x24, #0
	csel	w23, w8, w25, eq
	csel	w21, w22, wzr, eq
	str	x22, [sp]
Lloh16:
	adrp	x0, l_.str.5@PAGE
Lloh17:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_DBG
	add	w0, w23, w22
	str	w0, [x20]
	bl	_malloc
	str	x0, [x20, #8]
	cbz	x0, LBB0_11
; %bb.5:
	cmp	x24, #0
	csel	x24, xzr, x25, eq
	add	x0, x0, w21, uxtw
	mov	w1, #0
	mov	x2, x23
	bl	_memset
	ldr	x8, [x20, #8]
	add	x0, x8, x24
	mov	w1, #1
	mov	x2, x22
	mov	x3, x19
	bl	_fread
	cmp	w0, w22
	b.ne	LBB0_12
; %bb.6:
Lloh18:
	adrp	x0, l_.str.8@PAGE
Lloh19:
	add	x0, x0, l_.str.8@PAGEOFF
	bl	_DBG
	mov	x0, x19
	bl	_fclose
	b	LBB0_15
LBB0_7:
Lloh20:
	adrp	x0, l_.str@PAGE
Lloh21:
	add	x0, x0, l_.str@PAGEOFF
LBB0_8:
	bl	_ERR
	b	LBB0_14
LBB0_9:
	ldr	w8, [x20, #4]
	str	x8, [sp]
Lloh22:
	adrp	x0, l_.str.3@PAGE
Lloh23:
	add	x0, x0, l_.str.3@PAGEOFF
	b	LBB0_8
LBB0_10:
	ldr	w8, [x20, #4]
	str	x8, [sp]
Lloh24:
	adrp	x0, l_.str.4@PAGE
Lloh25:
	add	x0, x0, l_.str.4@PAGEOFF
	b	LBB0_13
LBB0_11:
Lloh26:
	adrp	x0, l_.str.6@PAGE
Lloh27:
	add	x0, x0, l_.str.6@PAGEOFF
	b	LBB0_13
LBB0_12:
	ldr	w8, [x20, #4]
	str	x8, [sp]
Lloh28:
	adrp	x0, l_.str.7@PAGE
Lloh29:
	add	x0, x0, l_.str.7@PAGEOFF
LBB0_13:
	bl	_ERR
	mov	x0, x19
	bl	_fclose
LBB0_14:
	mov	w21, #-1
LBB0_15:
	mov	x0, x21
	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
	add	sp, sp, #96
	ret
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Invalid pointer provided!\n"

l_.str.1:                               ; @.str.1
	.asciz	"Opening file: %s\n"

l_.str.2:                               ; @.str.2
	.asciz	"rb"

l_.str.3:                               ; @.str.3
	.asciz	"Error opening file: %s\n"

	.comm	_SEEK_END,4,2                   ; @SEEK_END
l_.str.4:                               ; @.str.4
	.asciz	"Error getting filesize: %s\n"

	.comm	_is_header,8,3                  ; @is_header
	.comm	_header_sz,4,2                  ; @header_sz
	.comm	_footer_sz,4,2                  ; @footer_sz
l_.str.5:                               ; @.str.5
	.asciz	"Filesize: %i\n"

l_.str.6:                               ; @.str.6
	.asciz	"Out of memory!\n"

l_.str.7:                               ; @.str.7
	.asciz	"Error reading file %s\n"

l_.str.8:                               ; @.str.8
	.asciz	"File: read successful\n"

	.no_dead_strip	_copyToOutputBuf
.subsections_via_symbols
