// File: /workspace/github_c_makefile_star2_O2/SimpleDoger[P]Darknet_CPU_Only/lstm_layer.c
// Function: forward_lstm_layer
void forward_lstm_layer(layer l, network state)
{
    network s = { 0 };
    s.train = state.train;
    int i;
    layer wf = *(l.wf);
    layer wi = *(l.wi);
    layer wg = *(l.wg);
    layer wo = *(l.wo);

    layer uf = *(l.uf);
    layer ui = *(l.ui);
    layer ug = *(l.ug);
    layer uo = *(l.uo);

    fill_cpu(l.outputs * l.batch * l.steps, 0, wf.delta, 1);
    fill_cpu(l.outputs * l.batch * l.steps, 0, wi.delta, 1);
    fill_cpu(l.outputs * l.batch * l.steps, 0, wg.delta, 1);
    fill_cpu(l.outputs * l.batch * l.steps, 0, wo.delta, 1);

    fill_cpu(l.outputs * l.batch * l.steps, 0, uf.delta, 1);
    fill_cpu(l.outputs * l.batch * l.steps, 0, ui.delta, 1);
    fill_cpu(l.outputs * l.batch * l.steps, 0, ug.delta, 1);
    fill_cpu(l.outputs * l.batch * l.steps, 0, uo.delta, 1);
    if (state.train) {
        fill_cpu(l.outputs * l.batch * l.steps, 0, l.delta, 1);
    }

    for (i = 0; i < l.steps; ++i) {
        s.input = l.h_cpu;
        forward_connected_layer(wf, s);							
        forward_connected_layer(wi, s);							
        forward_connected_layer(wg, s);							
        forward_connected_layer(wo, s);							

        s.input = state.input;
        forward_connected_layer(uf, s);							
        forward_connected_layer(ui, s);							
        forward_connected_layer(ug, s);							
        forward_connected_layer(uo, s);							

        copy_cpu(l.outputs*l.batch, wf.output, 1, l.f_cpu, 1);
        axpy_cpu(l.outputs*l.batch, 1, uf.output, 1, l.f_cpu, 1);

        copy_cpu(l.outputs*l.batch, wi.output, 1, l.i_cpu, 1);	
        axpy_cpu(l.outputs*l.batch, 1, ui.output, 1, l.i_cpu, 1);	

        copy_cpu(l.outputs*l.batch, wg.output, 1, l.g_cpu, 1);	
        axpy_cpu(l.outputs*l.batch, 1, ug.output, 1, l.g_cpu, 1);	

        copy_cpu(l.outputs*l.batch, wo.output, 1, l.o_cpu, 1);	
        axpy_cpu(l.outputs*l.batch, 1, uo.output, 1, l.o_cpu, 1);	

        activate_array(l.f_cpu, l.outputs*l.batch, LOGISTIC);		
        activate_array(l.i_cpu, l.outputs*l.batch, LOGISTIC);		
        activate_array(l.g_cpu, l.outputs*l.batch, TANH);			
        activate_array(l.o_cpu, l.outputs*l.batch, LOGISTIC);		

        copy_cpu(l.outputs*l.batch, l.i_cpu, 1, l.temp_cpu, 1);		
        mul_cpu(l.outputs*l.batch, l.g_cpu, 1, l.temp_cpu, 1);		
        mul_cpu(l.outputs*l.batch, l.f_cpu, 1, l.c_cpu, 1);			
        axpy_cpu(l.outputs*l.batch, 1, l.temp_cpu, 1, l.c_cpu, 1);	

        copy_cpu(l.outputs*l.batch, l.c_cpu, 1, l.h_cpu, 1);			
        activate_array(l.h_cpu, l.outputs*l.batch, TANH);		
        mul_cpu(l.outputs*l.batch, l.o_cpu, 1, l.h_cpu, 1);	

        copy_cpu(l.outputs*l.batch, l.c_cpu, 1, l.cell_cpu, 1);		
        copy_cpu(l.outputs*l.batch, l.h_cpu, 1, l.output, 1);

        state.input += l.inputs*l.batch;
        l.output    += l.outputs*l.batch;
        l.cell_cpu      += l.outputs*l.batch;

        increment_layer(&wf, 1);
        increment_layer(&wi, 1);
        increment_layer(&wg, 1);
        increment_layer(&wo, 1);

        increment_layer(&uf, 1);
        increment_layer(&ui, 1);
        increment_layer(&ug, 1);
        increment_layer(&uo, 1);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2bc8, %rsp           # imm = 0x2BC8
leaq 0x30a0(%rsp), %r14
leaq 0x2c00(%rsp), %r13
leaq 0x5b8(%rsp), %rbx
xorl %ebp, %ebp
movl $0x110, %edx            # imm = 0x110
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31c0
movl 0xf8(%r14), %r15d
movl %r15d, 0xf8(%rbx)
movq 0x468(%r13), %rsi
leaq 0x2728(%rsp), %r12
movl $0x4a0, %edx            # imm = 0x4A0
movq %r12, %rdi
callq 0x32b0
movq 0x478(%r13), %rsi
leaq 0x2288(%rsp), %r14
movl $0x4a0, %edx            # imm = 0x4A0
movq %r14, %rdi
callq 0x32b0
movq 0x488(%r13), %rsi
leaq 0x1de8(%rsp), %rbx
movl $0x4a0, %edx            # imm = 0x4A0
movq %rbx, %rdi
callq 0x32b0
movq 0x458(%r13), %rsi
leaq 0x1948(%rsp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x32b0
movq 0x460(%r13), %rsi
leaq 0x14a8(%rsp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x32b0
movq 0x470(%r13), %rsi
leaq 0x1008(%rsp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x32b0
movq 0x480(%r13), %rsi
leaq 0xb68(%rsp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x32b0
movq 0x450(%r13), %rsi
leaq 0x6c8(%rsp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x32b0
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
imull 0xc0(%r13), %edi
movq 0x260(%r12), %rsi
pushq $0x1
popq %r12
xorps %xmm0, %xmm0
movl %r12d, %edx
callq 0x1b449
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
imull 0xc0(%r13), %edi
movq 0x260(%r14), %rsi
xorps %xmm0, %xmm0
movl %r12d, %edx
callq 0x1b449
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
imull 0xc0(%r13), %edi
movq 0x260(%rbx), %rsi
xorps %xmm0, %xmm0
movl %r12d, %edx
callq 0x1b449
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
imull 0xc0(%r13), %edi
leaq 0x1948(%rsp), %rax
movq 0x260(%rax), %rsi
xorps %xmm0, %xmm0
movl %r12d, %edx
callq 0x1b449
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
imull 0xc0(%r13), %edi
leaq 0x14a8(%rsp), %rax
movq 0x260(%rax), %rsi
xorps %xmm0, %xmm0
movl %r12d, %edx
callq 0x1b449
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
imull 0xc0(%r13), %edi
leaq 0x1008(%rsp), %rax
movq 0x260(%rax), %rsi
xorps %xmm0, %xmm0
movl %r12d, %edx
callq 0x1b449
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
imull 0xc0(%r13), %edi
leaq 0xb68(%rsp), %rax
movq 0x260(%rax), %rsi
xorps %xmm0, %xmm0
movl %r12d, %edx
callq 0x1b449
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
imull 0xc0(%r13), %edi
leaq 0x6c8(%rsp), %rax
movq 0x260(%rax), %rsi
xorps %xmm0, %xmm0
movl %r12d, %edx
callq 0x1b449
testl %r15d, %r15d
je 0x3300d
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
imull 0xc0(%r13), %edi
movq 0x260(%r13), %rsi
pushq $0x1
popq %rdx
xorps %xmm0, %xmm0
callq 0x1b449
leaq 0x30a0(%rsp), %rax
movq 0xd8(%rax), %r12
leaq 0x5b8(%rsp), %r15
pushq $0x1
popq %rbx
cmpl 0xc0(%r13), %ebp
jge 0x33637
movq 0x310(%r13), %rax
movq %rax, 0x690(%rsp)
movl $0x94, %ecx
movq %rsp, %rdi
leaq 0x2728(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x4a0(%rsp), %rdi
pushq $0x22
popq %r14
movq %r14, %rcx
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x244cc
movl $0x94, %ecx
movq %rsp, %rdi
leaq 0x2288(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x4a0(%rsp), %rdi
movq %r14, %rcx
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x244cc
movl $0x94, %ecx
movq %rsp, %rdi
leaq 0x1de8(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x4a0(%rsp), %rdi
movq %r14, %rcx
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x244cc
movl $0x94, %ecx
movq %rsp, %rdi
leaq 0x1948(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x4a0(%rsp), %rdi
movq %r14, %rcx
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x244cc
movq %r12, 0x690(%rsp)
movl $0x94, %ecx
movq %rsp, %rdi
leaq 0x14a8(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x4a0(%rsp), %rdi
movq %r14, %rcx
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x244cc
movl $0x94, %ecx
movq %rsp, %rdi
leaq 0x1008(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x4a0(%rsp), %rdi
movq %r14, %rcx
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x244cc
movl $0x94, %ecx
movq %rsp, %rdi
leaq 0xb68(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x4a0(%rsp), %rdi
movq %r14, %rcx
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x244cc
movl $0x94, %ecx
movq %rsp, %rdi
leaq 0x6c8(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x4a0(%rsp), %rdi
movq %r14, %rcx
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x244cc
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
movq 0x2990(%rsp), %rsi
movq 0x358(%r13), %rcx
movl %ebx, %edx
movl %ebx, %r8d
callq 0x1b5a3
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
movq 0x1710(%rsp), %rsi
movq 0x358(%r13), %rcx
movss 0x18e2f(%rip), %xmm0    # 0x4c008
movl %ebx, %edx
movl %ebx, %r8d
callq 0x1b3ed
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
movq 0x24f0(%rsp), %rsi
movq 0x360(%r13), %rcx
movl %ebx, %edx
movl %ebx, %r8d
callq 0x1b5a3
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
movq 0x1270(%rsp), %rsi
movq 0x360(%r13), %rcx
movss 0x18de3(%rip), %xmm0    # 0x4c008
movl %ebx, %edx
movl %ebx, %r8d
callq 0x1b3ed
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
movq 0x2050(%rsp), %rsi
movq 0x368(%r13), %rcx
movl %ebx, %edx
movl %ebx, %r8d
callq 0x1b5a3
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
movq 0xdd0(%rsp), %rsi
movq 0x368(%r13), %rcx
movss 0x18d97(%rip), %xmm0    # 0x4c008
movl %ebx, %edx
movl %ebx, %r8d
callq 0x1b3ed
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
movq 0x1bb0(%rsp), %rsi
movq 0x370(%r13), %rcx
movl %ebx, %edx
movl %ebx, %r8d
callq 0x1b5a3
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
movq 0x930(%rsp), %rsi
movq 0x370(%r13), %rcx
movss 0x18d4b(%rip), %xmm0    # 0x4c008
movl %ebx, %edx
movl %ebx, %r8d
callq 0x1b3ed
movq 0x358(%r13), %rdi
movl 0x48(%r13), %esi
imull 0x58(%r13), %esi
xorl %edx, %edx
callq 0x1a4f8
movq 0x360(%r13), %rdi
movl 0x48(%r13), %esi
imull 0x58(%r13), %esi
xorl %edx, %edx
callq 0x1a4f8
movq 0x368(%r13), %rdi
movl 0x48(%r13), %esi
imull 0x58(%r13), %esi
movq %r12, %r14
movl %ebp, %r12d
pushq $0x5
popq %rbp
movl %ebp, %edx
callq 0x1a4f8
movq 0x370(%r13), %rdi
movl 0x48(%r13), %esi
imull 0x58(%r13), %esi
xorl %edx, %edx
callq 0x1a4f8
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
movq 0x360(%r13), %rsi
movq 0x320(%r13), %rcx
movl %ebx, %edx
movl %ebx, %r8d
callq 0x1b5a3
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
movq 0x368(%r13), %rsi
movq 0x320(%r13), %rcx
movl %ebx, %edx
movl %ebx, %r8d
callq 0x1b353
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
movq 0x358(%r13), %rsi
movq 0x378(%r13), %rcx
movl %ebx, %edx
movl %ebx, %r8d
callq 0x1b353
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
movq 0x320(%r13), %rsi
movq 0x378(%r13), %rcx
movss 0x18c5a(%rip), %xmm0    # 0x4c008
movl %ebx, %edx
movl %ebx, %r8d
callq 0x1b3ed
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
movq 0x378(%r13), %rsi
movq 0x310(%r13), %rcx
movl %ebx, %edx
movl %ebx, %r8d
callq 0x1b5a3
movq 0x310(%r13), %rdi
movl 0x48(%r13), %esi
imull 0x58(%r13), %esi
movl %ebp, %edx
movl %r12d, %ebp
callq 0x1a4f8
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
movq 0x370(%r13), %rsi
movq 0x310(%r13), %rcx
movl %ebx, %edx
movl %ebx, %r8d
callq 0x1b353
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
movq 0x378(%r13), %rsi
movq 0x350(%r13), %rcx
movl %ebx, %edx
movl %ebx, %r8d
callq 0x1b5a3
movl 0x48(%r13), %edi
imull 0x58(%r13), %edi
movq 0x310(%r13), %rsi
movq 0x268(%r13), %rcx
movl %ebx, %edx
movl %ebx, %r8d
callq 0x1b5a3
movslq 0x54(%r13), %rax
movslq 0x48(%r13), %rcx
movslq 0x58(%r13), %rdx
imulq %rcx, %rdx
shlq $0x2, %rdx
addq %rdx, 0x268(%r13)
addq %rdx, 0x350(%r13)
movl 0x2770(%rsp), %edx
imull 0x2780(%rsp), %edx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, 0x2990(%rsp)
addq %rdx, 0x2988(%rsp)
addq %rdx, 0x29e8(%rsp)
addq %rdx, 0x29f0(%rsp)
movl 0x22d0(%rsp), %edx
imull 0x22e0(%rsp), %edx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, 0x24f0(%rsp)
addq %rdx, 0x24e8(%rsp)
addq %rdx, 0x2548(%rsp)
addq %rdx, 0x2550(%rsp)
movl 0x1e30(%rsp), %edx
imull 0x1e40(%rsp), %edx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, 0x2050(%rsp)
addq %rdx, 0x2048(%rsp)
addq %rdx, 0x20a8(%rsp)
addq %rdx, 0x20b0(%rsp)
movl 0x1990(%rsp), %edx
imull 0x19a0(%rsp), %edx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, 0x1bb0(%rsp)
addq %rdx, 0x1ba8(%rsp)
addq %rdx, 0x1c08(%rsp)
addq %rdx, 0x1c10(%rsp)
movl 0x14f0(%rsp), %edx
imull 0x1500(%rsp), %edx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, 0x1710(%rsp)
addq %rdx, 0x1708(%rsp)
addq %rdx, 0x1768(%rsp)
addq %rdx, 0x1770(%rsp)
movl 0x1050(%rsp), %edx
imull 0x1060(%rsp), %edx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, 0x1270(%rsp)
addq %rdx, 0x1268(%rsp)
addq %rdx, 0x12c8(%rsp)
addq %rdx, 0x12d0(%rsp)
movl 0xbb0(%rsp), %edx
imull 0xbc0(%rsp), %edx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, 0xdd0(%rsp)
addq %rdx, 0xdc8(%rsp)
addq %rdx, 0xe28(%rsp)
addq %rdx, 0xe30(%rsp)
movl 0x710(%rsp), %edx
imull 0x720(%rsp), %edx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, 0x930(%rsp)
imulq %rcx, %rax
addq %rdx, 0x928(%rsp)
leaq (%r14,%rax,4), %r12
addq %rdx, 0x988(%rsp)
addq %rdx, 0x990(%rsp)
incl %ebp
jmp 0x33027
addq $0x2bc8, %rsp           # imm = 0x2BC8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq