// File: /workspace/github_c_makefile_star2_O0/aligusnet[P]morpheus/src/statistics.c
// Function: morpheus_row_stddev_m
void morpheus_row_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 i = 0; i < nrows; ++i) {
      const double *row = x + i*ncols;
      s[i] = 0;
      for (int j = 0; j < ncols; ++j) {
        double v = row[j] - means[i];
        s[i] += v*v;
      }
    }
  } else if (layout == morpheus_col_major) {
    for (int i = 0; i < nrows; ++i) {
      s[i] = 0;
    }
    for (int j = 0; j < ncols; ++j) {
      const double *column = x + j*nrows;
      for (int i = 0; i < nrows; ++i) {
        double v = column[i] - means[i];
        s[i] += v*v;
      }
    }
  } else {
    perror("unkwnown matrix layout");
    assert(0);
  }
  for (int i = 0; i < nrows; ++i) {
    s[i] = sqrt(s[i]/(ncols-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 0x7471
movl $0x0, 0x4c(%rsp)
movl 0x4c(%rsp), %eax
cmpl 0x70(%rsp), %eax
jge 0x746c
movq 0x58(%rsp), %rax
movl 0x4c(%rsp), %ecx
imull 0x6c(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x40(%rsp)
movq 0x50(%rsp), %rax
movslq 0x4c(%rsp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
cmpl 0x6c(%rsp), %eax
jge 0x745a
movq 0x40(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x60(%rsp), %rax
movslq 0x4c(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x30(%rsp), %xmm0
movsd 0x30(%rsp), %xmm2
movq 0x50(%rsp), %rax
movslq 0x4c(%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 0x73f7
jmp 0x745c
movl 0x4c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4c(%rsp)
jmp 0x73b2
jmp 0x758c
cmpl $0x16, 0x74(%rsp)
jne 0x755f
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x70(%rsp), %eax
jge 0x74ad
movq 0x50(%rsp), %rax
movslq 0x2c(%rsp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x7484
movl $0x0, 0x28(%rsp)
movl 0x28(%rsp), %eax
cmpl 0x6c(%rsp), %eax
jge 0x755d
movq 0x58(%rsp), %rax
movl 0x28(%rsp), %ecx
imull 0x70(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x20(%rsp)
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x70(%rsp), %eax
jge 0x754b
movq 0x20(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x60(%rsp), %rax
movslq 0x1c(%rsp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, 0x10(%rsp)
movsd 0x10(%rsp), %xmm0
movsd 0x10(%rsp), %xmm2
movq 0x50(%rsp), %rax
movslq 0x1c(%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 0x74e8
jmp 0x754d
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x74b5
jmp 0x758a
leaq 0x5822(%rip), %rdi      # 0xcd88
callq 0x1110
leaq 0x582d(%rip), %rdi      # 0xcd9f
leaq 0x5b28(%rip), %rsi      # 0xd0a1
movl $0x73, %edx
leaq 0x5b92(%rip), %rcx      # 0xd117
callq 0x1080
jmp 0x758c
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x70(%rsp), %eax
jge 0x75dd
movq 0x50(%rsp), %rax
movslq 0xc(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movl 0x6c(%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 0x7594
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)