// File: /workspace/github_c_makefile_star2_O2/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 0x8e55(%rip), %rcx      # 0xf990
leaq (%rcx,%rax), %r15
addq $0x57c, %r15            # imm = 0x57C
cmpl $0x0, 0x24(%r15)
je 0x6ba7
andl $0x0, 0x24(%r15)
movslq (%r15), %rax
movslq 0x4(%r15), %rcx
imulq $0xc0, %rax, %rax
addq 0x7431(%rip), %rax      # 0xdf98
imulq $0xc, %rcx, %rcx
movslq 0x4(%rcx,%rax), %rax
leaq -0x40(%rax), %rcx
movl %ecx, 0x20(%r15)
leaq 0x80a1(%rip), %rcx      # 0xec20
incl -0x1fc(%rcx,%rax,8)
leaq 0x2fd3(%rip), %rdi      # 0x9b60
xorl %eax, %eax
callq 0x2030
leaq 0x9d19(%rip), %rax      # 0x108b4
movl (%rax), %esi
incl %esi
pushq $0x1
popq %rdi
callq 0x4dbd
leaq 0x2fcf(%rip), %rdi      # 0x9b7d
xorl %eax, %eax
callq 0x2030
leaq 0x9cf8(%rip), %r13      # 0x108b4
movl (%r13), %esi
pushq $0xa
popq %rdi
callq 0x4dbd
leaq 0xb(%rsp), %r14
movq %r14, %rdi
callq 0x6d93
movsbl (%r14), %r12d
leal -0x56(%r12), %eax
cmpb $-0x17, %al
ja 0x6bf6
pushq $0x1
popq %rbp
callq 0x6fb8
leaq 0x2f96(%rip), %rdi      # 0x9b87
jmp 0x6cce
addl $-0x40, %r12d
movl %r12d, %eax
imulq $0x18, %rax, %rax
leaq 0x9888(%rip), %rcx      # 0x10490
movl (%rcx,%rax), %edx
movl 0x4(%rcx,%rax), %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 (%r13), %esi
incl %esi
pushq $0x1
popq %rbp
movl %ebp, %edi
callq 0x4dbd
cvtss2sd 0xc(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x2f48(%rip), %rdi      # 0x9b97
movb $0x1, %al
callq 0x2030
movsd 0x10(%rsp), %xmm0
addsd 0x2ef4(%rip), %xmm0     # 0x9b58
addsd 0x2aa4(%rip), %xmm0     # 0x9710
cvttsd2si %xmm0, %eax
leaq 0x9a39(%rip), %r14      # 0x106b0
cmpl %eax, 0x4(%r14)
jge 0x6cab
cmpl $0x0, 0x1c(%r15)
jne 0x6c92
cmpl $0x0, 0x18(%r15)
jne 0x6c92
cmpl $0x0, 0x14(%r15)
je 0x6cab
callq 0x6fb8
movl 0x4(%r14), %esi
leaq 0x2f07(%rip), %rdi      # 0x9ba9
xorl %eax, %eax
callq 0x2030
jmp 0x6cd5
movss 0x25ad(%rip), %xmm0     # 0x9260
ucomiss 0xc(%rsp), %xmm0
jbe 0x6ce6
movl (%r13), %esi
incl %esi
movl %ebp, %edi
callq 0x4dbd
leaq 0x2ef3(%rip), %rdi      # 0x9bc1
xorl %eax, %eax
callq 0x2030
movl %ebp, (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
decl %eax
leaq 0x99b9(%rip), %rcx      # 0x106a8
cltd
idivl 0x4(%rcx)
movl %eax, %r14d
incl %r14d
movl (%r13), %esi
incl %esi
pushq $0x1
popq %rdi
callq 0x4dbd
leaq 0x2ec6(%rip), %rdi      # 0x9bd4
xorl %ebp, %ebp
movl %r14d, %esi
xorl %eax, %eax
callq 0x2030
movslq 0x20(%r15), %rax
leaq 0x7efb(%rip), %rcx      # 0xec20
decl 0x4(%rcx,%rax,8)
movl %r12d, 0x20(%r15)
movl %r14d, 0x24(%r15)
movl %r14d, 0x28(%r15)
movq (%r15), %rax
movq %rax, 0x8(%r15)
jmp 0x6cd5
nop