// File: /workspace/github_c_makefile_star2_O0/icarroll[P]clunk/playthud.c
// Function: getmove
struct move getmove(void)
{
    struct move move;

    char * line = NULL;
    size_t size = 0;
    int _ = getline(& line, & size, stdin);

    char * cur = line;

    skipspace(& cur);
    if (toupper(* cur) == 'D') move.isdwarfmove = true;
    else if (toupper(* cur) == 'T') move.isdwarfmove = false;
    else exit(EXIT_FAILURE);
    cur += 1;

    bool valid;

    skipspace(& cur);
    valid = getpos(& cur, & move.from);
    if (! valid) exit(EXIT_FAILURE);

    skipspace(& cur);
    if (* cur++ != '-') exit(EXIT_FAILURE);

    skipspace(& cur);
    valid = getpos(& cur, & move.to);
    if (! valid) exit(EXIT_FAILURE);

    move.numcapts = 0;
    while (move.numcapts <= NUMDIRS)
    {
        skipspace(& cur);
        if (* cur == '\0' || * cur == '\n') break;

        skipspace(& cur);
        if (toupper(* cur++) != 'X') exit(EXIT_FAILURE);

        skipspace(& cur);
        valid = getpos(& cur, & move.capts[move.numcapts++]);
        if (! valid) exit(EXIT_FAILURE);
    }

    free(line);
    return move;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x38(%rbp)
movq %rdi, -0x30(%rbp)
movq $0x0, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movq 0x7b69(%rip), %rax      # 0x8fe0
movq (%rax), %rdx
leaq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x1150
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x4470
movq -0x20(%rbp), %rax
movsbl (%rax), %edi
callq 0x1080
cmpl $0x44, %eax
jne 0x14b5
movq -0x38(%rbp), %rax
movb $0x1, (%rax)
jmp 0x14db
movq -0x20(%rbp), %rax
movsbl (%rax), %edi
callq 0x1080
cmpl $0x54, %eax
jne 0x14cf
movq -0x38(%rbp), %rax
movb $0x0, (%rax)
jmp 0x14d9
movl $0x1, %edi
callq 0x1090
jmp 0x14db
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x4470
movq -0x38(%rbp), %rsi
addq $0x4, %rsi
leaq -0x20(%rbp), %rdi
callq 0x4510
andb $0x1, %al
movb %al, -0x21(%rbp)
testb $0x1, -0x21(%rbp)
jne 0x1516
movl $0x1, %edi
callq 0x1090
leaq -0x20(%rbp), %rdi
callq 0x4470
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x1540
movl $0x1, %edi
callq 0x1090
leaq -0x20(%rbp), %rdi
callq 0x4470
movq -0x38(%rbp), %rsi
addq $0xc, %rsi
leaq -0x20(%rbp), %rdi
callq 0x4510
andb $0x1, %al
movb %al, -0x21(%rbp)
testb $0x1, -0x21(%rbp)
jne 0x156f
movl $0x1, %edi
callq 0x1090
movq -0x38(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x38(%rbp), %rax
cmpl $0x8, 0x14(%rax)
jg 0x1625
leaq -0x20(%rbp), %rdi
callq 0x4470
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x15a9
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x15ab
jmp 0x1625
leaq -0x20(%rbp), %rdi
callq 0x4470
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl (%rax), %edi
callq 0x1080
cmpl $0x58, %eax
je 0x15da
movl $0x1, %edi
callq 0x1090
leaq -0x20(%rbp), %rdi
callq 0x4470
movq -0x38(%rbp), %rcx
movq %rcx, %rsi
addq $0x18, %rsi
movl 0x14(%rcx), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, 0x14(%rcx)
cltq
shlq $0x3, %rax
addq %rax, %rsi
leaq -0x20(%rbp), %rdi
callq 0x4510
andb $0x1, %al
movb %al, -0x21(%rbp)
testb $0x1, -0x21(%rbp)
jne 0x1620
movl $0x1, %edi
callq 0x1090
jmp 0x157a
movq -0x8(%rbp), %rdi
callq 0x10f0
movq -0x30(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)