// File: /workspace/github_c_makefile_star2_O3/beejjorgensen[P]conquest/conqve.c
// Function: inv_player
void inv_player(int x, int y, struct stplanet *planet)
{
    boolean printtf;
    char iline[81];
    char key;
    int cost, amount, ind, new_tf, balance;
    int trash1, trash2;

    get_tf(player, &new_tf, planet->pstar);
    tf_stars[planet->pstar][player]++;
    printtf = false;
    balance = planet->iu;
    cle3r_left();
    point(1, 19);
    addch(planet->pstar + 'A' - 1);

    printw("%d:%2d                         ", planet->number,
           planet->psee_capacity);
    point(x_cursor + 5, y_cursor);
    x_cursor = x_cursor - 5;
    printw("(%2d,/%3d)", planet->inhabitants, planet->iu);
    if (planet->conquered)
        printw("Con");
    else
        printw("   ");
    if (planet->mb != 0)
        printw("%2dmb", planet->mb);
    else
        printw("    ");
    if (planet->amb != 0)
        printw("%2damb", planet->amb);
    point(x_cursor, y_cursor + 1);

    do {
        point(1, 18);
        printw("%3d?                          ", balance);
        point(5, 18);
        get_line(iline, &ind, false);
        do {
            get_token(iline, &ind, &amount, &key);
            switch (key) {
            case 'A':
                cost = amount * amb_cost;
                if (planet->inhabitants == 0) {
                    cost = 0;
                    error_message();
                    printw("  !abandoned planet");
                } else if (planet->conquered) {
                    cost = 0;
                    error_message();
                    printw(" !No amb  on conquered colony ");
                } else if (cost <= balance) {
                    planet->amb = planet->amb + amount;
                };
                break;
            case 'B':
                cost = amount * b_cost;
                if (cost <= balance) {
                    tf[player][new_tf].b = tf[player][new_tf].b + amount;
                    printtf = true;
                };
                break;
            case 'C':
                cost = amount * c_cost;
                if (cost <= balance) {
                    tf[player][new_tf].c = tf[player][new_tf].c + amount;
                    printtf = true;
                };
                break;
            case 'H':
                help(4);
                cost = 0;
                break;
            case 'M':
                cost = amount * mb_cost;
                if (planet->inhabitants == 0) {
                    cost = 0;
                    error_message();
                    printw("  !abandoned planet");
                } else if (planet->conquered) {
                    cost = 0;
                    error_message();
                    printw(" !No Mb  on conquered colony  ");
                } else if (cost <= balance) {
                    planet->mb = planet->mb + amount;
                };
                break;
            case 'S':
                cost = amount * s_cost;
                if (cost <= balance) {
                    tf[player][new_tf].s = tf[player][new_tf].s + amount;
                    printtf = true;
                };
                break;
            case 'T':
                cost = amount;
                if (cost <= balance) {
                    if (cost > planet->inhabitants) {
                        error_message();
                        printw(" ! Not enough people for ( trans");
                        cost = 0;
                    } else if (planet->conquered) {
                        cost = 0;
                        error_message();
                        printw("!No transports on conqered col");
                    } else {
                        tf[player][new_tf].t =
                            tf[player][new_tf].t + amount;
                        planet->inhabitants = planet->inhabitants - amount;
                        trash1 = planet->iu - amount;
                        trash2 = planet->inhabitants * iu_ratio;
                        planet->iu = MIN(trash1, trash2);
                        printtf = true;
                        if (planet->inhabitants == 0) {
                            col_stars[planet->pstar][player]--;
                            if (col_stars[planet->pstar][player] == 0) {
                                board[x][y].enemy = ' ';
                                update_board(x, y, left);
                            };
                            planet->team = none;
                            planet->amb = 0;
                            planet->mb = 0;
                            planet->iu = 0;
                        };
                    };
                };
                break;
            case 'I':
                cost = i_cost * amount;
                if ((amount + planet->iu) >
                    (planet->inhabitants * iu_ratio)
                    ) {
                    cost = 0;
                    error_message();
                    printw(" !Can't support that many iu's");
                } else if (cost <= balance) {
                    planet->iu = planet->iu + amount;
                };
                break;
            case 'R':
            case 'V':
            case 'W':
                cost = amount;
                if (cost <= balance) {
                    point(1, 21);
                    research(player, key, amount);
                };
                pr2nt_res(key);
                break;
            case ' ':
                cost = 0;
                break;
            case '>':
                cost = 0;
                point(1, 18);
                printw(">?     ");
                point(3, 18);
                get_char(&key);
                switch (key) {
                case 'M':
                    printmap();
                    break;
                case 'S':
                    starsum();
                    break;
                case 'C':
                    print_col();
                    break;
                case 'R':
                    ressum();
                    break;
                default:
                    error_message();
                    printw(" !Only M,S,C,R allowed      ");
                };              /*switch ( > */
                break;
            default:
                error_message();
                printw(" !Illegal field %c", key);
            };                  /*switch ( */
            if (cost > balance) {
                error_message();
                printw(" !can't affort %3d%c", amount, key);
            } else
                balance = balance - cost;
        }
        while (key != ' ');
        cle3r_left();
        point(1, 19);
        addch(planet->pstar + 'A' - 1);

        printw("%d:%2d                         ", planet->number,
               planet->psee_capacity);
        point(x_cursor + 5, y_cursor);
        x_cursor = x_cursor - 5;
        printw("(%2d,/%3d)", planet->inhabitants, planet->iu);
        if (planet->conquered)
            printw("Con");
        else
            printw("   ");
        if (planet->mb != 0)
            printw("%2dmb", planet->mb);
        else
            printw("    ");
        if (planet->amb != 0)
            printw("%2damb", planet->amb);
        point(x_cursor, y_cursor + 1);

        if (printtf) {
            point(1, 20);
            pr3nt_tf(new_tf);
        };
    }
    while (balance > 0);
    zero_tf(player, new_tf);
    on_board(x, y);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r14
movl %esi, 0x20(%rsp)
movl %edi, 0x1c(%rsp)
movl 0x30(%rdx), %edx
leaq 0x14(%rsp), %rsi
movl $0x1, %edi
callq 0x2ac4
movslq 0x30(%r14), %rax
leaq 0x55a4(%rip), %rcx      # 0xdc20
incl 0x4(%rcx,%rax,8)
movl 0x14(%r14), %r15d
callq 0x7322
movl $0x1, %edi
movl $0x13, %esi
callq 0x4f79
movq 0x4949(%rip), %rax      # 0xcfe8
movq (%rax), %rdi
movl 0x30(%r14), %esi
addl $0x40, %esi
callq 0x20a0
movl (%r14), %esi
movl 0x8(%r14), %edx
leaq 0xe55(%rip), %rdi       # 0x9511
xorl %eax, %eax
callq 0x2030
leaq 0x71e6(%rip), %rbx      # 0xf8b0
movl (%rbx), %edi
addl $0x5, %edi
leaq 0x71de(%rip), %rax      # 0xf8b4
movl (%rax), %esi
callq 0x4f79
addl $-0x5, (%rbx)
movl 0x10(%r14), %esi
movl 0x14(%r14), %edx
leaq 0xe58(%rip), %rdi       # 0x9547
xorl %eax, %eax
callq 0x2030
cmpl $0x0, 0x20(%r14)
leaq 0xf23(%rip), %rax       # 0x9625
leaq 0xe49(%rip), %rdi       # 0x9552
cmoveq %rax, %rdi
xorl %eax, %eax
callq 0x2030
movl 0x18(%r14), %esi
testl %esi, %esi
je 0x872c
leaq 0xe33(%rip), %rdi       # 0x9556
xorl %eax, %eax
callq 0x2030
jmp 0x873a
leaq 0xef1(%rip), %rdi       # 0x9624
xorl %eax, %eax
callq 0x2030
movl 0x1c(%r14), %esi
testl %esi, %esi
je 0x8750
leaq 0xe13(%rip), %rdi       # 0x955c
xorl %eax, %eax
callq 0x2030
leaq 0x7159(%rip), %rax      # 0xf8b0
movl (%rax), %edi
leaq 0x7154(%rip), %rax      # 0xf8b4
movl (%rax), %esi
incl %esi
callq 0x4f79
movslq 0x1c(%rsp), %rax
movslq 0x20(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x6, %rax
addq 0x481a(%rip), %rax      # 0xcfa0
leaq (%rax,%rcx,4), %rax
movq %rax, 0x28(%rsp)
leaq 0x30(%rsp), %rbx
leaq 0xf(%rsp), %r12
leaq 0x18d0(%rip), %rbp      # 0xa070
movl $0x0, 0x18(%rsp)
movl $0x1, %edi
movl $0x12, %esi
callq 0x4f79
leaq 0xec9(%rip), %rdi       # 0x9687
movl %r15d, %esi
xorl %eax, %eax
callq 0x2030
movl $0x5, %edi
movl $0x12, %esi
callq 0x4f79
movq %rbx, %rdi
leaq 0x24(%rsp), %rsi
xorl %edx, %edx
callq 0x716e
movq %rbx, %rdi
leaq 0x24(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %r12, %rcx
callq 0x739d
movb 0xf(%rsp), %al
movzbl %al, %ecx
leal -0x3e(%rcx), %edx
cmpl $0x19, %edx
ja 0x8851
movslq (%rbp,%rdx,4), %rcx
addq %rbp, %rcx
jmpq *%rcx
movl 0x10(%rsp), %r13d
cmpl %r15d, %r13d
jg 0x8844
movl $0x1, %edi
movl $0x15, %esi
callq 0x4f79
movsbl 0xf(%rsp), %esi
movl 0x10(%rsp), %edx
movl $0x1, %edi
callq 0x7c5d
movb 0xf(%rsp), %al
movsbl %al, %edi
callq 0x7a98
jmp 0x8ab5
cmpl $0x20, %ecx
je 0x88a7
callq 0x738e
movsbl 0xf(%rsp), %esi
leaq 0xe65(%rip), %rdi       # 0x96cc
xorl %eax, %eax
callq 0x2030
jmp 0x8ab5
cmpl $0x0, 0x10(%r14)
je 0x8a21
cmpl $0x0, 0x20(%r14)
je 0x8a75
callq 0x738e
xorl %r13d, %r13d
leaq 0x1873(%rip), %rdi      # 0xa10b
jmp 0x8aae
movl $0x4, %edi
callq 0x747e
xorl %r13d, %r13d
jmp 0x8ab5
movl 0x10(%rsp), %eax
movl %eax, %r13d
shll $0x4, %r13d
cmpl %r15d, %r13d
jg 0x8ab5
movslq 0x14(%rsp), %rcx
imulq $0x34, %rcx, %rcx
leaq 0x60bd(%rip), %rdx      # 0xe990
addl %eax, 0x594(%rdx,%rcx)
jmp 0x89ec
movl 0x10(%rsp), %r13d
cmpl %r15d, %r13d
jg 0x8ab5
movl 0x10(%r14), %eax
movl %eax, %ecx
subl %r13d, %ecx
jge 0x8a59
callq 0x738e
xorl %r13d, %r13d
leaq 0x181f(%rip), %rdi      # 0xa12a
jmp 0x8aae
movl 0x10(%rsp), %eax
imull $0x46, %eax, %r13d
cmpl %r15d, %r13d
jg 0x8ab5
movslq 0x14(%rsp), %rcx
imulq $0x34, %rcx, %rcx
leaq 0x605f(%rip), %rdx      # 0xe990
addl %eax, 0x598(%rdx,%rcx)
jmp 0x89ec
movl $0x1, %edi
movl $0x12, %esi
callq 0x4f79
leaq 0x1836(%rip), %rdi      # 0xa189
xorl %eax, %eax
callq 0x2030
movl $0x3, %edi
movl $0x12, %esi
callq 0x4f79
movq %r12, %rdi
callq 0x7153
movzbl 0xf(%rsp), %eax
cmpl $0x51, %eax
jg 0x8a32
cmpl $0x43, %eax
je 0x8aee
cmpl $0x4d, %eax
jne 0x8a9f
callq 0x6228
jmp 0x88a7
cmpl $0x0, 0x10(%r14)
je 0x8a21
cmpl $0x0, 0x20(%r14)
je 0x8a8c
callq 0x738e
xorl %r13d, %r13d
leaq 0x1730(%rip), %rdi      # 0xa0ec
jmp 0x8aae
movl 0x10(%rsp), %eax
leal (%rax,%rax), %ecx
leal (%rcx,%rcx,2), %r13d
cmpl %r15d, %r13d
jg 0x8ab5
movslq 0x14(%rsp), %rcx
imulq $0x34, %rcx, %rcx
leaq 0x5fab(%rip), %rdx      # 0xe990
addl %eax, 0x58c(%rdx,%rcx)
movl $0x1, 0x18(%rsp)
jmp 0x8ab5
movl 0x10(%rsp), %ecx
movl 0x14(%r14), %eax
addl %ecx, %eax
movl 0x10(%r14), %edx
addl %edx, %edx
cmpl %edx, %eax
jle 0x8a4a
callq 0x738e
xorl %r13d, %r13d
leaq 0x174e(%rip), %rdi      # 0xa16a
jmp 0x8aae
callq 0x738e
xorl %r13d, %r13d
leaq 0x16a8(%rip), %rdi      # 0xa0d8
jmp 0x8aae
cmpl $0x52, %eax
je 0x8af8
cmpl $0x53, %eax
jne 0x8a9f
callq 0x4241
jmp 0x88a7
leal (%rcx,%rcx,2), %r13d
cmpl %r15d, %r13d
jg 0x8ab5
movl %eax, 0x14(%r14)
jmp 0x8ab5
cmpl $0x0, 0x20(%r14)
je 0x8b02
callq 0x738e
xorl %r13d, %r13d
leaq 0x16d8(%rip), %rdi      # 0xa14b
jmp 0x8aae
movl 0x10(%rsp), %eax
leal (,%rax,8), %r13d
cmpl %r15d, %r13d
jg 0x8ab5
addl %eax, 0x18(%r14)
jmp 0x8ab5
movl 0x10(%rsp), %eax
imull $0x23, %eax, %r13d
cmpl %r15d, %r13d
jg 0x8ab5
addl %eax, 0x1c(%r14)
jmp 0x8ab5
callq 0x738e
xorl %r13d, %r13d
leaq 0x16e3(%rip), %rdi      # 0xa191
xorl %eax, %eax
callq 0x2030
movl %r15d, %eax
subl %r13d, %eax
jge 0x8adb
callq 0x738e
movl 0x10(%rsp), %esi
movsbl 0xf(%rsp), %edx
leaq 0x16dc(%rip), %rdi      # 0xa1ae
xorl %eax, %eax
callq 0x2030
jmp 0x8ade
movl %eax, %r15d
cmpb $0x20, 0xf(%rsp)
jne 0x87e6
jmp 0x8b95
callq 0x4048
jmp 0x88a7
callq 0x7ba5
jmp 0x88a7
movslq 0x14(%rsp), %rdx
imulq $0x34, %rdx, %rdx
leaq 0x5e7e(%rip), %rsi      # 0xe990
addl %r13d, 0x590(%rsi,%rdx)
movl 0x14(%r14), %edx
subl %r13d, %edx
addl %ecx, %ecx
cmpl %ecx, %edx
cmovll %edx, %ecx
movl $0x1, 0x18(%rsp)
subl %r13d, %eax
movl %eax, 0x10(%r14)
movl %ecx, 0x14(%r14)
jne 0x8ab5
movslq 0x30(%r14), %rax
leaq 0x5184(%rip), %rcx      # 0xdcd0
decl 0x4(%rcx,%rax,8)
movslq 0x30(%r14), %rax
cmpl $0x0, 0x4(%rcx,%rax,8)
jne 0x8b78
movq 0x28(%rsp), %rax
movl $0x20, (%rax)
movl 0x1c(%rsp), %edi
movl 0x20(%rsp), %esi
movl $0x1, %edx
callq 0x2df8
movl $0x2, 0xc(%r14)
movl $0x0, 0x1c(%r14)
movq $0x0, 0x14(%r14)
jmp 0x8ab5
callq 0x7322
movl $0x1, %edi
movl $0x13, %esi
callq 0x4f79
movq 0x4438(%rip), %rax      # 0xcfe8
movq (%rax), %rdi
movl 0x30(%r14), %esi
addl $0x40, %esi
callq 0x20a0
movl (%r14), %esi
movl 0x8(%r14), %edx
leaq 0x944(%rip), %rdi       # 0x9511
xorl %eax, %eax
callq 0x2030
leaq 0x6cd5(%rip), %rbx      # 0xf8b0
movl (%rbx), %edi
addl $0x5, %edi
leaq 0x6ccd(%rip), %rax      # 0xf8b4
movl (%rax), %esi
callq 0x4f79
addl $-0x5, (%rbx)
movl 0x10(%r14), %esi
movl 0x14(%r14), %edx
leaq 0x947(%rip), %rdi       # 0x9547
xorl %eax, %eax
callq 0x2030
cmpl $0x0, 0x20(%r14)
leaq 0x93f(%rip), %rdi       # 0x9552
leaq 0xa0b(%rip), %rax       # 0x9625
cmoveq %rax, %rdi
xorl %eax, %eax
callq 0x2030
movl 0x18(%r14), %esi
testl %esi, %esi
je 0x8c3d
leaq 0x922(%rip), %rdi       # 0x9556
xorl %eax, %eax
callq 0x2030
jmp 0x8c4b
leaq 0x9e0(%rip), %rdi       # 0x9624
xorl %eax, %eax
callq 0x2030
movl 0x1c(%r14), %esi
testl %esi, %esi
leaq 0x30(%rsp), %rbx
je 0x8c66
leaq 0x8fd(%rip), %rdi       # 0x955c
xorl %eax, %eax
callq 0x2030
leaq 0x6c43(%rip), %rax      # 0xf8b0
movl (%rax), %edi
leaq 0x6c3e(%rip), %rax      # 0xf8b4
movl (%rax), %esi
incl %esi
callq 0x4f79
cmpl $0x0, 0x18(%rsp)
je 0x8c9e
movl $0x1, %edi
movl $0x14, %esi
callq 0x4f79
movl 0x14(%rsp), %edi
callq 0x7620
testl %r15d, %r15d
jg 0x87a8
movl 0x14(%rsp), %esi
movl $0x1, %edi
callq 0x36f5
movl 0x1c(%rsp), %edi
movl 0x20(%rsp), %esi
callq 0x752b
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq