	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function scsp_slot_keyon
_scsp_slot_keyon:                       ## @scsp_slot_keyon
	.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	(%rdi), %rax
	movq	_SCSP_ENV_RELEASE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_7
## %bb.1:
	movq	%rdi, %rbx
	movq	_scsp@GOTPCREL(%rip), %r15
	movq	%rdi, %rax
	subq	8(%r15), %rax
	shrq	$5, %rax
	imull	$-1431655765, %eax, %r14d       ## imm = 0xAAAAAAAB
	movq	_M68K@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	xorl	%eax, %eax
	callq	*(%rcx)
	movq	8(%rbx), %r10
	movl	88(%rbx), %r8d
	movl	16(%rbx), %r9d
	movq	_SCSP_FREQ_LB@GOTPCREL(%rip), %r12
	movb	(%r12), %cl
	sarl	%cl, %r9d
	leaq	L_.str(%rip), %rdi
	movl	%r14d, %esi
	movl	%eax, %edx
	movq	%r10, %rcx
	callq	_SCSPLOG
	cmpq	$0, 80(%rbx)
	movq	(%r15), %rcx
	movq	8(%rbx), %rax
	je	LBB0_3
## %bb.2:
	leaq	(%rcx,%rax,4), %rcx
	movq	%rcx, 72(%rbx)
	movl	16(%rbx), %edx
	movl	(%r12), %ecx
	jmp	LBB0_4
LBB0_3:
	movabsq	$4611686018427387902, %rdx      ## imm = 0x3FFFFFFFFFFFFFFE
	andq	%rax, %rdx
	leaq	(%rcx,%rdx,4), %rcx
	movq	%rcx, 64(%rbx)
	movl	16(%rbx), %edx
	movl	(%r12), %ecx
	decl	%ecx
LBB0_4:
	sarl	%cl, %edx
	movslq	%edx, %rsi
	addq	%rax, %rsi
	movq	_SCSP_RAM_MASK@GOTPCREL(%rip), %rdx
	movslq	(%rdx), %rdx
	cmpq	%rdx, %rsi
	jbe	LBB0_6
## %bb.5:
	subq	%rax, %rdx
                                        ## kill: def $cl killed $cl killed $ecx
	shlq	%cl, %rdx
	movl	%edx, 16(%rbx)
LBB0_6:
	movq	$0, 56(%rbx)
	movq	_SCSP_ENV_AS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 48(%rbx)
	movq	$0, 40(%rbx)
	leaq	28(%rbx), %rax
	movq	%rax, 32(%rbx)
	movq	_SCSP_ENV_ATTACK@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%rbx)
	movq	_SCSP_ENV_AE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%rbx)
	movq	_scsp_attack_next@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 20(%rbx)
LBB0_7:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SCSP_ENV_RELEASE,8,3           ## @SCSP_ENV_RELEASE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"key on slot %d. 68K PC = %08X slot->sa = %08X slot->lsa = %08X slot->lea = %08X\n"

	.comm	_scsp,16,3                      ## @scsp
	.comm	_M68K,8,3                       ## @M68K
	.comm	_SCSP_FREQ_LB,4,2               ## @SCSP_FREQ_LB
	.comm	_SCSP_RAM_MASK,4,2              ## @SCSP_RAM_MASK
	.comm	_SCSP_ENV_AS,4,2                ## @SCSP_ENV_AS
	.comm	_SCSP_ENV_ATTACK,8,3            ## @SCSP_ENV_ATTACK
	.comm	_SCSP_ENV_AE,4,2                ## @SCSP_ENV_AE
	.comm	_scsp_attack_next,4,2           ## @scsp_attack_next
	.no_dead_strip	_scsp_slot_keyon
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function scsp_slot_keyon
_scsp_slot_keyon:                       ; @scsp_slot_keyon
	.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
	ldr	x8, [x0]
Lloh0:
	adrp	x9, _SCSP_ENV_RELEASE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _SCSP_ENV_RELEASE@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.1:
	mov	x19, x0
Lloh3:
	adrp	x22, _scsp@GOTPAGE
Lloh4:
	ldr	x22, [x22, _scsp@GOTPAGEOFF]
	ldr	x8, [x22, #8]
	sub	x8, x0, x8
	lsr	x8, x8, #5
	mov	w9, #43691
	movk	w9, #43690, lsl #16
	mul	w20, w8, w9
Lloh5:
	adrp	x8, _M68K@GOTPAGE
Lloh6:
	ldr	x8, [x8, _M68K@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	ldr	x8, [x8]
	blr	x8
	mov	x2, x0
	ldr	x3, [x19, #8]
	ldr	w4, [x19, #88]
	ldr	w8, [x19, #16]
Lloh8:
	adrp	x21, _SCSP_FREQ_LB@GOTPAGE
Lloh9:
	ldr	x21, [x21, _SCSP_FREQ_LB@GOTPAGEOFF]
	ldr	w9, [x21]
	asr	w5, w8, w9
Lloh10:
	adrp	x0, l_.str@PAGE
Lloh11:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	bl	_SCSPLOG
	ldr	x10, [x19, #80]
	ldr	x9, [x22]
	ldr	x8, [x19, #8]
	cbz	x10, LBB0_3
; %bb.2:
	add	x9, x9, x8, lsl #2
	str	x9, [x19, #72]
	ldr	w10, [x19, #16]
	ldr	w9, [x21]
	b	LBB0_4
LBB0_3:
	and	x10, x8, #0x3ffffffffffffffe
	add	x9, x9, x10, lsl #2
	str	x9, [x19, #64]
	ldr	w10, [x19, #16]
	ldr	w9, [x21]
	sub	w9, w9, #1
LBB0_4:
	asr	w10, w10, w9
	add	x11, x8, w10, sxtw
Lloh12:
	adrp	x10, _SCSP_RAM_MASK@GOTPAGE
Lloh13:
	ldr	x10, [x10, _SCSP_RAM_MASK@GOTPAGEOFF]
Lloh14:
	ldrsw	x10, [x10]
	cmp	x11, x10
	b.ls	LBB0_6
; %bb.5:
                                        ; kill: def $w9 killed $w9 killed $x9 def $x9
	sub	x8, x10, x8
	lsl	x8, x8, x9
	str	w8, [x19, #16]
LBB0_6:
Lloh15:
	adrp	x8, _SCSP_ENV_AS@GOTPAGE
Lloh16:
	ldr	x8, [x8, _SCSP_ENV_AS@GOTPAGEOFF]
	str	xzr, [x19, #56]
Lloh17:
	ldr	w8, [x8]
	str	w8, [x19, #48]
	add	x8, x19, #28
	stp	x8, xzr, [x19, #32]
Lloh18:
	adrp	x8, _SCSP_ENV_ATTACK@GOTPAGE
Lloh19:
	ldr	x8, [x8, _SCSP_ENV_ATTACK@GOTPAGEOFF]
Lloh20:
	ldr	x8, [x8]
	str	x8, [x19]
Lloh21:
	adrp	x8, _SCSP_ENV_AE@GOTPAGE
Lloh22:
	ldr	x8, [x8, _SCSP_ENV_AE@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
Lloh24:
	adrp	x9, _scsp_attack_next@GOTPAGE
Lloh25:
	ldr	x9, [x9, _scsp_attack_next@GOTPAGEOFF]
Lloh26:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #20]
LBB0_7:
	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 AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_SCSP_ENV_RELEASE,8,3           ; @SCSP_ENV_RELEASE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"key on slot %d. 68K PC = %08X slot->sa = %08X slot->lsa = %08X slot->lea = %08X\n"

	.comm	_scsp,16,3                      ; @scsp
	.comm	_M68K,8,3                       ; @M68K
	.comm	_SCSP_FREQ_LB,4,2               ; @SCSP_FREQ_LB
	.comm	_SCSP_RAM_MASK,4,2              ; @SCSP_RAM_MASK
	.comm	_SCSP_ENV_AS,4,2                ; @SCSP_ENV_AS
	.comm	_SCSP_ENV_ATTACK,8,3            ; @SCSP_ENV_ATTACK
	.comm	_SCSP_ENV_AE,4,2                ; @SCSP_ENV_AE
	.comm	_scsp_attack_next,4,2           ; @scsp_attack_next
	.no_dead_strip	_scsp_slot_keyon
.subsections_via_symbols
