// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x2a0, %rsp            # imm = 0x2A0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x39a70
movq %rax, -0x28(%rbp)
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 0x1200d(%rip), %rsi     # 0x74346
leaq 0x140b0(%rip), %rdx     # 0x763f0
callq 0x42920
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x1161f(%rip), %rsi     # 0x73973
leaq 0x1405d(%rip), %rdx     # 0x763b8
callq 0x42920
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x126e8(%rip), %rsi     # 0x74a57
movl $0x2, %edx
callq 0x42990
movl %eax, -0x44(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x14389(%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, -0x74(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x78(%rbp)
movl -0x64(%rbp), %eax
movl $0x3e8, %ecx            # imm = 0x3E8
cltd
idivl %ecx
movl %eax, -0x7c(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
imull -0x64(%rbp), %eax
cltd
idivl -0x7c(%rbp)
movl %eax, -0x1c4(%rbp)
movl -0x1c(%rbp), %eax
imull -0x64(%rbp), %eax
cltd
idivl -0x7c(%rbp)
movl %eax, %ecx
movl -0x1c4(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x80(%rbp)
leaq -0x1a8(%rbp), %rdi
xorl %esi, %esi
movl $0xa8, %edx
callq 0x3190
movq -0x28(%rbp), %rax
movl 0x94(%rax), %eax
movl %eax, -0x17c(%rbp)
movq -0x28(%rbp), %rax
movl 0x90(%rax), %eax
movl %eax, -0x180(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x158(%rbp)
movl -0x80(%rbp), %eax
movl %eax, -0x190(%rbp)
movl $0x0, -0x18c(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x188(%rbp)
leaq -0x100(%rbp), %rax
movq %rax, -0x128(%rbp)
movl $0x9, -0x110(%rbp)
movq %rsp, %rdi
movl $0x15, %ecx
leaq -0x1a8(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x37500
movq %rax, -0x1b0(%rbp)
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jg 0x626ff
callq 0x30f0
movq %rax, -0x70(%rbp)
movq -0x1b0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3440
leaq -0xc0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
movl $0x40, %edx
callq 0x3280
movl -0x1c(%rbp), %eax
addl $0x1, %eax
imull -0x64(%rbp), %eax
cltd
idivl -0x7c(%rbp)
movl %eax, -0x1d4(%rbp)
movl -0x1c(%rbp), %eax
imull -0x64(%rbp), %eax
cltd
idivl -0x7c(%rbp)
movl %eax, %ecx
movl -0x1d4(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x80(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movl -0x1c(%rbp), %eax
imull -0x64(%rbp), %eax
cltd
idivl -0x7c(%rbp)
movl %eax, %ecx
movq -0x1d0(%rbp), %rax
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x1b8(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x7c(%rbp), %eax
je 0x62586
movq -0x1b8(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq %rsp, %rdi
movl $0x15, %ecx
leaq -0x1a8(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x37500
movq %rax, -0x1b0(%rbp)
movl -0xb8(%rbp), %eax
movl %eax, -0x1f4(%rbp)
callq 0x30f0
movq %rax, %rdi
subq -0x70(%rbp), %rdi
callq 0x4b50
movl -0x1f4(%rbp), %esi
cvtss2sd %xmm0, %xmm0
leaq 0x13e57(%rip), %rdi     # 0x7640b
movb $0x1, %al
callq 0x3130
callq 0x30f0
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rdi
movl -0x48(%rbp), %esi
movups -0xc0(%rbp), %xmm0
movups -0xb0(%rbp), %xmm1
movups -0xa0(%rbp), %xmm2
movups -0x90(%rbp), %xmm3
movq %rsp, %rax
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x3bf60
movq %rax, -0x1c0(%rbp)
movq -0x1c0(%rbp), %rax
movss (%rax), %xmm0
addss -0x74(%rbp), %xmm0
movss %xmm0, -0x74(%rbp)
movq -0x1c0(%rbp), %rax
movss 0x4(%rax), %xmm0
addss -0x78(%rbp), %xmm0
movss %xmm0, -0x78(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x1f0(%rbp)
movss -0x74(%rbp), %xmm0
cvtsi2ssl -0x1c(%rbp), %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x1e0(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x1ec(%rbp)
movss -0x78(%rbp), %xmm0
cvtsi2ssl -0x1c(%rbp), %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x1e8(%rbp)
callq 0x30f0
movq %rax, %rdi
subq -0x70(%rbp), %rdi
callq 0x4b50
movl -0x1f0(%rbp), %esi
movl -0x1ec(%rbp), %edx
movsd -0x1e8(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x1e0(%rbp), %xmm0
cvtss2sd %xmm2, %xmm2
movl -0xb8(%rbp), %ecx
leaq 0x13d76(%rip), %rdi     # 0x7642d
movb $0x3, %al
callq 0x3130
movups -0xc0(%rbp), %xmm0
movups -0xb0(%rbp), %xmm1
movups -0xa0(%rbp), %xmm2
movups -0x90(%rbp), %xmm3
movq %rsp, %rax
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x34400
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x624b9
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbp
retq
nopl (%rax,%rax)