// File: /workspace/github_c_makefile_star2_O1/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 0x2f9e4
movq %rax, %r14
movq %rax, %rdi
movl $0x1, %esi
callq 0x302d4
movl $0x21e88e, %edi         # imm = 0x21E88E
callq 0x3230
leaq 0x15f87(%rip), %rdi     # 0x5817b
callq 0x2b6d3
movq %rax, %r15
movl 0x94(%r14), %eax
movl %eax, 0x24(%rsp)
leaq 0x90(%rsp), %r13
leaq 0x15f73(%rip), %r12     # 0x58189
movq %rbx, 0x40(%rsp)
testq %rbx, %rbx
je 0x42232
movl $0x100, %edx            # imm = 0x100
movq %r13, %rdi
movq %rbx, %rsi
callq 0x3080
jmp 0x42281
leaq 0x15dd1(%rip), %rdi     # 0x5800a
xorl %eax, %eax
callq 0x3170
movq 0x27d89(%rip), %rax     # 0x69fd0
movq (%rax), %rdi
callq 0x3320
movq 0x27d82(%rip), %rax     # 0x69fd8
movq (%rax), %rdx
movq %r13, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x3240
testq %rax, %rax
je 0x423a5
movq %rax, %r13
movq %rax, %rdi
leaq 0x1628d(%rip), %rsi     # 0x58509
callq 0x33c0
leaq 0x48(%rsp), %rdi
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x160b6
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x28(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x1920a
movl 0x28(%rsp), %esi
movl 0x2c(%rsp), %edx
movq %r14, %rdi
callq 0x302fd
movl 0x28(%rsp), %esi
movl 0x2c(%rsp), %edx
leaq 0x155b2(%rip), %rdi     # 0x57884
xorl %eax, %eax
callq 0x3170
movq 0x38(%rsp), %rbp
callq 0x3130
movq %rax, %rbx
movq %r14, %rdi
movq %rbp, %rsi
callq 0x307ea
movq %rax, %rbp
movq %r14, %rdi
movl $0xa, %esi
leaq 0x60(%rsp), %rdx
callq 0x307d3
callq 0x3130
subq %rbx, %rax
movq %rax, %rdi
callq 0xe8d4
cvtss2sd %xmm0, %xmm0
leaq 0x15cc3(%rip), %rdi     # 0x57fe4
movq %r13, %rsi
movb $0x1, %al
callq 0x3170
xorl %ebx, %ebx
movslq 0x60(%rsp,%rbx,4), %rax
movss (%rbp,%rax,4), %xmm0
mulss 0x10f04(%rip), %xmm0    # 0x53244
cvtss2sd %xmm0, %xmm0
movq (%r15,%rax,8), %rsi
movq %r12, %rdi
movb $0x1, %al
callq 0x3170
incq %rbx
cmpq $0xa, %rbx
jne 0x4232d
movq 0x38(%rsp), %rax
cmpq 0x58(%rsp), %rax
je 0x4237f
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x15b37
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x15b37
movq 0x40(%rsp), %rbx
testq %rbx, %rbx
je 0x4221b
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq