	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_IMG_TAPE_ReadToMemory          ## -- Begin function IMG_TAPE_ReadToMemory
	.p2align	4, 0x90
_IMG_TAPE_ReadToMemory:                 ## @IMG_TAPE_ReadToMemory
	.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
	movl	%edx, %r14d
	movl	%esi, %r15d
	movq	%rdi, %rbx
	cmpq	$0, 16(%rdi)
	je	LBB0_2
## %bb.1:
	movq	%rbx, %rdi
	callq	_CassetteFlush
	movq	_FALSE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 16(%rbx)
LBB0_2:
	movl	(%rbx), %r12d
	movl	4(%rbx), %eax
	subl	%eax, %r12d
	jne	LBB0_5
## %bb.3:
	leaq	-44(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_ReadNextRecord
	testl	%eax, %eax
	je	LBB0_7
## %bb.4:
	movq	$0, (%rbx)
	xorl	%eax, %eax
LBB0_5:
	movslq	%eax, %rdi
	shlq	$3, %rdi
	addq	8(%rbx), %rdi
	leal	1(%r14), %r13d
	cmpl	%r14d, %r12d
	movl	%r14d, %edx
	cmovll	%r12d, %edx
	cmovlel	%r12d, %r13d
	movl	%r15d, %esi
	callq	_MEMORY_CopyToMem
	addl	%r13d, 4(%rbx)
	xorl	%eax, %eax
	cmpl	%r14d, %r12d
	jle	LBB0_8
## %bb.6:
	movq	8(%rbx), %rdi
	movslq	%r14d, %rax
	movq	(%rdi,%rax,8), %rbx
	movl	%r14d, %esi
	callq	_SIO_ChkSum
	movq	%rax, %rcx
	xorl	%eax, %eax
	cmpq	%rcx, %rbx
	sete	%al
	jmp	LBB0_8
LBB0_7:
	movl	$-1, %eax
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_FALSE,8,3                      ## @FALSE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_IMG_TAPE_ReadToMemory          ; -- Begin function IMG_TAPE_ReadToMemory
	.p2align	2
_IMG_TAPE_ReadToMemory:                 ; @IMG_TAPE_ReadToMemory
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x19, x2
	mov	x21, x1
	mov	x20, x0
	ldr	x8, [x0, #16]
	cbz	x8, LBB0_2
; %bb.1:
	mov	x0, x20
	bl	_CassetteFlush
Lloh0:
	adrp	x8, _FALSE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [x20, #16]
LBB0_2:
	ldp	w9, w8, [x20]
	subs	w22, w9, w8
	b.ne	LBB0_5
; %bb.3:
	add	x1, sp, #12
	mov	x0, x20
	bl	_ReadNextRecord
	cbz	w0, LBB0_8
; %bb.4:
	mov	w8, #0
	str	xzr, [x20]
LBB0_5:
	ldr	x9, [x20, #8]
	add	x0, x9, w8, sxtw #3
	cmp	w22, w19
	csel	w2, w22, w19, lt
	mov	x1, x21
	bl	_MEMORY_CopyToMem
	cmp	w22, w19
	csinc	w8, w22, w19, le
	ldr	w9, [x20, #4]
	add	w8, w9, w8
	str	w8, [x20, #4]
	b.le	LBB0_7
; %bb.6:
	ldr	x0, [x20, #8]
	ldr	x20, [x0, w19, sxtw #3]
	mov	x1, x19
	bl	_SIO_ChkSum
	cmp	x20, x0
	cset	w0, eq
	b	LBB0_9
LBB0_7:
	mov	w0, #0
	b	LBB0_9
LBB0_8:
	mov	w0, #-1
LBB0_9:
	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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_FALSE,8,3                      ; @FALSE
.subsections_via_symbols
