// File: /workspace/github_c_makefile_star2_O1/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 0x498d(%rip), %rax      # 0xb2d0
leaq 0x850(%rsp), %rcx
leaq 0x4e0e(%rip), %r15      # 0xb760
leaq 0x6897(%rip), %r12      # 0xd1f0
movzbl (%rbx,%r15), %edx
testq %rdx, %rdx
je 0x697d
xorl %esi, %esi
movswq (%rax,%rsi,2), %rdi
movss (%r12,%rdi,4), %xmm0
movss %xmm0, (%rcx,%rsi,4)
incq %rsi
cmpq %rsi, %rdx
jne 0x6965
incq %rbx
addq $0xe, %rax
addq $0x1c, %rcx
cmpq $0x53, %rbx
jne 0x6959
cmpl $0x0, 0xc(%rsp)
jle 0x6d68
movq $0x0, 0x18(%rsp)
xorps %xmm4, %xmm4
leaq 0x6b04(%rip), %rbp      # 0xd4b0
leaq 0x491d(%rip), %r14      # 0xb2d0
leaq 0x4706(%rip), %rbx      # 0xb0c0
movss 0x1ece(%rip), %xmm5     # 0x8890
movaps 0x1817(%rip), %xmm6     # 0x81e0
movss 0x1ed7(%rip), %xmm7     # 0x88a8
movss 0x1ed2(%rip), %xmm8     # 0x88ac
movss 0x1eb9(%rip), %xmm9     # 0x889c
movss 0x1ec4(%rip), %xmm10    # 0x88b0
movss 0x1ebf(%rip), %xmm11    # 0x88b4
movss 0x1e8e(%rip), %xmm12    # 0x888c
movsd 0x1ec9(%rip), %xmm13    # 0x88d0
movss 0x1e84(%rip), %xmm14    # 0x8894
movsd 0x1ebf(%rip), %xmm15    # 0x88d8
movss 0x1e77(%rip), %xmm3     # 0x8898
xorl %r9d, %r9d
xorl %r11d, %r11d
movl 0x4d87(%rip), %eax      # 0xb7b4
leaq 0x20(%rsp), %rcx
xorl %edx, %edx
movss (%r12,%rdx,4), %xmm0
testl %eax, %eax
jle 0x6a4d
xorl %esi, %esi
addss (%rcx,%rsi,4), %xmm0
incq %rsi
cmpq %rsi, %rax
jne 0x6a40
ucomiss %xmm4, %xmm0
seta (%rdx,%rbp)
incq %rdx
addq $0xc, %rcx
cmpq $0xae, %rdx
jne 0x6a34
xorl %eax, %eax
movq %r14, %rcx
xorl %r13d, %r13d
movzbl (%rax,%r15), %edx
movl $0x0, %esi
testq %rdx, %rdx
je 0x6a97
xorl %edi, %edi
xorl %esi, %esi
movswq (%rcx,%rdi,2), %r8
movzbl (%r8,%rbp), %r8d
addl %r8d, %esi
incq %rdi
cmpq %rdi, %rdx
jne 0x6a7f
andl $0x1, %esi
addl %esi, %r13d
incq %rax
addq $0xe, %rcx
cmpq $0x53, %rax
jne 0x6a6c
testl %r13d, %r13d
movl %r11d, 0x10(%rsp)
jne 0x6b3b
movl %r9d, 0x14(%rsp)
callq 0x688b
movl 0x14(%rsp), %r9d
movl 0x10(%rsp), %r11d
movss 0x1dc7(%rip), %xmm3     # 0x8898
movsd 0x1dfe(%rip), %xmm15    # 0x88d8
movss 0x1db1(%rip), %xmm14    # 0x8894
movsd 0x1de4(%rip), %xmm13    # 0x88d0
movss 0x1d97(%rip), %xmm12    # 0x888c
movss 0x1db6(%rip), %xmm11    # 0x88b4
movss 0x1da9(%rip), %xmm10    # 0x88b0
movss 0x1d8c(%rip), %xmm9     # 0x889c
movss 0x1d93(%rip), %xmm8     # 0x88ac
movss 0x1d87(%rip), %xmm7     # 0x88a8
movaps 0x16b8(%rip), %xmm6     # 0x81e0
movss 0x1d60(%rip), %xmm5     # 0x8890
xorps %xmm4, %xmm4
testl %eax, %eax
jne 0x6d7c
testl %r11d, %r11d
je 0x6b75
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 0x6d6a
movl 0x4c39(%rip), %eax      # 0xb7b4
xorl %ecx, %ecx
movzbl (%rcx,%r15), %edx
testq %rdx, %rdx
je 0x6c59
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 0x6bd7
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 0x6bcf
addss (%r8,%r9,4), %xmm0
incq %r9
cmpq %r9, %rax
jne 0x6bbb
mulss %xmm12, %xmm0
xorps %xmm2, %xmm2
cvtss2sd %xmm0, %xmm2
ucomisd %xmm13, %xmm2
movaps %xmm5, %xmm1
ja 0x6c33
ucomisd %xmm2, %xmm15
movaps %xmm14, %xmm1
ja 0x6c33
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 0x1c82(%rip), %xmm0     # 0x88a0
addss 0x1c7e(%rip), %xmm0     # 0x88a4
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 0x6b8d
incq %rcx
cmpq $0x53, %rcx
jne 0x6b7d
movl 0x4b48(%rip), %eax      # 0xb7b4
xorl %ecx, %ecx
testl %eax, %eax
jle 0x6d3a
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 0x6cda
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 0x6cd2
mulss (%r9,%r10,4), %xmm0
incq %r10
cmpq %r10, %rdi
jne 0x6cbb
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 0x6c78
incq %rcx
cmpq $0xae, %rcx
jne 0x6c6e
movl 0x10(%rsp), %r11d
incl %r11d
movl %r13d, %r9d
cmpl 0xc(%rsp), %r11d
movss 0x1b36(%rip), %xmm3     # 0x8898
jne 0x6a27
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 0x6d6a