// File: /workspace/github_c_makefile_star2_O1/SimpleDoger[P]Darknet_CPU_Only/classifier.c
// Function: validate_classifier_crop
void validate_classifier_crop(char *datacfg, char *filename, char *weightfile)
{
    int i = 0;
    network *net = load_network(filename, weightfile, 0);
    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);

    clock_t time;
    float avg_acc = 0;
    float avg_topk = 0;
    int splits = m/1000;
    int num = (i+1)*m/splits - i*m/splits;

    data val, buffer;

    load_args args = {0};
    args.w = net->w;
    args.h = net->h;

    args.paths = paths;
    args.classes = classes;
    args.n = num;
    args.m = 0;
    args.labels = labels;
    args.d = &buffer;
    args.type = OLD_CLASSIFICATION_DATA;

    pthread_t load_thread = load_data_in_thread(args);
    for(i = 1; i <= splits; ++i){
        time=clock();

        pthread_join(load_thread, 0);
        val = buffer;

        num = (i+1)*m/splits - i*m/splits;
        char **part = paths+(i*m/splits);
        if(i != splits){
            args.paths = part;
            load_thread = load_data_in_thread(args);
        }
        printf("Loaded: %d images in %lf seconds\n", val.X.rows, sec(clock()-time));

        time=clock();
        float *acc = network_accuracies(net, val, topk);
        avg_acc += acc[0];
        avg_topk += acc[1];
        printf("%d: top 1: %f, top %d: %f, %lf seconds, %d images\n", i, avg_acc/i, topk, avg_topk/i, sec(clock()-time), val.X.rows);
        free_data(val);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdi, %rbx
movq %rsi, %rdi
movq %rdx, %rsi
xorl %edx, %edx
callq 0x2f9e4
movq %rax, %rbp
xorl %edi, %edi
callq 0x32d0
movl %eax, %edi
callq 0x3230
movq %rbx, %rdi
callq 0x34b9c
movq %rax, %rbx
leaq 0xcf45(%rip), %rsi      # 0x56956
leaq 0xf13b(%rip), %rdx      # 0x58b53
movq %rax, %rdi
callq 0x34d5b
movq %rax, %r15
leaq 0xc562(%rip), %rsi      # 0x55f8c
leaq 0xf0ef(%rip), %rdx      # 0x58b20
movq %rbx, %rdi
callq 0x34d5b
movq %rax, %r13
leaq 0xd758(%rip), %rsi      # 0x5719b
movq %rbx, %rdi
movl $0x2, %edx
callq 0x34d9f
movl %eax, 0xb4(%rsp)
leaq 0xf416(%rip), %rsi      # 0x58e74
movl $0x1, %r12d
movq %rbx, %rdi
movl $0x1, %edx
callq 0x34d9f
movl %eax, 0xc4(%rsp)
movq %r15, %rdi
callq 0x2b6d3
movq %rax, 0xb8(%rsp)
movq %r13, %rdi
callq 0x296f8
movq %rax, %r13
movq %rax, %rdi
callq 0x10fa0
movq %rax, %r15
movslq (%r13), %rbx
movq %r13, %rdi
callq 0x10f56
imulq $0x10624dd3, %rbx, %rcx # imm = 0x10624DD3
movq %rcx, %rax
shrq $0x3f, %rax
sarq $0x26, %rcx
addl %eax, %ecx
movl %ebx, %eax
cltd
movq %rcx, 0xc8(%rsp)
idivl %ecx
movl %eax, %r13d
leaq 0x180(%rsp), %r14
movl $0xa8, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x31d0
movl 0x94(%rbp), %eax
movl %eax, 0x2c(%r14)
movq %rbp, 0xe8(%rsp)
movl 0x90(%rbp), %eax
movl %eax, 0x28(%r14)
movq %r15, 0xe0(%rsp)
movq %r15, 0x8(%r14)
movl 0xb4(%rsp), %eax
movl %eax, 0x50(%r14)
movl %r13d, 0x18(%r14)
movl $0x0, 0x1c(%r14)
movq 0xb8(%rsp), %rax
movq %rax, 0x20(%r14)
leaq 0x140(%rsp), %rax
movq %rax, 0x80(%r14)
movl $0x9, 0x98(%r14)
movl $0x15, %ecx
movq %rsp, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x2dc84
movq %rax, 0xd8(%rsp)
movq %rbx, 0xd0(%rsp)
cmpq $0x3e8, %rbx            # imm = 0x3E8
jl 0x49db9
movq 0xc8(%rsp), %rbp
negl %ebp
xorps %xmm0, %xmm0
movss %xmm0, 0xb4(%rsp)
movq 0xd0(%rsp), %rax
movl %eax, %r14d
movss %xmm0, 0xb8(%rsp)
callq 0x3130
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
xorl %esi, %esi
callq 0x3480
movups 0x140(%rsp), %xmm0
movups 0x150(%rsp), %xmm1
movups 0x160(%rsp), %xmm2
movups 0x170(%rsp), %xmm3
movaps %xmm0, 0x100(%rsp)
movaps %xmm1, 0x110(%rsp)
movaps %xmm2, 0x120(%rsp)
movaps %xmm3, 0x130(%rsp)
movl %ebp, %eax
addl %r12d, %eax
je 0x49c42
movl %r14d, %eax
xorl %edx, %edx
divl 0xc8(%rsp)
movq 0xe0(%rsp), %rcx
leaq (%rcx,%rax,8), %rax
movq %rax, 0x188(%rsp)
movl $0x15, %ecx
movq %rsp, %rdi
leaq 0x180(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x2dc84
movq %rax, 0xd8(%rsp)
leal 0x1(%r12), %r13d
movl 0x108(%rsp), %r15d
callq 0x3130
subq %rbx, %rax
movq %rax, %rdi
callq 0xe8d4
cvtss2sd %xmm0, %xmm0
leaq 0xeefa(%rip), %rdi      # 0x58b64
movl %r15d, %esi
movb $0x1, %al
callq 0x3170
callq 0x3130
movq %rax, %rbx
movaps 0x100(%rsp), %xmm0
movaps 0x110(%rsp), %xmm1
movaps 0x120(%rsp), %xmm2
movaps 0x130(%rsp), %xmm3
movups %xmm3, 0x30(%rsp)
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq 0xe8(%rsp), %rdi
movl 0xc4(%rsp), %r15d
movl %r15d, %esi
callq 0x3139e
movss 0xb4(%rsp), %xmm1
addss (%rax), %xmm1
xorps %xmm0, %xmm0
cvtsi2ss %r12d, %xmm0
movss 0xb8(%rsp), %xmm2
addss 0x4(%rax), %xmm2
movss %xmm1, 0xb4(%rsp)
divss %xmm0, %xmm1
cvtss2sd %xmm1, %xmm1
movsd %xmm1, 0xf8(%rsp)
movss %xmm2, 0xb8(%rsp)
movaps %xmm2, %xmm1
divss %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movsd %xmm0, 0xf0(%rsp)
callq 0x3130
subq %rbx, %rax
movq %rax, %rdi
callq 0xe8d4
xorps %xmm2, %xmm2
cvtss2sd %xmm0, %xmm2
movl 0x108(%rsp), %ecx
leaq 0xee3d(%rip), %rdi      # 0x58b86
movl %r12d, %esi
movsd 0xf8(%rsp), %xmm0
movl %r15d, %edx
movsd 0xf0(%rsp), %xmm1
movb $0x3, %al
callq 0x3170
movaps 0x100(%rsp), %xmm0
movaps 0x110(%rsp), %xmm1
movaps 0x120(%rsp), %xmm2
movaps 0x130(%rsp), %xmm3
movups %xmm3, 0x30(%rsp)
movups %xmm2, 0x20(%rsp)
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x2b6fd
leal (%rbp,%r13), %eax
addl 0xd0(%rsp), %r14d
movl %r13d, %r12d
cmpl $0x1, %eax
jne 0x49ba4
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq