// File: /workspace/github_c_makefile_star2_O2/beejjorgensen[P]conquest/conqbat.c
// Function: fire_salvo
void fire_salvo(tteam att_team, struct sttf *task, int tfnum,
                struct stplanet *planet, boolean first_time)
{
    int bases, att_forces, def_forces;
    boolean a_lose_none, p_lose_none;
    float att_odds, def_odds, attack_save, defend_save;
    tteam def_team;
    if (left_line[24]) {
        point(1, 24);
        printw(blank_line);
        left_line[24] = false;
    };
    if (att_team == ENEMY)
        def_team = player;
    else
        def_team = ENEMY;
    att_forces = weapons[att_team] * (task->c * c_guns + task->b * b_guns);
    def_forces =
        weapons[def_team] * (planet->mb * c_guns + planet->amb * b_guns);
    if (def_forces > 0) {
        att_odds = fmin((((float) def_forces) / att_forces), 14.0);
        attack_save = exp(log(0.8) * (att_odds));
        def_odds = fmin((float) att_forces / def_forces, 14.0);
        defend_save = exp(log(0.8) * (def_odds));
        point(1, 20);
        if (att_team == player)
            printw("TF%c", tfnum + 'a' - 1);
        else
            printw(" EN");
        printw(": %4d(weap %2d)sur: %4.0f", att_forces,
               weapons[att_team], attack_save * 100);
        point(1, 21);
        printw(" %c%d:%4d (weap %2d)sur: %4.0f", planet->pstar + 'A' - 1,
               planet->number,
               def_forces, weapons[def_team], defend_save * 100);
        point(1, 22);
        printw("Attacker losses:              ");
        point(1, 23);
        left_line[23] = true;
        printw(" Planet losses :              ");
        a_lose_none = true;
        p_lose_none = true;
        do {
            point(17, 22);
            lose(&task->c, &a_lose_none, 'c', attack_save);
            lose(&task->b, &a_lose_none, 'b', attack_save);
            point(17, 23);
            bases = planet->mb;
            lose(&planet->mb, &p_lose_none, 'm', defend_save);
            if (planet->mb != bases)
                printw("b");
            bases = planet->amb;
            lose(&planet->amb, &p_lose_none, 'a', defend_save);
            if (planet->amb != bases)
                printw("mb");
        }
        while (!first_time && p_lose_none && a_lose_none);
        if (a_lose_none) {
            point(17, 22);
            printw("(none)");
        };
        if (p_lose_none) {
            point(17, 23);
            printw("(none)");
        };
    };
    if ((planet->mb + planet->amb == 0)
        && (any_bc(att_team, planet->pstar))) {
        point(1, 24);
        printw("Planet %d falls!               ", planet->number);
        planet->team = att_team;
        planet->esee_team = att_team;
        planet->conquered = true;
        col_stars[task->dest][def_team]--;
        col_stars[task->dest][att_team]++;
        point(50, 1);
        pr5nt_star(planet->pstar);
        clear_field();
        on_board(stars[task->dest].x, stars[task->dest].y);
    };
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r8d, 0x30(%rsp)
movq %rcx, %r14
movl %edx, %ebx
movq %rsi, %r13
movl %edi, %ebp
leaq 0xd05f(%rip), %r15      # 0x108c0
cmpl $0x0, 0x60(%r15)
je 0x3886
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x4dbd
leaq 0x5a55(%rip), %rdi      # 0x92cf
xorl %eax, %eax
callq 0x2030
andl $0x0, 0x60(%r15)
xorl %ecx, %ecx
testl %ebp, %ebp
sete %cl
movl %ebp, 0x2c(%rsp)
movslq %ebp, %rax
movq %rax, 0x18(%rsp)
leaq 0xce18(%rip), %rdx      # 0x106b8
imull $0x7, 0x18(%r14), %eax
leaq 0x18(%r14), %r12
leaq 0x1c(%r14), %r15
movq %r14, 0x48(%rsp)
imull $0x28, 0x1c(%r14), %r14d
addl %eax, %r14d
movq %rcx, 0x40(%rsp)
imull (%rdx,%rcx,4), %r14d
testl %r14d, %r14d
jle 0x3b69
imull $0x7, 0x18(%r13), %eax
movq %r13, 0x38(%rsp)
imull $0x28, 0x1c(%r13), %r13d
addl %eax, %r13d
movq 0x18(%rsp), %rbp
imull (%rdx,%rbp,4), %r13d
cvtsi2ss %r14d, %xmm0
movss %xmm0, 0xc(%rsp)
cvtsi2ss %r13d, %xmm1
movss %xmm1, 0x20(%rsp)
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
minsd 0x56f9(%rip), %xmm0     # 0x9008
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x56f1(%rip), %xmm0     # 0x9010
callq 0x2060
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x10(%rsp)
movss 0x20(%rsp), %xmm0
divss 0xc(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
minsd 0x56c2(%rip), %xmm0     # 0x9008
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x56ba(%rip), %xmm0     # 0x9010
callq 0x2060
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xc(%rsp)
pushq $0x1
popq %rdi
pushq $0x14
popq %rsi
callq 0x4dbd
cmpl $0x1, %ebp
jne 0x398a
addl $0x60, %ebx
leaq 0x666b(%rip), %rdi      # 0x9fea
movl %ebx, %esi
xorl %eax, %eax
callq 0x2030
jmp 0x3998
leaq 0x59ef(%rip), %rdi      # 0x9380
xorl %eax, %eax
callq 0x2030
movq 0x38(%rsp), %rax
leaq 0x18(%rax), %rcx
movq %rcx, 0x20(%rsp)
addq $0x1c, %rax
movq %rax, 0x50(%rsp)
movq 0x18(%rsp), %rax
leaq 0xccfd(%rip), %rbx      # 0x106b8
movl (%rbx,%rax,4), %edx
movss 0x10(%rsp), %xmm0
mulss 0x59b0(%rip), %xmm0     # 0x937c
cvtss2sd %xmm0, %xmm0
leaq 0x59ad(%rip), %rdi      # 0x9384
movl %r13d, %esi
movb $0x1, %al
callq 0x2030
pushq $0x15
popq %rsi
pushq $0x1
popq %rbp
movl %ebp, %edi
callq 0x4dbd
movq 0x48(%rsp), %rax
movl (%rax), %edx
movl 0x30(%rax), %esi
addl $0x40, %esi
movq 0x40(%rsp), %rax
movl (%rbx,%rax,4), %r8d
movss 0x5970(%rip), %xmm0     # 0x937c
mulss 0xc(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x5981(%rip), %rdi      # 0x939e
movl %r14d, %ecx
movb $0x1, %al
callq 0x2030
pushq $0x16
popq %rsi
movl %ebp, %edi
callq 0x4dbd
leaq 0x5985(%rip), %rdi      # 0x93bd
xorl %eax, %eax
callq 0x2030
pushq $0x17
popq %rsi
movl %ebp, %edi
callq 0x4dbd
leaq 0xce70(%rip), %rax      # 0x108c0
movl %ebp, 0x5c(%rax)
leaq 0x5982(%rip), %rdi      # 0x93dc
xorl %eax, %eax
callq 0x2030
leaq 0x34(%rsp), %r14
movl %ebp, (%r14)
leaq 0x14(%rsp), %r13
movl %ebp, (%r13)
pushq $0x11
popq %rbp
movl %ebp, %edi
pushq $0x16
popq %rsi
callq 0x4dbd
movq 0x20(%rsp), %rdi
movq %r14, %rsi
pushq $0x63
popq %rdx
movss 0x10(%rsp), %xmm0
callq 0x2a34
movq 0x50(%rsp), %rdi
movq %r14, %rsi
pushq $0x62
popq %rdx
movss 0x10(%rsp), %xmm0
callq 0x2a34
movl %ebp, %edi
pushq $0x17
popq %rsi
callq 0x4dbd
movl (%r12), %ebx
movq %r12, %rdi
movq %r13, %rsi
pushq $0x6d
popq %rdx
movss 0xc(%rsp), %xmm0
callq 0x2a34
cmpl %ebx, (%r12)
je 0x3ae1
leaq 0x567b(%rip), %rdi      # 0x9155
xorl %eax, %eax
callq 0x2030
movl (%r15), %ebx
movq %r15, %rdi
movq %r13, %rsi
pushq $0x61
popq %rdx
movss 0xc(%rsp), %xmm0
callq 0x2a34
cmpl %ebx, (%r15)
je 0x3b0b
leaq 0x5a14(%rip), %rdi      # 0x9518
xorl %eax, %eax
callq 0x2030
movl 0x14(%rsp), %eax
movl 0x34(%rsp), %ecx
cmpl $0x0, 0x30(%rsp)
jne 0x3b26
testl %eax, %eax
je 0x3b26
testl %ecx, %ecx
jne 0x3a75
testl %ecx, %ecx
je 0x3b47
pushq $0x11
popq %rdi
pushq $0x16
popq %rsi
callq 0x4dbd
leaq 0x57f0(%rip), %rdi      # 0x932c
xorl %eax, %eax
callq 0x2030
movl 0x14(%rsp), %eax
testl %eax, %eax
movq 0x38(%rsp), %r13
je 0x3b69
pushq $0x11
popq %rdi
pushq $0x17
popq %rsi
callq 0x4dbd
leaq 0x57ca(%rip), %rdi      # 0x932c
xorl %eax, %eax
callq 0x2030
movl (%r12), %eax
addl (%r15), %eax
movq 0x48(%rsp), %r14
movl 0x2c(%rsp), %ebp
jne 0x3c1a
movl 0x30(%r14), %esi
movl %ebp, %edi
callq 0x222c
testl %eax, %eax
je 0x3c1a
pushq $0x1
popq %rbx
pushq $0x18
popq %rsi
movl %ebx, %edi
callq 0x4dbd
movl (%r14), %esi
leaq 0x5852(%rip), %rdi      # 0x93fb
xorl %eax, %eax
callq 0x2030
movl %ebp, 0xc(%r14)
movl %ebp, 0x28(%r14)
movl $0x1, 0x20(%r14)
movslq 0x20(%r13), %rax
leaq 0xb105(%rip), %rcx      # 0xecd0
leaq (%rcx,%rax,8), %rax
movq 0x40(%rsp), %rdx
decl (%rax,%rdx,4)
movslq 0x20(%r13), %rax
leaq (%rcx,%rax,8), %rax
movq 0x18(%rsp), %rcx
incl (%rax,%rcx,4)
pushq $0x32
popq %rdi
movl %ebx, %esi
callq 0x4dbd
movl 0x30(%r14), %edi
callq 0x72df
callq 0x6eef
movslq 0x20(%r13), %rax
imulq $0x18, %rax, %rax
leaq 0xc882(%rip), %rcx      # 0x10490
movl (%rcx,%rax), %edi
movl 0x4(%rcx,%rax), %esi
callq 0x7107
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq