	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_CASSETTE_ReadToMemory          ## -- Begin function CASSETTE_ReadToMemory
	.p2align	4, 0x90
_CASSETTE_ReadToMemory:                 ## @CASSETTE_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movl	%edi, %r15d
	movl	$1, %edi
	callq	_CASSETTE_TapeMotor
	movq	_cassette_readable@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_1
## %bb.2:
	movq	_event_time_left@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	imulq	$-1836584673, %rax, %rcx        ## imm = 0x9287F11F
	shrq	$32, %rcx
	addl	%eax, %ecx
	movl	%ecx, %eax
	shrl	$31, %eax
	sarl	$10, %ecx
	addl	%eax, %ecx
	movslq	%ecx, %rax
	movq	_cassette_gapdelay@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rsi
	subq	%rax, %rsi
	movq	%rsi, (%rbx)
	movq	_cassette_file@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	callq	_IMG_TAPE_SkipToData
	movq	$0, (%rbx)
	testl	%eax, %eax
	je	LBB0_3
## %bb.4:
	movl	(%r12), %edi
	movl	%r15d, %esi
	movl	%r14d, %edx
	callq	_IMG_TAPE_ReadToMemory
	movl	%eax, %ebx
	cmpl	$128, %eax
	je	LBB0_8
## %bb.5:
	cmpl	$-1, %ebx
	jne	LBB0_7
## %bb.6:
	movq	_eof_of_tape@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	xorl	%eax, %eax
	callq	_UpdateFlags
LBB0_7:
	movq	_FALSE@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_8
LBB0_1:
	xorl	%ebx, %ebx
	jmp	LBB0_8
LBB0_3:
	movq	_eof_of_tape@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_UpdateFlags
LBB0_8:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_cassette_readable,4,2          ## @cassette_readable
	.comm	_event_time_left,4,2            ## @event_time_left
	.comm	_cassette_gapdelay,8,3          ## @cassette_gapdelay
	.comm	_cassette_file,4,2              ## @cassette_file
	.comm	_eof_of_tape,4,2                ## @eof_of_tape
	.comm	_FALSE,4,2                      ## @FALSE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_CASSETTE_ReadToMemory          ; -- Begin function CASSETTE_ReadToMemory
	.p2align	2
_CASSETTE_ReadToMemory:                 ; @CASSETTE_ReadToMemory
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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, x1
	mov	x20, x0
	mov	w0, #1
	bl	_CASSETTE_TapeMotor
Lloh0:
	adrp	x8, _cassette_readable@GOTPAGE
Lloh1:
	ldr	x8, [x8, _cassette_readable@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cbz	w8, LBB0_7
; %bb.1:
Lloh3:
	adrp	x8, _event_time_left@GOTPAGE
Lloh4:
	ldr	x8, [x8, _event_time_left@GOTPAGEOFF]
Lloh5:
	ldrsw	x8, [x8]
	mov	x9, #-3809
	movk	x9, #37511, lsl #16
	mul	x9, x8, x9
	lsr	x9, x9, #32
	add	w8, w9, w8
	asr	w9, w8, #10
	add	w8, w9, w8, lsr #31
Lloh6:
	adrp	x22, _cassette_gapdelay@GOTPAGE
Lloh7:
	ldr	x22, [x22, _cassette_gapdelay@GOTPAGEOFF]
	ldr	x9, [x22]
	sub	x1, x9, w8, sxtw
	str	x1, [x22]
Lloh8:
	adrp	x21, _cassette_file@GOTPAGE
Lloh9:
	ldr	x21, [x21, _cassette_file@GOTPAGEOFF]
	ldr	w0, [x21]
	bl	_IMG_TAPE_SkipToData
	str	xzr, [x22]
	cbz	w0, LBB0_6
; %bb.2:
	ldr	w0, [x21]
	mov	x1, x20
	mov	x2, x19
	bl	_IMG_TAPE_ReadToMemory
	cmp	w0, #128
	b.eq	LBB0_8
; %bb.3:
	cmn	w0, #1
	b.ne	LBB0_5
; %bb.4:
Lloh10:
	adrp	x8, _eof_of_tape@GOTPAGE
Lloh11:
	ldr	x8, [x8, _eof_of_tape@GOTPAGEOFF]
	mov	w9, #1
Lloh12:
	str	w9, [x8]
	bl	_UpdateFlags
LBB0_5:
Lloh13:
	adrp	x8, _FALSE@GOTPAGE
Lloh14:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x8]
	b	LBB0_8
LBB0_6:
Lloh16:
	adrp	x8, _eof_of_tape@GOTPAGE
Lloh17:
	ldr	x8, [x8, _eof_of_tape@GOTPAGEOFF]
	mov	w9, #1
Lloh18:
	str	w9, [x8]
	bl	_UpdateFlags
LBB0_7:
	mov	w0, #0
LBB0_8:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotStr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotStr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_cassette_readable,4,2          ; @cassette_readable
	.comm	_event_time_left,4,2            ; @event_time_left
	.comm	_cassette_gapdelay,8,3          ; @cassette_gapdelay
	.comm	_cassette_file,4,2              ; @cassette_file
	.comm	_eof_of_tape,4,2                ; @eof_of_tape
	.comm	_FALSE,4,2                      ; @FALSE
.subsections_via_symbols
