// File: /workspace/github_c_makefile_star2_O3/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 $0x48, %rsp
movl %r8d, 0x30(%rsp)
movq %rcx, %r13
movl %edx, 0x20(%rsp)
movq %rsi, %rbp
movl %edi, %r14d
leaq 0xbf0c(%rip), %rbx      # 0xf8c0
cmpl $0x0, 0x60(%rbx)
je 0x39de
movl $0x1, %edi
movl $0x18, %esi
callq 0x4f79
leaq 0x5947(%rip), %rdi      # 0x9317
xorl %eax, %eax
callq 0x2030
movl $0x0, 0x60(%rbx)
xorl %esi, %esi
testl %r14d, %r14d
sete %sil
movl %r14d, 0x2c(%rsp)
movslq %r14d, %rax
movq %rax, 0x18(%rsp)
leaq 0xbcbd(%rip), %rdi      # 0xf6b8
leaq 0x18(%r13), %r15
movl 0x18(%r13), %eax
movl 0x1c(%r13), %ecx
leal (,%rax,8), %edx
subl %eax, %edx
leaq 0x1c(%r13), %r12
leal (%rcx,%rcx,4), %eax
leal (%rdx,%rax,8), %r14d
movq %rsi, 0x40(%rsp)
imull (%rdi,%rsi,4), %r14d
testl %r14d, %r14d
jle 0x3d08
movq %r13, 0x38(%rsp)
movl 0x18(%rbp), %eax
movl 0x1c(%rbp), %ecx
leal (,%rax,8), %edx
subl %eax, %edx
leal (%rcx,%rcx,4), %eax
leal (%rdx,%rax,8), %r13d
movq 0x18(%rsp), %rbx
imull (%rdi,%rbx,4), %r13d
cvtsi2ss %r14d, %xmm0
movss %xmm0, 0x4(%rsp)
cvtsi2ss %r13d, %xmm1
movss %xmm1, 0x10(%rsp)
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
minsd 0x558f(%rip), %xmm0     # 0x9008
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x5587(%rip), %xmm0     # 0x9010
callq 0x2070
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x8(%rsp)
movss 0x10(%rsp), %xmm0
divss 0x4(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
minsd 0x5558(%rip), %xmm0     # 0x9008
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
mulsd 0x5550(%rip), %xmm0     # 0x9010
callq 0x2070
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x4(%rsp)
movl $0x1, %edi
movl $0x14, %esi
callq 0x4f79
cmpl $0x1, %ebx
jne 0x3afa
movl 0x20(%rsp), %esi
addl $0x60, %esi
leaq 0x6539(%rip), %rdi      # 0xa02a
xorl %eax, %eax
callq 0x2030
jmp 0x3b08
leaq 0x58c7(%rip), %rdi      # 0x93c8
xorl %eax, %eax
callq 0x2030
leaq 0x18(%rbp), %rax
movq %rax, 0x20(%rsp)
movq %rbp, 0x10(%rsp)
leaq 0x1c(%rbp), %rbx
movq 0x18(%rsp), %rax
leaq 0xbb92(%rip), %rbp      # 0xf6b8
movl (%rbp,%rax,4), %edx
movss 0x8(%rsp), %xmm0
mulss 0x588c(%rip), %xmm0     # 0x93c4
cvtss2sd %xmm0, %xmm0
leaq 0x5889(%rip), %rdi      # 0x93cc
movl %r13d, %esi
movb $0x1, %al
callq 0x2030
movl $0x1, %r13d
movl $0x1, %edi
movl $0x15, %esi
callq 0x4f79
movq 0x38(%rsp), %rax
movl (%rax), %edx
movl 0x30(%rax), %esi
addl $0x40, %esi
movq 0x40(%rsp), %rax
movl (%rbp,%rax,4), %r8d
movss 0x5843(%rip), %xmm0     # 0x93c4
mulss 0x4(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x5854(%rip), %rdi      # 0x93e6
movl %r14d, %ecx
movb $0x1, %al
callq 0x2030
movl $0x1, %edi
movl $0x16, %esi
callq 0x4f79
leaq 0x5853(%rip), %rdi      # 0x9405
xorl %eax, %eax
callq 0x2030
movl $0x1, %edi
movl $0x17, %esi
callq 0x4f79
leaq 0xbcf1(%rip), %rax      # 0xf8c0
movl %r13d, 0x5c(%rax)
leaq 0x584a(%rip), %rdi      # 0x9424
xorl %eax, %eax
callq 0x2030
leaq 0x34(%rsp), %r14
movl $0x1, %eax
movl %eax, (%r14)
leaq 0xc(%rsp), %r13
movl %eax, (%r13)
movl $0x11, %edi
movl $0x16, %esi
callq 0x4f79
movq 0x20(%rsp), %rdi
movq %r14, %rsi
movl $0x63, %edx
movss 0x8(%rsp), %xmm0
callq 0x2b73
movq %rbx, %rdi
movq %r14, %rsi
movl $0x62, %edx
movss 0x8(%rsp), %xmm0
callq 0x2b73
movl $0x11, %edi
movl $0x17, %esi
callq 0x4f79
movl (%r15), %ebp
movq %r15, %rdi
movq %r13, %rsi
movl $0x6d, %edx
movss 0x4(%rsp), %xmm0
callq 0x2b73
cmpl %ebp, (%r15)
je 0x3c6f
leaq 0x5535(%rip), %rdi      # 0x919d
xorl %eax, %eax
callq 0x2030
movl (%r12), %ebp
movq %r12, %rdi
movq %r13, %rsi
movl $0x61, %edx
movss 0x4(%rsp), %xmm0
callq 0x2b73
cmpl %ebp, (%r12)
je 0x3c9d
leaq 0x58ca(%rip), %rdi      # 0x9560
xorl %eax, %eax
callq 0x2030
movl 0xc(%rsp), %eax
movl 0x34(%rsp), %ecx
cmpl $0x0, 0x30(%rsp)
jne 0x3cb8
testl %eax, %eax
je 0x3cb8
testl %ecx, %ecx
jne 0x3bf7
testl %ecx, %ecx
je 0x3cdd
movl $0x11, %edi
movl $0x16, %esi
callq 0x4f79
leaq 0x56a2(%rip), %rdi      # 0x9374
xorl %eax, %eax
callq 0x2030
movl 0xc(%rsp), %eax
testl %eax, %eax
movq 0x10(%rsp), %rbp
movq 0x38(%rsp), %r13
je 0x3d08
movl $0x11, %edi
movl $0x17, %esi
callq 0x4f79
leaq 0x5673(%rip), %rdi      # 0x9374
xorl %eax, %eax
callq 0x2030
movl (%r15), %eax
addl (%r12), %eax
movl 0x2c(%rsp), %ebx
jne 0x3dbc
movl 0x30(%r13), %esi
movl %ebx, %edi
callq 0x223c
testl %eax, %eax
je 0x3dbc
movl $0x1, %edi
movl $0x18, %esi
callq 0x4f79
movl (%r13), %esi
leaq 0x56fd(%rip), %rdi      # 0x9443
xorl %eax, %eax
callq 0x2030
movl %ebx, 0xc(%r13)
movl %ebx, 0x28(%r13)
movl $0x1, 0x20(%r13)
movslq 0x20(%rbp), %rax
leaq 0x9f68(%rip), %rcx      # 0xdcd0
leaq (%rcx,%rax,8), %rax
movq 0x40(%rsp), %rdx
decl (%rax,%rdx,4)
movslq 0x20(%rbp), %rax
leaq (%rcx,%rax,8), %rax
movq 0x18(%rsp), %rcx
incl (%rax,%rcx,4)
movl $0x32, %edi
movl $0x1, %esi
callq 0x4f79
movl 0x30(%r13), %edi
callq 0x7730
callq 0x72c9
movslq 0x20(%rbp), %rax
leaq (%rax,%rax,2), %rax
leaq 0xb6e0(%rip), %rcx      # 0xf490
movl (%rcx,%rax,8), %edi
movl 0x4(%rcx,%rax,8), %esi
callq 0x752b
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq