// File: /workspace/github_c_makefile_star2_O3/beejjorgensen[P]conquest/conqs1.c
// Function: set_des
void set_des(int tf_num, boolean *Err0r)
{
    boolean error;
    int st_num, min_eta;
    char istar;
    float r;
    int dst;
    int from_star;
    if ((tf[player][tf_num].eta != 0)) {        /*cancel */
        tf[player][tf_num].eta = 0;
        from_star =
            board[tf[player][tf_num].x][tf[player][tf_num].y].star - 'A' +
            1;
        tf[player][tf_num].dest = from_star;
        tf_stars[from_star][player]++;
        printw("(Cancelling previous orders)");
        point(1, y_cursor + 1);
    };
    error = true;
    printw(" to star:");
    point(10, y_cursor);
    get_char(&istar);
    st_num = istar - 'A' + 1;
    if ((st_num < 0) || (st_num > nstars)) {
        error_message();
        printw("  !illegal star");
    } else {
        r = sqrt((float) (((stars[st_num].x - tf[1][tf_num].x) *
                           (stars[st_num].x - tf[1][tf_num].x)) +
                          ((stars[st_num].y - tf[1][tf_num].y) *
                           (stars[st_num].y - tf[1][tf_num].y))));
        point(1, y_cursor + 1);
        printw("   distance:%5.1f", r);
        dst = r - 0.049 + 1;
        if ((dst > range[player]) &&
            ((tf[1][tf_num].b != 0) ||
             (tf[1][tf_num].c != 0) || (tf[1][tf_num].t != 0))) {
            error_message();
            printw("  !maximum range is %2d", range[player]);
        } else if (r < 0.5) {
            point(1, y_cursor + 1);
            printw("Tf remains at star");
        } else {
            min_eta = ((dst - 1) / vel[player]) + 1;
            point(1, y_cursor + 1);
            printw("eta in %2d turns", min_eta);
            tf_stars[tf[player][tf_num].dest][player]--;
            tf[player][tf_num].dest = st_num;
            tf[player][tf_num].eta = min_eta;
            tf[player][tf_num].origeta = tf[player][tf_num].eta;
            tf[player][tf_num].xf = tf[player][tf_num].x;
            tf[player][tf_num].yf = tf[player][tf_num].y;
            error = false;
        }
    }
    *Err0r = error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movslq %edi, %rax
imulq $0x34, %rax, %rax
leaq 0x7ab9(%rip), %rcx      # 0xe990
leaq (%rcx,%rax), %r15
addq $0x57c, %r15            # imm = 0x57C
cmpl $0x0, 0x24(%r15)
je 0x6f49
movl $0x0, 0x24(%r15)
movslq (%r15), %rax
movslq 0x4(%r15), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x6, %rax
addq 0x6099(%rip), %rax      # 0xcfa0
leaq (%rcx,%rcx,2), %rcx
movslq 0x4(%rax,%rcx,4), %rax
leaq -0x40(%rax), %rcx
movl %ecx, 0x20(%r15)
leaq 0x6d01(%rip), %rcx      # 0xdc20
incl -0x1fc(%rcx,%rax,8)
leaq 0x2c73(%rip), %rdi      # 0x9ba0
xorl %eax, %eax
callq 0x2030
leaq 0x8979(%rip), %rax      # 0xf8b4
movl (%rax), %esi
incl %esi
movl $0x1, %edi
callq 0x4f79
leaq 0x2c6d(%rip), %rdi      # 0x9bbd
xorl %eax, %eax
callq 0x2030
leaq 0x8956(%rip), %r12      # 0xf8b4
movl (%r12), %esi
movl $0xa, %edi
callq 0x4f79
leaq 0xb(%rsp), %r14
movq %r14, %rdi
callq 0x7153
movsbl (%r14), %r14d
leal -0x56(%r14), %eax
cmpb $-0x17, %al
ja 0x6f9d
callq 0x738e
leaq 0x2c36(%rip), %rdi      # 0x9bc7
xorl %eax, %eax
callq 0x2030
jmp 0x7053
addl $-0x40, %r14d
movl %r14d, %eax
leaq (%rax,%rax,2), %rax
leaq 0x84e1(%rip), %rcx      # 0xf490
movl (%rcx,%rax,8), %edx
movl 0x4(%rcx,%rax,8), %eax
subl (%r15), %edx
imull %edx, %edx
subl 0x4(%r15), %eax
imull %eax, %eax
addl %edx, %eax
cvtsi2ss %eax, %xmm0
sqrtss %xmm0, %xmm0
movss %xmm0, 0xc(%rsp)
movl (%r12), %esi
incl %esi
movl $0x1, %edi
callq 0x4f79
xorps %xmm0, %xmm0
cvtss2sd 0xc(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x2bde(%rip), %rdi      # 0x9bd7
movb $0x1, %al
callq 0x2030
movsd 0x10(%rsp), %xmm0
addsd 0x2b8a(%rip), %xmm0     # 0x9b98
addsd 0x273a(%rip), %xmm0     # 0x9750
cvttsd2si %xmm0, %eax
leaq 0x868f(%rip), %r13      # 0xf6b0
cmpl %eax, 0x4(%r13)
jge 0x706b
cmpl $0x0, 0x1c(%r15)
jne 0x703c
cmpl $0x0, 0x18(%r15)
jne 0x703c
cmpl $0x0, 0x14(%r15)
je 0x706b
callq 0x738e
movl 0x4(%r13), %esi
leaq 0x2b9d(%rip), %rdi      # 0x9be9
xorl %eax, %eax
callq 0x2030
movl $0x1, %r12d
movl %r12d, (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movss 0x2235(%rip), %xmm0     # 0x92a8
ucomiss 0xc(%rsp), %xmm0
jbe 0x70a0
movl (%r12), %esi
incl %esi
movl $0x1, %r12d
movl $0x1, %edi
callq 0x4f79
leaq 0x2b6a(%rip), %rdi      # 0x9c01
xorl %eax, %eax
callq 0x2030
jmp 0x7059
decl %eax
leaq 0x85ff(%rip), %rcx      # 0xf6a8
cltd
idivl 0x4(%rcx)
movl %eax, %ebp
incl %ebp
movl (%r12), %esi
incl %esi
movl $0x1, %edi
callq 0x4f79
leaq 0x2b4c(%rip), %rdi      # 0x9c14
xorl %r12d, %r12d
movl %ebp, %esi
xorl %eax, %eax
callq 0x2030
movslq 0x20(%r15), %rax
leaq 0x6b41(%rip), %rcx      # 0xdc20
decl 0x4(%rcx,%rax,8)
movl %r14d, 0x20(%r15)
movl %ebp, 0x24(%r15)
movl %ebp, 0x28(%r15)
movq (%r15), %rax
movq %rax, 0x8(%r15)
jmp 0x7059
nop