// File: /workspace/github_c_makefile_star2_O3/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 0x8ee1(%rip), %r15      # 0xe990
cmpl $0x0, 0x5d0(%r15,%rbx)
je 0x5af7
cmpl $0x0, 0x5d4(%r15,%rbx)
je 0x5af7
movslq 0x5b0(%r15,%rbx), %rdi
movslq 0x5b4(%r15,%rbx), %rsi
leaq (%rsi,%rsi,2), %rax
leaq (%rdi,%rdi,2), %rcx
shlq $0x6, %rcx
addq 0x74b8(%rip), %rcx      # 0xcfa0
movl $0x20, 0x8(%rcx,%rax,4)
xorl %edx, %edx
callq 0x2df8
addq $0x34, %rbx
cmpq $0x548, %rbx            # imm = 0x548
jne 0x5aaf
movb $0x1, %al
movl %eax, 0x8(%rsp)
movq $0x0, 0x20(%rsp)
xorl %r8d, %r8d
movl $0x1, %r13d
imulq $0x57c, %r8, %r9        # imm = 0x57C
xorl %r14d, %r14d
movq %r8, 0x18(%rsp)
movq %r9, 0x10(%rsp)
imulq $0x34, %r13, %rbp
leaq (%r9,%r15), %r12
movslq 0x20(%rbp,%r12), %rax
testq %rax, %rax
je 0x5f76
addq %rbp, %r12
movl 0x24(%r12), %ebx
testl %ebx, %ebx
je 0x5f76
leaq (%rax,%rax,2), %rdx
shlq $0x3, %rdx
addq 0x7463(%rip), %rdx      # 0xcfc8
decl %ebx
movl %ebx, 0x24(%r12)
sete %cl
cmpl $0x0, 0x10(%rdx,%r8,4)
jne 0x5d63
andb 0x20(%rsp), %cl
je 0x5d63
leaq 0x9d34(%rip), %rax      # 0xf8c0
movl $0x1, 0x50(%rax)
callq 0x7322
movl $0x1, %edi
movl $0x13, %esi
callq 0x4f79
movl 0x20(%r12), %edx
addl $0x40, %edx
movl %r13d, %esi
orl $0x60, %esi
leaq 0x3bf0(%rip), %rdi      # 0x97ac
xorl %eax, %eax
callq 0x2030
movl $0x5, %edi
callq 0x4fd5
imull 0x14(%r12), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
addsd 0x3ba6(%rip), %xmm0     # 0x9788
leaq 0x10(%r12), %rbx
cmpl $0x0, 0x10(%r12)
je 0x5c0b
movl $0xa, %edi
callq 0x4fd5
imull (%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
addsd 0x3b85(%rip), %xmm0     # 0x9790
leaq 0x18(%r12), %r15
cmpl $0x0, 0x18(%r12)
je 0x5c35
movl $0xa, %edi
callq 0x4fd5
imull (%r15), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
addsd 0x3b63(%rip), %xmm0     # 0x9798
movq %r15, 0x28(%rsp)
movq %rbx, 0x30(%rsp)
leaq 0x1c(%r12), %r15
cmpl $0x0, 0x1c(%r12)
je 0x5c69
movl $0x3, %edi
callq 0x4fd5
imull (%r15), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
addsd 0x3b37(%rip), %xmm0     # 0x97a0
divsd 0x33a7(%rip), %xmm0     # 0x9018
cvtsd2ss %xmm0, %xmm0
leaq 0x14(%r12), %rdi
movss 0x3742(%rip), %xmm1     # 0x93c4
minss %xmm0, %xmm1
movss %xmm1, 0x4(%rsp)
movl $0x1, 0xc(%rsp)
leaq 0xc(%rsp), %rbx
movq %rbx, %rsi
movl $0x74, %edx
movaps %xmm1, %xmm0
callq 0x2b73
movq 0x30(%rsp), %rdi
movq %rbx, %rsi
movl $0x73, %edx
movss 0x4(%rsp), %xmm0
callq 0x2b73
movq 0x28(%rsp), %rdi
movq %rbx, %rsi
movl $0x63, %edx
movss 0x4(%rsp), %xmm0
callq 0x2b73
movq %r15, %rdi
movq %rbx, %rsi
movl $0x62, %edx
movss 0x4(%rsp), %xmm0
callq 0x2b73
cmpl $0x0, 0xc(%rsp)
je 0x5d04
leaq 0x3acc(%rip), %rdi      # 0x97c9
xorl %eax, %eax
callq 0x2030
xorl %ebx, %ebx
leaq 0x3ac5(%rip), %rdi      # 0x97d2
xorl %eax, %eax
callq 0x2030
leaq 0x9ba5(%rip), %rax      # 0xf8c0
movl $0x1, %r15d
movl %r15d, 0x5c(%rax)
callq 0x75db
movl %r15d, 0x24(%r12)
movl $0x1, %edi
movl %r13d, %esi
callq 0x36f5
movl $0x0, 0x24(%r12)
movl 0x20(%r12), %eax
testl %eax, %eax
leaq 0x8c3d(%rip), %r15      # 0xe990
movq 0x18(%rsp), %r8
movq 0x10(%rsp), %r9
je 0x5f76
testb $0x1, 0x20(%rsp)
je 0x5ea1
cltq
leaq (%rax,%rax,2), %rax
leaq 0x9715(%rip), %rdx      # 0xf490
movl (%rdx,%rax,8), %ecx
movl 0x4(%rdx,%rax,8), %r15d
xorps %xmm0, %xmm0
cvtsi2ss %ebx, %xmm0
xorps %xmm1, %xmm1
cvtsi2ssl 0x28(%r12), %xmm1
divss %xmm1, %xmm0
movss 0x3a08(%rip), %xmm1     # 0x97a8
subss %xmm0, %xmm1
movss %xmm1, 0x4(%rsp)
movl 0x8(%r12), %ebx
subl %ebx, %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
mulss %xmm1, %xmm0
callq 0x4ff2
addl %ebx, %eax
movl %eax, (%r12)
movl 0xc(%r12), %ebx
subl %ebx, %r15d
xorps %xmm0, %xmm0
cvtsi2ss %r15d, %xmm0
leaq 0x8bb2(%rip), %r15      # 0xe990
mulss 0x4(%rsp), %xmm0
callq 0x4ff2
movq 0x10(%rsp), %r9
movq 0x18(%rsp), %r8
addl %ebx, %eax
movl %eax, 0x4(%r12)
cmpl $0x0, 0x24(%r12)
jne 0x5ea1
movslq 0x20(%r12), %rdx
leaq (%rdx,%rdx,2), %rcx
leaq 0x967a(%rip), %rsi      # 0xf490
movq 0x8(%rsi,%rcx,8), %rsi
testq %rsi, %rsi
je 0x5e2c
movl 0x4(%rsi), %edi
movl %edi, 0x8(%rsi)
movq 0x38(%rsi), %rsi
jmp 0x5e1b
leaq 0x9a1d(%rip), %rsi      # 0xf850
movl $0x1, (%rsi,%rdx,4)
shlq $0x3, %rcx
addq 0x7183(%rip), %rcx      # 0xcfc8
cmpl $0x0, 0x10(%rcx,%r8,4)
jne 0x5ea1
movslq (%r12), %rdi
movslq %eax, %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rdi,%rdi,2), %rdx
shlq $0x6, %rdx
addq 0x7139(%rip), %rdx      # 0xcfa0
movl $0x20, (%rdx,%rcx,4)
movl %eax, %esi
movl $0x1, %edx
callq 0x2df8
movq 0x10(%rsp), %r9
movq 0x18(%rsp), %r8
movslq 0x20(%r12), %rax
leaq (%rax,%rax,2), %rax
shlq $0x3, %rax
addq 0x7130(%rip), %rax      # 0xcfc8
movl $0x1, 0x10(%rax,%r8,4)
testb $0x1, 0x8(%rsp)
je 0x5f5a
cmpl $0x0, 0x24(%r12)
jne 0x5f76
movslq 0x20(%r12), %rax
leaq (%rax,%rax,2), %rdx
leaq 0x95c8(%rip), %rsi      # 0xf490
movq 0x8(%rsi,%rdx,8), %rcx
movl $0x1, 0x10(%rsi,%rdx,8)
testq %rcx, %rcx
je 0x5ee6
movl 0xc(%rcx), %edx
movl %edx, 0x28(%rcx)
movq 0x38(%rcx), %rcx
jmp 0x5ed5
leaq 0x7d33(%rip), %rcx      # 0xdc20
cmpl $0x0, (%rcx,%rax,8)
jle 0x5f30
addq %r15, %rbp
leaq 0x34(%r15), %rdx
movq %r14, %rax
subq $0x1, %rax
jb 0x5f11
movl 0x20(%rdx), %ecx
cmpl 0x20(%rbp), %ecx
jne 0x5f11
cmpl $0x0, 0x24(%rdx)
je 0x5f17
addq $0x34, %rdx
jmp 0x5efd
xorl %edi, %edi
movq %rbp, %rsi
callq 0x2b38
movq 0x10(%rsp), %r9
movq 0x18(%rsp), %r8
movslq 0x20(%r12), %rax
leaq 0x7ce9(%rip), %rcx      # 0xdc20
cmpl $0x0, 0x4(%rcx,%rax,8)
jg 0x5f4c
leaq 0x7d8b(%rip), %rcx      # 0xdcd0
cmpl $0x0, 0x4(%rcx,%rax,8)
jle 0x5f5a
leaq 0x983d(%rip), %rcx      # 0xf790
movl $0x1, (%rcx,%rax,4)
cmpl $0x0, 0x24(%r12)
jne 0x5f76
movslq 0x20(%r12), %rax
shlq $0x3, %rax
addq 0x706e(%rip), %rax      # 0xcfe0
incl (%rax,%r8,4)
incq %r13
incq %r14
cmpq $0x1b, %r13
jne 0x5b30
movl $0x1, %r8d
movl $0x0, 0x8(%rsp)
testb $0x1, 0x20(%rsp)
movb $0x1, %al
movq %rax, 0x20(%rsp)
je 0x5b16
movl $0x5b0, %ebx            # imm = 0x5B0
addq 0x6ffe(%rip), %rbx      # 0xcfb0
movl $0x61, %r14d
leaq 0x7dd1(%rip), %r15      # 0xdd90
cmpl $0x0, 0x20(%rbx)
je 0x6011
movl $0x0, 0x2c(%rbx)
movslq (%rbx), %rdi
movslq 0x4(%rbx), %rsi
leaq (%rsi,%rsi,2), %rax
leaq (%rdi,%rdi,2), %rcx
shlq $0x6, %rcx
addq %r15, %rcx
movl 0x8(%rcx,%rax,4), %r8d
cmpq $0x20, %r8
jne 0x5ff6
leal -0x60(%r14), %edx
orl $0x60, %edx
jmp 0x6000
movl $0x2a, %edx
cmpq %r8, %r14
je 0x600a
leaq (%rcx,%rax,4), %rax
addq $0x8, %rax
movl %edx, (%rax)
xorl %edx, %edx
callq 0x2df8
incq %r14
addq $0x34, %rbx
cmpq $0x7b, %r14
jne 0x5fbf
movb $0x1, %al
movl $0x1, %ecx
leaq 0x37b2(%rip), %rbx      # 0x97de
movq 0x6fb5(%rip), %r14      # 0xcfe8
movq %rcx, %r15
leaq 0x9813(%rip), %rcx      # 0xf850
cmpl $0x0, (%rcx,%r15,4)
jne 0x604f
incq %r15
cmpq $0x16, %r15
jne 0x6036
jmp 0x60a6
testb $0x1, %al
je 0x607b
movl $0x21, %edi
movl $0x15, %esi
callq 0x4f79
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2030
movl $0x32, %edi
movl $0x15, %esi
callq 0x4f79
movq (%r14), %rdi
movl %r15d, %esi
orl $0x40, %esi
callq 0x20a0
leaq 0x97c0(%rip), %rax      # 0xf850
movl $0x0, (%rax,%r15,4)
leaq 0x1(%r15), %rcx
xorl %eax, %eax
cmpq $0x15, %r15
jne 0x6033
jmp 0x60c7
testb $0x1, %al
je 0x60c7
movl $0x21, %edi
movl $0x15, %esi
callq 0x4f79
leaq 0x3257(%rip), %rdi      # 0x9317
xorl %eax, %eax
callq 0x2030
movb $0x1, %al
movl $0x1, %ecx
leaq 0x372a(%rip), %rbx      # 0x97ff
movq %rcx, %r15
leaq 0x96b1(%rip), %rcx      # 0xf790
cmpl $0x0, (%rcx,%r15,4)
jne 0x60f1
incq %r15
cmpq $0x16, %r15
jne 0x60d8
jmp 0x6148
testb $0x1, %al
je 0x611d
movl $0x21, %edi
movl $0x16, %esi
callq 0x4f79
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2030
movl $0x32, %edi
movl $0x16, %esi
callq 0x4f79
movq (%r14), %rdi
movl %r15d, %esi
orl $0x40, %esi
callq 0x20a0
leaq 0x965e(%rip), %rax      # 0xf790
movl $0x0, (%rax,%r15,4)
leaq 0x1(%r15), %rcx
xorl %eax, %eax
cmpq $0x15, %r15
jne 0x60d5
jmp 0x6169
testb $0x1, %al
je 0x6169
movl $0x21, %edi
movl $0x16, %esi
callq 0x4f79
leaq 0x31b5(%rip), %rdi      # 0x9317
xorl %eax, %eax
callq 0x2030
movb $0x1, %al
movl $0x1, %ecx
leaq 0x9679(%rip), %r15      # 0xf7f0
leaq 0x36a2(%rip), %rbx      # 0x9820
movq %rcx, %r12
cmpl $0x0, (%r15,%r12,4)
jne 0x6193
incq %r12
cmpq $0x16, %r12
jne 0x6181
jmp 0x61e4
testb $0x1, %al
je 0x61bf
movl $0x21, %edi
movl $0x17, %esi
callq 0x4f79
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2030
movl $0x32, %edi
movl $0x17, %esi
callq 0x4f79
movq (%r14), %rdi
movl %r12d, %esi
orl $0x40, %esi
callq 0x20a0
movl $0x0, (%r15,%r12,4)
leaq 0x1(%r12), %rcx
xorl %eax, %eax
cmpq $0x15, %r12
jne 0x617e
jmp 0x6205
testb $0x1, %al
je 0x6205
movl $0x21, %edi
movl $0x17, %esi
callq 0x4f79
leaq 0x3119(%rip), %rdi      # 0x9317
xorl %eax, %eax
callq 0x2030
movl $0x1, %ebx
movl %ebx, %edi
callq 0x43f0
incl %ebx
cmpl $0x16, %ebx
jne 0x620a
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop