	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cobra_read_packet
_cobra_read_packet:                     ## @cobra_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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, -112(%rbp)                ## 8-byte Spill
	movq	%rdi, %r13
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_COBRA_MAX_STROBE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	callq	_gameport_time
	movl	%eax, -84(%rbp)                 ## 4-byte Spill
	movl	(%rbx), %r12d
	movq	$0, -64(%rbp)
	movq	$0, -72(%rbp)
	callq	_local_irq_save
	movq	%r13, %rdi
	callq	_gameport_read
	movl	%eax, %r14d
	movl	-72(%rbp), %eax
	movq	%rax, -104(%rbp)                ## 8-byte Spill
	movl	-68(%rbp), %eax
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	movl	-64(%rbp), %eax
	movl	%eax, -80(%rbp)                 ## 4-byte Spill
	movl	-60(%rbp), %eax
	movl	%eax, -76(%rbp)                 ## 4-byte Spill
	movl	%r12d, %r15d
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	decl	%r15d
	decl	%r12d
	movq	%r13, %rdi
	callq	_gameport_read
	movl	%eax, %ebx
	xorb	%r14b, %bl
	je	LBB0_15
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	_COBRA_LENGTH@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movzbl	%bl, %esi
	movl	%esi, %ecx
	andl	$48, %ecx
	je	LBB0_8
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$48, %ecx
	je	LBB0_7
## %bb.4:                               ##   in Loop: Header=BB0_1 Depth=1
	cmpl	%edx, -104(%rbp)                ## 4-byte Folded Reload
	jge	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_1 Depth=1
	testl	%r15d, %r15d
	jle	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_1 Depth=1
	shrl	$5, %esi
	andl	$1, %esi
	movq	-104(%rbp), %rcx                ## 8-byte Reload
	leal	1(%rcx), %edi
                                        ## kill: def $cl killed $cl killed $rcx
	shll	%cl, %esi
	orl	%esi, -80(%rbp)                 ## 4-byte Folded Spill
	movl	%edi, %ecx
	movq	%rcx, -104(%rbp)                ## 8-byte Spill
	movl	-84(%rbp), %r15d                ## 4-byte Reload
	movl	%eax, %r14d
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_1 Depth=1
	xorl	%r15d, %r15d
LBB0_8:                                 ##   in Loop: Header=BB0_1 Depth=1
	cmpb	$4, %bl
	jb	LBB0_15
## %bb.9:                               ##   in Loop: Header=BB0_1 Depth=1
	shrb	$2, %bl
	movzbl	%bl, %esi
	movl	%esi, %ecx
	andl	$48, %ecx
	je	LBB0_15
## %bb.10:                              ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$48, %ecx
	jne	LBB0_11
LBB0_13:                                ##   in Loop: Header=BB0_1 Depth=1
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_1 Depth=1
	testl	%r15d, %r15d
	jg	LBB0_1
LBB0_16:                                ##   in Loop: Header=BB0_1 Depth=1
	testl	%r12d, %r12d
	jg	LBB0_1
	jmp	LBB0_17
LBB0_11:                                ##   in Loop: Header=BB0_1 Depth=1
	cmpl	%edx, -96(%rbp)                 ## 4-byte Folded Reload
	jge	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_1 Depth=1
	testl	%r12d, %r12d
	jle	LBB0_13
## %bb.14:                              ##   in Loop: Header=BB0_1 Depth=1
	shrl	$5, %esi
	movq	-96(%rbp), %rcx                 ## 8-byte Reload
	leal	1(%rcx), %edx
                                        ## kill: def $cl killed $cl killed $rcx
	shll	%cl, %esi
	orl	%esi, -76(%rbp)                 ## 4-byte Folded Spill
	movl	%edx, %ecx
	movq	%rcx, -96(%rbp)                 ## 8-byte Spill
	movl	-84(%rbp), %r12d                ## 4-byte Reload
	movl	%eax, %r14d
	testl	%r15d, %r15d
	jle	LBB0_16
	jmp	LBB0_1
LBB0_17:
	movl	%r15d, -56(%rbp)
	movl	%r12d, -52(%rbp)
	movq	-104(%rbp), %rax                ## 8-byte Reload
	movl	%eax, -72(%rbp)
	movl	-80(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, -64(%rbp)
	movq	-96(%rbp), %rax                 ## 8-byte Reload
	movl	%eax, -68(%rbp)
	movl	-76(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, -60(%rbp)
	callq	_local_irq_restore
	movl	-72(%rbp), %edi
	movq	_COBRA_LENGTH@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%eax, %eax
	cmpl	%esi, %edi
	jne	LBB0_26
## %bb.18:
	testl	%edi, %edi
	jle	LBB0_19
## %bb.20:
	movl	-64(%rbp), %edx
	movl	%edx, %ecx
	andl	$1090785407, %ecx               ## imm = 0x4104107F
	movl	$1, %eax
	cmpl	$1090785344, %ecx               ## imm = 0x41041040
	je	LBB0_25
## %bb.21:
	leal	-1(%rdi), %ecx
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_22:                                ## =>This Inner Loop Header: Depth=1
	movl	%esi, %eax
	movl	%edx, %esi
	andl	$1, %edx
	shll	%cl, %edx
	sarl	%esi
	orl	%esi, %edx
	leal	1(%rax), %esi
	cmpl	%eax, %ecx
	je	LBB0_24
## %bb.23:                              ##   in Loop: Header=BB0_22 Depth=1
	movl	%edx, %eax
	andl	$1090785407, %eax               ## imm = 0x4104107F
	cmpl	$1090785344, %eax               ## imm = 0x41041040
	jne	LBB0_22
LBB0_24:
	xorl	%eax, %eax
	cmpl	%edi, %esi
	setl	%al
	jmp	LBB0_25
LBB0_19:
	xorl	%eax, %eax
	movl	-64(%rbp), %edx
LBB0_25:
	movl	%edx, %ecx
	shrl	$7, %ecx
	andl	$31, %ecx
	movl	%edx, %esi
	shrl	$8, %esi
	andl	$992, %esi                      ## imm = 0x3E0
	orl	%ecx, %esi
	movl	%edx, %ecx
	shrl	$9, %ecx
	andl	$31744, %ecx                    ## imm = 0x7C00
	orl	%esi, %ecx
	movl	%edx, %esi
	shrl	$10, %esi
	andl	$1015808, %esi                  ## imm = 0xF8000
	orl	%ecx, %esi
	sarl	$11, %edx
	andl	$32505856, %edx                 ## imm = 0x1F00000
	orl	%esi, %edx
	movq	-112(%rbp), %rcx                ## 8-byte Reload
	movl	%edx, (%rcx)
	movq	_COBRA_LENGTH@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
LBB0_26:
	cmpl	%esi, -68(%rbp)
	jne	LBB0_35
## %bb.27:
	testl	%esi, %esi
	jle	LBB0_28
## %bb.29:
	movl	-60(%rbp), %edx
	movl	%edx, %ecx
	andl	$1090785407, %ecx               ## imm = 0x4104107F
	movl	$2, %r8d
	cmpl	$1090785344, %ecx               ## imm = 0x41041040
	je	LBB0_34
## %bb.30:
	leal	-1(%rsi), %ecx
	xorl	%r8d, %r8d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_32:                                ## =>This Inner Loop Header: Depth=1
	movl	%edx, %edi
	andl	$1, %edx
	shll	%cl, %edx
	sarl	%edi
	orl	%edi, %edx
	cmpl	%ebx, %ecx
	je	LBB0_34
## %bb.31:                              ##   in Loop: Header=BB0_32 Depth=1
	movl	%edx, %edi
	andl	$1090785407, %edi               ## imm = 0x4104107F
	incl	%ebx
	cmpl	$1090785344, %edi               ## imm = 0x41041040
	jne	LBB0_32
## %bb.33:
	xorl	%r8d, %r8d
	cmpl	%esi, %ebx
	setl	%r8b
	addl	%r8d, %r8d
	jmp	LBB0_34
LBB0_28:
	xorl	%r8d, %r8d
	movl	-60(%rbp), %edx
LBB0_34:
	orl	%r8d, %eax
	movl	%edx, %ecx
	shrl	$7, %ecx
	andl	$31, %ecx
	movl	%edx, %esi
	shrl	$8, %esi
	andl	$992, %esi                      ## imm = 0x3E0
	orl	%ecx, %esi
	movl	%edx, %ecx
	shrl	$9, %ecx
	andl	$31744, %ecx                    ## imm = 0x7C00
	orl	%esi, %ecx
	movl	%edx, %esi
	shrl	$10, %esi
	andl	$1015808, %esi                  ## imm = 0xF8000
	orl	%ecx, %esi
	sarl	$11, %edx
	andl	$32505856, %edx                 ## imm = 0x1F00000
	orl	%esi, %edx
	movq	-112(%rbp), %rcx                ## 8-byte Reload
	movl	%edx, 4(%rcx)
LBB0_35:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_37
## %bb.36:
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_37:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_COBRA_MAX_STROBE,4,2           ## @COBRA_MAX_STROBE
	.comm	_COBRA_LENGTH,4,2               ## @COBRA_LENGTH
	.no_dead_strip	_cobra_read_packet
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cobra_read_packet
_cobra_read_packet:                     ; @cobra_read_packet
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #40]
Lloh3:
	adrp	x21, _COBRA_MAX_STROBE@GOTPAGE
Lloh4:
	ldr	x21, [x21, _COBRA_MAX_STROBE@GOTPAGEOFF]
	ldr	w1, [x21]
	bl	_gameport_time
	mov	x19, x0
	ldr	w28, [x21]
	stp	xzr, xzr, [sp, #16]
	bl	_local_irq_save
	mov	x0, x20
	bl	_gameport_read
	mov	x22, x0
	ldp	w26, w27, [sp, #16]
	ldp	w24, w25, [sp, #24]
	mov	x21, x28
Lloh5:
	adrp	x23, _COBRA_LENGTH@GOTPAGE
Lloh6:
	ldr	x23, [x23, _COBRA_LENGTH@GOTPAGEOFF]
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	sub	w21, w21, #1
	sub	w28, w28, #1
	mov	x0, x20
	bl	_gameport_read
	eor	w9, w0, w22
	cbz	w9, LBB0_12
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	w8, [x23]
	ands	w10, w9, #0x30
	b.eq	LBB0_6
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	cmp	w10, #48
	b.eq	LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_1 Depth=1
	cmp	w26, w8
	ccmp	w21, #1, #8, lt
	b.ge	LBB0_11
LBB0_5:                                 ;   in Loop: Header=BB0_1 Depth=1
	mov	w21, #0
LBB0_6:                                 ;   in Loop: Header=BB0_1 Depth=1
	cmp	w9, #4
	b.lo	LBB0_12
LBB0_7:                                 ;   in Loop: Header=BB0_1 Depth=1
	lsr	w9, w9, #2
	ands	w10, w9, #0x30
	b.eq	LBB0_12
; %bb.8:                                ;   in Loop: Header=BB0_1 Depth=1
	cmp	w10, #48
	b.eq	LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_1 Depth=1
	cmp	w27, w8
	ccmp	w28, #0, #4, lt
	b.gt	LBB0_14
LBB0_10:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	w28, #0
	cmp	w21, #0
	b.le	LBB0_13
	b	LBB0_1
LBB0_11:                                ;   in Loop: Header=BB0_1 Depth=1
	ubfx	w10, w9, #5, #1
	lsl	w10, w10, w26
	add	w26, w26, #1
	orr	w24, w24, w10
	mov	x21, x19
	mov	x22, x0
	cmp	w9, #4
	b.hs	LBB0_7
LBB0_12:                                ;   in Loop: Header=BB0_1 Depth=1
	cmp	w21, #0
	b.gt	LBB0_1
LBB0_13:                                ;   in Loop: Header=BB0_1 Depth=1
	cmp	w28, #0
	b.gt	LBB0_1
	b	LBB0_15
LBB0_14:                                ;   in Loop: Header=BB0_1 Depth=1
	lsr	w8, w9, #5
	lsl	w8, w8, w27
	add	w27, w27, #1
	orr	w25, w25, w8
	mov	x28, x19
	mov	x22, x0
	cmp	w21, #0
	b.le	LBB0_13
	b	LBB0_1
LBB0_15:
	stp	w21, w28, [sp, #32]
	stp	w26, w27, [sp, #16]
	stp	w24, w25, [sp, #24]
	bl	_local_irq_restore
	ldr	w10, [sp, #16]
	ldr	w9, [x23]
	cmp	w10, w9
	b.ne	LBB0_19
; %bb.16:
	cmp	w10, #0
	b.le	LBB0_20
; %bb.17:
	mov	w9, #4160
	movk	w9, #16644, lsl #16
	ldr	w8, [sp, #24]
	orr	w11, w9, #0x3f
	and	w11, w8, w11
	cmp	w11, w9
	b.ne	LBB0_21
; %bb.18:
	mov	w0, #1
	b	LBB0_25
LBB0_19:
	mov	w0, #0
	b	LBB0_26
LBB0_20:
	mov	w0, #0
	ldr	w8, [sp, #24]
	b	LBB0_25
LBB0_21:
	mov	w12, #0
	sub	w11, w10, #1
LBB0_22:                                ; =>This Inner Loop Header: Depth=1
	and	w13, w8, #0x1
	lsl	w13, w13, w11
	orr	w8, w13, w8, asr #1
	add	w13, w12, #1
	cmp	w11, w12
	b.eq	LBB0_24
; %bb.23:                               ;   in Loop: Header=BB0_22 Depth=1
	add	w12, w9, #63
	and	w14, w8, w12
	mov	x12, x13
	cmp	w14, w9
	b.ne	LBB0_22
LBB0_24:
	cmp	w13, w10
	cset	w0, lt
LBB0_25:
	lsr	w9, w8, #8
	and	w9, w9, #0x3e0
	bfxil	w9, w8, #7, #5
	lsr	w10, w8, #9
	and	w10, w10, #0x7c00
	orr	w9, w9, w10
	lsr	w10, w8, #10
	and	w10, w10, #0xf8000
	orr	w9, w9, w10
	asr	w8, w8, #11
	and	w8, w8, #0x1f00000
	orr	w8, w9, w8
	ldr	x9, [sp, #8]                    ; 8-byte Folded Reload
	str	w8, [x9]
	ldr	w9, [x23]
LBB0_26:
	ldr	w8, [sp, #20]
	cmp	w8, w9
	b.ne	LBB0_37
; %bb.27:
	cmp	w9, #0
	b.le	LBB0_30
; %bb.28:
	mov	w10, #4160
	movk	w10, #16644, lsl #16
	ldr	w8, [sp, #28]
	orr	w11, w10, #0x3f
	and	w11, w8, w11
	cmp	w11, w10
	b.ne	LBB0_31
; %bb.29:
	mov	w9, #2
	b	LBB0_36
LBB0_30:
	mov	w9, #0
	ldr	w8, [sp, #28]
	b	LBB0_36
LBB0_31:
	mov	w11, #0
	sub	w12, w9, #1
LBB0_32:                                ; =>This Inner Loop Header: Depth=1
	and	w13, w8, #0x1
	lsl	w13, w13, w12
	orr	w8, w13, w8, asr #1
	cmp	w12, w11
	b.eq	LBB0_35
; %bb.33:                               ;   in Loop: Header=BB0_32 Depth=1
	add	w13, w10, #63
	and	w13, w8, w13
	add	w11, w11, #1
	cmp	w13, w10
	b.ne	LBB0_32
; %bb.34:
	cmp	w11, w9
	cset	w9, lt
	lsl	w9, w9, #1
	b	LBB0_36
LBB0_35:
	mov	w9, #0
LBB0_36:
	orr	w0, w9, w0
	lsr	w9, w8, #8
	and	w9, w9, #0x3e0
	bfxil	w9, w8, #7, #5
	lsr	w10, w8, #9
	and	w10, w10, #0x7c00
	orr	w9, w9, w10
	lsr	w10, w8, #10
	and	w10, w10, #0xf8000
	orr	w9, w9, w10
	asr	w8, w8, #11
	and	w8, w8, #0x1f00000
	orr	w8, w9, w8
	ldr	x9, [sp, #8]                    ; 8-byte Folded Reload
	str	w8, [x9, #4]
LBB0_37:
	ldr	x8, [sp, #40]
Lloh7:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh8:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_39
; %bb.38:
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_39:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_COBRA_MAX_STROBE,4,2           ; @COBRA_MAX_STROBE
	.comm	_COBRA_LENGTH,4,2               ; @COBRA_LENGTH
	.no_dead_strip	_cobra_read_packet
.subsections_via_symbols
