	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function set_bank_A0AF
_set_bank_A0AF:                         ## @set_bank_A0AF
	.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
	movq	_active_cart@GOTPCREL(%rip), %r15
	movq	(%r15), %rax
	cmpl	$0, (%rax)
	js	LBB0_6
## %bb.1:
	movl	%esi, %ebx
	movl	%edi, %r14d
	xorl	%eax, %eax
	callq	_MEMORY_CartA0bfEnable
	movq	(%r15), %rax
	movslq	(%rax), %rdx
	cmpq	$255, %rdx
	jne	LBB0_3
## %bb.2:
	movl	$40960, %edi                    ## imm = 0xA000
	movl	$255, %esi
	movl	$4096, %edx                     ## imm = 0x1000
	callq	_MEMORY_dFillMem
	testl	%ebx, %ebx
	js	LBB0_7
LBB0_5:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_MEMORY_CartA0bfDisable         ## TAILCALL
LBB0_3:
	shlq	$12, %rdx
	addq	8(%rax), %rdx
	movl	$40960, %edi                    ## imm = 0xA000
	movl	$45055, %esi                    ## imm = 0xAFFF
	callq	_MEMORY_CopyROM
	testl	%ebx, %ebx
	jns	LBB0_5
LBB0_7:
	movq	(%r15), %rax
	movslq	%r14d, %rdx
	addq	8(%rax), %rdx
	movl	$45056, %edi                    ## imm = 0xB000
	movl	$49151, %esi                    ## imm = 0xBFFF
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_MEMORY_CopyROM                 ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_active_cart,8,3                ## @active_cart
	.no_dead_strip	_set_bank_A0AF
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function set_bank_A0AF
_set_bank_A0AF:                         ; @set_bank_A0AF
	.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
Lloh0:
	adrp	x21, _active_cart@GOTPAGE
Lloh1:
	ldr	x21, [x21, _active_cart@GOTPAGEOFF]
	ldr	x8, [x21]
	ldr	w8, [x8]
	tbnz	w8, #31, LBB0_4
; %bb.1:
	mov	x20, x1
	mov	x19, x0
	bl	_MEMORY_CartA0bfEnable
	ldr	x8, [x21]
	ldrsw	x9, [x8]
	cmp	w9, #255
	b.ne	LBB0_5
; %bb.2:
	mov	w0, #40960
	mov	w1, #255
	mov	w2, #4096
	bl	_MEMORY_dFillMem
	tbnz	w20, #31, LBB0_6
LBB0_3:
	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
LBB0_4:
	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	_MEMORY_CartA0bfDisable
LBB0_5:
	ldr	x8, [x8, #8]
	add	x2, x8, x9, lsl #12
	mov	w0, #40960
	mov	w1, #45055
	bl	_MEMORY_CopyROM
	tbz	w20, #31, LBB0_3
LBB0_6:
	ldr	x8, [x21]
	ldr	x8, [x8, #8]
	add	x2, x8, w19, sxtw
	mov	w0, #45056
	mov	w1, #49151
	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	_MEMORY_CopyROM
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_active_cart,8,3                ; @active_cart
	.no_dead_strip	_set_bank_A0AF
.subsections_via_symbols
