// File: /workspace/github_c_makefile_star2_O3/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 0x317e(%rip), %rdi      # 0x99dc
xorl %eax, %eax
callq 0x2030
leaq 0x3(%rsp), %rbx
movq %rbx, %rdi
callq 0x7153
callq 0x7322
movsbl (%rbx), %ebx
leal -0x5b(%rbx), %eax
cmpb $-0x1b, %al
ja 0x688f
callq 0x738e
leaq 0x3157(%rip), %rdi      # 0x99e4
jmp 0x68d8
addl $-0x40, %ebx
movl %ebx, %eax
imulq $0x34, %rax, %rax
leaq 0x80f1(%rip), %rcx      # 0xe990
movslq 0x59c(%rcx,%rax), %r14
testq %r14, %r14
je 0x68cc
leaq (%rcx,%rax), %r13
addq $0x57c, %r13            # imm = 0x57C
cmpl $0x0, 0x24(%r13)
je 0x68ee
callq 0x738e
leaq 0x313a(%rip), %rdi      # 0x9a04
jmp 0x68d8
callq 0x738e
leaq 0x311a(%rip), %rdi      # 0x99f2
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 0x8b97(%rip), %rcx      # 0xf490
movq 0x8(%rcx,%rax,8), %r12
testq %r12, %r12
je 0x691f
leaq 0x7316(%rip), %rax      # 0xdc20
cmpl $0x0, (%rax,%r14,8)
jle 0x692d
callq 0x738e
leaq 0x3125(%rip), %rdi      # 0x9a42
jmp 0x68d8
callq 0x738e
leaq 0x30f8(%rip), %rdi      # 0x9a23
jmp 0x68d8
movl $0xb, %edi
movl $0x12, %esi
callq 0x4f79
leaq 0x3127(%rip), %rdi      # 0x9a6a
xorl %eax, %eax
callq 0x2030
cmpq $0x0, 0x38(%r12)
je 0x6997
leaq 0x306e(%rip), %rdi      # 0x99c7
xorl %eax, %eax
callq 0x2030
leaq 0x1(%rsp), %r15
movq %r15, %rdi
callq 0x7153
movsbl (%r15), %ebp
addl $-0x30, %ebp
cmpl %ebp, (%r12)
je 0x69ab
je 0x6986
movq 0x38(%r12), %r12
testq %r12, %r12
jne 0x6974
callq 0x738e
leaq 0x30c7(%rip), %rdi      # 0x9a59
jmp 0x68d8
movl (%r12), %ebp
leaq 0x2ecd(%rip), %rdi      # 0x986f
movl %ebp, %esi
xorl %eax, %eax
callq 0x2030
testl %ebp, %ebp
je 0x68df
movl 0xc(%r12), %eax
testl %eax, %eax
je 0x69c9
cmpl $0x1, %eax
jne 0x69da
cmpl $0x0, 0x20(%r12)
je 0x69da
callq 0x738e
leaq 0x309e(%rip), %rdi      # 0x9a73
jmp 0x68d8
movl 0x4(%r12), %eax
subl 0x10(%r12), %eax
movl %eax, 0x4(%rsp)
movl $0x1, %edi
movl $0x13, %esi
callq 0x4f79
leaq 0x3094(%rip), %rdi      # 0x9a92
xorl %eax, %eax
callq 0x2030
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rbp
movq %rbp, %rsi
xorl %edx, %edx
callq 0x716e
leaq 0x8(%rsp), %r15
leaq 0x2(%rsp), %rcx
leaq 0x10(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x739d
movl (%r15), %eax
testl %eax, %eax
jne 0x6a42
movl 0x14(%r13), %eax
movl %eax, 0x8(%rsp)
testl %eax, %eax
jle 0x6a60
movl 0x14(%r13), %ecx
subl %eax, %ecx
jge 0x6a71
callq 0x738e
movl 0x14(%r13), %esi
leaq 0x3057(%rip), %rdi      # 0x9ab5
jmp 0x6a87
callq 0x738e
leaq 0x3033(%rip), %rdi      # 0x9a9f
jmp 0x68d8
movl 0x4(%rsp), %ebp
cmpl %ebp, %eax
jle 0x6a93
callq 0x738e
leaq 0x304d(%rip), %rdi      # 0x9ad2
movl %ebp, %esi
xorl %eax, %eax
callq 0x2030
jmp 0x68df
movl $0x1, 0xc(%r12)
movl 0x10(%r12), %edx
testl %edx, %edx
jne 0x6ab6
leaq 0x7224(%rip), %rdx      # 0xdcd0
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
leaq (%rsi,%rsi,2), %rax
leaq (%rdi,%rdi,2), %rcx
shlq $0x6, %rcx
addq 0x64bf(%rip), %rcx      # 0xcfa0
cmpl $0x20, (%rcx,%rax,4)
jne 0x6afb
leaq (%rcx,%rax,4), %rax
movl $0x40, (%rax)
movl $0x1, %edx
callq 0x2df8
movl $0x1, %edi
movl $0x14, %esi
callq 0x4f79
movq 0x64d7(%rip), %rax      # 0xcfe8
movq (%rax), %rdi
addl $0x40, %r14d
movl %r14d, %esi
callq 0x20a0
leaq 0x8d8d(%rip), %r14      # 0xf8b4
movl (%r14), %edx
cmpl $0x16, %edx
setge %al
leaq 0x8d79(%rip), %r15      # 0xf8b0
cmpl $0x32, (%r15)
setge %cl
cmpl $0x18, %edx
jg 0x6b47
andb %cl, %al
je 0x6b60
callq 0x75db
callq 0x72c9
movl $0x32, %edi
movl $0x1, %esi
callq 0x4f79
movl (%r12), %esi
movl 0x8(%r12), %edx
leaq 0x29a1(%rip), %rdi      # 0x9511
xorl %eax, %eax
callq 0x2030
movl (%r15), %edi
addl $0x5, %edi
movl (%r14), %esi
callq 0x4f79
addl $-0x5, (%r15)
cmpl $0x0, 0x8(%r12)
je 0x6bb1
movl 0xc(%r12), %eax
testl %eax, %eax
je 0x6bfd
cmpl $0x1, %eax
je 0x6bc4
cmpl $0x2, %eax
jne 0x6c70
leaq 0x298d(%rip), %rdi      # 0x953c
jmp 0x6bb8
leaq 0x2979(%rip), %rdi      # 0x9531
xorl %eax, %eax
callq 0x2030
jmp 0x6c70
movl 0x10(%r12), %esi
movl 0x14(%r12), %edx
leaq 0x2972(%rip), %rdi      # 0x9547
xorl %eax, %eax
callq 0x2030
cmpl $0x0, 0x20(%r12)
leaq 0x2a3c(%rip), %rax      # 0x9625
leaq 0x2962(%rip), %rdi      # 0x9552
cmoveq %rax, %rdi
xorl %eax, %eax
callq 0x2030
jmp 0x6c32
leaq 0x295f(%rip), %rdi      # 0x9563
xorl %eax, %eax
callq 0x2030
cmpl $0x0, 0x20(%r12)
leaq 0x2a0d(%rip), %rax      # 0x9625
leaq 0x2949(%rip), %rdi      # 0x9568
cmoveq %rax, %rdi
xorl %eax, %eax
callq 0x2030
cmpl $0x0, 0x24(%r12)
je 0x6c70
movl 0x18(%r12), %esi
testl %esi, %esi
je 0x6c4b
leaq 0x2914(%rip), %rdi      # 0x9556
xorl %eax, %eax
callq 0x2030
jmp 0x6c59
leaq 0x29d2(%rip), %rdi      # 0x9624
xorl %eax, %eax
callq 0x2030
movl 0x1c(%r12), %esi
testl %esi, %esi
je 0x6c70
leaq 0x28f3(%rip), %rdi      # 0x955c
xorl %eax, %eax
callq 0x2030
movl (%r15), %edi
movl (%r14), %esi
incl %esi
callq 0x4f79
movl $0x1, %edi
movl %ebx, %esi
callq 0x36f5
movl %ebx, %edi
callq 0x7620
jmp 0x68df