// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/detector.c
// Function: test_detector
void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filename, float thresh, float hier_thresh, char *outfile, int fullscreen)
{
    list *options = read_data_cfg(datacfg);
    char *name_list = option_find_str(options, "names", "data/names.list");
    char **names = get_labels(name_list);

    image **alphabet = load_alphabet();
    network *net = load_network(cfgfile, weightfile, 0);
    set_batch_network(net, 1);
    srand(2222222);
    double time;
    char buff[256];
    char *input = buff;
    float nms=.45;
    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 sized = letterbox_image(im, net->w, net->h);
        //image sized = resize_image(im, net->w, net->h);
        //image sized2 = resize_max(im, net->w);
        //image sized = crop_image(sized2, -((net->w - sized2.w)/2), -((net->h - sized2.h)/2), net->w, net->h);
        //resize_network(net, sized.w, sized.h);
        layer l = net->layers[net->n-1];


        float *X = sized.data;
        time=what_time_is_it_now();
        network_predict(net, X);
        printf("%s: Predicted in %f seconds.\n", input, what_time_is_it_now()-time);
        int nboxes = 0;
        detection *dets = get_network_boxes(net, im.w, im.h, thresh, hier_thresh, 0, 1, &nboxes);
        //printf("%d\n", nboxes);
        //if (nms) do_nms_obj(boxes, probs, l.w*l.h*l.n, l.classes, nms);
        if (nms) do_nms_sort(dets, nboxes, l.classes, nms);
        draw_detections(im, dets, nboxes, thresh, names, alphabet, l.classes);
        free_detections(dets, nboxes);
        if(outfile){
            save_image(im, outfile);
        }
        else{
            save_image(im, "predictions");
        }

        free_image(im);
        free_image(sized);
        if (filename) break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x690, %rsp            # imm = 0x690
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movss %xmm0, -0x24(%rbp)
movss %xmm1, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
movq -0x8(%rbp), %rdi
callq 0x426b0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
leaq 0x9590(%rip), %rsi      # 0x74fa5
leaq 0xafd4(%rip), %rdx      # 0x769f0
callq 0x42920
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x343c0
movq %rax, -0x50(%rbp)
movb $0x0, %al
callq 0xf400
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x39a70
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movl $0x1, %esi
callq 0x3a9b0
movl $0x21e88e, %edi         # imm = 0x21E88E
callq 0x31e0
leaq -0x170(%rbp), %rax
movq %rax, -0x178(%rbp)
movss 0xaf22(%rip), %xmm0     # 0x769a0
movss %xmm0, -0x17c(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x6baa4
movq -0x178(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x3060
jmp 0x6bb05
leaq 0x9e47(%rip), %rdi      # 0x758f2
movb $0x0, %al
callq 0x3130
movq 0x17517(%rip), %rax     # 0x82fd0
movq (%rax), %rdi
callq 0x32e0
movq -0x178(%rbp), %rdi
movq 0x17509(%rip), %rax     # 0x82fd8
movq (%rax), %rdx
movl $0x100, %esi            # imm = 0x100
callq 0x3200
movq %rax, -0x178(%rbp)
cmpq $0x0, -0x178(%rbp)
jne 0x6baf2
jmp 0x6bd66
movq -0x178(%rbp), %rdi
leaq 0xa2ae(%rip), %rsi      # 0x75dae
callq 0x3380
movq -0x178(%rbp), %rsi
leaq -0x198(%rbp), %rdi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0xf510
movq -0x60(%rbp), %rax
movl 0x94(%rax), %esi
movq -0x60(%rbp), %rax
movl 0x90(%rax), %edx
leaq -0x1b0(%rbp), %rdi
leaq -0x198(%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 0x12c60
movq -0x60(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x60(%rbp), %rax
movl (%rax), %eax
subl $0x1, %eax
cltq
imulq $0x4a0, %rax, %rax      # imm = 0x4A0
addq %rax, %rsi
leaq -0x650(%rbp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0x1a0(%rbp), %rax
movq %rax, -0x658(%rbp)
movb $0x0, %al
callq 0x3f10
movsd %xmm0, -0x68(%rbp)
movq -0x60(%rbp), %rdi
movq -0x658(%rbp), %rsi
callq 0x3b160
movq -0x178(%rbp), %rax
movq %rax, -0x670(%rbp)
movb $0x0, %al
callq 0x3f10
movq -0x670(%rbp), %rsi
subsd -0x68(%rbp), %xmm0
leaq 0x9cf0(%rip), %rdi      # 0x758cc
movb $0x1, %al
callq 0x3130
movl $0x0, -0x65c(%rbp)
movq -0x60(%rbp), %rdi
movl -0x198(%rbp), %esi
movl -0x194(%rbp), %edx
movss -0x24(%rbp), %xmm0
movss -0x28(%rbp), %xmm1
xorl %eax, %eax
movl %eax, %ecx
movl $0x1, %r8d
leaq -0x65c(%rbp), %r9
callq 0x3b640
movq %rax, -0x668(%rbp)
movss -0x17c(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x6bc38
jp 0x6bc38
jmp 0x6bc58
movq -0x668(%rbp), %rdi
movl -0x65c(%rbp), %esi
movl -0x554(%rbp), %edx
movss -0x17c(%rbp), %xmm0
callq 0x44d40
movq -0x668(%rbp), %rdi
movl -0x65c(%rbp), %esi
movss -0x24(%rbp), %xmm0
movq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rcx
movl -0x554(%rbp), %r8d
leaq -0x198(%rbp), %rax
movq (%rax), %r9
movq %r9, (%rsp)
movq 0x8(%rax), %r9
movq %r9, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xf550
movq -0x668(%rbp), %rdi
movl -0x65c(%rbp), %esi
callq 0x3b6b0
cmpq $0x0, -0x30(%rbp)
je 0x6bce2
movq -0x30(%rbp), %rdi
leaq -0x198(%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 0x11330
jmp 0x6bd0e
leaq -0x198(%rbp), %rax
leaq 0xab9f(%rip), %rdi      # 0x7688f
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x11330
leaq -0x198(%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
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 0x6bd61
jmp 0x6bd66
jmp 0x6ba86
addq $0x690, %rsp            # imm = 0x690
popq %rbp
retq
nop