#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 asin(float);
int /*<<< orphan*/ printf(char *, ...);
void asin_tab(int max_y, int max_x) {
  int y;
  printf("unsigned char T_ASIN[256] = {");
  for (y = 0; y <= max_y; y++) {
    printf("0x%x", (unsigned char)(asin(((float)y) / ((float)max_y)) * 180.0 *
                                   max_x / (90.0 * 3.14)));
    if (y < max_y) {
      printf(", ");
    }
  }
  printf("};\n");
}


x86 assembly (clang, -O0):
<asin_tab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11c5 <asin_tab+0xa5>
cvtsi2ssl -0xc(%rbp),%xmm0
cvtsi2ssl -0x4(%rbp),%xmm1
divss  %xmm1,%xmm0
call   1040 <asin@plt>
movsd  0xe96(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe89(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
movzbl %al,%esi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b2 <asin_tab+0x92>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b7 <asin_tab+0x97>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <asin_tab+0x23>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asin_tab>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebp
mov    %edi,%r12d
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12d,%r12d
js     11e1 <asin_tab+0xb1>
cvtsi2ss %r12d,%xmm0
movss  %xmm0,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0x1(%r12),%ebp
lea    0xeb2(%rip),%r14
lea    0xeb0(%rip),%r15
xor    %ebx,%ebx
jmp    1197 <asin_tab+0x67>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    %ebx,%ebp
je     11e1 <asin_tab+0xb1>
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
divss  0x4(%rsp),%xmm0
call   1050 <asin@plt>
mulsd  0xe4f(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
divsd  0xe49(%rip),%xmm0
cvttsd2si %xmm0,%eax
movzbl %al,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r12d,%ebx
jge    1190 <asin_tab+0x60>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1190 <asin_tab+0x60>
lea    0xe4e(%rip),%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"unsigned char T_ASIN[256] = {\00"
@.str.1 = [5 x i8] c"0x%x\00"
@.str.2 = [3 x i8] c", \00"
@.str.3 = [4 x i8] c"};\0A\00"
define void @asin_tab(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %7
7: ; preds = %32, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %35
11: ; preds = %7
%12 = load i32, i32* %5
%13 = sitofp i32 %12 to float
%14 = load i32, i32* %3
%15 = sitofp i32 %14 to float
%16 = fdiv float %13, %15
%17 = call double @asin(float %16)
%18 = fmul double %17, 1.800000e+02
%19 = load i32, i32* %4
%20 = sitofp i32 %19 to double
%21 = fmul double %18, %20
%22 = fdiv double %21, 2.826000e+02
%23 = fptoui double %22 to i8
%24 = zext i8 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %5
%27 = load i32, i32* %3
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %31
29: ; preds = %11
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %29, %11
br label %32
32: ; preds = %31
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %7
35: ; preds = %7
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"unsigned char T_ASIN[256] = {\00"
@.str.1 = [5 x i8] c"0x%x\00"
@.str.2 = [3 x i8] c", \00"
@str = [3 x i8] c"};\00"
define void @asin_tab(i32 %0, i32 %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%4 = icmp slt i32 %0, 0
br i1 %4, label %25, label %5
5: ; preds = %2
%6 = sitofp i32 %0 to float
%7 = sitofp i32 %1 to double
br label %8
8: ; preds = %5, %22
%9 = phi i32 [ 0, %5 ], [ %23, %22 ]
%10 = sitofp i32 %9 to float
%11 = fdiv float %10, %6
%12 = tail call double @asin(float %11)
%13 = fmul double %12, 1.800000e+02
%14 = fmul double %13, %7
%15 = fdiv double %14, 2.826000e+02
%16 = fptoui double %15 to i8
%17 = zext i8 %16 to i32
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = icmp slt i32 %9, %0
br i1 %19, label %20, label %22
20: ; preds = %8
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %8, %20
%23 = add nuw i32 %9, 1
%24 = icmp eq i32 %9, %0
br i1 %24, label %25, label %8
25: ; preds = %22, %2
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}