#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 M_PI;
int /*<<< orphan*/ assert(int);
double sin(double);
int main() {
  double s, f = 0.0, fStep = 0.1 * M_PI;
  int n = 0;
  do {
    s = sin(f);
    f += fStep;
    n++;
  } while (f < M_PI);
  assert(n < 11);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xec1(%rip),%xmm0
mov    0x2ea2(%rip),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movsd  -0x18(%rbp),%xmm1
mov    0x2e5f(%rip),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
ja     1156 <main+0x36>
cmpl   $0xb,-0x24(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    0x2ebb(%rip),%rbx
movsd  (%rbx),%xmm2
movsd  0xec7(%rip),%xmm1
mulsd  %xmm2,%xmm1
xorpd  %xmm0,%xmm0
mov    $0xffffffff,%ebp
movsd  0xeba(%rip),%xmm3
movsd  0xeba(%rip),%xmm4
cs nopw 0x0(%rax,%rax,1)
ucomisd %xmm3,%xmm0
jae    117b <main+0x5b>
ucomisd %xmm0,%xmm4
jae    117b <main+0x5b>
addsd  %xmm1,%xmm0
add    $0x1,%ebp
ucomisd %xmm0,%xmm2
ja     1160 <main+0x40>
jmp    11ae <main+0x8e>
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
call   1040 <sin@plt>
movsd  0xe7c(%rip),%xmm4
movsd  0xe6c(%rip),%xmm3
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  (%rbx),%xmm2
jmp    116c <main+0x4c>
xor    %edi,%edi
cmp    $0xa,%ebp
setb   %dil
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store i32 0, i32* %1
store double 0.000000e+00, double* %3
%6 = load double, double* @M_PI
%7 = fmul double 1.000000e-01, %6
store double %7, double* %4
store i32 0, i32* %5
br label %8
8: ; preds = %16, %0
%9 = load double, double* %3
%10 = call double @sin(double %9)
store double %10, double* %2
%11 = load double, double* %4
%12 = load double, double* %3
%13 = fadd double %12, %11
store double %13, double* %3
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
br label %16
16: ; preds = %8
%17 = load double, double* %3
%18 = load double, double* @M_PI
%19 = fcmp olt double %17, %18
br i1 %19, label %8, label %20
20: ; preds = %16
%21 = load i32, i32* %5
%22 = icmp slt i32 %21, 11
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define i32 @main() {
%1 = load double, double* @M_PI
%2 = fmul double %1, 1.000000e-01
br label %3
3: ; preds = %13, %0
%4 = phi double [ %1, %0 ], [ %14, %13 ]
%5 = phi double [ 0.000000e+00, %0 ], [ %15, %13 ]
%6 = phi i32 [ 0, %0 ], [ %16, %13 ]
%7 = fcmp oeq double %5, 0xFFF0000000000000
%8 = fcmp oeq double %5, 0x7FF0000000000000
%9 = or i1 %8, %7
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = tail call double @sin(double %5)
%12 = load double, double* @M_PI
br label %13
13: ; preds = %3, %10
%14 = phi double [ %4, %3 ], [ %12, %10 ]
%15 = fadd double %2, %5
%16 = add nuw nsw i32 %6, 1
%17 = fcmp olt double %15, %14
br i1 %17, label %3, label %18
18: ; preds = %13
%19 = icmp ult i32 %6, 10
%20 = zext i1 %19 to i32
%21 = tail call i32 @assert(i32 %20)
ret i32 0
}