// File: /workspace/github_c_makefile_star2_O3/pavel-demin[P]ft8d-c/ft8d.c
// Function: process
void process(sync_t *cand)
{
  int i, j, k, l, m;
  real_t s[8], d, sum, avg, sig;

  for(i = 0; i < 2; ++i)
  {
    for(j = 0; j < 29; ++j)
    {
      k = cand->j * NFFT + cand->i + (i * 36 + j + 7) * NSSY * NFFT;

      for(l = 0; l < 8; ++l)
      {
        m = k + graymap[l] * NFOS;
        s[l] = (m >= 0 && m < NSYM * NFFT) ? map[m] > 0 ? log10f(map[m]) : -10 : -10;
      }

      k = i * 87 + j * 3;

      llr[k + 0] = max(s[4], s[5], s[6], s[7]) - max(s[0], s[1], s[2], s[3]);
      llr[k + 1] = max(s[2], s[3], s[6], s[7]) - max(s[0], s[1], s[4], s[5]);
      llr[k + 2] = max(s[1], s[3], s[5], s[7]) - max(s[0], s[2], s[4], s[6]);
    }
  }

  sum = 0;
  for(i = 0; i < N; ++i)
  {
    sum += llr[i];
  }
  avg = sum / N;

  sum = 0;
  for(i = 0; i < N; ++i)
  {
    d = llr[i] - avg;
    sum += d * d;
  }
  sig = sqrtf(sum / (N - 1)) / 4;

  for(i = 0; i < N; ++i)
  {
    llr[i] /= sig;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movb $0x1, %cl
xorl %eax, %eax
leaq 0x5390(%rip), %r15      # 0xb7e0
movss 0x2467(%rip), %xmm11    # 0x88c0
xorps %xmm12, %xmm12
leaq 0x6d8c(%rip), %r13      # 0xd1f0
movl %ecx, 0xc(%rsp)
leaq (,%rax,4), %rcx
leaq (%rcx,%rcx,8), %rcx
movq %rcx, 0x40(%rsp)
imulq $0x57, %rax, %rax
movq %rax, 0x38(%rsp)
xorl %ebp, %ebp
imull $0xc80, 0x4(%rbx), %eax # imm = 0xC80
movq 0x40(%rsp), %rcx
addl %ebp, %ecx
imull $0x7d00, %ecx, %ecx     # imm = 0x7D00
addl (%rbx), %ecx
leal (%rax,%rcx), %r14d
addl $0x36b00, %r14d         # imm = 0x36B00
xorl %r12d, %r12d
movl (%r12,%r15), %eax
leal (%rax,%rax,4), %eax
addl %r14d, %eax
movaps %xmm11, %xmm0
cmpl $0x2dc07f, %eax         # imm = 0x2DC07F
ja 0x64ea
movq 0x6d1c(%rip), %rcx      # 0xd1e0
movl %eax, %eax
movss (%rcx,%rax,4), %xmm1
ucomiss %xmm12, %xmm1
movaps %xmm11, %xmm0
jbe 0x64ea
movaps %xmm1, %xmm0
callq 0x10d0
xorps %xmm12, %xmm12
movss 0x23d6(%rip), %xmm11    # 0x88c0
movss %xmm0, 0x10(%rsp,%r12)
addq $0x4, %r12
cmpq $0x20, %r12
jne 0x64a8
leaq (,%rbp,2), %rax
addq %rbp, %rax
addq 0x38(%rsp), %rax
movss 0x20(%rsp), %xmm0
movss 0x24(%rsp), %xmm1
movss 0x28(%rsp), %xmm4
movss 0x2c(%rsp), %xmm2
movaps %xmm0, %xmm3
maxss %xmm4, %xmm0
maxss %xmm2, %xmm4
movss 0x10(%rsp), %xmm5
movss 0x14(%rsp), %xmm6
movss 0x18(%rsp), %xmm7
movss 0x1c(%rsp), %xmm8
movaps %xmm5, %xmm9
maxss %xmm6, %xmm9
unpcklps %xmm7, %xmm3            # xmm3 = xmm3[0],xmm7[0],xmm3[1],xmm7[1]
movaps %xmm1, %xmm10
unpcklps %xmm8, %xmm10           # xmm10 = xmm10[0],xmm8[0],xmm10[1],xmm8[1]
maxps %xmm10, %xmm3
shufps $0x0, %xmm4, %xmm4      # xmm4 = xmm4[0,0,0,0]
movaps %xmm3, %xmm10
maxps %xmm4, %xmm10
shufps $0x0, %xmm9, %xmm9      # xmm9 = xmm9[0,0,0,0]
shufps $0xe1, %xmm3, %xmm3     # xmm3 = xmm3[1,0,2,3]
maxps %xmm3, %xmm9
subps %xmm9, %xmm10
movlps %xmm10, (%r13,%rax,4)
maxss %xmm8, %xmm6
maxss %xmm2, %xmm1
maxss %xmm1, %xmm6
maxss %xmm7, %xmm5
maxss %xmm0, %xmm5
subss %xmm5, %xmm6
movss %xmm6, 0x8(%r13,%rax,4)
incq %rbp
cmpq $0x1d, %rbp
jne 0x6484
movl $0x1, %eax
testb $0x1, 0xc(%rsp)
movl $0x0, %ecx
jne 0x6464
xorps %xmm1, %xmm1
xorl %eax, %eax
addss (%rax,%r13), %xmm1
addq $0x4, %rax
cmpq $0x2b8, %rax            # imm = 0x2B8
jne 0x65c9
divss 0x22e1(%rip), %xmm1     # 0x88c4
xorps %xmm0, %xmm0
xorl %eax, %eax
movss (%rax,%r13), %xmm2
subss %xmm1, %xmm2
mulss %xmm2, %xmm2
addss %xmm2, %xmm0
addq $0x4, %rax
cmpq $0x2b8, %rax            # imm = 0x2B8
jne 0x65e8
divss 0x22ba(%rip), %xmm0     # 0x88c8
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0x661c
sqrtss %xmm0, %xmm0
jmp 0x6621
callq 0x10e0
mulss 0x22a3(%rip), %xmm0     # 0x88cc
xorl %eax, %eax
movss (%rax,%r13), %xmm1
divss %xmm0, %xmm1
movss %xmm1, (%rax,%r13)
addq $0x4, %rax
cmpq $0x2b8, %rax            # imm = 0x2B8
jne 0x662b
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq