// File: /workspace/github_c_makefile_star2_O3/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 0x316bc
movq %rax, %rbx
movq %rax, %rdi
movl $0x1, %esi
callq 0x320a7
movl $0x21e88e, %edi         # imm = 0x21E88E
callq 0x3220
movslq (%rbx), %rax
movl $0x0, %ecx
movq %rcx, 0x20(%rsp)
testq %rax, %rax
jle 0x43554
movq 0x20(%rbx), %rcx
subq $-0x80, %rcx
movq $0x0, 0x20(%rsp)
cmpl $0x3, (%rcx)
je 0x43541
movq 0x20(%rsp), %rsi
incq %rsi
addq $0x4a0, %rcx            # imm = 0x4A0
movq %rsi, 0x20(%rsp)
cmpq %rsi, %rax
jne 0x43518
movq $0x0, 0x20(%rsp)
jmp 0x43554
leaq 0x17051(%rip), %rdi     # 0x5a599
movq 0x20(%rsp), %rsi
xorl %eax, %eax
callq 0x3160
movl 0x90(%rbx), %edx
movl 0x94(%rbx), %esi
movl 0x98(%rbx), %ecx
leaq 0x60(%rsp), %r15
movq %r15, %rdi
callq 0x43442
movl 0x90(%rbx), %edx
movl 0x94(%rbx), %esi
movl 0x98(%rbx), %ecx
leaq 0x40(%rsp), %rdi
callq 0x43442
movl 0x90(%rbx), %edx
movl 0x94(%rbx), %esi
movl 0x98(%rbx), %ecx
leaq 0x80(%rsp), %rdi
callq 0x15d43
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
leaq 0x98(%rsp), %rdi
callq 0x1626c
leaq 0xb0(%rsp), %r13
xorl %ebp, %ebp
xorl %r14d, %r14d
cmpl $0xf, %r14d
jne 0x43670
movq 0x70(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x60(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x1657b
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 0x43442
movq 0x38(%rsp), %rax
movq %rax, 0x50(%rsp)
movups 0x28(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
xorl %r14d, %r14d
cmpl $0x12c, %ebp            # imm = 0x12C
jb 0x43670
movq 0xa8(%rsp), %rax
movq %rax, 0x50(%rsp)
movups 0x98(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
cmpl $0x13b, %ebp            # imm = 0x13B
jae 0x4378f
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 0x16a7a(%rip), %xmm0    # 0x5a118
imull 0x88(%rsp), %edx
movq 0x90(%rsp), %rcx
callq 0x43328
movq 0x90(%rsp), %r15
callq 0x3120
movq %rax, %r12
movq %rbx, %rdi
movq %r15, %rsi
callq 0x32690
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
movq 0x20(%rsp), %rdx
callq 0x32548
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x1807b
callq 0x3120
subq %r12, %rax
movq %rax, %rdi
callq 0xf0bf
cvtss2sd %xmm0, %xmm0
leaq 0x16a09(%rip), %rdi     # 0x5a11c
movq %r13, %rsi
movb $0x1, %al
callq 0x3160
movq %r13, %rdi
leaq 0x16a13(%rip), %rsi     # 0x5a13a
movl %ebp, %edx
xorl %eax, %eax
callq 0x3420
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x17bcc(%rip), %r15     # 0x5b316
movq %r15, %rdi
callq 0x18301
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r13, %rdi
callq 0x18301
movq 0x38(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r15, %rdi
xorl %esi, %esi
callq 0x40f9
jmp 0x435d9
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq