	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_lightgun_refresh               ## -- Begin function lightgun_refresh
	.p2align	4, 0x90
_lightgun_refresh:                      ## @lightgun_refresh
	.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
	movq	_lightgun@GOTPCREL(%rip), %rax
	cmpl	%edi, (%rax)
	jne	LBB0_14
## %bb.1:
	movq	_input@GOTPCREL(%rip), %r14
	movq	(%r14), %rax
	movslq	%edi, %rcx
	movq	(%rax,%rcx,8), %rax
	movl	8(%r14), %ebx
	addl	4(%rax), %ebx
	movq	_v_counter@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %ebx
	jne	LBB0_12
## %bb.2:
	movq	_bitmap@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %ebx
	jge	LBB0_12
## %bb.3:
	movq	_io_reg@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	testb	$-128, 20(%rcx)
	je	LBB0_14
## %bb.4:
	movl	(%rax), %r15d
	movq	16(%r14), %rax
	movq	8(%rax), %rax
	movq	_SYSTEM_MENACER@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_9
## %bb.5:
	movq	_system_hw@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_SYSTEM_MCD@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_7
## %bb.6:
	imull	$304, %r15d, %eax               ## imm = 0x130
	jmp	LBB0_8
LBB0_12:
	movq	_hvc_latch@GOTPCREL(%rip), %rax
	xorl	%ecx, %ecx
	testb	$2, 2(%rax)
	jne	LBB0_13
	jmp	LBB0_14
LBB0_7:
	imull	$289, %r15d, %eax               ## imm = 0x121
LBB0_8:
	cltq
	imulq	$1717986919, %rax, %r15         ## imm = 0x66666667
	movq	%r15, %rax
	shrq	$63, %rax
	sarq	$39, %r15
	addl	%eax, %r15d
LBB0_9:
	movq	_reg@GOTPCREL(%rip), %r12
	movq	(%r12), %rax
	testb	$8, 44(%rax)
	je	LBB0_11
## %bb.10:
	movl	$2, %edi
	callq	_m68k_update_irq
	movq	(%r12), %rax
LBB0_11:
	xorl	%ecx, %ecx
	testb	$2, (%rax)
	sete	%cl
	shll	$8, %ebx
	shll	$16, %ecx
	addl	$65536, %ecx                    ## imm = 0x10000
	orl	%ebx, %ecx
	movq	_hvc_latch@GOTPCREL(%rip), %rdx
	movl	%ecx, (%rdx)
	testb	$1, 48(%rax)
	movl	$171, %eax
	movl	$210, %esi
	cmovel	%eax, %esi
	movq	_hc_320@GOTPCREL(%rip), %rax
	cmoveq	_hc_256@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movl	%r15d, %eax
	shrl	$31, %eax
	addl	%r15d, %eax
	sarl	%eax
	addl	24(%r14), %eax
	cltd
	idivl	%esi
	movslq	%edx, %rax
	orl	(%rdi,%rax,4), %ecx
LBB0_13:
	movq	_hvc_latch@GOTPCREL(%rip), %rax
	movl	%ecx, (%rax)
LBB0_14:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_lightgun,4,2                   ## @lightgun
	.comm	_input,32,3                     ## @input
	.comm	_v_counter,4,2                  ## @v_counter
	.comm	_bitmap,4,2                     ## @bitmap
	.comm	_io_reg,8,3                     ## @io_reg
	.comm	_SYSTEM_MENACER,8,3             ## @SYSTEM_MENACER
	.comm	_system_hw,8,3                  ## @system_hw
	.comm	_SYSTEM_MCD,8,3                 ## @SYSTEM_MCD
	.comm	_reg,8,3                        ## @reg
	.comm	_hvc_latch,4,2                  ## @hvc_latch
	.comm	_hc_320,8,3                     ## @hc_320
	.comm	_hc_256,8,3                     ## @hc_256
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_lightgun_refresh               ; -- Begin function lightgun_refresh
	.p2align	2
_lightgun_refresh:                      ; @lightgun_refresh
	.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
Lloh0:
	adrp	x8, _lightgun@GOTPAGE
Lloh1:
	ldr	x8, [x8, _lightgun@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w0
	b.ne	LBB0_14
; %bb.1:
Lloh3:
	adrp	x19, _input@GOTPAGE
Lloh4:
	ldr	x19, [x19, _input@GOTPAGEOFF]
	ldr	x8, [x19]
	ldr	x8, [x8, w0, sxtw #3]
	ldr	w9, [x8, #4]
	ldr	w10, [x19, #8]
Lloh5:
	adrp	x11, _v_counter@GOTPAGE
Lloh6:
	ldr	x11, [x11, _v_counter@GOTPAGEOFF]
Lloh7:
	ldr	w11, [x11]
Lloh8:
	adrp	x12, _bitmap@GOTPAGE
Lloh9:
	ldr	x12, [x12, _bitmap@GOTPAGEOFF]
Lloh10:
	ldr	w12, [x12]
	add	w20, w10, w9
	cmp	w20, w11
	ccmp	w20, w12, #0, eq
	b.lt	LBB0_4
; %bb.2:
Lloh11:
	adrp	x8, _hvc_latch@GOTPAGE
Lloh12:
	ldr	x8, [x8, _hvc_latch@GOTPAGEOFF]
	ldrb	w8, [x8, #2]
	tbz	w8, #1, LBB0_14
; %bb.3:
	mov	w8, #0
	b	LBB0_13
LBB0_4:
Lloh13:
	adrp	x9, _io_reg@GOTPAGE
Lloh14:
	ldr	x9, [x9, _io_reg@GOTPAGEOFF]
Lloh15:
	ldr	x9, [x9]
	ldrb	w9, [x9, #20]
	tbz	w9, #7, LBB0_14
; %bb.5:
	ldr	w21, [x8]
	ldr	x8, [x19, #16]
	ldr	x8, [x8, #8]
Lloh16:
	adrp	x9, _SYSTEM_MENACER@GOTPAGE
Lloh17:
	ldr	x9, [x9, _SYSTEM_MENACER@GOTPAGEOFF]
Lloh18:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_10
; %bb.6:
Lloh19:
	adrp	x8, _system_hw@GOTPAGE
Lloh20:
	ldr	x8, [x8, _system_hw@GOTPAGEOFF]
Lloh21:
	ldr	x8, [x8]
Lloh22:
	adrp	x9, _SYSTEM_MCD@GOTPAGE
Lloh23:
	ldr	x9, [x9, _SYSTEM_MCD@GOTPAGEOFF]
Lloh24:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_8
; %bb.7:
	mov	w8, #304
	b	LBB0_9
LBB0_8:
	mov	w8, #289
LBB0_9:
	mul	w8, w21, w8
	mov	w9, #26215
	movk	w9, #26214, lsl #16
	smull	x8, w8, w9
	lsr	x9, x8, #63
	asr	x8, x8, #39
	add	w21, w8, w9
LBB0_10:
Lloh25:
	adrp	x22, _reg@GOTPAGE
Lloh26:
	ldr	x22, [x22, _reg@GOTPAGEOFF]
	ldr	x8, [x22]
	ldrb	w9, [x8, #44]
	tbz	w9, #3, LBB0_12
; %bb.11:
	mov	w0, #2
	bl	_m68k_update_irq
	ldr	x8, [x22]
LBB0_12:
	ldr	w9, [x8]
	tst	w9, #0x2
	mov	w9, #65536
	mov	w10, #131072
	csel	w9, w10, w9, eq
	orr	w9, w9, w20, lsl #8
Lloh27:
	adrp	x10, _hvc_latch@GOTPAGE
Lloh28:
	ldr	x10, [x10, _hvc_latch@GOTPAGEOFF]
Lloh29:
	str	w9, [x10]
	ldr	w8, [x8, #48]
	tst	w8, #0x1
	mov	w8, #210
	mov	w10, #171
Lloh30:
	adrp	x11, _hc_256@GOTPAGE
Lloh31:
	ldr	x11, [x11, _hc_256@GOTPAGEOFF]
Lloh32:
	adrp	x12, _hc_320@GOTPAGE
Lloh33:
	ldr	x12, [x12, _hc_320@GOTPAGEOFF]
	csel	w8, w10, w8, eq
	csel	x10, x11, x12, eq
	ldr	x10, [x10]
	cmp	w21, #0
	cinc	w11, w21, lt
	ldr	w12, [x19, #24]
	add	w11, w12, w11, asr #1
	sdiv	w12, w11, w8
	msub	w8, w12, w8, w11
	ldr	w8, [x10, w8, sxtw #2]
	orr	w8, w8, w9
LBB0_13:
Lloh34:
	adrp	x9, _hvc_latch@GOTPAGE
Lloh35:
	ldr	x9, [x9, _hvc_latch@GOTPAGEOFF]
Lloh36:
	str	w8, [x9]
LBB0_14:
	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 AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh32, Lloh33
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpLdrGotStr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotStr	Lloh34, Lloh35, Lloh36
	.cfi_endproc
                                        ; -- End function
	.comm	_lightgun,4,2                   ; @lightgun
	.comm	_input,32,3                     ; @input
	.comm	_v_counter,4,2                  ; @v_counter
	.comm	_bitmap,4,2                     ; @bitmap
	.comm	_io_reg,8,3                     ; @io_reg
	.comm	_SYSTEM_MENACER,8,3             ; @SYSTEM_MENACER
	.comm	_system_hw,8,3                  ; @system_hw
	.comm	_SYSTEM_MCD,8,3                 ; @SYSTEM_MCD
	.comm	_reg,8,3                        ; @reg
	.comm	_hvc_latch,4,2                  ; @hvc_latch
	.comm	_hc_320,8,3                     ; @hc_320
	.comm	_hc_256,8,3                     ; @hc_256
.subsections_via_symbols
