// File: /workspace/github_c_makefile_star2_O1/beejjorgensen[P]conquest/conqmc.c
// Function: send4transports
void send4transports(float slist[nstars + 1], struct sttf *task)
{
    int new_tf, to_land, sec_star, sec_score, best_star, top_score,
        score, starnum;
    int xstar;
    struct stplanet *pplan, *best_plan;
    int trash1, trash2;

    if (task->t > 0) {
        best_star = 0;
        sec_star = 0;
        sec_score = -11000;
        top_score = -10000;
        best_plan = nil;
        for (starnum = 1; starnum <= nstars; starnum++) {
            if ((slist[starnum] > 0) || (starnum == task->dest)) {
                pplan = stars[starnum].first_planet;
                while (pplan != nil) {
                    score = eval_t_col(pplan, slist[starnum]);
                    xstar = starnum;
                    if (score > top_score) {
                        swap(&best_star, &xstar);
                        swap(&top_score, &score);
                        best_plan = pplan;
                    };
                    if (score > sec_score) {
                        sec_score = score;
                        sec_star = xstar;
                    };
                    pplan = pplan->next;
                };
            };
        };
        if (best_star == task->dest) {  /*land */
            if ((tf_stars[best_star][player] == 0)
                && (best_plan->team != player)
                ) {
                trash1 = task->t;
                trash2 =
                    (best_plan->capacity - best_plan->inhabitants) / 3;
                to_land = MIN(trash1, trash2);
                if ((to_land > 0)) {
                    if (best_plan->inhabitants == 0) {
                        best_plan->team = ENEMY;
                        best_plan->esee_team = ENEMY;
                        col_stars[best_star][ENEMY] =
                            col_stars[best_star][ENEMY] + 1;
                    };
                    best_plan->inhabitants =
                        best_plan->inhabitants + to_land;
                    best_plan->iu = best_plan->iu + to_land;
                    task->t = task->t - to_land;
                    send4transports(slist, task);
                };
            };
        } else {                /*move */
            if ((task->t >= 10) && (sec_star > 0)) {
                get_tf(ENEMY, &new_tf, task->dest);
                tf[ENEMY][new_tf].t = task->t / 2;
                task->t = task->t - tf[ENEMY][new_tf].t;
                if ((task->c > 0) && (!underdefended(task->dest))) {
                    tf[ENEMY][new_tf].c = 1;
                    task->c = task->c - 1;
                };
                send2t_tf(&tf[ENEMY][new_tf], slist, best_star);
                best_star = sec_star;
            };
            get_tf(ENEMY, &new_tf, task->dest);
            tf[ENEMY][new_tf].t = task->t;
            task->t = 0;
            if ((task->c > 0) && (!underdefended(task->dest))) {
                tf[ENEMY][new_tf].c = 1;
                task->c = task->c - 1;
            };
            send2t_tf(&tf[ENEMY][new_tf], slist, best_star);
        };
    };
}

// Assembly:
cmpl $0x0, 0x14(%rsi)
jle 0x5791
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq %rsi, 0x20(%rsp)
leaq 0xc(%rsp), %rax
movl $0x0, (%rax)
leaq 0x1c(%rsp), %rax
movl $0xffffd8f0, (%rax)     # imm = 0xFFFFD8F0
movl $0xffffd508, %ebp       # imm = 0xFFFFD508
xorl %r15d, %r15d
movl $0x1, %r13d
xorl %r12d, %r12d
movss (%rbx,%r13,4), %xmm0
ucomiss 0x3ade(%rip), %xmm0     # 0x9030
ja 0x5561
movq 0x20(%rsp), %rax
movl 0x20(%rax), %eax
cmpq %rax, %r13
jne 0x55d0
leaq (,%r13,2), %rax
addq %r13, %rax
leaq 0x9f2d(%rip), %rcx      # 0xf4a0
movq 0x8(%rcx,%rax,8), %r14
testq %r14, %r14
je 0x55d0
movss (%rbx,%r13,4), %xmm0
movq %r14, %rdi
callq 0x5218
movl %eax, 0x18(%rsp)
movl %r13d, 0x14(%rsp)
cmpl 0x1c(%rsp), %eax
jle 0x55bb
leaq 0xc(%rsp), %rdi
leaq 0x14(%rsp), %rsi
callq 0x7af8
leaq 0x1c(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x7af8
movq %r14, %r12
movl 0x18(%rsp), %eax
cmpl %ebp, %eax
jle 0x55ca
movl 0x14(%rsp), %r15d
movl %eax, %ebp
movq 0x38(%r14), %r14
jmp 0x5578
incq %r13
cmpq $0x16, %r13
jne 0x5545
movslq 0xc(%rsp), %rax
movq 0x20(%rsp), %r13
movl 0x20(%r13), %edx
cmpl %edx, %eax
jne 0x567d
leaq 0x8636(%rip), %rcx      # 0xdc30
cmpl $0x0, 0x4(%rcx,%rax,8)
jne 0x5783
cmpl $0x1, 0xc(%r12)
je 0x5783
movl 0x14(%r13), %esi
movl 0x4(%r12), %ecx
movl 0x10(%r12), %edx
subl %edx, %ecx
movslq %ecx, %rcx
imulq $0x55555556, %rcx, %rcx # imm = 0x55555556
movq %rcx, %rdi
shrq $0x3f, %rdi
shrq $0x20, %rcx
addl %edi, %ecx
cmpl %ecx, %esi
cmovll %esi, %ecx
testl %ecx, %ecx
jle 0x5783
testl %edx, %edx
jne 0x565f
xorl %edx, %edx
movl %edx, 0xc(%r12)
movl %edx, 0x28(%r12)
leaq 0x8684(%rip), %rdx      # 0xdce0
incl (%rdx,%rax,8)
addl %ecx, 0x10(%r12)
addl %ecx, 0x14(%r12)
subl %ecx, 0x14(%r13)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x54fe
jmp 0x5783
cmpl $0xa, 0x14(%r13)
jl 0x570b
testl %r15d, %r15d
jle 0x570b
leaq 0x10(%rsp), %r14
xorl %edi, %edi
movq %r14, %rsi
callq 0x2a18
movl 0x14(%r13), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movslq (%r14), %rax
imulq $0x34, %rax, %rax
leaq 0x92e9(%rip), %r14      # 0xe9a0
movl %ecx, 0x14(%r14,%rax)
subl %ecx, 0x14(%r13)
cmpl $0x0, 0x18(%r13)
jle 0x56ea
movl 0x20(%r13), %edi
callq 0x59c2
testl %eax, %eax
jne 0x56ea
movslq 0x10(%rsp), %rax
imulq $0x34, %rax, %rax
movl $0x1, 0x18(%r14,%rax)
decl 0x18(%r13)
movslq 0x10(%rsp), %rax
imulq $0x34, %rax, %rdi
addq 0x78be(%rip), %rdi      # 0xcfb8
movl 0xc(%rsp), %edx
movq %rbx, %rsi
callq 0x5a43
movl %r15d, 0xc(%rsp)
movl 0x20(%r13), %edx
leaq 0x10(%rsp), %r14
xorl %edi, %edi
movq %r14, %rsi
callq 0x2a18
movl 0x14(%r13), %eax
movslq (%r14), %rcx
imulq $0x34, %rcx, %rcx
leaq 0x9270(%rip), %r14      # 0xe9a0
movl %eax, 0x14(%r14,%rcx)
movl $0x0, 0x14(%r13)
cmpl $0x0, 0x18(%r13)
jle 0x5767
movl 0x20(%r13), %edi
callq 0x59c2
testl %eax, %eax
jne 0x5767
movslq 0x10(%rsp), %rax
imulq $0x34, %rax, %rax
movl $0x1, 0x18(%r14,%rax)
decl 0x18(%r13)
movslq 0x10(%rsp), %rax
imulq $0x34, %rax, %rdi
addq 0x7841(%rip), %rdi      # 0xcfb8
movl 0xc(%rsp), %edx
movq %rbx, %rsi
callq 0x5a43
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq