// File: /workspace/github_c_makefile_star2_O3/beejjorgensen[P]conquest/conqbat.c
// Function: play_salvo
void play_salvo(int starnum, boolean *Battl9)
{
    boolean battle;
    char tf_char, planch;
    int planet_num = 0, tf_num;
    boolean found;
    struct stplanet *pplanet;
    boolean first_time;
    battle = *Battl9;
    printw("Attack planet ");
    pplanet = stars[starnum].first_planet;
    if ((col_stars[starnum][ENEMY] > 1)) {
        printw(":");
        get_char(&planch);
        cle3r_left();
        planet_num = planch - '0';
        found = false;
        while (!found) {
            if (pplanet->number == planet_num)
                found = true;
            else {
                if (pplanet->next == nil)
                    found = true;
                else
                    pplanet = pplanet->next;
            }
        }
        if (pplanet->number != planet_num) {
            planet_num = 0;
            error_message();
            printw("! That is not a useable planet");
        } else if (pplanet->team != ENEMY) {
            error_message();
            printw(" !Not an enemy colony");
            planet_num = 0;
        };
    } else {
        while (pplanet->team != ENEMY)
            pplanet = pplanet->next;
        printw("%d", pplanet->number);
        cle3r_left();
    };
    if (planet_num != 0) {
        point(1, 19);
        printw(" attacking tf ");
        if (tf_stars[starnum][player] > 1) {
            printw(":");
            get_char(&tf_char);
            tf_num = tf_char - 'A' + 1;
        } else {
            tf_num = 1;
            while (tf[player][tf_num].dest != starnum ||
                   tf[player][tf_num].eta != 0)
                tf_num++;
            addch(tf_num + 'a' - 1);
        }
        if (tf_num < 1 || tf_num > 26) {
            error_message();
            printw(" !Illegal tf");
        } else if (tf[player][tf_num].dest == 0) {
            error_message();
            printw(" !Nonexistent tf");
        } else if ((tf[player][tf_num].dest != starnum) ||
                   (tf[player][tf_num].eta != 0)) {
            error_message();
            printw(" !Tf is not at this star      ");
        } else if ((tf[player][tf_num].b + tf[player][tf_num].c) == 0) {
            error_message();
            printw(" !Tf has no warships");
        } else {
            first_time = !pplanet->under_attack;
            if (!(pplanet->under_attack)) {
                pplanet->under_attack = true;
                point(50, 1);
                pr5nt_star(starnum);
                clear_field();
            };
            fire_salvo(player, &tf[player][tf_num], tf_num,
                       pplanet, first_time);
            zero_tf(player, tf_num);
            battle = (col_stars[starnum][ENEMY] > 0) &&
                (any_bc(player, starnum));
        };
    };
    *Battl9 = battle;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movl %edi, %ebp
movl (%rsi), %r13d
leaq 0x567b(%rip), %rdi      # 0x9463
xorl %eax, %eax
callq 0x2030
movslq %ebp, %r12
leaq (%r12,%r12,2), %rax
leaq 0xb693(%rip), %rcx      # 0xf490
movq 0x8(%rcx,%rax,8), %r14
leaq 0x9ec7(%rip), %rax      # 0xdcd0
cmpl $0x1, (%rax,%r12,8)
jle 0x3e62
leaq 0x5bb0(%rip), %rdi      # 0x99c7
xorl %eax, %eax
callq 0x2030
leaq 0xe(%rsp), %r15
movq %r15, %rdi
callq 0x7153
callq 0x7322
movsbl (%r15), %eax
addl $-0x30, %eax
movq %r14, %r15
cmpl %eax, (%r14)
je 0x3e48
movq 0x38(%r15), %r14
testq %r14, %r14
jne 0x3e37
cmpl %eax, (%r15)
jne 0x3e87
cmpl $0x0, 0xc(%r15)
je 0x3eac
callq 0x738e
leaq 0x5631(%rip), %rdi      # 0x9491
jmp 0x3e93
cmpl $0x0, 0xc(%r14)
je 0x3e6f
movq 0x38(%r14), %r14
jmp 0x3e62
movl (%r14), %esi
leaq 0x59f6(%rip), %rdi      # 0x986f
xorl %eax, %eax
callq 0x2030
callq 0x7322
jmp 0x3e9a
callq 0x738e
leaq 0x55df(%rip), %rdi      # 0x9472
xorl %eax, %eax
callq 0x2030
movl %r13d, (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %eax, %eax
je 0x3e9a
movl $0x1, %edi
movl $0x13, %esi
callq 0x4f79
leaq 0x55e1(%rip), %rdi      # 0x94a7
xorl %eax, %eax
callq 0x2030
leaq 0x9d4c(%rip), %rax      # 0xdc20
cmpl $0x1, 0x4(%rax,%r12,8)
jle 0x3f01
leaq 0x5ae4(%rip), %rdi      # 0x99c7
xorl %eax, %eax
callq 0x2030
leaq 0xf(%rsp), %r14
movq %r14, %rdi
callq 0x7153
movsbl (%r14), %r14d
addl $-0x40, %r14d
jmp 0x3f37
movl $0x5d4, %eax            # imm = 0x5D4
addq 0x90a3(%rip), %rax      # 0xcfb0
movl $0x61, %esi
cmpl %ebp, -0x4(%rax)
jne 0x3f1c
cmpl $0x0, (%rax)
je 0x3f24
incl %esi
addq $0x34, %rax
jmp 0x3f12
leal -0x60(%rsi), %r14d
movq 0x90b9(%rip), %rax      # 0xcfe8
movq (%rax), %rdi
callq 0x20a0
leal -0x1b(%r14), %eax
cmpl $-0x1b, %eax
ja 0x3f51
callq 0x738e
leaq 0x556a(%rip), %rdi      # 0x94b6
jmp 0x3e93
movl %r14d, %eax
imulq $0x34, %rax, %rax
leaq 0xaa31(%rip), %rcx      # 0xe990
movl 0x59c(%rcx,%rax), %edx
testl %edx, %edx
je 0x3f90
cmpl %ebp, %edx
jne 0x3f7f
leaq (%rcx,%rax), %rsi
addq $0x57c, %rsi            # imm = 0x57C
cmpl $0x0, 0x24(%rsi)
je 0x3fa1
callq 0x738e
leaq 0x5549(%rip), %rdi      # 0x94d4
jmp 0x3e93
callq 0x738e
leaq 0x5527(%rip), %rdi      # 0x94c3
jmp 0x3e93
movl 0x1c(%rsi), %eax
addl 0x18(%rsi), %eax
jne 0x3fba
callq 0x738e
leaq 0x553e(%rip), %rdi      # 0x94f3
jmp 0x3e93
xorl %r13d, %r13d
cmpl $0x0, 0x24(%r15)
sete %r13b
jne 0x3ff5
movl $0x1, 0x24(%r15)
movl $0x32, %edi
movq %rsi, 0x10(%rsp)
movl $0x1, %esi
callq 0x4f79
movl %ebp, %edi
callq 0x7730
callq 0x72c9
movq 0x10(%rsp), %rsi
movl $0x1, %edi
movl %r14d, %edx
movq %r15, %rcx
movl %r13d, %r8d
callq 0x398d
movl $0x1, %edi
movl %r14d, %esi
callq 0x36f5
leaq 0x9cb4(%rip), %rax      # 0xdcd0
cmpl $0x0, (%rax,%r12,8)
jle 0x403d
movl $0x1, %edi
movl %ebp, %esi
callq 0x223c
xorl %r13d, %r13d
testl %eax, %eax
setne %r13b
jmp 0x3e9a
xorl %r13d, %r13d
jmp 0x3e9a
nopl (%rax)