// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x11a0, %rsp           # imm = 0x11A0
movl %edi, -0x8(%rbp)
leaq -0x870(%rbp), %rdi
xorl %esi, %esi
movl $0x828, %edx            # imm = 0x828
callq 0x10a0
movl $0x0, -0xc(%rbp)
cmpl $0x53, -0xc(%rbp)
jge 0x16bc5
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movslq -0xc(%rbp), %rdx
leaq 0x4c0d(%rip), %rcx      # 0x1b770
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jge 0x16bb8
movslq -0xc(%rbp), %rcx
leaq 0x476a(%rip), %rax      # 0x1b2e0
imulq $0xe, %rcx, %rcx
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
movswq (%rax,%rcx,2), %rcx
leaq 0x6673(%rip), %rax      # 0x1d200
movss (%rax,%rcx,4), %xmm0
movslq -0xc(%rbp), %rcx
leaq -0x1190(%rbp), %rax
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x16b55
jmp 0x16bba
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x16b48
movl $0x0, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x17152
movl $0x0, -0xc(%rbp)
cmpl $0xae, -0xc(%rbp)
jge 0x16c8e
movslq -0xc(%rbp), %rcx
leaq 0x65fb(%rip), %rax      # 0x1d200
movss (%rax,%rcx,4), %xmm0
movss %xmm0, -0x1194(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl 0x4ba2(%rip), %eax      # 0x1b7c4
jge 0x16c5a
movslq -0xc(%rbp), %rcx
leaq -0x870(%rbp), %rax
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
addss -0x1194(%rbp), %xmm0
movss %xmm0, -0x1194(%rbp)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x16c19
movss -0x1194(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
seta %al
andb $0x1, %al
movzbl %al, %eax
movb %al, %dl
movslq -0xc(%rbp), %rcx
leaq 0x6843(%rip), %rax      # 0x1d4c0
movb %dl, (%rax,%rcx)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x16bed
movl $0x0, -0x28(%rbp)
movl $0x0, -0xc(%rbp)
cmpl $0x53, -0xc(%rbp)
jge 0x16d2a
movl $0x0, -0x18(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movslq -0xc(%rbp), %rdx
leaq 0x4aae(%rip), %rcx      # 0x1b770
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jge 0x16d01
movslq -0xc(%rbp), %rcx
leaq 0x460b(%rip), %rax      # 0x1b2e0
imulq $0xe, %rcx, %rcx
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
movswq (%rax,%rcx,2), %rcx
leaq 0x67d4(%rip), %rax      # 0x1d4c0
movzbl (%rax,%rcx), %eax
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x16cb4
movl -0x18(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jle 0x16d1a
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x16d1c
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x16c9c
cmpl $0x0, -0x28(%rbp)
jne 0x16d46
callq 0x16a10
cmpl $0x0, %eax
je 0x16d46
movl $0x1, -0x4(%rbp)
jmp 0x17159
cmpl $0x0, -0x1c(%rbp)
jle 0x16d84
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x16d64
movl $0x0, -0x30(%rbp)
cmpl $0x4, -0x30(%rbp)
jle 0x16d82
cmpl $0x9, -0x1c(%rbp)
jle 0x16d82
cmpl $0xf, -0x28(%rbp)
jle 0x16d82
movl $0x0, -0x4(%rbp)
jmp 0x17159
jmp 0x16d84
movl -0x28(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0xc(%rbp)
cmpl $0x53, -0xc(%rbp)
jge 0x16f8e
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movslq -0xc(%rbp), %rdx
leaq 0x49c0(%rip), %rcx      # 0x1b770
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jge 0x16f7e
movslq -0xc(%rbp), %rcx
leaq 0x4519(%rip), %rax      # 0x1b2e0
imulq $0xe, %rcx, %rcx
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
movswl (%rax,%rcx,2), %eax
movl %eax, -0x20(%rbp)
movslq -0x20(%rbp), %rcx
leaq 0x641c(%rip), %rax      # 0x1d200
movss (%rax,%rcx,4), %xmm0
movss %xmm0, -0x3c(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl 0x49c6(%rip), %eax      # 0x1b7c4
jge 0x16e51
movslq -0x20(%rbp), %rcx
leaq 0x42c5(%rip), %rax      # 0x1b0d0
imulq $0x3, %rcx, %rcx
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl -0xc(%rbp), %eax
je 0x16e44
movslq -0x20(%rbp), %rcx
leaq -0x870(%rbp), %rax
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
addss -0x3c(%rbp), %xmm0
movss %xmm0, -0x3c(%rbp)
jmp 0x16e46
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x16df5
movss -0x3c(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss 0x11f1(%rip), %xmm1     # 0x1805c
divss %xmm1, %xmm0
movss %xmm0, -0x34(%rbp)
movss -0x34(%rbp), %xmm0
mulss -0x34(%rbp), %xmm0
movss %xmm0, -0x38(%rbp)
movss -0x34(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x1d5c(%rip), %xmm1     # 0x18bf0
ucomisd %xmm1, %xmm0
jbe 0x16eaf
movss 0x11b2(%rip), %xmm0     # 0x18054
movss %xmm0, -0x1198(%rbp)
jmp 0x16f4d
movss -0x34(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x1d38(%rip), %xmm0     # 0x18bf8
ucomisd %xmm1, %xmm0
jbe 0x16ed8
movss 0x1d1a(%rip), %xmm0     # 0x18be8
movss %xmm0, -0x119c(%rbp)
jmp 0x16f3d
movss 0x1d04(%rip), %xmm0     # 0x18be4
addss -0x38(%rbp), %xmm0
movss -0x38(%rbp), %xmm1
mulss %xmm1, %xmm0
movss 0x1cd6(%rip), %xmm1     # 0x18bcc
addss %xmm1, %xmm0
mulss -0x34(%rbp), %xmm0
movss -0x38(%rbp), %xmm1
movss 0x1144(%rip), %xmm2     # 0x18050
mulss %xmm2, %xmm1
movss 0x1cc8(%rip), %xmm2     # 0x18be0
addss %xmm2, %xmm1
movss -0x38(%rbp), %xmm2
mulss %xmm2, %xmm1
movss 0x1c9f(%rip), %xmm2     # 0x18bcc
addss %xmm2, %xmm1
divss %xmm1, %xmm0
movss %xmm0, -0x119c(%rbp)
movss -0x119c(%rbp), %xmm0
movss %xmm0, -0x1198(%rbp)
movss -0x1198(%rbp), %xmm0
movslq -0xc(%rbp), %rcx
leaq -0x1190(%rbp), %rax
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x16da2
jmp 0x16f80
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x16d91
movl $0x0, -0xc(%rbp)
cmpl $0xae, -0xc(%rbp)
jge 0x17142
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl 0x4812(%rip), %eax      # 0x1b7c4
jge 0x17132
movslq -0xc(%rbp), %rcx
leaq 0x410d(%rip), %rax      # 0x1b0d0
imulq $0x3, %rcx, %rcx
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x24(%rbp)
movss 0x1077(%rip), %xmm0     # 0x18054
movss %xmm0, -0x40(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movslq -0x24(%rbp), %rdx
leaq 0x4779(%rip), %rcx      # 0x1b770
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jge 0x17050
movslq -0x24(%rbp), %rcx
leaq 0x42d6(%rip), %rax      # 0x1b2e0
imulq $0xe, %rcx, %rcx
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
movswl (%rax,%rcx,2), %eax
cmpl -0xc(%rbp), %eax
je 0x17043
movslq -0x24(%rbp), %rcx
leaq -0x1190(%rbp), %rax
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
mulss -0x40(%rbp), %xmm0
movss %xmm0, -0x40(%rbp)
jmp 0x17045
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x16fe9
movss -0x40(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, -0x34(%rbp)
movss -0x34(%rbp), %xmm0
mulss -0x34(%rbp), %xmm0
movss %xmm0, -0x38(%rbp)
movss -0x38(%rbp), %xmm1
movss 0x1b55(%rip), %xmm0     # 0x18bd8
mulss %xmm0, %xmm1
movss 0x1b4d(%rip), %xmm0     # 0x18bdc
addss %xmm0, %xmm1
movss -0x38(%rbp), %xmm0
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
mulss %xmm0, %xmm1
movss 0x1b1b(%rip), %xmm0     # 0x18bcc
addss %xmm0, %xmm1
movss 0xf9f(%rip), %xmm0      # 0x1805c
mulss %xmm1, %xmm0
mulss -0x34(%rbp), %xmm0
movss -0x38(%rbp), %xmm1
movss 0x1afd(%rip), %xmm2     # 0x18bd0
mulss %xmm2, %xmm1
movss 0x1af5(%rip), %xmm2     # 0x18bd4
addss %xmm2, %xmm1
movss -0x38(%rbp), %xmm2
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
mulss %xmm2, %xmm1
movss 0x1acb(%rip), %xmm2     # 0x18bcc
addss %xmm2, %xmm1
divss %xmm1, %xmm0
movslq -0xc(%rbp), %rcx
leaq -0x870(%rbp), %rax
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x16fa9
jmp 0x17134
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x16f95
jmp 0x17144
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x16bda
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x11a0, %rsp           # imm = 0x11A0
popq %rbp
retq
nopw %cs:(%rax,%rax)