// File: /workspace/github_c_makefile_star2_O0/beejjorgensen[P]conquest/conqi2.c
// Function: revolt
void revolt(int starnum)
{
    tplanet *pplan;
    tteam loses, gets_back;
    pplan = stars[starnum].first_planet;
    if (col_stars[starnum][ENEMY] + col_stars[starnum][player] > 0) {
        while (pplan != nil) {
            if (pplan->conquered) {
                if ((pplan->team == player) && (!any_bc(player, starnum))) {
                    loses = player;
                    gets_back = ENEMY;
                } else if ((pplan->team == ENEMY) &&
                           (!any_bc(ENEMY, starnum))) {
                    loses = ENEMY;
                    gets_back = player;
                } else
                    loses = none;
                if (loses != none) {
                    col_stars[starnum][loses] =
                        col_stars[starnum][loses] - 1;
                    col_stars[starnum][gets_back]++;
                    pplan->team = gets_back;
                    pplan->conquered = false;
                    pplan->psee_capacity = pplan->capacity;
                    on_board(stars[starnum].x, stars[starnum].y);
                };
            };
            pplan = pplan->next;
        };
    };
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0xee6a(%rip), %rax      # 0x144a0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0xd690(%rip), %rax      # 0x12ce0
movl (%rax,%rcx,8), %eax
movslq -0x4(%rbp), %rdx
leaq 0xd682(%rip), %rcx      # 0x12ce0
addl 0x4(%rcx,%rdx,8), %eax
cmpl $0x0, %eax
jle 0x57a8
jmp 0x566d
cmpq $0x0, -0x10(%rbp)
je 0x57a6
movq -0x10(%rbp), %rax
cmpl $0x0, 0x20(%rax)
je 0x5795
movq -0x10(%rbp), %rax
cmpl $0x1, 0xc(%rax)
jne 0x56b2
movl -0x4(%rbp), %esi
movl $0x1, %edi
callq 0x2250
cmpl $0x0, %eax
jne 0x56b2
movl $0x1, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
jmp 0x56e4
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x56db
movl -0x4(%rbp), %esi
xorl %edi, %edi
callq 0x2250
cmpl $0x0, %eax
jne 0x56db
movl $0x0, -0x14(%rbp)
movl $0x1, -0x18(%rbp)
jmp 0x56e2
movl $0x2, -0x14(%rbp)
jmp 0x56e4
cmpl $0x2, -0x14(%rbp)
je 0x5793
movslq -0x4(%rbp), %rcx
leaq 0xd5e7(%rip), %rax      # 0x12ce0
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %edx
subl $0x1, %edx
movslq -0x4(%rbp), %rcx
leaq 0xd5cb(%rip), %rax      # 0x12ce0
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movslq -0x4(%rbp), %rcx
leaq 0xd5b2(%rip), %rax      # 0x12ce0
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x18(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x20(%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movslq -0x4(%rbp), %rcx
leaq 0xed30(%rip), %rax      # 0x144a0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edi
movslq -0x4(%rbp), %rcx
leaq 0xed1c(%rip), %rax      # 0x144a0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %esi
callq 0xaa50
jmp 0x5795
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x566d
jmp 0x57a8
addq $0x20, %rsp
popq %rbp
retq
nop