// File: /workspace/github_c_makefile_star2_O1/beejjorgensen[P]conquest/conqin.c
// Function: init_player
void init_player(void)
{
    char str, key;
    int star_number;
    int balance, cost, amt, ind;
    char iline[81];
    do {
        point(1, 18);
        printw("start at star?\n     ");
        get_char(&str);
        point(1, 19);
        star_number = str - 'A' + 1;
    }
    while (star_number < 1 || star_number > nstars);
    tf[player][1].x = stars[star_number].x;
    tf[player][1].y = stars[star_number].y;
    tf_stars[star_number][player] = 1;
    tf[player][1].dest = star_number;
    point(1, 20);
    printw("choose your initial fleet.");
    point(1, 21);
    printw("you have %d transports", initunit);
    point(1, 22);
    printw(" && %d units to spend", initmoney);
    point(1, 23);
    printw("on ships or research.");
    balance = initmoney;
    do {
        point(1, 19);
        pr3nt_tf(1);
        point(1, 18);
        printw("%3d?                          ", balance);
        point(6, 18);
        get_line(iline, &ind, false);
        do {
            get_token(iline, &ind, &amt, &key);
            switch (key) {
            case 'C':
                cost = amt * c_cost;
                if (cost <= balance) {
                    tf[player][1].c = tf[player][1].c + amt;
                }
                break;
            case 'S':
                cost = amt * s_cost;
                if (cost <= balance) {
                    tf[player][1].s = tf[player][1].s + amt;
                };
                break;
            case 'B':
                cost = amt * b_cost;
                if (cost <= balance) {
                    tf[player][1].b = tf[player][1].b + amt;
                };
                break;
            case 'H':
                help(0);
                cost = 0;
                break;
            case 'W':
            case 'V':
            case 'R':
                cost = amt;
                if (cost <= balance)
                    research(player, key, amt);
                break;
            case ' ':
                cost = 0;
                break;
            case '>':
                point(1, 18);
                printw(">?      ");
                point(3, 18);
                cost = 0;
                get_char(&key);
                switch (key) {
                case 'M':
                    printmap();
                    break;
                case 'R':
                    ressum();
                    break;
                default:
                    error_message();
                    printw(" !Only M,R during initialize");
                };              /*!= switch ( */
                break;
            default:
                error_message();
                printw(" !Illegal field %c", key);
            };                  /*switch ( */
            if (cost <= balance)
                balance = balance - cost;
            else {
                error_message();
                printw("  !can't afford %c", key);
            };
        }
        while (key != ' ');
    }
    while (balance > 0);
    stars[star_number].visit[player] = true;
    board[stars[star_number].x][stars[star_number].y].tf = 'a';
    board[stars[star_number].x][stars[star_number].y].enemy = ' ';
    on_board(stars[star_number].x, stars[star_number].y);
    point(33, 20);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
leaq 0x4fc4(%rip), %rbx      # 0x95c4
leaq 0xb(%rsp), %r14
movl $0x1, %edi
movl $0x12, %esi
callq 0x4f69
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2030
movq %r14, %rdi
callq 0x7187
movl $0x1, %edi
movl $0x13, %esi
callq 0x4f69
movzbl 0xb(%rsp), %eax
leal -0x56(%rax), %ecx
cmpb $-0x15, %cl
jb 0x4605
addl $-0x40, %eax
leaq (%rax,%rax,2), %rcx
leaq 0xae50(%rip), %rdx      # 0xf4a0
leaq (%rdx,%rcx,8), %rdx
movl (%rdx), %ecx
leaq 0xa343(%rip), %rsi      # 0xe9a0
movl %ecx, 0x5b0(%rsi)
movq %rdx, 0x10(%rsp)
movl 0x4(%rdx), %ecx
movl %ecx, 0x5b4(%rsi)
leaq 0x95b8(%rip), %rcx      # 0xdc30
movl $0x1, 0x4(%rcx,%rax,8)
movl %eax, 0x5d0(%rsi)
movl $0x1, %edi
movl $0x14, %esi
callq 0x4f69
leaq 0x4f3d(%rip), %rdi      # 0x95d9
xorl %eax, %eax
callq 0x2030
movl $0x1, %edi
movl $0x15, %esi
callq 0x4f69
leaq 0x4f3b(%rip), %rdi      # 0x95f4
movl $0x23, %esi
xorl %eax, %eax
callq 0x2030
movl $0x1, %edi
movl $0x16, %esi
callq 0x4f69
leaq 0x4f30(%rip), %rdi      # 0x960b
movl $0x1e, %ebx
movl $0x1e, %esi
xorl %eax, %eax
callq 0x2030
movl $0x1, %edi
movl $0x17, %esi
callq 0x4f69
leaq 0x4f1f(%rip), %rdi      # 0x9621
xorl %eax, %eax
callq 0x2030
leaq 0x20(%rsp), %r15
leaq 0x1c(%rsp), %r12
leaq 0xc(%rsp), %r13
leaq 0xa(%rsp), %rbp
movl $0x1, %edi
movl $0x13, %esi
callq 0x4f69
movl $0x1, %edi
callq 0x7683
movl $0x1, %edi
movl $0x12, %esi
callq 0x4f69
leaq 0x4eeb(%rip), %rdi      # 0x9637
movl %ebx, %esi
xorl %eax, %eax
callq 0x2030
movl $0x6, %edi
movl $0x12, %esi
callq 0x4f69
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x71a2
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x73f2
movb 0xa(%rsp), %cl
movzbl %cl, %eax
cmpl $0x51, %eax
jg 0x47c1
cmpl $0x41, %eax
jle 0x4820
cmpl $0x42, %eax
je 0x4880
cmpl $0x43, %eax
je 0x489c
cmpl $0x48, %eax
jne 0x48bb
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x74d3
jmp 0x48dd
leal -0x56(%rax), %edx
cmpl $0x2, %edx
jb 0x47fd
cmpl $0x52, %eax
je 0x47fd
cmpl $0x53, %eax
jne 0x48bb
movl 0xc(%rsp), %eax
leal (%rax,%rax), %ecx
leal (%rcx,%rcx,2), %r14d
cmpl %ebx, %r14d
jg 0x48dd
leaq 0xa1ae(%rip), %rcx      # 0xe9a0
addl %eax, 0x5c0(%rcx)
jmp 0x48dd
movl 0xc(%rsp), %r14d
cmpl %ebx, %r14d
jg 0x48dd
movsbl %cl, %esi
movl $0x1, %edi
movl %r14d, %edx
callq 0x7cc9
jmp 0x48dd
cmpl $0x20, %eax
je 0x48da
cmpl $0x3e, %eax
jne 0x48bb
movl $0x1, %edi
movl $0x12, %esi
callq 0x4f69
leaq 0x4e0e(%rip), %rdi      # 0x9656
xorl %eax, %eax
callq 0x2030
movl $0x3, %edi
movl $0x12, %esi
callq 0x4f69
movq %rbp, %rdi
callq 0x7187
movzbl 0xa(%rsp), %eax
cmpl $0x52, %eax
je 0x48d5
cmpl $0x4d, %eax
jne 0x490d
callq 0x61f4
jmp 0x48da
movl 0xc(%rsp), %eax
imull $0x46, %eax, %r14d
cmpl %ebx, %r14d
jg 0x48dd
leaq 0xa10c(%rip), %rcx      # 0xe9a0
addl %eax, 0x5cc(%rcx)
jmp 0x48dd
movl 0xc(%rsp), %eax
movl %eax, %r14d
shll $0x4, %r14d
cmpl %ebx, %r14d
jg 0x48dd
leaq 0xa0ed(%rip), %rcx      # 0xe9a0
addl %eax, 0x5c8(%rcx)
jmp 0x48dd
callq 0x73e3
movsbl 0xa(%rsp), %esi
leaq 0x4db0(%rip), %rdi      # 0x967c
xorl %eax, %eax
callq 0x2030
jmp 0x48dd
callq 0x7c11
xorl %r14d, %r14d
movl %ebx, %eax
subl %r14d, %eax
jge 0x48fe
callq 0x73e3
movsbl 0xa(%rsp), %esi
leaq 0x4d9a(%rip), %rdi      # 0x968f
xorl %eax, %eax
callq 0x2030
jmp 0x4900
movl %eax, %ebx
cmpb $0x20, 0xa(%rsp)
jne 0x4771
jmp 0x4925
callq 0x73e3
xorl %r14d, %r14d
leaq 0x4d43(%rip), %rdi      # 0x965f
xorl %eax, %eax
callq 0x2030
jmp 0x48dd
testl %ebx, %ebx
jg 0x471d
movq 0x10(%rsp), %rax
movl $0x1, 0x14(%rax)
movslq (%rax), %rdi
movslq 0x4(%rax), %rsi
leaq (%rsi,%rsi,2), %rax
leaq (%rdi,%rdi,2), %rcx
shlq $0x6, %rcx
addq 0x8655(%rip), %rcx      # 0xcfa8
movl $0x61, 0x8(%rcx,%rax,4)
movl $0x20, (%rcx,%rax,4)
callq 0x7580
movl $0x21, %edi
movl $0x14, %esi
callq 0x4f69
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq