// File: /workspace/github_c_makefile_star2_O3/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 0x4fe8(%rip), %rbx      # 0x9614
leaq 0xb(%rsp), %r14
movl $0x1, %edi
movl $0x12, %esi
callq 0x4f79
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2030
movq %r14, %rdi
callq 0x7153
movl $0x1, %edi
movl $0x13, %esi
callq 0x4f79
movzbl 0xb(%rsp), %eax
leal -0x56(%rax), %ecx
cmpb $-0x15, %cl
jb 0x4631
addl $-0x40, %eax
leaq (%rax,%rax,2), %rcx
leaq 0xae14(%rip), %rdx      # 0xf490
leaq (%rdx,%rcx,8), %rcx
movq %rcx, 0x10(%rsp)
movq (%rcx), %rcx
leaq 0xa301(%rip), %rdx      # 0xe990
movq %rcx, 0x5b0(%rdx)
leaq 0x9583(%rip), %rcx      # 0xdc20
movl $0x1, 0x4(%rcx,%rax,8)
movl %eax, 0x5d0(%rdx)
movl $0x1, %edi
movl $0x14, %esi
callq 0x4f79
leaq 0x4f68(%rip), %rdi      # 0x9629
xorl %eax, %eax
callq 0x2030
movl $0x1, %edi
movl $0x15, %esi
callq 0x4f79
leaq 0x4f66(%rip), %rdi      # 0x9644
movl $0x23, %esi
xorl %eax, %eax
callq 0x2030
movl $0x1, %edi
movl $0x16, %esi
callq 0x4f79
leaq 0x4f5b(%rip), %rdi      # 0x965b
movl $0x1e, %ebx
movl $0x1e, %esi
xorl %eax, %eax
callq 0x2030
movl $0x1, %edi
movl $0x17, %esi
callq 0x4f79
leaq 0x4f4a(%rip), %rdi      # 0x9671
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 0x4f79
movl $0x1, %edi
callq 0x7620
movl $0x1, %edi
movl $0x12, %esi
callq 0x4f79
leaq 0x4f16(%rip), %rdi      # 0x9687
movl %ebx, %esi
xorl %eax, %eax
callq 0x2030
movl $0x6, %edi
movl $0x12, %esi
callq 0x4f79
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x716e
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x739d
movb 0xa(%rsp), %cl
movzbl %cl, %eax
cmpl $0x51, %eax
jg 0x47e6
cmpl $0x41, %eax
jle 0x4845
cmpl $0x42, %eax
je 0x48a5
cmpl $0x43, %eax
je 0x48c1
cmpl $0x48, %eax
jne 0x48e0
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x747e
jmp 0x4902
leal -0x56(%rax), %edx
cmpl $0x2, %edx
jb 0x4822
cmpl $0x52, %eax
je 0x4822
cmpl $0x53, %eax
jne 0x48e0
movl 0xc(%rsp), %eax
leal (%rax,%rax), %ecx
leal (%rcx,%rcx,2), %r14d
cmpl %ebx, %r14d
jg 0x4902
leaq 0xa179(%rip), %rcx      # 0xe990
addl %eax, 0x5c0(%rcx)
jmp 0x4902
movl 0xc(%rsp), %r14d
cmpl %ebx, %r14d
jg 0x4902
movsbl %cl, %esi
movl $0x1, %edi
movl %r14d, %edx
callq 0x7c5d
jmp 0x4902
cmpl $0x20, %eax
je 0x48ff
cmpl $0x3e, %eax
jne 0x48e0
movl $0x1, %edi
movl $0x12, %esi
callq 0x4f79
leaq 0x4e39(%rip), %rdi      # 0x96a6
xorl %eax, %eax
callq 0x2030
movl $0x3, %edi
movl $0x12, %esi
callq 0x4f79
movq %rbp, %rdi
callq 0x7153
movzbl 0xa(%rsp), %eax
cmpl $0x52, %eax
je 0x48fa
cmpl $0x4d, %eax
jne 0x4932
callq 0x6228
jmp 0x48ff
movl 0xc(%rsp), %eax
imull $0x46, %eax, %r14d
cmpl %ebx, %r14d
jg 0x4902
leaq 0xa0d7(%rip), %rcx      # 0xe990
addl %eax, 0x5cc(%rcx)
jmp 0x4902
movl 0xc(%rsp), %eax
movl %eax, %r14d
shll $0x4, %r14d
cmpl %ebx, %r14d
jg 0x4902
leaq 0xa0b8(%rip), %rcx      # 0xe990
addl %eax, 0x5c8(%rcx)
jmp 0x4902
callq 0x738e
movsbl 0xa(%rsp), %esi
leaq 0x4ddb(%rip), %rdi      # 0x96cc
xorl %eax, %eax
callq 0x2030
jmp 0x4902
callq 0x7ba5
xorl %r14d, %r14d
movl %ebx, %eax
subl %r14d, %eax
jge 0x4923
callq 0x738e
movsbl 0xa(%rsp), %esi
leaq 0x4dc5(%rip), %rdi      # 0x96df
xorl %eax, %eax
callq 0x2030
jmp 0x4925
movl %eax, %ebx
cmpb $0x20, 0xa(%rsp)
jne 0x4796
jmp 0x494a
callq 0x738e
xorl %r14d, %r14d
leaq 0x4d6e(%rip), %rdi      # 0x96af
xorl %eax, %eax
callq 0x2030
jmp 0x4902
testl %ebx, %ebx
jg 0x4742
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 0x8628(%rip), %rcx      # 0xcfa0
movl $0x61, 0x8(%rcx,%rax,4)
movl $0x20, (%rcx,%rax,4)
callq 0x752b
movl $0x21, %edi
movl $0x14, %esi
callq 0x4f79
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq