	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function command_event_set_savestate_auto_index
_command_event_set_savestate_auto_index: ## @command_event_set_savestate_auto_index
	.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
	subq	$168, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_configuration_settings@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -192(%rbp)                ## 8-byte Spill
	cmpl	$0, 4(%rax)
	je	LBB0_11
## %bb.1:
	movq	_PATH_MAX_LENGTH@GOTPCREL(%rip), %r12
	movslq	(%r12), %r13
	movl	%r13d, %edi
	movl	$1, %esi
	callq	_calloc
	movq	%rax, %rbx
	movq	_g_extern@GOTPCREL(%rip), %r15
	movq	(%r15), %rsi
	movq	%rax, %rdi
	movq	%r13, %rdx
	callq	_fill_pathname_basedir
	movq	_DIR_LIST_PLAIN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%eax, %eax
	movq	%rax, -184(%rbp)                ## 8-byte Spill
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_dir_list_new_special
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_free
	testq	%r14, %r14
	je	LBB0_11
## %bb.2:
	movl	(%r12), %edi
	movl	$1, %esi
	callq	_calloc
	movq	(%r15), %rsi
	movq	%rax, %r15
	movq	%rax, %rdi
	movl	%r13d, %edx
	callq	_fill_pathname_base
	cmpq	$0, (%r14)
	movq	%r14, %rbx
	je	LBB0_10
## %bb.3:
	xorl	%r13d, %r13d
	xorl	%eax, %eax
	movq	%rax, -184(%rbp)                ## 8-byte Spill
	movq	%r15, -200(%rbp)                ## 8-byte Spill
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_4 Depth=1
	movq	%r15, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_strtoul
	movq	-184(%rbp), %rcx                ## 8-byte Reload
	cmpl	%eax, %ecx
	cmoval	%ecx, %eax
                                        ## kill: def $eax killed $eax killed $rax def $rax
	movq	%rax, -184(%rbp)                ## 8-byte Spill
	movq	-200(%rbp), %r15                ## 8-byte Reload
LBB0_9:                                 ##   in Loop: Header=BB0_4 Depth=1
	incq	%r13
	cmpq	(%rbx), %r13
	jae	LBB0_10
LBB0_4:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_6 Depth 2
	xorps	%xmm0, %xmm0
	movaps	%xmm0, -64(%rbp)
	movaps	%xmm0, -80(%rbp)
	movaps	%xmm0, -96(%rbp)
	movaps	%xmm0, -112(%rbp)
	movaps	%xmm0, -128(%rbp)
	movaps	%xmm0, -144(%rbp)
	movaps	%xmm0, -160(%rbp)
	movaps	%xmm0, -176(%rbp)
	movq	8(%rbx), %rax
	movq	(%rax,%r13,8), %r14
	leaq	-176(%rbp), %r12
	movq	%r12, %rdi
	movq	%r14, %rsi
	movl	$128, %edx
	callq	_fill_pathname_base
	movq	%r15, %rdi
	callq	_strlen
	movq	%r12, %rdi
	movq	%r15, %rsi
	movq	%rax, %rdx
	callq	_strncmp
	testl	%eax, %eax
	jne	LBB0_9
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	%r14, %rdi
	callq	_strlen
	movslq	%eax, %r12
	addq	%r14, %r12
	.p2align	4, 0x90
LBB0_6:                                 ##   Parent Loop BB0_4 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	%r12, %r15
	cmpq	%r14, %r12
	jbe	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=2
	leaq	-1(%r15), %r12
	movsbl	-1(%r15), %edi
	callq	_isdigit
	testq	%rax, %rax
	jne	LBB0_6
	jmp	LBB0_8
LBB0_10:
	movq	%rbx, %rdi
	callq	_dir_list_free
	movq	%r15, %rdi
	callq	_free
	movq	-192(%rbp), %rdi                ## 8-byte Reload
	movl	(%rdi), %esi
	movq	-184(%rbp), %rbx                ## 8-byte Reload
	movl	%ebx, %edx
	callq	_configuration_set_int
	movq	_MSG_FOUND_LAST_STATE_SLOT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_msg_hash_to_str
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	movl	%ebx, %edx
	callq	_RARCH_LOG
LBB0_11:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_13
## %bb.12:
	addq	$168, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_PATH_MAX_LENGTH,4,2            ## @PATH_MAX_LENGTH
	.comm	_configuration_settings,8,3     ## @configuration_settings
	.comm	_g_extern,8,3                   ## @g_extern
	.comm	_DIR_LIST_PLAIN,4,2             ## @DIR_LIST_PLAIN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s: #%d\n"

	.comm	_MSG_FOUND_LAST_STATE_SLOT,4,2  ## @MSG_FOUND_LAST_STATE_SLOT
	.no_dead_strip	_command_event_set_savestate_auto_index
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function command_event_set_savestate_auto_index
_command_event_set_savestate_auto_index: ; @command_event_set_savestate_auto_index
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #224
	.cfi_def_cfa_offset 224
	stp	x26, x25, [sp, #144]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #160]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #176]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #192]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #208]            ; 16-byte Folded Spill
	add	x29, sp, #208
	.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
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-72]
Lloh3:
	adrp	x8, _configuration_settings@GOTPAGE
Lloh4:
	ldr	x8, [x8, _configuration_settings@GOTPAGEOFF]
Lloh5:
	ldr	x19, [x8]
	ldr	w8, [x19, #4]
	cbz	w8, LBB0_12
; %bb.1:
Lloh6:
	adrp	x23, _PATH_MAX_LENGTH@GOTPAGE
Lloh7:
	ldr	x23, [x23, _PATH_MAX_LENGTH@GOTPAGEOFF]
	ldrsw	x21, [x23]
	mov	x0, x21
	mov	w1, #1
	bl	_calloc
	mov	x22, x0
Lloh8:
	adrp	x24, _g_extern@GOTPAGE
Lloh9:
	ldr	x24, [x24, _g_extern@GOTPAGEOFF]
	ldr	x1, [x24]
	mov	x2, x21
	bl	_fill_pathname_basedir
Lloh10:
	adrp	x8, _DIR_LIST_PLAIN@GOTPAGE
Lloh11:
	ldr	x8, [x8, _DIR_LIST_PLAIN@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	x0, x22
	mov	x2, #0
	bl	_dir_list_new_special
	mov	x20, x0
	mov	x0, x22
	bl	_free
	cbz	x20, LBB0_12
; %bb.2:
	ldr	w0, [x23]
	mov	w1, #1
	bl	_calloc
	mov	x22, x0
	ldr	x1, [x24]
	mov	x2, x21
	bl	_fill_pathname_base
	ldr	x8, [x20]
	cbz	x8, LBB0_10
; %bb.3:
	mov	x25, #0
	mov	w21, #0
	b	LBB0_6
LBB0_4:                                 ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x24
	mov	x1, #0
	mov	w2, #0
	bl	_strtoul
	cmp	w21, w0
	csel	w21, w21, w0, hi
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	add	x25, x25, #1
	ldr	x8, [x20]
	cmp	x25, x8
	b.hs	LBB0_11
LBB0_6:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_8 Depth 2
	movi.2d	v0, #0000000000000000
	stp	q0, q0, [sp, #96]
	stp	q0, q0, [sp, #64]
	stp	q0, q0, [sp, #32]
	stp	q0, q0, [sp]
	ldr	x8, [x20, #8]
	ldr	x23, [x8, x25, lsl #3]
	mov	x0, sp
	mov	x1, x23
	mov	w2, #128
	bl	_fill_pathname_base
	mov	x0, x22
	bl	_strlen
	mov	x2, x0
	mov	x0, sp
	mov	x1, x22
	bl	_strncmp
	cbnz	w0, LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x23
	bl	_strlen
	add	x26, x23, w0, sxtw
LBB0_8:                                 ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	mov	x24, x26
	cmp	x26, x23
	b.ls	LBB0_4
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=2
	mov	x26, x24
	ldrsb	w0, [x26, #-1]!
	bl	_isdigit
	cbnz	x0, LBB0_8
	b	LBB0_4
LBB0_10:
	mov	w21, #0
LBB0_11:
	mov	x0, x20
	bl	_dir_list_free
	mov	x0, x22
	bl	_free
	ldr	w1, [x19]
	mov	x0, x19
	mov	x2, x21
	bl	_configuration_set_int
Lloh13:
	adrp	x8, _MSG_FOUND_LAST_STATE_SLOT@GOTPAGE
Lloh14:
	ldr	x8, [x8, _MSG_FOUND_LAST_STATE_SLOT@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x8]
	bl	_msg_hash_to_str
	mov	x1, x0
Lloh16:
	adrp	x0, l_.str@PAGE
Lloh17:
	add	x0, x0, l_.str@PAGEOFF
	mov	x2, x21
	bl	_RARCH_LOG
LBB0_12:
	ldur	x8, [x29, #-72]
Lloh18:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh19:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_14
; %bb.13:
	ldp	x29, x30, [sp, #208]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #192]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #176]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #160]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #144]            ; 16-byte Folded Reload
	add	sp, sp, #224
	ret
LBB0_14:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_PATH_MAX_LENGTH,4,2            ; @PATH_MAX_LENGTH
	.comm	_configuration_settings,8,3     ; @configuration_settings
	.comm	_g_extern,8,3                   ; @g_extern
	.comm	_DIR_LIST_PLAIN,4,2             ; @DIR_LIST_PLAIN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s: #%d\n"

	.comm	_MSG_FOUND_LAST_STATE_SLOT,4,2  ; @MSG_FOUND_LAST_STATE_SLOT
	.no_dead_strip	_command_event_set_savestate_auto_index
.subsections_via_symbols
