// File: /workspace/github_c_makefile_star2_O3/pavel-demin[P]ft8d-c/ft8d.c
// Function: decode
int decode(int iterations)
{
  int i, j, k, l, iter, ibj, ichk, current, previous, counter;
  real_t x, x2, tnm, tmn, tov[N][3], toc[M][7], zn;

  memset(tov, 0, sizeof(tov));

  for(i = 0; i < M; ++i)
  {
    for(j = 0; j < nrw[i]; ++j)
    {
      toc[i][j] = llr[nm[i][j]];
    }
  }

  counter = 0;
  previous = 0;
  for(iter = 0; iter < iterations; ++iter)
  {
    for(i = 0; i < N; ++i)
    {
      zn = llr[i];
      for(j = 0; j < ncw; ++j) zn += tov[i][j];
      message[i] = zn > 0;
    }

    current = 0;
    for(i = 0; i < M; ++i)
    {
      l = 0;
      for(j = 0; j < nrw[i]; ++j) l += message[nm[i][j]];
      if(l % 2 > 0) ++current;
    }

    if(current == 0 && check()) return 1;

    if(iter > 0)
    {
      ++counter;
      if(current < previous) counter = 0;
      if(counter > 4 && iter > 9 && current > 15) return 0;
    }

    previous = current;

    for(i = 0; i < M; ++i)
    {
      for(j = 0; j < nrw[i]; ++j)
      {
        ibj = nm[i][j];
        tnm = llr[ibj];
        for(k = 0; k < ncw; ++k)
        {
          if(mn[ibj][k] != i)
          {
            tnm += tov[ibj][k];
          }
        }
        x = -tnm / 2;
        x2 = x * x;
        toc[i][j] = x > 3.64 ? 1 : x < -3.64 ? -1 : (945 + (105 + x2) * x2) * x / (945 + (420 + 15 * x2) * x2);
      }
    }

    for(i = 0; i < N; ++i)
    {
      for(j = 0; j < ncw; ++j)
      {
        ichk = mn[i][j];
        tmn = 1;
        for(k = 0; k < nrw[ichk]; ++k)
        {
          if(nm[ichk][k] != i)
          {
            tmn *= toc[ichk][k];
          }
        }
        x = -tmn;
        x2 = x * x;
        tov[i][j] = 2 * (945 - (735 - 64 * x2) * x2) * x / (945 - (1050 - 225 * x2) * x2);
      }
    }
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1168, %rsp           # imm = 0x1168
movl %edi, 0xc(%rsp)
leaq 0x20(%rsp), %rdi
xorl %ebx, %ebx
movl $0x828, %edx            # imm = 0x828
xorl %esi, %esi
callq 0x10a0
leaq 0x4bc2(%rip), %rax      # 0xb2d0
leaq 0x850(%rsp), %rcx
leaq 0x5043(%rip), %r15      # 0xb760
leaq 0x6acc(%rip), %r12      # 0xd1f0
movzbl (%rbx,%r15), %edx
testq %rdx, %rdx
je 0x6748
xorl %esi, %esi
movswq (%rax,%rsi,2), %rdi
movss (%r12,%rdi,4), %xmm0
movss %xmm0, (%rcx,%rsi,4)
incq %rsi
cmpq %rsi, %rdx
jne 0x6730
incq %rbx
addq $0xe, %rax
addq $0x1c, %rcx
cmpq $0x53, %rbx
jne 0x6724
cmpl $0x0, 0xc(%rsp)
jle 0x6b2f
movq $0x0, 0x18(%rsp)
movl 0x5041(%rip), %eax      # 0xb7b4
xorps %xmm4, %xmm4
leaq 0x6d33(%rip), %rbp      # 0xd4b0
leaq 0x4b4c(%rip), %r14      # 0xb2d0
leaq 0x4935(%rip), %rbx      # 0xb0c0
movss 0x1935(%rip), %xmm5     # 0x80c8
movaps 0x1a66(%rip), %xmm6     # 0x8200
movss 0x2146(%rip), %xmm7     # 0x88e8
movss 0x2141(%rip), %xmm8     # 0x88ec
movss 0x2128(%rip), %xmm9     # 0x88dc
movss 0x2133(%rip), %xmm10    # 0x88f0
movss 0x212e(%rip), %xmm11    # 0x88f4
movss 0x2101(%rip), %xmm12    # 0x88d0
movsd 0x2138(%rip), %xmm13    # 0x8910
movss 0x20f3(%rip), %xmm14    # 0x88d4
movsd 0x212e(%rip), %xmm15    # 0x8918
movss 0x20e6(%rip), %xmm3     # 0x88d8
xorl %r9d, %r9d
xorl %r11d, %r11d
movl %eax, %eax
leaq 0x20(%rsp), %rcx
xorl %edx, %edx
movss (%r12,%rdx,4), %xmm0
testl %eax, %eax
jle 0x681a
xorl %esi, %esi
addss (%rcx,%rsi,4), %xmm0
incq %rsi
cmpq %rsi, %rax
jne 0x680d
ucomiss %xmm4, %xmm0
seta (%rdx,%rbp)
incq %rdx
addq $0xc, %rcx
cmpq $0xae, %rdx
jne 0x6801
xorl %eax, %eax
movq %r14, %rcx
xorl %r13d, %r13d
movzbl (%rax,%r15), %edx
movl $0x0, %esi
testq %rdx, %rdx
je 0x6864
xorl %edi, %edi
xorl %esi, %esi
movswq (%rcx,%rdi,2), %r8
movzbl (%r8,%rbp), %r8d
addl %r8d, %esi
incq %rdi
cmpq %rdi, %rdx
jne 0x684c
andl $0x1, %esi
addl %esi, %r13d
incq %rax
addq $0xe, %rcx
cmpq $0x53, %rax
jne 0x6839
testl %r13d, %r13d
movl %r11d, 0x10(%rsp)
jne 0x6908
movl %r9d, 0x14(%rsp)
callq 0x6656
movl 0x14(%rsp), %r9d
movl 0x10(%rsp), %r11d
movss 0x203a(%rip), %xmm3     # 0x88d8
movsd 0x2071(%rip), %xmm15    # 0x8918
movss 0x2024(%rip), %xmm14    # 0x88d4
movsd 0x2057(%rip), %xmm13    # 0x8910
movss 0x200e(%rip), %xmm12    # 0x88d0
movss 0x2029(%rip), %xmm11    # 0x88f4
movss 0x201c(%rip), %xmm10    # 0x88f0
movss 0x1fff(%rip), %xmm9     # 0x88dc
movss 0x2006(%rip), %xmm8     # 0x88ec
movss 0x1ffa(%rip), %xmm7     # 0x88e8
movaps 0x190b(%rip), %xmm6     # 0x8200
movss 0x17cb(%rip), %xmm5     # 0x80c8
xorps %xmm4, %xmm4
testl %eax, %eax
jne 0x6b43
testl %r11d, %r11d
je 0x6942
movq 0x18(%rsp), %rcx
incl %ecx
xorl %eax, %eax
cmpl %r9d, %r13d
cmovll %eax, %ecx
movq %rcx, 0x18(%rsp)
cmpl $0x5, %ecx
setge %cl
cmpl $0xa, %r11d
setae %dl
cmpl $0x10, %r13d
setge %sil
andb %cl, %sil
testb %dl, %sil
jne 0x6b31
movl 0x4e6c(%rip), %eax      # 0xb7b4
xorl %ecx, %ecx
movzbl (%rcx,%r15), %edx
testq %rdx, %rdx
je 0x6a26
xorl %esi, %esi
movq %rcx, %r8
shlq $0x4, %r8
subq %rcx, %r8
subq %rcx, %r8
addq %r14, %r8
movswq (%r8,%rsi,2), %rdi
movss (%r12,%rdi,4), %xmm0
testl %eax, %eax
jle 0x69a4
leaq (%rdi,%rdi,2), %rdi
leaq (%rsp,%rdi,4), %r8
addq $0x20, %r8
xorl %r9d, %r9d
leaq (%rdi,%r9), %r10
movzbl (%rbx,%r10), %r10d
cmpq %r10, %rcx
je 0x699c
addss (%r8,%r9,4), %xmm0
incq %r9
cmpq %r9, %rax
jne 0x6988
mulss %xmm12, %xmm0
xorps %xmm2, %xmm2
cvtss2sd %xmm0, %xmm2
ucomisd %xmm13, %xmm2
movaps %xmm5, %xmm1
ja 0x6a00
ucomisd %xmm2, %xmm15
movaps %xmm14, %xmm1
ja 0x6a00
movaps %xmm0, %xmm2
mulss %xmm0, %xmm2
movaps %xmm2, %xmm1
addss %xmm3, %xmm1
mulss %xmm2, %xmm1
addss %xmm9, %xmm1
mulss %xmm0, %xmm1
movaps %xmm2, %xmm0
mulss 0x1ef5(%rip), %xmm0     # 0x88e0
addss 0x1ef1(%rip), %xmm0     # 0x88e4
mulss %xmm2, %xmm0
addss %xmm9, %xmm0
divss %xmm0, %xmm1
leaq (%rcx,%rcx,8), %rdi
leaq (%rdi,%rdi,2), %rdi
addq %rcx, %rdi
addq %rsp, %rdi
addq $0x850, %rdi            # imm = 0x850
movss %xmm1, (%rdi,%rsi,4)
incq %rsi
cmpq %rdx, %rsi
jne 0x695a
incq %rcx
cmpq $0x53, %rcx
jne 0x694a
xorl %ecx, %ecx
testl %eax, %eax
jle 0x6b01
xorl %edx, %edx
leaq (%rcx,%rcx,2), %rsi
leaq (%rbx,%rsi), %rdi
movzbl (%rdx,%rdi), %r9d
movzbl (%r9,%r15), %edi
movaps %xmm5, %xmm0
testq %rdi, %rdi
je 0x6aa1
movl %r9d, %r8d
shll $0x4, %r8d
subq %r9, %r8
subq %r9, %r8
leaq (%r9,%r9,8), %r10
leaq (%r10,%r10,2), %r10
addq %r9, %r10
leaq (%rsp,%r10), %r9
addq $0x850, %r9             # imm = 0x850
xorl %r10d, %r10d
movaps %xmm5, %xmm0
leaq (%r8,%r10,2), %r11
movswq (%r14,%r11), %r11
movl %r11d, %r11d
cmpq %r11, %rcx
je 0x6a99
mulss (%r9,%r10,4), %xmm0
incq %r10
cmpq %r10, %rdi
jne 0x6a82
movaps %xmm0, %xmm1
xorps %xmm6, %xmm1
mulss %xmm0, %xmm0
movaps %xmm0, %xmm2
mulss %xmm7, %xmm2
addss %xmm8, %xmm2
mulss %xmm0, %xmm2
movaps %xmm9, %xmm3
subss %xmm2, %xmm3
addss %xmm3, %xmm3
mulss %xmm1, %xmm3
movaps %xmm0, %xmm1
mulss %xmm10, %xmm1
addss %xmm11, %xmm1
mulss %xmm0, %xmm1
movaps %xmm9, %xmm0
subss %xmm1, %xmm0
divss %xmm0, %xmm3
leaq (%rsp,%rsi,4), %rsi
addq $0x20, %rsi
movss %xmm3, (%rsi,%rdx,4)
incq %rdx
cmpq %rax, %rdx
jne 0x6a3f
incq %rcx
cmpq $0xae, %rcx
jne 0x6a35
movl 0x10(%rsp), %r11d
incl %r11d
movl %r13d, %r9d
cmpl 0xc(%rsp), %r11d
movss 0x1daf(%rip), %xmm3     # 0x88d8
jne 0x67f8
xorl %eax, %eax
addq $0x1168, %rsp           # imm = 0x1168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %eax
jmp 0x6b31