// File: /workspace/github_c_makefile_star2_O3/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 0x4e095(%rip), %rbx     # 0x68da0
movl (%rbx), %ecx
cmpl %ecx, 0x10c8(%rax)
jne 0x1ad2a
xorl %eax, %eax
callq 0x18160
testl %eax, %eax
je 0x1ae95
movl (%rbx), %ecx
movq 0x58(%r14), %rax
movl %ecx, 0x10c8(%rax)
movq 0x4d8c9(%rip), %rax     # 0x68600
movl $0x4, %edi
callq *0xc8(%rax)
movups 0x38105(%rip), %xmm0    # 0x52e4e
movups %xmm0, 0x2b(%rsp)
movups 0x380ee(%rip), %xmm0    # 0x52e43
movaps %xmm0, 0x20(%rsp)
movq 0x58(%r14), %rcx
movslq 0xf84(%rcx), %rax
testq %rax, %rax
je 0x1ad94
shlq $0x4, %rax
movq 0x4dd53(%rip), %rdx     # 0x68ac8
movq (%rdx,%rax), %rbx
movl 0x8(%rdx,%rax), %esi
xorl %eax, %eax
cmpl $0x12, %esi
setl %al
leaq 0x20(,%rax,8), %rax
movq %rax, 0x8(%rsp)
jmp 0x1adaa
leaq 0xf90(%rcx), %rbx
movl $0x20, %eax
movq %rax, 0x8(%rsp)
movl $0x12, %esi
movslq 0xf88(%rcx), %rdx
movq %rdx, %rax
shlq $0x4, %rax
cmpq $0x0, 0x8(%rbx,%rax)
movq %r14, 0x18(%rsp)
jne 0x1ade1
incl %edx
movl %edx, %eax
cltd
idivl %esi
movslq %edx, %rax
shlq $0x4, %rax
cmpq $0x0, 0x8(%rbx,%rax)
je 0x1adc5
movl %edx, 0xf88(%rcx)
testl %esi, %esi
jle 0x1ae73
movl %edx, %r13d
movl %esi, %r14d
shlq $0x3, %r13
movq 0x8(%rsp), %rax
addl %r13d, %eax
movl %eax, 0x14(%rsp)
shlq $0x3, %r14
leaq 0x7f0(%rsp), %r15
leaq 0x20(%rsp), %r12
xorl %ebp, %ebp
movq (%rbx,%rbp,2), %r9
testq %r9, %r9
je 0x1ae6a
cmpq %rbp, %r13
jne 0x1ae3b
movq %r15, %rdi
movl $0x200, %esi            # imm = 0x200
leaq 0x3802f(%rip), %rdx     # 0x52e5e
movl $0x37, %ecx
movl 0x14(%rsp), %r8d
jmp 0x1ae58
movq 0x8(%rsp), %rax
leal (%rax,%rbp), %r8d
movq %r15, %rdi
movl $0x200, %esi            # imm = 0x200
leaq 0x38025(%rip), %rdx     # 0x52e78
movl $0x37, %ecx
xorl %eax, %eax
callq 0x18e10
movq %r12, %rdi
movq %r15, %rsi
callq 0x19640
addq $0x8, %rbp
cmpq %rbp, %r14
jne 0x1ae12
leaq 0x20(%rsp), %rdi
movq 0x4d781(%rip), %rbx     # 0x68600
callq *0xe8(%rbx)
movq 0x18(%rsp), %rdi
movl $0x1, %esi
callq *0xb8(%rbx)
addq $0x9f8, %rsp            # imm = 0x9F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq