// File: /workspace/github_c_makefile_star2_O0/beejjorgensen[P]conquest/conqmc.c
// Function: move_bc
void move_bc(struct sttf *task, float slist[nstars + 1])
{
    int best_star, top_score, starnum, score, factors;
    struct stplanet *pplanet, *best_planet;

    if ((task->b > 0) || (task->c > 0)) {
        for (starnum = 1; starnum <= nstars; starnum++) {
            if (slist[starnum] > 0) {
                best_star = starnum;
                starnum = nstars + 1;
            };
        };
        best_planet = nil;
        top_score = -1000;
        for (starnum = 1; starnum <= nstars; starnum++) {
            if ((slist[starnum] > 0) || (starnum == task->dest)) {
                pplanet = stars[starnum].first_planet;
                while (pplanet != nil) {
                    score = eval_bc_col(pplanet);
                    if (starnum == task->dest)
                        score += 250;

                    if (tf_stars[starnum][ENEMY] > 0)
                        score -= 150;

                    if (score > top_score) {
                        top_score = score;
                        best_planet = pplanet;
                        best_star = starnum;
                    };
                    pplanet = pplanet->next;
                };
            };
        };
        if (best_star == task->dest) {  /*stay put */
            if (best_planet != nil) {
                if ((best_planet->team == ENEMY)
                    && (best_planet->conquered)
                    && (best_planet->iu < 20)) {
                    factors =
                        weapons[ENEMY] * ((task->c * c_guns) +
                                          (task->b * b_guns));
                    factors = MIN(factors, 4 * best_planet->inhabitants);
                    blast(best_planet, factors);
                    if ((tf_stars[best_planet->pstar][player] > 0) ||
                        (col_stars[best_planet->pstar][player] > 0))
                        best_planet->psee_capacity = best_planet->capacity;
                } else if ((best_planet->team == ENEMY) && (best_planet->conquered)) {  /*decide whether to split */
                    if ((((task->b > 3) || (task->c > 3)) && (rnd(4) == 4))
                        || (task->b > 8))
                        wander_bc(task, slist);
                };
            };
        } else {                /*move */
            tf_stars[task->dest][ENEMY]--;
            depart(task->dest);
            task->dest = best_star;
            task->eta = (int) ((slist[best_star] - 0.01) / vel[ENEMY]) + 1;
        };
    };
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jg 0x76e8
movq -0x8(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jle 0x79a6
movl $0x1, -0x1c(%rbp)
cmpl $0x15, -0x1c(%rbp)
jg 0x7724
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x7717
movl -0x1c(%rbp), %eax
movl %eax, -0x14(%rbp)
movl $0x16, -0x1c(%rbp)
jmp 0x7719
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x76ef
movq $0x0, -0x38(%rbp)
movl $0xfffffc18, -0x18(%rbp) # imm = 0xFFFFFC18
movl $0x1, -0x1c(%rbp)
cmpl $0x15, -0x1c(%rbp)
jg 0x7805
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
ja 0x7769
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jne 0x77f5
movslq -0x1c(%rbp), %rcx
leaq 0xcd2c(%rip), %rax      # 0x144a0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x77f3
movq -0x30(%rbp), %rdi
callq 0x6d70
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jne 0x77ad
movl -0x20(%rbp), %eax
addl $0xfa, %eax
movl %eax, -0x20(%rbp)
movslq -0x1c(%rbp), %rcx
leaq 0xb478(%rip), %rax      # 0x12c30
cmpl $0x0, (%rax,%rcx,8)
jle 0x77c9
movl -0x20(%rbp), %eax
subl $0x96, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x18(%rbp), %eax
jle 0x77e5
movl -0x20(%rbp), %eax
movl %eax, -0x18(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x7783
jmp 0x77f5
jmp 0x77f7
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x773a
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jne 0x7935
cmpq $0x0, -0x38(%rbp)
je 0x7933
movq -0x38(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x78df
movq -0x38(%rbp), %rax
cmpl $0x0, 0x20(%rax)
je 0x78df
movq -0x38(%rbp), %rax
cmpl $0x14, 0x14(%rax)
jge 0x78df
leaq 0xce77(%rip), %rax      # 0x146c8
movl (%rax), %eax
movq -0x8(%rbp), %rcx
imull $0x7, 0x18(%rcx), %ecx
movq -0x8(%rbp), %rdx
imull $0x28, 0x1c(%rdx), %edx
addl %edx, %ecx
imull %ecx, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x38(%rbp), %rcx
movl 0x10(%rcx), %ecx
shll $0x2, %ecx
cmpl %ecx, %eax
jge 0x7884
movl -0x24(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x7891
movq -0x38(%rbp), %rax
movl 0x10(%rax), %eax
shll $0x2, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x38(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x4700
movq -0x38(%rbp), %rax
movslq 0x30(%rax), %rcx
leaq 0xb37e(%rip), %rax      # 0x12c30
cmpl $0x0, 0x4(%rax,%rcx,8)
jg 0x78cf
movq -0x38(%rbp), %rax
movslq 0x30(%rax), %rcx
leaq 0xb418(%rip), %rax      # 0x12ce0
cmpl $0x0, 0x4(%rax,%rcx,8)
jle 0x78dd
movq -0x38(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x8(%rax)
jmp 0x7931
movq -0x38(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x792f
movq -0x38(%rbp), %rax
cmpl $0x0, 0x20(%rax)
je 0x792f
movq -0x8(%rbp), %rax
cmpl $0x3, 0x1c(%rax)
jg 0x7907
movq -0x8(%rbp), %rax
cmpl $0x3, 0x18(%rax)
jle 0x7916
movl $0x4, %edi
callq 0x6a70
cmpl $0x4, %eax
je 0x7920
movq -0x8(%rbp), %rax
cmpl $0x8, 0x1c(%rax)
jle 0x792d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x6b80
jmp 0x792f
jmp 0x7931
jmp 0x7933
jmp 0x79a4
movq -0x8(%rbp), %rax
movslq 0x20(%rax), %rcx
leaq 0xb2ec(%rip), %rax      # 0x12c30
movl (%rax,%rcx,8), %edx
addl $-0x1, %edx
leaq 0xb2df(%rip), %rax      # 0x12c30
movl %edx, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movl 0x20(%rax), %edi
callq 0x6b40
movl -0x14(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x695d(%rip), %xmm1     # 0xe2e0
subsd %xmm1, %xmm0
leaq 0xcd2a(%rip), %rax      # 0x146b8
cvtsi2sdl (%rax), %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x24(%rax)
jmp 0x79a6
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)