// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/rnn_layer.c
// Function: forward_rnn_layer
void forward_rnn_layer(layer l, network net)
{
    network s = net;
    s.train = net.train;
    int i;
    layer input_layer = *(l.input_layer);
    layer self_layer = *(l.self_layer);
    layer output_layer = *(l.output_layer);

    fill_cpu(l.outputs * l.batch * l.steps, 0, output_layer.delta, 1);
    fill_cpu(l.outputs * l.batch * l.steps, 0, self_layer.delta, 1);
    fill_cpu(l.outputs * l.batch * l.steps, 0, input_layer.delta, 1);
    if(net.train) fill_cpu(l.outputs * l.batch, 0, l.state, 1);

    for (i = 0; i < l.steps; ++i) {
        s.input = net.input;
        forward_connected_layer(input_layer, s);

        s.input = l.state;
        forward_connected_layer(self_layer, s);

        float *old_state = l.state;
        if(net.train) l.state += l.outputs*l.batch;
        if(l.shortcut){
            copy_cpu(l.outputs * l.batch, old_state, 1, l.state, 1);
        }else{
            fill_cpu(l.outputs * l.batch, 0, l.state, 1);
        }
        axpy_cpu(l.outputs * l.batch, 1, input_layer.output, 1, l.state, 1);
        axpy_cpu(l.outputs * l.batch, 1, self_layer.output, 1, l.state, 1);

        s.input = l.state;
        forward_connected_layer(output_layer, s);

        net.input += l.inputs*l.batch;
        increment_layer(&input_layer, 1);
        increment_layer(&self_layer, 1);
        increment_layer(&output_layer, 1);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x14e0, %rsp           # imm = 0x14E0
leaq 0x4b0(%rbp), %rsi
movq %rsi, -0xf08(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0xf10(%rbp)
leaq -0x110(%rbp), %rdi
movl $0x110, %edx            # imm = 0x110
callq 0x3280
movq -0xf10(%rbp), %rax
movq -0xf08(%rbp), %rcx
movl 0xf8(%rcx), %ecx
movl %ecx, -0x18(%rbp)
movq 0x390(%rax), %rsi
leaq -0x5b8(%rbp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0xf10(%rbp), %rax
movq 0x398(%rax), %rsi
leaq -0xa58(%rbp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0xf10(%rbp), %rax
movq 0x3a0(%rax), %rsi
leaq -0xef8(%rbp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0xf10(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
imull 0xc0(%rax), %edi
movq -0xc98(%rbp), %rsi
xorps %xmm0, %xmm0
movl $0x1, %edx
callq 0x2f740
movq -0xf10(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
imull 0xc0(%rax), %edi
movq -0x7f8(%rbp), %rsi
xorps %xmm0, %xmm0
movl $0x1, %edx
callq 0x2f740
movq -0xf10(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
imull 0xc0(%rax), %edi
movq -0x358(%rbp), %rsi
xorps %xmm0, %xmm0
movl $0x1, %edx
callq 0x2f740
movq -0xf08(%rbp), %rax
cmpl $0x0, 0xf8(%rax)
je 0x48b1f
movq -0xf10(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
movq 0x1e0(%rax), %rsi
xorps %xmm0, %xmm0
movl $0x1, %edx
callq 0x2f740
movl $0x0, -0x114(%rbp)
movq -0xf10(%rbp), %rcx
movl -0x114(%rbp), %eax
cmpl 0xc0(%rcx), %eax
jge 0x48da7
movq -0xf08(%rbp), %rax
movq 0xd8(%rax), %rax
movq %rax, -0x38(%rbp)
movq %rsp, %rdi
movq %rdi, -0xf20(%rbp)
movl $0x94, %ecx
leaq -0x5b8(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0xf20(%rbp), %rdi
addq $0x4a0, %rdi            # imm = 0x4A0
movl $0x22, %ecx
leaq -0x110(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x3c6d0
movq -0xf10(%rbp), %rax
movq 0x1e0(%rax), %rax
movq %rax, -0x38(%rbp)
movq %rsp, %rdi
movq %rdi, -0xf18(%rbp)
movl $0x94, %ecx
leaq -0xa58(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0xf18(%rbp), %rdi
addq $0x4a0, %rdi            # imm = 0x4A0
movl $0x22, %ecx
leaq -0x110(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x3c6d0
movq -0xf10(%rbp), %rcx
movq -0xf08(%rbp), %rax
movq 0x1e0(%rcx), %rcx
movq %rcx, -0xf00(%rbp)
cmpl $0x0, 0xf8(%rax)
je 0x48c27
movq -0xf10(%rbp), %rax
movl 0x58(%rax), %edx
imull 0x48(%rax), %edx
movq 0x1e0(%rax), %rcx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
movq %rcx, 0x1e0(%rax)
movq -0xf10(%rbp), %rax
cmpl $0x0, 0x44(%rax)
je 0x48c60
movq -0xf10(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
movq -0xf00(%rbp), %rsi
movq 0x1e0(%rax), %rcx
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f960
jmp 0x48c82
movq -0xf10(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
movq 0x1e0(%rax), %rsi
xorps %xmm0, %xmm0
movl $0x1, %edx
callq 0x2f740
movq -0xf10(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
movq -0x350(%rbp), %rsi
movq 0x1e0(%rax), %rcx
movss 0x28366(%rip), %xmm0    # 0x7100c
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f680
movq -0xf10(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
movq -0x7f0(%rbp), %rsi
movq 0x1e0(%rax), %rcx
movss 0x28334(%rip), %xmm0    # 0x7100c
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f680
movq -0xf10(%rbp), %rax
movq 0x1e0(%rax), %rax
movq %rax, -0x38(%rbp)
movq %rsp, %rdi
movq %rdi, -0xf28(%rbp)
movl $0x94, %ecx
leaq -0xef8(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0xf28(%rbp), %rdi
addq $0x4a0, %rdi            # imm = 0x4A0
movl $0x22, %ecx
leaq -0x110(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x3c6d0
movq -0xf10(%rbp), %rcx
movq -0xf08(%rbp), %rax
movl 0x54(%rcx), %edx
imull 0x48(%rcx), %edx
movq 0xd8(%rax), %rcx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
movq %rcx, 0xd8(%rax)
leaq -0x5b8(%rbp), %rdi
movl $0x1, %esi
callq 0x492c0
leaq -0xa58(%rbp), %rdi
movl $0x1, %esi
callq 0x492c0
leaq -0xef8(%rbp), %rdi
movl $0x1, %esi
callq 0x492c0
movl -0x114(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x114(%rbp)
jmp 0x48b29
addq $0x14e0, %rsp           # imm = 0x14E0
popq %rbp
retq