// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/nightmare.c
// Function: reconstruct_picture
void reconstruct_picture(network *net, float *features, image recon, image update, float rate, float momentum, float lambda, int smooth_size, int iters)
{
    int iter = 0;
    for (iter = 0; iter < iters; ++iter) {
        image delta = make_image(recon.w, recon.h, recon.c);

        net->input = recon.data;
        net->delta = delta.data;
        net->truth = features;

        forward_network(net);
        backward_network(net);

        //normalize_array(delta.data, delta.w*delta.h*delta.c);
        axpy_cpu(recon.w*recon.h*recon.c, 1, delta.data, 1, update.data, 1);
        //smooth(recon, update, lambda, smooth_size);

        axpy_cpu(recon.w*recon.h*recon.c, rate, update.data, 1, recon.data, 1);
        scal_cpu(recon.w*recon.h*recon.c, momentum, update.data, 1);

        float mag = mag_array(delta.data, recon.w*recon.h*recon.c);
        printf("mag: %f\n", mag);
        //scal_cpu(recon.w*recon.h*recon.c, 600/mag, recon.data, 1);

        constrain_image(recon);
        free_image(delta);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
leaq 0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movss %xmm0, -0x14(%rbp)
movss %xmm1, -0x18(%rbp)
movss %xmm2, -0x1c(%rbp)
movl %edx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x6ccce
movq -0x50(%rbp), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
movl 0x8(%rax), %ecx
leaq -0x40(%rbp), %rdi
callq 0xe3e0
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xd8(%rax)
movq -0x30(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xe8(%rax)
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xe0(%rax)
movq -0x8(%rbp), %rdi
callq 0x3a1b0
movq -0x8(%rbp), %rdi
callq 0x3a5a0
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rcx
movl (%rcx), %edi
imull 0x4(%rcx), %edi
imull 0x8(%rcx), %edi
movq -0x30(%rbp), %rsi
movq 0x10(%rax), %rcx
movss 0x4423(%rip), %xmm0     # 0x7100c
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f680
movq -0x58(%rbp), %rcx
movq -0x50(%rbp), %rax
movl (%rax), %edi
imull 0x4(%rax), %edi
imull 0x8(%rax), %edi
movss -0x14(%rbp), %xmm0
movq 0x10(%rcx), %rsi
movq 0x10(%rax), %rcx
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f680
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rcx
movl (%rcx), %edi
imull 0x4(%rcx), %edi
imull 0x8(%rcx), %edi
movss -0x18(%rbp), %xmm0
movq 0x10(%rax), %rsi
movl $0x1, %edx
callq 0x2f6f0
movq -0x50(%rbp), %rax
movq -0x30(%rbp), %rdi
movl (%rax), %esi
imull 0x4(%rax), %esi
imull 0x8(%rax), %esi
callq 0x59b0
movss %xmm0, -0x44(%rbp)
movss -0x44(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x9e30(%rip), %rdi      # 0x76aa5
movb $0x1, %al
callq 0x3130
movq -0x50(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x10db0
leaq -0x40(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xedb0
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x6cb63
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)