#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 sin(double);
int main(int argc, char **argv) {
  double i = 0.00;
  int j = 0;
  printf("testsin:\n");
  while (i < 100.0) {
    double v = sin(i);
    printf("float:sin(%f)=%f\n", i, v);
    i = i + 1.0;
  }
  printf("exit testsin\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xea5(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11a4 <main+0x84>
movsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xe94(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  0xe73(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1153 <main+0x33>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
xorpd  %xmm0,%xmm0
mov    $0x64,%ebp
lea    0xeb9(%rip),%rbx
nop
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  (%rsp),%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
addsd  0xe82(%rip),%xmm0
add    $0xffffffff,%ebp
jne    1150 <main+0x20>
lea    0xe99(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"testsin:\0A\00"
@.str.1 = [18 x i8] c"float:sin(%f)=%f\0A\00"
@.str.2 = [14 x i8] c"exit testsin\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca i32
%8 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 0.000000e+00, double* %6
store i32 0, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %13, %2
%11 = load double, double* %6
%12 = fcmp olt double %11, 1.000000e+02
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load double, double* %6
%15 = call double @sin(double %14)
store double %15, double* %8
%16 = load double, double* %6
%17 = load double, double* %8
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), double %16, double %17)
%19 = load double, double* %6
%20 = fadd double %19, 1.000000e+00
store double %20, double* %6
br label %10
21: ; preds = %10
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"float:sin(%f)=%f\0A\00"
@str = [9 x i8] c"testsin:\00"
@str.3 = [13 x i8] c"exit testsin\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %2, %4
%5 = phi i32 [ 0, %2 ], [ %9, %4 ]
%6 = sitofp i32 %5 to double
%7 = tail call double @sin(double %6)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), double %6, double %7)
%9 = add nuw nsw i32 %5, 1
%10 = icmp eq i32 %9, 100
br i1 %10, label %11, label %4
11: ; preds = %4
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.3, i64 0, i64 0))
ret i32 0
}