// File: /workspace/github_c_makefile_star2_O2/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 %r14d, %r14d
xorl %edx, %edx
callq 0x22658
movq %rax, %rbx
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x22f00
movl $0x21e88e, %edi         # imm = 0x21E88E
callq 0x3220
movl (%rbx), %eax
testl %eax, %eax
movl $0x0, %ecx
movq %rcx, 0x38(%rsp)
cmovlel %r14d, %eax
movl $0x80, %ecx
xorl %r15d, %r15d
cmpq %r15, %rax
je 0x37168
movq 0x20(%rbx), %rdx
cmpl $0x3, (%rdx,%rcx)
je 0x37152
incq %r15
addq $0x4a0, %rcx            # imm = 0x4A0
jmp 0x37137
leaq 0x1a2f8(%rip), %rdi     # 0x51451
movl %r15d, %esi
xorl %eax, %eax
callq 0x3160
movq %r15, 0x38(%rsp)
movl 0x90(%rbx), %edx
movl 0x94(%rbx), %esi
movl 0x98(%rbx), %ecx
leaq 0x60(%rsp), %r15
movq %r15, %rdi
callq 0x37077
movl 0x90(%rbx), %edx
movl 0x94(%rbx), %esi
movl 0x98(%rbx), %ecx
leaq 0x40(%rsp), %rdi
callq 0x37077
movl 0x90(%rbx), %edx
movl 0x94(%rbx), %esi
movl 0x98(%rbx), %ecx
leaq 0x80(%rsp), %rdi
callq 0xb45a
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
leaq 0x98(%rsp), %rdi
callq 0xb85b
leaq 0xb0(%rsp), %r13
xorl %ebp, %ebp
xorl %r12d, %r12d
cmpl $0xf, %r12d
jne 0x37284
movq 0x70(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x60(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xba88
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 0x20(%rsp), %rdi
callq 0x37077
movq 0x30(%rsp), %rax
movq %rax, 0x50(%rsp)
movups 0x20(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
xorl %r12d, %r12d
cmpl $0x12c, %ebp            # imm = 0x12C
jb 0x37284
movq 0xa8(%rsp), %rax
movq %rax, 0x50(%rsp)
movups 0x98(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
cmpl $0x13b, %ebp            # imm = 0x13B
jae 0x373a0
incl %ebp
incl %r12d
movq 0x70(%rsp), %rdi
cvtsi2ss %r12d, %xmm0
movq 0x50(%rsp), %rsi
movl 0x84(%rsp), %edx
imull 0x80(%rsp), %edx
divss 0x19d69(%rip), %xmm0    # 0x51018
imull 0x88(%rsp), %edx
movq 0x90(%rsp), %rcx
callq 0x36f70
movq 0x90(%rsp), %r14
callq 0x3120
movq %rax, %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x233e2
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
movq 0x38(%rsp), %rdx
callq 0x232a7
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xd27c
callq 0x3120
subq %r15, %rax
movq %rax, %rdi
callq 0x437c
cvtss2sd %xmm0, %xmm0
leaq 0x19cf8(%rip), %rdi     # 0x5101c
movq %r13, %rsi
movb $0x1, %al
callq 0x3160
movq %r13, %rdi
leaq 0x19d02(%rip), %rsi     # 0x5103a
movl %ebp, %edx
xorl %eax, %eax
callq 0x3420
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x1ae7b(%rip), %r14     # 0x521d6
movq %r14, %rdi
callq 0xd514
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r13, %rdi
callq 0xd514
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0xd4c7
jmp 0x371ed
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq