// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/go.c
// Function: valid_go
void valid_go(char *cfgfile, char *weightfile, int multi, char *filename)
{
    srand(time(0));
    char *base = basecfg(cfgfile);
    printf("%s\n", base);
    network *net = load_network(cfgfile, weightfile, 0);
    set_batch_network(net, 1);
    printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net->learning_rate, net->momentum, net->decay);

    float *board = calloc(19*19*3, sizeof(float));
    float *move = calloc(19*19+2, sizeof(float));
    // moves m = load_go_moves("/home/pjreddie/backup/go.test");
    moves m = load_go_moves(filename);

    int N = m.n;
    int i,j;
    int correct = 0;
    for (i = 0; i <N; ++i) {
        char *b = m.data[i];
        int player = b[0] - '0';
        //int result = b[1] - '0';
        int row = b[2];
        int col = b[3];
        int truth = col + 19*row;
        string_to_board(b+4, board);
        if(player > 0) for(j = 0; j < 19*19; ++j) board[19*19*2 + j] = 1;
        predict_move2(net, board, move, multi);
        int index = max_index(move, 19*19+1);
        if(index == truth) ++correct;
        printf("%d Accuracy %f\n", i, (float) correct/(i+1));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x3290
movl %eax, %edi
callq 0x31e0
movq -0x8(%rbp), %rdi
callq 0x4850
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rsi
leaq 0x1904b(%rip), %rdi     # 0x7439d
movb $0x0, %al
callq 0x3130
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x39a70
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0x3a9b0
movq -0x30(%rbp), %rax
movss 0x34(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x30(%rbp), %rax
movss 0x38(%rax), %xmm1
cvtss2sd %xmm1, %xmm1
movq -0x30(%rbp), %rax
movss 0x3c(%rax), %xmm2
cvtss2sd %xmm2, %xmm2
leaq 0x1a3c0(%rip), %rdi     # 0x75768
movb $0x3, %al
callq 0x3130
movl $0x43b, %edi            # imm = 0x43B
movl $0x4, %esi
callq 0x3220
movq %rax, -0x38(%rbp)
movl $0x16b, %edi            # imm = 0x16B
movl $0x4, %esi
callq 0x3220
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
callq 0x58730
movq %rax, -0x50(%rbp)
movl %edx, -0x48(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x54(%rbp)
movl $0x0, -0x60(%rbp)
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x5b501
movq -0x50(%rbp), %rax
movslq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x6c(%rbp)
movq -0x68(%rbp), %rax
movsbl 0x2(%rax), %eax
movl %eax, -0x70(%rbp)
movq -0x68(%rbp), %rax
movsbl 0x3(%rax), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
imull $0x13, -0x70(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x78(%rbp)
movq -0x68(%rbp), %rdi
addq $0x4, %rdi
movq -0x38(%rbp), %rsi
callq 0x58810
cmpl $0x0, -0x6c(%rbp)
jle 0x5b495
movl $0x0, -0x5c(%rbp)
cmpl $0x169, -0x5c(%rbp)     # imm = 0x169
jge 0x5b493
movq -0x38(%rbp), %rax
movl -0x5c(%rbp), %ecx
addl $0x2d2, %ecx            # imm = 0x2D2
movslq %ecx, %rcx
movss 0x15b89(%rip), %xmm0    # 0x7100c
movss %xmm0, (%rax,%rcx,4)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x5b462
jmp 0x5b495
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movl -0x14(%rbp), %ecx
callq 0x59610
movq -0x40(%rbp), %rdi
movl $0x16a, %esi            # imm = 0x16A
callq 0x5c30
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x78(%rbp), %eax
jne 0x5b4cb
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
movl -0x58(%rbp), %esi
cvtsi2ssl -0x60(%rbp), %xmm0
movl -0x58(%rbp), %eax
addl $0x1, %eax
cvtsi2ss %eax, %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1a7fe(%rip), %rdi     # 0x75cea
movb $0x1, %al
callq 0x3130
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x5b3f9
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)