// File: /workspace/github_c_makefile_star2_O1/ArchLuke[P]YouSuck/Engine.c
// Function: ParsePosition
static
void ParsePosition(char* lineIn, S_BOARD *pos) {
    
    lineIn += 9;
    char *ptrChar = lineIn;
    
    if(strncmp(lineIn, "startpos", 8) == 0){
        ParseFen(START_FEN, pos);
    } else {
        ptrChar = strstr(lineIn, "fen");
        if(ptrChar == NULL) {
            ParseFen(START_FEN, pos);
        } else {
            ptrChar+=4;
            ParseFen(ptrChar, pos);
        }
    }
    
    ptrChar = strstr(lineIn, "moves");
    int move;
    
    if(ptrChar != NULL) {
        ptrChar += 6;
        while(*ptrChar) {
              move = ParseMove(ptrChar,pos);
              if(move == NOMOVE) break;
              MakeMove(pos, move);
              pos->ply=0;
              while(*ptrChar && *ptrChar!= ' ') ptrChar++;
              ptrChar++;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x808, %rsp            # imm = 0x808
movq %rdi, %rbx
addq $0x9, %rbx
leaq 0x5246(%rip), %rsi      # 0x7c67
movl $0x8, %edx
movq %rbx, %rdi
callq 0x1050
testl %eax, %eax
je 0x2a55
leaq 0x5270(%rip), %rsi      # 0x7ca9
movq %rbx, %rdi
callq 0x1120
leaq 0x4(%rax), %rcx
testq %rax, %rax
leaq 0x5221(%rip), %rdi      # 0x7c70
cmovneq %rcx, %rdi
jmp 0x2a5c
leaq 0x5214(%rip), %rdi      # 0x7c70
callq 0x330e
leaq 0x53e4(%rip), %rsi      # 0x7e4c
movq %rbx, %rdi
callq 0x1120
testq %rax, %rax
je 0x2bf1
movq %rax, %rbx
movb 0x6(%rax), %r15b
testb %r15b, %r15b
je 0x2bf1
addq $0x6, %rbx
movl $0x13cf, %r12d          # imm = 0x13CF
movsbl 0x1(%rbx), %r14d
leal -0x39(%r14), %eax
movl $0x0, %edi
cmpb $-0x8, %al
jae 0x2ad4
testl %edi, %edi
je 0x2bf1
callq 0x3701
movl $0x0, 0x93f0(%rip)      # 0xbeac
incq %rbx
movzbl -0x1(%rbx), %eax
testb $-0x21, %al
jne 0x2abc
movb (%rbx), %r15b
testb %r15b, %r15b
jne 0x2a93
jmp 0x2bf1
leal -0x69(%r15), %eax
movl $0x0, %edi
cmpb $-0x8, %al
jb 0x2aa5
movsbl 0x3(%rbx), %ebp
leal -0x39(%rbp), %eax
movl $0x0, %edi
cmpb $-0x8, %al
jb 0x2aa5
movzbl 0x2(%rbx), %r13d
leal -0x69(%r13), %eax
movl $0x0, %edi
cmpb $-0x8, %al
jb 0x2aa5
movq %rsp, %rdi
xorl %esi, %esi
callq 0x39ab
movslq 0x800(%rsp), %rax
testq %rax, %rax
jle 0x2bde
movzbl %r15b, %ecx
leal (%r14,%r14,4), %edx
leal (%rcx,%rdx,2), %edx
movl $0xfffffdca, %edi       # imm = 0xFFFFFDCA
addl %edi, %edx
leal (%rbp,%rbp,4), %ecx
leal (%r13,%rcx,2), %esi
addl %edi, %esi
xorl %r8d, %r8d
movl (%rsp,%r8,8), %edi
movl %edi, %ecx
andl $0x7f, %ecx
cmpl %edx, %ecx
jne 0x2bd2
movl %edi, %ecx
shrl $0x7, %ecx
andl $0x7f, %ecx
cmpl %esi, %ecx
jne 0x2bd2
movl %edi, %ecx
shrl $0x14, %ecx
andl $0xf, %ecx
je 0x2aa5
movl $0x13cf, %r9d           # imm = 0x13CF
shrq %cl, %r9
movl $0x15d7, %r10d          # imm = 0x15D7
shrq %cl, %r10
btl %ecx, %r12d
jb 0x2b92
testb $0x1, %r10b
je 0x2ba8
cmpb $0x72, 0x4(%rbx)
jne 0x2ba8
jmp 0x2aa5
testb $0x1, %r10b
jne 0x2ba2
cmpb $0x62, 0x4(%rbx)
je 0x2aa5
testb $0x1, %r9b
jne 0x2bbe
movl $0x15d7, %r9d           # imm = 0x15D7
btl %ecx, %r9d
jb 0x2bbe
cmpb $0x71, 0x4(%rbx)
je 0x2aa5
cmpl $0x8, %ecx
je 0x2bc8
cmpl $0x2, %ecx
jne 0x2bd2
cmpb $0x6e, 0x4(%rbx)
je 0x2aa5
incq %r8
cmpq %r8, %rax
jne 0x2b3e
leaq 0x5416(%rip), %rdi      # 0x7ffb
callq 0x1060
xorl %edi, %edi
jmp 0x2aa5
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq