// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/classifier.c
// Function: label_classifier
void label_classifier(char *datacfg, char *filename, char *weightfile)
{
    int i;
    network *net = load_network(filename, weightfile, 0);
    set_batch_network(net, 1);
    srand(time(0));

    list *options = read_data_cfg(datacfg);

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

    char **labels = get_labels(label_list);
    list *plist = get_paths(test_list);

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

    for(i = 0; i < m; ++i){
        image im = load_image_color(paths[i], 0, 0);
        image resized = resize_min(im, net->w);
        image crop = crop_image(resized, (resized.w - net->w)/2, (resized.h - net->h)/2, net->w, net->h);
        float *pred = network_predict(net, crop.data);

        if(resized.data != im.data) free_image(resized);
        free_image(im);
        free_image(crop);
        int ind = max_index(pred, classes);

        printf("%s\n", labels[ind]);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %r14
xorl %ebp, %ebp
movq %rsi, %rdi
movq %rdx, %rsi
xorl %edx, %edx
callq 0x22658
movq %rax, %rbx
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x22f00
xorl %edi, %edi
callq 0x32c0
movl %eax, %edi
callq 0x3220
movq %r14, %rdi
callq 0x29598
movq %rax, %r14
leaq 0xe429(%rip), %rsi      # 0x50739
leaq 0xf86d(%rip), %rdx      # 0x51b84
movq %rax, %rdi
callq 0x29737
movq %rax, %r15
leaq 0xfdec(%rip), %rsi      # 0x52115
leaq 0xf800(%rip), %rdx      # 0x51b30
movq %r14, %rdi
callq 0x29737
movq %rax, %r12
leaq 0xdea9(%rip), %rsi      # 0x501eb
pushq $0x2
popq %rdx
movq %r14, %rdi
callq 0x2977d
movl %eax, 0x1c(%rsp)
movq %r15, %rdi
callq 0x1e673
movq %rax, %r15
movq %r12, %rdi
callq 0x1c8c8
movq %rax, %r13
movq %rax, %rdi
callq 0x72f5
movq %rax, %r12
movl (%r13), %r14d
movq %r13, %rdi
callq 0x72c6
testl %r14d, %r14d
cmovlel %ebp, %r14d
cmpq %rbp, %r14
je 0x42490
movq (%r12,%rbp,8), %rsi
leaq 0x38(%rsp), %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xbf36
movl 0x94(%rbx), %esi
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x38(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %rdi
callq 0xe96d
movl 0x90(%rbx), %r8d
movl 0x94(%rbx), %ecx
movl 0x20(%rsp), %eax
movl 0x24(%rsp), %esi
subl %ecx, %eax
cltd
pushq $0x2
popq %rdi
idivl %edi
movl %eax, %r9d
subl %r8d, %esi
movl %esi, %eax
cltd
idivl %edi
movq 0x30(%rsp), %rdx
movq %rdx, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x50(%rsp), %rdi
movl %r9d, %esi
movl %eax, %edx
callq 0xdba7
movq 0x60(%rsp), %rsi
movq %rbx, %rdi
callq 0x233e2
movq %rax, %r13
movq 0x30(%rsp), %rax
cmpq 0x48(%rsp), %rax
je 0x42441
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xba88
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x38(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xba88
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xba88
movq %r13, %rdi
movl 0x1c(%rsp), %esi
callq 0x4c73
cltq
movq (%r15,%rax,8), %rdi
callq 0x30b0
incq %rbp
jmp 0x42385
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq