// File: /workspace/github_c_makefile_star2_O2/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, %rbx
xorl %r15d, %r15d
movq %rsi, %rdi
movq %rdx, %rsi
xorl %edx, %edx
callq 0x22658
movq %rax, 0x28(%rsp)
xorl %edi, %edi
callq 0x32c0
movl %eax, %edi
callq 0x3220
movq %rbx, %rdi
callq 0x29598
movq %rax, %rbx
leaq 0xfc30(%rip), %rsi      # 0x52115
leaq 0xf747(%rip), %rdx      # 0x51c33
movq %rax, %rdi
callq 0x29737
movq %rax, %r14
leaq 0xf98e(%rip), %rsi      # 0x51e8c
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x2977d
movl %eax, %ebp
movq %r14, %rdi
callq 0x1c8c8
movq %rax, %rbx
movq %rax, %rdi
callq 0x72f5
movq %rax, 0x38(%rsp)
movl (%rbx), %r14d
movq %rbx, %rdi
callq 0x72c6
movl %ebp, 0x24(%rsp)
movslq %ebp, %r13
pushq $0x4
popq %rsi
movq %r13, %rdi
callq 0x3250
movq %rax, %rbp
testl %r13d, %r13d
cmovlel %r15d, %r13d
testl %r14d, %r14d
movl $0x0, %eax
movl %r14d, 0x20(%rsp)
cmovgl %r14d, %eax
leaq 0xf6e0(%rip), %r15      # 0x51c42
xorl %r14d, %r14d
movq %rax, 0x30(%rsp)
cmpq %rax, %r14
je 0x426b8
xorl %eax, %eax
callq 0x3bc0
movsd %xmm0, 0x40(%rsp)
movq 0x38(%rsp), %rax
movq (%rax,%r14,8), %r12
leaq 0x48(%rsp), %rdi
movq %r12, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xbf36
movq 0x28(%rsp), %rbx
movl 0x90(%rbx), %edx
movl 0x94(%rbx), %esi
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x48(%rsp), %xmm0
movupd %xmm0, (%rsp)
leaq 0x60(%rsp), %rdi
callq 0xe7d0
movq 0x70(%rsp), %rsi
movq %rbx, %rdi
callq 0x233e2
movq %rbx, %rcx
movq %rax, %rbx
movq 0xd0(%rcx), %rdx
testq %rdx, %rdx
je 0x42602
movl 0x84(%rcx), %esi
movq %rbx, %rdi
pushq $0x1
popq %rcx
movl %ecx, %r8d
callq 0x324ad
movq 0x28(%rsp), %rcx
movl 0x84(%rcx), %esi
movq %rbx, %rdi
movl 0x24(%rsp), %edx
movq %rbp, %rcx
callq 0x438a
leaq 0xd3ad(%rip), %rdi      # 0x4f9cb
movq %r12, %rsi
xorl %eax, %eax
callq 0x3160
xorl %ebx, %ebx
cmpq %rbx, %r13
je 0x42642
movl (%rbp,%rbx,4), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x3160
incq %rbx
jmp 0x4262a
pushq $0xa
popq %rdi
callq 0x3060
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xba88
movq 0x70(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x60(%rsp), %xmm0
movupd %xmm0, (%rsp)
callq 0xba88
movq 0x21975(%rip), %rax     # 0x63ff8
movq (%rax), %rbx
xorl %eax, %eax
callq 0x3bc0
subsd 0x40(%rsp), %xmm0
incq %r14
movq %rbx, %rdi
leaq 0xf5a6(%rip), %rsi      # 0x51c46
movl %r14d, %edx
movl 0x20(%rsp), %ecx
movb $0x1, %al
callq 0x3270
movq 0x30(%rsp), %rax
jmp 0x4256a
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq