// File: /workspace/github_c_makefile_star2_O2/beejjorgensen[P]conquest/conqpl.c
// Function: land
void land(void)
{
    char tfc, trc, planc;
    boolean see;
    int x, y, room_left, tfnum, transports, planet_num;
    int starnum, ind;
    char iline[81];
    boolean found;
    struct stplanet *pplanet;
    printw("and tf:");
    get_char(&tfc);
    cle3r_left();
    tfnum = tfc - 'A' + 1;
    if ((tfnum < 1) || (tfnum > 26)) {
        error_message();
        printw("  !illegal tf");
    } else if (tf[player][tfnum].dest == 0) {
        error_message();
        printw("  !nonexistent tf");
    } else if ((tf[player][tfnum].eta != 0)) {
        error_message();
        printw("  !tf is not in normal space  ");
    } else {
        starnum = tf[player][tfnum].dest;
        pplanet = stars[starnum].first_planet;
        if (pplanet == nil) {
            error_message();
            printw("  !no planets at this star    ");
        } else if (tf_stars[starnum][ENEMY] > 0) {
            error_message();
            printw("  !enemy ships present");
        } else {
            point(11, 18);
            printw(" planet ");
            if (pplanet->next == nil) {
                planet_num = pplanet->number;
                printw("%d", planet_num);
            } else {
                printw(":");
                get_char(&planc);
                planet_num = planc - '0';
                found = false;
                while ((pplanet != nil) && !found) {
                    if (pplanet->number == planet_num)
                        found = true;
                    else
                        pplanet = pplanet->next;
                };
                if (!found) {
                    planet_num = 0;
                    error_message();
                    printw(" !Not a habitable planet ");
                }
            };
            if (planet_num != 0) {
                if ((pplanet->team == ENEMY) || ((pplanet->team == player)
                                                 && (pplanet->conquered))) {
                    error_message();
                    printw("  !Enemy infested planet  !!  ");
                } else {        /*get the number of transports */
                    room_left = pplanet->capacity - pplanet->inhabitants;
                    point(1, 19);
                    printw(" transports:");
                    get_line(iline, &ind, false);
                    get_token(iline, &ind, &transports, &trc);
                    if (transports == 0)
                        transports = tf[player][tfnum].t;
                    if (transports < 1) {
                        error_message();
                        printw("  !illegal transports");
                    } else if (transports > tf[player][tfnum].t) {
                        error_message();
                        printw("  !only %2d transports in tf",
                               tf[player][tfnum].t);
                    } else if (transports > room_left) {
                        error_message();
                        printw("  !only room for %2d transports",
                               room_left);
                    } else {
                        pplanet->team = player;
                        if (pplanet->inhabitants == 0) {
                            col_stars[starnum][player]++;
                        };
                        pplanet->inhabitants =
                            pplanet->inhabitants + transports;
                        pplanet->iu = pplanet->iu + transports;
                        tf[player][tfnum].t =
                            tf[player][tfnum].t - transports;
                        x = tf[player][tfnum].x;
                        y = tf[player][tfnum].y;
                        if (board[x][y].enemy == ' ') {
                            board[x][y].enemy = '@';
                            update_board(x, y, left);
                        };
                        point(1, 20);
                        addch(starnum + 'A' - 1);
                        see = true;
                        if (((y_cursor > 21) && (x_cursor >= 50)) ||
                            (y_cursor > 24)) {
                            pause();
                            clear_field();
                            point(50, 1);
                        };
                        printw("%d:%2d                         ",
                               pplanet->number, pplanet->psee_capacity);
                        point(x_cursor + 5, y_cursor);
                        x_cursor = x_cursor - 5;
                        if (pplanet->psee_capacity == 0)
                            printw(" Decimated");
                        else if ((pplanet->team == none) && see)
                            printw(" No colony");
                        else if (pplanet->team == player) {
                            printw("(%2d,/%3d)", pplanet->inhabitants,
                                   pplanet->iu);
                            if (pplanet->conquered)
                                printw("Con");
                            else
                                printw("   ");
                            if (pplanet->mb != 0)
                                printw("%2dmb", pplanet->mb);
                            else
                                printw("    ");
                            if (pplanet->amb != 0)
                                printw("%2damb", pplanet->amb);
                        } else if ((pplanet->team == ENEMY) && see) {
                            printw("*EN*");
                            if (see && pplanet->conquered) {
                                printw("Conquered");
                            } else
                                printw("   ");
                            if (pplanet->under_attack) {
                                if (pplanet->mb != 0)
                                    printw("%2dmb", pplanet->mb);
                                else
                                    printw("    ");
                                if (pplanet->amb != 0)
                                    printw("%2damb", pplanet->amb);
                            };
                        };
                        point(x_cursor, y_cursor + 1);

                        zero_tf(player, tfnum);
                        pr3nt_tf(tfnum);
                    };
                };
            };
        };
    };
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
leaq 0x34b9(%rip), %rdi      # 0x999c
xorl %eax, %eax
callq 0x2030
leaq 0x3(%rsp), %rbx
movq %rbx, %rdi
callq 0x6d93
callq 0x6f4d
movsbl (%rbx), %ebx
leal -0x5b(%rbx), %eax
cmpb $-0x1b, %al
ja 0x6514
callq 0x6fb8
leaq 0x3492(%rip), %rdi      # 0x99a4
jmp 0x655d
addl $-0x40, %ebx
movl %ebx, %eax
imulq $0x34, %rax, %rax
leaq 0x946c(%rip), %rcx      # 0xf990
movslq 0x59c(%rcx,%rax), %r14
testq %r14, %r14
je 0x6551
leaq (%rcx,%rax), %r13
addq $0x57c, %r13            # imm = 0x57C
cmpl $0x0, 0x24(%r13)
je 0x6573
callq 0x6fb8
leaq 0x3475(%rip), %rdi      # 0x99c4
jmp 0x655d
callq 0x6fb8
leaq 0x3455(%rip), %rdi      # 0x99b2
xorl %eax, %eax
callq 0x2030
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
imulq $0x18, %r14, %rax
leaq 0x9f12(%rip), %rcx      # 0x10490
movq 0x8(%rcx,%rax), %r12
testq %r12, %r12
je 0x65a4
leaq 0x8691(%rip), %rax      # 0xec20
cmpl $0x0, (%rax,%r14,8)
jle 0x65b2
callq 0x6fb8
leaq 0x3460(%rip), %rdi      # 0x9a02
jmp 0x655d
callq 0x6fb8
leaq 0x3433(%rip), %rdi      # 0x99e3
jmp 0x655d
pushq $0xb
popq %rdi
pushq $0x12
popq %rsi
callq 0x4dbd
leaq 0x3466(%rip), %rdi      # 0x9a2a
xorl %eax, %eax
callq 0x2030
cmpq $0x0, 0x38(%r12)
je 0x6607
leaq 0x33ad(%rip), %rdi      # 0x9987
xorl %eax, %eax
callq 0x2030
leaq 0x1(%rsp), %r15
movq %r15, %rdi
callq 0x6d93
movsbl (%r15), %ebp
addl $-0x30, %ebp
testq %r12, %r12
je 0x6651
cmpl %ebp, (%r12)
je 0x661d
movq 0x38(%r12), %r12
jmp 0x65f5
movl (%r12), %ebp
leaq 0x321d(%rip), %rdi      # 0x982f
movl %ebp, %esi
xorl %eax, %eax
callq 0x2030
jmp 0x6622
testq %r12, %r12
je 0x6651
testl %ebp, %ebp
je 0x6564
movl 0xc(%r12), %eax
testl %eax, %eax
je 0x6640
cmpl $0x1, %eax
jne 0x6662
cmpl $0x0, 0x20(%r12)
je 0x6662
callq 0x6fb8
leaq 0x33e7(%rip), %rdi      # 0x9a33
jmp 0x655d
callq 0x6fb8
leaq 0x33bc(%rip), %rdi      # 0x9a19
jmp 0x655d
movl 0x4(%r12), %eax
subl 0x10(%r12), %eax
movl %eax, 0x4(%rsp)
pushq $0x1
popq %rdi
pushq $0x13
popq %rsi
callq 0x4dbd
leaq 0x33d0(%rip), %rdi      # 0x9a52
xorl %eax, %eax
callq 0x2030
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rbp
movq %rbp, %rsi
xorl %edx, %edx
callq 0x6dae
leaq 0x8(%rsp), %r15
leaq 0x2(%rsp), %rcx
leaq 0x10(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x6fc3
movl (%r15), %eax
testl %eax, %eax
jne 0x66c6
movl 0x14(%r13), %eax
movl %eax, 0x8(%rsp)
testl %eax, %eax
jle 0x66e4
movl 0x14(%r13), %ecx
subl %eax, %ecx
jge 0x66f5
callq 0x6fb8
movl 0x14(%r13), %esi
leaq 0x3393(%rip), %rdi      # 0x9a75
jmp 0x670b
callq 0x6fb8
leaq 0x336f(%rip), %rdi      # 0x9a5f
jmp 0x655d
movl 0x4(%rsp), %ebp
cmpl %ebp, %eax
jle 0x6717
callq 0x6fb8
leaq 0x3389(%rip), %rdi      # 0x9a92
movl %ebp, %esi
xorl %eax, %eax
callq 0x2030
jmp 0x6564
movl $0x1, 0xc(%r12)
movl 0x10(%r12), %edx
testl %edx, %edx
jne 0x673a
leaq 0x85a0(%rip), %rdx      # 0xecd0
incl 0x4(%rdx,%r14,8)
movl 0x10(%r12), %edx
addl %eax, %edx
movl %edx, 0x10(%r12)
addl %eax, 0x14(%r12)
movl %ecx, 0x14(%r13)
movslq (%r13), %rdi
movslq 0x4(%r13), %rsi
imulq $0xc, %rsi, %rcx
imulq $0xc0, %rdi, %rax
addq 0x7834(%rip), %rax      # 0xdf98
cmpl $0x20, (%rcx,%rax)
jne 0x677b
addq %rcx, %rax
movl $0x40, (%rax)
pushq $0x1
popq %rdx
callq 0x2ca4
pushq $0x1
popq %rdi
pushq $0x14
popq %rsi
callq 0x4dbd
movq 0x785b(%rip), %rax      # 0xdfe8
movq (%rax), %rdi
addl $0x40, %r14d
movl %r14d, %esi
callq 0x2090
leaq 0xa111(%rip), %r14      # 0x108b4
movl (%r14), %edx
cmpl $0x16, %edx
setge %al
leaq 0xa0fd(%rip), %r15      # 0x108b0
cmpl $0x32, (%r15)
setge %cl
cmpl $0x18, %edx
jg 0x67c3
andb %cl, %al
je 0x67d8
callq 0x71b1
callq 0x6eef
pushq $0x32
popq %rdi
pushq $0x1
popq %rsi
callq 0x4dbd
movl (%r12), %esi
movl 0x8(%r12), %edx
leaq 0x2ce1(%rip), %rdi      # 0x94c9
xorl %eax, %eax
callq 0x2030
movl (%r15), %edi
addl $0x5, %edi
movl (%r14), %esi
callq 0x4dbd
addl $-0x5, (%r15)
cmpl $0x0, 0x8(%r12)
je 0x6829
movl 0xc(%r12), %eax
testl %eax, %eax
je 0x6875
cmpl $0x1, %eax
je 0x683c
cmpl $0x2, %eax
jne 0x68e8
leaq 0x2ccd(%rip), %rdi      # 0x94f4
jmp 0x6830
leaq 0x2cb9(%rip), %rdi      # 0x94e9
xorl %eax, %eax
callq 0x2030
jmp 0x68e8
movl 0x10(%r12), %esi
movl 0x14(%r12), %edx
leaq 0x2cb2(%rip), %rdi      # 0x94ff
xorl %eax, %eax
callq 0x2030
cmpl $0x0, 0x20(%r12)
leaq 0x2d84(%rip), %rax      # 0x95e5
leaq 0x2ca2(%rip), %rdi      # 0x950a
cmoveq %rax, %rdi
xorl %eax, %eax
callq 0x2030
jmp 0x68aa
leaq 0x2c9f(%rip), %rdi      # 0x951b
xorl %eax, %eax
callq 0x2030
cmpl $0x0, 0x20(%r12)
leaq 0x2d55(%rip), %rax      # 0x95e5
leaq 0x2c89(%rip), %rdi      # 0x9520
cmoveq %rax, %rdi
xorl %eax, %eax
callq 0x2030
cmpl $0x0, 0x24(%r12)
je 0x68e8
movl 0x18(%r12), %esi
testl %esi, %esi
je 0x68c3
leaq 0x2c54(%rip), %rdi      # 0x950e
xorl %eax, %eax
callq 0x2030
jmp 0x68d1
leaq 0x2d1a(%rip), %rdi      # 0x95e4
xorl %eax, %eax
callq 0x2030
movl 0x1c(%r12), %esi
testl %esi, %esi
je 0x68e8
leaq 0x2c33(%rip), %rdi      # 0x9514
xorl %eax, %eax
callq 0x2030
movl (%r15), %edi
movl (%r14), %esi
incl %esi
callq 0x4dbd
pushq $0x1
popq %rdi
movl %ebx, %esi
callq 0x35b4
movl %ebx, %edi
callq 0x71d7
jmp 0x6564