// File: /workspace/github_c_makefile_star2_O0/beejjorgensen[P]conquest/conq1.c
// Function: check_game_over
void check_game_over(void)
{
    boolean dead[2];
    boolean quit_game;
    int total[2], transports[2], inhabs[2];
    tteam team;
    int tfnum, starnum;
    struct stplanet *pplan;
    quit_game = game_over;
    for (team = ENEMY; team <= player; team++) {
        transports[team] = 0;
        inhabs[team] = 0;
        for (tfnum = 1; tfnum <= 26; tfnum++) {
            if (tf[team][tfnum].dest != 0)
                transports[team] = transports[team]
                    + tf[team][tfnum].t;
        };
    };
    for (starnum = 1; starnum <= nstars; starnum++) {
        pplan = stars[starnum].first_planet;
        while (pplan != nil) {
            switch (pplan->team) {
            case player:
                inhabs[player] = inhabs[player] + pplan->iu;
                break;
            case ENEMY:
                inhabs[ENEMY] = inhabs[ENEMY] + pplan->iu;
                break;
            };                  /*switch ( */
            pplan = pplan->next;
        };
    };
    for (team = ENEMY; team <= player; team++) {
        total[team] = inhabs[team] + transports[team];
        dead[team] = total[team] == 0;
    };
    if ((!dead[player]) && (!dead[ENEMY]) && (turn >= 40)) {
        dead[ENEMY] = total[player] / total[ENEMY] >= 8;
        dead[player] = total[ENEMY] / total[player] >= 8;
    };
    game_over = dead[player] || dead[ENEMY] || (turn > 100) || quit_game;
    if (game_over) {
        cle2r_screen();
        printw("*** Game over ***\n");
        printw("Player: Population in transports:%3d", transports[player]);
        printw("  IU's on colonies: %3d  TOTAL: %3d\n", inhabs[player],
               total[player]);
        addch('\n');
        printw("Enemy:  Population in transports:%3d", transports[ENEMY]);
        printw("  IU's on colonies: %3d  TOTAL: %3d\n",
               inhabs[ENEMY], total[ENEMY]);
        if ((total[ENEMY] > total[player]) || quit_game)
            printw("**** THE ENEMY HAS CONQUERED THE GALAXY ***\n");
        else if ((total[player] > total[ENEMY]))
            printw("*** PLAYER WINS- YOU HAVE SAVED THE GALAXY! ***\n");
        else
            printw("*** DRAWN ***\n");
    };
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
leaq 0x12489(%rip), %rax     # 0x148b8
movl (%rax), %eax
movl %eax, -0xc(%rbp)
movl $0x0, -0x28(%rbp)
cmpl $0x1, -0x28(%rbp)
jg 0x24e0
movslq -0x28(%rbp), %rax
movl $0x0, -0x1c(%rbp,%rax,4)
movslq -0x28(%rbp), %rax
movl $0x0, -0x24(%rbp,%rax,4)
movl $0x1, -0x2c(%rbp)
cmpl $0x1a, -0x2c(%rbp)
jg 0x24d0
movslq -0x28(%rbp), %rcx
leaq 0x1152b(%rip), %rax     # 0x139a0
imulq $0x57c, %rcx, %rcx      # imm = 0x57C
addq %rcx, %rax
movslq -0x2c(%rbp), %rcx
imulq $0x34, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x20(%rax)
je 0x24c3
movslq -0x28(%rbp), %rax
movl -0x1c(%rbp,%rax,4), %ecx
movslq -0x28(%rbp), %rdx
leaq 0x114fd(%rip), %rax     # 0x139a0
imulq $0x57c, %rdx, %rdx      # imm = 0x57C
addq %rdx, %rax
movslq -0x2c(%rbp), %rdx
imulq $0x34, %rdx, %rdx
addq %rdx, %rax
addl 0x14(%rax), %ecx
movslq -0x28(%rbp), %rax
movl %ecx, -0x1c(%rbp,%rax,4)
jmp 0x24c5
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x2464
jmp 0x24d2
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x243b
movl $0x1, -0x30(%rbp)
cmpl $0x15, -0x30(%rbp)
jg 0x255f
movslq -0x30(%rbp), %rcx
leaq 0x11fa8(%rip), %rax     # 0x144a0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x2552
movq -0x38(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x3c(%rbp)
testl %eax, %eax
je 0x2537
jmp 0x251e
movl -0x3c(%rbp), %eax
subl $0x1, %eax
jne 0x2544
jmp 0x2528
movl -0x20(%rbp), %eax
movq -0x38(%rbp), %rcx
addl 0x14(%rcx), %eax
movl %eax, -0x20(%rbp)
jmp 0x2544
movl -0x24(%rbp), %eax
movq -0x38(%rbp), %rcx
addl 0x14(%rcx), %eax
movl %eax, -0x24(%rbp)
movq -0x38(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x2507
jmp 0x2554
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x24e7
movl $0x0, -0x28(%rbp)
cmpl $0x1, -0x28(%rbp)
jg 0x25a8
movslq -0x28(%rbp), %rax
movl -0x24(%rbp,%rax,4), %ecx
movslq -0x28(%rbp), %rax
addl -0x1c(%rbp,%rax,4), %ecx
movslq -0x28(%rbp), %rax
movl %ecx, -0x14(%rbp,%rax,4)
movslq -0x28(%rbp), %rax
cmpl $0x0, -0x14(%rbp,%rax,4)
sete %al
andb $0x1, %al
movzbl %al, %ecx
movslq -0x28(%rbp), %rax
movl %ecx, -0x8(%rbp,%rax,4)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x2566
cmpl $0x0, -0x4(%rbp)
jne 0x25ea
cmpl $0x0, -0x8(%rbp)
jne 0x25ea
leaq 0x121d9(%rip), %rax     # 0x14794
cmpl $0x28, (%rax)
jl 0x25ea
movl -0x10(%rbp), %eax
cltd
idivl -0x14(%rbp)
cmpl $0x8, %eax
setge %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x8(%rbp)
movl -0x14(%rbp), %eax
cltd
idivl -0x10(%rbp)
cmpl $0x8, %eax
setge %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
movb $0x1, %al
cmpl $0x0, -0x4(%rbp)
movb %al, -0x3d(%rbp)
jne 0x261b
movb $0x1, %al
cmpl $0x0, -0x8(%rbp)
movb %al, -0x3d(%rbp)
jne 0x261b
movb $0x1, %al
leaq 0x1218b(%rip), %rcx     # 0x14794
cmpl $0x64, (%rcx)
movb %al, -0x3d(%rbp)
jg 0x261b
cmpl $0x0, -0xc(%rbp)
setne %al
movb %al, -0x3d(%rbp)
movb -0x3d(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
leaq 0x1228e(%rip), %rax     # 0x148b8
movl %ecx, (%rax)
leaq 0x12285(%rip), %rax     # 0x148b8
cmpl $0x0, (%rax)
je 0x26f5
callq 0xa790
leaq 0xb9e8(%rip), %rdi      # 0xe030
movb $0x0, %al
callq 0x2030
movl -0x18(%rbp), %esi
leaq 0xb9ea(%rip), %rdi      # 0xe043
movb $0x0, %al
callq 0x2030
movl -0x20(%rbp), %esi
movl -0x10(%rbp), %edx
leaq 0xb9fb(%rip), %rdi      # 0xe068
movb $0x0, %al
callq 0x2030
movq 0xf975(%rip), %rax      # 0x11ff0
movq (%rax), %rdi
movl $0xa, %esi
callq 0x20a0
movl -0x1c(%rbp), %esi
leaq 0xb9fb(%rip), %rdi      # 0xe08d
movb $0x0, %al
callq 0x2030
movl -0x24(%rbp), %esi
movl -0x14(%rbp), %edx
leaq 0xb9c2(%rip), %rdi      # 0xe068
movb $0x0, %al
callq 0x2030
movl -0x14(%rbp), %eax
cmpl -0x10(%rbp), %eax
jg 0x26bb
cmpl $0x0, -0xc(%rbp)
je 0x26cb
leaq 0xb9f0(%rip), %rdi      # 0xe0b2
movb $0x0, %al
callq 0x2030
jmp 0x26f3
movl -0x10(%rbp), %eax
cmpl -0x14(%rbp), %eax
jle 0x26e3
leaq 0xba05(%rip), %rdi      # 0xe0df
movb $0x0, %al
callq 0x2030
jmp 0x26f1
leaq 0xba26(%rip), %rdi      # 0xe110
movb $0x0, %al
callq 0x2030
jmp 0x26f3
jmp 0x26f5
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)