	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function restore_binary_file
_restore_binary_file:                   ## @restore_binary_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r12
	movq	%rdi, %r14
	movq	_FOPEN_RB@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_fopen_with_cleanup
	movq	%rax, %r15
	movq	_SEEK_END@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_fseek
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	%r14, %rdi
	callq	_perror_with_name
                                        ## implicit-def: $r13
	jmp	LBB0_3
LBB0_2:
	movq	%r15, %rdi
	callq	_ftell
	movq	%rax, %r13
	movq	(%r12), %rdx
	cmpq	%rdx, %rax
	jg	LBB0_4
LBB0_3:
	leaq	L_.str(%rip), %rdi
	movq	%r14, %rsi
	callq	_error
	movq	(%r12), %rdx
LBB0_4:
	movq	8(%r12), %rax
	cmpq	%r13, %rax
	movq	%r13, %rbx
	cmovlq	%rax, %rbx
	testq	%rax, %rax
	cmoveq	%r13, %rbx
	xorl	%eax, %eax
	testq	%rdx, %rdx
	cmovgq	%rdx, %rax
	subq	%rax, %rbx
	addq	16(%r12), %rdx
	leaq	(%rbx,%rdx), %rcx
	leaq	L_.str.1(%rip), %rdi
	movq	%r14, %rsi
	callq	_printf_filtered
	movq	(%r12), %rsi
	movq	_SEEK_SET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_fseek
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	movq	%r14, %rdi
	callq	_perror_with_name
LBB0_6:
	movq	%rbx, %rdi
	callq	_xmalloc
	movq	%rax, %r13
	movq	_xfree@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r13, %rsi
	callq	_make_cleanup
	movq	%r13, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movq	%r15, %rcx
	callq	_fread
	cmpq	%rbx, %rax
	je	LBB0_8
## %bb.7:
	movq	%r14, %rdi
	callq	_perror_with_name
LBB0_8:
	movq	16(%r12), %rdi
	addq	(%r12), %rdi
	movq	%r13, %rsi
	movq	%rbx, %rdx
	callq	_target_write_memory
	testq	%rax, %rax
	je	LBB0_9
## %bb.10:
	movq	%rax, %rdi
	callq	_safe_strerror
	leaq	L_.str.2(%rip), %rdi
	movl	%eax, %esi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_warning                        ## TAILCALL
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_FOPEN_RB,4,2                   ## @FOPEN_RB
	.comm	_SEEK_END,4,2                   ## @SEEK_END
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Start address is greater than length of binary file %s."

L_.str.1:                               ## @.str.1
	.asciz	"Restoring binary file %s into memory (0x%lx to 0x%lx)\n"

	.comm	_SEEK_SET,4,2                   ## @SEEK_SET
	.comm	_xfree,4,2                      ## @xfree
L_.str.2:                               ## @.str.2
	.asciz	"restore: memory write failed (%s)."

	.no_dead_strip	_restore_binary_file
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function restore_binary_file
_restore_binary_file:                   ; @restore_binary_file
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x8, _FOPEN_RB@GOTPAGE
Lloh1:
	ldr	x8, [x8, _FOPEN_RB@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_fopen_with_cleanup
	mov	x21, x0
Lloh3:
	adrp	x8, _SEEK_END@GOTPAGE
Lloh4:
	ldr	x8, [x8, _SEEK_END@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	mov	x1, #0
	bl	_fseek
	cbz	x0, LBB0_2
; %bb.1:
	mov	x0, x20
	bl	_perror_with_name
                                        ; implicit-def: $x22
	b	LBB0_3
LBB0_2:
	mov	x0, x21
	bl	_ftell
	mov	x22, x0
	ldr	x8, [x19]
	cmp	x0, x8
	b.gt	LBB0_4
LBB0_3:
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	bl	_error
	ldr	x8, [x19]
LBB0_4:
	ldp	x9, x10, [x19, #8]
	cmp	x9, x22
	ccmp	x9, #0, #4, lt
	csel	x9, x9, x22, ne
	cmp	x8, #0
	csel	x11, x8, xzr, gt
	sub	x22, x9, x11
	add	x2, x10, x8
	add	x3, x22, x2
Lloh8:
	adrp	x0, l_.str.1@PAGE
Lloh9:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x20
	bl	_printf_filtered
	ldr	x1, [x19]
Lloh10:
	adrp	x8, _SEEK_SET@GOTPAGE
Lloh11:
	ldr	x8, [x8, _SEEK_SET@GOTPAGEOFF]
Lloh12:
	ldr	w2, [x8]
	mov	x0, x21
	bl	_fseek
	cbz	x0, LBB0_6
; %bb.5:
	mov	x0, x20
	bl	_perror_with_name
LBB0_6:
	mov	x0, x22
	bl	_xmalloc
	mov	x23, x0
Lloh13:
	adrp	x8, _xfree@GOTPAGE
Lloh14:
	ldr	x8, [x8, _xfree@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x8]
	mov	x1, x23
	bl	_make_cleanup
	mov	x0, x23
	mov	w1, #1
	mov	x2, x22
	mov	x3, x21
	bl	_fread
	cmp	x0, x22
	b.eq	LBB0_8
; %bb.7:
	mov	x0, x20
	bl	_perror_with_name
LBB0_8:
	ldr	x8, [x19]
	ldr	x9, [x19, #16]
	add	x0, x9, x8
	mov	x1, x23
	mov	x2, x22
	bl	_target_write_memory
	cbz	x0, LBB0_10
; %bb.9:
	bl	_safe_strerror
	mov	x1, x0
Lloh16:
	adrp	x0, l_.str.2@PAGE
Lloh17:
	add	x0, x0, l_.str.2@PAGEOFF
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_warning
LBB0_10:
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_FOPEN_RB,4,2                   ; @FOPEN_RB
	.comm	_SEEK_END,4,2                   ; @SEEK_END
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Start address is greater than length of binary file %s."

l_.str.1:                               ; @.str.1
	.asciz	"Restoring binary file %s into memory (0x%lx to 0x%lx)\n"

	.comm	_SEEK_SET,4,2                   ; @SEEK_SET
	.comm	_xfree,4,2                      ; @xfree
l_.str.2:                               ; @.str.2
	.asciz	"restore: memory write failed (%s)."

	.no_dead_strip	_restore_binary_file
.subsections_via_symbols
