// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: test_go
void test_go(char *cfg, char *weights, int multi)
{
    int i;
    network *net = load_network(cfg, weights, 0);
    set_batch_network(net, 1);
    srand(time(0));
    float *board = calloc(19*19*3, sizeof(float));
    flip_board(board);
    float *move = calloc(19*19+1, sizeof(float));
    int color = 1;
    while(1){
        float result = predict_move2(net, board, move, multi);
        printf("%.2f%% Win Chance\n", (result+1)/2*100);

        int indexes[nind];
        int row, col;
        top_k(move, 19*19+1, nind, indexes);
        print_board(stderr, board, color, indexes);
        for(i = 0; i < nind; ++i){
            int index = indexes[i];
            row = index / 19;
            col = index % 19;
            if(row == 19){
                printf("%d: Pass, %.2f%%\n", i+1, move[index]*100);
            } else {
                printf("%d: %c %d, %.2f%%\n", i+1, col + 'A' + 1*(col > 7 && noi), (inverted)?19 - row : row+1, move[index]*100);
            }
        }
        //if(color == 1) printf("\u25EF Enter move: ");
        //else printf("\u25C9 Enter move: ");
        if(color == 1) printf("X Enter move: ");
        else printf("O Enter move: ");

        char c;
        char *line = fgetl(stdin);
        int picked = 1;
        int dnum = sscanf(line, "%d", &picked);
        int cnum = sscanf(line, "%c", &c);
        if (strlen(line) == 0 || dnum) {
            --picked;
            if (picked < nind){
                int index = indexes[picked];
                row = index / 19;
                col = index % 19;
                if(row < 19){
                    move_go(board, 1, row, col);
                }
            }
        } else if (cnum){
            if (c <= 'T' && c >= 'A'){
                int num = sscanf(line, "%c %d", &c, &row);
                row = (inverted)?19 - row : row-1;
                col = c - 'A';
                if (col > 7 && noi) col -= 1;
                if (num == 2) move_go(board, 1, row, col);
            } else if (c == 'p') {
                // Pass
            } else if(c=='b' || c == 'w'){
                char g;
                int num = sscanf(line, "%c %c %d", &g, &c, &row);
                row = (inverted)?19 - row : row-1;
                col = c - 'A';
                if (col > 7 && noi) col -= 1;
                if (num == 3) {
                    int mc = (g == 'b') ? 1 : -1;
                    if (mc == color) {
                        board[row*19 + col] = 1;
                    } else {
                        board[19*19 + row*19 + col] = 1;
                    }
                }
            } else if(c == 'c'){
                char g;
                int num = sscanf(line, "%c %c %d", &g, &c, &row);
                row = (inverted)?19 - row : row-1;
                col = c - 'A';
                if (col > 7 && noi) col -= 1;
                if (num == 3) {
                    board[row*19 + col] = 0;
                    board[19*19 + row*19 + col] = 0;
                }
            }
        }
        free(line);
        flip_board(board);
        color = -color;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x39a70
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0x3a9b0
xorl %eax, %eax
movl %eax, %edi
callq 0x3290
movl %eax, %edi
callq 0x31e0
movl $0x43b, %edi            # imm = 0x43B
movl $0x4, %esi
callq 0x3220
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x59560
movl $0x16a, %edi            # imm = 0x16A
movl $0x4, %esi
callq 0x3220
movq %rax, -0x30(%rbp)
movl $0x1, -0x34(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl -0x14(%rbp), %ecx
callq 0x59610
movss %xmm0, -0x38(%rbp)
movss -0x38(%rbp), %xmm0
movss 0x14359(%rip), %xmm1    # 0x7100c
addss %xmm1, %xmm0
movss 0x1452d(%rip), %xmm1    # 0x711ec
mulss %xmm1, %xmm0
movss 0x14549(%rip), %xmm1    # 0x71214
mulss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x193eb(%rip), %rdi     # 0x760c5
movb $0x1, %al
callq 0x3130
movq %rsp, %rax
movq %rax, -0x40(%rbp)
movq %rsp, %rcx
addq $-0x30, %rcx
movq %rcx, -0x88(%rbp)
movq %rcx, %rsp
movq -0x30(%rbp), %rdi
movl $0x16a, %esi            # imm = 0x16A
movl $0xa, %edx
callq 0x4b70
movq -0x88(%rbp), %rcx
movq 0x262de(%rip), %rax     # 0x82ff8
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
movl -0x34(%rbp), %edx
callq 0x59360
movl $0x0, -0x18(%rbp)
cmpl $0xa, -0x18(%rbp)
jge 0x5ce60
movq -0x88(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl $0x13, %ecx
cltd
idivl %ecx
movl %eax, -0x44(%rbp)
movl -0x4c(%rbp), %eax
movl $0x13, %ecx
cltd
idivl %ecx
movl %edx, -0x48(%rbp)
cmpl $0x13, -0x44(%rbp)
jne 0x5cd9f
movl -0x18(%rbp), %esi
addl $0x1, %esi
movq -0x30(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movss 0x14491(%rip), %xmm0    # 0x71214
mulss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x19345(%rip), %rdi     # 0x760d8
movb $0x1, %al
callq 0x3130
jmp 0x5ce50
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
movl -0x48(%rbp), %eax
addl $0x41, %eax
movl %eax, -0x90(%rbp)
xorl %eax, %eax
cmpl $0x7, -0x48(%rbp)
movb %al, -0x89(%rbp)
jle 0x5cdd5
cmpl $0x0, 0x26aa8(%rip)     # 0x83874
setne %al
movb %al, -0x89(%rbp)
movl -0x90(%rbp), %eax
movb -0x89(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
shll $0x0, %ecx
addl %ecx, %eax
movl %eax, -0x98(%rbp)
cmpl $0x0, 0x26a77(%rip)     # 0x83870
je 0x5ce0b
movl $0x13, %eax
subl -0x44(%rbp), %eax
movl %eax, -0x9c(%rbp)
jmp 0x5ce17
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
movl -0x98(%rbp), %edx
movl -0x94(%rbp), %esi
movl -0x9c(%rbp), %ecx
movq -0x30(%rbp), %rax
movslq -0x4c(%rbp), %rdi
movss 0x143db(%rip), %xmm0    # 0x71214
mulss (%rax,%rdi,4), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x192a1(%rip), %rdi     # 0x760ea
movb $0x1, %al
callq 0x3130
jmp 0x5ce52
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x5cd30
cmpl $0x1, -0x34(%rbp)
jne 0x5ce76
leaq 0x19290(%rip), %rdi     # 0x760fd
movb $0x0, %al
callq 0x3130
jmp 0x5ce84
leaq 0x1928f(%rip), %rdi     # 0x7610c
movb $0x0, %al
callq 0x3130
movq 0x2614d(%rip), %rax     # 0x82fd8
movq (%rax), %rdi
callq 0x4140
movq %rax, -0x58(%rbp)
movl $0x1, -0x5c(%rbp)
movq -0x58(%rbp), %rdi
leaq 0x19610(%rip), %rsi     # 0x764b9
leaq -0x5c(%rbp), %rdx
movb $0x0, %al
callq 0x32f0
movl %eax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
leaq 0x174b0(%rip), %rsi     # 0x74372
leaq -0x4d(%rbp), %rdx
movb $0x0, %al
callq 0x32f0
movl %eax, -0x64(%rbp)
movq -0x58(%rbp), %rdi
callq 0x3110
cmpq $0x0, %rax
je 0x5cee5
cmpl $0x0, -0x60(%rbp)
je 0x5cf42
movl -0x5c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x5c(%rbp)
cmpl $0xa, -0x5c(%rbp)
jge 0x5cf3d
movq -0x88(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
movl $0x13, %ecx
cltd
idivl %ecx
movl %eax, -0x44(%rbp)
movl -0x68(%rbp), %eax
movl $0x13, %ecx
cltd
idivl %ecx
movl %edx, -0x48(%rbp)
cmpl $0x13, -0x44(%rbp)
jge 0x5cf3b
movq -0x28(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x48(%rbp), %ecx
movl $0x1, %esi
callq 0x598a0
jmp 0x5cf3d
jmp 0x5d1b3
cmpl $0x0, -0x64(%rbp)
je 0x5d1b1
movsbl -0x4d(%rbp), %eax
cmpl $0x54, %eax
jg 0x5cff2
movsbl -0x4d(%rbp), %eax
cmpl $0x41, %eax
jl 0x5cff2
movq -0x58(%rbp), %rdi
leaq 0x191ad(%rip), %rsi     # 0x7611e
leaq -0x4d(%rbp), %rdx
leaq -0x44(%rbp), %rcx
movb $0x0, %al
callq 0x32f0
movl %eax, -0x6c(%rbp)
cmpl $0x0, 0x268e6(%rip)     # 0x83870
je 0x5cf9c
movl $0x13, %eax
subl -0x44(%rbp), %eax
movl %eax, -0xa0(%rbp)
jmp 0x5cfa8
movl -0x44(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xa0(%rbp)
movl -0xa0(%rbp), %eax
movl %eax, -0x44(%rbp)
movsbl -0x4d(%rbp), %eax
subl $0x41, %eax
movl %eax, -0x48(%rbp)
cmpl $0x7, -0x48(%rbp)
jle 0x5cfd3
cmpl $0x0, 0x268ac(%rip)     # 0x83874
je 0x5cfd3
movl -0x48(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x48(%rbp)
cmpl $0x2, -0x6c(%rbp)
jne 0x5cfed
movq -0x28(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x48(%rbp), %ecx
movl $0x1, %esi
callq 0x598a0
jmp 0x5d1af
movsbl -0x4d(%rbp), %eax
cmpl $0x70, %eax
jne 0x5d000
jmp 0x5d1ad
movsbl -0x4d(%rbp), %eax
cmpl $0x62, %eax
je 0x5d016
movsbl -0x4d(%rbp), %eax
cmpl $0x77, %eax
jne 0x5d0f1
movq -0x58(%rbp), %rdi
leaq 0x190fa(%rip), %rsi     # 0x7611b
leaq -0x6d(%rbp), %rdx
leaq -0x4d(%rbp), %rcx
leaq -0x44(%rbp), %r8
movb $0x0, %al
callq 0x32f0
movl %eax, -0x74(%rbp)
cmpl $0x0, 0x26832(%rip)     # 0x83870
je 0x5d050
movl $0x13, %eax
subl -0x44(%rbp), %eax
movl %eax, -0xa4(%rbp)
jmp 0x5d05c
movl -0x44(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
movl %eax, -0x44(%rbp)
movsbl -0x4d(%rbp), %eax
subl $0x41, %eax
movl %eax, -0x48(%rbp)
cmpl $0x7, -0x48(%rbp)
jle 0x5d087
cmpl $0x0, 0x267f8(%rip)     # 0x83874
je 0x5d087
movl -0x48(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x48(%rbp)
cmpl $0x3, -0x74(%rbp)
jne 0x5d0ec
movsbl -0x6d(%rbp), %edx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0x1, %ecx
cmpl $0x62, %edx
cmovel %ecx, %eax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
cmpl -0x34(%rbp), %eax
jne 0x5d0c9
movq -0x28(%rbp), %rax
imull $0x13, -0x44(%rbp), %ecx
addl -0x48(%rbp), %ecx
movslq %ecx, %rcx
movss 0x13f4a(%rip), %xmm0    # 0x7100c
movss %xmm0, (%rax,%rcx,4)
jmp 0x5d0ea
movq -0x28(%rbp), %rax
imull $0x13, -0x44(%rbp), %ecx
addl $0x169, %ecx            # imm = 0x169
addl -0x48(%rbp), %ecx
movslq %ecx, %rcx
movss 0x13f27(%rip), %xmm0    # 0x7100c
movss %xmm0, (%rax,%rcx,4)
jmp 0x5d0ec
jmp 0x5d1ab
movsbl -0x4d(%rbp), %eax
cmpl $0x63, %eax
jne 0x5d1a9
movq -0x58(%rbp), %rdi
leaq 0x19012(%rip), %rsi     # 0x7611b
leaq -0x79(%rbp), %rdx
leaq -0x4d(%rbp), %rcx
leaq -0x44(%rbp), %r8
movb $0x0, %al
callq 0x32f0
movl %eax, -0x80(%rbp)
cmpl $0x0, 0x2674a(%rip)     # 0x83870
je 0x5d138
movl $0x13, %eax
subl -0x44(%rbp), %eax
movl %eax, -0xa8(%rbp)
jmp 0x5d144
movl -0x44(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xa8(%rbp)
movl -0xa8(%rbp), %eax
movl %eax, -0x44(%rbp)
movsbl -0x4d(%rbp), %eax
subl $0x41, %eax
movl %eax, -0x48(%rbp)
cmpl $0x7, -0x48(%rbp)
jle 0x5d16f
cmpl $0x0, 0x26710(%rip)     # 0x83874
je 0x5d16f
movl -0x48(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x48(%rbp)
cmpl $0x3, -0x80(%rbp)
jne 0x5d1a7
movq -0x28(%rbp), %rax
imull $0x13, -0x44(%rbp), %ecx
addl -0x48(%rbp), %ecx
movslq %ecx, %rcx
xorps %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
movq -0x28(%rbp), %rax
imull $0x13, -0x44(%rbp), %ecx
addl $0x169, %ecx            # imm = 0x169
addl -0x48(%rbp), %ecx
movslq %ecx, %rcx
xorps %xmm0, %xmm0
movss %xmm0, (%rax,%rcx,4)
jmp 0x5d1a9
jmp 0x5d1ab
jmp 0x5d1ad
jmp 0x5d1af
jmp 0x5d1b1
jmp 0x5d1b3
movq -0x58(%rbp), %rdi
callq 0x3030
movq -0x28(%rbp), %rdi
callq 0x59560
xorl %eax, %eax
subl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x40(%rbp), %rax
movq %rax, %rsp
jmp 0x5cc8d
nopl (%rax)