#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 */

/* Variables and functions */
double M_PI;
int /*<<< orphan*/ printf(char *, ...);
double sin(double);
void gensintbl(void) {
  int i;
  printf("#define SINTABBITS %d\n#define SINTABSIZE  (1<<SINTABBITS)\n"
         "\nstatic short isintab[SINTABSIZE+SINTABSIZE/4] = {\n\t",
         9);
  for (i = 0; i < ((1 << 9) + (1 << 9) / 4); i++) {
    printf("%6d", (int)(32767.0 * sin(2.0 * M_PI / (1 << 9) * i)));
    if (i < ((1 << 9) + (1 << 9) / 4) - 1) {
      if ((i & 7) == 7)
        printf(",\n\t");
      else
        printf(",");
    }
  }
  printf("\n};\n\n");
}


x86 assembly (clang, -O0):
<gensintbl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee9(%rip),%rdi
mov    $0x9,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x280,-0x4(%rbp)
jge    11f2 <gensintbl+0xd2>
movsd  0xeb9(%rip),%xmm0
mov    0x2e8a(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xe9e(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xe79(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x27f,-0x4(%rbp)
jge    11df <gensintbl+0xbf>
mov    -0x4(%rbp),%eax
and    $0x7,%eax
cmp    $0x7,%eax
jne    11cc <gensintbl+0xac>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11da <gensintbl+0xba>
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11df <gensintbl+0xbf>
jmp    11e4 <gensintbl+0xc4>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1142 <gensintbl+0x22>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gensintbl>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xeca(%rip),%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xorpd  %xmm1,%xmm1
mov    0x2e83(%rip),%r15
lea    0xf1b(%rip),%rbx
lea    0xf18(%rip),%r14
xor    %ebp,%ebp
jmp    11a2 <gensintbl+0x62>
nopw   0x0(%rax,%rax,1)
mov    $0x2c,%edi
call   1030 <putchar@plt>
movsd  (%rsp),%xmm1
addsd  0xe79(%rip),%xmm1
add    $0x1,%ebp
cmp    $0x280,%ebp
je     11f3 <gensintbl+0xb3>
movsd  %xmm1,(%rsp)
movsd  (%r15),%xmm0
addsd  %xmm0,%xmm0
mulsd  0xe48(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1060 <sin@plt>
mulsd  0xe3f(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x27f,%ebp
je     11f3 <gensintbl+0xb3>
mov    %ebp,%eax
not    %eax
test   $0x7,%al
jne    1180 <gensintbl+0x40>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    118a <gensintbl+0x4a>
lea    0xe95(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [111 x i8] c"#define SINTABBITS %d\0A#define SINTABSIZE (1<<SINTABBITS)\0A\0Astatic short isintab[SINTABSIZE+SINTABSIZE/4] = {\0A\09\00"
@.str.1 = [4 x i8] c"%6d\00"
@M_PI = global double 0.000000e+00
@.str.2 = [4 x i8] c",\0A\09\00"
@.str.3 = [2 x i8] c",\00"
@.str.4 = [6 x i8] c"\0A};\0A\0A\00"
define void @gensintbl() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([111 x i8], [111 x i8]* @.str, i64 0, i64 0), i32 9)
store i32 0, i32* %1
br label %3
3: ; preds = %29, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 640
br i1 %5, label %6, label %32
6: ; preds = %3
%7 = load double, double* @M_PI
%8 = fmul double 2.000000e+00, %7
%9 = fdiv double %8, 5.120000e+02
%10 = load i32, i32* %1
%11 = sitofp i32 %10 to double
%12 = fmul double %9, %11
%13 = call double @sin(double %12)
%14 = fmul double 3.276700e+04, %13
%15 = fptosi double %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %1
%18 = icmp slt i32 %17, 639
br i1 %18, label %19, label %28
19: ; preds = %6
%20 = load i32, i32* %1
%21 = and i32 %20, 7
%22 = icmp eq i32 %21, 7
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %27
25: ; preds = %19
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %25, %23
br label %28
28: ; preds = %27, %6
br label %29
29: ; preds = %28
%30 = load i32, i32* %1
%31 = add nsw i32 %30, 1
store i32 %31, i32* %1
br label %3
32: ; preds = %3
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [111 x i8] c"#define SINTABBITS %d\0A#define SINTABSIZE (1<<SINTABBITS)\0A\0Astatic short isintab[SINTABSIZE+SINTABSIZE/4] = {\0A\09\00"
@.str.1 = [4 x i8] c"%6d\00"
@M_PI = global double 0.000000e+00
@.str.2 = [4 x i8] c",\0A\09\00"
@str = [5 x i8] c"\0A};\0A\00"
define void @gensintbl() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([111 x i8], [111 x i8]* @.str, i64 0, i64 0), i32 9)
br label %2
2: ; preds = %0, %21
%3 = phi i32 [ 0, %0 ], [ %22, %21 ]
%4 = load double, double* @M_PI
%5 = fmul double %4, 2.000000e+00
%6 = fmul double %5, 0x3F60000000000000
%7 = sitofp i32 %3 to double
%8 = fmul double %6, %7
%9 = tail call double @sin(double %8)
%10 = fmul double %9, 3.276700e+04
%11 = fptosi double %10 to i32
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = icmp eq i32 %3, 639
br i1 %13, label %24, label %14
14: ; preds = %2
%15 = and i32 %3, 7
%16 = icmp eq i32 %15, 7
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %21
19: ; preds = %14
%20 = tail call i32 @putchar(i32 44)
br label %21
21: ; preds = %19, %17
%22 = add nuw nsw i32 %3, 1
%23 = icmp eq i32 %22, 640
br i1 %23, label %24, label %2
24: ; preds = %2, %21
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret void
}