#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 sin(int);
int main() {
  int i, deg = 0;
  float y;
  printf("                       Y ---->                     \n");
  printf("  ------------------------------------------------>\n");
  for (i = deg; i < 180; i += 15) {
    if (i == 90)
      printf("X |");
    else
      printf("  |");
    y = sin((i * 3.14) / 90) + 1;
    printf("%*d ", (int)(y * 25), 0);
    printf(" \n");
  }
  printf(" \n \n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0xb4,-0x8(%rbp)
jge    11ff <main+0xdf>
cmpl   $0x5a,-0x8(%rbp)
jne    1182 <main+0x62>
lea    0xf0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1190 <main+0x70>
lea    0xefd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe73(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe5f(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
add    $0x1,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe36(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
cvttss2si %xmm0,%esi
lea    0xeb0(%rip),%rdi
xor    %edx,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xf,%eax
mov    %eax,-0x8(%rbp)
jmp    1158 <main+0x38>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0e(%rip),%rdi
call   1030 <puts@plt>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0xfffffff1,%ebp
lea    0xeb2(%rip),%r15
lea    0xeaf(%rip),%r12
lea    0xeac(%rip),%r14
lea    0xf14(%rip),%rbx
nop
cmp    $0x4b,%ebp
mov    %r12,%rdi
cmove  %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0xe61(%rip),%xmm0
divsd  0xe61(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <sin@plt>
add    $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0xe56(%rip),%xmm0
cvttss2si %xmm0,%esi
mov    %r14,%rdi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
movsd  0x8(%rsp),%xmm0
addsd  0xe28(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
add    $0xf,%ebp
cmp    $0xa5,%ebp
jb     1180 <main+0x50>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [53 x i8] c" Y ----> \0A\00"
@.str.1 = [53 x i8] c" ------------------------------------------------>\0A\00"
@.str.2 = [4 x i8] c"X |\00"
@.str.3 = [4 x i8] c" |\00"
@.str.4 = [5 x i8] c"%*d \00"
@.str.5 = [3 x i8] c" \0A\00"
@.str.6 = [5 x i8] c" \0A \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
store i32 0, i32* %1
store i32 0, i32* %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* %3
store i32 %7, i32* %2
br label %8
8: ; preds = %32, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 180
br i1 %10, label %11, label %35
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 90
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %18
16: ; preds = %11
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
%19 = load i32, i32* %2
%20 = sitofp i32 %19 to double
%21 = fmul double %20, 3.140000e+00
%22 = fdiv double %21, 9.000000e+01
%23 = fptosi double %22 to i32
%24 = call i32 @sin(i32 %23)
%25 = add nsw i32 %24, 1
%26 = sitofp i32 %25 to float
store float %26, float* %4
%27 = load float, float* %4
%28 = fmul float %27, 2.500000e+01
%29 = fptosi float %28 to i32
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %29, i32 0)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %32
32: ; preds = %18
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 15
store i32 %34, i32* %2
br label %8
35: ; preds = %8
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [4 x i8] c"X |\00"
@.str.3 = [4 x i8] c" |\00"
@.str.4 = [5 x i8] c"%*d \00"
@str = [52 x i8] c" Y ----> \00"
@str.7 = [52 x i8] c" ------------------------------------------------>\00"
@str.8 = [4 x i8] c" \0A \00"
@str.9 = [2 x i8] c" \00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.7, i64 0, i64 0))
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %19, %3 ]
%5 = icmp eq i32 %4, 90
%6 = select i1 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %6)
%8 = sitofp i32 %4 to double
%9 = fmul double %8, 3.140000e+00
%10 = fdiv double %9, 9.000000e+01
%11 = fptosi double %10 to i32
%12 = tail call i32 @sin(i32 %11)
%13 = add nsw i32 %12, 1
%14 = sitofp i32 %13 to float
%15 = fmul float %14, 2.500000e+01
%16 = fptosi float %15 to i32
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %16, i32 0)
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0))
%19 = add nuw nsw i32 %4, 15
%20 = icmp ult i32 %4, 165
br i1 %20, label %3, label %21
21: ; preds = %3
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.8, i64 0, i64 0))
ret i32 0
}