	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_TuiProcessMenuKeyboardEvent    ## -- Begin function TuiProcessMenuKeyboardEvent
	.p2align	4, 0x90
_TuiProcessMenuKeyboardEvent:           ## @TuiProcessMenuKeyboardEvent
	.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
	movq	%rsi, %r15
	movq	%rdi, %r14
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_MachConsKbHit
	testl	%eax, %eax
	je	LBB0_30
## %bb.1:
	cmpl	$-1, (%r14)
	je	LBB0_3
## %bb.2:
	movl	$-1, (%r14)
	movq	%r14, %rdi
	callq	_TuiDrawMenuBox
LBB0_3:
	xorl	%eax, %eax
	callq	_MachConsGetCh
	movq	%rax, %rbx
	movq	_KEY_EXTENDED@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rbx
	jne	LBB0_5
## %bb.4:
	xorl	%eax, %eax
	callq	_MachConsGetCh
	movq	%rax, %rbx
LBB0_5:
	testq	%r15, %r15
	je	LBB0_8
## %bb.6:
	movq	8(%r14), %rsi
	movl	32(%r14), %edx
	movq	%rbx, %rdi
	callq	*%r15
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	movq	_UiVtbl@GOTPCREL(%rip), %rax
	movq	%r14, %rdi
	callq	*(%rax)
	xorl	%ebx, %ebx
	jmp	LBB0_30
LBB0_8:
	movq	_KEY_UP@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	_KEY_DOWN@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	_KEY_HOME@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_KEY_END@GOTPCREL(%rip), %rsi
	movq	(%rsi), %rsi
	cmpq	%rdx, %rbx
	je	LBB0_12
## %bb.9:
	cmpq	%rcx, %rbx
	je	LBB0_12
## %bb.10:
	cmpq	%rax, %rbx
	je	LBB0_12
## %bb.11:
	cmpq	%rsi, %rbx
	jne	LBB0_30
LBB0_12:
	movq	8(%r14), %r15
	movq	16(%r14), %r12
	cmpq	%rdx, %rbx
	jne	LBB0_17
## %bb.13:
	testq	%r15, %r15
	jle	LBB0_17
## %bb.14:
	leaq	-1(%r15), %rax
	movq	%rax, 8(%r14)
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_TuiDrawMenuItem
	cmpq	$2, %r15
	jb	LBB0_29
## %bb.15:
	movq	24(%r14), %rax
	cmpq	$0, -8(%rax,%r15,8)
	jne	LBB0_29
## %bb.16:
	decq	8(%r14)
	jmp	LBB0_29
LBB0_17:
	decq	%r12
	xorq	%rbx, %rdx
	orq	%r15, %rdx
	je	LBB0_19
## %bb.18:
	cmpq	%rsi, %rbx
	je	LBB0_19
## %bb.20:
	cmpq	%rcx, %rbx
	jne	LBB0_25
## %bb.21:
	cmpq	%r12, %r15
	jge	LBB0_25
## %bb.22:
	leaq	1(%r15), %r13
	movq	%r13, 8(%r14)
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_TuiDrawMenuItem
	cmpq	%r12, %r13
	jge	LBB0_29
## %bb.23:
	movq	24(%r14), %rax
	cmpq	$0, 8(%rax,%r15,8)
	jne	LBB0_29
## %bb.24:
	incq	8(%r14)
	jmp	LBB0_29
LBB0_19:
	movq	%r12, 8(%r14)
LBB0_28:
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_TuiDrawMenuItem
LBB0_29:
	movq	8(%r14), %rsi
	movq	%r14, %rdi
	callq	_TuiDrawMenuItem
	xorl	%eax, %eax
	callq	_VideoCopyOffScreenBufferToVRAM
LBB0_30:
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_25:
	xorq	%rbx, %rcx
	xorq	%r15, %r12
	orq	%rcx, %r12
	je	LBB0_27
## %bb.26:
	cmpq	%rax, %rbx
	jne	LBB0_29
LBB0_27:
	movq	$0, 8(%r14)
	jmp	LBB0_28
	.cfi_endproc
                                        ## -- End function
	.comm	_KEY_EXTENDED,8,3               ## @KEY_EXTENDED
	.comm	_UiVtbl,8,3                     ## @UiVtbl
	.comm	_KEY_UP,8,3                     ## @KEY_UP
	.comm	_KEY_DOWN,8,3                   ## @KEY_DOWN
	.comm	_KEY_HOME,8,3                   ## @KEY_HOME
	.comm	_KEY_END,8,3                    ## @KEY_END
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_TuiProcessMenuKeyboardEvent    ; -- Begin function TuiProcessMenuKeyboardEvent
	.p2align	2
_TuiProcessMenuKeyboardEvent:           ; @TuiProcessMenuKeyboardEvent
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x21, x1
	mov	x19, x0
	bl	_MachConsKbHit
	cbz	w0, LBB0_13
; %bb.1:
	ldr	w8, [x19]
	cmn	w8, #1
	b.eq	LBB0_3
; %bb.2:
	mov	w8, #-1
	str	w8, [x19]
	mov	x0, x19
	bl	_TuiDrawMenuBox
LBB0_3:
	bl	_MachConsGetCh
	mov	x20, x0
Lloh0:
	adrp	x8, _KEY_EXTENDED@GOTPAGE
Lloh1:
	ldr	x8, [x8, _KEY_EXTENDED@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_5
; %bb.4:
	bl	_MachConsGetCh
	mov	x20, x0
LBB0_5:
	cbz	x21, LBB0_8
; %bb.6:
	ldr	x1, [x19, #8]
	ldr	w2, [x19, #32]
	mov	x0, x20
	blr	x21
	cbz	x0, LBB0_8
; %bb.7:
Lloh3:
	adrp	x8, _UiVtbl@GOTPAGE
Lloh4:
	ldr	x8, [x8, _UiVtbl@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	mov	x0, x19
	blr	x8
	mov	x20, #0
	b	LBB0_26
LBB0_8:
Lloh6:
	adrp	x8, _KEY_UP@GOTPAGE
Lloh7:
	ldr	x8, [x8, _KEY_UP@GOTPAGEOFF]
Lloh8:
	adrp	x9, _KEY_DOWN@GOTPAGE
Lloh9:
	ldr	x9, [x9, _KEY_DOWN@GOTPAGEOFF]
Lloh10:
	ldr	x10, [x8]
Lloh11:
	ldr	x9, [x9]
Lloh12:
	adrp	x8, _KEY_HOME@GOTPAGE
Lloh13:
	ldr	x8, [x8, _KEY_HOME@GOTPAGEOFF]
Lloh14:
	adrp	x11, _KEY_END@GOTPAGE
Lloh15:
	ldr	x11, [x11, _KEY_END@GOTPAGEOFF]
Lloh16:
	ldr	x8, [x8]
Lloh17:
	ldr	x11, [x11]
	cmp	x20, x10
	ccmp	x20, x9, #4, ne
	ccmp	x20, x8, #4, ne
	ccmp	x20, x11, #4, ne
	b.ne	LBB0_26
; %bb.9:
	ldr	x21, [x19, #8]
	cmp	x20, x10
	ccmp	x21, #1, #8, eq
	b.ge	LBB0_14
; %bb.10:
	ldr	x12, [x19, #16]
	sub	x22, x12, #1
	cmp	x21, #0
	ccmp	x20, x10, #0, eq
	ccmp	x20, x11, #4, ne
	b.ne	LBB0_17
; %bb.11:
	str	x22, [x19, #8]
LBB0_12:
	mov	x0, x19
	mov	x1, x21
	bl	_TuiDrawMenuItem
	b	LBB0_25
LBB0_13:
	mov	x20, #0
	b	LBB0_26
LBB0_14:
	sub	x22, x21, #1
	str	x22, [x19, #8]
	mov	x0, x19
	mov	x1, x21
	bl	_TuiDrawMenuItem
	cmp	x21, #2
	b.lo	LBB0_25
; %bb.15:
	ldr	x8, [x19, #24]
	ldr	x8, [x8, x22, lsl #3]
	cbnz	x8, LBB0_25
; %bb.16:
	ldr	x8, [x19, #8]
	sub	x8, x8, #1
	b	LBB0_24
LBB0_17:
	cmp	x20, x9
	ccmp	x21, x22, #0, eq
	b.lt	LBB0_21
; %bb.18:
	cmp	x21, x22
	ccmp	x20, x9, #0, eq
	b.eq	LBB0_20
; %bb.19:
	cmp	x20, x8
	b.ne	LBB0_25
LBB0_20:
	str	xzr, [x19, #8]
	b	LBB0_12
LBB0_21:
	add	x23, x21, #1
	str	x23, [x19, #8]
	mov	x0, x19
	mov	x1, x21
	bl	_TuiDrawMenuItem
	cmp	x23, x22
	b.ge	LBB0_25
; %bb.22:
	ldr	x8, [x19, #24]
	ldr	x8, [x8, x23, lsl #3]
	cbnz	x8, LBB0_25
; %bb.23:
	ldr	x8, [x19, #8]
	add	x8, x8, #1
LBB0_24:
	str	x8, [x19, #8]
LBB0_25:
	ldr	x1, [x19, #8]
	mov	x0, x19
	bl	_TuiDrawMenuItem
	bl	_VideoCopyOffScreenBufferToVRAM
LBB0_26:
	mov	x0, x20
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh16
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_KEY_EXTENDED,8,3               ; @KEY_EXTENDED
	.comm	_UiVtbl,8,3                     ; @UiVtbl
	.comm	_KEY_UP,8,3                     ; @KEY_UP
	.comm	_KEY_DOWN,8,3                   ; @KEY_DOWN
	.comm	_KEY_HOME,8,3                   ; @KEY_HOME
	.comm	_KEY_END,8,3                    ; @KEY_END
.subsections_via_symbols
