// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/g_tourney.c
// Function: Match_Start
void Match_Start(edict_t *ent)
{
    int i;
    edict_t *player;
    char message[MAX_INFO_STRING];
    int player_count = 0;
    gitem_t *Item;
    //edict_t    *Item_ent;

    // Blank all players' stats, and respawn them
    for (i=0 ; i < game.maxclients ; i++) {
        player = g_edicts + 1 + i;

        // Don't bother killing them if they are an observer
        if (player->inuse && !player->client->resp.spectator) {
            player_count++;

            if(matchstate != MATCH_RAILGUN_COUNTDOWN) {
                player->health = 0;
                player_die (player, player, player, 100000, vec3_origin);
                // don't even bother waiting for death frames

                // Start our time over so we respawn on team spawn point
                player->client->resp.enterframe = level.framenum;

                //bat force them to hit the button to respawn.
                //took out respawn() and added a second to the respawn time
                //Too Many overflows!!!!!
                //respawn (player);
                //This is in seconds!!!

                //Let's try this in the respawn instead;
                //player->client->respawn_time = level.time + (0.2 * player_count);

                stats_clear(player); // Blank all our stats, whether we are here or not
            } else {
                player->health = 100;
                player->client->pers.weapon = FindItem ("railgun");;
                player->client->newweapon = player->client->pers.weapon;
                Item = FindItem("slugs");
                Add_Ammo(player, Item, 1000);
                ChangeWeapon(player);
            }
        }
    }

    if(matchstate == MATCH_RAILGUN_COUNTDOWN) {
        matchstate = MATCH_RAILGUN_INPLAY;
        ent->count = railtime->value;
        sprintf(message, "%d seconds. %d men enter 1 man leaves \n", ent->count, player_count);
        ctf_BSafePrint(PRINT_HIGH, message);
    } else {
        matchstate = MATCH_INPLAY;
        ent->count = ((unsigned short)timelimit->value) * 60;
        sprintf(message, "%d minutes until match ends.\n", ent->count/60);
        ctf_BSafePrint(PRINT_HIGH, message);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq %rdi, -0x8(%rbp)
movl $0x0, -0x224(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq 0x5ccf6(%rip), %rcx     # 0x82d40
cmpl 0x610(%rcx), %eax
jge 0x26190
movq 0x5c4fb(%rip), %rax     # 0x82558
movq (%rax), %rax
addq $0x4a8, %rax            # imm = 0x4A8
movslq -0xc(%rbp), %rcx
imulq $0x4a8, %rcx, %rcx      # imm = 0x4A8
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x60(%rax)
je 0x26180
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
cmpl $0x0, 0xe04(%rax)
jne 0x26180
movl -0x224(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x224(%rbp)
movq 0x5c727(%rip), %rax     # 0x827d8
cmpl $0x5, (%rax)
je 0x26103
movq -0x18(%rbp), %rax
movl $0x0, 0x254(%rax)
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl $0x186a0, %ecx          # imm = 0x186A0
movq 0x5c68c(%rip), %r8      # 0x82768
callq 0x19d28
movq 0x5ccb8(%rip), %rax     # 0x82da0
movl (%rax), %ecx
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movl %ecx, 0xdf0(%rax)
movq -0x18(%rbp), %rdi
callq 0x19460
jmp 0x2617e
movq -0x18(%rbp), %rax
movl $0x64, 0x254(%rax)
leaq 0x50d1d(%rip), %rdi     # 0x76e35
callq 0x18a90
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq %rcx, 0x730(%rax)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq 0x730(%rax), %rcx
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq %rcx, 0xe50(%rax)
leaq 0x4d8b3(%rip), %rdi     # 0x73a07
callq 0x18a90
movq %rax, -0x230(%rbp)
movq -0x18(%rbp), %rdi
movq -0x230(%rbp), %rsi
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x19430
movq -0x18(%rbp), %rdi
callq 0x18820
jmp 0x26180
jmp 0x26182
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x26040
movq 0x5c641(%rip), %rax     # 0x827d8
cmpl $0x5, (%rax)
jne 0x261fa
movq 0x5c635(%rip), %rax     # 0x827d8
movl $0x6, (%rax)
movq 0x5c4a0(%rip), %rax     # 0x82650
movq (%rax), %rax
cvttss2si 0x20(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x290(%rax)
leaq -0x220(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x290(%rax), %edx
movl -0x224(%rbp), %ecx
leaq 0x4a7ae(%rip), %rsi     # 0x7098e
movb $0x0, %al
callq 0x19940
leaq -0x220(%rbp), %rsi
movl $0x2, %edi
callq 0x19470
jmp 0x26260
movq 0x5c5d7(%rip), %rax     # 0x827d8
movl $0x3, (%rax)
movq 0x5c4a2(%rip), %rax     # 0x826b0
movq (%rax), %rax
cvttss2si 0x20(%rax), %eax
movzwl %ax, %eax
imull $0x3c, %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x290(%rax)
leaq -0x220(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x290(%rax), %eax
movl $0x3c, %ecx
cltd
idivl %ecx
movl %eax, %edx
leaq 0x4a76e(%rip), %rsi     # 0x709b6
movb $0x0, %al
callq 0x19940
leaq -0x220(%rbp), %rsi
movl $0x2, %edi
callq 0x19470
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
nopl (%rax)