// File: /workspace/github_c_makefile_star2_O1/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), %r15d
leaq 0x569c(%rip), %rdi      # 0x941b
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x2030
movslq %ebp, %r12
leaq (%r12,%r12,2), %rax
leaq 0xb709(%rip), %rcx      # 0xf4a0
movq 0x8(%rcx,%rax,8), %r14
leaq 0x9f3d(%rip), %rax      # 0xdce0
cmpl $0x1, (%rax,%r12,8)
movl %r15d, 0x8(%rsp)
jle 0x3e17
leaq 0x5bc1(%rip), %rdi      # 0x9977
xorl %eax, %eax
callq 0x2030
leaq 0x16(%rsp), %r15
movq %r15, %rdi
callq 0x7187
callq 0x7377
movsbl (%r15), %r15d
addl $-0x30, %r15d
movl $0x1, %eax
cmpl %r15d, (%r14)
jne 0x3de9
movl $0x1, %r13d
jmp 0x3df8
movq 0x38(%r14), %rcx
testq %rcx, %rcx
cmovel %eax, %r13d
cmovneq %rcx, %r14
testl %r13d, %r13d
je 0x3ddc
cmpl %r15d, (%r14)
jne 0x3e3f
cmpl $0x0, 0xc(%r14)
je 0x3e55
callq 0x73e3
leaq 0x5634(%rip), %rdi      # 0x9449
jmp 0x3e4b
cmpl $0x0, 0xc(%r14)
je 0x3e24
movq 0x38(%r14), %r14
jmp 0x3e17
movl (%r14), %esi
leaq 0x59f1(%rip), %rdi      # 0x981f
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x2030
callq 0x7377
jmp 0x3e55
callq 0x73e3
leaq 0x55df(%rip), %rdi      # 0x942a
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x2030
testl %r15d, %r15d
je 0x3f4b
movl $0x1, %edi
movl $0x13, %esi
callq 0x4f69
leaq 0x55eb(%rip), %rdi      # 0x945f
xorl %eax, %eax
callq 0x2030
leaq 0x9dae(%rip), %rax      # 0xdc30
cmpl $0x1, 0x4(%rax,%r12,8)
jle 0x3eaf
leaq 0x5ae6(%rip), %rdi      # 0x9977
xorl %eax, %eax
callq 0x2030
leaq 0x17(%rsp), %r15
movq %r15, %rdi
callq 0x7187
movsbl (%r15), %r15d
addl $-0x40, %r15d
jmp 0x3ee5
movl $0x5d4, %eax            # imm = 0x5D4
addq 0x90fd(%rip), %rax      # 0xcfb8
movl $0x61, %esi
cmpl %ebp, -0x4(%rax)
jne 0x3eca
cmpl $0x0, (%rax)
je 0x3ed2
incl %esi
addq $0x34, %rax
jmp 0x3ec0
leal -0x60(%rsi), %r15d
movq 0x910b(%rip), %rax      # 0xcfe8
movq (%rax), %rdi
callq 0x20a0
leal -0x1b(%r15), %eax
cmpl $-0x1b, %eax
ja 0x3efc
callq 0x73e3
leaq 0x5574(%rip), %rdi      # 0x946e
jmp 0x3f44
movl %r15d, %eax
imulq $0x34, %rax, %rax
leaq 0xaa96(%rip), %rcx      # 0xe9a0
movl 0x59c(%rcx,%rax), %edx
testl %edx, %edx
je 0x3f38
cmpl %ebp, %edx
jne 0x3f2a
leaq (%rcx,%rax), %rsi
addq $0x57c, %rsi            # imm = 0x57C
cmpl $0x0, 0x24(%rsi)
je 0x3f60
callq 0x73e3
leaq 0x5556(%rip), %rdi      # 0x948c
jmp 0x3f44
callq 0x73e3
leaq 0x5537(%rip), %rdi      # 0x947b
xorl %eax, %eax
callq 0x2030
movl 0x8(%rsp), %ecx
movl %ecx, (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x1c(%rsi), %eax
addl 0x18(%rsi), %eax
jne 0x3f76
callq 0x73e3
leaq 0x5537(%rip), %rdi      # 0x94ab
jmp 0x3f44
xorl %r13d, %r13d
cmpl $0x0, 0x24(%r14)
sete %r13b
jne 0x3fb1
movl $0x1, 0x24(%r14)
movl $0x32, %edi
movq %rsi, 0x8(%rsp)
movl $0x1, %esi
callq 0x4f69
movl %ebp, %edi
callq 0x7793
callq 0x731e
movq 0x8(%rsp), %rsi
movl $0x1, %edi
movl %r15d, %edx
movq %r14, %rcx
movl %r13d, %r8d
callq 0x391d
movl $0x1, %edi
movl %r15d, %esi
callq 0x3695
leaq 0x9d08(%rip), %rax      # 0xdce0
cmpl $0x0, (%rax,%r12,8)
jle 0x3ff7
movl $0x1, %edi
movl %ebp, %esi
callq 0x224c
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
jmp 0x3f4f
xorl %ecx, %ecx
jmp 0x3f4f
nop