// File: /workspace/github_c_makefile_star2_O0/aligusnet[P]morpheus/src/statistics.c
// Function: morpheus_column_stddev_m
void morpheus_column_stddev_m(morpheus_layout_e layout,
                              int nrows, int ncols,
                              const double *means,
                              const double *x,
                              double *s) {
  if (layout == morpheus_row_major) {
    for (int j = 0; j < ncols; ++j) {
      s[j] = 0;
    }
    for (int i = 0; i < nrows; ++i) {
      const double *row = x + i*ncols;
      for (int j = 0; j < ncols; ++j) {
        double v = row[j] - means[j];
        s[j] += v*v;
      }
    }
  } else if (layout == morpheus_col_major) {
    for (int j = 0; j < ncols; ++j) {
      const double *column = &x[j*nrows];
      s[j] = 0;
      for (int i = 0; i < nrows; ++i) {
        double v = column[i] - means[j];
        s[j] += v*v;
      }
    }
  } else {
    perror("unkwnown matrix layout");
    assert(0);
  }
  for (int j = 0; j < ncols; ++j) {
    s[j] = sqrt(s[j]/(nrows-1));
  }
}

// Assembly:
subq $0x78, %rsp
movl %edi, 0x74(%rsp)
movl %esi, 0x70(%rsp)
movl %edx, 0x6c(%rsp)
movq %rcx, 0x60(%rsp)
movq %r8, 0x58(%rsp)
movq %r9, 0x50(%rsp)
cmpl $0x15, 0x74(%rsp)
jne 0x7220
movl $0x0, 0x4c(%rsp)
movl 0x4c(%rsp), %eax
cmpl 0x6c(%rsp), %eax
jge 0x716b
movq 0x50(%rsp), %rax
movslq 0x4c(%rsp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl 0x4c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4c(%rsp)
jmp 0x7142
movl $0x0, 0x48(%rsp)
movl 0x48(%rsp), %eax
cmpl 0x70(%rsp), %eax
jge 0x721b
movq 0x58(%rsp), %rax
movl 0x48(%rsp), %ecx
imull 0x6c(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x40(%rsp)
movl $0x0, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
cmpl 0x6c(%rsp), %eax
jge 0x7209
movq 0x40(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x60(%rsp), %rax
movslq 0x3c(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x30(%rsp), %xmm0
movsd 0x30(%rsp), %xmm2
movq 0x50(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x71a6
jmp 0x720b
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x7173
jmp 0x731c
cmpl $0x16, 0x74(%rsp)
jne 0x72ef
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x6c(%rsp), %eax
jge 0x72ed
movq 0x58(%rsp), %rax
movl 0x2c(%rsp), %ecx
imull 0x70(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x50(%rsp), %rax
movslq 0x2c(%rsp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x70(%rsp), %eax
jge 0x72db
movq 0x20(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x60(%rsp), %rax
movslq 0x2c(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x10(%rsp), %xmm0
movsd 0x10(%rsp), %xmm2
movq 0x50(%rsp), %rax
movslq 0x2c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x7278
jmp 0x72dd
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x7233
jmp 0x731a
leaq 0x5a92(%rip), %rdi      # 0xcd88
callq 0x1110
leaq 0x5a9d(%rip), %rdi      # 0xcd9f
leaq 0x5d98(%rip), %rsi      # 0xd0a1
movl $0x51, %edx
leaq 0x5d9d(%rip), %rcx      # 0xd0b2
callq 0x1080
jmp 0x731c
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x6c(%rsp), %eax
jge 0x736d
movq 0x50(%rsp), %rax
movslq 0xc(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movl 0x70(%rsp), %eax
subl $0x1, %eax
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
callq 0x1130
movq 0x50(%rsp), %rax
movslq 0xc(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x7324
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)