#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 */
int /*<<< orphan*/ printf(char *, ...);
int tan(double);
int main() {
  printf("const u32 tan_table[%u] = {\n", 32);
  for (int i = 0; i < 32; i++) {
    printf("\t%d,\n", (int)(tan((double)i * ((360.00f / (float)(32 * 4)) *
                                             (3.14159265f / 180.00f))) *
                            (1 << 13)));
  }
  printf("};\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x20,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jge    118a <main+0x6a>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xea0(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <tan@plt>
mov    %eax,%esi
shl    $0xd,%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1149 <main+0x29>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rdi
mov    $0x20,%ebp
mov    $0x20,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xorpd  %xmm0,%xmm0
lea    0xed7(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
mulsd  0xe8e(%rip),%xmm0
call   1050 <tan@plt>
shl    $0xd,%eax
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
addsd  0xe75(%rip),%xmm0
add    $0xffffffff,%ebp
jne    1160 <main+0x30>
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"const u32 tan_table[%u] = {\0A\00"
@.str.1 = [6 x i8] c"\09%d,\0A\00"
@.str.2 = [4 x i8] c"};\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 32)
store i32 0, i32* %2
br label %4
4: ; preds = %14, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 32
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sitofp i32 %8 to double
%10 = fmul double %9, 0x3FA921FB60000000
%11 = call i32 @tan(double %10)
%12 = mul nsw i32 %11, 8192
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %7
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %4
17: ; preds = %4
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@.str = [29 x i8] c"const u32 tan_table[%u] = {\0A\00"
@.str.1 = [6 x i8] c"\09%d,\0A\00"
@str = [3 x i8] c"};\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 32)
br label %4
2: ; preds = %4
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret i32 0
4: ; preds = %0, %4
%5 = phi i32 [ 0, %0 ], [ %11, %4 ]
%6 = sitofp i32 %5 to double
%7 = fmul double %6, 0x3FA921FB60000000
%8 = tail call i32 @tan(double %7)
%9 = shl nsw i32 %8, 13
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i32 %5, 1
%12 = icmp eq i32 %11, 32
br i1 %12, label %2, label %4
}