// File: /workspace/github_c_makefile_star2_O0/SimpleDoger[P]Darknet_CPU_Only/blas.c
// Function: reorg_cpu
void reorg_cpu(float *x, int w, int h, int c, int batch, int stride, int forward, float *out)
{
    int b,i,j,k;
    int out_c = c/(stride*stride);

    for(b = 0; b < batch; ++b){
        for(k = 0; k < c; ++k){
            for(j = 0; j < h; ++j){
                for(i = 0; i < w; ++i){
                    int in_index  = i + w*(j + h*(k + c*b));
                    int c2 = k % out_c;
                    int offset = k / out_c;
                    int w2 = i*stride + offset % stride;
                    int h2 = j*stride + offset / stride;
                    int out_index = w2 + w*stride*(h2 + h*stride*(c2 + out_c*b));
                    if(forward) out[out_index] = x[in_index];
                    else out[in_index] = x[out_index];
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movl %r9d, -0x1c(%rbp)
movl -0x14(%rbp), %eax
movl -0x1c(%rbp), %ecx
imull -0x1c(%rbp), %ecx
cltd
idivl %ecx
movl %eax, -0x30(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x2eb48
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x2eb38
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x2eb28
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x2eb18
movl -0x24(%rbp), %eax
movl -0xc(%rbp), %ecx
movl -0x28(%rbp), %edx
movl -0x10(%rbp), %esi
movl -0x2c(%rbp), %edi
movl -0x14(%rbp), %r8d
imull -0x20(%rbp), %r8d
addl %r8d, %edi
imull %edi, %esi
addl %esi, %edx
imull %edx, %ecx
addl %ecx, %eax
movl %eax, -0x34(%rbp)
movl -0x2c(%rbp), %eax
cltd
idivl -0x30(%rbp)
movl %edx, -0x38(%rbp)
movl -0x2c(%rbp), %eax
cltd
idivl -0x30(%rbp)
movl %eax, -0x3c(%rbp)
movl -0x24(%rbp), %eax
imull -0x1c(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x3c(%rbp), %eax
cltd
idivl -0x1c(%rbp)
movl -0x50(%rbp), %eax
addl %edx, %eax
movl %eax, -0x40(%rbp)
movl -0x28(%rbp), %eax
imull -0x1c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x3c(%rbp), %eax
cltd
idivl -0x1c(%rbp)
movl %eax, %ecx
movl -0x4c(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x44(%rbp)
movl -0x40(%rbp), %eax
movl -0xc(%rbp), %ecx
imull -0x1c(%rbp), %ecx
movl -0x44(%rbp), %edx
movl -0x10(%rbp), %esi
imull -0x1c(%rbp), %esi
movl -0x38(%rbp), %edi
movl -0x30(%rbp), %r8d
imull -0x20(%rbp), %r8d
addl %r8d, %edi
imull %edi, %esi
addl %esi, %edx
imull %edx, %ecx
addl %ecx, %eax
movl %eax, -0x48(%rbp)
cmpl $0x0, 0x10(%rbp)
je 0x2eaee
movq -0x8(%rbp), %rax
movslq -0x34(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movq 0x18(%rbp), %rax
movslq -0x48(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
jmp 0x2eb08
movq -0x8(%rbp), %rax
movslq -0x48(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movq 0x18(%rbp), %rax
movslq -0x34(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
jmp 0x2eb0a
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2ea20
jmp 0x2eb1a
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x2ea0d
jmp 0x2eb2a
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x2e9fa
jmp 0x2eb3a
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2e9e7
popq %rbp
retq
nopw (%rax,%rax)