// File: /workspace/github_c_makefile_star2_O1/SimpleDoger[P]Darknet_CPU_Only/lsd.c
// Function: inter_dcgan
void inter_dcgan(char *cfgfile, char *weightfile)
{
    network *net = load_network(cfgfile, weightfile, 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;
        }
    }
    image start = random_unit_vector_image(net->w, net->h, net->c);
    image end = random_unit_vector_image(net->w, net->h, net->c);
        image im = make_image(net->w, net->h, net->c);
        image orig = copy_image(start);

    int c = 0;
    int count = 0;
    int max_count = 15;
    while(1){
        ++c;
        
        if(count == max_count){
            count = 0;
            free_image(start);
            start = end;
            end = random_unit_vector_image(net->w, net->h, net->c);
            if(c > 300){
                end = orig;
            }
            if(c>300 + max_count) return;
        }
        ++count;

        slerp(start.data, end.data, (float)count / max_count, im.w*im.h*im.c, im.data);

        float *X = im.data;
        time=clock();
        network_predict(net, X);
        image out = get_network_image_layer(net, imlayer);
        //yuv_to_rgb(out);
        normalize_image(out);
        printf("%s: Predicted in %f seconds.\n", input, sec(clock()-time));
        //char buff[256];
        sprintf(buff, "out%05d", c);
        save_image(out, "out");
        save_image(out, buff);
        show_image(out, "out", 0);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
xorl %edx, %edx
callq 0x2f9e4
movq %rax, %rbx
movq %rax, %rdi
movl $0x1, %esi
callq 0x302d4
movl $0x21e88e, %edi         # imm = 0x21E88E
callq 0x3230
movslq (%rbx), %rax
movl $0x0, %ecx
movq %rcx, 0x20(%rsp)
testq %rax, %rax
jle 0x4136a
movq 0x20(%rbx), %rcx
subq $-0x80, %rcx
movq $0x0, 0x20(%rsp)
cmpl $0x3, (%rcx)
je 0x41357
movq 0x20(%rsp), %rsi
incq %rsi
addq $0x4a0, %rcx            # imm = 0x4A0
movq %rsi, 0x20(%rsp)
cmpq %rsi, %rax
jne 0x4132e
movq $0x0, 0x20(%rsp)
jmp 0x4136a
leaq 0x170e3(%rip), %rdi     # 0x58441
movq 0x20(%rsp), %rsi
xorl %eax, %eax
callq 0x3170
movl 0x90(%rbx), %edx
movl 0x94(%rbx), %esi
movl 0x98(%rbx), %ecx
leaq 0x60(%rsp), %r15
movq %r15, %rdi
callq 0x4125a
movl 0x90(%rbx), %edx
movl 0x94(%rbx), %esi
movl 0x98(%rbx), %ecx
leaq 0x40(%rsp), %rdi
callq 0x4125a
movl 0x90(%rbx), %edx
movl 0x94(%rbx), %esi
movl 0x98(%rbx), %ecx
leaq 0x80(%rsp), %rdi
callq 0x1529e
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
leaq 0x98(%rsp), %rdi
callq 0x15841
leaq 0xb0(%rsp), %r13
xorl %ebp, %ebp
xorl %r14d, %r14d
cmpl $0xf, %r14d
jne 0x41486
movq 0x70(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x60(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x15b37
movq 0x50(%rsp), %rax
movq %rax, 0x70(%rsp)
movaps 0x40(%rsp), %xmm0
movaps %xmm0, 0x60(%rsp)
movl 0x90(%rbx), %edx
movl 0x94(%rbx), %esi
movl 0x98(%rbx), %ecx
leaq 0x28(%rsp), %rdi
callq 0x4125a
movq 0x38(%rsp), %rax
movq %rax, 0x50(%rsp)
movups 0x28(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
cmpl $0x12c, %ebp            # imm = 0x12C
jb 0x41477
movq 0xa8(%rsp), %rax
movq %rax, 0x50(%rsp)
movups 0x98(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
xorl %r14d, %r14d
cmpl $0x13b, %ebp            # imm = 0x13B
jae 0x415a5
incl %ebp
incl %r14d
movq 0x70(%rsp), %rdi
xorps %xmm0, %xmm0
cvtsi2ss %r14d, %xmm0
movq 0x50(%rsp), %rsi
movl 0x84(%rsp), %edx
imull 0x80(%rsp), %edx
divss 0x16b2c(%rip), %xmm0    # 0x57fe0
imull 0x88(%rsp), %edx
movq 0x90(%rsp), %rcx
callq 0x41140
movq 0x90(%rsp), %r15
callq 0x3130
movq %rax, %r12
movq %rbx, %rdi
movq %r15, %rsi
callq 0x307ea
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
movq 0x20(%rsp), %rdx
callq 0x306a2
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x177d6
callq 0x3130
subq %r12, %rax
movq %rax, %rdi
callq 0xe8d4
cvtss2sd %xmm0, %xmm0
leaq 0x16abb(%rip), %rdi     # 0x57fe4
movq %r13, %rsi
movb $0x1, %al
callq 0x3170
movq %r13, %rdi
leaq 0x16ac5(%rip), %rsi     # 0x58002
movl %ebp, %edx
xorl %eax, %eax
callq 0x3430
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x17c5e(%rip), %r15     # 0x591be
movq %r15, %rdi
callq 0x17a72
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r13, %rdi
callq 0x17a72
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r15, %rdi
xorl %esi, %esi
callq 0x3f2e
jmp 0x413ef
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq