// File: /workspace/github_c_makefile_star2_O3/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 0x316bc
movq %rax, 0x28(%rsp)
xorl %edi, %edi
callq 0x32c0
movl %eax, %edi
callq 0x3220
movq %r14, %rdi
callq 0x36cb4
movq %rax, %r14
leaq 0xd8fd(%rip), %rsi      # 0x5b255
leaq 0xd414(%rip), %rdx      # 0x5ad73
movq %rax, %rdi
callq 0x36e77
movq %rax, %r15
leaq 0xd65b(%rip), %rsi      # 0x5afcc
movq %r14, %rdi
movl $0x1, %edx
callq 0x36eed
movl %eax, %ebx
movq %r15, %rdi
callq 0x2af38
movq %rax, %r14
movq %rax, %rdi
callq 0x11928
movq %rax, 0x38(%rsp)
movslq (%r14), %r15
movq %r14, %rdi
callq 0x118de
movl %ebx, 0x24(%rsp)
movslq %ebx, %rdi
movl $0x4, %esi
callq 0x3250
movq %r15, 0x30(%rsp)
testq %r15, %r15
jle 0x4db27
movq %rax, %r12
movl 0x24(%rsp), %ebx
leaq 0xd3b2(%rip), %r13      # 0x5ad82
xorl %r14d, %r14d
xorl %eax, %eax
callq 0xe79c
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 0x16ac9
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 0x19916
movq 0x70(%rsp), %rsi
movq %rbp, %rdi
callq 0x32690
movq %rbp, %rcx
movq %rax, %rbp
movq 0xd0(%rcx), %rdx
testq %rdx, %rdx
je 0x4da67
movl 0x84(%rcx), %esi
movq %rbp, %rdi
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x3eeda
movq 0x28(%rsp), %rcx
movl 0x84(%rcx), %esi
movq %rbp, %rdi
movl 0x24(%rsp), %ebp
movl %ebp, %edx
movq %r12, %rcx
callq 0xf0cd
leaq 0xaff6(%rip), %rdi      # 0x58a7b
movq %r15, %rsi
xorl %eax, %eax
callq 0x3160
testl %ebp, %ebp
jle 0x4daac
xorl %r15d, %r15d
movl (%r12,%r15,4), %esi
movq %r13, %rdi
xorl %eax, %eax
callq 0x3160
incq %r15
cmpq %r15, %rbx
jne 0x4da96
movl $0xa, %edi
callq 0x3060
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x1657b
movq 0x70(%rsp), %rax
movq %rax, 0x10(%rsp)
movupd 0x60(%rsp), %xmm0
movupd %xmm0, (%rsp)
callq 0x1657b
movq 0x1e509(%rip), %rax     # 0x6bff8
movq (%rax), %r15
xorl %eax, %eax
callq 0xe79c
subsd 0x40(%rsp), %xmm0
incq %r14
movq %r15, %rdi
leaq 0xd27a(%rip), %rsi      # 0x5ad86
movl %r14d, %edx
movq 0x30(%rsp), %r15
movl %r15d, %ecx
movb $0x1, %al
callq 0x3270
cmpq %r15, %r14
jne 0x4d9d3
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq