	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tmdc_read_packet
_tmdc_read_packet:                      ## @tmdc_read_packet
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r12
	movq	_TMDC_MAX_LENGTH@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	_TMDC_MAX_STROBE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_gameport_time
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	_TMDC_MAX_START@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	%r12, %rdi
	callq	_gameport_time
	movl	%eax, %r14d
	movl	(%rbx), %esi
	movq	%r12, %rdi
	callq	_gameport_time
	movl	%eax, %r13d
	callq	_local_irq_save
	movq	%r12, %rdi
	callq	_gameport_trigger
	movq	%r12, -88(%rbp)                 ## 8-byte Spill
	movq	%r12, %rdi
	callq	_gameport_read
	shrl	$4, %eax
	addq	-72(%rbp), %r15                 ## 8-byte Folded Reload
	movq	%r15, -80(%rbp)                 ## 8-byte Spill
	movl	$0, -52(%rbp)                   ## 4-byte Folded Spill
	movl	$0, -48(%rbp)                   ## 4-byte Folded Spill
	xorl	%ecx, %ecx
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	xorl	%r15d, %r15d
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movl	%eax, %r12d
	movq	-88(%rbp), %rdi                 ## 8-byte Reload
	callq	_gameport_read
	movl	%eax, %edx
	shrl	$4, %eax
	movzbl	%al, %esi
	movl	%esi, %edi
	notl	%edi
	movl	%edi, %ecx
	andl	%r12d, %ecx
	testb	$2, %cl
	je	LBB0_9
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	testl	%r14d, %r14d
	jle	LBB0_10
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	_TMDC_MAX_LENGTH@GOTPCREL(%rip), %rcx
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	cmpl	(%rcx), %ebx
	jge	LBB0_10
## %bb.4:                               ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$9, %r15d
	je	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_1 Depth=1
	testl	%r15d, %r15d
	jne	LBB0_8
## %bb.6:                               ##   in Loop: Header=BB0_1 Depth=1
	testb	$1, %dil
	movl	$0, %r14d
	cmovel	-44(%rbp), %r14d                ## 4-byte Folded Reload
	movslq	-48(%rbp), %rcx                 ## 4-byte Folded Reload
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movb	$0, (%rdi,%rcx)
	movl	$1, %r15d
	jmp	LBB0_10
LBB0_7:                                 ##   in Loop: Header=BB0_1 Depth=1
	xorl	%r15d, %r15d
	testb	$16, %dl
	movl	$0, %r14d
	cmovel	-44(%rbp), %r14d                ## 4-byte Folded Reload
	incl	-48(%rbp)                       ## 4-byte Folded Spill
	jmp	LBB0_10
LBB0_8:                                 ##   in Loop: Header=BB0_1 Depth=1
	andl	$1, %edi
	leal	1(%r15), %r8d
	decb	%r15b
	movl	%r15d, %ecx
	shll	%cl, %edi
	movslq	-48(%rbp), %rcx                 ## 4-byte Folded Reload
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	orb	%dil, (%rbx,%rcx)
	movl	%r8d, %r15d
	movl	-44(%rbp), %r14d                ## 4-byte Reload
LBB0_9:                                 ##   in Loop: Header=BB0_1 Depth=1
	decl	%r14d
LBB0_10:                                ##   in Loop: Header=BB0_1 Depth=1
	shrl	$2, %esi
	shrl	$2, %r12d
	notl	%esi
	andl	%esi, %r12d
	testb	$2, %r12b
	je	LBB0_18
## %bb.11:                              ##   in Loop: Header=BB0_1 Depth=1
	testl	%r13d, %r13d
	jle	LBB0_19
## %bb.12:                              ##   in Loop: Header=BB0_1 Depth=1
	movq	_TMDC_MAX_LENGTH@GOTPCREL(%rip), %rcx
	movl	-52(%rbp), %edi                 ## 4-byte Reload
	cmpl	(%rcx), %edi
	jge	LBB0_19
## %bb.13:                              ##   in Loop: Header=BB0_1 Depth=1
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	testl	%ecx, %ecx
	je	LBB0_16
## %bb.14:                              ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$9, %ecx
	jne	LBB0_17
## %bb.15:                              ##   in Loop: Header=BB0_1 Depth=1
	xorl	%ecx, %ecx
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	testb	$64, %dl
	movl	$0, %r13d
	cmovel	-44(%rbp), %r13d                ## 4-byte Folded Reload
	incl	-52(%rbp)                       ## 4-byte Folded Spill
	jmp	LBB0_19
LBB0_16:                                ##   in Loop: Header=BB0_1 Depth=1
	testb	$1, %sil
	movl	$0, %r13d
	cmovel	-44(%rbp), %r13d                ## 4-byte Folded Reload
	movslq	-52(%rbp), %rcx                 ## 4-byte Folded Reload
	movq	-80(%rbp), %rdx                 ## 8-byte Reload
	movb	$0, (%rdx,%rcx)
	movl	$1, %ecx
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	jmp	LBB0_19
LBB0_17:                                ##   in Loop: Header=BB0_1 Depth=1
	andl	$1, %esi
	leal	1(%rcx), %edx
	decb	%cl
                                        ## kill: def $cl killed $cl killed $rcx
	shll	%cl, %esi
	movslq	-52(%rbp), %rcx                 ## 4-byte Folded Reload
	movq	-80(%rbp), %rdi                 ## 8-byte Reload
	orb	%sil, (%rdi,%rcx)
	movl	%edx, %ecx
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	movl	-44(%rbp), %r13d                ## 4-byte Reload
LBB0_18:                                ##   in Loop: Header=BB0_1 Depth=1
	decl	%r13d
LBB0_19:                                ##   in Loop: Header=BB0_1 Depth=1
	testl	%r14d, %r14d
	jg	LBB0_1
## %bb.20:                              ##   in Loop: Header=BB0_1 Depth=1
	testl	%r13d, %r13d
	jg	LBB0_1
## %bb.21:
	callq	_local_irq_restore
	movq	_TMDC_MAX_LENGTH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%ecx, %ecx
	cmpl	%eax, -48(%rbp)                 ## 4-byte Folded Reload
	sete	%cl
	xorl	%edx, %edx
	cmpl	%eax, -52(%rbp)                 ## 4-byte Folded Reload
	sete	%dl
	leal	(%rcx,%rdx,2), %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_TMDC_MAX_LENGTH,4,2            ## @TMDC_MAX_LENGTH
	.comm	_TMDC_MAX_STROBE,4,2            ## @TMDC_MAX_STROBE
	.comm	_TMDC_MAX_START,4,2             ## @TMDC_MAX_START
	.no_dead_strip	_tmdc_read_packet
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tmdc_read_packet
_tmdc_read_packet:                      ; @tmdc_read_packet
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	str	x1, [sp, #8]                    ; 8-byte Folded Spill
	mov	x20, x0
Lloh0:
	adrp	x24, _TMDC_MAX_LENGTH@GOTPAGE
Lloh1:
	ldr	x24, [x24, _TMDC_MAX_LENGTH@GOTPAGEOFF]
	ldr	w8, [x24]
	str	x8, [sp]                        ; 8-byte Folded Spill
Lloh2:
	adrp	x8, _TMDC_MAX_STROBE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _TMDC_MAX_STROBE@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	bl	_gameport_time
	mov	x21, x0
Lloh5:
	adrp	x19, _TMDC_MAX_START@GOTPAGE
Lloh6:
	ldr	x19, [x19, _TMDC_MAX_START@GOTPAGEOFF]
	ldr	w1, [x19]
	mov	x0, x20
	bl	_gameport_time
	mov	x22, x0
	ldr	w1, [x19]
	mov	x0, x20
	bl	_gameport_time
	mov	x23, x0
	bl	_local_irq_save
	mov	x0, x20
	bl	_gameport_trigger
	mov	x0, x20
	bl	_gameport_read
	mov	w25, #0
	mov	w26, #0
	mov	w28, #0
	mov	w19, #0
	lsr	w27, w0, #4
	ldp	x9, x8, [sp]                    ; 16-byte Folded Reload
	add	x8, x8, x9
	str	x8, [sp]                        ; 8-byte Folded Spill
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_gameport_read
	ubfx	w8, w0, #4, #8
	bic	w9, w27, w8
	tbz	w9, #1, LBB0_9
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	cmp	w22, #1
	b.lt	LBB0_10
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	w9, [x24]
	cmp	w26, w9
	b.ge	LBB0_10
; %bb.4:                                ;   in Loop: Header=BB0_1 Depth=1
	cmp	w19, #9
	b.eq	LBB0_7
; %bb.5:                                ;   in Loop: Header=BB0_1 Depth=1
	mvn	w9, w8
	cbnz	w19, LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_1 Depth=1
	tst	w9, #0x1
	csel	w22, w21, wzr, eq
	ldr	x9, [sp, #8]                    ; 8-byte Folded Reload
	strb	wzr, [x9, w26, sxtw]
	mov	w19, #1
	b	LBB0_10
LBB0_7:                                 ;   in Loop: Header=BB0_1 Depth=1
	mov	w19, #0
	tst	w0, #0x10
	csel	w22, w21, wzr, eq
	add	w26, w26, #1
	b	LBB0_10
LBB0_8:                                 ;   in Loop: Header=BB0_1 Depth=1
	and	w9, w9, #0x1
	sub	w10, w19, #1
	add	w19, w19, #1
	sxtw	x11, w26
	ldr	x13, [sp, #8]                   ; 8-byte Folded Reload
	ldrb	w12, [x13, x11]
	lsl	w9, w9, w10
	orr	w9, w12, w9
	strb	w9, [x13, x11]
	mov	x22, x21
LBB0_9:                                 ;   in Loop: Header=BB0_1 Depth=1
	sub	w22, w22, #1
LBB0_10:                                ;   in Loop: Header=BB0_1 Depth=1
	lsr	w9, w27, #2
	bic	w9, w9, w8, lsr #2
	tbz	w9, #1, LBB0_18
; %bb.11:                               ;   in Loop: Header=BB0_1 Depth=1
	cmp	w23, #1
	b.lt	LBB0_19
; %bb.12:                               ;   in Loop: Header=BB0_1 Depth=1
	ldr	w9, [x24]
	cmp	w25, w9
	b.ge	LBB0_19
; %bb.13:                               ;   in Loop: Header=BB0_1 Depth=1
	mov	w9, #-1
	eor	w8, w9, w8, lsr #2
	cbz	w28, LBB0_16
; %bb.14:                               ;   in Loop: Header=BB0_1 Depth=1
	cmp	w28, #9
	b.ne	LBB0_17
; %bb.15:                               ;   in Loop: Header=BB0_1 Depth=1
	mov	w28, #0
	tst	w0, #0x40
	csel	w23, w21, wzr, eq
	add	w25, w25, #1
	b	LBB0_19
LBB0_16:                                ;   in Loop: Header=BB0_1 Depth=1
	tst	w8, #0x1
	csel	w23, w21, wzr, eq
	ldr	x8, [sp]                        ; 8-byte Folded Reload
	strb	wzr, [x8, w25, sxtw]
	mov	w28, #1
	b	LBB0_19
LBB0_17:                                ;   in Loop: Header=BB0_1 Depth=1
	and	w8, w8, #0x1
	sub	w9, w28, #1
	add	w28, w28, #1
	sxtw	x10, w25
	ldr	x12, [sp]                       ; 8-byte Folded Reload
	ldrb	w11, [x12, x10]
	lsl	w8, w8, w9
	orr	w8, w11, w8
	strb	w8, [x12, x10]
	mov	x23, x21
LBB0_18:                                ;   in Loop: Header=BB0_1 Depth=1
	sub	w23, w23, #1
LBB0_19:                                ;   in Loop: Header=BB0_1 Depth=1
	lsr	w27, w0, #4
	cmp	w22, #0
	b.gt	LBB0_1
; %bb.20:                               ;   in Loop: Header=BB0_1 Depth=1
	cmp	w23, #0
	b.gt	LBB0_1
; %bb.21:
	bl	_local_irq_restore
	ldr	w8, [x24]
	cmp	w26, w8
	cset	w0, eq
	cmp	w25, w8
	cset	w8, eq
	bfi	w0, w8, #1, #1
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_TMDC_MAX_LENGTH,4,2            ; @TMDC_MAX_LENGTH
	.comm	_TMDC_MAX_STROBE,4,2            ; @TMDC_MAX_STROBE
	.comm	_TMDC_MAX_START,4,2             ; @TMDC_MAX_START
	.no_dead_strip	_tmdc_read_packet
.subsections_via_symbols
