// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/gru_layer.c
// Function: forward_gru_layer
void forward_gru_layer(layer l, network net)
{
    network s = net;
    s.train = net.train;
    int i;
    layer uz = *(l.uz);
    layer ur = *(l.ur);
    layer uh = *(l.uh);

    layer wz = *(l.wz);
    layer wr = *(l.wr);
    layer wh = *(l.wh);

    fill_cpu(l.outputs * l.batch * l.steps, 0, uz.delta, 1);
    fill_cpu(l.outputs * l.batch * l.steps, 0, ur.delta, 1);
    fill_cpu(l.outputs * l.batch * l.steps, 0, uh.delta, 1);

    fill_cpu(l.outputs * l.batch * l.steps, 0, wz.delta, 1);
    fill_cpu(l.outputs * l.batch * l.steps, 0, wr.delta, 1);
    fill_cpu(l.outputs * l.batch * l.steps, 0, wh.delta, 1);
    if(net.train) {
        fill_cpu(l.outputs * l.batch * l.steps, 0, l.delta, 1);
        copy_cpu(l.outputs*l.batch, l.state, 1, l.prev_state, 1);
    }

    for (i = 0; i < l.steps; ++i) {
        s.input = l.state;
        forward_connected_layer(wz, s);
        forward_connected_layer(wr, s);

        s.input = net.input;
        forward_connected_layer(uz, s);
        forward_connected_layer(ur, s);
        forward_connected_layer(uh, s);


        copy_cpu(l.outputs*l.batch, uz.output, 1, l.z_cpu, 1);
        axpy_cpu(l.outputs*l.batch, 1, wz.output, 1, l.z_cpu, 1);

        copy_cpu(l.outputs*l.batch, ur.output, 1, l.r_cpu, 1);
        axpy_cpu(l.outputs*l.batch, 1, wr.output, 1, l.r_cpu, 1);

        activate_array(l.z_cpu, l.outputs*l.batch, LOGISTIC);
        activate_array(l.r_cpu, l.outputs*l.batch, LOGISTIC);

        copy_cpu(l.outputs*l.batch, l.state, 1, l.forgot_state, 1);
        mul_cpu(l.outputs*l.batch, l.r_cpu, 1, l.forgot_state, 1);

        s.input = l.forgot_state;
        forward_connected_layer(wh, s);

        copy_cpu(l.outputs*l.batch, uh.output, 1, l.h_cpu, 1);
        axpy_cpu(l.outputs*l.batch, 1, wh.output, 1, l.h_cpu, 1);

        if(l.tanh){
            activate_array(l.h_cpu, l.outputs*l.batch, TANH);
        } else {
            activate_array(l.h_cpu, l.outputs*l.batch, LOGISTIC);
        }

        weighted_sum_cpu(l.state, l.h_cpu, l.z_cpu, l.outputs*l.batch, l.output);

        copy_cpu(l.outputs*l.batch, l.output, 1, l.state, 1);

        net.input += l.inputs*l.batch;
        l.output += l.outputs*l.batch;
        increment_layer(&uz, 1);
        increment_layer(&ur, 1);
        increment_layer(&uh, 1);

        increment_layer(&wz, 1);
        increment_layer(&wr, 1);
        increment_layer(&wh, 1);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x22d0, %rsp           # imm = 0x22D0
leaq 0x4b0(%rbp), %rsi
movq %rsi, -0x1ce0(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x1ce8(%rbp)
leaq -0x110(%rbp), %rdi
movl $0x110, %edx            # imm = 0x110
callq 0x3280
movq -0x1ce8(%rbp), %rax
movq -0x1ce0(%rbp), %rcx
movl 0xf8(%rcx), %ecx
movl %ecx, -0x18(%rbp)
movq 0x428(%rax), %rsi
leaq -0x5b8(%rbp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0x1ce8(%rbp), %rax
movq 0x438(%rax), %rsi
leaq -0xa58(%rbp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0x1ce8(%rbp), %rax
movq 0x448(%rax), %rsi
leaq -0xef8(%rbp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0x1ce8(%rbp), %rax
movq 0x420(%rax), %rsi
leaq -0x1398(%rbp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0x1ce8(%rbp), %rax
movq 0x430(%rax), %rsi
leaq -0x1838(%rbp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0x1ce8(%rbp), %rax
movq 0x440(%rax), %rsi
leaq -0x1cd8(%rbp), %rdi
movl $0x4a0, %edx            # imm = 0x4A0
callq 0x3280
movq -0x1ce8(%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 -0x1ce8(%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 -0x1ce8(%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 -0x1ce8(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
imull 0xc0(%rax), %edi
movq -0x1138(%rbp), %rsi
xorps %xmm0, %xmm0
movl $0x1, %edx
callq 0x2f740
movq -0x1ce8(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
imull 0xc0(%rax), %edi
movq -0x15d8(%rbp), %rsi
xorps %xmm0, %xmm0
movl $0x1, %edx
callq 0x2f740
movq -0x1ce8(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
imull 0xc0(%rax), %edi
movq -0x1a78(%rbp), %rsi
xorps %xmm0, %xmm0
movl $0x1, %edx
callq 0x2f740
movq -0x1ce0(%rbp), %rax
cmpl $0x0, 0xf8(%rax)
je 0x49b58
movq -0x1ce8(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
imull 0xc0(%rax), %edi
movq 0x260(%rax), %rsi
xorps %xmm0, %xmm0
movl $0x1, %edx
callq 0x2f740
movq -0x1ce8(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
movq 0x1e0(%rax), %rsi
movq 0x1e8(%rax), %rcx
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f960
movl $0x0, -0x114(%rbp)
movq -0x1ce8(%rbp), %rcx
movl -0x114(%rbp), %eax
cmpl 0xc0(%rcx), %eax
jge 0x4a01f
movq -0x1ce8(%rbp), %rax
movq 0x1e0(%rax), %rax
movq %rax, -0x38(%rbp)
movq %rsp, %rdi
movq %rdi, -0x1d18(%rbp)
movl $0x94, %ecx
leaq -0x1398(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x1d18(%rbp), %rdi
addq $0x4a0, %rdi            # imm = 0x4A0
movl $0x22, %ecx
leaq -0x110(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x3c6d0
movq %rsp, %rdi
movq %rdi, -0x1d10(%rbp)
movl $0x94, %ecx
leaq -0x1838(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x1d10(%rbp), %rdi
addq $0x4a0, %rdi            # imm = 0x4A0
movl $0x22, %ecx
leaq -0x110(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x3c6d0
movq -0x1ce0(%rbp), %rax
movq 0xd8(%rax), %rax
movq %rax, -0x38(%rbp)
movq %rsp, %rdi
movq %rdi, -0x1d08(%rbp)
movl $0x94, %ecx
leaq -0x5b8(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x1d08(%rbp), %rdi
addq $0x4a0, %rdi            # imm = 0x4A0
movl $0x22, %ecx
leaq -0x110(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x3c6d0
movq %rsp, %rdi
movq %rdi, -0x1d00(%rbp)
movl $0x94, %ecx
leaq -0xa58(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x1d00(%rbp), %rdi
addq $0x4a0, %rdi            # imm = 0x4A0
movl $0x22, %ecx
leaq -0x110(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x3c6d0
movq %rsp, %rdi
movq %rdi, -0x1cf8(%rbp)
movl $0x94, %ecx
leaq -0xef8(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x1cf8(%rbp), %rdi
addq $0x4a0, %rdi            # imm = 0x4A0
movl $0x22, %ecx
leaq -0x110(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x3c6d0
movq -0x1ce8(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
movq -0x350(%rbp), %rsi
movq 0x300(%rax), %rcx
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f960
movq -0x1ce8(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
movq -0x1130(%rbp), %rsi
movq 0x300(%rax), %rcx
movss 0x272f8(%rip), %xmm0    # 0x7100c
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f680
movq -0x1ce8(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
movq -0x7f0(%rbp), %rsi
movq 0x308(%rax), %rcx
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f960
movq -0x1ce8(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
movq -0x15d0(%rbp), %rsi
movq 0x308(%rax), %rcx
movss 0x2729c(%rip), %xmm0    # 0x7100c
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f680
movq -0x1ce8(%rbp), %rax
movq 0x300(%rax), %rdi
movl 0x58(%rax), %esi
imull 0x48(%rax), %esi
xorl %edx, %edx
callq 0x2dfa0
movq -0x1ce8(%rbp), %rax
movq 0x308(%rax), %rdi
movl 0x58(%rax), %esi
imull 0x48(%rax), %esi
xorl %edx, %edx
callq 0x2dfa0
movq -0x1ce8(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
movq 0x1e0(%rax), %rsi
movq 0x1f0(%rax), %rcx
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f960
movq -0x1ce8(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
movq 0x308(%rax), %rsi
movq 0x1f0(%rax), %rcx
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f5a0
movq -0x1ce8(%rbp), %rax
movq 0x1f0(%rax), %rax
movq %rax, -0x38(%rbp)
movq %rsp, %rdi
movq %rdi, -0x1cf0(%rbp)
movl $0x94, %ecx
leaq -0x1cd8(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x1cf0(%rbp), %rdi
addq $0x4a0, %rdi            # imm = 0x4A0
movl $0x22, %ecx
leaq -0x110(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
callq 0x3c6d0
movq -0x1ce8(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
movq -0xc90(%rbp), %rsi
movq 0x310(%rax), %rcx
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f960
movq -0x1ce8(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
movq -0x1a70(%rbp), %rsi
movq 0x310(%rax), %rcx
movss 0x27167(%rip), %xmm0    # 0x7100c
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f680
movq -0x1ce8(%rbp), %rax
cmpl $0x0, 0x120(%rax)
je 0x49ee4
movq -0x1ce8(%rbp), %rax
movq 0x310(%rax), %rdi
movl 0x58(%rax), %esi
imull 0x48(%rax), %esi
movl $0x5, %edx
callq 0x2dfa0
jmp 0x49f00
movq -0x1ce8(%rbp), %rax
movq 0x310(%rax), %rdi
movl 0x58(%rax), %esi
imull 0x48(%rax), %esi
xorl %edx, %edx
callq 0x2dfa0
movq -0x1ce8(%rbp), %rax
movq 0x1e0(%rax), %rdi
movq 0x310(%rax), %rsi
movq 0x300(%rax), %rdx
movl 0x58(%rax), %ecx
imull 0x48(%rax), %ecx
movq 0x268(%rax), %r8
callq 0x2ec90
movq -0x1ce8(%rbp), %rax
movl 0x58(%rax), %edi
imull 0x48(%rax), %edi
movq 0x268(%rax), %rsi
movq 0x1e0(%rax), %rcx
movl $0x1, %r8d
movl %r8d, %edx
callq 0x2f960
movq -0x1ce0(%rbp), %rcx
movq -0x1ce8(%rbp), %rax
movl 0x54(%rax), %esi
imull 0x48(%rax), %esi
movq 0xd8(%rcx), %rdx
movslq %esi, %rsi
shlq $0x2, %rsi
addq %rsi, %rdx
movq %rdx, 0xd8(%rcx)
movl 0x58(%rax), %edx
imull 0x48(%rax), %edx
movq 0x268(%rax), %rcx
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
movq %rcx, 0x268(%rax)
leaq -0x5b8(%rbp), %rdi
movl $0x1, %esi
callq 0x4a1f0
leaq -0xa58(%rbp), %rdi
movl $0x1, %esi
callq 0x4a1f0
leaq -0xef8(%rbp), %rdi
movl $0x1, %esi
callq 0x4a1f0
leaq -0x1398(%rbp), %rdi
movl $0x1, %esi
callq 0x4a1f0
leaq -0x1838(%rbp), %rdi
movl $0x1, %esi
callq 0x4a1f0
leaq -0x1cd8(%rbp), %rdi
movl $0x1, %esi
callq 0x4a1f0
movl -0x114(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x114(%rbp)
jmp 0x49b62
addq $0x22d0, %rsp           # imm = 0x22D0
popq %rbp
retq
nopl (%rax,%rax)