	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mainmenu                       ## -- Begin function mainmenu
	.p2align	4, 0x90
_mainmenu:                              ## @mainmenu
	.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	$344, %rsp                      ## imm = 0x158
	.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)
	movl	$0, -372(%rbp)
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movq	_joysticks@GOTPCREL(%rip), %r15
	movq	(%r15), %rax
	movq	_joytypes@GOTPCREL(%rip), %r14
	movq	(%r14), %rcx
	movq	(%rcx), %rcx
	movq	(%rax,%rcx,8), %rcx
	leaq	-368(%rbp), %rdi
	leaq	L_.str(%rip), %r12
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_sprintf
	movq	(%r15), %rax
	movq	(%r14), %rcx
	movq	8(%rcx), %rcx
	movq	(%rax,%rcx,8), %rcx
	leaq	-288(%rbp), %r13
	movq	%r13, %rdi
	movq	%r12, %rsi
	movl	$1, %edx
	callq	_sprintf
	movq	(%r15), %rax
	movq	(%r14), %rcx
	movq	16(%rcx), %rcx
	movq	(%rax,%rcx,8), %rcx
	leaq	-208(%rbp), %rbx
	movq	%rbx, %rdi
	movq	%r12, %rsi
	movl	$2, %edx
	callq	_sprintf
	movq	(%r15), %rax
	movq	(%r14), %rcx
	movq	24(%rcx), %rcx
	movq	(%rax,%rcx,8), %rcx
	leaq	-128(%rbp), %r15
	movq	%r15, %rdi
	movq	%r12, %rsi
	movl	$3, %edx
	callq	_sprintf
	movq	_BACKGROUND@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	L_.str.1(%rip), %rdi
	leaq	-372(%rbp), %rsi
	leaq	-368(%rbp), %rcx
	movq	%r13, %r8
	movq	%rbx, %r9
	pushq	$0
	leaq	L_.str.9(%rip), %rax
	pushq	%rax
	leaq	L_.str.8(%rip), %rax
	pushq	%rax
	leaq	L_.str.2(%rip), %rax
	pushq	%rax
	leaq	L_.str.7(%rip), %rbx
	pushq	%rbx
	pushq	%rax
	leaq	L_.str.6(%rip), %rbx
	pushq	%rbx
	leaq	L_.str.5(%rip), %rbx
	pushq	%rbx
	leaq	L_.str.4(%rip), %rbx
	pushq	%rbx
	leaq	L_.str.3(%rip), %rbx
	pushq	%rbx
	pushq	%rax
	pushq	%r15
	callq	_SelectItem
	addq	$96, %rsp
	movl	%eax, %r14d
	cmpl	$330, %eax                      ## imm = 0x14A
	jle	LBB0_2
## %bb.5:                               ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$331, %r14d                     ## imm = 0x14B
	je	LBB0_9
## %bb.6:                               ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$333, %r14d                     ## imm = 0x14D
	jne	LBB0_18
## %bb.7:                               ##   in Loop: Header=BB0_1 Depth=1
	movslq	-372(%rbp), %rax
	cmpq	$3, %rax
	jg	LBB0_18
## %bb.8:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	_joytypes@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	(%rcx,%rax,8), %rdx
	incq	%rdx
	movq	%rdx, (%rcx,%rax,8)
	movq	_JOYSTICKTYPES@GOTPCREL(%rip), %rsi
	cmpq	(%rsi), %rdx
	movl	$0, %esi
	cmovneq	%rdx, %rsi
	movq	%rsi, (%rcx,%rax,8)
	jmp	LBB0_18
	.p2align	4, 0x90
LBB0_2:                                 ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$13, %r14d
	jne	LBB0_3
## %bb.12:                              ##   in Loop: Header=BB0_1 Depth=1
	movslq	-372(%rbp), %rdi
	cmpq	$3, %rdi
	jg	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_1 Depth=1
	movq	_joytypes@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%rax,%rdi,8), %rcx
	incq	%rcx
	movq	%rcx, (%rax,%rdi,8)
	movq	_JOYSTICKTYPES@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	movl	$0, %edx
	cmovneq	%rcx, %rdx
	movq	%rdx, (%rax,%rdi,8)
	jmp	LBB0_18
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_1 Depth=1
	movslq	-372(%rbp), %rax
	cmpq	$3, %rax
	jg	LBB0_18
## %bb.10:                              ##   in Loop: Header=BB0_1 Depth=1
	movq	_joytypes@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	subq	$1, (%rcx,%rax,8)
	jae	LBB0_18
## %bb.11:                              ##   in Loop: Header=BB0_1 Depth=1
	movq	_JOYSTICKTYPES@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	decq	%rdx
	movq	%rdx, (%rcx,%rax,8)
	jmp	LBB0_18
LBB0_3:                                 ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$27, %r14d
	jne	LBB0_18
	jmp	LBB0_4
LBB0_14:                                ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$8, %edi
	ja	LBB0_16
## %bb.15:                              ##   in Loop: Header=BB0_1 Depth=1
	addl	$-5, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_setupkeyset
	jmp	LBB0_18
LBB0_16:                                ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$10, %edi
	jne	LBB0_18
## %bb.17:                              ##   in Loop: Header=BB0_1 Depth=1
	xorl	%eax, %eax
	callq	_testcollisions
	.p2align	4, 0x90
LBB0_18:                                ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$13, %r14d
	jne	LBB0_1
## %bb.19:                              ##   in Loop: Header=BB0_1 Depth=1
	movl	-372(%rbp), %ecx
	cmpl	$12, %ecx
	jl	LBB0_1
## %bb.20:
	movb	$1, %al
	jmp	LBB0_21
LBB0_4:
	movl	-372(%rbp), %ecx
	xorl	%eax, %eax
LBB0_21:
	cmpl	$12, %ecx
	sete	%cl
	movq	___stack_chk_guard@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	cmpq	-48(%rbp), %rdx
	jne	LBB0_23
## %bb.22:
	andb	%cl, %al
	movzbl	%al, %eax
	addq	$344, %rsp                      ## imm = 0x158
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_23:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Joystick %i: %s"

	.comm	_joysticks,8,3                  ## @joysticks
	.comm	_joytypes,8,3                   ## @joytypes
L_.str.1:                               ## @.str.1
	.asciz	"Select function"

	.comm	_BACKGROUND,4,2                 ## @BACKGROUND
L_.str.2:                               ## @.str.2
	.asciz	"-"

L_.str.3:                               ## @.str.3
	.asciz	"Configure keyset 0"

L_.str.4:                               ## @.str.4
	.asciz	"Configure keyset 1"

L_.str.5:                               ## @.str.5
	.asciz	"Configure keyset 2"

L_.str.6:                               ## @.str.6
	.asciz	"Configure keyset 3"

L_.str.7:                               ## @.str.7
	.asciz	"Test keyboard collisions"

L_.str.8:                               ## @.str.8
	.asciz	"Save and exit"

L_.str.9:                               ## @.str.9
	.asciz	"Exit without saving"

	.comm	_JOYSTICKTYPES,8,3              ## @JOYSTICKTYPES
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mainmenu                       ; -- Begin function mainmenu
	.p2align	2
_mainmenu:                              ; @mainmenu
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	sub	sp, sp, #432
	add	x8, sp, #96
	add	x19, x8, #80
	add	x20, x8, #160
Lloh0:
	adrp	x26, _joysticks@GOTPAGE
Lloh1:
	ldr	x26, [x26, _joysticks@GOTPAGEOFF]
	add	x21, x8, #240
Lloh2:
	adrp	x27, _joytypes@GOTPAGE
Lloh3:
	ldr	x27, [x27, _joytypes@GOTPAGEOFF]
Lloh4:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh5:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh6:
	ldr	x8, [x8]
Lloh7:
	adrp	x22, l_.str@PAGE
Lloh8:
	add	x22, x22, l_.str@PAGEOFF
	stur	x8, [x29, #-96]
	str	wzr, [sp, #92]
Lloh9:
	adrp	x23, l_.str.2@PAGE
Lloh10:
	add	x23, x23, l_.str.2@PAGEOFF
Lloh11:
	adrp	x28, l_.str.3@PAGE
Lloh12:
	add	x28, x28, l_.str.3@PAGEOFF
Lloh13:
	adrp	x24, l_.str.1@PAGE
Lloh14:
	add	x24, x24, l_.str.1@PAGEOFF
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x26]
	ldr	x9, [x27]
	ldr	x9, [x9]
	ldr	x3, [x8, x9, lsl #3]
	add	x0, sp, #96
	mov	x1, x22
	mov	w2, #0
	bl	_sprintf
	ldr	x8, [x26]
	ldr	x9, [x27]
	ldr	x9, [x9, #8]
	ldr	x3, [x8, x9, lsl #3]
	mov	x0, x19
	mov	x1, x22
	mov	w2, #1
	bl	_sprintf
	ldr	x8, [x26]
	ldr	x9, [x27]
	ldr	x9, [x9, #16]
	ldr	x3, [x8, x9, lsl #3]
	mov	x0, x20
	mov	x1, x22
	mov	w2, #2
	bl	_sprintf
	ldr	x8, [x26]
	ldr	x9, [x27]
	ldr	x9, [x9, #24]
	ldr	x3, [x8, x9, lsl #3]
	mov	x0, x21
	mov	x1, x22
	mov	w2, #3
	bl	_sprintf
Lloh15:
	adrp	x8, _BACKGROUND@GOTPAGE
Lloh16:
	ldr	x8, [x8, _BACKGROUND@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
Lloh18:
	adrp	x8, l_.str.9@PAGE
Lloh19:
	add	x8, x8, l_.str.9@PAGEOFF
	stp	x8, xzr, [sp, #64]
Lloh20:
	adrp	x8, l_.str.8@PAGE
Lloh21:
	add	x8, x8, l_.str.8@PAGEOFF
	stp	x23, x8, [sp, #48]
Lloh22:
	adrp	x8, l_.str.7@PAGE
Lloh23:
	add	x8, x8, l_.str.7@PAGEOFF
	stp	x23, x8, [sp, #32]
	add	x1, sp, #92
	add	x3, sp, #96
Lloh24:
	adrp	x8, l_.str.6@PAGE
Lloh25:
	add	x9, x8, l_.str.6@PAGEOFF
Lloh26:
	adrp	x8, l_.str.5@PAGE
Lloh27:
	add	x8, x8, l_.str.5@PAGEOFF
	stp	x8, x9, [sp, #16]
Lloh28:
	adrp	x8, l_.str.4@PAGE
Lloh29:
	add	x8, x8, l_.str.4@PAGEOFF
	stp	x28, x8, [sp]
	mov	x0, x24
	mov	x4, x19
	mov	x5, x20
	mov	x6, x21
	mov	x7, x23
	bl	_SelectItem
	mov	x25, x0
	cmp	w0, #330
	b.le	LBB0_5
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	cmp	w25, #331
	b.eq	LBB0_8
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	cmp	w25, #333
	b.ne	LBB0_16
; %bb.4:                                ;   in Loop: Header=BB0_1 Depth=1
	ldrsw	x8, [sp, #92]
	cmp	w8, #3
	b.le	LBB0_7
	b	LBB0_16
LBB0_5:                                 ;   in Loop: Header=BB0_1 Depth=1
	cmp	w25, #13
	b.ne	LBB0_11
; %bb.6:                                ;   in Loop: Header=BB0_1 Depth=1
	ldrsw	x8, [sp, #92]
	cmp	w8, #3
	b.gt	LBB0_12
LBB0_7:                                 ;   in Loop: Header=BB0_1 Depth=1
	ldr	x9, [x27]
	lsl	x8, x8, #3
	ldr	x10, [x9, x8]
	add	x11, x10, #1
	str	x11, [x9, x8]
Lloh30:
	adrp	x12, _JOYSTICKTYPES@GOTPAGE
Lloh31:
	ldr	x12, [x12, _JOYSTICKTYPES@GOTPAGEOFF]
Lloh32:
	ldr	x12, [x12]
	cmp	x11, x12
	csinc	x10, xzr, x10, eq
	str	x10, [x9, x8]
	b	LBB0_16
LBB0_8:                                 ;   in Loop: Header=BB0_1 Depth=1
	ldrsw	x8, [sp, #92]
	cmp	w8, #3
	b.gt	LBB0_16
; %bb.9:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	x9, [x27]
	lsl	x10, x8, #3
	ldr	x11, [x9, x10]
	sub	x12, x11, #1
	str	x12, [x9, x10]
	cbnz	x11, LBB0_16
; %bb.10:                               ;   in Loop: Header=BB0_1 Depth=1
Lloh33:
	adrp	x10, _JOYSTICKTYPES@GOTPAGE
Lloh34:
	ldr	x10, [x10, _JOYSTICKTYPES@GOTPAGEOFF]
Lloh35:
	ldr	x10, [x10]
	sub	x10, x10, #1
	str	x10, [x9, x8, lsl #3]
	b	LBB0_16
LBB0_11:                                ;   in Loop: Header=BB0_1 Depth=1
	cmp	w25, #27
	b.ne	LBB0_16
	b	LBB0_19
LBB0_12:                                ;   in Loop: Header=BB0_1 Depth=1
	cmp	w8, #8
	b.hi	LBB0_14
; %bb.13:                               ;   in Loop: Header=BB0_1 Depth=1
	sub	w0, w8, #5
	bl	_setupkeyset
	b	LBB0_16
LBB0_14:                                ;   in Loop: Header=BB0_1 Depth=1
	cmp	w8, #10
	b.ne	LBB0_16
; %bb.15:                               ;   in Loop: Header=BB0_1 Depth=1
	bl	_testcollisions
LBB0_16:                                ;   in Loop: Header=BB0_1 Depth=1
	cmp	w25, #13
	b.ne	LBB0_1
; %bb.17:                               ;   in Loop: Header=BB0_1 Depth=1
	ldr	w9, [sp, #92]
	cmp	w9, #12
	b.lt	LBB0_1
; %bb.18:
	mov	w8, #1
	b	LBB0_20
LBB0_19:
	mov	w8, #0
	ldr	w9, [sp, #92]
LBB0_20:
	cmp	w9, #12
	cset	w9, eq
	ldur	x10, [x29, #-96]
Lloh36:
	adrp	x11, ___stack_chk_guard@GOTPAGE
Lloh37:
	ldr	x11, [x11, ___stack_chk_guard@GOTPAGEOFF]
Lloh38:
	ldr	x11, [x11]
	cmp	x11, x10
	b.ne	LBB0_22
; %bb.21:
	and	w0, w8, w9
	add	sp, sp, #432
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_22:
	bl	___stack_chk_fail
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdrp	Lloh24, Lloh26
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Joystick %i: %s"

	.comm	_joysticks,8,3                  ; @joysticks
	.comm	_joytypes,8,3                   ; @joytypes
l_.str.1:                               ; @.str.1
	.asciz	"Select function"

	.comm	_BACKGROUND,4,2                 ; @BACKGROUND
l_.str.2:                               ; @.str.2
	.asciz	"-"

l_.str.3:                               ; @.str.3
	.asciz	"Configure keyset 0"

l_.str.4:                               ; @.str.4
	.asciz	"Configure keyset 1"

l_.str.5:                               ; @.str.5
	.asciz	"Configure keyset 2"

l_.str.6:                               ; @.str.6
	.asciz	"Configure keyset 3"

l_.str.7:                               ; @.str.7
	.asciz	"Test keyboard collisions"

l_.str.8:                               ; @.str.8
	.asciz	"Save and exit"

l_.str.9:                               ; @.str.9
	.asciz	"Exit without saving"

	.comm	_JOYSTICKTYPES,8,3              ; @JOYSTICKTYPES
.subsections_via_symbols
