	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function sms_cart_reset
LCPI0_0:
	.long	0                               ## 0x0
	.long	0                               ## 0x0
	.long	1                               ## 0x1
	.long	2                               ## 0x2
LCPI0_1:
	.long	0                               ## 0x0
	.long	0                               ## 0x0
	.long	1                               ## 0x1
	.long	0                               ## 0x0
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_sms_cart_reset
	.p2align	4, 0x90
_sms_cart_reset:                        ## @sms_cart_reset
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	_bios_rom@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rax
	movaps	LCPI0_0(%rip), %xmm0            ## xmm0 = [0,0,1,2]
	movups	%xmm0, (%rax)
	movq	_cart_rom@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	leal	-130(%rdx), %esi
	cmpl	$3, %esi
	jae	LBB0_1
## %bb.3:
	movq	8(%rcx), %rsi
	xorps	%xmm0, %xmm0
	jmp	LBB0_5
LBB0_1:
	addl	$-128, %edx
	cmpl	$1, %edx
	ja	LBB0_4
## %bb.2:
	movq	8(%rcx), %rsi
	jmp	LBB0_5
LBB0_4:
	movq	8(%rcx), %rsi
	movaps	LCPI0_1(%rip), %xmm0            ## xmm0 = [0,0,1,0]
LBB0_5:
	movups	%xmm0, (%rsi)
	movl	8(%rbx), %edx
	movq	_cart@GOTPCREL(%rip), %r14
	movq	(%r14), %rdi
	cmpl	$2, %edx
	jl	LBB0_7
## %bb.6:
	addq	$4194304, %rdi                  ## imm = 0x400000
	movq	_slot@GOTPCREL(%rip), %rcx
	movq	%rdi, 16(%rcx)
	movq	%rax, (%rcx)
	movl	12(%rbx), %eax
	movl	%eax, 8(%rcx)
	movl	%edx, 12(%rcx)
	movl	$224, %eax
	jmp	LBB0_10
LBB0_7:
	movq	_slot@GOTPCREL(%rip), %rax
	movq	%rdi, 16(%rax)
	movq	%rsi, (%rax)
	movl	(%rcx), %esi
	movl	16(%rcx), %ecx
	movl	%esi, 8(%rax)
	movl	%ecx, 12(%rax)
	movq	_system_hw@GOTPCREL(%rip), %rax
	movq	_SYSTEM_SMS@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	je	LBB0_9
## %bb.8:
	movq	_work_ram@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	$168, (%rax)
	movl	8(%rbx), %edx
LBB0_9:
	testl	%edx, %edx
	movl	$168, %ecx
	movl	$224, %eax
	cmovel	%ecx, %eax
LBB0_10:
	movq	_io_reg@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	%eax, 56(%rcx)
	xorl	%eax, %eax
	callq	_mapper_reset
	cmpl	$1, 8(%rbx)
	jne	LBB0_12
## %bb.11:
	movl	$4194304, %eax                  ## imm = 0x400000
	addq	(%r14), %rax
	movq	_z80_readmap@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	%rax, (%rcx)
LBB0_12:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_bios_rom,16,3                  ## @bios_rom
	.comm	_cart_rom,24,3                  ## @cart_rom
	.comm	_cart,8,3                       ## @cart
	.comm	_slot,24,3                      ## @slot
	.comm	_system_hw,4,2                  ## @system_hw
	.comm	_SYSTEM_SMS,4,2                 ## @SYSTEM_SMS
	.comm	_work_ram,8,3                   ## @work_ram
	.comm	_io_reg,8,3                     ## @io_reg
	.comm	_z80_readmap,8,3                ## @z80_readmap
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ; -- Begin function sms_cart_reset
lCPI0_0:
	.long	0                               ; 0x0
	.long	0                               ; 0x0
	.long	1                               ; 0x1
	.long	2                               ; 0x2
lCPI0_1:
	.long	0                               ; 0x0
	.long	0                               ; 0x0
	.long	1                               ; 0x1
	.long	0                               ; 0x0
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_sms_cart_reset
	.p2align	2
_sms_cart_reset:                        ; @sms_cart_reset
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
Lloh0:
	adrp	x19, _bios_rom@GOTPAGE
Lloh1:
	ldr	x19, [x19, _bios_rom@GOTPAGEOFF]
	ldr	x8, [x19]
Lloh2:
	adrp	x9, lCPI0_0@PAGE
Lloh3:
	ldr	q0, [x9, lCPI0_0@PAGEOFF]
	str	q0, [x8]
Lloh4:
	adrp	x9, _cart_rom@GOTPAGE
Lloh5:
	ldr	x9, [x9, _cart_rom@GOTPAGEOFF]
	ldr	w10, [x9]
	sub	w11, w10, #130
	cmp	w11, #3
	b.hs	LBB0_2
; %bb.1:
	ldr	x11, [x9, #8]
	stp	xzr, xzr, [x11]
	b	LBB0_6
LBB0_2:
	sub	w10, w10, #128
	cmp	w10, #1
	b.hi	LBB0_4
; %bb.3:
	ldr	x11, [x9, #8]
	b	LBB0_5
LBB0_4:
	ldr	x11, [x9, #8]
Lloh6:
	adrp	x10, lCPI0_1@PAGE
Lloh7:
	ldr	q0, [x10, lCPI0_1@PAGEOFF]
LBB0_5:
	str	q0, [x11]
LBB0_6:
	ldr	w10, [x19, #8]
Lloh8:
	adrp	x20, _cart@GOTPAGE
Lloh9:
	ldr	x20, [x20, _cart@GOTPAGEOFF]
	ldr	x12, [x20]
	cmp	w10, #2
	b.lt	LBB0_8
; %bb.7:
	add	x9, x12, #1024, lsl #12         ; =4194304
Lloh10:
	adrp	x11, _slot@GOTPAGE
Lloh11:
	ldr	x11, [x11, _slot@GOTPAGEOFF]
	str	x9, [x11, #16]
	str	x8, [x11]
	ldr	w8, [x19, #12]
	stp	w8, w10, [x11, #8]
	mov	w8, #224
	b	LBB0_11
LBB0_8:
Lloh12:
	adrp	x8, _slot@GOTPAGE
Lloh13:
	ldr	x8, [x8, _slot@GOTPAGEOFF]
	str	x12, [x8, #16]
	str	x11, [x8]
	ldr	w11, [x9]
	ldr	w9, [x9, #16]
Lloh14:
	adrp	x12, _system_hw@GOTPAGE
Lloh15:
	ldr	x12, [x12, _system_hw@GOTPAGEOFF]
	stp	w11, w9, [x8, #8]
Lloh16:
	ldr	w8, [x12]
Lloh17:
	adrp	x9, _SYSTEM_SMS@GOTPAGE
Lloh18:
	ldr	x9, [x9, _SYSTEM_SMS@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_10
; %bb.9:
Lloh20:
	adrp	x8, _work_ram@GOTPAGE
Lloh21:
	ldr	x8, [x8, _work_ram@GOTPAGEOFF]
Lloh22:
	ldr	x8, [x8]
	mov	w9, #168
	str	w9, [x8]
	ldr	w10, [x19, #8]
LBB0_10:
	mov	w8, #224
	mov	w9, #168
	cmp	w10, #0
	csel	w8, w9, w8, eq
LBB0_11:
Lloh23:
	adrp	x9, _io_reg@GOTPAGE
Lloh24:
	ldr	x9, [x9, _io_reg@GOTPAGEOFF]
Lloh25:
	ldr	x9, [x9]
	str	w8, [x9, #56]
	bl	_mapper_reset
	ldr	w8, [x19, #8]
	cmp	w8, #1
	b.ne	LBB0_13
; %bb.12:
	ldr	x8, [x20]
	add	x8, x8, #1024, lsl #12          ; =4194304
Lloh26:
	adrp	x9, _z80_readmap@GOTPAGE
Lloh27:
	ldr	x9, [x9, _z80_readmap@GOTPAGEOFF]
Lloh28:
	ldr	x9, [x9]
	str	x8, [x9]
LBB0_13:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdrp	Lloh2, Lloh4
	.loh AdrpLdr	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdr	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_bios_rom,16,3                  ; @bios_rom
	.comm	_cart_rom,24,3                  ; @cart_rom
	.comm	_cart,8,3                       ; @cart
	.comm	_slot,24,3                      ; @slot
	.comm	_system_hw,4,2                  ; @system_hw
	.comm	_SYSTEM_SMS,4,2                 ; @SYSTEM_SMS
	.comm	_work_ram,8,3                   ; @work_ram
	.comm	_io_reg,8,3                     ; @io_reg
	.comm	_z80_readmap,8,3                ; @z80_readmap
.subsections_via_symbols
