	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function adi_read_packet
_adi_read_packet:                       ## @adi_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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%rdi), %rbx
	movq	8(%rdi), %r15
	movl	$-1, (%r15)
	movq	_ADI_MAX_START@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movq	%rbx, %rdi
	callq	_gameport_time
	movl	%eax, %r12d
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movl	$-1, 16(%r15)
	movl	(%r14), %esi
	movq	%rbx, %rdi
	callq	_gameport_time
	movl	%eax, %r15d
	callq	_local_irq_save
	movq	%rbx, %rdi
	callq	_gameport_trigger
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	callq	_gameport_read
	movl	%eax, %r13d
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	xorl	%r14d, %r14d
	jmp	LBB0_1
	.p2align	4, 0x90
LBB0_20:                                ##   in Loop: Header=BB0_1 Depth=1
	xorl	%r15d, %r15d
	testl	%r12d, %r12d
	jg	LBB0_1
LBB0_21:                                ##   in Loop: Header=BB0_1 Depth=1
	testl	%r15d, %r15d
	jle	LBB0_22
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movl	%r13d, %ebx
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_gameport_read
	movl	%eax, %r13d
	xorb	%al, %bl
	movl	%ebx, %eax
	andb	$48, %al
	je	LBB0_5
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	testl	%r14d, %r14d
	je	LBB0_5
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	cmpb	$48, %al
	je	LBB0_10
## %bb.6:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movslq	(%rax), %rax
	movq	_ADI_MAX_LENGTH@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jge	LBB0_10
## %bb.7:                               ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$2, %r12d
	jl	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movq	8(%rsi), %rcx
	leaq	1(%rax), %rdx
	movl	%edx, (%rsi)
	movb	%bl, 1(%rcx,%rax)
	movq	_ADI_MAX_STROBE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_gameport_time
	movl	%eax, %r12d
	jmp	LBB0_11
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_1 Depth=1
	decl	%r12d
	testb	$48, %r13b
	movl	$1, %eax
	cmovel	%eax, %r14d
	jmp	LBB0_11
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_1 Depth=1
	xorl	%r12d, %r12d
LBB0_11:                                ##   in Loop: Header=BB0_1 Depth=1
	shrb	$2, %bl
	movl	%ebx, %eax
	andb	$48, %al
	je	LBB0_15
## %bb.12:                              ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_15
## %bb.13:                              ##   in Loop: Header=BB0_1 Depth=1
	cmpb	$48, %al
	je	LBB0_20
## %bb.16:                              ##   in Loop: Header=BB0_1 Depth=1
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movslq	16(%rax), %rax
	movq	_ADI_MAX_LENGTH@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jge	LBB0_20
## %bb.17:                              ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$2, %r15d
	jl	LBB0_20
## %bb.18:                              ##   in Loop: Header=BB0_1 Depth=1
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movq	24(%rsi), %rcx
	leaq	1(%rax), %rdx
	movl	%edx, 16(%rsi)
	movb	%bl, 1(%rcx,%rax)
	movq	_ADI_MAX_STROBE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_gameport_time
	movl	%eax, %r15d
	testl	%r12d, %r12d
	jle	LBB0_21
	jmp	LBB0_1
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_1 Depth=1
	decl	%r15d
	cmpb	$64, %r13b
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	movl	$1, %ecx
	cmovbl	%ecx, %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	testl	%r12d, %r12d
	jle	LBB0_21
	jmp	LBB0_1
LBB0_22:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_local_irq_restore              ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_ADI_MAX_START,4,2              ## @ADI_MAX_START
	.comm	_ADI_MAX_LENGTH,4,2             ## @ADI_MAX_LENGTH
	.comm	_ADI_MAX_STROBE,4,2             ## @ADI_MAX_STROBE
	.no_dead_strip	_adi_read_packet
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function adi_read_packet
_adi_read_packet:                       ; @adi_read_packet
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	ldp	x19, x23, [x0]
	mov	w21, #-1
	str	w21, [x23]
Lloh0:
	adrp	x22, _ADI_MAX_START@GOTPAGE
Lloh1:
	ldr	x22, [x22, _ADI_MAX_START@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x19
	bl	_gameport_time
	mov	x20, x0
	str	w21, [x23, #16]
	ldr	w1, [x22]
	mov	x0, x19
	bl	_gameport_time
	mov	x21, x0
	bl	_local_irq_save
	mov	x0, x19
	bl	_gameport_trigger
	mov	x0, x19
	bl	_gameport_read
	mov	x22, x0
	mov	w24, #0
	mov	w25, #0
Lloh2:
	adrp	x26, _ADI_MAX_LENGTH@GOTPAGE
Lloh3:
	ldr	x26, [x26, _ADI_MAX_LENGTH@GOTPAGEOFF]
Lloh4:
	adrp	x27, _ADI_MAX_STROBE@GOTPAGE
Lloh5:
	ldr	x27, [x27, _ADI_MAX_STROBE@GOTPAGEOFF]
	b	LBB0_3
LBB0_1:                                 ;   in Loop: Header=BB0_3 Depth=1
	sub	w21, w21, #1
	cmp	w22, #64
	csinc	w24, w24, wzr, hs
	cmp	w20, #1
	b.ge	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	cmp	w21, #0
	b.le	LBB0_15
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x28, x22
	mov	x0, x19
	bl	_gameport_read
	mov	x22, x0
	eor	w28, w0, w28
	and	w8, w28, #0x30
	cmp	w8, #0
	ccmp	w25, #0, #4, ne
	b.ne	LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	sub	w20, w20, #1
	tst	w22, #0x30
	csinc	w25, w25, wzr, ne
	b	LBB0_9
LBB0_5:                                 ;   in Loop: Header=BB0_3 Depth=1
	cmp	w8, #48
	b.eq	LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	ldrsw	x8, [x23]
	ldr	w9, [x26]
	cmp	w8, w9
	ccmp	w20, #2, #8, lt
	b.ge	LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_3 Depth=1
	mov	w20, #0
	b	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	x9, [x23, #8]
	add	x8, x8, #1
	str	w8, [x23]
	strb	w28, [x9, x8]
	ldr	w1, [x27]
	mov	x0, x19
	bl	_gameport_time
	mov	x20, x0
LBB0_9:                                 ;   in Loop: Header=BB0_3 Depth=1
	lsr	w8, w28, #2
	ands	w9, w8, #0x30
	b.eq	LBB0_1
; %bb.10:                               ;   in Loop: Header=BB0_3 Depth=1
	cbz	w24, LBB0_1
; %bb.11:                               ;   in Loop: Header=BB0_3 Depth=1
	cmp	w9, #48
	b.eq	LBB0_13
; %bb.12:                               ;   in Loop: Header=BB0_3 Depth=1
	ldrsw	x9, [x23, #16]
	ldr	w10, [x26]
	cmp	w9, w10
	ccmp	w21, #1, #4, lt
	b.gt	LBB0_14
LBB0_13:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	w21, #0
	cmp	w20, #1
	b.lt	LBB0_2
	b	LBB0_3
LBB0_14:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x10, [x23, #24]
	add	x9, x9, #1
	str	w9, [x23, #16]
	strb	w8, [x10, x9]
	ldr	w1, [x27]
	mov	x0, x19
	bl	_gameport_time
	mov	x21, x0
	cmp	w20, #1
	b.lt	LBB0_2
	b	LBB0_3
LBB0_15:
	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
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	b	_local_irq_restore
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_ADI_MAX_START,4,2              ; @ADI_MAX_START
	.comm	_ADI_MAX_LENGTH,4,2             ; @ADI_MAX_LENGTH
	.comm	_ADI_MAX_STROBE,4,2             ; @ADI_MAX_STROBE
	.no_dead_strip	_adi_read_packet
.subsections_via_symbols
