#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
double M_PI;
int cos(double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int sin(double);
void gentbl_afsk2666(FILE *f) {
  int i, j, k, l, o, v, sumi, sumq;
  float window[(2 * 6) * 2];
  int cfreq[2];
  fprintf(f,
          "\n/*\n * afsk2666 specific tables\n */\n"
          "#define AFSK26_DEMCORRLEN %d\n"
          "#define AFSK26_SAMPLERATE %d\n\n",
          (2 * 6), 16000);
  fprintf(f, "static const unsigned int afsk26_carfreq[%d] = { ", 2);
  for (i = 0; i < 2; i++) {
    cfreq[i] = 0x10000 * 2000 / 16000 + 0x10000 * i / 6 / 2;
    fprintf(f, "0x%x", cfreq[i]);
    if (i < 2 - 1)
      fprintf(f, ", ");
  }
  fprintf(f, " };\n\n");
  for (i = 0; i < (2 * 6) * 2; i++)
    window[i] =
        ((1 - cos(2.0 * M_PI * (((float)i) / ((2 * 6) * 2)))) / 2.0) * 127.0;
  fprintf(f,
          "\nstatic const struct {\n\t"
          "int i[%d];\n\tint q[%d];\n} afsk26_dem_tables[%d][%d] = {\n",
          (2 * 6), (2 * 6), 2, 2);
  for (o = 2 - 1; o >= 0; o--) {
    fprintf(f, "\t{\n");
    for (i = 0; i < 2; i++) {
      j = cfreq[i];
      fprintf(f, "\t\t{{ ");
      for (l = (2 * 6) - 1, k = (j * o) / 2, sumi = 0; l >= 0;
           l--, k = (k + j) & 0xffffu) {
        sumi += (v = 1 * window[l * 2 + o] * cos(M_PI * k / 32768.0));
        fprintf(f, "%6d%s", v, l ? ", " : " }, { ");
      }
      for (l = (2 * 6) - 1, k = (j * o) / 2, sumq = 0; l >= 0;
           l--, k = (k + j) & 0xffffu) {
        sumq += (v = 1 * window[l * 2 + o] * sin(M_PI * k / 32768.0));
        fprintf(f, "%6d%s", v, l ? ", " : " }}");
      }
      if (i < 1)
        fprintf(f, ",");
      fprintf(f,
              "\n#define AFSK26_DEM_SUM_I_%d_%d %d\n"
              "#define AFSK26_DEM_SUM_Q_%d_%d %d\n",
              2 - 1 - o, i, sumi, 2 - 1 - o, i, sumq);
    }
    fprintf(f, "\t}%s\n", o ? "," : "");
  }
  fprintf(f, "};\n\n");
}


x86 assembly (clang, -O0):
<gentbl_afsk2666>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed6(%rip),%rsi
mov    $0xc,%edx
mov    $0x3e80,%ecx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf1a(%rip),%rsi
mov    $0x2,%edx
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    11f8 <gentbl_afsk2666+0xc8>
mov    -0xc(%rbp),%eax
shl    $0x10,%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
add    $0x2000,%ecx
movslq -0xc(%rbp),%rax
mov    %ecx,-0x98(%rbp,%rax,4)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
mov    -0x98(%rbp,%rax,4),%edx
lea    0xef0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpl   $0x1,-0xc(%rbp)
jge    11e5 <gentbl_afsk2666+0xb5>
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11ea <gentbl_afsk2666+0xba>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1179 <gentbl_afsk2666+0x49>
mov    -0x8(%rbp),%rdi
lea    0xeb7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x18,-0xc(%rbp)
jge    1290 <gentbl_afsk2666+0x160>
movsd  0xded(%rip),%xmm0
mov    0x2dbe(%rip),%rax
mulsd  (%rax),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
movss  0xde1(%rip),%xmm2
divss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
call   1050 <cos@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  0xdaf(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xd9b(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movslq -0xc(%rbp),%rax
movss  %xmm0,-0x90(%rbp,%rax,4)
ff ff
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1211 <gentbl_afsk2666+0xe1>
mov    -0x8(%rbp),%rdi
lea    0xe25(%rip),%rsi
mov    $0xc,%ecx
mov    $0x2,%r9d
mov    %ecx,%edx
mov    %r9d,%r8d
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     1554 <gentbl_afsk2666+0x424>
mov    -0x8(%rbp),%rdi
lea    0xe42(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    151c <gentbl_afsk2666+0x3ec>
movslq -0xc(%rbp),%rax
mov    -0x98(%rbp,%rax,4),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe15(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0xb,-0x18(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     13df <gentbl_afsk2666+0x2af>
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
add    -0x1c(%rbp),%eax
cltq
movss  0xcd5(%rip),%xmm0
mulss  -0x90(%rbp,%rax,4),%xmm0
ff ff
movss  %xmm0,-0x9c(%rbp)
ff
mov    0x2c8d(%rip),%rax
movsd  (%rax),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc90(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <cos@plt>
movss  -0x9c(%rbp),%xmm0
ff
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x20(%rbp)
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%edx
mov    -0x18(%rbp),%esi
lea    0xd79(%rip),%rcx
lea    0xd09(%rip),%rax
cmp    $0x0,%esi
cmovne %rax,%rcx
lea    0xd5e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
and    $0xffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1326 <gentbl_afsk2666+0x1f6>
movl   $0xb,-0x18(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     14b8 <gentbl_afsk2666+0x388>
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
add    -0x1c(%rbp),%eax
cltq
movss  0xbfc(%rip),%xmm0
mulss  -0x90(%rbp,%rax,4),%xmm0
ff ff
movss  %xmm0,-0xa0(%rbp)
ff
mov    0x2bb4(%rip),%rax
movsd  (%rax),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xbb7(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sin@plt>
movss  -0xa0(%rbp),%xmm0
ff
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x20(%rbp)
add    -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%edx
mov    -0x18(%rbp),%esi
lea    0xca7(%rip),%rcx
lea    0xc30(%rip),%rax
cmp    $0x0,%esi
cmovne %rax,%rcx
lea    0xc85(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
and    $0xffff,%eax
mov    %eax,-0x14(%rbp)
jmp    13ff <gentbl_afsk2666+0x2cf>
cmpl   $0x1,-0xc(%rbp)
jge    14d4 <gentbl_afsk2666+0x3a4>
mov    -0x8(%rbp),%rdi
lea    0xc5e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%edx
sub    -0x1c(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    $0x1,%r9d
sub    -0x1c(%rbp),%r9d
mov    -0xc(%rbp),%r10d
mov    -0x28(%rbp),%eax
lea    0xc2e(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12dc <gentbl_afsk2666+0x1ac>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%ecx
lea    0xb95(%rip),%rdx
lea    0xbfa(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xc34(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    12b9 <gentbl_afsk2666+0x189>
mov    -0x8(%rbp),%rdi
lea    0xb5c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gentbl_afsk2666>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rdi,%r14
lea    0xeb5(%rip),%rsi
xor    %ebx,%ebx
mov    $0xc,%edx
mov    $0x3e80,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xefb(%rip),%rsi
mov    %r14,%rdi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xf17(%rip),%rbp
mov    %r14,%rdi
mov    %rbp,%rsi
mov    $0x2000,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xf03(%rip),%r15
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %r14,%rcx
call   1070 <fwrite@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    $0x3555,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xed8(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1070 <fwrite@plt>
mov    0x2ded(%rip),%rbp
nopl   0x0(%rax,%rax,1)
movsd  0x0(%rbp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
addsd  %xmm1,%xmm1
divss  0xde8(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
call   1060 <cos@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mulsd  0xdcd(%rip),%xmm0
mulsd  0xdcd(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x30(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x18,%rbx
jne    1200 <gentbl_afsk2666+0xb0>
lea    0xe62(%rip),%rsi
mov    %r14,%rdi
mov    $0xc,%edx
mov    $0xc,%ecx
mov    $0x2,%r8d
mov    $0x2,%r9d
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%ebx
lea    0x30(%rsp),%rax
mov    %rax,0x10(%rsp)
mov    %r14,0x18(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x3,%esi
mov    $0x1,%edx
lea    0xe5f(%rip),%rdi
mov    %r14,%rcx
call   1070 <fwrite@plt>
mov    $0x5,%esi
mov    $0x1,%edx
lea    0xe4a(%rip),%rdi
mov    %r14,%rcx
call   1070 <fwrite@plt>
mov    %rbx,0x28(%rsp)
mov    %ebx,%r12d
shl    $0xc,%r12d
mov    0x10(%rsp),%rcx
mov    $0xc,%ebp
mov    %r15,%r14
xor    %r15d,%r15d
mov    %r12d,%ebx
movsd  0xd1f(%rip),%xmm1
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movss  -0x4(%rcx,%rbp,8),%xmm2
movss  %xmm2,0x10(%rsp)
mov    0x2cce(%rip),%rax
mulsd  (%rax),%xmm0
mulsd  %xmm1,%xmm0
mov    %rcx,%r13
call   1060 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0x10(%rsp),%xmm0
cvttss2si %xmm0,%edx
add    %edx,%r15d
cmp    $0x1,%rbp
mov    %r14,%rcx
lea    0xdd4(%rip),%rax
cmove  %rax,%rcx
mov    0x18(%rsp),%rdi
lea    0xdbe(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %r13,%rcx
movsd  0xcaa(%rip),%xmm1
add    $0x2000,%ebx
movzwl %bx,%ebx
add    $0xffffffffffffffff,%rbp
jne    1300 <gentbl_afsk2666+0x1b0>
xor    %r13d,%r13d
mov    $0xc,%ebp
lea    0xd9b(%rip),%rbx
mov    0x2c55(%rip),%r14
mov    %rcx,0x10(%rsp)
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
mov    0x10(%rsp),%rax
movss  -0x4(%rax,%rbp,8),%xmm1
movss  %xmm1,0xc(%rsp)
mulsd  (%r14),%xmm0
mulsd  0xc52(%rip),%xmm0
call   1050 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0xc(%rsp),%xmm0
cvttss2si %xmm0,%edx
add    %edx,%r13d
cmp    $0x1,%rbp
lea    0xccd(%rip),%rcx
cmove  %rbx,%rcx
mov    0x18(%rsp),%rdi
lea    0xd20(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x2000,%r12d
movzwl %r12w,%r12d
add    $0xffffffffffffffff,%rbp
jne    13a0 <gentbl_afsk2666+0x250>
mov    $0x2c,%edi
mov    0x18(%rsp),%rbp
mov    %rbp,%rsi
call   1030 <fputc@plt>
mov    $0x1,%edx
mov    0x28(%rsp),%rbx
sub    %ebx,%edx
xor    %r12d,%r12d
mov    %rbp,%rdi
lea    0xcf0(%rip),%rsi
xor    %ecx,%ecx
mov    %r15d,%r8d
mov    %edx,0x24(%rsp)
mov    %edx,%r9d
xor    %eax,%eax
push   %r13
push   $0x0
call   1040 <fprintf@plt>
add    $0x10,%rsp
mov    $0x5,%esi
mov    $0x1,%edx
lea    0xcab(%rip),%rdi
mov    %rbp,%rcx
call   1070 <fwrite@plt>
imul   $0x3555,%ebx,%eax
mov    %eax,%r13d
shr    $0x1f,%r13d
add    %eax,%r13d
sar    %r13d
mov    $0xc,%ebx
mov    %r13d,%ebp
lea    0xc8d(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mov    0x10(%rsp),%rax
movss  -0x4(%rax,%rbx,8),%xmm1
movss  %xmm1,0xc(%rsp)
mulsd  (%r14),%xmm0
mulsd  0xb53(%rip),%xmm0
call   1060 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0xc(%rsp),%xmm0
cvttss2si %xmm0,%edx
add    %edx,%r12d
cmp    $0x1,%rbx
lea    0xbce(%rip),%rcx
cmove  %r15,%rcx
mov    0x18(%rsp),%rdi
lea    0xc21(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x3555,%ebp
movzwl %bp,%ebp
add    $0xffffffffffffffff,%rbx
jne    14a0 <gentbl_afsk2666+0x350>
xor    %r15d,%r15d
mov    $0xc,%ebx
mov    %r14,%rbp
lea    0xc06(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2sd %r13d,%xmm0
mov    0x10(%rsp),%rax
movss  -0x4(%rax,%rbx,8),%xmm1
movss  %xmm1,0xc(%rsp)
mulsd  0x0(%rbp),%xmm0
mulsd  0xac2(%rip),%xmm0
call   1050 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0xc(%rsp),%xmm0
cvttss2si %xmm0,%edx
add    %edx,%r15d
cmp    $0x1,%rbx
lea    0xb3d(%rip),%rcx
cmove  %r14,%rcx
mov    0x18(%rsp),%rdi
lea    0xb90(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x3555,%r13d
movzwl %r13w,%r13d
add    $0xffffffffffffffff,%rbx
jne    1530 <gentbl_afsk2666+0x3e0>
mov    0x18(%rsp),%r14
mov    %r14,%rdi
lea    0xb7c(%rip),%rsi
mov    0x24(%rsp),%edx
mov    $0x1,%ecx
mov    %r12d,%r8d
mov    %edx,%r9d
xor    %eax,%eax
push   %r15
push   $0x1
call   1040 <fprintf@plt>
add    $0x10,%rsp
mov    0x28(%rsp),%r15
mov    %r15,%rbx
sub    $0x1,%rbx
lea    0xb49(%rip),%rdx
lea    0xad6(%rip),%rax
cmovb  %rax,%rdx
mov    %r14,%rdi
lea    0xb7c(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
addq   $0xfffffffffffffffc,0x10(%rsp)
test   %r15,%r15
lea    0xaa9(%rip),%r15
jne    12a0 <gentbl_afsk2666+0x150>
lea    0xaa0(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r14,%rcx
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <fwrite@plt>

LLVM IR (-O0):
@.str = [96 x i8] c"\0A/*\0A * afsk2666 specific tables\0A */\0A#define AFSK26_DEMCORRLEN %d\0A#define AFSK26_SAMPLERATE %d\0A\0A\00"
@.str.1 = [50 x i8] c"static const unsigned int afsk26_carfreq[%d] = { \00"
@.str.2 = [5 x i8] c"0x%x\00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [6 x i8] c" };\0A\0A\00"
@M_PI = global double 0.000000e+00
@.str.5 = [80 x i8] c"\0Astatic const struct {\0A\09int i[%d];\0A\09int q[%d];\0A} afsk26_dem_tables[%d][%d] = {\0A\00"
@.str.6 = [4 x i8] c"\09{\0A\00"
@.str.7 = [6 x i8] c"\09\09{{ \00"
@.str.8 = [6 x i8] c"%6d%s\00"
@.str.9 = [7 x i8] c" }, { \00"
@.str.10 = [4 x i8] c" }}\00"
@.str.11 = [2 x i8] c",\00"
@.str.12 = [70 x i8] c"\0A#define AFSK26_DEM_SUM_I_%d_%d %d\0A#define AFSK26_DEM_SUM_Q_%d_%d %d\0A\00"
@.str.13 = [6 x i8] c"\09}%s\0A\00"
@.str.14 = [1 x i8] zeroinitializer
@.str.15 = [5 x i8] c"};\0A\0A\00"
define void @gentbl_afsk2666(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [24 x float]
%12 = alloca [2 x i32]
store i32* %0, i32** %2
%13 = load i32*, i32** %2
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0), i32 12, i32 16000)
%15 = load i32*, i32** %2
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i32 2)
store i32 0, i32* %3
br label %17
17: ; preds = %41, %1
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, 2
br i1 %19, label %20, label %44
20: ; preds = %17
%21 = load i32, i32* %3
%22 = mul nsw i32 65536, %21
%23 = sdiv i32 %22, 6
%24 = sdiv i32 %23, 2
%25 = add nsw i32 8192, %24
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 %27
store i32 %25, i32* %28
%29 = load i32*, i32** %2
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %33)
%35 = load i32, i32* %3
%36 = icmp slt i32 %35, 1
br i1 %36, label %37, label %40
37: ; preds = %20
%38 = load i32*, i32** %2
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %40
40: ; preds = %37, %20
br label %41
41: ; preds = %40
%42 = load i32, i32* %3
%43 = add nsw i32 %42, 1
store i32 %43, i32* %3
br label %17
44: ; preds = %17
%45 = load i32*, i32** %2
%46 = call i32 (i32*, i8*, ...) @fprintf(i32* %45, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %47
47: ; preds = %67, %44
%48 = load i32, i32* %3
%49 = icmp slt i32 %48, 24
br i1 %49, label %50, label %70
50: ; preds = %47
%51 = load double, double* @M_PI
%52 = fmul double 2.000000e+00, %51
%53 = load i32, i32* %3
%54 = sitofp i32 %53 to float
%55 = fdiv float %54, 2.400000e+01
%56 = fpext float %55 to double
%57 = fmul double %52, %56
%58 = call i32 @cos(double %57)
%59 = sub nsw i32 1, %58
%60 = sitofp i32 %59 to double
%61 = fdiv double %60, 2.000000e+00
%62 = fmul double %61, 1.270000e+02
%63 = fptrunc double %62 to float
%64 = load i32, i32* %3
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [24 x float], [24 x float]* %11, i64 0, i64 %65
store float %63, float* %66
br label %67
67: ; preds = %50
%68 = load i32, i32* %3
%69 = add nsw i32 %68, 1
store i32 %69, i32* %3
br label %47
70: ; preds = %47
%71 = load i32*, i32** %2
%72 = call i32 (i32*, i8*, ...) @fprintf(i32* %71, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.5, i64 0, i64 0), i32 12, i32 12, i32 2, i32 2)
store i32 1, i32* %7
br label %73
73: ; preds = %199, %70
%74 = load i32, i32* %7
%75 = icmp sge i32 %74, 0
br i1 %75, label %76, label %202
76: ; preds = %73
%77 = load i32*, i32** %2
%78 = call i32 (i32*, i8*, ...) @fprintf(i32* %77, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %3
br label %79
79: ; preds = %189, %76
%80 = load i32, i32* %3
%81 = icmp slt i32 %80, 2
br i1 %81, label %82, label %192
82: ; preds = %79
%83 = load i32, i32* %3
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 %84
%86 = load i32, i32* %85
store i32 %86, i32* %4
%87 = load i32*, i32** %2
%88 = call i32 (i32*, i8*, ...) @fprintf(i32* %87, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
store i32 11, i32* %6
%89 = load i32, i32* %4
%90 = load i32, i32* %7
%91 = mul nsw i32 %89, %90
%92 = sdiv i32 %91, 2
store i32 %92, i32* %5
store i32 0, i32* %9
br label %93
93: ; preds = %123, %82
%94 = load i32, i32* %6
%95 = icmp sge i32 %94, 0
br i1 %95, label %96, label %130
96: ; preds = %93
%97 = load i32, i32* %6
%98 = mul nsw i32 %97, 2
%99 = load i32, i32* %7
%100 = add nsw i32 %98, %99
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds [24 x float], [24 x float]* %11, i64 0, i64 %101
%103 = load float, float* %102
%104 = fmul float 1.000000e+00, %103
%105 = load double, double* @M_PI
%106 = load i32, i32* %5
%107 = sitofp i32 %106 to double
%108 = fmul double %105, %107
%109 = fdiv double %108, 3.276800e+04
%110 = call i32 @cos(double %109)
%111 = sitofp i32 %110 to float
%112 = fmul float %104, %111
%113 = fptosi float %112 to i32
store i32 %113, i32* %8
%114 = load i32, i32* %9
%115 = add nsw i32 %114, %113
store i32 %115, i32* %9
%116 = load i32*, i32** %2
%117 = load i32, i32* %8
%118 = load i32, i32* %6
%119 = icmp ne i32 %118, 0
%120 = zext i1 %119 to i64
%121 = select i1 %119, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0)
%122 = call i32 (i32*, i8*, ...) @fprintf(i32* %116, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 %117, i8* %121)
br label %123
123: ; preds = %96
%124 = load i32, i32* %6
%125 = add nsw i32 %124, -1
store i32 %125, i32* %6
%126 = load i32, i32* %5
%127 = load i32, i32* %4
%128 = add nsw i32 %126, %127
%129 = and i32 %128, 65535
store i32 %129, i32* %5
br label %93
130: ; preds = %93
store i32 11, i32* %6
%131 = load i32, i32* %4
%132 = load i32, i32* %7
%133 = mul nsw i32 %131, %132
%134 = sdiv i32 %133, 2
store i32 %134, i32* %5
store i32 0, i32* %10
br label %135
135: ; preds = %165, %130
%136 = load i32, i32* %6
%137 = icmp sge i32 %136, 0
br i1 %137, label %138, label %172
138: ; preds = %135
%139 = load i32, i32* %6
%140 = mul nsw i32 %139, 2
%141 = load i32, i32* %7
%142 = add nsw i32 %140, %141
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds [24 x float], [24 x float]* %11, i64 0, i64 %143
%145 = load float, float* %144
%146 = fmul float 1.000000e+00, %145
%147 = load double, double* @M_PI
%148 = load i32, i32* %5
%149 = sitofp i32 %148 to double
%150 = fmul double %147, %149
%151 = fdiv double %150, 3.276800e+04
%152 = call i32 @sin(double %151)
%153 = sitofp i32 %152 to float
%154 = fmul float %146, %153
%155 = fptosi float %154 to i32
store i32 %155, i32* %8
%156 = load i32, i32* %10
%157 = add nsw i32 %156, %155
store i32 %157, i32* %10
%158 = load i32*, i32** %2
%159 = load i32, i32* %8
%160 = load i32, i32* %6
%161 = icmp ne i32 %160, 0
%162 = zext i1 %161 to i64
%163 = select i1 %161, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0)
%164 = call i32 (i32*, i8*, ...) @fprintf(i32* %158, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 %159, i8* %163)
br label %165
165: ; preds = %138
%166 = load i32, i32* %6
%167 = add nsw i32 %166, -1
store i32 %167, i32* %6
%168 = load i32, i32* %5
%169 = load i32, i32* %4
%170 = add nsw i32 %168, %169
%171 = and i32 %170, 65535
store i32 %171, i32* %5
br label %135
172: ; preds = %135
%173 = load i32, i32* %3
%174 = icmp slt i32 %173, 1
br i1 %174, label %175, label %178
175: ; preds = %172
%176 = load i32*, i32** %2
%177 = call i32 (i32*, i8*, ...) @fprintf(i32* %176, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
br label %178
178: ; preds = %175, %172
%179 = load i32*, i32** %2
%180 = load i32, i32* %7
%181 = sub nsw i32 1, %180
%182 = load i32, i32* %3
%183 = load i32, i32* %9
%184 = load i32, i32* %7
%185 = sub nsw i32 1, %184
%186 = load i32, i32* %3
%187 = load i32, i32* %10
%188 = call i32 (i32*, i8*, ...) @fprintf(i32* %179, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.12, i64 0, i64 0), i32 %181, i32 %182, i32 %183, i32 %185, i32 %186, i32 %187)
br label %189
189: ; preds = %178
%190 = load i32, i32* %3
%191 = add nsw i32 %190, 1
store i32 %191, i32* %3
br label %79
192: ; preds = %79
%193 = load i32*, i32** %2
%194 = load i32, i32* %7
%195 = icmp ne i32 %194, 0
%196 = zext i1 %195 to i64
%197 = select i1 %195, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.14, i64 0, i64 0)
%198 = call i32 (i32*, i8*, ...) @fprintf(i32* %193, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i8* %197)
br label %199
199: ; preds = %192
%200 = load i32, i32* %7
%201 = add nsw i32 %200, -1
store i32 %201, i32* %7
br label %73
202: ; preds = %73
%203 = load i32*, i32** %2
%204 = call i32 (i32*, i8*, ...) @fprintf(i32* %203, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [96 x i8] c"\0A/*\0A * afsk2666 specific tables\0A */\0A#define AFSK26_DEMCORRLEN %d\0A#define AFSK26_SAMPLERATE %d\0A\0A\00"
@.str.1 = [50 x i8] c"static const unsigned int afsk26_carfreq[%d] = { \00"
@.str.2 = [5 x i8] c"0x%x\00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [6 x i8] c" };\0A\0A\00"
@M_PI = global double 0.000000e+00
@.str.5 = [80 x i8] c"\0Astatic const struct {\0A\09int i[%d];\0A\09int q[%d];\0A} afsk26_dem_tables[%d][%d] = {\0A\00"
@.str.6 = [4 x i8] c"\09{\0A\00"
@.str.7 = [6 x i8] c"\09\09{{ \00"
@.str.8 = [6 x i8] c"%6d%s\00"
@.str.9 = [7 x i8] c" }, { \00"
@.str.10 = [4 x i8] c" }}\00"
@.str.11 = [2 x i8] c",\00"
@.str.12 = [70 x i8] c"\0A#define AFSK26_DEM_SUM_I_%d_%d %d\0A#define AFSK26_DEM_SUM_Q_%d_%d %d\0A\00"
@.str.13 = [6 x i8] c"\09}%s\0A\00"
@.str.14 = [1 x i8] zeroinitializer
@.str.15 = [5 x i8] c"};\0A\0A\00"
define void @gentbl_afsk2666(i32* nocapture %0) {
%2 = alloca [24 x float]
%3 = bitcast [24 x float]* %2 to i8*
%4 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0), i32 12, i32 16000)
%5 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i32 2)
%6 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 8192)
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i64 2, i64 1, i32* %0)
%8 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 13653)
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i64 5, i64 1, i32* %0)
br label %10
10: ; preds = %1, %10
%11 = phi i64 [ 0, %1 ], [ %26, %10 ]
%12 = load double, double* @M_PI
%13 = fmul double %12, 2.000000e+00
%14 = trunc i64 %11 to i32
%15 = sitofp i32 %14 to float
%16 = fdiv float %15, 2.400000e+01
%17 = fpext float %16 to double
%18 = fmul double %13, %17
%19 = tail call i32 @cos(double %18)
%20 = sub nsw i32 1, %19
%21 = sitofp i32 %20 to double
%22 = fmul double %21, 5.000000e-01
%23 = fmul double %22, 1.270000e+02
%24 = fptrunc double %23 to float
%25 = getelementptr inbounds [24 x float], [24 x float]* %2, i64 0, i64 %11
store float %24, float* %25
%26 = add nuw nsw i64 %11, 1
%27 = icmp eq i64 %26, 24
br i1 %27, label %28, label %10
28: ; preds = %10
%29 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.5, i64 0, i64 0), i32 12, i32 12, i32 2, i32 2)
br label %30
30: ; preds = %28, %140
%31 = phi i64 [ 1, %28 ], [ %145, %140 ]
%32 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i64 3, i64 1, i32* %0)
%33 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i64 5, i64 1, i32* %0)
%34 = trunc i64 %31 to i32
%35 = shl nsw i32 %34, 12
br label %36
36: ; preds = %30, %36
%37 = phi i64 [ 11, %30 ], [ %56, %36 ]
%38 = phi i32 [ 0, %30 ], [ %52, %36 ]
%39 = phi i32 [ %35, %30 ], [ %58, %36 ]
%40 = shl nuw nsw i64 %37, 1
%41 = add nuw nsw i64 %40, %31
%42 = getelementptr inbounds [24 x float], [24 x float]* %2, i64 0, i64 %41
%43 = load float, float* %42
%44 = load double, double* @M_PI
%45 = sitofp i32 %39 to double
%46 = fmul double %44, %45
%47 = fmul double %46, 0x3F00000000000000
%48 = tail call i32 @cos(double %47)
%49 = sitofp i32 %48 to float
%50 = fmul float %43, %49
%51 = fptosi float %50 to i32
%52 = add nsw i32 %38, %51
%53 = icmp eq i64 %37, 0
%54 = select i1 %53, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%55 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 %51, i8* %54)
%56 = add nsw i64 %37, -1
%57 = add nsw i32 %39, 8192
%58 = and i32 %57, 65535
%59 = icmp eq i64 %37, 0
br i1 %59, label %60, label %36
60: ; preds = %36, %60
%61 = phi i64 [ %80, %60 ], [ 11, %36 ]
%62 = phi i32 [ %76, %60 ], [ 0, %36 ]
%63 = phi i32 [ %82, %60 ], [ %35, %36 ]
%64 = shl nuw nsw i64 %61, 1
%65 = add nuw nsw i64 %64, %31
%66 = getelementptr inbounds [24 x float], [24 x float]* %2, i64 0, i64 %65
%67 = load float, float* %66
%68 = load double, double* @M_PI
%69 = sitofp i32 %63 to double
%70 = fmul double %68, %69
%71 = fmul double %70, 0x3F00000000000000
%72 = tail call i32 @sin(double %71)
%73 = sitofp i32 %72 to float
%74 = fmul float %67, %73
%75 = fptosi float %74 to i32
%76 = add nsw i32 %62, %75
%77 = icmp eq i64 %61, 0
%78 = select i1 %77, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%79 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 %75, i8* %78)
%80 = add nsw i64 %61, -1
%81 = add nsw i32 %63, 8192
%82 = and i32 %81, 65535
%83 = icmp eq i64 %61, 0
br i1 %83, label %84, label %60
84: ; preds = %60
%85 = tail call i32 @fputc(i32 44, i32* %0)
%86 = trunc i64 %31 to i32
%87 = sub i32 1, %86
%88 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.12, i64 0, i64 0), i32 %87, i32 0, i32 %52, i32 %87, i32 0, i32 %76)
%89 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i64 5, i64 1, i32* %0)
%90 = mul nsw i32 %34, 13653
%91 = sdiv i32 %90, 2
br label %92
92: ; preds = %92, %84
%93 = phi i64 [ 11, %84 ], [ %112, %92 ]
%94 = phi i32 [ 0, %84 ], [ %108, %92 ]
%95 = phi i32 [ %91, %84 ], [ %114, %92 ]
%96 = shl nuw nsw i64 %93, 1
%97 = add nuw nsw i64 %96, %31
%98 = getelementptr inbounds [24 x float], [24 x float]* %2, i64 0, i64 %97
%99 = load float, float* %98
%100 = load double, double* @M_PI
%101 = sitofp i32 %95 to double
%102 = fmul double %100, %101
%103 = fmul double %102, 0x3F00000000000000
%104 = tail call i32 @cos(double %103)
%105 = sitofp i32 %104 to float
%106 = fmul float %99, %105
%107 = fptosi float %106 to i32
%108 = add nsw i32 %94, %107
%109 = icmp eq i64 %93, 0
%110 = select i1 %109, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%111 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 %107, i8* %110)
%112 = add nsw i64 %93, -1
%113 = add nsw i32 %95, 13653
%114 = and i32 %113, 65535
%115 = icmp eq i64 %93, 0
br i1 %115, label %116, label %92
116: ; preds = %92, %116
%117 = phi i64 [ %136, %116 ], [ 11, %92 ]
%118 = phi i32 [ %132, %116 ], [ 0, %92 ]
%119 = phi i32 [ %138, %116 ], [ %91, %92 ]
%120 = shl nuw nsw i64 %117, 1
%121 = add nuw nsw i64 %120, %31
%122 = getelementptr inbounds [24 x float], [24 x float]* %2, i64 0, i64 %121
%123 = load float, float* %122
%124 = load double, double* @M_PI
%125 = sitofp i32 %119 to double
%126 = fmul double %124, %125
%127 = fmul double %126, 0x3F00000000000000
%128 = tail call i32 @sin(double %127)
%129 = sitofp i32 %128 to float
%130 = fmul float %123, %129
%131 = fptosi float %130 to i32
%132 = add nsw i32 %118, %131
%133 = icmp eq i64 %117, 0
%134 = select i1 %133, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%135 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 %131, i8* %134)
%136 = add nsw i64 %117, -1
%137 = add nsw i32 %119, 13653
%138 = and i32 %137, 65535
%139 = icmp eq i64 %117, 0
br i1 %139, label %140, label %116
140: ; preds = %116
%141 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.12, i64 0, i64 0), i32 %87, i32 1, i32 %108, i32 %87, i32 1, i32 %132)
%142 = icmp eq i64 %31, 0
%143 = select i1 %142, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0)
%144 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i8* %143)
%145 = add nsw i64 %31, -1
%146 = icmp eq i64 %31, 0
br i1 %146, label %147, label %30
147: ; preds = %140
%148 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i64 4, i64 1, i32* %0)
ret void
}