// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/tag.c
// Function: test_tag
void test_tag(char *cfgfile, char *weightfile, char *filename)
{
    network *net = load_network(cfgfile, weightfile, 0);
    set_batch_network(net, 1);
    srand(2222222);
    int i = 0;
    char **names = get_labels("data/tags.txt");
    clock_t time;
    int indexes[10];
    char buff[256];
    char *input = buff;
    int size = net->w;
    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 im = load_image_color(input, 0, 0);
        image r = resize_min(im, size);
        resize_network(net, r.w, r.h);
        printf("%d %d\n", r.w, r.h);

        float *X = r.data;
        time=clock();
        float *predictions = network_predict(net, X);
        top_predictions(net, 10, indexes);
        printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));
        for(i = 0; i < 10; ++i){
            int index = indexes[i];
            printf("%.1f%%: %s\n", predictions[index]*100, names[index]);
        }
        if(r.data != im.data) free_image(r);
        free_image(im);
        if (filename) break;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rdx, %rbx
xorl %edx, %edx
callq 0x22658
movq %rax, %r14
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x22f00
movl $0x21e88e, %edi         # imm = 0x21E88E
callq 0x3220
leaq 0x18c7b(%rip), %rdi     # 0x511b3
callq 0x1e673
movq %rax, %r15
movl 0x94(%r14), %eax
movl %eax, 0x24(%rsp)
leaq 0x90(%rsp), %r13
leaq 0x18c67(%rip), %r12     # 0x511c1
movq %rbx, 0x40(%rsp)
testq %rbx, %rbx
je 0x38576
movl $0x100, %edx            # imm = 0x100
movq %r13, %rdi
movq %rbx, %rsi
callq 0x3080
jmp 0x385c5
leaq 0x18ac5(%rip), %rdi     # 0x51042
xorl %eax, %eax
callq 0x3160
movq 0x2ba45(%rip), %rax     # 0x63fd0
movq (%rax), %rdi
callq 0x3310
movq 0x2ba3e(%rip), %rax     # 0x63fd8
movq (%rax), %rdx
movq %r13, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x3230
testq %rax, %rax
je 0x386e9
movq %rax, %r13
movq %rax, %rdi
leaq 0x18f59(%rip), %rsi     # 0x51519
callq 0x33b0
leaq 0x48(%rsp), %rdi
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xbf36
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x28(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0xe96d
movl 0x28(%rsp), %esi
movl 0x2c(%rsp), %edx
movq %r14, %rdi
callq 0x22f25
movl 0x28(%rsp), %esi
movl 0x2c(%rsp), %edx
leaq 0x182c6(%rip), %rdi     # 0x508dc
xorl %eax, %eax
callq 0x3160
movq 0x38(%rsp), %rbp
callq 0x3120
movq %rax, %rbx
movq %r14, %rdi
movq %rbp, %rsi
callq 0x233e2
movq %rax, %rbp
movq %r14, %rdi
pushq $0xa
popq %rsi
leaq 0x60(%rsp), %rdx
callq 0x233cb
callq 0x3120
subq %rbx, %rax
movq %rax, %rdi
callq 0x437c
cvtss2sd %xmm0, %xmm0
leaq 0x189b9(%rip), %rdi     # 0x5101c
movq %r13, %rsi
movb $0x1, %al
callq 0x3160
xorl %ebx, %ebx
cmpq $0xa, %rbx
je 0x3869f
movslq 0x60(%rsp,%rbx,4), %rax
movss (%rbp,%rax,4), %xmm0
mulss 0x13bbc(%rip), %xmm0    # 0x4c244
cvtss2sd %xmm0, %xmm0
movq (%r15,%rax,8), %rsi
movq %r12, %rdi
movb $0x1, %al
callq 0x3160
incq %rbx
jmp 0x3866f
movq 0x38(%rsp), %rax
cmpq 0x58(%rsp), %rax
je 0x386c3
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xba88
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xba88
movq 0x40(%rsp), %rbx
testq %rbx, %rbx
je 0x3855f
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq