	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function write_mapper_korea_8k
_write_mapper_korea_8k:                 ## @write_mapper_korea_8k
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movl	%edi, %ebx
	cmpl	$40959, %edi                    ## imm = 0x9FFF
	jg	LBB0_5
## %bb.1:
	cmpl	$16384, %ebx                    ## imm = 0x4000
	je	LBB0_9
## %bb.2:
	cmpl	$24576, %ebx                    ## imm = 0x6000
	je	LBB0_11
## %bb.3:
	cmpl	$32768, %ebx                    ## imm = 0x8000
	jne	LBB0_15
## %bb.4:
	movzbl	%r14b, %esi
	xorl	%edi, %edi
	jmp	LBB0_10
LBB0_5:
	cmpl	$40960, %ebx                    ## imm = 0xA000
	je	LBB0_12
## %bb.6:
	cmpl	$65534, %ebx                    ## imm = 0xFFFE
	je	LBB0_13
## %bb.7:
	cmpl	$65535, %ebx                    ## imm = 0xFFFF
	jne	LBB0_15
## %bb.8:
	movzbl	%r14b, %eax
	addl	%eax, %eax
	movzbl	%al, %r15d
	xorl	%edi, %edi
	movl	%r15d, %esi
	callq	_mapper_8k_w
	movl	$1, %edi
	jmp	LBB0_14
LBB0_9:
	movzbl	%r14b, %esi
	movl	$2, %edi
	jmp	LBB0_10
LBB0_11:
	movzbl	%r14b, %esi
	movl	$3, %edi
	jmp	LBB0_10
LBB0_12:
	movzbl	%r14b, %esi
	movl	$1, %edi
LBB0_10:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mapper_8k_w                    ## TAILCALL
LBB0_13:
	movzbl	%r14b, %eax
	addl	%eax, %eax
	movzbl	%al, %r15d
	movl	$2, %edi
	movl	%r15d, %esi
	callq	_mapper_8k_w
	movl	$3, %edi
LBB0_14:
	orl	$1, %r15d
	movl	%r15d, %esi
	callq	_mapper_8k_w
LBB0_15:
	movq	_z80_writemap@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	%ebx, %ecx
	shrl	$10, %ecx
	movq	(%rax,%rcx,8), %rax
	andl	$1023, %ebx                     ## imm = 0x3FF
	movb	%r14b, (%rax,%rbx)
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_z80_writemap,8,3               ## @z80_writemap
	.no_dead_strip	_write_mapper_korea_8k
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function write_mapper_korea_8k
_write_mapper_korea_8k:                 ; @write_mapper_korea_8k
	.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
	mov	x19, x1
	mov	x20, x0
	cmp	w0, #10, lsl #12                ; =40960
	b.ge	LBB0_5
; %bb.1:
	cmp	w20, #4, lsl #12                ; =16384
	b.eq	LBB0_9
; %bb.2:
	cmp	w20, #6, lsl #12                ; =24576
	b.eq	LBB0_10
; %bb.3:
	cmp	w20, #8, lsl #12                ; =32768
	b.ne	LBB0_15
; %bb.4:
	mov	w0, #0
	b	LBB0_12
LBB0_5:
	b.eq	LBB0_11
; %bb.6:
	mov	w8, #65534
	cmp	w20, w8
	b.eq	LBB0_13
; %bb.7:
	mov	w8, #65535
	cmp	w20, w8
	b.ne	LBB0_15
; %bb.8:
	ubfiz	w21, w19, #1, #7
	mov	w0, #0
	mov	x1, x21
	bl	_mapper_8k_w
	mov	w0, #1
	b	LBB0_14
LBB0_9:
	mov	w0, #2
	b	LBB0_12
LBB0_10:
	mov	w0, #3
	b	LBB0_12
LBB0_11:
	mov	w0, #1
LBB0_12:
	mov	x1, x19
	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
	b	_mapper_8k_w
LBB0_13:
	ubfiz	w21, w19, #1, #7
	mov	w0, #2
	mov	x1, x21
	bl	_mapper_8k_w
	mov	w0, #3
LBB0_14:
	orr	w1, w21, #0x1
	bl	_mapper_8k_w
LBB0_15:
Lloh0:
	adrp	x8, _z80_writemap@GOTPAGE
Lloh1:
	ldr	x8, [x8, _z80_writemap@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	lsr	w9, w20, #10
	ldr	x8, [x8, w9, uxtw #3]
	and	x9, x20, #0x3ff
	strb	w19, [x8, x9]
	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
	.cfi_endproc
                                        ; -- End function
	.comm	_z80_writemap,8,3               ; @z80_writemap
	.no_dead_strip	_write_mapper_korea_8k
.subsections_via_symbols
