// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movl $0xffffffff, 0x1c(%rsp) # imm = 0xFFFFFFFF
movl $0x1e, 0x18(%rsp)
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x10(%rsp) # imm = 0xFFFFFFFF
movl $0x0, 0xc(%rsp)
movq $0x0, (%rsp)
movq 0x28(%rsp), %rax
movl $0x0, 0xc(%rax)
movq 0x30(%rsp), %rdi
leaq 0x89c0(%rip), %rsi      # 0xbceb
callq 0x1100
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x333c
jmp 0x333c
movq 0x30(%rsp), %rdi
leaq 0x89ac(%rip), %rsi      # 0xbcf4
callq 0x1100
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x3376
movq 0x20(%rsp), %rax
cmpl $0x1, 0x200(%rax)
jne 0x3376
movq (%rsp), %rdi
addq $0x5, %rdi
callq 0x10e0
movl %eax, 0xc(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x8977(%rip), %rsi      # 0xbcf9
callq 0x1100
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x33b0
movq 0x20(%rsp), %rax
cmpl $0x0, 0x200(%rax)
jne 0x33b0
movq (%rsp), %rdi
addq $0x5, %rdi
callq 0x10e0
movl %eax, 0xc(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x8942(%rip), %rsi      # 0xbcfe
callq 0x1100
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x33ea
movq 0x20(%rsp), %rax
cmpl $0x0, 0x200(%rax)
jne 0x33ea
movq (%rsp), %rdi
addq $0x6, %rdi
callq 0x10e0
movl %eax, 0x10(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x890e(%rip), %rsi      # 0xbd04
callq 0x1100
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x3424
movq 0x20(%rsp), %rax
cmpl $0x1, 0x200(%rax)
jne 0x3424
movq (%rsp), %rdi
addq $0x6, %rdi
callq 0x10e0
movl %eax, 0x10(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x88da(%rip), %rsi      # 0xbd0a
callq 0x1100
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x3450
movq (%rsp), %rdi
addq $0xa, %rdi
callq 0x10e0
movl %eax, 0x18(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x88b8(%rip), %rsi      # 0xbd14
callq 0x1100
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x347c
movq (%rsp), %rdi
addq $0x9, %rdi
callq 0x10e0
movl %eax, 0x14(%rsp)
movq 0x30(%rsp), %rdi
leaq 0x8895(%rip), %rsi      # 0xbd1d
callq 0x1100
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x34a8
movq (%rsp), %rdi
addq $0x6, %rdi
callq 0x10e0
movl %eax, 0x1c(%rsp)
cmpl $-0x1, 0x14(%rsp)
je 0x34bf
movl 0x14(%rsp), %eax
movl %eax, 0x10(%rsp)
movl $0x1, 0x18(%rsp)
callq 0x6000
movl %eax, %ecx
movq 0x28(%rsp), %rax
movl %ecx, (%rax)
movl 0x1c(%rsp), %ecx
movq 0x28(%rsp), %rax
movl %ecx, 0x8(%rax)
cmpl $-0x1, 0x10(%rsp)
je 0x351d
movq 0x28(%rsp), %rax
movl $0x1, 0xc(%rax)
movl 0x18(%rsp), %ecx
movl 0x10(%rsp), %eax
cltd
idivl %ecx
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %eax
subl $0x32, %eax
movl %eax, 0x10(%rsp)
movq 0x28(%rsp), %rax
movl (%rax), %ecx
addl 0x10(%rsp), %ecx
addl 0xc(%rsp), %ecx
movq 0x28(%rsp), %rax
movl %ecx, 0x4(%rax)
cmpl $-0x1, 0x1c(%rsp)
jne 0x3530
movq 0x28(%rsp), %rax
movl $0x40, 0x8(%rax)
movl 0x10(%rsp), %esi
movq 0x28(%rsp), %rax
movl (%rax), %edx
movq 0x28(%rsp), %rax
movl 0x4(%rax), %ecx
movq 0x28(%rsp), %rax
movl 0x8(%rax), %r8d
movq 0x28(%rsp), %rax
movl 0xc(%rax), %r9d
leaq 0x87c7(%rip), %rdi      # 0xbd23
movb $0x0, %al
callq 0x1060
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x5e70
addq $0x38, %rsp
retq
nopw (%rax,%rax)