#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 */
typedef int /*<<< orphan*/ uint64_t;
struct timeval {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
double atof(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double, double, ...);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(double *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
double sin(double);
scalar_t__ usec_diff(struct timeval);
int main() {
  double input;
  double s, c;
  char line[15];
  double *buffer;
  double *sin_buffer;
  double *cos_buffer;
  buffer = (double *)malloc(sizeof(double) * 1000000);
  sin_buffer = (double *)malloc(sizeof(double) * 1000000);
  cos_buffer = (double *)malloc(sizeof(double) * 1000000);
  FILE *ifp = fopen("trig.in", "r");
  FILE *ofp = fopen("trig.out", "w");
  int do_stuff = 1;
  int last_read_count = 0;
  int i;
  struct timeval start_time;
  gettimeofday(&start_time, NULL);
  uint64_t usec_math_count = 0;
  uint64_t usec_total = 0;
  while (1) {
    memset(buffer, 0, sizeof(double) * 1000000);
    memset(sin_buffer, 0, sizeof(double) * 1000000);
    memset(cos_buffer, 0, sizeof(double) * 1000000);
    last_read_count = 0;
    for (i = 0; i < 1000000; i++) {
      do_stuff = fgets(line, 15, ifp) != (char *)0;
      if (!do_stuff) {
        break;
      }
      buffer[i] = atof(line);
    }
    last_read_count = i;
    struct timeval math_time;
    gettimeofday(&math_time, NULL);
    for (i = 0; i < last_read_count; i++) {
      sin_buffer[i] = sin(
          buffer[i] * 0.017453292519943295769236907684886127134428718885417);
      cos_buffer[i] = sin(
          1.570796326794896619231321691639751442098584699687552 -
          buffer[i] * 0.017453292519943295769236907684886127134428718885417);
    }
    usec_math_count += usec_diff(math_time);
    for (i = 0; i < last_read_count; i++) {
      if (cos_buffer[i] < 0.000000001 && cos_buffer[i] > -0.000000001) {
        fprintf(ofp, "%.7f %.7f n\n", sin_buffer[i], cos_buffer[i]);
      } else {
        fprintf(ofp, "%.7f %.7f %.7f\n", sin_buffer[i], cos_buffer[i],
                (sin_buffer[i] / cos_buffer[i]));
      }
    }
    if (!do_stuff) {
      break;
    }
  }
  fclose(ifp);
  fclose(ofp);
  usec_total += usec_diff(start_time);
  printf("estimated math time in usec: %llu\n", usec_math_count);
  printf("estimated run time in usec: %llu\n", usec_total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x7a1200,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    $0x7a1200,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    $0x7a1200,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x48(%rbp)
lea    0xe2d(%rip),%rdi
lea    0xe2e(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x50(%rbp)
lea    0xe20(%rip),%rdi
lea    0xe22(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x58(%rbp)
movl   $0x1,-0x5c(%rbp)
movl   $0x0,-0x60(%rbp)
lea    -0x68(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <gettimeofday@plt>
movl   $0x0,-0x6c(%rbp)
movl   $0x0,-0x70(%rbp)
mov    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x7a1200,%edx
call   1070 <memset@plt>
mov    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x7a1200,%edx
call   1070 <memset@plt>
mov    -0x48(%rbp),%rdi
xor    %esi,%esi
mov    $0x7a1200,%edx
call   1070 <memset@plt>
movl   $0x0,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
cmpl   $0xf4240,-0x64(%rbp)
jge    12e2 <main+0x132>
lea    -0x2f(%rbp),%rdi
mov    -0x50(%rbp),%rdx
mov    $0xf,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x5c(%rbp)
cmpl   $0x0,-0x5c(%rbp)
jne    12be <main+0x10e>
jmp    12e2 <main+0x132>
lea    -0x2f(%rbp),%rdi
call   1030 <atof@plt>
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1281 <main+0xd1>
mov    -0x64(%rbp),%eax
mov    %eax,-0x60(%rbp)
lea    -0x78(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <gettimeofday@plt>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x60(%rbp),%eax
jge    138b <main+0x1db>
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  0xcf8(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
call   10a0 <sin@plt>
mov    -0x40(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xcb5(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xcb1(%rip),%xmm1
addsd  %xmm1,%xmm0
call   10a0 <sin@plt>
mov    -0x48(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    12fc <main+0x14c>
mov    -0x78(%rbp),%edi
call   10c0 <usec_diff@plt>
mov    %rax,%rcx
movslq -0x6c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x6c(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x60(%rbp),%eax
jge    1477 <main+0x2c7>
mov    -0x48(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  0xc3d(%rip),%xmm0
ucomisd (%rax,%rcx,8),%xmm0
jbe    141e <main+0x26e>
mov    -0x48(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xc25(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    141e <main+0x26e>
mov    -0x58(%rbp),%rdi
mov    -0x40(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xc23(%rip),%rsi
mov    $0x2,%al
call   1090 <fprintf@plt>
jmp    1464 <main+0x2b4>
mov    -0x58(%rbp),%rdi
mov    -0x40(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x40(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x48(%rbp),%rax
movslq -0x64(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm2
lea    0xbe5(%rip),%rsi
mov    $0x3,%al
call   1090 <fprintf@plt>
jmp    1469 <main+0x2b9>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    13a7 <main+0x1f7>
cmpl   $0x0,-0x5c(%rbp)
jne    1486 <main+0x2d6>
jmp    148b <main+0x2db>
jmp    1243 <main+0x93>
mov    -0x50(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x58(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x68(%rbp),%edi
call   10c0 <usec_diff@plt>
mov    %rax,%rcx
movslq -0x70(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x70(%rbp)
mov    -0x6c(%rbp),%esi
lea    0xb96(%rip),%rdi
call   1050 <printf@plt>
mov    -0x70(%rbp),%esi
lea    0xbaa(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    $0x7a1200,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbx
mov    $0x7a1200,%edi
call   10b0 <malloc@plt>
mov    %rax,%r14
mov    $0x7a1200,%edi
call   10b0 <malloc@plt>
mov    %rax,%r15
lea    0xe34(%rip),%rdi
lea    0xe35(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,%r13
lea    0xe28(%rip),%rdi
lea    0xe2a(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,0x20(%rsp)
xor    %ebp,%ebp
lea    0x28(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    %r13,0x38(%rsp)
mov    %r14,0x10(%rsp)
jmp    124b <main+0x9b>
nopl   (%rax)
movslq 0x40(%rsp),%rax
mov    0x18(%rsp),%rbp
add    %rax,%rbp
test   %r12,%r12
mov    0x38(%rsp),%r13
je     149e <main+0x2ee>
mov    %rbp,0x40(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x7a1200,%edx
call   1070 <memset@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x7a1200,%edx
call   1070 <memset@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x7a1200,%edx
call   1070 <memset@plt>
xor    %ebp,%ebp
lea    0x49(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    $0xf,%esi
mov    %r13,%rdx
call   1080 <fgets@plt>
mov    %rax,%r12
test   %rax,%rax
je     12e0 <main+0x130>
mov    %r14,%rdi
call   1030 <atof@plt>
movsd  %xmm0,(%rbx,%rbp,8)
add    $0x1,%rbp
cmp    $0xf4240,%rbp
jne    1290 <main+0xe0>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    $0xf4240,%ebp
jmp    12f7 <main+0x147>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %r13d,%r13d
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
test   %ebp,%ebp
je     1491 <main+0x2e1>
mov    0x10(%rsp),%r14
movsd  0xcfc(%rip),%xmm1
mov    %ebp,%r13d
cmp    $0x1,%ebp
mov    %rbp,0x30(%rsp)
mov    %r13,0x18(%rsp)
jne    1320 <main+0x170>
xor    %ebp,%ebp
jmp    13bd <main+0x20d>
nopl   (%rax)
and    $0xfffffffe,%r13d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
movsd  (%rbx,%rbp,8),%xmm0
mulsd  %xmm1,%xmm0
call   10a0 <sin@plt>
movsd  %xmm0,(%r14,%rbp,8)
movsd  (%rbx,%rbp,8),%xmm1
mulsd  0xcaf(%rip),%xmm1
movsd  0xcaf(%rip),%xmm0
subsd  %xmm1,%xmm0
call   10a0 <sin@plt>
movsd  %xmm0,(%r15,%rbp,8)
movsd  0x8(%rbx,%rbp,8),%xmm0
mulsd  0xc8a(%rip),%xmm0
call   10a0 <sin@plt>
movsd  %xmm0,0x8(%r14,%rbp,8)
movsd  0x8(%rbx,%rbp,8),%xmm1
mulsd  0xc70(%rip),%xmm1
movsd  0xc70(%rip),%xmm0
subsd  %xmm1,%xmm0
call   10a0 <sin@plt>
movsd  0xc57(%rip),%xmm1
movsd  %xmm0,0x8(%r15,%rbp,8)
add    $0x2,%rbp
cmp    %rbp,%r13
jne    1330 <main+0x180>
testb  $0x1,0x18(%rsp)
je     13fc <main+0x24c>
movsd  (%rbx,%rbp,8),%xmm0
mulsd  %xmm1,%xmm0
call   10a0 <sin@plt>
movsd  %xmm0,(%r14,%rbp,8)
movsd  (%rbx,%rbp,8),%xmm1
mulsd  0xc1b(%rip),%xmm1
movsd  0xc1b(%rip),%xmm0
subsd  %xmm1,%xmm0
call   10a0 <sin@plt>
movsd  %xmm0,(%r15,%rbp,8)
xor    %ebp,%ebp
mov    0x30(%rsp),%r13
mov    0x8(%rsp),%edi
call   10c0 <usec_diff@plt>
mov    %rax,0x18(%rsp)
test   %bpl,%bpl
jne    1230 <main+0x80>
mov    %r13d,%ebp
xor    %r13d,%r13d
jmp    1458 <main+0x2a8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
mov    0x20(%rsp),%rdi
lea    0xbfe(%rip),%rsi
mov    $0x3,%al
call   1090 <fprintf@plt>
add    $0x1,%r13
cmp    %r13,%rbp
je     1230 <main+0x80>
movsd  (%r15,%r13,8),%xmm1
movsd  0xbaa(%rip),%xmm0
ucomisd %xmm1,%xmm0
movsd  (%r14,%r13,8),%xmm0
jbe    1430 <main+0x280>
ucomisd 0xb9e(%rip),%xmm1
jbe    1430 <main+0x280>
mov    0x20(%rsp),%rdi
lea    0xbad(%rip),%rsi
mov    $0x2,%al
call   1090 <fprintf@plt>
jmp    144b <main+0x29b>
mov    $0x1,%bpl
mov    0x10(%rsp),%r14
jmp    1403 <main+0x253>
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    0x20(%rsp),%rdi
call   1040 <fclose@plt>
mov    0x28(%rsp),%edi
call   10c0 <usec_diff@plt>
mov    %rax,%rbx
lea    0xb8f(%rip),%rdi
mov    %ebp,%esi
call   1050 <printf@plt>
lea    0xba4(%rip),%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
@.str = [8 x i8] c"trig.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"trig.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [13 x i8] c"%.7f %.7f n\0A\00"
@.str.5 = [16 x i8] c"%.7f %.7f %.7f\0A\00"
@.str.6 = [35 x i8] c"estimated math time in usec: %llu\0A\00"
@.str.7 = [34 x i8] c"estimated run time in usec: %llu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca [15 x i8]
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca %struct.timeval
%15 = alloca i32
%16 = alloca i32
%17 = alloca %struct.timeval
store i32 0, i32* %1
%18 = call i64 @malloc(i32 8000000)
%19 = inttoptr i64 %18 to double*
store double* %19, double** %6
%20 = call i64 @malloc(i32 8000000)
%21 = inttoptr i64 %20 to double*
store double* %21, double** %7
%22 = call i64 @malloc(i32 8000000)
%23 = inttoptr i64 %22 to double*
store double* %23, double** %8
%24 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %24, i32** %9
%25 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %25, i32** %10
store i32 1, i32* %11
store i32 0, i32* %12
%26 = call i32 @gettimeofday(%struct.timeval* %14, i32* null)
store i32 0, i32* %15
store i32 0, i32* %16
br label %27
27: ; preds = %0, %161
%28 = load double*, double** %6
%29 = call i32 @memset(double* %28, i32 0, i32 8000000)
%30 = load double*, double** %7
%31 = call i32 @memset(double* %30, i32 0, i32 8000000)
%32 = load double*, double** %8
%33 = call i32 @memset(double* %32, i32 0, i32 8000000)
store i32 0, i32* %12
store i32 0, i32* %13
br label %34
34: ; preds = %53, %27
%35 = load i32, i32* %13
%36 = icmp slt i32 %35, 1000000
br i1 %36, label %37, label %56
37: ; preds = %34
%38 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%39 = load i32*, i32** %9
%40 = call i8* @fgets(i8* %38, i32 15, i32* %39)
%41 = icmp ne i8* %40, null
%42 = zext i1 %41 to i32
store i32 %42, i32* %11
%43 = load i32, i32* %11
%44 = icmp ne i32 %43, 0
br i1 %44, label %46, label %45
45: ; preds = %37
br label %56
46: ; preds = %37
%47 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%48 = call double @atof(i8* %47)
%49 = load double*, double** %6
%50 = load i32, i32* %13
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %49, i64 %51
store double %48, double* %52
br label %53
53: ; preds = %46
%54 = load i32, i32* %13
%55 = add nsw i32 %54, 1
store i32 %55, i32* %13
br label %34
56: ; preds = %45, %34
%57 = load i32, i32* %13
store i32 %57, i32* %12
%58 = call i32 @gettimeofday(%struct.timeval* %17, i32* null)
store i32 0, i32* %13
br label %59
59: ; preds = %87, %56
%60 = load i32, i32* %13
%61 = load i32, i32* %12
%62 = icmp slt i32 %60, %61
br i1 %62, label %63, label %90
63: ; preds = %59
%64 = load double*, double** %6
%65 = load i32, i32* %13
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %64, i64 %66
%68 = load double, double* %67
%69 = fmul double %68, 0x3F91DF46A2529D39
%70 = call double @sin(double %69)
%71 = load double*, double** %7
%72 = load i32, i32* %13
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %71, i64 %73
store double %70, double* %74
%75 = load double*, double** %6
%76 = load i32, i32* %13
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds double, double* %75, i64 %77
%79 = load double, double* %78
%80 = fneg double %79
%81 = call double @llvm.fmuladd.f64(double %80, double 0x3F91DF46A2529D39, double 0x3FF921FB54442D18)
%82 = call double @sin(double %81)
%83 = load double*, double** %8
%84 = load i32, i32* %13
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds double, double* %83, i64 %85
store double %82, double* %86
br label %87
87: ; preds = %63
%88 = load i32, i32* %13
%89 = add nsw i32 %88, 1
store i32 %89, i32* %13
br label %59
90: ; preds = %59
%91 = getelementptr inbounds %struct.timeval, %struct.timeval* %17, i32 0, i32 0
%92 = load i32, i32* %91
%93 = call i64 @usec_diff(i32 %92)
%94 = load i32, i32* %15
%95 = sext i32 %94 to i64
%96 = add nsw i64 %95, %93
%97 = trunc i64 %96 to i32
store i32 %97, i32* %15
store i32 0, i32* %13
br label %98
98: ; preds = %154, %90
%99 = load i32, i32* %13
%100 = load i32, i32* %12
%101 = icmp slt i32 %99, %100
br i1 %101, label %102, label %157
102: ; preds = %98
%103 = load double*, double** %8
%104 = load i32, i32* %13
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds double, double* %103, i64 %105
%107 = load double, double* %106
%108 = fcmp olt double %107, 1.000000e-09
br i1 %108, label %109, label %129
109: ; preds = %102
%110 = load double*, double** %8
%111 = load i32, i32* %13
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds double, double* %110, i64 %112
%114 = load double, double* %113
%115 = fcmp ogt double %114, -1.000000e-09
br i1 %115, label %116, label %129
116: ; preds = %109
%117 = load i32*, i32** %10
%118 = load double*, double** %7
%119 = load i32, i32* %13
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds double, double* %118, i64 %120
%122 = load double, double* %121
%123 = load double*, double** %8
%124 = load i32, i32* %13
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds double, double* %123, i64 %125
%127 = load double, double* %126
%128 = call i32 (i32*, i8*, double, double, ...) @fprintf(i32* %117, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double %122, double %127)
br label %153
129: ; preds = %109, %102
%130 = load i32*, i32** %10
%131 = load double*, double** %7
%132 = load i32, i32* %13
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds double, double* %131, i64 %133
%135 = load double, double* %134
%136 = load double*, double** %8
%137 = load i32, i32* %13
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds double, double* %136, i64 %138
%140 = load double, double* %139
%141 = load double*, double** %7
%142 = load i32, i32* %13
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds double, double* %141, i64 %143
%145 = load double, double* %144
%146 = load double*, double** %8
%147 = load i32, i32* %13
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds double, double* %146, i64 %148
%150 = load double, double* %149
%151 = fdiv double %145, %150
%152 = call i32 (i32*, i8*, double, double, ...) @fprintf(i32* %130, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), double %135, double %140, double %151)
br label %153
153: ; preds = %129, %116
br label %154
154: ; preds = %153
%155 = load i32, i32* %13
%156 = add nsw i32 %155, 1
store i32 %156, i32* %13
br label %98
157: ; preds = %98
%158 = load i32, i32* %11
%159 = icmp ne i32 %158, 0
br i1 %159, label %161, label %160
160: ; preds = %157
br label %162
161: ; preds = %157
br label %27
162: ; preds = %160
%163 = load i32*, i32** %9
%164 = call i32 @fclose(i32* %163)
%165 = load i32*, i32** %10
%166 = call i32 @fclose(i32* %165)
%167 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 0
%168 = load i32, i32* %167
%169 = call i64 @usec_diff(i32 %168)
%170 = load i32, i32* %16
%171 = sext i32 %170 to i64
%172 = add nsw i64 %171, %169
%173 = trunc i64 %172 to i32
store i32 %173, i32* %16
%174 = load i32, i32* %15
%175 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), i32 %174)
%176 = load i32, i32* %16
%177 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i32 %176)
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
@.str = [8 x i8] c"trig.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"trig.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [13 x i8] c"%.7f %.7f n\0A\00"
@.str.5 = [16 x i8] c"%.7f %.7f %.7f\0A\00"
@.str.6 = [35 x i8] c"estimated math time in usec: %llu\0A\00"
@.str.7 = [34 x i8] c"estimated run time in usec: %llu\0A\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca %struct.timeval
%3 = alloca %struct.timeval
%4 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%5 = tail call i64 @malloc(i32 8000000)
%6 = inttoptr i64 %5 to double*
%7 = tail call i64 @malloc(i32 8000000)
%8 = inttoptr i64 %7 to double*
%9 = tail call i64 @malloc(i32 8000000)
%10 = inttoptr i64 %9 to double*
%11 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%13 = bitcast %struct.timeval* %2 to i8*
%14 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%15 = bitcast %struct.timeval* %3 to i8*
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
br label %17
17: ; preds = %112, %0
%18 = phi i64 [ 0, %0 ], [ %92, %112 ]
%19 = call i32 @memset(double* %6, i32 0, i32 8000000)
%20 = call i32 @memset(double* %8, i32 0, i32 8000000)
%21 = call i32 @memset(double* %10, i32 0, i32 8000000)
br label %22
22: ; preds = %17, %26
%23 = phi i64 [ 0, %17 ], [ %29, %26 ]
%24 = call i8* @fgets(i8* %4, i32 15, i32* %11)
%25 = icmp eq i8* %24, null
br i1 %25, label %33, label %26
26: ; preds = %22
%27 = call double @atof(i8* %4)
%28 = getelementptr inbounds double, double* %6, i64 %23
store double %27, double* %28
%29 = add nuw nsw i64 %23, 1
%30 = icmp eq i64 %29, 1000000
br i1 %30, label %31, label %22
31: ; preds = %26
%32 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
br label %37
33: ; preds = %22
%34 = trunc i64 %23 to i32
%35 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%36 = icmp eq i32 %34, 0
br i1 %36, label %85, label %37
37: ; preds = %31, %33
%38 = phi i32 [ 1000000, %31 ], [ %34, %33 ]
%39 = zext i32 %38 to i64
%40 = and i64 %39, 1
%41 = icmp eq i32 %38, 1
br i1 %41, label %71, label %42
42: ; preds = %37
%43 = and i64 %39, 4294967294
br label %44
44: ; preds = %44, %42
%45 = phi i64 [ 0, %42 ], [ %68, %44 ]
%46 = phi i64 [ 0, %42 ], [ %69, %44 ]
%47 = getelementptr inbounds double, double* %6, i64 %45
%48 = load double, double* %47
%49 = fmul double %48, 0x3F91DF46A2529D39
%50 = call double @sin(double %49)
%51 = getelementptr inbounds double, double* %8, i64 %45
store double %50, double* %51
%52 = load double, double* %47
%53 = fneg double %52
%54 = call double @llvm.fmuladd.f64(double %53, double 0x3F91DF46A2529D39, double 0x3FF921FB54442D18)
%55 = call double @sin(double %54)
%56 = getelementptr inbounds double, double* %10, i64 %45
store double %55, double* %56
%57 = or i64 %45, 1
%58 = getelementptr inbounds double, double* %6, i64 %57
%59 = load double, double* %58
%60 = fmul double %59, 0x3F91DF46A2529D39
%61 = call double @sin(double %60)
%62 = getelementptr inbounds double, double* %8, i64 %57
store double %61, double* %62
%63 = load double, double* %58
%64 = fneg double %63
%65 = call double @llvm.fmuladd.f64(double %64, double 0x3F91DF46A2529D39, double 0x3FF921FB54442D18)
%66 = call double @sin(double %65)
%67 = getelementptr inbounds double, double* %10, i64 %57
store double %66, double* %67
%68 = add nuw nsw i64 %45, 2
%69 = add i64 %46, 2
%70 = icmp eq i64 %69, %43
br i1 %70, label %71, label %44
71: ; preds = %44, %37
%72 = phi i64 [ 0, %37 ], [ %68, %44 ]
%73 = icmp eq i64 %40, 0
br i1 %73, label %85, label %74
74: ; preds = %71
%75 = getelementptr inbounds double, double* %6, i64 %72
%76 = load double, double* %75
%77 = fmul double %76, 0x3F91DF46A2529D39
%78 = call double @sin(double %77)
%79 = getelementptr inbounds double, double* %8, i64 %72
store double %78, double* %79
%80 = load double, double* %75
%81 = fneg double %80
%82 = call double @llvm.fmuladd.f64(double %81, double 0x3F91DF46A2529D39, double 0x3FF921FB54442D18)
%83 = call double @sin(double %82)
%84 = getelementptr inbounds double, double* %10, i64 %72
store double %83, double* %84
br label %85
85: ; preds = %74, %71, %33
%86 = phi i1 [ true, %33 ], [ false, %71 ], [ false, %74 ]
%87 = phi i32 [ 0, %33 ], [ %38, %71 ], [ %38, %74 ]
%88 = load i32, i32* %16
%89 = call i64 @usec_diff(i32 %88)
%90 = shl i64 %18, 32
%91 = ashr exact i64 %90, 32
%92 = add nsw i64 %89, %91
br i1 %86, label %112, label %93
93: ; preds = %85
%94 = zext i32 %87 to i64
br label %95
95: ; preds = %93, %109
%96 = phi i64 [ 0, %93 ], [ %110, %109 ]
%97 = getelementptr inbounds double, double* %10, i64 %96
%98 = load double, double* %97
%99 = fcmp olt double %98, 1.000000e-09
%100 = fcmp ogt double %98, -1.000000e-09
%101 = and i1 %99, %100
%102 = getelementptr inbounds double, double* %8, i64 %96
%103 = load double, double* %102
br i1 %101, label %104, label %106
104: ; preds = %95
%105 = call i32 (i32*, i8*, double, double, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), double %103, double %98)
br label %109
106: ; preds = %95
%107 = fdiv double %103, %98
%108 = call i32 (i32*, i8*, double, double, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), double %103, double %98, double %107)
br label %109
109: ; preds = %104, %106
%110 = add nuw nsw i64 %96, 1
%111 = icmp eq i64 %110, %94
br i1 %111, label %112, label %95
112: ; preds = %109, %85
br i1 %25, label %113, label %17
113: ; preds = %112
%114 = trunc i64 %92 to i32
%115 = call i32 @fclose(i32* %11)
%116 = call i32 @fclose(i32* %12)
%117 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%118 = load i32, i32* %117
%119 = call i64 @usec_diff(i32 %118)
%120 = trunc i64 %119 to i32
%121 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), i32 %114)
%122 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i32 %120)
ret i32 0
}