// File: /workspace/github_c_makefile_star2_O3/SimpleDoger[P]Darknet_CPU_Only/segmenter.c
// Function: predict_segmenter
void predict_segmenter(char *datafile, char *cfg, char *weights, char *filename)
{
    network *net = load_network(cfg, weights, 0);
    set_batch_network(net, 1);
    srand(2222222);

    clock_t time;
    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 im = load_image_color(input, 0, 0);
        image sized = letterbox_image(im, net->w, net->h);

        float *X = sized.data;
        time=clock();
        float *predictions = network_predict(net, X);
        image pred = get_network_image(net);
        image prmask = mask_to_rgb(pred);
        printf("Predicted: %f\n", predictions[0]);
        printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));
        show_image(sized, "orig", 1);
        show_image(prmask, "pred", 0);
        free_image(im);
        free_image(sized);
        free_image(prmask);
        if (filename) break;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rcx, %rbx
movq %rsi, %rdi
movq %rdx, %rsi
xorl %edx, %edx
callq 0x316bc
movq %rax, %r14
movq %rax, %rdi
movl $0x1, %esi
callq 0x320a7
movl $0x21e88e, %edi         # imm = 0x21E88E
callq 0x3220
leaq 0x80(%rsp), %r13
leaq 0x10546(%rip), %r12     # 0x5ac86
testq %rbx, %rbx
je 0x4a757
movl $0x100, %edx            # imm = 0x100
movq %r13, %rdi
movq %rbx, %rsi
callq 0x3080
jmp 0x4a7a6
leaq 0xf9e4(%rip), %rdi      # 0x5a142
xorl %eax, %eax
callq 0x3160
movq 0x21864(%rip), %rax     # 0x6bfd0
movq (%rax), %rdi
callq 0x3310
movq 0x2185d(%rip), %rax     # 0x6bfd8
movq (%rax), %rdx
movq %r13, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x3230
testq %rax, %rax
je 0x4a8f4
movq %rax, %r13
movq %rax, %rdi
leaq 0xfec0(%rip), %rsi      # 0x5a661
callq 0x33b0
leaq 0x50(%rsp), %rdi
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x16ac9
movl 0x90(%r14), %edx
movl 0x94(%r14), %esi
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %rdi
callq 0x19916
movq 0x30(%rsp), %rbp
callq 0x3120
movq %rax, %r15
movq %r14, %rdi
movq %rbp, %rsi
callq 0x32690
movq %rax, %rbp
leaq 0x68(%rsp), %rdi
movq %r14, %rsi
callq 0x325ae
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x38(%rsp), %rdi
callq 0x15b57
xorps %xmm0, %xmm0
cvtss2sd (%rbp), %xmm0
leaq 0x10455(%rip), %rdi     # 0x5ac8b
movb $0x1, %al
callq 0x3160
callq 0x3120
subq %r15, %rax
movq %rax, %rdi
callq 0xf0bf
cvtss2sd %xmm0, %xmm0
leaq 0xf8c4(%rip), %rdi      # 0x5a11c
movq %r13, %rsi
movb $0x1, %al
callq 0x3160
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x1041e(%rip), %rdi     # 0x5ac9a
movl $0x1, %esi
callq 0x40f9
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x38(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r12, %rdi
xorl %esi, %esi
callq 0x40f9
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x1657b
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x1657b
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x38(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x1657b
testq %rbx, %rbx
je 0x4a740
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq