#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*/ init_uart(int /*<<< orphan*/, int);
int /*<<< orphan*/ putchar(int);
double sin(float);
int main(void) {
  float spunk;
  char res;
  char p;
  init_uart(0, 1);
  while (1) {
    for (spunk = 0.0; spunk < 6.283; spunk = spunk + 0.1) {
      res = 30.0 * sin(spunk) + 40.0;
      for (p = 0; p < res; ++p) {
        putchar(' ');
      }
      putchar('*');
      putchar(0x0d);
      putchar(0x0a);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
mov    $0x1,%esi
call   1050 <init_uart@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe9c(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1203 <main+0xd3>
movss  -0x8(%rbp),%xmm0
call   1040 <sin@plt>
movsd  0xe88(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe84(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %al,-0x9(%rbp)
movb   $0x0,-0xa(%rbp)
movsbl -0xa(%rbp),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jge    11c2 <main+0x92>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xa(%rbp),%al
add    $0x1,%al
mov    %al,-0xa(%rbp)
jmp    119b <main+0x6b>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xd,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe27(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1153 <main+0x23>
jmp    114b <main+0x1b>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
mov    $0x1,%esi
call   1050 <init_uart@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xorpd  %xmm0,%xmm0
xorps  %xmm2,%xmm2
jmp    11a5 <main+0x75>
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0xd,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0x8(%rsp),%xmm0
addsd  0xe84(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
movsd  0xe79(%rip),%xmm1
ucomisd %xmm2,%xmm1
jbe    1150 <main+0x20>
movsd  %xmm2,0x8(%rsp)
call   1040 <sin@plt>
mulsd  0xe48(%rip),%xmm0
addsd  0xe48(%rip),%xmm0
cvttsd2si %xmm0,%ebx
test   %bl,%bl
jle    1160 <main+0x30>
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xff,%bl
jne    11d0 <main+0xa0>
jmp    1160 <main+0x30>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i8
%4 = alloca i8
store i32 0, i32* %1
%5 = call i32 @init_uart(i32 0, i32 1)
br label %6
6: ; preds = %0, %36
store float 0.000000e+00, float* %2
br label %7
7: ; preds = %31, %6
%8 = load float, float* %2
%9 = fpext float %8 to double
%10 = fcmp olt double %9, 6.283000e+00
br i1 %10, label %11, label %36
11: ; preds = %7
%12 = load float, float* %2
%13 = call double @sin(float %12)
%14 = call double @llvm.fmuladd.f64(double 3.000000e+01, double %13, double 4.000000e+01)
%15 = fptosi double %14 to i8
store i8 %15, i8* %3
store i8 0, i8* %4
br label %16
16: ; preds = %24, %11
%17 = load i8, i8* %4
%18 = sext i8 %17 to i32
%19 = load i8, i8* %3
%20 = sext i8 %19 to i32
%21 = icmp slt i32 %18, %20
br i1 %21, label %22, label %27
22: ; preds = %16
%23 = call i32 @putchar(i32 32)
br label %24
24: ; preds = %22
%25 = load i8, i8* %4
%26 = add i8 %25, 1
store i8 %26, i8* %4
br label %16
27: ; preds = %16
%28 = call i32 @putchar(i32 42)
%29 = call i32 @putchar(i32 13)
%30 = call i32 @putchar(i32 10)
br label %31
31: ; preds = %27
%32 = load float, float* %2
%33 = fpext float %32 to double
%34 = fadd double %33, 1.000000e-01
%35 = fptrunc double %34 to float
store float %35, float* %2
br label %7
36: ; preds = %7
br label %6
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @init_uart(i32 0, i32 1)
br label %2
2: ; preds = %15, %0
br label %3
3: ; preds = %2, %15
%4 = phi double [ 0.000000e+00, %2 ], [ %21, %15 ]
%5 = phi float [ 0.000000e+00, %2 ], [ %20, %15 ]
%6 = tail call double @sin(float %5)
%7 = tail call double @llvm.fmuladd.f64(double %6, double 3.000000e+01, double 4.000000e+01)
%8 = fptosi double %7 to i8
%9 = icmp sgt i8 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %3, %10
%11 = phi i8 [ %13, %10 ], [ 0, %3 ]
%12 = tail call i32 @putchar(i32 32)
%13 = add nuw nsw i8 %11, 1
%14 = icmp eq i8 %13, %8
br i1 %14, label %15, label %10
15: ; preds = %10, %3
%16 = tail call i32 @putchar(i32 42)
%17 = tail call i32 @putchar(i32 13)
%18 = tail call i32 @putchar(i32 10)
%19 = fadd double %4, 1.000000e-01
%20 = fptrunc double %19 to float
%21 = fpext float %20 to double
%22 = fcmp olt double %21, 6.283000e+00
br i1 %22, label %3, label %2
}