// File: /workspace/github_c_makefile_star2_O1/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 0x3121(%rip), %rdi      # 0x998c
xorl %eax, %eax
callq 0x2030
leaq 0x3(%rsp), %rbx
movq %rbx, %rdi
callq 0x7187
callq 0x7377
movsbl (%rbx), %ebx
leal -0x5b(%rbx), %eax
cmpb $-0x1b, %al
ja 0x689c
callq 0x73e3
leaq 0x30fa(%rip), %rdi      # 0x9994
jmp 0x68e5
addl $-0x40, %ebx
movl %ebx, %eax
imulq $0x34, %rax, %rax
leaq 0x80f4(%rip), %rcx      # 0xe9a0
movslq 0x59c(%rcx,%rax), %r14
testq %r14, %r14
je 0x68d9
leaq (%rcx,%rax), %r13
addq $0x57c, %r13            # imm = 0x57C
cmpl $0x0, 0x24(%r13)
je 0x68fb
callq 0x73e3
leaq 0x30dd(%rip), %rdi      # 0x99b4
jmp 0x68e5
callq 0x73e3
leaq 0x30bd(%rip), %rdi      # 0x99a2
xorl %eax, %eax
callq 0x2030
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq (%r14,%r14,2), %rax
leaq 0x8b9a(%rip), %rcx      # 0xf4a0
movq 0x8(%rcx,%rax,8), %r12
testq %r12, %r12
je 0x692c
leaq 0x7319(%rip), %rax      # 0xdc30
cmpl $0x0, (%rax,%r14,8)
jle 0x693a
callq 0x73e3
leaq 0x30c8(%rip), %rdi      # 0x99f2
jmp 0x68e5
callq 0x73e3
leaq 0x309b(%rip), %rdi      # 0x99d3
jmp 0x68e5
movl $0xb, %edi
movl $0x12, %esi
callq 0x4f69
leaq 0x30ca(%rip), %rdi      # 0x9a1a
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x2030
cmpq $0x0, 0x38(%r12)
je 0x69bd
leaq 0x300e(%rip), %rdi      # 0x9977
xorl %eax, %eax
callq 0x2030
leaq 0x1(%rsp), %rbp
movq %rbp, %rdi
callq 0x7187
movsbl (%rbp), %ebp
addl $-0x30, %ebp
cmpl %ebp, (%r12)
jne 0x6992
movl $0x1, %r15d
jmp 0x6997
movq 0x38(%r12), %r12
testq %r12, %r12
je 0x69a1
testl %r15d, %r15d
je 0x6984
testl %r15d, %r15d
jne 0x69d1
callq 0x73e3
leaq 0x3057(%rip), %rdi      # 0x9a09
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x2030
jmp 0x69d1
movl (%r12), %ebp
leaq 0x2e57(%rip), %rdi      # 0x981f
movl %ebp, %esi
xorl %eax, %eax
callq 0x2030
testl %ebp, %ebp
je 0x68ec
movl 0xc(%r12), %eax
testl %eax, %eax
je 0x69ef
cmpl $0x1, %eax
jne 0x6a00
cmpl $0x0, 0x20(%r12)
je 0x6a00
callq 0x73e3
leaq 0x3028(%rip), %rdi      # 0x9a23
jmp 0x68e5
movl 0x4(%r12), %eax
subl 0x10(%r12), %eax
movl %eax, 0x8(%rsp)
movl $0x1, %edi
movl $0x13, %esi
callq 0x4f69
leaq 0x301e(%rip), %rdi      # 0x9a42
xorl %eax, %eax
callq 0x2030
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rbp
movq %rbp, %rsi
xorl %edx, %edx
callq 0x71a2
leaq 0x4(%rsp), %r15
leaq 0x2(%rsp), %rcx
leaq 0x10(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x73f2
cmpl $0x0, (%r15)
jne 0x6a67
movl 0x14(%r13), %eax
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
testl %eax, %eax
jle 0x6a89
movl 0x14(%r13), %ecx
subl %eax, %ecx
jge 0x6a9a
callq 0x73e3
movl 0x14(%r13), %esi
leaq 0x2fde(%rip), %rdi      # 0x9a65
jmp 0x6ab0
callq 0x73e3
leaq 0x2fba(%rip), %rdi      # 0x9a4f
jmp 0x68e5
movl 0x8(%rsp), %ebp
cmpl %ebp, %eax
jle 0x6abc
callq 0x73e3
leaq 0x2fd4(%rip), %rdi      # 0x9a82
movl %ebp, %esi
xorl %eax, %eax
callq 0x2030
jmp 0x68ec
movl $0x1, 0xc(%r12)
cmpl $0x0, 0x10(%r12)
jne 0x6ad9
leaq 0x720c(%rip), %rdx      # 0xdce0
incl 0x4(%rdx,%r14,8)
addl %eax, 0x10(%r12)
addl %eax, 0x14(%r12)
movl %ecx, 0x14(%r13)
movslq (%r13), %rdi
movslq 0x4(%r13), %rsi
leaq (%rsi,%rsi,2), %rax
leaq (%rdi,%rdi,2), %rcx
shlq $0x6, %rcx
addq 0x64a6(%rip), %rcx      # 0xcfa8
cmpl $0x20, (%rcx,%rax,4)
jne 0x6b1c
leaq (%rcx,%rax,4), %rax
movl $0x40, (%rax)
movl $0x1, %edx
callq 0x2d64
movl $0x1, %edi
movl $0x14, %esi
callq 0x4f69
movq 0x64b6(%rip), %rax      # 0xcfe8
movq (%rax), %rdi
addl $0x40, %r14d
movl %r14d, %esi
callq 0x20a0
leaq 0x8d7c(%rip), %r14      # 0xf8c4
movl (%r14), %edx
cmpl $0x16, %edx
setge %al
leaq 0x8d68(%rip), %r15      # 0xf8c0
cmpl $0x32, (%r15)
setge %cl
cmpl $0x18, %edx
jg 0x6b68
andb %cl, %al
je 0x6b81
callq 0x763e
callq 0x731e
movl $0x32, %edi
movl $0x1, %esi
callq 0x4f69
movl (%r12), %esi
movl 0x8(%r12), %edx
leaq 0x2938(%rip), %rdi      # 0x94c9
xorl %eax, %eax
callq 0x2030
movl (%r15), %edi
addl $0x5, %edi
movl (%r14), %esi
callq 0x4f69
addl $-0x5, (%r15)
cmpl $0x0, 0x8(%r12)
je 0x6bd2
movl 0xc(%r12), %eax
testl %eax, %eax
je 0x6c1e
cmpl $0x1, %eax
je 0x6be5
cmpl $0x2, %eax
jne 0x6c91
leaq 0x2924(%rip), %rdi      # 0x94f4
jmp 0x6bd9
leaq 0x2910(%rip), %rdi      # 0x94e9
xorl %eax, %eax
callq 0x2030
jmp 0x6c91
movl 0x10(%r12), %esi
movl 0x14(%r12), %edx
leaq 0x2909(%rip), %rdi      # 0x94ff
xorl %eax, %eax
callq 0x2030
cmpl $0x0, 0x20(%r12)
leaq 0x29cb(%rip), %rax      # 0x95d5
leaq 0x28f9(%rip), %rdi      # 0x950a
cmoveq %rax, %rdi
xorl %eax, %eax
callq 0x2030
jmp 0x6c53
leaq 0x28f6(%rip), %rdi      # 0x951b
xorl %eax, %eax
callq 0x2030
cmpl $0x0, 0x20(%r12)
leaq 0x299c(%rip), %rax      # 0x95d5
leaq 0x28e0(%rip), %rdi      # 0x9520
cmoveq %rax, %rdi
xorl %eax, %eax
callq 0x2030
cmpl $0x0, 0x24(%r12)
je 0x6c91
movl 0x18(%r12), %esi
testl %esi, %esi
je 0x6c6c
leaq 0x28ab(%rip), %rdi      # 0x950e
xorl %eax, %eax
callq 0x2030
jmp 0x6c7a
leaq 0x2961(%rip), %rdi      # 0x95d4
xorl %eax, %eax
callq 0x2030
movl 0x1c(%r12), %esi
testl %esi, %esi
je 0x6c91
leaq 0x288a(%rip), %rdi      # 0x9514
xorl %eax, %eax
callq 0x2030
movl (%r15), %edi
movl (%r14), %esi
incl %esi
callq 0x4f69
movl $0x1, %edi
movl %ebx, %esi
callq 0x3695
movl %ebx, %edi
callq 0x7683
jmp 0x68ec