// File: /workspace/github_c_makefile_star2_O1/SimpleDoger[P]Darknet_CPU_Only/lsd.c
// Function: test_lsd
void test_lsd(char *cfg, char *weights, char *filename, int gray)
{
    network *net = load_network(cfg, weights, 0);
    set_batch_network(net, 1);
    srand(2222222);

    clock_t time;
    char buff[256];
    char *input = buff;
    int i, imlayer = 0;

    for (i = 0; i < net->n; ++i) {
        if (net->layers[i].out_c == 3) {
            imlayer = i;
            printf("%d\n", i);
            break;
        }
    }

    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 resized = resize_min(im, net->w);
        image crop = crop_image(resized, (resized.w - net->w)/2, (resized.h - net->h)/2, net->w, net->h);
        if(gray) grayscale_image_3c(crop);

        float *X = crop.data;
        time=clock();
        network_predict(net, X);
        image out = get_network_image_layer(net, imlayer);
        //yuv_to_rgb(out);
        constrain_image(out);
        printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));
        save_image(out, "out");
        show_image(out, "out", 1);
        show_image(crop, "crop", 0);

        free_image(im);
        free_image(resized);
        free_image(crop);
        if (filename) break;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movl %ecx, 0x1c(%rsp)
movq %rdx, %r14
xorl %r15d, %r15d
xorl %edx, %edx
callq 0x2f9e4
movq %rax, %r12
movq %rax, %rdi
movl $0x1, %esi
callq 0x302d4
movl $0x21e88e, %edi         # imm = 0x21E88E
callq 0x3230
movslq (%r12), %rax
testq %rax, %rax
jle 0x417cc
movq 0x20(%r12), %rcx
subq $-0x80, %rcx
xorl %r15d, %r15d
cmpl $0x3, (%rcx)
je 0x417bb
incq %r15
addq $0x4a0, %rcx            # imm = 0x4A0
cmpq %r15, %rax
jne 0x417a2
xorl %r15d, %r15d
jmp 0x417cc
leaq 0x16c7f(%rip), %rdi     # 0x58441
movl %r15d, %esi
xorl %eax, %eax
callq 0x3170
leaq 0x80(%rsp), %rbp
testq %r14, %r14
je 0x417eb
movl $0x100, %edx            # imm = 0x100
movq %rbp, %rdi
movq %r14, %rsi
callq 0x3080
jmp 0x4183a
leaq 0x16818(%rip), %rdi     # 0x5800a
xorl %eax, %eax
callq 0x3170
movq 0x287d0(%rip), %rax     # 0x69fd0
movq (%rax), %rdi
callq 0x3320
movq 0x287c9(%rip), %rax     # 0x69fd8
movq (%rax), %rdx
movq %rbp, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0x3240
testq %rax, %rax
je 0x419f4
movq %rax, %rbp
movq %rax, %rdi
leaq 0x16cd4(%rip), %rsi     # 0x58509
callq 0x33c0
leaq 0x68(%rsp), %rdi
movq %rbp, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x160b6
movl 0x94(%r12), %esi
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x50(%rsp), %rdi
callq 0x1920a
movl 0x90(%r12), %r8d
movl 0x94(%r12), %ecx
movl 0x50(%rsp), %eax
movl 0x54(%rsp), %edi
subl %ecx, %eax
movl %eax, %esi
shrl $0x1f, %esi
addl %eax, %esi
sarl %esi
subl %r8d, %edi
movl %edi, %edx
shrl $0x1f, %edx
addl %edi, %edx
sarl %edx
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %rdi
callq 0x181f7
cmpl $0x0, 0x1c(%rsp)
je 0x418db
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x19df5
movq 0x30(%rsp), %rbx
callq 0x3130
movq %rax, %r13
movq %r12, %rdi
movq %rbx, %rsi
callq 0x307ea
leaq 0x38(%rsp), %rdi
movq %r12, %rsi
movl %r15d, %edx
callq 0x306a2
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x38(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x17785
callq 0x3130
subq %r13, %rax
movq %rax, %rdi
callq 0xe8d4
cvtss2sd %xmm0, %xmm0
leaq 0x166ae(%rip), %rdi     # 0x57fe4
movq %rbp, %rsi
movb $0x1, %al
callq 0x3170
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x38(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x17864(%rip), %rbx     # 0x591be
movq %rbx, %rdi
callq 0x17a72
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x38(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
movl $0x1, %esi
callq 0x3f2e
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x15b58(%rip), %rdi     # 0x574f4
xorl %esi, %esi
callq 0x3f2e
movq 0x78(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x68(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x15b37
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x15b37
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x15b37
testq %r14, %r14
je 0x417d4
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq