	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mapper_sega_w
_mapper_sega_w:                         ## @mapper_sega_w
	.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
	testb	$1, %dil
	jne	LBB0_3
## %bb.1:
	movq	_cart@GOTPCREL(%rip), %rax
	movq	8(%rax), %r8
	movq	_m68k@GOTPCREL(%rip), %rdx
	movl	$1312, %ecx                     ## imm = 0x520
	addq	(%rdx), %rcx
	movl	4(%rax), %r14d
	movl	$2097152, %esi                  ## imm = 0x200000
	xorl	%edi, %edi
	xorps	%xmm0, %xmm0
	movq	_zbank_memory_map@GOTPCREL(%rip), %rax
	movq	_m68k_unused_8_w@GOTPCREL(%rip), %r9
	movq	_m68k_unused_16_w@GOTPCREL(%rip), %r10
	movq	_zbank_unused_w@GOTPCREL(%rip), %r11
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	%r14d, %ebx
	andl	%esi, %ebx
	addq	%r8, %rbx
	movq	%rbx, (%rcx)
	movups	%xmm0, -16(%rcx)
	movq	(%rax), %rbx
	movq	$0, 520(%rbx,%rdi)
	movq	(%r9), %rbx
	movq	%rbx, -24(%rcx)
	movq	(%r10), %rbx
	movq	%rbx, -32(%rcx)
	movq	(%r11), %rbx
	movq	(%rax), %rdx
	movq	%rbx, 512(%rdx,%rdi)
	addl	$65536, %esi                    ## imm = 0x10000
	addq	$40, %rcx
	addq	$16, %rdi
	cmpq	$512, %rdi                      ## imm = 0x200
	jne	LBB0_2
	jmp	LBB0_11
LBB0_3:
	movq	_sram@GOTPCREL(%rip), %rax
	cmpq	$0, 8(%rax)
	je	LBB0_8
## %bb.4:
	movq	(%rax), %rcx
	movq	_m68k@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rcx, 1312(%rax)
	movq	_sram_read_byte@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdx
	movq	%rdx, 1304(%rax)
	movq	_sram_read_word@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	%rcx, 1296(%rax)
	movq	_zbank_memory_map@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	%rdx, 520(%rcx)
	testb	$2, %dil
	jne	LBB0_5
## %bb.6:
	movq	_sram_write_byte@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movq	%rdx, 1288(%rax)
	movq	_sram_write_word@GOTPCREL(%rip), %rsi
	movq	(%rsi), %rsi
	movq	%rsi, 1280(%rax)
	jmp	LBB0_7
LBB0_5:
	movq	_m68k_unused_8_w@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movq	%rdx, 1288(%rax)
	movq	_m68k_unused_16_w@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movq	%rdx, 1280(%rax)
	movq	_zbank_unused_w@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
LBB0_7:
	movq	%rdx, 512(%rcx)
LBB0_8:
	movq	_cart@GOTPCREL(%rip), %rax
	movq	_HW_LOCK_ON@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	je	LBB0_11
## %bb.9:
	movq	_config@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	_TYPE_SK@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jne	LBB0_11
## %bb.10:
	movq	8(%rax), %rax
	movq	_m68k@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	leaq	9437184(%rax), %rdx
	movq	%rdx, 1952(%rcx)
	leaq	9502720(%rax), %rsi
	movq	%rsi, 1992(%rcx)
	leaq	9568256(%rax), %rdi
	movq	%rdi, 2032(%rcx)
	addq	$9633792, %rax                  ## imm = 0x930000
	movq	%rax, 2072(%rcx)
	movq	%rdx, 2112(%rcx)
	movq	%rsi, 2152(%rcx)
	movq	%rdi, 2192(%rcx)
	movq	%rax, 2232(%rcx)
	movq	%rdx, 2272(%rcx)
	movq	%rsi, 2312(%rcx)
	movq	%rdi, 2352(%rcx)
	movq	%rax, 2392(%rcx)
	movq	%rdx, 2432(%rcx)
	movq	%rsi, 2472(%rcx)
	movq	%rdi, 2512(%rcx)
	movq	%rax, 2552(%rcx)
LBB0_11:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_sram,16,3                      ## @sram
	.comm	_m68k,8,3                       ## @m68k
	.comm	_sram_read_byte,8,3             ## @sram_read_byte
	.comm	_sram_read_word,8,3             ## @sram_read_word
	.comm	_zbank_memory_map,8,3           ## @zbank_memory_map
	.comm	_m68k_unused_8_w,8,3            ## @m68k_unused_8_w
	.comm	_m68k_unused_16_w,8,3           ## @m68k_unused_16_w
	.comm	_zbank_unused_w,8,3             ## @zbank_unused_w
	.comm	_sram_write_byte,8,3            ## @sram_write_byte
	.comm	_sram_write_word,8,3            ## @sram_write_word
	.comm	_cart,16,3                      ## @cart
	.comm	_HW_LOCK_ON,4,2                 ## @HW_LOCK_ON
	.comm	_config,8,3                     ## @config
	.comm	_TYPE_SK,8,3                    ## @TYPE_SK
	.no_dead_strip	_mapper_sega_w
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mapper_sega_w
_mapper_sega_w:                         ; @mapper_sega_w
	.cfi_startproc
; %bb.0:
	tbnz	w0, #0, LBB0_4
; %bb.1:
	mov	x8, #0
Lloh0:
	adrp	x10, _cart@GOTPAGE
Lloh1:
	ldr	x10, [x10, _cart@GOTPAGEOFF]
	ldr	x9, [x10, #8]
	ldr	w10, [x10, #4]
Lloh2:
	adrp	x11, _m68k@GOTPAGE
Lloh3:
	ldr	x11, [x11, _m68k@GOTPAGEOFF]
Lloh4:
	ldr	x11, [x11]
	mov	w12, #2097152
	mov	w13, #520
	movi.2d	v0, #0000000000000000
Lloh5:
	adrp	x14, _zbank_memory_map@GOTPAGE
Lloh6:
	ldr	x14, [x14, _zbank_memory_map@GOTPAGEOFF]
Lloh7:
	adrp	x15, _m68k_unused_8_w@GOTPAGE
Lloh8:
	ldr	x15, [x15, _m68k_unused_8_w@GOTPAGEOFF]
Lloh9:
	adrp	x16, _m68k_unused_16_w@GOTPAGE
Lloh10:
	ldr	x16, [x16, _m68k_unused_16_w@GOTPAGEOFF]
Lloh11:
	adrp	x17, _zbank_unused_w@GOTPAGE
Lloh12:
	ldr	x17, [x17, _zbank_unused_w@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	mov	w0, w12
	and	x0, x10, x0
	add	x0, x9, x0
	add	x1, x11, x8
	str	x0, [x1, #1312]
	str	q0, [x1, #1296]
	ldr	x0, [x14]
	str	xzr, [x0, x13]
	ldr	x0, [x15]
	str	x0, [x1, #1288]
	ldr	x0, [x16]
	str	x0, [x1, #1280]
	ldr	x0, [x17]
	ldr	x1, [x14]
	add	x1, x1, x13
	stur	x0, [x1, #-8]
	add	w12, w12, #16, lsl #12          ; =65536
	add	x8, x8, #40
	add	x13, x13, #16
	cmp	x8, #1280
	b.ne	LBB0_2
LBB0_3:
	ret
LBB0_4:
Lloh13:
	adrp	x8, _sram@GOTPAGE
Lloh14:
	ldr	x8, [x8, _sram@GOTPAGEOFF]
	ldr	x9, [x8, #8]
	cbz	x9, LBB0_9
; %bb.5:
	ldr	x9, [x8]
Lloh15:
	adrp	x8, _m68k@GOTPAGE
Lloh16:
	ldr	x8, [x8, _m68k@GOTPAGEOFF]
Lloh17:
	ldr	x8, [x8]
	str	x9, [x8, #1312]
Lloh18:
	adrp	x9, _sram_read_byte@GOTPAGE
Lloh19:
	ldr	x9, [x9, _sram_read_byte@GOTPAGEOFF]
Lloh20:
	ldr	x10, [x9]
	str	x10, [x8, #1304]
Lloh21:
	adrp	x9, _sram_read_word@GOTPAGE
Lloh22:
	ldr	x9, [x9, _sram_read_word@GOTPAGEOFF]
Lloh23:
	ldr	x9, [x9]
	str	x9, [x8, #1296]
Lloh24:
	adrp	x9, _zbank_memory_map@GOTPAGE
Lloh25:
	ldr	x9, [x9, _zbank_memory_map@GOTPAGEOFF]
Lloh26:
	ldr	x9, [x9]
	str	x10, [x9, #520]
	tbnz	w0, #1, LBB0_7
; %bb.6:
Lloh27:
	adrp	x10, _sram_write_byte@GOTPAGE
Lloh28:
	ldr	x10, [x10, _sram_write_byte@GOTPAGEOFF]
Lloh29:
	ldr	x10, [x10]
	str	x10, [x8, #1288]
Lloh30:
	adrp	x11, _sram_write_word@GOTPAGE
Lloh31:
	ldr	x11, [x11, _sram_write_word@GOTPAGEOFF]
Lloh32:
	ldr	x11, [x11]
	str	x11, [x8, #1280]
	b	LBB0_8
LBB0_7:
Lloh33:
	adrp	x10, _m68k_unused_8_w@GOTPAGE
Lloh34:
	ldr	x10, [x10, _m68k_unused_8_w@GOTPAGEOFF]
Lloh35:
	ldr	x10, [x10]
Lloh36:
	adrp	x11, _m68k_unused_16_w@GOTPAGE
Lloh37:
	ldr	x11, [x11, _m68k_unused_16_w@GOTPAGEOFF]
	str	x10, [x8, #1288]
Lloh38:
	ldr	x10, [x11]
	str	x10, [x8, #1280]
Lloh39:
	adrp	x8, _zbank_unused_w@GOTPAGE
Lloh40:
	ldr	x8, [x8, _zbank_unused_w@GOTPAGEOFF]
Lloh41:
	ldr	x10, [x8]
LBB0_8:
	str	x10, [x9, #512]
LBB0_9:
Lloh42:
	adrp	x8, _cart@GOTPAGE
Lloh43:
	ldr	x8, [x8, _cart@GOTPAGEOFF]
	ldr	w9, [x8]
Lloh44:
	adrp	x10, _HW_LOCK_ON@GOTPAGE
Lloh45:
	ldr	x10, [x10, _HW_LOCK_ON@GOTPAGEOFF]
Lloh46:
	ldr	w10, [x10]
	tst	w10, w9
	b.eq	LBB0_3
; %bb.10:
Lloh47:
	adrp	x9, _config@GOTPAGE
Lloh48:
	ldr	x9, [x9, _config@GOTPAGEOFF]
Lloh49:
	ldr	x9, [x9]
Lloh50:
	adrp	x10, _TYPE_SK@GOTPAGE
Lloh51:
	ldr	x10, [x10, _TYPE_SK@GOTPAGEOFF]
Lloh52:
	ldr	x10, [x10]
	cmp	x9, x10
	b.ne	LBB0_3
; %bb.11:
	ldr	x8, [x8, #8]
Lloh53:
	adrp	x9, _m68k@GOTPAGE
Lloh54:
	ldr	x9, [x9, _m68k@GOTPAGEOFF]
Lloh55:
	ldr	x9, [x9]
	add	x10, x8, #2304, lsl #12         ; =9437184
	str	x10, [x9, #1952]
	add	x11, x8, #2320, lsl #12         ; =9502720
	str	x11, [x9, #1992]
	add	x12, x8, #2336, lsl #12         ; =9568256
	str	x12, [x9, #2032]
	add	x8, x8, #2352, lsl #12          ; =9633792
	str	x8, [x9, #2072]
	str	x10, [x9, #2112]
	str	x11, [x9, #2152]
	str	x12, [x9, #2192]
	str	x8, [x9, #2232]
	str	x10, [x9, #2272]
	str	x11, [x9, #2312]
	str	x12, [x9, #2352]
	str	x8, [x9, #2392]
	str	x10, [x9, #2432]
	str	x11, [x9, #2472]
	str	x12, [x9, #2512]
	str	x8, [x9, #2552]
	ret
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.loh AdrpLdrGot	Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh50, Lloh51, Lloh52
	.loh AdrpLdrGotLdr	Lloh47, Lloh48, Lloh49
	.loh AdrpLdrGotLdr	Lloh53, Lloh54, Lloh55
	.cfi_endproc
                                        ; -- End function
	.comm	_sram,16,3                      ; @sram
	.comm	_m68k,8,3                       ; @m68k
	.comm	_sram_read_byte,8,3             ; @sram_read_byte
	.comm	_sram_read_word,8,3             ; @sram_read_word
	.comm	_zbank_memory_map,8,3           ; @zbank_memory_map
	.comm	_m68k_unused_8_w,8,3            ; @m68k_unused_8_w
	.comm	_m68k_unused_16_w,8,3           ; @m68k_unused_16_w
	.comm	_zbank_unused_w,8,3             ; @zbank_unused_w
	.comm	_sram_write_byte,8,3            ; @sram_write_byte
	.comm	_sram_write_word,8,3            ; @sram_write_word
	.comm	_cart,16,3                      ; @cart
	.comm	_HW_LOCK_ON,4,2                 ; @HW_LOCK_ON
	.comm	_config,8,3                     ; @config
	.comm	_TYPE_SK,8,3                    ; @TYPE_SK
	.no_dead_strip	_mapper_sega_w
.subsections_via_symbols
