#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 TestSinCosD(double const);
int TestSinCosF(double);
double drand48();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ srand48(int);
int main(int argc, char *argv[]) {
  const double pi = 3.14159265;
  const double fourpi = 4.0 * pi;
  double a;
  int i;
  int sawproblem = 0;
  for (a = -fourpi; a < fourpi; a += pi / 8.0) {
    sawproblem |= TestSinCosD(a);
    sawproblem |= TestSinCosF(a);
  }
  srand48(12345678);
  for (i = 0; i < 100; i++) {
    sawproblem |= TestSinCosD(fourpi * (drand48() - 0.5));
    sawproblem |= TestSinCosF(drand48());
  }
  if (!sawproblem) {
    printf("No problems!\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)
movsd  0xea2(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe8d(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x30(%rbp)
movsd  0xe71(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe6c(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    11de <main+0x8e>
movsd  -0x28(%rbp),%xmm0
call   1040 <TestSinCosD@plt>
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <TestSinCosF@plt>
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
movsd  0xe51(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1194 <main+0x44>
mov    $0xbc614e,%edi
call   1060 <srand48@plt>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x64,-0x2c(%rbp)
jge    1246 <main+0xf6>
mov    $0x0,%al
call   1070 <drand48@plt>
movaps %xmm0,%xmm1
movsd  0xe0d(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xdf1(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <TestSinCosD@plt>
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    $0x0,%al
call   1070 <drand48@plt>
call   1050 <TestSinCosF@plt>
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11ef <main+0x9f>
cmpl   $0x0,-0x30(%rbp)
jne    125c <main+0x10c>
lea    0xdd1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movsd  0xea0(%rip),%xmm0
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <TestSinCosD@plt>
mov    %eax,%ebp
or     %ebx,%ebp
movsd  0x8(%rsp),%xmm0
call   1050 <TestSinCosF@plt>
mov    %eax,%ebx
or     %ebp,%ebx
movsd  0x8(%rsp),%xmm0
addsd  0xe66(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe60(%rip),%xmm0
ucomisd 0x8(%rsp),%xmm0
movsd  0x8(%rsp),%xmm0
ja     1170 <main+0x20>
mov    $0xbc614e,%edi
call   1060 <srand48@plt>
mov    $0x64,%ebp
nopl   (%rax)
xor    %eax,%eax
call   1070 <drand48@plt>
addsd  0xe39(%rip),%xmm0
mulsd  0xe29(%rip),%xmm0
call   1040 <TestSinCosD@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1070 <drand48@plt>
call   1050 <TestSinCosF@plt>
or     %eax,%ebx
or     %r14d,%ebx
add    $0xffffffff,%ebp
jne    11d0 <main+0x80>
test   %ebx,%ebx
jne    1215 <main+0xc5>
lea    0xe10(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"No problems!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 0x400921FB53C8D4F1, double* %6
store double 0x402921FB53C8D4F1, double* %7
store i32 0, i32* %10
store double 0xC02921FB53C8D4F1, double* %8
br label %11
11: ; preds = %23, %2
%12 = load double, double* %8
%13 = fcmp olt double %12, 0x402921FB53C8D4F1
br i1 %13, label %14, label %26
14: ; preds = %11
%15 = load double, double* %8
%16 = call i32 @TestSinCosD(double %15)
%17 = load i32, i32* %10
%18 = or i32 %17, %16
store i32 %18, i32* %10
%19 = load double, double* %8
%20 = call i32 @TestSinCosF(double %19)
%21 = load i32, i32* %10
%22 = or i32 %21, %20
store i32 %22, i32* %10
br label %23
23: ; preds = %14
%24 = load double, double* %8
%25 = fadd double %24, 0x3FD921FB53C8D4F1
store double %25, double* %8
br label %11
26: ; preds = %11
%27 = call i32 @srand48(i32 12345678)
store i32 0, i32* %9
br label %28
28: ; preds = %42, %26
%29 = load i32, i32* %9
%30 = icmp slt i32 %29, 100
br i1 %30, label %31, label %45
31: ; preds = %28
%32 = call double (...) @drand48()
%33 = fsub double %32, 5.000000e-01
%34 = fmul double 0x402921FB53C8D4F1, %33
%35 = call i32 @TestSinCosD(double %34)
%36 = load i32, i32* %10
%37 = or i32 %36, %35
store i32 %37, i32* %10
%38 = call double (...) @drand48()
%39 = call i32 @TestSinCosF(double %38)
%40 = load i32, i32* %10
%41 = or i32 %40, %39
store i32 %41, i32* %10
br label %42
42: ; preds = %31
%43 = load i32, i32* %9
%44 = add nsw i32 %43, 1
store i32 %44, i32* %9
br label %28
45: ; preds = %28
%46 = load i32, i32* %10
%47 = icmp ne i32 %46, 0
br i1 %47, label %50, label %48
48: ; preds = %45
%49 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %50
50: ; preds = %48, %45
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"No problems!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i32 [ 0, %2 ], [ %9, %3 ]
%5 = phi double [ 0xC02921FB53C8D4F1, %2 ], [ %10, %3 ]
%6 = tail call i32 @TestSinCosD(double %5)
%7 = or i32 %6, %4
%8 = tail call i32 @TestSinCosF(double %5)
%9 = or i32 %7, %8
%10 = fadd double %5, 0x3FD921FB53C8D4F1
%11 = fcmp olt double %10, 0x402921FB53C8D4F1
br i1 %11, label %3, label %12
12: ; preds = %3
%13 = tail call i32 @srand48(i32 12345678)
br label %14
14: ; preds = %12, %14
%15 = phi i32 [ %9, %12 ], [ %24, %14 ]
%16 = phi i32 [ 0, %12 ], [ %25, %14 ]
%17 = tail call double (...) @drand48()
%18 = fadd double %17, -5.000000e-01
%19 = fmul double %18, 0x402921FB53C8D4F1
%20 = tail call i32 @TestSinCosD(double %19)
%21 = or i32 %20, %15
%22 = tail call double (...) @drand48()
%23 = tail call i32 @TestSinCosF(double %22)
%24 = or i32 %21, %23
%25 = add nuw nsw i32 %16, 1
%26 = icmp eq i32 %25, 100
br i1 %26, label %27, label %14
27: ; preds = %14
%28 = icmp eq i32 %24, 0
br i1 %28, label %29, label %31
29: ; preds = %27
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %31
31: ; preds = %29, %27
ret i32 0
}