	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function apply_cheats
_apply_cheats:                          ## @apply_cheats
	.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
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_maxRAMcheats@GOTPCREL(%rip), %r8
	movq	$0, (%r8)
	movq	_maxROMcheats@GOTPCREL(%rip), %r13
	movq	$0, (%r13)
	movq	_maxcheats@GOTPCREL(%rip), %r10
	cmpl	$0, (%r10)
	jle	LBB0_12
## %bb.1:
	xorl	%esi, %esi
	movq	_cheatlist@GOTPCREL(%rip), %r9
	movq	_cart@GOTPCREL(%rip), %r15
	movq	_SYSTEM_MD@GOTPCREL(%rip), %r11
	movq	_cheatIndexes@GOTPCREL(%rip), %r12
	xorl	%ebx, %ebx
	jmp	LBB0_2
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	8(%r15), %rax
	andl	$16777214, %r14d                ## imm = 0xFFFFFE
	movq	(%rax,%r14), %rdi
	movq	%rdi, 8(%rcx,%rsi)
	movq	16(%rcx,%rsi), %rcx
	movq	%rcx, (%rax,%r14)
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_2 Depth=1
	incq	%rbx
	movslq	(%r10), %rax
	addq	$40, %rsi
	cmpq	%rax, %rbx
	jge	LBB0_12
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r9), %rcx
	cmpq	$0, 32(%rcx,%rsi)
	je	LBB0_11
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%rcx,%rsi), %r14d
	cmpl	(%r15), %r14d
	jge	LBB0_9
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_SYSTEM_PBC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_system_hw@GOTPCREL(%rip), %rdx
	andl	(%rdx), %eax
	cmpl	(%r11), %eax
	je	LBB0_5
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r13), %rax
	incq	%rax
	movq	%rax, (%r13)
	movq	(%r12), %rdi
	movq	_MAX_CHEATS@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	subq	%rax, %rdx
	movl	%ebx, (%rdi,%rdx,4)
	movq	_z80_readmap@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movl	(%rcx,%rsi), %eax
	movl	%eax, %edi
	sarl	$10, %edi
	movslq	%edi, %rdi
	movq	(%rdx,%rdi,8), %rdi
	andl	$1023, %eax                     ## imm = 0x3FF
	movq	8(%rcx,%rsi), %rdx
	cmpq	(%rdi,%rax,8), %rdx
	jne	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	leaq	(%rdi,%rax,8), %rax
	movq	16(%rcx,%rsi), %rdx
	movq	%rdx, (%rax)
	movq	%rax, 24(%rcx,%rsi)
	jmp	LBB0_11
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_2 Depth=1
	cmpl	$16711680, %r14d                ## imm = 0xFF0000
	jl	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r12), %rax
	movq	(%r8), %rcx
	leaq	1(%rcx), %rdx
	movq	%rdx, (%r8)
	movl	%ebx, (%rax,%rcx,4)
	jmp	LBB0_11
LBB0_8:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	$0, 24(%rcx,%rsi)
	jmp	LBB0_11
LBB0_12:
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_maxRAMcheats,8,3               ## @maxRAMcheats
	.comm	_maxROMcheats,8,3               ## @maxROMcheats
	.comm	_maxcheats,4,2                  ## @maxcheats
	.comm	_cheatlist,8,3                  ## @cheatlist
	.comm	_cart,16,3                      ## @cart
	.comm	_system_hw,4,2                  ## @system_hw
	.comm	_SYSTEM_PBC,4,2                 ## @SYSTEM_PBC
	.comm	_SYSTEM_MD,4,2                  ## @SYSTEM_MD
	.comm	_cheatIndexes,8,3               ## @cheatIndexes
	.comm	_MAX_CHEATS,8,3                 ## @MAX_CHEATS
	.comm	_z80_readmap,8,3                ## @z80_readmap
	.no_dead_strip	_apply_cheats
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function apply_cheats
_apply_cheats:                          ; @apply_cheats
	.cfi_startproc
; %bb.0:
Lloh0:
	adrp	x8, _maxRAMcheats@GOTPAGE
Lloh1:
	ldr	x8, [x8, _maxRAMcheats@GOTPAGEOFF]
Lloh2:
	adrp	x9, _maxROMcheats@GOTPAGE
Lloh3:
	ldr	x9, [x9, _maxROMcheats@GOTPAGEOFF]
	str	xzr, [x8]
	str	xzr, [x9]
Lloh4:
	adrp	x10, _maxcheats@GOTPAGE
Lloh5:
	ldr	x10, [x10, _maxcheats@GOTPAGEOFF]
	ldr	w11, [x10]
	cmp	w11, #1
	b.lt	LBB0_12
; %bb.1:
	mov	x11, #0
	mov	x12, #0
Lloh6:
	adrp	x13, _cheatlist@GOTPAGE
Lloh7:
	ldr	x13, [x13, _cheatlist@GOTPAGEOFF]
Lloh8:
	adrp	x14, _cart@GOTPAGE
Lloh9:
	ldr	x14, [x14, _cart@GOTPAGEOFF]
Lloh10:
	adrp	x15, _system_hw@GOTPAGE
Lloh11:
	ldr	x15, [x15, _system_hw@GOTPAGEOFF]
Lloh12:
	adrp	x16, _SYSTEM_PBC@GOTPAGE
Lloh13:
	ldr	x16, [x16, _SYSTEM_PBC@GOTPAGEOFF]
Lloh14:
	adrp	x17, _SYSTEM_MD@GOTPAGE
Lloh15:
	ldr	x17, [x17, _SYSTEM_MD@GOTPAGEOFF]
Lloh16:
	adrp	x0, _cheatIndexes@GOTPAGE
Lloh17:
	ldr	x0, [x0, _cheatIndexes@GOTPAGEOFF]
Lloh18:
	adrp	x1, _MAX_CHEATS@GOTPAGE
Lloh19:
	ldr	x1, [x1, _MAX_CHEATS@GOTPAGEOFF]
Lloh20:
	adrp	x2, _z80_readmap@GOTPAGE
Lloh21:
	ldr	x2, [x2, _z80_readmap@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	x5, [x14, #8]
	and	x4, x4, #0xfffffe
	ldr	x6, [x5, x4]
	add	x3, x3, x11
	str	x6, [x3, #8]
	ldr	x3, [x3, #16]
	str	x3, [x5, x4]
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x12, x12, #1
	ldrsw	x3, [x10]
	add	x11, x11, #40
	cmp	x12, x3
	b.ge	LBB0_12
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x3, [x13]
	add	x4, x3, x11
	ldr	x4, [x4, #32]
	cbz	x4, LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w4, [x3, x11]
	ldr	w5, [x14]
	cmp	w4, w5
	b.ge	LBB0_9
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w5, [x15]
	ldr	w6, [x16]
	and	w5, w6, w5
	ldr	w6, [x17]
	cmp	w5, w6
	b.eq	LBB0_2
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x4, [x9]
	add	x4, x4, #1
	ldr	x5, [x0]
	ldr	x6, [x1]
	sub	x6, x6, x4
	str	w12, [x5, x6, lsl #2]
	ldr	x5, [x2]
	add	x3, x3, x11
	ldr	w6, [x3]
	asr	w7, w6, #10
	ldr	x5, [x5, w7, sxtw #3]
	str	x4, [x9]
	and	x4, x6, #0x3ff
	add	x4, x5, x4, lsl #3
	ldr	x5, [x3, #8]
	ldr	x6, [x4]
	cmp	x5, x6
	b.ne	LBB0_11
; %bb.8:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x5, [x3, #16]
	str	x5, [x4]
	str	x4, [x3, #24]
	b	LBB0_3
LBB0_9:                                 ;   in Loop: Header=BB0_4 Depth=1
	cmp	w4, #4080, lsl #12              ; =16711680
	b.lt	LBB0_3
; %bb.10:                               ;   in Loop: Header=BB0_4 Depth=1
	ldr	x3, [x0]
	ldr	x4, [x8]
	add	x5, x4, #1
	str	x5, [x8]
	str	w12, [x3, x4, lsl #2]
	b	LBB0_3
LBB0_11:                                ;   in Loop: Header=BB0_4 Depth=1
	str	xzr, [x3, #24]
	b	LBB0_3
LBB0_12:
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_maxRAMcheats,8,3               ; @maxRAMcheats
	.comm	_maxROMcheats,8,3               ; @maxROMcheats
	.comm	_maxcheats,4,2                  ; @maxcheats
	.comm	_cheatlist,8,3                  ; @cheatlist
	.comm	_cart,16,3                      ; @cart
	.comm	_system_hw,4,2                  ; @system_hw
	.comm	_SYSTEM_PBC,4,2                 ; @SYSTEM_PBC
	.comm	_SYSTEM_MD,4,2                  ; @SYSTEM_MD
	.comm	_cheatIndexes,8,3               ; @cheatIndexes
	.comm	_MAX_CHEATS,8,3                 ; @MAX_CHEATS
	.comm	_z80_readmap,8,3                ; @z80_readmap
	.no_dead_strip	_apply_cheats
.subsections_via_symbols
