#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 *, double);
double sin(double);
int main() {
  const double scale = 41.0916;
  double xpos, xinc, iteration;
  xpos = 0.0;
  for (iteration = 0; iteration <= 20; iteration = iteration + 0.1) {
    xinc = sin(iteration);
    xpos = xpos + 1 + xinc;
    printf("\\ThreeDput[normal=1 0 "
           "0](%.3f,0,0){\\pscircle[fillstyle=solid,fillcolor=green,linecolor="
           "black](0,0){0.3}}\n",
           xpos / scale);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xeb4(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jb     11b9 <main+0x99>
movsd  -0x28(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  0xe9a(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe6e(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
movsd  0xe6e(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    114c <main+0x2c>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xorpd  %xmm0,%xmm0
lea    0xef0(%rip),%rbx
xorpd  %xmm1,%xmm1
movsd  %xmm1,(%rsp)
nopl   0x0(%rax)
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
movsd  (%rsp),%xmm1
addsd  0xea2(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movapd %xmm1,%xmm0
divsd  0xe95(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
addsd  0xe87(%rip),%xmm0
movsd  0xe87(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1140 <main+0x20>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [106 x i8] c"\\ThreeDput[normal=1 0 0](%.3f,0,0){\\pscircle[fillstyle=solid,fillcolor=green,linecolor=black](0,0){0.3}}\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
store double 4.109160e+01, double* %2
store double 0.000000e+00, double* %3
store double 0.000000e+00, double* %5
br label %6
6: ; preds = %19, %0
%7 = load double, double* %5
%8 = fcmp ole double %7, 2.000000e+01
br i1 %8, label %9, label %22
9: ; preds = %6
%10 = load double, double* %5
%11 = call double @sin(double %10)
store double %11, double* %4
%12 = load double, double* %3
%13 = fadd double %12, 1.000000e+00
%14 = load double, double* %4
%15 = fadd double %13, %14
store double %15, double* %3
%16 = load double, double* %3
%17 = fdiv double %16, 4.109160e+01
%18 = call i32 @printf(i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str, i64 0, i64 0), double %17)
br label %19
19: ; preds = %9
%20 = load double, double* %5
%21 = fadd double %20, 1.000000e-01
store double %21, double* %5
br label %6
22: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [106 x i8] c"\\ThreeDput[normal=1 0 0](%.3f,0,0){\\pscircle[fillstyle=solid,fillcolor=green,linecolor=black](0,0){0.3}}\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi double [ 0.000000e+00, %0 ], [ %9, %1 ]
%3 = phi double [ 0.000000e+00, %0 ], [ %6, %1 ]
%4 = tail call double @sin(double %2)
%5 = fadd double %3, 1.000000e+00
%6 = fadd double %5, %4
%7 = fdiv double %6, 4.109160e+01
%8 = tail call i32 @printf(i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str, i64 0, i64 0), double %7)
%9 = fadd double %2, 1.000000e-01
%10 = fcmp ugt double %9, 2.000000e+01
br i1 %10, label %11, label %1
11: ; preds = %1
ret i32 0
}