// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/classifier.c
// Function: validate_classifier_full
void validate_classifier_full(char *datacfg, char *filename, char *weightfile)
{
    int i, j;
    network *net = load_network(filename, weightfile, 0);
    set_batch_network(net, 1);
    srand(time(0));

    list *options = read_data_cfg(datacfg);

    char *label_list = option_find_str(options, "labels", "data/labels.list");
    char *valid_list = option_find_str(options, "valid", "data/train.list");
    int classes = option_find_int(options, "classes", 2);
    int topk = option_find_int(options, "top", 1);

    char **labels = get_labels(label_list);
    list *plist = get_paths(valid_list);

    char **paths = (char **)list_to_array(plist);
    int m = plist->size;
    free_list(plist);

    float avg_acc = 0;
    float avg_topk = 0;
    int *indexes = calloc(topk, sizeof(int));

    int size = net->w;
    for(i = 0; i < m; ++i){
        int class = -1;
        char *path = paths[i];
        for(j = 0; j < classes; ++j){
            if(strstr(path, labels[j])){
                class = j;
                break;
            }
        }
        image im = load_image_color(paths[i], 0, 0);
        image resized = resize_min(im, size);
        resize_network(net, resized.w, resized.h);
        //show_image(im, "orig");
        //show_image(crop, "cropped");
        //cvWaitKey(0);
        float *pred = network_predict(net, resized.data);
        if(net->hierarchy) hierarchy_predictions(pred, net->outputs, net->hierarchy, 1, 1);

        free_image(im);
        free_image(resized);
        top_k(pred, classes, topk, indexes);

        if(indexes[0] == class) avg_acc += 1;
        for(j = 0; j < topk; ++j){
            if(indexes[j] == class) avg_topk += 1;
        }

        printf("%d: top 1: %f, top %d: %f\n", i, avg_acc/(i+1), topk, avg_topk/(i+1));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x39a70
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movl $0x1, %esi
callq 0x3a9b0
xorl %eax, %eax
movl %eax, %edi
callq 0x3290
movl %eax, %edi
callq 0x31e0
movq -0x8(%rbp), %rdi
callq 0x426b0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x11396(%rip), %rsi     # 0x74346
leaq 0x13439(%rip), %rdx     # 0x763f0
callq 0x42920
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x109a8(%rip), %rsi     # 0x73973
leaq 0x133e6(%rip), %rdx     # 0x763b8
callq 0x42920
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x11a71(%rip), %rsi     # 0x74a57
movl $0x2, %edx
callq 0x42990
movl %eax, -0x44(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x13712(%rip), %rsi     # 0x76710
movl $0x1, %edx
callq 0x42990
movl %eax, -0x48(%rbp)
movq -0x38(%rbp), %rdi
callq 0x343c0
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rdi
callq 0x31450
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0x9020
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x58(%rbp), %rdi
callq 0x8fb0
xorps %xmm0, %xmm0
movss %xmm0, -0x68(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x6c(%rbp)
movslq -0x48(%rbp), %rdi
movl $0x4, %esi
callq 0x3220
movq %rax, -0x78(%rbp)
movq -0x28(%rbp), %rax
movl 0x94(%rax), %eax
movl %eax, -0x7c(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x64(%rbp), %eax
jge 0x6329c
movl $0xffffffff, -0x80(%rbp) # imm = 0xFFFFFFFF
movq -0x60(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x88(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x630e2
movq -0x88(%rbp), %rdi
movq -0x50(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x3480
cmpq $0x0, %rax
je 0x630d5
movl -0x20(%rbp), %eax
movl %eax, -0x80(%rbp)
jmp 0x630e2
jmp 0x630d7
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x630a7
movq -0x60(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0xa0(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0xf510
movl -0x7c(%rbp), %esi
leaq -0xb8(%rbp), %rdi
leaq -0xa0(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x12eb0
movq -0x28(%rbp), %rdi
movl -0xb8(%rbp), %esi
movl -0xb4(%rbp), %edx
callq 0x3aa00
movq -0x28(%rbp), %rdi
movq -0xa8(%rbp), %rsi
callq 0x3b160
movq %rax, -0xc0(%rbp)
movq -0x28(%rbp), %rax
cmpq $0x0, 0xd0(%rax)
je 0x63191
movq -0xc0(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x84(%rax), %esi
movq -0x28(%rbp), %rax
movq 0xd0(%rax), %rdx
movl $0x1, %r8d
movl %r8d, %ecx
callq 0x4efb0
leaq -0xa0(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xedb0
leaq -0xb8(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xedb0
movq -0xc0(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x48(%rbp), %edx
movq -0x78(%rbp), %rcx
callq 0x4b70
movq -0x78(%rbp), %rax
movl (%rax), %eax
cmpl -0x80(%rbp), %eax
jne 0x6320e
movss 0xde08(%rip), %xmm0     # 0x7100c
addss -0x68(%rbp), %xmm0
movss %xmm0, -0x68(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0x6324c
movq -0x78(%rbp), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x80(%rbp), %eax
jne 0x6323f
movss 0xddd7(%rip), %xmm0     # 0x7100c
addss -0x6c(%rbp), %xmm0
movss %xmm0, -0x6c(%rbp)
jmp 0x63241
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x63215
movl -0x1c(%rbp), %esi
movss -0x68(%rbp), %xmm0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
cvtsi2ss %eax, %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movl -0x48(%rbp), %edx
movss -0x6c(%rbp), %xmm1
movl -0x1c(%rbp), %eax
addl $0x1, %eax
cvtsi2ss %eax, %xmm2
divss %xmm2, %xmm1
cvtss2sd %xmm1, %xmm1
leaq 0x131d9(%rip), %rdi     # 0x76460
movb $0x2, %al
callq 0x3130
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6307a
addq $0xe0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)