// File: /workspace/github_c_makefile_star2_O2/QwazyWabbitWOS[P]lmctf60/g_menu.c
// Function: Menu_Draw
void Menu_Draw (edict_t *ent)
{
	char line[MAX_INFO_STRING], string[2000];
	int i;
	menuitem *menu;
	int size, ystart;

	int selected;

	// Keep from updating the menu more than once per frame
	// Paril: unless we're paused, in which case...
	if (ent->client->menumovetime == level.framenum && !GamePaused())
		return;

	ent->client->menumovetime = level.framenum;

	gi.WriteByte (svc_layout);
	strcpy(string, "xv 32 yv 8 picn inventory ");

	if (ent->client->menu == MENU_LOCAL) // Special case
	{
		menu = ent->client->localmenu;
		size = 18;
		ystart = 32; // Start one line up from static menu
	}
	else // Static menu
	{
		menu = menulist[ent->client->menu].menu;
		size = menulist[ent->client->menu].size;
		if (size < 18)
			ystart = 40; // Start one line down from local menu
		else
			ystart = 32;
	}

	// Validate our highlighed selection
	while (!menu[ent->client->menuselect].func)
		ent->client->menuselect = (ent->client->menuselect + 1) % size;
	selected = ent->client->menuselect;

	for (i=0 ; i<size ; i++)
	{
		if (!menu[i].text)
			continue;
		if (i == selected)
		{
			Com_sprintf(line, sizeof(line),
				"xv %i yv %i string \"\x0d%s\" ",
				55, ystart + (i * 8), menu[i].text );
		}
		else
		{
			Com_sprintf(line, sizeof(line),
				"xv %i yv %i string2 \" %s\" ",
				55, ystart + (i * 8), menu[i].text );
		}
		strcat(string, line);
	}

	gi.WriteString (string);
	// Paril
	gi.unicast (ent, true);
	// Paril
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x9f8, %rsp            # imm = 0x9F8
movq %rdi, %r14
movq 0x58(%rdi), %rax
movq 0x4c5ba(%rip), %rbx     # 0x66da0
movl (%rbx), %ecx
cmpl %ecx, 0x10c8(%rax)
jne 0x1a805
xorl %eax, %eax
callq 0x18160
testl %eax, %eax
je 0x1a953
movl (%rbx), %ecx
movq 0x58(%r14), %rax
movl %ecx, 0x10c8(%rax)
movq 0x4bdee(%rip), %rax     # 0x66600
pushq $0x4
popq %rdi
callq *0xc8(%rax)
movups 0x3462c(%rip), %xmm0    # 0x4ee4e
movups %xmm0, 0x2b(%rsp)
movups 0x34615(%rip), %xmm0    # 0x4ee43
movaps %xmm0, 0x20(%rsp)
movq %r14, 0x18(%rsp)
movq 0x58(%r14), %rcx
movslq 0xf84(%rcx), %rax
testq %rax, %rax
je 0x1a872
shlq $0x4, %rax
movq 0x4c275(%rip), %rdx     # 0x66ac8
movq (%rdx,%rax), %r14
movl 0x8(%rdx,%rax), %ebx
xorl %eax, %eax
cmpl $0x12, %ebx
setl %al
leaq 0x20(,%rax,8), %rax
movq %rax, 0x8(%rsp)
jmp 0x1a884
leaq 0xf90(%rcx), %r14
pushq $0x20
popq %rax
movq %rax, 0x8(%rsp)
pushq $0x12
popq %rbx
movl 0xf88(%rcx), %eax
movslq %eax, %rdx
shlq $0x4, %rdx
cmpq $0x0, 0x8(%r14,%rdx)
jne 0x1a8a8
incl %eax
cltd
idivl %ebx
movl %edx, %eax
movl %edx, 0xf88(%rcx)
jmp 0x1a88a
movl %eax, %ebp
xorl %eax, %eax
testl %ebx, %ebx
cmovlel %eax, %ebx
shlq $0x3, %rbp
movq 0x8(%rsp), %rax
addl %ebp, %eax
movl %eax, 0x14(%rsp)
shlq $0x3, %rbx
leaq 0x7f0(%rsp), %r15
leaq 0x20(%rsp), %r13
xorl %r12d, %r12d
cmpq %r12, %rbx
je 0x1a933
movq (%r14,%r12,2), %r9
testq %r9, %r9
je 0x1a92d
cmpq %r12, %rbp
jne 0x1a900
movq %r15, %rdi
movl $0x200, %esi            # imm = 0x200
leaq 0x34568(%rip), %rdx     # 0x4ee5e
pushq $0x37
popq %rcx
movl 0x14(%rsp), %r8d
jmp 0x1a91b
movq 0x8(%rsp), %rax
leal (%rax,%r12), %r8d
movq %r15, %rdi
movl $0x200, %esi            # imm = 0x200
leaq 0x34560(%rip), %rdx     # 0x4ee78
pushq $0x37
popq %rcx
xorl %eax, %eax
callq 0x18f30
movq %r13, %rdi
movq %r15, %rsi
callq 0x19800
addq $0x8, %r12
jmp 0x1a8d4
leaq 0x20(%rsp), %rdi
movq 0x4bcc1(%rip), %rbx     # 0x66600
callq *0xe8(%rbx)
pushq $0x1
popq %rsi
movq 0x18(%rsp), %rdi
callq *0xb8(%rbx)
addq $0x9f8, %rsp            # imm = 0x9F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq