// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/classifier.c
// Function: test_classifier
void test_classifier(char *datacfg, char *cfgfile, char *weightfile, int target_layer)
{
    int curr = 0;
    network *net = load_network(cfgfile, weightfile, 0);
    srand(time(0));

    list *options = read_data_cfg(datacfg);

    char *test_list = option_find_str(options, "test", "data/test.list");
    int classes = option_find_int(options, "classes", 2);

    list *plist = get_paths(test_list);

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

    clock_t time;

    data val, buffer;

    load_args args = {0};
    args.w = net->w;
    args.h = net->h;
    args.paths = paths;
    args.classes = classes;
    args.n = net->batch;
    args.m = 0;
    args.labels = 0;
    args.d = &buffer;
    args.type = OLD_CLASSIFICATION_DATA;

    pthread_t load_thread = load_data_in_thread(args);
    for(curr = net->batch; curr < m; curr += net->batch){
        time=clock();

        pthread_join(load_thread, 0);
        val = buffer;

        if(curr < m){
            args.paths = paths + curr;
            if (curr + net->batch > m) args.n = m - curr;
            load_thread = load_data_in_thread(args);
        }
        fprintf(stderr, "Loaded: %d images in %lf seconds\n", val.X.rows, sec(clock()-time));

        time=clock();
        matrix pred = network_predict_data(net, val);

        int i, j;
        if (target_layer >= 0){
            //layer l = net->layers[target_layer];
        }

        for(i = 0; i < pred.rows; ++i){
            printf("%s", paths[curr-net->batch+i]);
            for(j = 0; j < pred.cols; ++j){
                printf("\t%g", pred.vals[i][j]);
            }
            printf("\n");
        }

        free_matrix(pred);

        fprintf(stderr, "%lf seconds, %d images, %d total\n", sec(clock()-time), val.X.rows, curr);
        free_data(val);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x270, %rsp            # imm = 0x270
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl $0x0, -0x20(%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 0x120ed(%rip), %rsi     # 0x76999
leaq 0x11bf6(%rip), %rdx     # 0x764a9
callq 0x42920
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x10190(%rip), %rsi     # 0x74a57
movl $0x2, %edx
callq 0x42990
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rdi
callq 0x31450
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x9020
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x48(%rbp), %rdi
callq 0x8fb0
leaq -0x188(%rbp), %rdi
xorl %esi, %esi
movl $0xa8, %edx
callq 0x3190
movq -0x28(%rbp), %rax
movl 0x94(%rax), %eax
movl %eax, -0x15c(%rbp)
movq -0x28(%rbp), %rax
movl 0x90(%rax), %eax
movl %eax, -0x160(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x180(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x138(%rbp)
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x170(%rbp)
movl $0x0, -0x16c(%rbp)
movq $0x0, -0x168(%rbp)
leaq -0xe0(%rbp), %rax
movq %rax, -0x108(%rbp)
movl $0x9, -0xf0(%rbp)
movq %rsp, %rdi
movl $0x15, %ecx
leaq -0x188(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x37500
movq %rax, -0x190(%rbp)
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x64c30
callq 0x30f0
movq %rax, -0x60(%rbp)
movq -0x190(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3440
leaq -0xa0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
movl $0x40, %edx
callq 0x3280
movl -0x20(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x64a3d
movq -0x50(%rbp), %rax
movslq -0x20(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x180(%rbp)
movl -0x20(%rbp), %eax
movq -0x28(%rbp), %rcx
addl 0x4(%rcx), %eax
cmpl -0x54(%rbp), %eax
jle 0x64a1f
movl -0x54(%rbp), %eax
subl -0x20(%rbp), %eax
movl %eax, -0x170(%rbp)
movq %rsp, %rdi
movl $0x15, %ecx
leaq -0x188(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x37500
movq %rax, -0x190(%rbp)
movq 0x1e5b4(%rip), %rax     # 0x82ff8
movq (%rax), %rax
movq %rax, -0x1b8(%rbp)
movl -0x98(%rbp), %eax
movl %eax, -0x1ac(%rbp)
callq 0x30f0
movq %rax, %rdi
subq -0x60(%rbp), %rdi
callq 0x4b50
movq -0x1b8(%rbp), %rdi
movl -0x1ac(%rbp), %edx
cvtss2sd %xmm0, %xmm0
leaq 0x11988(%rip), %rsi     # 0x7640b
movb $0x1, %al
callq 0x3240
callq 0x30f0
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rdi
movups -0xa0(%rbp), %xmm0
movups -0x90(%rbp), %xmm1
movups -0x80(%rbp), %xmm2
movups -0x70(%rbp), %xmm3
movq %rsp, %rax
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x3b9e0
movq %rax, -0x1a0(%rbp)
movq %rdx, -0x198(%rbp)
cmpl $0x0, -0x1c(%rbp)
jl 0x64ada
jmp 0x64ada
movl $0x0, -0x1a4(%rbp)
movl -0x1a4(%rbp), %eax
cmpl -0x1a0(%rbp), %eax
jge 0x64b9a
movq -0x50(%rbp), %rax
movl -0x20(%rbp), %ecx
movq -0x28(%rbp), %rdx
subl 0x4(%rdx), %ecx
addl -0x1a4(%rbp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
leaq 0xf853(%rip), %rdi      # 0x7436b
movb $0x0, %al
callq 0x3130
movl $0x0, -0x1a8(%rbp)
movl -0x1a8(%rbp), %eax
cmpl -0x19c(%rbp), %eax
jge 0x64b78
movq -0x198(%rbp), %rax
movslq -0x1a4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1a8(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x1197e(%rip), %rdi     # 0x764de
movb $0x1, %al
callq 0x3130
movl -0x1a8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1a8(%rbp)
jmp 0x64b29
leaq 0x1122f(%rip), %rdi     # 0x75dae
movb $0x0, %al
callq 0x3130
movl -0x1a4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1a4(%rbp)
jmp 0x64ae4
movq -0x1a0(%rbp), %rdi
movq -0x198(%rbp), %rsi
callq 0x39030
movq 0x1e444(%rip), %rax     # 0x82ff8
movq (%rax), %rax
movq %rax, -0x1c0(%rbp)
callq 0x30f0
movq %rax, %rdi
subq -0x60(%rbp), %rdi
callq 0x4b50
movq -0x1c0(%rbp), %rdi
cvtss2sd %xmm0, %xmm0
movl -0x98(%rbp), %edx
movl -0x20(%rbp), %ecx
leaq 0x118d2(%rip), %rsi     # 0x764bc
movb $0x1, %al
callq 0x3240
movups -0xa0(%rbp), %xmm0
movups -0x90(%rbp), %xmm1
movups -0x80(%rbp), %xmm2
movups -0x70(%rbp), %xmm3
movq %rsp, %rax
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x34400
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
jmp 0x649a9
addq $0x270, %rsp            # imm = 0x270
popq %rbp
retq
nopl (%rax)