// File: /workspace/github_c_makefile_star2_O3/beejjorgensen[P]conquest/conqtf.c
// Function: split_tf
void split_tf(int *Tf2num, int *New2tf)
{
    int tf_num, new_tf;
    char ships;
    int x, y, n_ships;
    int ind;
    char iline[81];
    new_tf = *New2tf;
    tf_num = *Tf2num;
    get_tf(player, &new_tf, tf[player][tf_num].dest);
    tf_stars[tf[player][tf_num].dest][player]++;
    printw(" ships:");
    point(8, y_cursor);
    get_line(iline, &ind, false);
    get_token(iline, &ind, &n_ships, &ships);
    if (ships == ' ') {         /*entire fleet */
        tf[player][new_tf].s = tf[player][tf_num].s;
        tf[player][new_tf].t = tf[player][tf_num].t;
        tf[player][new_tf].c = tf[player][tf_num].c;
        tf[player][new_tf].b = tf[player][tf_num].b;
        tf[player][tf_num].s = 0;
        tf[player][tf_num].t = 0;
        tf[player][tf_num].c = 0;
        tf[player][tf_num].b = 0;
    } else {
        do {
            switch (ships) {
            case 'T':
                if (tf[player][tf_num].t < n_ships)
                    n_ships = tf[player][tf_num].t;
                tf[player][tf_num].t = tf[player][tf_num].t - n_ships;
                tf[player][new_tf].t = tf[player][new_tf].t + n_ships;
                break;
            case 'S':
                if (tf[player][tf_num].s < n_ships)
                    n_ships = tf[player][tf_num].s;
                tf[player][tf_num].s = tf[player][tf_num].s - n_ships;
                tf[player][new_tf].s = tf[player][new_tf].s + n_ships;
                break;
            case 'C':
                if (tf[player][tf_num].c < n_ships)
                    n_ships = tf[player][tf_num].c;
                tf[player][tf_num].c = tf[player][tf_num].c - n_ships;
                tf[player][new_tf].c = tf[player][new_tf].c + n_ships;
                break;
            case 'B':
                if (tf[player][tf_num].b < n_ships)
                    n_ships = tf[player][tf_num].b;
                tf[player][tf_num].b = tf[player][tf_num].b - n_ships;
                tf[player][new_tf].b = tf[player][new_tf].b + n_ships;
                break;
            default:
                error_message();
                printw("  ! Illegal field %c", ships);
            };                  /*switch ( */
            get_token(iline, &ind, &n_ships, &ships);
        }
        while (ships != ' ');
    };
    x = tf[player][tf_num].x;
    y = tf[player][tf_num].y;
    zero_tf(player, tf_num);
    zero_tf(player, new_tf);
    on_board(x, y);
    *Tf2num = tf_num;
    *New2tf = new_tf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, 0x28(%rsp)
movl (%rsi), %eax
leaq 0x10(%rsp), %rsi
movl %eax, (%rsi)
movq %rdi, 0x20(%rsp)
movslq (%rdi), %rax
movq %rax, 0x18(%rsp)
imulq $0x34, %rax, %rax
leaq 0x6a6f(%rip), %r15      # 0xe990
leaq (%r15,%rax), %r14
addq $0x57c, %r14            # imm = 0x57C
movl 0x20(%r14), %edx
movl $0x1, %edi
callq 0x2ac4
movslq 0x20(%r14), %rax
leaq 0x5cdb(%rip), %rcx      # 0xdc20
incl 0x4(%rcx,%rax,8)
leaq 0x2034(%rip), %rdi      # 0x9f84
xorl %eax, %eax
callq 0x2030
leaq 0x7956(%rip), %rax      # 0xf8b4
movl (%rax), %esi
movl $0x8, %edi
callq 0x4f79
leaq 0x30(%rsp), %rbx
leaq 0x14(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x716e
leaq 0xc(%rsp), %rdx
leaq 0xb(%rsp), %r13
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rcx
callq 0x739d
movb (%r13), %al
cmpb $0x20, %al
jne 0x7fc5
movslq 0x10(%rsp), %rax
imulq $0x34, %rax, %rax
movups 0x10(%r14), %xmm0
movups %xmm0, 0x58c(%r15,%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r14)
jmp 0x80dd
leaq 0x30(%rsp), %r12
leaq 0x14(%rsp), %r13
leaq 0xc(%rsp), %rbp
leaq 0xb(%rsp), %rbx
movzbl %al, %eax
cmpl $0x52, %eax
jg 0x801d
cmpl $0x42, %eax
je 0x806c
cmpl $0x43, %eax
jne 0x8052
movl 0x18(%r14), %eax
movl 0xc(%rsp), %ecx
cmpl %ecx, %eax
jge 0x8001
movl %eax, 0xc(%rsp)
movl %eax, %ecx
subl %ecx, %eax
movl %eax, 0x18(%r14)
movslq 0x10(%rsp), %rax
imulq $0x34, %rax, %rax
addl %ecx, 0x594(%r15,%rax)
jmp 0x80c0
cmpl $0x53, %eax
je 0x8097
cmpl $0x54, %eax
jne 0x8052
movl 0x14(%r14), %eax
movl 0xc(%rsp), %ecx
cmpl %ecx, %eax
jge 0x8039
movl %eax, 0xc(%rsp)
movl %eax, %ecx
subl %ecx, %eax
movl %eax, 0x14(%r14)
movslq 0x10(%rsp), %rax
imulq $0x34, %rax, %rax
addl %ecx, 0x590(%r15,%rax)
jmp 0x80c0
callq 0x738e
movsbl 0xb(%rsp), %esi
leaq 0x1f29(%rip), %rdi      # 0x9f8c
xorl %eax, %eax
callq 0x2030
jmp 0x80c0
movl 0x1c(%r14), %eax
movl 0xc(%rsp), %ecx
cmpl %ecx, %eax
jge 0x807e
movl %eax, 0xc(%rsp)
movl %eax, %ecx
subl %ecx, %eax
movl %eax, 0x1c(%r14)
movslq 0x10(%rsp), %rax
imulq $0x34, %rax, %rax
addl %ecx, 0x598(%r15,%rax)
jmp 0x80c0
movl 0x10(%r14), %eax
movl 0xc(%rsp), %ecx
cmpl %ecx, %eax
jge 0x80a9
movl %eax, 0xc(%rsp)
movl %eax, %ecx
subl %ecx, %eax
movl %eax, 0x10(%r14)
movslq 0x10(%rsp), %rax
imulq $0x34, %rax, %rax
addl %ecx, 0x58c(%r15,%rax)
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x739d
movb 0xb(%rsp), %al
cmpb $0x20, %al
jne 0x7fd9
movl (%r14), %ebx
movl 0x4(%r14), %ebp
movl $0x1, %edi
movq 0x18(%rsp), %r14
movl %r14d, %esi
callq 0x36f5
movl 0x10(%rsp), %esi
movl $0x1, %edi
callq 0x36f5
movl %ebx, %edi
movl %ebp, %esi
callq 0x752b
movq 0x20(%rsp), %rax
movl %r14d, (%rax)
movl 0x10(%rsp), %eax
movq 0x28(%rsp), %rcx
movl %eax, (%rcx)
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq