	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_slot_autosave                  ## -- Begin function slot_autosave
	.p2align	4, 0x90
_slot_autosave:                         ## @slot_autosave
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movl	%edi, %r12d
	testl	%edi, %edi
	je	LBB0_1
## %bb.21:
	movq	_config@GOTPCREL(%rip), %rax
	testb	$2, (%rax)
	jne	LBB0_18
	jmp	LBB0_20
LBB0_1:
	movq	_system_hw@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_SYSTEM_MCD@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_17
## %bb.2:
	movq	_scd@GOTPCREL(%rip), %rbx
	movq	24(%rbx), %rsi
	xorl	%edi, %edi
	movl	$8192, %edx                     ## imm = 0x2000
	callq	_crc32
	movq	_brm_crc@GOTPCREL(%rip), %r13
	movq	(%r13), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_6
## %bb.3:
	movl	$8160, %edi                     ## imm = 0x1FE0
	addq	24(%rbx), %rdi
	movq	_brm_format@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	$32, %rsi
	movl	$32, %edx
	callq	_memcmp
	testl	%eax, %eax
	jne	LBB0_6
## %bb.4:
	movq	_brm_filename@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_region_code@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	sarl	$6, %ecx
	xorl	$1, %ecx
	movslq	%ecx, %rcx
	movl	-4(%rax,%rcx,4), %edi
	leaq	L_.str(%rip), %rsi
	callq	_fopen
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	movq	%rax, %r15
	movq	24(%rbx), %rdi
	movl	$8192, %esi                     ## imm = 0x2000
	movl	$1, %edx
	movq	%rax, %rcx
	callq	_fwrite
	movq	%r15, %rdi
	callq	_fclose
	movq	24(%rbx), %rsi
	xorl	%edi, %edi
	movl	$8192, %edx                     ## imm = 0x2000
	callq	_crc32
	movq	(%r13), %rcx
	movq	%rax, (%rcx)
LBB0_6:
	cmpq	$0, 16(%rbx)
	je	LBB0_17
## %bb.7:
	movq	8(%rbx), %rsi
	movl	(%rbx), %edx
	incl	%edx
	xorl	%edi, %edi
	callq	_crc32
	movq	(%r13), %rcx
	cmpq	8(%rcx), %rax
	je	LBB0_17
## %bb.8:
	movq	8(%rbx), %rax
	movslq	(%rbx), %rcx
	leaq	(%rax,%rcx), %rdi
	addq	$-31, %rdi
	movq	_brm_format@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	$32, %rsi
	movl	$32, %edx
	callq	_memcmp
	testl	%eax, %eax
	jne	LBB0_17
## %bb.9:
	movq	_CART_BRAM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_fopen
	testq	%rax, %rax
	je	LBB0_17
## %bb.10:
	movq	%rax, %r15
	movl	(%rbx), %eax
	leal	1(%rax), %r13d
	movq	_CHUNKSIZE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	xorl	%ebx, %ebx
	cmpl	%esi, %eax
	jl	LBB0_14
## %bb.11:
	movq	%r15, -48(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movslq	%ebx, %rbx
	movq	_scd@GOTPCREL(%rip), %rax
	movq	8(%rax), %rdi
	addq	%rbx, %rdi
	movl	$1, %edx
	movq	%rcx, %r15
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	callq	_fwrite
	movq	%r15, %rcx
	movl	(%r15), %esi
	addl	%esi, %ebx
	subl	%esi, %r13d
	cmpl	%esi, %r13d
	jg	LBB0_12
## %bb.13:
	movslq	%ebx, %rbx
	movq	-48(%rbp), %r15                 ## 8-byte Reload
LBB0_14:
	testl	%r13d, %r13d
	je	LBB0_16
## %bb.15:
	movq	_scd@GOTPCREL(%rip), %rax
	addq	8(%rax), %rbx
	movq	%rbx, %rdi
	movl	%r13d, %esi
	movl	$1, %edx
	movq	%r15, %rcx
	callq	_fwrite
LBB0_16:
	movq	%r15, %rdi
	callq	_fclose
	movq	_scd@GOTPCREL(%rip), %rax
	movq	8(%rax), %rsi
	movl	(%rax), %edx
	incl	%edx
	xorl	%edi, %edi
	callq	_crc32
	movq	_brm_crc@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	%rax, 8(%rcx)
LBB0_17:
	movq	_config@GOTPCREL(%rip), %rax
	testb	$1, (%rax)
	je	LBB0_20
LBB0_18:
	movq	_rom_filename@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_strlen
	testq	%rax, %rax
	je	LBB0_20
## %bb.19:
	movq	_SILENT@GOTPCREL(%rip), %rbx
	movl	$1, (%rbx)
	movl	%r12d, %edi
	movl	%r14d, %esi
	callq	_slot_save
	movl	$0, (%rbx)
LBB0_20:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_system_hw,8,3                  ## @system_hw
	.comm	_SYSTEM_MCD,8,3                 ## @SYSTEM_MCD
	.comm	_scd,32,3                       ## @scd
	.comm	_brm_crc,8,3                    ## @brm_crc
	.comm	_brm_format,8,3                 ## @brm_format
	.comm	_brm_filename,8,3               ## @brm_filename
	.comm	_region_code,4,2                ## @region_code
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"wb"

	.comm	_CART_BRAM,4,2                  ## @CART_BRAM
	.comm	_CHUNKSIZE,4,2                  ## @CHUNKSIZE
	.comm	_config,4,2                     ## @config
	.comm	_rom_filename,4,2               ## @rom_filename
	.comm	_SILENT,4,2                     ## @SILENT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_slot_autosave                  ; -- Begin function slot_autosave
	.p2align	2
_slot_autosave:                         ; @slot_autosave
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x1
	mov	x20, x0
	cbz	w0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _config@GOTPAGE
Lloh1:
	ldr	x8, [x8, _config@GOTPAGEOFF]
	ldrb	w8, [x8]
	tbnz	w8, #1, LBB0_20
	b	LBB0_22
LBB0_2:
Lloh2:
	adrp	x8, _system_hw@GOTPAGE
Lloh3:
	ldr	x8, [x8, _system_hw@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
Lloh5:
	adrp	x9, _SYSTEM_MCD@GOTPAGE
Lloh6:
	ldr	x9, [x9, _SYSTEM_MCD@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_19
; %bb.3:
Lloh8:
	adrp	x23, _scd@GOTPAGE
Lloh9:
	ldr	x23, [x23, _scd@GOTPAGEOFF]
	ldr	x1, [x23, #24]
	mov	w0, #0
	mov	w2, #8192
	bl	_crc32
Lloh10:
	adrp	x24, _brm_crc@GOTPAGE
Lloh11:
	ldr	x24, [x24, _brm_crc@GOTPAGEOFF]
	ldr	x8, [x24]
	ldr	x8, [x8]
	cmp	x0, x8
	b.eq	LBB0_7
; %bb.4:
	ldr	x8, [x23, #24]
	mov	w9, #8160
	add	x0, x8, x9
Lloh12:
	adrp	x8, _brm_format@GOTPAGE
Lloh13:
	ldr	x8, [x8, _brm_format@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
	add	x1, x8, #32
	mov	w2, #32
	bl	_memcmp
	cbnz	w0, LBB0_7
; %bb.5:
Lloh15:
	adrp	x8, _brm_filename@GOTPAGE
Lloh16:
	ldr	x8, [x8, _brm_filename@GOTPAGEOFF]
Lloh17:
	ldr	x8, [x8]
Lloh18:
	adrp	x9, _region_code@GOTPAGE
Lloh19:
	ldr	x9, [x9, _region_code@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	asr	w9, w9, #6
	eor	w9, w9, #0x1
	sub	w9, w9, #1
	ldr	w0, [x8, w9, sxtw #2]
Lloh21:
	adrp	x1, l_.str@PAGE
Lloh22:
	add	x1, x1, l_.str@PAGEOFF
	bl	_fopen
	cbz	x0, LBB0_7
; %bb.6:
	mov	x21, x0
	ldr	x0, [x23, #24]
	mov	w1, #8192
	mov	w2, #1
	mov	x3, x21
	bl	_fwrite
	mov	x0, x21
	bl	_fclose
	ldr	x1, [x23, #24]
	mov	w0, #0
	mov	w2, #8192
	bl	_crc32
	ldr	x8, [x24]
	str	x0, [x8]
LBB0_7:
	ldr	x8, [x23, #16]
	cbz	x8, LBB0_19
; %bb.8:
	ldr	x1, [x23, #8]
	ldr	w8, [x23]
	add	w2, w8, #1
	mov	w0, #0
	bl	_crc32
	ldr	x8, [x24]
	ldr	x8, [x8, #8]
	cmp	x0, x8
	b.eq	LBB0_19
; %bb.9:
	ldr	x8, [x23, #8]
	ldrsw	x9, [x23]
	add	x8, x8, x9
	sub	x0, x8, #31
Lloh23:
	adrp	x8, _brm_format@GOTPAGE
Lloh24:
	ldr	x8, [x8, _brm_format@GOTPAGEOFF]
Lloh25:
	ldr	x8, [x8]
	add	x1, x8, #32
	mov	w2, #32
	bl	_memcmp
	cbnz	w0, LBB0_19
; %bb.10:
Lloh26:
	adrp	x8, _CART_BRAM@GOTPAGE
Lloh27:
	ldr	x8, [x8, _CART_BRAM@GOTPAGEOFF]
Lloh28:
	ldr	w0, [x8]
Lloh29:
	adrp	x1, l_.str@PAGE
Lloh30:
	add	x1, x1, l_.str@PAGEOFF
	bl	_fopen
	cbz	x0, LBB0_19
; %bb.11:
	mov	x21, x0
	ldr	w8, [x23]
	add	w22, w8, #1
Lloh31:
	adrp	x25, _CHUNKSIZE@GOTPAGE
Lloh32:
	ldr	x25, [x25, _CHUNKSIZE@GOTPAGEOFF]
	ldr	w1, [x25]
	cmp	w8, w1
	b.ge	LBB0_13
; %bb.12:
	mov	x8, #0
	b	LBB0_16
LBB0_13:
	mov	w26, #0
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x23, #8]
	add	x0, x8, w26, sxtw
	mov	w2, #1
	mov	x3, x21
	bl	_fwrite
	ldr	w1, [x25]
	add	w26, w1, w26
	sub	w22, w22, w1
	cmp	w22, w1
	b.gt	LBB0_14
; %bb.15:
	sxtw	x8, w26
LBB0_16:
	cbz	w22, LBB0_18
; %bb.17:
	ldr	x9, [x23, #8]
	add	x0, x9, x8
	mov	x1, x22
	mov	w2, #1
	mov	x3, x21
	bl	_fwrite
LBB0_18:
	mov	x0, x21
	bl	_fclose
	ldr	x1, [x23, #8]
	ldr	w8, [x23]
	add	w2, w8, #1
	mov	w0, #0
	bl	_crc32
	ldr	x8, [x24]
	str	x0, [x8, #8]
LBB0_19:
Lloh33:
	adrp	x8, _config@GOTPAGE
Lloh34:
	ldr	x8, [x8, _config@GOTPAGEOFF]
	ldrb	w8, [x8]
	tbz	w8, #0, LBB0_22
LBB0_20:
Lloh35:
	adrp	x8, _rom_filename@GOTPAGE
Lloh36:
	ldr	x8, [x8, _rom_filename@GOTPAGEOFF]
Lloh37:
	ldr	w0, [x8]
	bl	_strlen
	cbz	x0, LBB0_22
; %bb.21:
Lloh38:
	adrp	x21, _SILENT@GOTPAGE
Lloh39:
	ldr	x21, [x21, _SILENT@GOTPAGEOFF]
	mov	w8, #1
	str	w8, [x21]
	mov	x0, x20
	mov	x1, x19
	bl	_slot_save
	str	wzr, [x21]
LBB0_22:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGot	Lloh38, Lloh39
	.cfi_endproc
                                        ; -- End function
	.comm	_system_hw,8,3                  ; @system_hw
	.comm	_SYSTEM_MCD,8,3                 ; @SYSTEM_MCD
	.comm	_scd,32,3                       ; @scd
	.comm	_brm_crc,8,3                    ; @brm_crc
	.comm	_brm_format,8,3                 ; @brm_format
	.comm	_brm_filename,8,3               ; @brm_filename
	.comm	_region_code,4,2                ; @region_code
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"wb"

	.comm	_CART_BRAM,4,2                  ; @CART_BRAM
	.comm	_CHUNKSIZE,4,2                  ; @CHUNKSIZE
	.comm	_config,4,2                     ; @config
	.comm	_rom_filename,4,2               ; @rom_filename
	.comm	_SILENT,4,2                     ; @SILENT
.subsections_via_symbols
