// File: /workspace/github_c_makefile_star2_O3/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 0x57b0
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, %r13d      # imm = 0xFFFFD508
xorl %r15d, %r15d
movl $0x1, %ebp
xorl %r12d, %r12d
movss (%rbx,%rbp,4), %xmm0
ucomiss 0x3b0e(%rip), %xmm0     # 0x9078
ja 0x5579
movq 0x20(%rsp), %rax
movl 0x20(%rax), %eax
cmpq %rax, %rbp
jne 0x55ec
leaq (,%rbp,2), %rax
addq %rbp, %rax
leaq 0x9f05(%rip), %rcx      # 0xf490
movq 0x8(%rcx,%rax,8), %r14
testq %r14, %r14
je 0x55ec
movss (%rbx,%rbp,4), %xmm0
movq %r14, %rdi
callq 0x5232
movl %eax, 0x18(%rsp)
movl %ebp, 0x14(%rsp)
movl %ebp, %ecx
cmpl 0x1c(%rsp), %eax
jle 0x55db
leaq 0xc(%rsp), %rdi
leaq 0x14(%rsp), %rsi
callq 0x7a8c
leaq 0x1c(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x7a8c
movl 0x18(%rsp), %eax
movl 0x14(%rsp), %ecx
movq %r14, %r12
cmpl %r13d, %eax
cmovgl %eax, %r13d
cmovgl %ecx, %r15d
movq 0x38(%r14), %r14
jmp 0x5590
incq %rbp
cmpq $0x16, %rbp
jne 0x555e
movslq 0xc(%rsp), %rax
movq 0x20(%rsp), %r13
movl 0x20(%r13), %edx
cmpl %edx, %eax
jne 0x56a6
leaq 0x860a(%rip), %rcx      # 0xdc20
cmpl $0x0, 0x4(%rcx,%rax,8)
jne 0x57a2
cmpl $0x1, 0xc(%r12)
je 0x57a2
movl 0x14(%r13), %edx
movl 0x4(%r12), %ecx
movl 0x10(%r12), %esi
subl %esi, %ecx
movslq %ecx, %rcx
imulq $0x55555556, %rcx, %rcx # imm = 0x55555556
movq %rcx, %rdi
shrq $0x3f, %rdi
shrq $0x20, %rcx
addl %edi, %ecx
cmpl %ecx, %edx
cmovll %edx, %ecx
testl %ecx, %ecx
jle 0x57a2
testl %esi, %esi
jne 0x5684
xorl %edx, %edx
movl %edx, 0xc(%r12)
movl %edx, 0x28(%r12)
leaq 0x8658(%rip), %rdx      # 0xdcd0
incl (%rdx,%rax,8)
movl 0x10(%r12), %esi
movl 0x14(%r13), %edx
addl %ecx, %esi
movl %esi, 0x10(%r12)
addl %ecx, 0x14(%r12)
subl %ecx, %edx
movl %edx, 0x14(%r13)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x5517
jmp 0x57a2
cmpl $0xa, 0x14(%r13)
jl 0x5733
testl %r15d, %r15d
jle 0x5733
leaq 0x10(%rsp), %r14
xorl %edi, %edi
movq %r14, %rsi
callq 0x2ac4
movl 0x14(%r13), %eax
movl %eax, %edx
shrl $0x1f, %edx
addl %eax, %edx
sarl %edx
movslq (%r14), %rcx
imulq $0x34, %rcx, %rax
leaq 0x92b0(%rip), %r14      # 0xe990
movl %edx, 0x14(%r14,%rax)
subl %edx, 0x14(%r13)
cmpl $0x0, 0x18(%r13)
jle 0x5713
movl 0x20(%r13), %edi
callq 0x59ce
movslq 0x10(%rsp), %rcx
testl %eax, %eax
jne 0x5713
imulq $0x34, %rcx, %rax
movl $0x1, 0x18(%r14,%rax)
decl 0x18(%r13)
imulq $0x34, %rcx, %rdi
addq 0x7892(%rip), %rdi      # 0xcfb0
movl 0xc(%rsp), %edx
movq %rbx, %rsi
callq 0x5a40
movl %r15d, 0xc(%rsp)
movl 0x20(%r13), %edx
leaq 0x10(%rsp), %r14
xorl %edi, %edi
movq %r14, %rsi
callq 0x2ac4
movl 0x14(%r13), %eax
movslq (%r14), %rcx
imulq $0x34, %rcx, %rdx
leaq 0x923c(%rip), %r14      # 0xe990
movl %eax, 0x14(%r14,%rdx)
movl $0x0, 0x14(%r13)
cmpl $0x0, 0x18(%r13)
jle 0x578b
movl 0x20(%r13), %edi
callq 0x59ce
movslq 0x10(%rsp), %rcx
testl %eax, %eax
jne 0x578b
imulq $0x34, %rcx, %rax
movl $0x1, 0x18(%r14,%rax)
decl 0x18(%r13)
imulq $0x34, %rcx, %rdi
addq 0x781a(%rip), %rdi      # 0xcfb0
movl 0xc(%rsp), %edx
movq %rbx, %rsi
callq 0x5a40
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq