// File: /workspace/github_c_makefile_star2_O1/SimpleDoger[P]Darknet_CPU_Only/classifier.c
// Function: csv_classifier
void csv_classifier(char *datacfg, char *cfgfile, char *weightfile)
{
    int i,j;
    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 top = option_find_int(options, "top", 1);

    list *plist = get_paths(test_list);

    char **paths = (char **)list_to_array(plist);
    int m = plist->size;
    free_list(plist);
    int *indexes = calloc(top, sizeof(int));

    for(i = 0; i < m; ++i){
        double time = what_time_is_it_now();
        char *path = paths[i];
        image im = load_image_color(path, 0, 0);
        image r = letterbox_image(im, net->w, net->h);
        float *predictions = network_predict(net, r.data);
        if(net->hierarchy) hierarchy_predictions(predictions, net->outputs, net->hierarchy, 1, 1);
        top_k(predictions, net->outputs, top, indexes);

        printf("%s", path);
        for(j = 0; j < top; ++j){
            printf("\t%d", indexes[j]);
        }
        printf("\n");

        free_image(im);
        free_image(r);

        fprintf(stderr, "%lf seconds, %d images, %d total\n", what_time_is_it_now() - time, i+1, m);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %r14
movq %rsi, %rdi
movq %rdx, %rsi
xorl %edx, %edx
callq 0x2f9e4
movq %rax, 0x28(%rsp)
xorl %edi, %edi
callq 0x32d0
movl %eax, %edi
callq 0x3230
movq %r14, %rdi
callq 0x34b9c
movq %rax, %r14
leaq 0xda7a(%rip), %rsi      # 0x590fd
leaq 0xd578(%rip), %rdx      # 0x58c02
movq %rax, %rdi
callq 0x34d5b
movq %rax, %r15
leaq 0xd7d8(%rip), %rsi      # 0x58e74
movq %r14, %rdi
movl $0x1, %edx
callq 0x34d9f
movl %eax, %ebx
movq %r15, %rdi
callq 0x296f8
movq %rax, %r14
movq %rax, %rdi
callq 0x10fa0
movq %rax, 0x38(%rsp)
movslq (%r14), %r15
movq %r14, %rdi
callq 0x10f56
movl %ebx, 0x24(%rsp)
movslq %ebx, %rdi
movl $0x4, %esi
callq 0x3260
movq %r15, 0x30(%rsp)
testq %r15, %r15
jle 0x4b852
movq %rax, %r12
movl 0x24(%rsp), %ebx
leaq 0xd516(%rip), %r13      # 0x58c11
xorl %r14d, %r14d
xorl %eax, %eax
callq 0xdfdc
movsd %xmm0, 0x40(%rsp)
movq 0x38(%rsp), %rax
movq (%rax,%r14,8), %r15
leaq 0x48(%rsp), %rdi
movq %r15, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x160b6
movq 0x28(%rsp), %rbp
movl 0x90(%rbp), %edx
movl 0x94(%rbp), %esi
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x48(%rsp), %xmm0
movupd %xmm0, (%rsp)
leaq 0x60(%rsp), %rdi
callq 0x1905c
movq 0x70(%rsp), %rsi
movq %rbp, %rdi
callq 0x307ea
movq %rbp, %rcx
movq %rax, %rbp
movq 0xd0(%rcx), %rdx
testq %rdx, %rdx
je 0x4b792
movl 0x84(%rcx), %esi
movq %rbp, %rdi
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x3cc56
movq 0x28(%rsp), %rcx
movl 0x84(%rcx), %esi
movq %rbp, %rdi
movl 0x24(%rsp), %ebp
movl %ebp, %edx
movq %r12, %rcx
callq 0xe8e2
leaq 0xb1cb(%rip), %rdi      # 0x5697b
movq %r15, %rsi
xorl %eax, %eax
callq 0x3170
testl %ebp, %ebp
jle 0x4b7d7
xorl %r15d, %r15d
movl (%r12,%r15,4), %esi
movq %r13, %rdi
xorl %eax, %eax
callq 0x3170
incq %r15
cmpq %r15, %rbx
jne 0x4b7c1
movl $0xa, %edi
callq 0x3060
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x15b37
movq 0x70(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x60(%rsp), %xmm0
movupd %xmm0, (%rsp)
callq 0x15b37
movq 0x1e7de(%rip), %rax     # 0x69ff8
movq (%rax), %r15
xorl %eax, %eax
callq 0xdfdc
subsd 0x40(%rsp), %xmm0
incq %r14
movq %r15, %rdi
leaq 0xd3de(%rip), %rsi      # 0x58c15
movl %r14d, %edx
movq 0x30(%rsp), %r15
movl %r15d, %ecx
movb $0x1, %al
callq 0x3280
cmpq %r15, %r14
jne 0x4b6fe
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq