// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %rbx
pushq $0x12
popq %rbp
leaq 0x513a(%rip), %r14      # 0x95d4
leaq 0xb(%rsp), %r15
pushq $0x13
popq %r12
movl %ebx, %edi
movl %ebp, %esi
callq 0x4dbd
movq %r14, %rdi
xorl %eax, %eax
callq 0x2030
movq %r15, %rdi
callq 0x6d93
movl %ebx, %edi
movl %r12d, %esi
callq 0x4dbd
movzbl 0xb(%rsp), %eax
leal -0x56(%rax), %ecx
cmpb $-0x15, %cl
jb 0x44a3
addl $-0x40, %eax
imulq $0x18, %rax, %rcx
leaq 0xbfad(%rip), %rdx      # 0x10490
leaq (%rdx,%rcx), %rsi
movq %rsi, 0x10(%rsp)
movq (%rdx,%rcx), %rcx
leaq 0xb499(%rip), %rdx      # 0xf990
movq %rcx, 0x5b0(%rdx)
leaq 0xa71b(%rip), %rcx      # 0xec20
movl $0x1, 0x4(%rcx,%rax,8)
movl %eax, 0x5d0(%rdx)
pushq $0x1
popq %rbx
pushq $0x14
popq %rsi
movl %ebx, %edi
callq 0x4dbd
leaq 0x50c2(%rip), %rdi      # 0x95e9
xorl %eax, %eax
callq 0x2030
pushq $0x15
popq %rsi
movl %ebx, %edi
callq 0x4dbd
leaq 0x50c5(%rip), %rdi      # 0x9604
pushq $0x23
popq %rsi
xorl %eax, %eax
callq 0x2030
pushq $0x16
popq %rsi
movl %ebx, %edi
callq 0x4dbd
leaq 0x50c1(%rip), %rdi      # 0x961b
pushq $0x1e
popq %rbp
movl %ebp, %esi
xorl %eax, %eax
callq 0x2030
pushq $0x17
popq %rsi
movl %ebx, %edi
callq 0x4dbd
leaq 0x50ba(%rip), %rdi      # 0x9631
xorl %eax, %eax
callq 0x2030
leaq 0x20(%rsp), %r14
leaq 0x1c(%rsp), %r12
leaq 0xa(%rsp), %r15
pushq $0x1
popq %r13
movl %r13d, %edi
pushq $0x13
popq %rsi
callq 0x4dbd
movl %r13d, %edi
callq 0x71d7
movl %r13d, %edi
pushq $0x12
popq %r13
movl %r13d, %esi
callq 0x4dbd
leaq 0x508d(%rip), %rdi      # 0x9647
movl %ebp, %esi
xorl %eax, %eax
callq 0x2030
pushq $0x6
popq %rdi
movl %r13d, %esi
callq 0x4dbd
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x6dae
movq %r14, %rdi
movq %r12, %rsi
leaq 0xc(%rsp), %rdx
movq %r15, %rcx
callq 0x6fc3
movb 0xa(%rsp), %al
movzbl %al, %ecx
leal -0x56(%rcx), %edx
cmpl $0x2, %edx
jb 0x4657
cmpl $0x20, %ecx
je 0x4719
cmpl $0x3e, %ecx
je 0x4675
cmpl $0x42, %ecx
je 0x46bb
cmpl $0x53, %ecx
je 0x46e0
cmpl $0x48, %ecx
je 0x46d5
cmpl $0x52, %ecx
je 0x4657
cmpl $0x43, %ecx
jne 0x46fa
movl 0xc(%rsp), %eax
movl %eax, %ebx
shll $0x4, %ebx
cmpl %ebp, %ebx
jg 0x471b
leaq 0xb344(%rip), %rcx      # 0xf990
addl %eax, 0x5c8(%rcx)
jmp 0x471b
movl 0xc(%rsp), %ebx
cmpl %ebp, %ebx
jg 0x471b
movsbl %al, %esi
pushq $0x1
popq %rdi
movl %ebx, %edx
callq 0x77c6
jmp 0x471b
pushq $0x1
popq %rdi
movl %r13d, %esi
callq 0x4dbd
leaq 0x4fdf(%rip), %rdi      # 0x9666
xorl %eax, %eax
callq 0x2030
pushq $0x3
popq %rdi
movl %r13d, %esi
callq 0x4dbd
movq %r15, %rdi
callq 0x6d93
movzbl 0xa(%rsp), %eax
cmpl $0x52, %eax
je 0x4714
cmpl $0x4d, %eax
jne 0x474a
callq 0x5edc
jmp 0x4719
movl 0xc(%rsp), %eax
imull $0x46, %eax, %ebx
cmpl %ebp, %ebx
jg 0x471b
leaq 0xb2c3(%rip), %rcx      # 0xf990
addl %eax, 0x5cc(%rcx)
jmp 0x471b
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x706a
jmp 0x471b
movl 0xc(%rsp), %eax
imull $0x6, %eax, %ebx
cmpl %ebp, %ebx
jg 0x471b
leaq 0xb29e(%rip), %rcx      # 0xf990
addl %eax, 0x5c0(%rcx)
jmp 0x471b
callq 0x6fb8
movsbl 0xa(%rsp), %esi
leaq 0x4f81(%rip), %rdi      # 0x968c
xorl %eax, %eax
callq 0x2030
jmp 0x471b
callq 0x7716
xorl %ebx, %ebx
movl %ebp, %eax
subl %ebx, %eax
jge 0x473b
callq 0x6fb8
movsbl 0xa(%rsp), %esi
leaq 0x4f6d(%rip), %rdi      # 0x969f
xorl %eax, %eax
callq 0x2030
jmp 0x473d
movl %eax, %ebp
cmpb $0x20, 0xa(%rsp)
jne 0x45db
jmp 0x4761
callq 0x6fb8
xorl %ebx, %ebx
leaq 0x4f17(%rip), %rdi      # 0x966f
xorl %eax, %eax
callq 0x2030
jmp 0x471b
testl %ebp, %ebp
jg 0x458d
movq 0x10(%rsp), %rax
movl $0x1, 0x14(%rax)
movslq (%rax), %rdi
movslq 0x4(%rax), %rsi
imulq $0xc, %rsi, %rax
imulq $0xc0, %rdi, %rcx
addq 0x980a(%rip), %rcx      # 0xdf98
movl $0x61, 0x8(%rax,%rcx)
movl $0x20, (%rax,%rcx)
callq 0x7107
pushq $0x21
popq %rdi
pushq $0x14
popq %rsi
callq 0x4dbd
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq