// File: /workspace/github_c_makefile_star2_O2/QwazyWabbitWOS[P]lmctf60/p_hud.c
// Function: G_SetStats
void G_SetStats (edict_t *ent)
{
    gitem_t     *item;
    int         index, cells=0;
    int         power_armor_type;

    // TEAM PLAY -- LM_JORM
    char        *s;
    char        portrait[MAX_INFO_STRING];

int Red_Caps = 0;
int Blue_Caps = 0;
int i;
edict_t     *cl_ent;

#ifdef OLDOBSERVERCODE   
    if (ent->client->camera_target &&
        ent->client->camera_target->client)
    {
        memcpy(&ent->client->ps.stats, &ent->client->camera_target->client->ps.stats, sizeof(short)*MAX_STATS);
        ent->client->ps.stats[STAT_FRAGS] = 0;
    }
    else
#endif
    {
        ent->client->ps.stats[STAT_RED_FRAGS] = redscore;
        ent->client->ps.stats[STAT_BLUE_FRAGS] = bluescore;
		
		//bat - This should be global. :/
		for(i = 0 ; i < game.maxclients; i++)
		{
	        cl_ent = g_edicts + 1 + i;
			if(!cl_ent->inuse)
			    continue;

			if(cl_ent->client->ctf.teamnum == CTF_TEAM_RED)
				Red_Caps  += stats_get(cl_ent, STATS_CAPTURES);
	        else if(cl_ent->client->ctf.teamnum == CTF_TEAM_BLUE)
				Blue_Caps  += stats_get(cl_ent, STATS_CAPTURES);
		}
        
		ent->client->ps.stats[STAT_RED_CAPS] = Red_Caps;
		ent->client->ps.stats[STAT_BLUE_CAPS] = Blue_Caps;
		ent->client->ps.stats[STAT_MATCH_TIME] = Time_Left;
        


        //s = Info_ValueForKey (ent->client->pers.userinfo, "skin");
        
        // decide gender
        
        /*
        if (s[0] == 'f' || s[0] == 'F') // Female
        {
        if (ent->client->teamnum == 1)
        ent->client->ps.stats[STAT_TEAM_ICON] = gi.imageindex ("../players/female/red_i");
        
         if (ent->client->teamnum == 2)
         ent->client->ps.stats[STAT_TEAM_ICON] = gi.imageindex ("../players/female/blue_i");
         }
         else // male
         {
         if (ent->client->teamnum == 1)
         ent->client->ps.stats[STAT_TEAM_ICON] = gi.imageindex ("../players/male/red_i");
         
          if (ent->client->teamnum == 2)
          ent->client->ps.stats[STAT_TEAM_ICON] = gi.imageindex ("../players/male/blue_i");
          }
        */
        
        
        s = Info_ValueForKey (ent->client->pers.userinfo, "skin");
        s = strchr(s, '/');
        if (s && strlen(s) > 0)
        {
            s++;
            strcpy(portrait, s);
            strcat(portrait, "_i");
        }
        else
        {
            strcpy(portrait, "redlion_i");
        }
        
        
        switch (ent->client->ctf.compass)
        {
        default:
        case 0:
            if (redflag && (redflag->owner == ent))
                ent->client->ps.stats[STAT_TEAM_ICON] = gi.imageindex ("redflaggone");
            else if (blueflag && (blueflag->owner == ent))
                ent->client->ps.stats[STAT_TEAM_ICON] = gi.imageindex ("blueflaggone");
            else
                ent->client->ps.stats[STAT_TEAM_ICON] = gi.imageindex (portrait);
            break;
        case 1:
            ent->client->ps.stats[STAT_TEAM_ICON] = gi.imageindex (ctf_facing(ent));
            break;
        case 2:
            ent->client->ps.stats[STAT_TEAM_ICON] = gi.imageindex (ctf_faceNorth(ent));
            break;
        case 3:
            ent->client->ps.stats[STAT_TEAM_ICON] = gi.imageindex (ctf_faceEnemyFlag(ent));
            break;
        }
        
        
        // Show status of the red flag
        if (redflag)
        {
            if (redflag->owner)
                ent->client->ps.stats[STAT_RED_ICON] = gi.imageindex ("redflaggone");
            else if (!ctf_flagathome(redflag))
                ent->client->ps.stats[STAT_RED_ICON] = gi.imageindex ("redflagdown");
            else
                ent->client->ps.stats[STAT_RED_ICON] = gi.imageindex ("redlion_i");
        }
        
        if (blueflag)
        {
            if (blueflag->owner)
                ent->client->ps.stats[STAT_BLUE_ICON] = gi.imageindex ("blueflaggone");
            else if (!ctf_flagathome(blueflag))
                ent->client->ps.stats[STAT_BLUE_ICON] = gi.imageindex ("blueflagdown");
            else
                ent->client->ps.stats[STAT_BLUE_ICON] = gi.imageindex ("bluewolf_i");
        }
        
        if (ent->client->rune)
        {
            if (ent->client->rune->runetype == RUNE_DAMAGE)
                ent->client->ps.stats[STAT_RUNE_ICON] = gi.imageindex ("strength");
            if (ent->client->rune->runetype == RUNE_RESIST)
                ent->client->ps.stats[STAT_RUNE_ICON] = gi.imageindex ("resist");
            if (ent->client->rune->runetype == RUNE_HASTE)
                ent->client->ps.stats[STAT_RUNE_ICON] = gi.imageindex ("haste");
            if (ent->client->rune->runetype == RUNE_REGEN)
                ent->client->ps.stats[STAT_RUNE_ICON] = gi.imageindex ("regen");
			if (ent->client->rune->runetype == RUNE_VAMP)                          //added by Vampire
                ent->client->ps.stats[STAT_RUNE_ICON] = gi.imageindex ("k_redkey");
                //ent->client->ps.stats[STAT_RUNE_ICON] = gi.imageindex ("resist");    
        }
        else
            ent->client->ps.stats[STAT_RUNE_ICON] = 0;
        
        // END CTF CODE -- LM_JORM
        
        //
        // health
        //
        ent->client->ps.stats[STAT_HEALTH_ICON] = level.pic_health;
        ent->client->ps.stats[STAT_HEALTH] = ent->health;
        
        //
        // ammo
        //
        if (!ent->client->ammo_index /* || !ent->client->pers.inventory[ent->client->ammo_index] */)
        {
            ent->client->ps.stats[STAT_AMMO_ICON] = 0;
            ent->client->ps.stats[STAT_AMMO] = 0;
        }
        else
        {
            item = &itemlist[ent->client->ammo_index];
            ent->client->ps.stats[STAT_AMMO_ICON] = gi.imageindex (item->icon);
            ent->client->ps.stats[STAT_AMMO] = ent->client->pers.inventory[ent->client->ammo_index];
        }
        
        //
        // armor
        //
        power_armor_type = PowerArmorType (ent);
        if (power_armor_type)
        {
            cells = ent->client->pers.inventory[ITEM_INDEX(FindItem ("cells"))];
            if (cells == 0)
            {   // ran out of cells for power armor
                ent->flags &= ~FL_POWER_ARMOR;
                gi.sound(ent, CHAN_ITEM, gi.soundindex("misc/power2.wav"), 1, ATTN_NORM, 0);
                power_armor_type = 0;;
            }
        }
        
        index = ArmorIndex (ent);
        if (power_armor_type && (!index || (level.framenum & 8) ) )
        {   // flash between power armor and other armor icon
            ent->client->ps.stats[STAT_ARMOR_ICON] = gi.imageindex ("i_powershield");
            ent->client->ps.stats[STAT_ARMOR] = cells;
        }
        else if (index)
        {
            item = GetItemByIndex (index);
            ent->client->ps.stats[STAT_ARMOR_ICON] = gi.imageindex (item->icon);
            ent->client->ps.stats[STAT_ARMOR] = ent->client->pers.inventory[index];
        }
        else
        {
            ent->client->ps.stats[STAT_ARMOR_ICON] = 0;
            ent->client->ps.stats[STAT_ARMOR] = 0;
        }
        
        //
        // pickup message
        //
        if (level.time > ent->client->pickup_msg_time)
        {
            ent->client->ps.stats[STAT_PICKUP_ICON] = 0;
            ent->client->ps.stats[STAT_PICKUP_STRING] = 0;
        }
        
        //
        // timers
        //
        if (ent->client->quad_framenum > level.framenum)
        {
            ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("p_quad");
            ent->client->ps.stats[STAT_TIMER] = (ent->client->quad_framenum - level.framenum)/10;
        }
        else if (ent->client->invincible_framenum > level.framenum)
        {
            ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("p_invulnerability");
            ent->client->ps.stats[STAT_TIMER] = (ent->client->invincible_framenum - level.framenum)/10;
        }
        else if (ent->client->enviro_framenum > level.framenum)
        {
            ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("p_envirosuit");
            ent->client->ps.stats[STAT_TIMER] = (ent->client->enviro_framenum - level.framenum)/10;
        }
        else if (ent->client->breather_framenum > level.framenum)
        {
            ent->client->ps.stats[STAT_TIMER_ICON] = gi.imageindex ("p_rebreather");
            ent->client->ps.stats[STAT_TIMER] = (ent->client->breather_framenum - level.framenum)/10;
        }
        else
        {
            ent->client->ps.stats[STAT_TIMER_ICON] = 0;
            ent->client->ps.stats[STAT_TIMER] = 0;
        }
        
        //
        // selected item
        //
        
        // Show proper flag item
        if (ent->client->pers.selected_item == -1)
            ent->client->ps.stats[STAT_SELECTED_ICON] = 0;
        else
        {
            if (blueflag && blueflag->item == &itemlist[ent->client->pers.selected_item])
            {
                ent->client->ps.stats[STAT_SELECTED_ICON] = gi.imageindex ("a_blueflag");
            }
            else if (redflag && redflag->item == &itemlist[ent->client->pers.selected_item])
            {
                ent->client->ps.stats[STAT_SELECTED_ICON] = gi.imageindex ("a_redflag");            
            }
            else
            {
                ent->client->ps.stats[STAT_SELECTED_ICON] = gi.imageindex (itemlist[ent->client->pers.selected_item].icon);
                
            }
        }
        
        ent->client->ps.stats[STAT_SELECTED_ITEM] = ent->client->pers.selected_item;
        
        //
        // frags
        //
        ent->client->ps.stats[STAT_FRAGS] = stats_get(ent, STATS_SCORE);
        
        //
        // help icon / current weapon if not shown
        //
        if (ent->client->pers.helpchanged && (level.framenum&8) )
            ent->client->ps.stats[STAT_HELPICON] = gi.imageindex ("i_help");
        else if ( (ent->client->pers.hand == CENTER_HANDED || ent->client->ps.fov > 91)
            && ent->client->pers.weapon)
            ent->client->ps.stats[STAT_HELPICON] = gi.imageindex (ent->client->pers.weapon->icon);
        else
            ent->client->ps.stats[STAT_HELPICON] = 0;
    }

    //
    // layouts
    //
    ent->client->ps.stats[STAT_LAYOUTS] = 0;

    if (deathmatch->value)
    {
        if (ent->client->pers.health <= 0 || level.intermissiontime
            || ent->client->showscores || ent->client->showctfhud 
            || ent->client->showmod || ent->client->showmenu
			|| ent->client->showsquadboard) // ADC
            ent->client->ps.stats[STAT_LAYOUTS] |= 1;
        if (ent->client->showinventory && ent->client->pers.health > 0)
            ent->client->ps.stats[STAT_LAYOUTS] |= 2;
    }
    else
    {
        if (ent->client->showscores || ent->client->showhelp
            || ent->client->showctfhud || ent->client->showmod
			|| ent->client->showsquadboard) // ADC
            ent->client->ps.stats[STAT_LAYOUTS] |= 1;
        if (ent->client->showinventory && ent->client->pers.health > 0)
            ent->client->ps.stats[STAT_LAYOUTS] |= 2;
    }

    // LM_JORM -- Turn CTF HUD back on automatically
    /*
    if ((level.framenum - ent->client->awayframe > 10) &&
        !ent->client->showmenu)
        ent->client->showctfhud = true;
    */

	ent->client->ps.stats[STAT_SPECTATOR] = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq 0x21a3b(%rip), %rax     # 0x66bd8
movzwl (%rax), %eax
movq %rdi, 0x8(%rsp)
movq 0x58(%rdi), %rcx
movw %ax, 0x9e(%rcx)
movq 0x21891(%rip), %rax     # 0x66a48
movzwl (%rax), %eax
movw %ax, 0xa0(%rcx)
movl $0x4a8, %r14d           # imm = 0x4A8
xorl %r15d, %r15d
movq 0x21b6f(%rip), %r12     # 0x66d40
movq 0x21380(%rip), %r13     # 0x66558
xorl %ebp, %ebp
xorl %ebx, %ebx
movslq 0x610(%r12), %rax
cmpq %rax, %r15
jge 0x4522f
movq (%r13), %rdi
cmpl $0x0, 0x60(%rdi,%r14)
je 0x45223
movq 0x58(%rdi,%r14), %rax
addq %r14, %rdi
movl 0x1100(%rax), %eax
cmpl $0x2, %eax
je 0x45219
cmpl $0x1, %eax
jne 0x45223
pushq $0x4
popq %rsi
callq 0x18030
addl %eax, %ebp
jmp 0x45223
pushq $0x4
popq %rsi
callq 0x18030
addl %eax, %ebx
incq %r15
addq $0x4a8, %r14            # imm = 0x4A8
jmp 0x451dc
movq 0x8(%rsp), %r13
movq 0x58(%r13), %rdi
movw %bp, 0xa8(%rdi)
movw %bx, 0xaa(%rdi)
movq 0x219b3(%rip), %rax     # 0x66c00
movzwl (%rax), %eax
movw %ax, 0xac(%rdi)
addq $0xc0, %rdi
leaq 0x90db(%rip), %rsi      # 0x4e340
callq 0x18c70
pushq $0x2f
popq %rsi
movq %rax, %rdi
callq 0x18780
testq %rax, %rax
je 0x452a8
cmpb $0x0, (%rax)
je 0x452a8
incq %rax
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x182c0
movq %r14, %rdi
callq 0x186c0
movw $0x695f, 0x10(%rsp,%rax) # imm = 0x695F
movb $0x0, 0x12(%rsp,%rax)
jmp 0x452be
movabsq $0x5f6e6f696c646572, %rax # imm = 0x5F6E6F696C646572
movq %rax, 0x10(%rsp)
movw $0x69, 0x18(%rsp)
movq 0x58(%r13), %rax
movl 0x1118(%rax), %eax
cmpl $0x1, %eax
je 0x45301
cmpl $0x2, %eax
je 0x452ec
cmpl $0x3, %eax
jne 0x4531b
movq 0x21322(%rip), %rax     # 0x66600
movq 0x50(%rax), %rbx
movq %r13, %rdi
callq 0x19950
jmp 0x45314
movq 0x2130d(%rip), %rax     # 0x66600
movq 0x50(%rax), %rbx
movq %r13, %rdi
callq 0x19000
jmp 0x45314
movq 0x212f8(%rip), %rax     # 0x66600
movq 0x50(%rax), %rbx
movq %r13, %rdi
callq 0x18b00
movq %rax, %rdi
callq *%rbx
jmp 0x4537a
movq 0x214d6(%rip), %rax     # 0x667f8
movq (%rax), %rax
testq %rax, %rax
je 0x45333
cmpq %r13, 0x110(%rax)
je 0x45359
movq 0x21526(%rip), %rax     # 0x66860
movq (%rax), %rax
testq %rax, %rax
je 0x4534b
cmpq %r13, 0x110(%rax)
je 0x45369
movq 0x212ae(%rip), %rax     # 0x66600
leaq 0x10(%rsp), %rdi
jmp 0x45377
movq 0x212a0(%rip), %rax     # 0x66600
leaq 0xa4e6(%rip), %rdi      # 0x4f84d
jmp 0x45377
movq 0x21290(%rip), %rax     # 0x66600
leaq 0xa4c9(%rip), %rdi      # 0x4f840
callq *0x50(%rax)
movq 0x58(%r13), %rcx
movw %ax, 0x9c(%rcx)
movq 0x2146c(%rip), %r14     # 0x667f8
movq (%r14), %rdi
testq %rdi, %rdi
je 0x453e2
cmpq $0x0, 0x110(%rdi)
je 0x453b1
movq 0x2125b(%rip), %rax     # 0x66600
leaq 0xa4a1(%rip), %rdi      # 0x4f84d
callq *0x50(%rax)
jmp 0x453d7
callq 0x195d0
movq 0x21243(%rip), %rcx     # 0x66600
movq 0x50(%rcx), %rcx
testl %eax, %eax
je 0x453ce
leaq 0x11546(%rip), %rdi     # 0x56912
jmp 0x453d5
leaq 0x1172e(%rip), %rdi     # 0x56b03
callq *%rcx
movq 0x58(%r13), %rcx
movw %ax, 0xa2(%rcx)
movq 0x21477(%rip), %r15     # 0x66860
movq (%r15), %rdi
testq %rdi, %rdi
je 0x4543f
cmpq $0x0, 0x110(%rdi)
je 0x4540e
movq 0x211fe(%rip), %rax     # 0x66600
leaq 0xa437(%rip), %rdi      # 0x4f840
callq *0x50(%rax)
jmp 0x45434
callq 0x195d0
movq 0x211e6(%rip), %rcx     # 0x66600
movq 0x50(%rcx), %rcx
testl %eax, %eax
je 0x4542b
leaq 0x114f3(%rip), %rdi     # 0x5691c
jmp 0x45432
leaq 0x116dd(%rip), %rdi     # 0x56b0f
callq *%rcx
movq 0x58(%r13), %rcx
movw %ax, 0xa4(%rcx)
movq 0xf68(%rcx), %rax
testq %rax, %rax
je 0x45529
movl 0x478(%rax), %eax
cmpl $0x1, %eax
jne 0x45483
movq 0x2119f(%rip), %rax     # 0x66600
leaq 0xdcad(%rip), %rdi      # 0x53115
callq *0x50(%rax)
movq 0x58(%r13), %rcx
movw %ax, 0xa6(%rcx)
movq 0xf68(%rcx), %rax
movl 0x478(%rax), %eax
cmpl $0x2, %eax
jne 0x454b1
movq 0x21171(%rip), %rax     # 0x66600
leaq 0xdc9a(%rip), %rdi      # 0x53130
callq *0x50(%rax)
movq 0x58(%r13), %rcx
movw %ax, 0xa6(%rcx)
movq 0xf68(%rcx), %rax
movl 0x478(%rax), %eax
cmpl $0x4, %eax
jne 0x454df
movq 0x21143(%rip), %rax     # 0x66600
leaq 0xdc85(%rip), %rdi      # 0x53149
callq *0x50(%rax)
movq 0x58(%r13), %rcx
movw %ax, 0xa6(%rcx)
movq 0xf68(%rcx), %rax
movl 0x478(%rax), %eax
cmpl $0x8, %eax
jne 0x4550d
movq 0x21115(%rip), %rax     # 0x66600
leaq 0xdc6e(%rip), %rdi      # 0x53160
callq *0x50(%rax)
movq 0x58(%r13), %rcx
movw %ax, 0xa6(%rcx)
movq 0xf68(%rcx), %rax
movl 0x478(%rax), %eax
cmpl $0x10, %eax
jne 0x45532
movq 0x210e7(%rip), %rax     # 0x66600
leaq 0xda43(%rip), %rdi      # 0x52f63
callq *0x50(%rax)
movq 0x58(%r13), %rcx
jmp 0x4552b
xorl %eax, %eax
movw %ax, 0xa6(%rcx)
movq 0x21867(%rip), %r12     # 0x66da0
movzwl 0x12c(%r12), %eax
movw %ax, 0x78(%rcx)
movzwl 0x254(%r13), %eax
movw %ax, 0x7a(%rcx)
movslq 0xe38(%rcx), %rax
testq %rax, %rax
je 0x45594
movq 0x2109b(%rip), %rcx     # 0x66600
imulq $0x88, %rax, %rax
movq 0x218cd(%rip), %rdx     # 0x66e40
movq 0x48(%rdx,%rax), %rdi
callq *0x50(%rcx)
movq 0x58(%r13), %rcx
movw %ax, 0x7c(%rcx)
movslq 0xe38(%rcx), %rax
movzwl 0x318(%rcx,%rax,4), %eax
jmp 0x4559b
andw $0x0, 0x7c(%rcx)
xorl %eax, %eax
movw %ax, 0x7e(%rcx)
movq %r13, %rdi
callq 0x18b50
testl %eax, %eax
je 0x45615
movq 0x58(%r13), %rbx
leaq 0xd521(%rip), %rdi      # 0x52ad7
callq 0x18a80
subq 0x2187e(%rip), %rax     # 0x66e40
movl $0x88, %ecx
cqto
idivq %rcx
movl 0x318(%rbx,%rax,4), %ebx
movq %r13, %rbp
xorl %r13d, %r13d
testl %ebx, %ebx
jne 0x4561d
andb $-0x11, 0x11d(%rbp)
movq 0x21015(%rip), %rax     # 0x66600
movq 0x20(%rax), %rbx
leaq 0x9df8(%rip), %rdi      # 0x4f3ee
callq *0x48(%rax)
pushq $0x3
popq %rsi
movss 0x9924(%rip), %xmm0     # 0x4ef28
xorps %xmm2, %xmm2
movq %rbp, %rdi
movl %eax, %edx
movaps %xmm0, %xmm1
callq *%rbx
xorl %ebx, %ebx
jmp 0x4561a
xorl %ebx, %ebx
movq %r13, %rbp
movb $0x1, %r13b
movq %rbp, %rdi
callq 0x187a0
movl %eax, %ebp
testb %r13b, %r13b
je 0x45645
testl %ebp, %ebp
jne 0x45650
movq 0x8(%rsp), %r13
movq 0x58(%r13), %rcx
andw $0x0, 0x80(%rcx)
xorl %ebx, %ebx
jmp 0x456a3
testl %ebp, %ebp
je 0x45682
testb $0x8, (%r12)
jne 0x45682
movl %ebp, %edi
callq 0x18d10
movq 0x20fa2(%rip), %rcx     # 0x66600
movq 0x48(%rax), %rdi
callq *0x50(%rcx)
movq 0x8(%rsp), %r13
movq 0x58(%r13), %rcx
movw %ax, 0x80(%rcx)
movslq %ebp, %rax
movzwl 0x318(%rcx,%rax,4), %ebx
jmp 0x456a3
movq 0x20f77(%rip), %rax     # 0x66600
leaq 0xcbce(%rip), %rdi      # 0x5225e
callq *0x50(%rax)
movq 0x8(%rsp), %r13
movq 0x58(%r13), %rcx
movw %ax, 0x80(%rcx)
movw %bx, 0x82(%rcx)
movss 0x4(%r12), %xmm0
ucomiss 0xf24(%rcx), %xmm0
jbe 0x456c1
andl $0x0, 0x86(%rcx)
cvtsi2ssl (%r12), %xmm0
movss 0xf04(%rcx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x456fd
movq 0x20f25(%rip), %rax     # 0x66600
leaq 0xd4a5(%rip), %rdi      # 0x52b87
callq *0x50(%rax)
movq 0x58(%r13), %rcx
movw %ax, 0x8a(%rcx)
movss 0xf04(%rcx), %xmm0
jmp 0x45798
movss 0xf08(%rcx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x45730
movq 0x20eef(%rip), %rax     # 0x66600
leaq 0xd4ab(%rip), %rdi      # 0x52bc3
callq *0x50(%rax)
movq 0x58(%r13), %rcx
movw %ax, 0x8a(%rcx)
movss 0xf08(%rcx), %xmm0
jmp 0x45798
movss 0xf10(%rcx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x45763
movq 0x20ebc(%rip), %rax     # 0x66600
leaq 0xd56a(%rip), %rdi      # 0x52cb5
callq *0x50(%rax)
movq 0x58(%r13), %rcx
movw %ax, 0x8a(%rcx)
movss 0xf10(%rcx), %xmm0
jmp 0x45798
movss 0xf0c(%rcx), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x459cc
movq 0x20e85(%rip), %rax     # 0x66600
leaq 0xd4ed(%rip), %rdi      # 0x52c6f
callq *0x50(%rax)
movq 0x58(%r13), %rcx
movw %ax, 0x8a(%rcx)
movss 0xf0c(%rcx), %xmm0
cvtsi2ssl (%r12), %xmm1
subss %xmm1, %xmm0
divss 0x976a(%rip), %xmm0     # 0x4ef14
cvttss2si %xmm0, %eax
movw %ax, 0x8c(%rcx)
movslq 0x314(%rcx), %rax
cmpq $-0x1, %rax
je 0x4581f
movq (%r15), %rcx
testq %rcx, %rcx
je 0x457e1
imulq $0x88, %rax, %rdx
addq 0x21668(%rip), %rdx     # 0x66e40
cmpq %rdx, 0x330(%rcx)
je 0x45823
movq (%r14), %rcx
testq %rcx, %rcx
je 0x45800
imulq $0x88, %rax, %rdx
addq 0x21649(%rip), %rdx     # 0x66e40
cmpq %rdx, 0x330(%rcx)
je 0x45833
movq 0x20df9(%rip), %rcx     # 0x66600
imulq $0x88, %rax, %rax
movq 0x2162b(%rip), %rdx     # 0x66e40
movq 0x48(%rdx,%rax), %rdi
callq *0x50(%rcx)
jmp 0x45844
xorl %eax, %eax
jmp 0x45848
movq 0x20dd6(%rip), %rax     # 0x66600
leaq 0x112eb(%rip), %rdi     # 0x56b1c
jmp 0x45841
movq 0x20dc6(%rip), %rax     # 0x66600
leaq 0xd831(%rip), %rdi      # 0x53072
callq *0x50(%rax)
movq 0x58(%r13), %rcx
movw %ax, 0x84(%rcx)
movzwl 0x314(%rcx), %eax
movw %ax, 0x90(%rcx)
pushq $0x3
popq %rsi
movq %r13, %rdi
callq 0x18030
movq 0x58(%r13), %rcx
movw %ax, 0x94(%rcx)
cmpl $0x0, 0x74c(%rcx)
je 0x45883
testb $0x8, (%r12)
jne 0x458ba
cmpl $0x2, 0x300(%rcx)
je 0x4589a
movss 0x70(%rcx), %xmm0
ucomiss 0x10d90(%rip), %xmm0    # 0x56628
jbe 0x458b6
movq 0x730(%rcx), %rax
testq %rax, %rax
je 0x458b6
movq 0x20d53(%rip), %rcx     # 0x66600
movq 0x48(%rax), %rdi
callq *0x50(%rcx)
jmp 0x458cb
xorl %eax, %eax
jmp 0x458cf
movq 0x20d3f(%rip), %rax     # 0x66600
leaq 0xf24a(%rip), %rdi      # 0x54b12
callq *0x50(%rax)
movq 0x58(%r13), %rcx
movw %ax, 0x8e(%rcx)
andw $0x0, 0x92(%rcx)
movq 0x215db(%rip), %rax     # 0x66ec0
movq (%rax), %rax
movss 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x458f7
jnp 0x4595f
movl 0x308(%rcx), %eax
testl %eax, %eax
jle 0x45943
movss 0xc8(%r12), %xmm0
ucomiss %xmm1, %xmm0
jne 0x45943
jp 0x45943
cmpl $0x0, 0xe24(%rcx)
jne 0x45943
cmpl $0x0, 0xf78(%rcx)
jne 0x45943
cmpl $0x0, 0xf74(%rcx)
jne 0x45943
cmpl $0x0, 0xf80(%rcx)
jne 0x45943
cmpl $0x0, 0xe34(%rcx)
je 0x459e1
movw $0x1, 0x92(%rcx)
movw $0x3, %dx
testl %eax, %eax
jle 0x459b2
cmpl $0x0, 0xe28(%rcx)
jne 0x459ab
jmp 0x459b2
cmpl $0x0, 0xe24(%rcx)
jne 0x4598c
cmpl $0x0, 0xe2c(%rcx)
jne 0x4598c
cmpl $0x0, 0xf78(%rcx)
jne 0x4598c
cmpl $0x0, 0xf74(%rcx)
jne 0x4598c
cmpl $0x0, 0xe34(%rcx)
je 0x459db
movw $0x1, 0x92(%rcx)
movw $0x3, %dx
cmpl $0x0, 0xe28(%rcx)
je 0x459b2
cmpl $0x0, 0x308(%rcx)
jle 0x459b2
movw %dx, 0x92(%rcx)
andw $0x0, 0x9a(%rcx)
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
andw $0x0, 0x8a(%rcx)
xorl %eax, %eax
jmp 0x457ae
movw $0x2, %dx
jmp 0x45999
movw $0x2, %dx
jmp 0x45950