// File: /workspace/github_c_makefile_star2_O2/beejjorgensen[P]conquest/conqmo.c
// Function: move_ships
void move_ships(void)
{
    float ratio, prob;
    int there, dx, dy, i;
    tteam tm;
    struct stplanet *pplanet;
    boolean any, loss;
    /*clear the board */
    for (i = 1; i <= 26; i++) {
        if ((tf[player][i].dest != 0) && (tf[player][i].eta != 0)) {
            board[tf[player][i].x][tf[player][i].y].tf = ' ';
            update_board(tf[player][i].x, tf[player][i].y, right);
        };
    };
    /*move ships of both teams */
    tm = ENEMY;
    do {
        for (i = 1; i <= 26; i++) {
            if ((tf[tm][i].dest != 0) && (tf[tm][i].eta != 0)) {
                tf[tm][i].eta = tf[tm][i].eta - 1;
                if ((!stars[tf[tm][i].dest].visit[tm]) &&
                    (tf[tm][i].eta == 0) && (tm == player)) {

                    left_line[20] = true;
                    cle3r_left();
                    point(1, 19);
                    printw("Task force %c exploring %c.\n", '`' + i,
                           tf[tm][i].dest + '@');
                    prob = (t_e_prob + rnd(t_e_var) * tf[tm][i].t) / 100.0;
                    if (tf[tm][i].s != 0)
                        prob =
                            (s_e_prob +
                             rnd(s_e_var) * tf[tm][i].s) / 100.0;
                    if (tf[tm][i].c != 0)
                        prob =
                            (c_e_prob +
                             rnd(c_e_var) * tf[tm][i].c) / 100.0;
                    if (tf[tm][i].b != 0)
                        prob =
                            (b_e_prob +
                             rnd(b_e_var) * tf[tm][i].b) / 100.0;
                    if (prob > 100)
                        prob = 100;
                    loss = true;
                    lose(&tf[tm][i].t, &loss, 't', prob);
                    lose(&tf[tm][i].s, &loss, 's', prob);
                    lose(&tf[tm][i].c, &loss, 'c', prob);
                    lose(&tf[tm][i].b, &loss, 'b', prob);
                    if (loss)
                        printw("No ships");
                    printw(" destroyed.");
                    left_line[23] = true;
                    pause();
                    tf[tm][i].eta = 1;  /* fool zero tf */
                    zero_tf(tm, i);
                    tf[tm][i].eta = 0;  /* fool zero tf */
                }
                if (tf[tm][i].dest != 0) {
                    if (tm == player) {
                        dx = stars[tf[tm][i].dest].x;
                        dy = stars[tf[tm][i].dest].y;
                        ratio =
                            1.0 -
                            ((float) tf[tm][i].eta / tf[tm][i].origeta);
                        tf[tm][i].x =
                            tf[tm][i].xf +
                            conq_round(ratio * (dx - tf[tm][i].xf));
                        tf[tm][i].y =
                            tf[tm][i].yf +
                            conq_round(ratio * (dy - tf[tm][i].yf));
                        if (tf[tm][i].eta == 0) {
                            pplanet = stars[tf[tm][i].dest].first_planet;
                            while (pplanet != nil) {
                                pplanet->psee_capacity = pplanet->capacity;
                                pplanet = pplanet->next;
                            }
                            player_arrivals[tf[tm][i].dest] = true;
                            if (!stars[tf[tm][i].dest].visit[tm]) {
                                board[tf[tm][i].x][tf[tm][i].y].enemy =
                                    ' ';
                                update_board(tf[tm][i].x, tf[tm][i].y,
                                             left);
                                stars[tf[tm][i].dest].visit[tm] = true;
                            };
                        };
                    };
                    if ((tm == ENEMY) && (tf[tm][i].eta == 0)) {
                        pplanet = stars[tf[tm][i].dest].first_planet;
                        stars[tf[tm][i].dest].visit[ENEMY] = true;
                        while (pplanet != nil) {
                            pplanet->esee_team = pplanet->team;
                            pplanet = pplanet->next;
                        };
                        if (tf_stars[tf[tm][i].dest][ENEMY] > 0) {
                            there = 1;
                            while ((there == i)
                                   || (tf[ENEMY][there].dest !=
                                       tf[ENEMY][i]
                                       .dest)
                                   || (tf[ENEMY][there].eta != 0))
                                there = there + 1;
                            joinsilent(ENEMY, &tf[ENEMY][i],
                                       &tf[ENEMY][there]);
                        };
                        if ((tf_stars[tf[tm][i].dest][player] > 0) ||
                            (col_stars[tf[tm][i].dest][player] > 0))
                            enemy_arrivals[tf[tm][i].dest] = true;
                    };
                    if (tf[tm][i].eta == 0)
                        tf_stars[tf[tm][i].dest][tm]++;
                };
            };
        };
        tm++;
    }
    while (tm != none);
    /* put the good guys on the board */
    for (i = 1; i <= 26; i++) {
        if (tf[player][i].dest != 0) {
            tf[player][i].blasting = false;
            dx = tf[player][i].x;
            dy = tf[player][i].y;
            if (board[dx][dy].tf == ' ')
                board[dx][dy].tf = i + 'a' - 1;
            else if (board[dx][dy].tf != i + 'a' - 1)
                board[dx][dy].tf = '*';
            update_board(dx, dy, right);
        };
    };
    any = false;
    for (i = 1; i <= nstars; i++) {
        if (player_arrivals[i]) {
            if ((!any)) {
                point(33, 21);
                printw("Player arrivals :               ");
                point(50, 21);
                any = true;
            };
            addch(i + 'A' - 1);
            player_arrivals[i] = false;
        };
    };
    if ((!any)) {
        point(33, 21);
        printw(blank_line);
    };
    any = false;
    for (i = 1; i <= nstars; i++) {
        if (enemy_arrivals[i]) {
            if ((!any)) {
                point(33, 22);
                printw("Enemy arrivals  :               ");
                point(50, 22);
                any = true;
            };
            addch(i + 'A' - 1);
            enemy_arrivals[i] = false;
        };
    };
    if ((!any)) {
        point(33, 22);
        printw(blank_line);
    };
    any = false;
    for (i = 1; i <= nstars; i++) {
        if (en_departures[i]) {
            if (!any) {
                point(33, 23);
                printw("Enemy departures:               ");
                point(50, 23);
                any = true;
            };
            addch(i + 'A' - 1);
            en_departures[i] = false;
        };
    };
    if ((!any)) {
        point(33, 23);
        printw(blank_line);
    };
    for (i = 1; i <= nstars; i++)
        revolt(i);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
xorl %ebx, %ebx
leaq 0xa1b9(%rip), %rbp      # 0xf990
cmpq $0x548, %rbx            # imm = 0x548
je 0x582b
cmpl $0x0, 0x5d0(%rbp,%rbx)
je 0x5825
cmpl $0x0, 0x5d4(%rbp,%rbx)
je 0x5825
movslq 0x5b0(%rbp,%rbx), %rdi
movslq 0x5b4(%rbp,%rbx), %rsi
imulq $0xc, %rsi, %rax
imulq $0xc0, %rdi, %rcx
addq 0x8782(%rip), %rcx      # 0xdf98
movl $0x20, 0x8(%rax,%rcx)
xorl %edx, %edx
callq 0x2ca4
addq $0x34, %rbx
jmp 0x57d7
movb $0x1, %al
movl %eax, 0x8(%rsp)
pushq $0x1
popq %r14
movq $0x0, 0x20(%rsp)
xorl %r8d, %r8d
imulq $0x57c, %r8, %r9        # imm = 0x57C
xorl %r10d, %r10d
movq %r8, 0x18(%rsp)
movq %r9, 0x10(%rsp)
cmpq $0x1b, %r14
je 0x5c82
imulq $0x34, %r14, %r15
leaq (%r9,%rbp), %r12
movslq 0x20(%r15,%r12), %rax
testq %rax, %rax
je 0x5c77
addq %r15, %r12
movl 0x24(%r12), %ebx
testl %ebx, %ebx
je 0x5c77
imulq $0x18, %rax, %rdx
addq 0x8738(%rip), %rdx      # 0xdfc8
decl %ebx
movl %ebx, 0x24(%r12)
sete %cl
cmpl $0x0, 0x10(%rdx,%r8,4)
jne 0x5a69
andb 0x20(%rsp), %cl
je 0x5a69
movq %r10, 0x30(%rsp)
leaq 0xb004(%rip), %rax      # 0x108c0
movl $0x1, 0x50(%rax)
callq 0x6f4d
pushq $0x1
popq %rdi
pushq $0x13
popq %rsi
callq 0x4dbd
movl 0x20(%r12), %edx
addl $0x40, %edx
movl %r14d, %esi
orl $0x60, %esi
leaq 0x3e84(%rip), %rdi      # 0x976c
xorl %eax, %eax
callq 0x2030
pushq $0x5
popq %rdi
callq 0x4e19
imull 0x14(%r12), %eax
cvtsi2sd %eax, %xmm0
addsd 0x3e3f(%rip), %xmm0     # 0x9748
leaq 0x10(%r12), %rbx
cmpl $0x0, 0x10(%r12)
je 0x592d
pushq $0xa
popq %rdi
callq 0x4e19
imull (%rbx), %eax
cvtsi2sd %eax, %xmm0
addsd 0x3e23(%rip), %xmm0     # 0x9750
movq %rbx, 0x28(%rsp)
leaq 0x18(%r12), %rbp
cmpl $0x0, 0x18(%r12)
je 0x5957
pushq $0xa
popq %rdi
callq 0x4e19
imull (%rbp), %eax
cvtsi2sd %eax, %xmm0
addsd 0x3e01(%rip), %xmm0     # 0x9758
leaq 0x1c(%r12), %rbx
cmpl $0x0, 0x1c(%r12)
je 0x597b
pushq $0x3
popq %rdi
callq 0x4e19
imull (%rbx), %eax
cvtsi2sd %eax, %xmm0
addsd 0x3de5(%rip), %xmm0     # 0x9760
divsd 0x3695(%rip), %xmm0     # 0x9018
cvtsd2ss %xmm0, %xmm0
leaq 0x14(%r12), %rdi
movss 0x39e8(%rip), %xmm1     # 0x937c
minss %xmm0, %xmm1
movss %xmm1, 0x4(%rsp)
movl $0x1, 0xc(%rsp)
leaq 0xc(%rsp), %r13
movq %r13, %rsi
pushq $0x74
popq %rdx
movaps %xmm1, %xmm0
callq 0x2a34
movq 0x28(%rsp), %rdi
movq %r13, %rsi
pushq $0x73
popq %rdx
movss 0x4(%rsp), %xmm0
callq 0x2a34
movq %rbp, %rdi
movq %r13, %rsi
pushq $0x63
popq %rdx
movss 0x4(%rsp), %xmm0
callq 0x2a34
movq %rbx, %rdi
movq %r13, %rsi
pushq $0x62
popq %rdx
movss 0x4(%rsp), %xmm0
callq 0x2a34
cmpl $0x0, 0xc(%rsp)
je 0x5a0c
leaq 0x3d84(%rip), %rdi      # 0x9789
xorl %eax, %eax
callq 0x2030
xorl %ebx, %ebx
leaq 0x3d7d(%rip), %rdi      # 0x9792
xorl %eax, %eax
callq 0x2030
pushq $0x1
popq %r13
leaq 0xae99(%rip), %rax      # 0x108c0
movl %r13d, 0x5c(%rax)
callq 0x71b1
movl %r13d, 0x24(%r12)
movl %r13d, %edi
movl %r14d, %esi
callq 0x35b4
andl $0x0, 0x24(%r12)
movl 0x20(%r12), %eax
testl %eax, %eax
leaq 0x9f3c(%rip), %rbp      # 0xf990
movq 0x18(%rsp), %r8
movq 0x10(%rsp), %r9
movq 0x30(%rsp), %r10
je 0x5c77
testb $0x1, 0x20(%rsp)
je 0x5b9b
cltq
imulq $0x18, %rax, %rax
leaq 0xaa0f(%rip), %rdx      # 0x10490
movl (%rdx,%rax), %ecx
movl 0x4(%rdx,%rax), %ebp
cvtsi2ss %ebx, %xmm0
cvtsi2ssl 0x28(%r12), %xmm1
divss %xmm1, %xmm0
movss 0x3cc9(%rip), %xmm1     # 0x9768
subss %xmm0, %xmm1
movss %xmm1, 0x4(%rsp)
movl 0x8(%r12), %ebx
subl %ebx, %ecx
cvtsi2ss %ecx, %xmm0
mulss %xmm1, %xmm0
movq %r10, %r13
callq 0x4e31
addl %ebx, %eax
movl %eax, (%r12)
movl 0xc(%r12), %ebx
subl %ebx, %ebp
cvtsi2ss %ebp, %xmm0
leaq 0x9eb8(%rip), %rbp      # 0xf990
mulss 0x4(%rsp), %xmm0
callq 0x4e31
movq %r13, %r10
movq 0x10(%rsp), %r9
movq 0x18(%rsp), %r8
addl %ebx, %eax
movl %eax, 0x4(%r12)
cmpl $0x0, 0x24(%r12)
jne 0x5b9b
movslq 0x20(%r12), %rdx
imulq $0x18, %rdx, %rcx
leaq 0xa97d(%rip), %rsi      # 0x10490
addq %rcx, %rsi
addq $0x8, %rsi
movq (%rsi), %rsi
testq %rsi, %rsi
je 0x5b2e
movl 0x4(%rsi), %edi
movl %edi, 0x8(%rsi)
addq $0x38, %rsi
jmp 0x5b1a
leaq 0xad1b(%rip), %rsi      # 0x10850
movl $0x1, (%rsi,%rdx,4)
addq 0x8485(%rip), %rcx      # 0xdfc8
cmpl $0x0, 0x10(%rcx,%r8,4)
jne 0x5b9b
movslq (%r12), %rdi
movslq %eax, %rcx
imulq $0xc, %rcx, %rcx
imulq $0xc0, %rdi, %rdx
addq 0x8434(%rip), %rdx      # 0xdf98
movl $0x20, (%rcx,%rdx)
movl %eax, %esi
pushq $0x1
popq %rdx
callq 0x2ca4
movq %r13, %r10
movq 0x10(%rsp), %r9
movq 0x18(%rsp), %r8
movslq 0x20(%r12), %rax
imulq $0x18, %rax, %rax
addq 0x8436(%rip), %rax      # 0xdfc8
movl $0x1, 0x10(%rax,%r8,4)
testb $0x1, 0x8(%rsp)
je 0x5c5b
cmpl $0x0, 0x24(%r12)
jne 0x5c77
movslq 0x20(%r12), %rax
imulq $0x18, %rax, %rdx
leaq 0xa8ce(%rip), %rsi      # 0x10490
movq 0x8(%rsi,%rdx), %rcx
movl $0x1, 0x10(%rsi,%rdx)
testq %rcx, %rcx
je 0x5be0
movl 0xc(%rcx), %edx
movl %edx, 0x28(%rcx)
movq 0x38(%rcx), %rcx
jmp 0x5bcf
leaq 0x9039(%rip), %rcx      # 0xec20
cmpl $0x0, (%rcx,%rax,8)
jle 0x5c31
addq %rbp, %r15
leaq 0x34(%rbp), %rdx
movq %r10, %rax
subq $0x1, %rax
jb 0x5c0c
movl 0x20(%rdx), %ecx
cmpl 0x20(%r15), %ecx
jne 0x5c0c
cmpl $0x0, 0x24(%rdx)
je 0x5c12
addq $0x34, %rdx
jmp 0x5bf7
xorl %edi, %edi
movq %r15, %rsi
movq %r10, %rbx
callq 0x29fc
movq %rbx, %r10
movq 0x10(%rsp), %r9
movq 0x18(%rsp), %r8
movslq 0x20(%r12), %rax
leaq 0x8fe8(%rip), %rcx      # 0xec20
cmpl $0x0, 0x4(%rcx,%rax,8)
jg 0x5c4d
leaq 0x908a(%rip), %rcx      # 0xecd0
cmpl $0x0, 0x4(%rcx,%rax,8)
jle 0x5c5b
leaq 0xab3c(%rip), %rcx      # 0x10790
movl $0x1, (%rcx,%rax,4)
cmpl $0x0, 0x24(%r12)
jne 0x5c77
movslq 0x20(%r12), %rax
shlq $0x3, %rax
addq 0x836d(%rip), %rax      # 0xdfe0
incl (%rax,%r8,4)
incq %r14
incq %r10
jmp 0x5855
movl $0x0, 0x8(%rsp)
pushq $0x1
popq %r14
movq %r14, %r8
testb $0x1, 0x20(%rsp)
movb $0x1, %al
movq %rax, 0x20(%rsp)
je 0x5841
movl $0x5b0, %ebx            # imm = 0x5B0
addq 0x82f9(%rip), %rbx      # 0xdfa8
pushq $0x61
popq %r14
pushq $0x2a
popq %rbp
leaq 0x90d3(%rip), %r15      # 0xed90
cmpq $0x7b, %r14
je 0x5d16
cmpl $0x0, 0x20(%rbx)
je 0x5d0d
andl $0x0, 0x2c(%rbx)
movslq (%rbx), %rdi
movslq 0x4(%rbx), %rsi
imulq $0xc, %rsi, %rax
imulq $0xc0, %rdi, %rcx
addq %r15, %rcx
movl 0x8(%rax,%rcx), %r8d
cmpq $0x20, %r8
jne 0x5cf6
leal -0x60(%r14), %edx
orl $0x60, %edx
jmp 0x5cfd
movl %ebp, %edx
cmpq %r8, %r14
je 0x5d06
addq %rcx, %rax
addq $0x8, %rax
movl %edx, (%rax)
xorl %edx, %edx
callq 0x2ca4
incq %r14
addq $0x34, %rbx
jmp 0x5cbd
pushq $0x1
popq %rbx
pushq $0x21
popq %rbp
pushq $0x15
popq %r14
leaq 0x3a77(%rip), %r15      # 0x979e
pushq $0x32
popq %r12
movq 0x82b6(%rip), %r13      # 0xdfe8
xorl %eax, %eax
cmpq $0x16, %rbx
je 0x5d8b
leaq 0xab0f(%rip), %rcx      # 0x10850
cmpl $0x0, (%rcx,%rbx,4)
je 0x5d86
testl %eax, %eax
jne 0x5d6a
movl %ebp, %edi
movl %r14d, %esi
callq 0x4dbd
movq %r15, %rdi
xorl %eax, %eax
callq 0x2030
movl %r12d, %edi
movl %r14d, %esi
callq 0x4dbd
movq (%r13), %rdi
movl %ebx, %esi
orl $0x40, %esi
callq 0x2090
leaq 0xaad1(%rip), %rax      # 0x10850
andl $0x0, (%rax,%rbx,4)
pushq $0x1
popq %rax
incq %rbx
jmp 0x5d34
testl %eax, %eax
jne 0x5da8
pushq $0x21
popq %rdi
pushq $0x15
popq %rsi
callq 0x4dbd
leaq 0x352e(%rip), %rdi      # 0x92cf
xorl %eax, %eax
callq 0x2030
pushq $0x1
popq %r12
pushq $0x16
popq %rbp
leaq 0x3a09(%rip), %r14      # 0x97bf
pushq $0x32
popq %r15
pushq $0x1
popq %rbx
xorl %eax, %eax
cmpq $0x16, %r12
je 0x5e17
leaq 0xa9c4(%rip), %rcx      # 0x10790
cmpl $0x0, (%rcx,%r12,4)
je 0x5e12
testl %eax, %eax
jne 0x5df5
pushq $0x21
popq %rdi
movl %ebp, %esi
callq 0x4dbd
movq %r14, %rdi
xorl %eax, %eax
callq 0x2030
movl %r15d, %edi
movl %ebp, %esi
callq 0x4dbd
movq (%r13), %rdi
movl %r12d, %esi
orl $0x40, %esi
callq 0x2090
leaq 0xa985(%rip), %rax      # 0x10790
andl $0x0, (%rax,%r12,4)
movl %ebx, %eax
incq %r12
jmp 0x5dbf
testl %eax, %eax
jne 0x5e34
pushq $0x21
popq %rdi
pushq $0x16
popq %rsi
callq 0x4dbd
leaq 0x34a2(%rip), %rdi      # 0x92cf
xorl %eax, %eax
callq 0x2030
pushq $0x1
popq %r12
leaq 0xa9b1(%rip), %rbx      # 0x107f0
pushq $0x17
popq %rbp
pushq $0x32
popq %r15
pushq $0x1
popq %r14
xorl %eax, %eax
cmpq $0x16, %r12
je 0x5e9b
cmpl $0x0, (%rbx,%r12,4)
je 0x5e96
testl %eax, %eax
jne 0x5e7f
pushq $0x21
popq %rdi
movl %ebp, %esi
callq 0x4dbd
leaq 0x3972(%rip), %rdi      # 0x97e0
xorl %eax, %eax
callq 0x2030
movl %r15d, %edi
movl %ebp, %esi
callq 0x4dbd
movq (%r13), %rdi
movl %r12d, %esi
orl $0x40, %esi
callq 0x2090
andl $0x0, (%rbx,%r12,4)
movl %r14d, %eax
incq %r12
jmp 0x5e4c
testl %eax, %eax
jne 0x5eb8
pushq $0x21
popq %rdi
pushq $0x17
popq %rsi
callq 0x4dbd
leaq 0x341e(%rip), %rdi      # 0x92cf
xorl %eax, %eax
callq 0x2030
pushq $0x1
popq %rbx
cmpl $0x16, %ebx
je 0x5ecb
movl %ebx, %edi
callq 0x4248
incl %ebx
jmp 0x5ebb
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop