// File: /workspace/github_c_makefile_star2_O3/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 0x316bc
movq %rax, %r14
movq %rax, %rdi
movl $0x1, %esi
callq 0x320a7
movl $0x21e88e, %edi         # imm = 0x21E88E
callq 0x3220
leaq 0x15ed7(%rip), %rdi     # 0x5a2b3
callq 0x2d26c
movq %rax, %r15
movl 0x94(%r14), %eax
movl %eax, 0x24(%rsp)
leaq 0x90(%rsp), %r13
leaq 0x15ec3(%rip), %r12     # 0x5a2c1
movq %rbx, 0x40(%rsp)
testq %rbx, %rbx
je 0x4441a
movl $0x100, %edx            # imm = 0x100
movq %r13, %rdi
movq %rbx, %rsi
callq 0x3080
jmp 0x44469
leaq 0x15d21(%rip), %rdi     # 0x5a142
xorl %eax, %eax
callq 0x3160
movq 0x27ba1(%rip), %rax     # 0x6bfd0
movq (%rax), %rdi
callq 0x3310
movq 0x27b9a(%rip), %rax     # 0x6bfd8
movq (%rax), %rdx
movq %r13, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x3230
testq %rax, %rax
je 0x4458d
movq %rax, %r13
movq %rax, %rdi
leaq 0x161fd(%rip), %rsi     # 0x5a661
callq 0x33b0
leaq 0x48(%rsp), %rdi
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x16ac9
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x28(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x19bb8
movl 0x28(%rsp), %esi
movl 0x2c(%rsp), %edx
movq %r14, %rdi
callq 0x321b7
movl 0x28(%rsp), %esi
movl 0x2c(%rsp), %edx
leaq 0x154d2(%rip), %rdi     # 0x5998c
xorl %eax, %eax
callq 0x3160
movq 0x38(%rsp), %rbp
callq 0x3120
movq %rax, %rbx
movq %r14, %rdi
movq %rbp, %rsi
callq 0x32690
movq %rax, %rbp
movq %r14, %rdi
movl $0xa, %esi
leaq 0x60(%rsp), %rdx
callq 0x32679
callq 0x3120
subq %rbx, %rax
movq %rax, %rdi
callq 0xf0bf
cvtss2sd %xmm0, %xmm0
leaq 0x15c13(%rip), %rdi     # 0x5a11c
movq %r13, %rsi
movb $0x1, %al
callq 0x3160
xorl %ebx, %ebx
movslq 0x60(%rsp,%rbx,4), %rax
movss (%rbp,%rax,4), %xmm0
mulss 0x10d4c(%rip), %xmm0    # 0x55274
cvtss2sd %xmm0, %xmm0
movq (%r15,%rax,8), %rsi
movq %r12, %rdi
movb $0x1, %al
callq 0x3160
incq %rbx
cmpq $0xa, %rbx
jne 0x44515
movq 0x38(%rsp), %rax
cmpq 0x58(%rsp), %rax
je 0x44567
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x1657b
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x1657b
movq 0x40(%rsp), %rbx
testq %rbx, %rbx
je 0x44403
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq