// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/classifier.c
// Function: try_classifier
void try_classifier(char *datacfg, char *cfgfile, char *weightfile, char *filename, int layer_num)
{
    network *net = load_network(cfgfile, weightfile, 0);
    set_batch_network(net, 1);
    srand(2222222);

    list *options = read_data_cfg(datacfg);

    char *name_list = option_find_str(options, "names", 0);
    if(!name_list) name_list = option_find_str(options, "labels", "data/labels.list");
    int top = option_find_int(options, "top", 1);

    int i = 0;
    char **names = get_labels(name_list);
    clock_t time;
    int *indexes = calloc(top, sizeof(int));
    char buff[256];
    char *input = buff;
    while(1){
        if(filename){
            strncpy(input, filename, 256);
        }else{
            printf("Enter Image Path: ");
            fflush(stdout);
            input = fgets(input, 256, stdin);
            if(!input) return;
            strtok(input, "\n");
        }
        image orig = load_image_color(input, 0, 0);
        image r = resize_min(orig, 256);
        image im = crop_image(r, (r.w - 224 - 1)/2 + 1, (r.h - 224 - 1)/2 + 1, 224, 224);
        float mean[] = {0.48263312050943, 0.45230225481413, 0.40099074308742};
        float std[] = {0.22590347483426, 0.22120921437787, 0.22103996251583};
        float var[3];
        var[0] = std[0]*std[0];
        var[1] = std[1]*std[1];
        var[2] = std[2]*std[2];

        normalize_cpu(im.data, mean, var, 1, 3, im.w*im.h);

        float *X = im.data;
        time=clock();
        float *predictions = network_predict(net, X);

        layer l = net->layers[layer_num];
        for(i = 0; i < l.c; ++i){
            if(l.rolling_mean) printf("%f %f %f\n", l.rolling_mean[i], l.rolling_variance[i], l.scales[i]);
        }
        for(i = 0; i < l.outputs; ++i){
            printf("%f\n", l.output[i]);
        }
        /*

           printf("\n\nWeights\n");
           for(i = 0; i < l.n*l.size*l.size*l.c; ++i){
           printf("%f\n", l.filters[i]);
           }

           printf("\n\nBiases\n");
           for(i = 0; i < l.n; ++i){
           printf("%f\n", l.biases[i]);
           }
         */

        top_predictions(net, top, indexes);
        printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));
        for(i = 0; i < top; ++i){
            int index = indexes[i];
            printf("%s: %f\n", names[index], predictions[index]);
        }
        free_image(im);
        if (filename) break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x6b0, %rsp            # imm = 0x6B0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x39a70
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0x3a9b0
movl $0x21e88e, %edi         # imm = 0x21E88E
callq 0x31e0
movq -0x8(%rbp), %rdi
callq 0x426b0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
leaq 0x11443(%rip), %rsi     # 0x74fa5
xorl %eax, %eax
movl %eax, %edx
callq 0x42920
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x63b91
movq -0x38(%rbp), %rdi
leaq 0x107c5(%rip), %rsi     # 0x74346
leaq 0x12868(%rip), %rdx     # 0x763f0
callq 0x42920
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
leaq 0x12b74(%rip), %rsi     # 0x76710
movl $0x1, %edx
callq 0x42990
movl %eax, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x343c0
movq %rax, -0x50(%rbp)
movslq -0x44(%rbp), %rdi
movl $0x4, %esi
callq 0x3220
movq %rax, -0x60(%rbp)
leaq -0x160(%rbp), %rax
movq %rax, -0x168(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x63bfb
movq -0x168(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x3060
jmp 0x63c5c
leaq 0x11cf0(%rip), %rdi     # 0x758f2
movb $0x0, %al
callq 0x3130
movq 0x1f3c0(%rip), %rax     # 0x82fd0
movq (%rax), %rdi
callq 0x32e0
movq -0x168(%rbp), %rdi
movq 0x1f3b2(%rip), %rax     # 0x82fd8
movq (%rax), %rdx
movl $0x100, %esi            # imm = 0x100
callq 0x3200
movq %rax, -0x168(%rbp)
cmpq $0x0, -0x168(%rbp)
jne 0x63c49
jmp 0x63fa0
movq -0x168(%rbp), %rdi
leaq 0x12157(%rip), %rsi     # 0x75dae
callq 0x3380
movq -0x168(%rbp), %rsi
leaq -0x180(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0xf510
leaq -0x198(%rbp), %rdi
leaq -0x180(%rbp), %rax
movl $0x100, %esi            # imm = 0x100
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x12eb0
movl -0x198(%rbp), %eax
subl $0xe0, %eax
subl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %esi
addl $0x1, %esi
movl -0x194(%rbp), %eax
subl $0xe0, %eax
subl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %edx
addl $0x1, %edx
leaq -0x1b0(%rbp), %rdi
leaq -0x198(%rbp), %rax
movl $0xe0, %r8d
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
movl %r8d, %ecx
callq 0x11ca0
movq 0x1282a(%rip), %rax     # 0x76540
movq %rax, -0x1bc(%rbp)
movl 0x12825(%rip), %eax     # 0x76548
movl %eax, -0x1b4(%rbp)
movq 0x1281c(%rip), %rax     # 0x7654c
movq %rax, -0x1c8(%rbp)
movl 0x12817(%rip), %eax     # 0x76554
movl %eax, -0x1c0(%rbp)
movss -0x1c8(%rbp), %xmm0
mulss -0x1c8(%rbp), %xmm0
movss %xmm0, -0x1d4(%rbp)
movss -0x1c4(%rbp), %xmm0
mulss -0x1c4(%rbp), %xmm0
movss %xmm0, -0x1d0(%rbp)
movss -0x1c0(%rbp), %xmm0
mulss -0x1c0(%rbp), %xmm0
movss %xmm0, -0x1cc(%rbp)
movq -0x1a0(%rbp), %rdi
leaq -0x1bc(%rbp), %rsi
leaq -0x1d4(%rbp), %rdx
movl -0x1b0(%rbp), %r9d
imull -0x1ac(%rbp), %r9d
movl $0x1, %ecx
movl $0x3, %r8d
callq 0x2f440
movq -0x1a0(%rbp), %rax
movq %rax, -0x1e0(%rbp)
callq 0x30f0
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rdi
movq -0x1e0(%rbp), %rsi
callq 0x3b160
movq %rax, -0x1e8(%rbp)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rsi
movslq -0x24(%rbp), %rax
imulq $0x4a0, %rax, %rax      # imm = 0x4A0
addq %rax, %rsi
leaq -0x688(%rbp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x614(%rbp), %eax
jge 0x63e87
cmpq $0x0, -0x3d8(%rbp)
je 0x63e7a
movq -0x3d8(%rbp), %rax
movslq -0x48(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
movq -0x3d0(%rbp), %rax
movslq -0x48(%rbp), %rcx
movss (%rax,%rcx,4), %xmm1
cvtss2sd %xmm1, %xmm1
movq -0x448(%rbp), %rax
movslq -0x48(%rbp), %rcx
movss (%rax,%rcx,4), %xmm2
cvtss2sd %xmm2, %xmm2
leaq 0x11417(%rip), %rdi     # 0x7528a
movb $0x3, %al
callq 0x3130
jmp 0x63e7c
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x63e1b
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x630(%rbp), %eax
jge 0x63ec6
movq -0x420(%rbp), %rax
movslq -0x48(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x122ae(%rip), %rdi     # 0x76162
movb $0x1, %al
callq 0x3130
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x63e8e
movq -0x30(%rbp), %rdi
movl -0x44(%rbp), %esi
movq -0x60(%rbp), %rdx
callq 0x3b120
movq -0x168(%rbp), %rax
movq %rax, -0x698(%rbp)
callq 0x30f0
movq %rax, %rdi
subq -0x58(%rbp), %rdi
callq 0x4b50
movq -0x698(%rbp), %rsi
cvtss2sd %xmm0, %xmm0
leaq 0x119c5(%rip), %rdi     # 0x758cc
movb $0x1, %al
callq 0x3130
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x63f6d
movq -0x60(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x68c(%rbp)
movq -0x50(%rbp), %rax
movslq -0x68c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movq -0x1e8(%rbp), %rax
movslq -0x68c(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x12539(%rip), %rdi     # 0x76494
movb $0x1, %al
callq 0x3130
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x63f15
leaq -0x1b0(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xedb0
cmpq $0x0, -0x20(%rbp)
je 0x63f9b
jmp 0x63fa0
jmp 0x63bdd
addq $0x6b0, %rsp            # imm = 0x6B0
popq %rbp
retq
nopl (%rax)