// File: /workspace/github_c_makefile_star2_O3/ArchLuke[P]YouSuck/Engine.c
// Function: ParseGo
static
void ParseGo(char* line, S_SEARCHINFO *info, S_BOARD *pos) {
    
    int depth = -1, movestogo = 30,movetime = -1;
    int time = -1, inc = 0;
        char *ptr = NULL;
    info->timeset = FALSE;
    
    if ((ptr = strstr(line,"infinite"))) {
        ;
    }
    
    if ((ptr = strstr(line,"binc")) && pos->side == BLACK) {
        inc = atoi(ptr + 5);
    }
    
    if ((ptr = strstr(line,"winc")) && pos->side == WHITE) {
        inc = atoi(ptr + 5);
    }
    
    if ((ptr = strstr(line,"wtime")) && pos->side == WHITE) {
        time = atoi(ptr + 6);
    }
      
    if ((ptr = strstr(line,"btime")) && pos->side == BLACK) {
        time = atoi(ptr + 6);
    }
      
    if ((ptr = strstr(line,"movestogo"))) {
        movestogo = atoi(ptr + 10);
    }
      
    if ((ptr = strstr(line,"movetime"))) {
        movetime = atoi(ptr + 9);
    }
      
    if ((ptr = strstr(line,"depth"))) {
        depth = atoi(ptr + 6);
    }
    
    if(movetime != -1) {
        time = movetime;
        movestogo = 1;
    }
    
    info->starttime = GetTimeMs();
    info->depth = depth;
    
    if(time != -1) {
        info->timeset = TRUE;
        time /= movestogo;
        time -= 50;        
        info->stoptime = info->starttime + time + inc;
    }
    
    if(depth == -1) {
        info->depth = MAXDEPTH;
    }
    
    printf("time:%d start:%d stop:%d depth:%d timeset:%d\n",
        time,info->starttime,info->stoptime,info->depth,info->timeset);
    SearchPosition(pos, info);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1028, %rsp           # imm = 0x1028
movq %rdi, %r14
movl $0x0, 0x24578(%rip)     # 0x2717c
leaq 0x509e(%rip), %rsi      # 0x7ca9
callq 0x1120
testq %rax, %rax
setne %cl
movl 0x9284(%rip), %ebp      # 0xbea0
cmpl $0x1, %ebp
sete %dl
andb %cl, %dl
xorl %ebx, %ebx
cmpb $0x1, %dl
jne 0x2c39
addq $0x5, %rax
movq %rax, %rdi
callq 0x1100
movl %eax, %ebx
leaq 0x506e(%rip), %rsi      # 0x7cae
movq %r14, %rdi
callq 0x1120
testq %rax, %rax
setne %cl
testl %ebp, %ebp
sete %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x2c68
addq $0x5, %rax
movq %rax, %rdi
callq 0x1100
movl %eax, %ebx
testl %ebp, %ebp
sete %r15b
leaq 0x503e(%rip), %rsi      # 0x7cb3
movq %r14, %rdi
callq 0x1120
testq %rax, %rax
setne %cl
testb %r15b, %cl
jne 0x2cb1
cmpl $0x1, %ebp
sete %bpl
leaq 0x5023(%rip), %rsi      # 0x7cb9
movq %r14, %rdi
callq 0x1120
testq %rax, %rax
setne %cl
andb %bpl, %cl
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpb $0x1, %cl
jne 0x2cbf
addq $0x6, %rax
movq %rax, %rdi
callq 0x1100
movl %eax, %ebp
leaq 0x4ff9(%rip), %rsi      # 0x7cbf
movq %r14, %rdi
callq 0x1120
testq %rax, %rax
je 0x2ce4
addq $0xa, %rax
movq %rax, %rdi
callq 0x1100
movl %eax, %r12d
jmp 0x2cea
movl $0x1e, %r12d
leaq 0x4fd8(%rip), %rsi      # 0x7cc9
movq %r14, %rdi
callq 0x1120
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x2d19
addq $0x9, %rax
movq %rax, %rdi
callq 0x1100
movl %eax, %r13d
leaq 0x4fb2(%rip), %rsi      # 0x7cd2
movq %r14, %rdi
callq 0x1120
testq %rax, %rax
je 0x2d3c
addq $0x6, %rax
movq %rax, %rdi
callq 0x1100
movl %eax, %r15d
cmpl $-0x1, %r13d
cmovnel %r13d, %ebp
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x1090
imull $0x3e8, (%r14), %ecx    # imm = 0x3E8
movabsq $0x20c49ba5e353f7cf, %rax # imm = 0x20C49BA5E353F7CF
imulq 0x8(%r14)
movq %rdx, %r8
movq %rdx, %rax
shrq $0x3f, %rax
shrq $0x7, %r8
addl %eax, %r8d
addl %ecx, %r8d
movl %r8d, 0x243ed(%rip)     # 0x27170
movl %r15d, 0x243ee(%rip)    # 0x27178
cmpl $-0x1, %ebp
je 0x2dc1
cmpl $-0x1, %r13d
movl $0x1, %ecx
cmovel %r12d, %ecx
movl $0x1, 0x243d6(%rip)     # 0x2717c
movl %ebp, %eax
cltd
idivl %ecx
addl %r8d, %ebx
leal (%rax,%rbx), %ecx
addl $-0x32, %ecx
movl %eax, %esi
addl $-0x32, %esi
movl %ecx, 0x243b5(%rip)     # 0x27174
jmp 0x2dc6
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
cmpl $-0x1, %r15d
jne 0x2ddc
movl $0x40, 0x243a2(%rip)    # 0x27178
movl $0x40, %r15d
movl 0x24392(%rip), %ecx     # 0x27174
movl 0x24393(%rip), %r9d     # 0x2717c
leaq 0x4ee8(%rip), %rdi      # 0x7cd8
xorl %r12d, %r12d
movl %r8d, %edx
movl %r15d, %r8d
xorl %eax, %eax
callq 0x1080
leaq 0x8e99(%rip), %rbx      # 0xbca0
movslq 0x90a2(%rip), %rax      # 0xbeb0
leaq (%rax,%rax,2), %rax
movl 0x258(%rbx,%rax,8), %ebp
movl %ebp, %edi
callq 0x4a55
leaq 0x4edf(%rip), %rdi      # 0x7d06
leaq 0x24626(%rip), %r14     # 0x27454
movq %r14, %rsi
xorl %eax, %eax
callq 0x1080
movl 0x8a82(%rip), %edi      # 0xb8c0
callq 0x4a55
leaq 0x4ecc(%rip), %rdi      # 0x7d16
movq %r14, %rsi
xorl %eax, %eax
callq 0x1080
cmpl $0x0, 0x8a69(%rip)      # 0xb8c4
je 0x2ea4
cmpl 0x8a5d(%rip), %ebp      # 0xb8c0
jne 0x2ea4
leaq 0x519b(%rip), %rdi      # 0x8007
callq 0x1060
movl 0x8a4d(%rip), %edi      # 0xb8c4
callq 0x4a55
leaq 0x4ea9(%rip), %rdi      # 0x7d2c
leaq 0x245ca(%rip), %rsi     # 0x27454
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x1080
movl %ebx, 0x8a2b(%rip)      # 0xb8c4
movl %ebx, 0x8a21(%rip)      # 0xb8c0
jmp 0x32c7
movq $0x0, 0x15279(%rip) # 0x18128
movl %r12d, 0x1527a(%rip)    # 0x18130
movl %r12d, 0x8fef(%rip)     # 0xbeac
leaq 0x15394(%rip), %rdi     # 0x18258
movl $0x1a60, %edx           # imm = 0x1A60
xorl %esi, %esi
callq 0x10a0
xorps %xmm0, %xmm0
movups %xmm0, 0x242ae(%rip)    # 0x27188
movl %r12d, 0x242b7(%rip)    # 0x27198
cmpl %r12d, 0x24290(%rip)    # 0x27178
jle 0x305c
movl $0x1, %ebp
leaq 0x10(%rsp), %r8
movl $0x0, (%rsp)
movl $0xffff8ad0, %edi       # imm = 0xFFFF8AD0
movl $0x7530, %esi           # imm = 0x7530
movl $0x1, %edx
movl $0x1, %ecx
xorl %r9d, %r9d
callq 0x4b1b
cmpl $0x1, 0x2426e(%rip)     # 0x27190
je 0x3058
movl %eax, %r13d
leaq 0x4e71(%rip), %r14      # 0x7da3
leaq 0x2451b(%rip), %r15     # 0x27454
movl %ebp, %edi
callq 0x500c
movl 0x15212(%rip), %eax     # 0x18158
movl %eax, (%rsp)
movq 0x24238(%rip), %r12     # 0x27188
leaq 0x820(%rsp), %rdi
xorl %esi, %esi
callq 0x1090
imull $0x3e8, 0x820(%rsp), %ecx # imm = 0x3E8
movabsq $0x20c49ba5e353f7cf, %rax # imm = 0x20C49BA5E353F7CF
imulq 0x828(%rsp)
movq %rdx, %r8
shrq $0x3f, %r8
shrq $0x7, %rdx
addl %edx, %r8d
addl %ecx, %r8d
subl 0x241dc(%rip), %r8d     # 0x27170
leaq 0x4dd8(%rip), %rdi      # 0x7d73
movl %r13d, %esi
movl %ebp, %edx
movq %r12, %rcx
xorl %eax, %eax
callq 0x1080
movl %ebp, %edi
callq 0x500c
movl %eax, %r13d
leaq 0x4de5(%rip), %rdi      # 0x7da0
xorl %eax, %eax
callq 0x1080
testl %r13d, %r13d
jle 0x2fef
movl %r13d, %r12d
xorl %r13d, %r13d
movl 0xc4b8(%rbx,%r13,4), %edi
callq 0x4a55
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x1080
incq %r13
cmpq %r13, %r12
jne 0x2fcd
movl $0xa, %edi
callq 0x1040
movl 0x1512d(%rip), %esi     # 0x1812c
movl 0x15123(%rip), %edx     # 0x18128
movl 0x15119(%rip), %ecx     # 0x18124
movl 0x1511e(%rip), %r8d     # 0x18130
leaq 0x4d8e(%rip), %rdi      # 0x7da7
xorl %eax, %eax
callq 0x1080
cmpl 0x24152(%rip), %ebp     # 0x27178
jge 0x3058
incl %ebp
movl $0xffff8ad0, %edi       # imm = 0xFFFF8AD0
movl $0x7530, %esi           # imm = 0x7530
movl %ebp, %edx
movl $0x1, %ecx
leaq 0x10(%rsp), %r8
xorl %r9d, %r9d
callq 0x4b1b
movl %eax, %r13d
cmpl $0x1, 0x2413e(%rip)     # 0x27190
jne 0x2f39
movl (%rsp), %r12d
movl %r12d, %edi
callq 0x4a55
leaq 0x4ccf(%rip), %rdi      # 0x7d3a
leaq 0x243e2(%rip), %rsi     # 0x27454
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x1080
movq $0x0, 0x150a2(%rip) # 0x18128
movl %ebx, 0x150a4(%rip)     # 0x18130
movl %ebx, 0x8e1a(%rip)      # 0xbeac
leaq 0x151bf(%rip), %rdi     # 0x18258
movl $0x1a60, %edx           # imm = 0x1A60
xorl %esi, %esi
callq 0x10a0
xorps %xmm0, %xmm0
movups %xmm0, 0x240d9(%rip)    # 0x27188
movl %ebx, 0x240e3(%rip)     # 0x27198
leaq 0x10(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x1090
imull $0x3e8, (%r14), %ecx    # imm = 0x3E8
movabsq $0x20c49ba5e353f7cf, %rax # imm = 0x20C49BA5E353F7CF
imulq 0x8(%r14)
movq %rdx, %rax
shrq $0x3f, %rax
shrq $0x7, %rdx
addl %eax, %edx
addl %ecx, %edx
movl %edx, 0x24082(%rip)     # 0x27170
movq $0x40, 0x2407f(%rip) # 0x27178
movl %r12d, %edi
callq 0x36cf
movq 0x8db8(%rip), %rcx      # 0xbec0
movslq 0x15011(%rip), %rsi     # 0x18120
movq %rcx, %rax
xorl %edx, %edx
divq %rsi
movq 0x14ffa(%rip), %rax     # 0x18118
movslq %edx, %rdx
leaq (%rdx,%rdx,2), %rdx
cmpq %rcx, (%rax,%rdx,8)
jne 0x32c7
leaq (%rax,%rdx,8), %rax
movl 0x8(%rax), %ebx
testl %ebx, %ebx
je 0x32c7
movl %ebx, 0x877c(%rip)      # 0xb8c0
movl %ebx, %edi
callq 0x4a55
leaq 0x4bf5(%rip), %rdi      # 0x7d47
leaq 0x242fb(%rip), %rsi     # 0x27454
xorl %eax, %eax
callq 0x1080
movl %ebx, %edi
callq 0x36cf
leaq 0x4ea7(%rip), %rdi      # 0x8015
callq 0x1060
movq 0x8d46(%rip), %rcx      # 0xbec0
movslq 0x14f9f(%rip), %rsi     # 0x18120
movq %rcx, %rax
xorl %edx, %edx
divq %rsi
movq 0x14f88(%rip), %rax     # 0x18118
movslq %edx, %rdx
leaq (%rdx,%rdx,2), %rdx
cmpq %rcx, (%rax,%rdx,8)
jne 0x32c7
leaq (%rax,%rdx,8), %rax
movl 0xc(%rax), %r15d
cmpl $0x1f4, %r15d           # imm = 0x1F4
jg 0x32c7
movq %rdx, 0x8(%rsp)
movl 0x8(%rax), %r12d
movl 0x10(%rax), %eax
movl %eax, (%rsp)
leaq 0x820(%rsp), %rsi
movl %r12d, %edi
movl %r15d, %edx
callq 0x56fe
movl %eax, %ebx
xorl %ebp, %ebp
cmpl $0xffff8ad1, %eax       # imm = 0xFFFF8AD1
cmovgel %r12d, %ebp
leaq 0x10(%rsp), %r13
movq %r13, %rdi
xorl %esi, %esi
callq 0x3966
movl 0x800(%r13), %eax
movl %eax, 0x4(%rsp)
testl %eax, %eax
js 0x32a3
cmpl $0x1, 0x23f82(%rip)     # 0x27190
je 0x32a3
xorl %r13d, %r13d
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl %r12d, %esi
callq 0x58c6
movl $0xffff8ad0, %edi       # imm = 0xFFFF8AD0
movl $0x7530, %esi           # imm = 0x7530
movl (%rsp), %edx
movl $0x1, %ecx
movq %r14, %r8
movl $0x1, %r9d
callq 0x4b1b
movq 0x14eca(%rip), %rcx     # 0x18118
movq 0x8(%rsp), %rsi
movq (%rcx,%rsi,8), %rdx
cmpq 0x8c62(%rip), %rdx      # 0xbec0
jne 0x32a3
addl $0x32, %eax
cmpl %r15d, %eax
jle 0x32a3
leaq (%rcx,%rsi,8), %rax
movl 0x8(%rax), %r12d
movl %r12d, %edi
leaq 0x820(%rsp), %rsi
movl %r15d, %edx
callq 0x56fe
cmpl %ebx, %eax
cmovgl %eax, %ebx
cmovgl %r12d, %ebp
cmpl 0x4(%rsp), %r13d
jge 0x32a3
incl %r13d
cmpl $0x1, 0x23ef3(%rip)     # 0x27190
jne 0x3217
movl %ebp, 0x861b(%rip)      # 0xb8c4
movl %ebp, %edi
callq 0x4a55
leaq 0x4b1a(%rip), %rdi      # 0x7dd1
leaq 0x24196(%rip), %rdx     # 0x27454
movl %ebx, %esi
xorl %eax, %eax
callq 0x1080
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq