#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);
double minimaxsin(double);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
scalar_t__ usec_diff(struct timeval);
int main() {
  double input;
  double sin, cos;
  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] = minimaxsin(
          buffer[i] * 0.017453292519943295769236907684886127134428718885417);
      cos_buffer[i] = minimaxsin(
          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   1090 <minimaxsin@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   1090 <minimaxsin@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   10a0 <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   10a0 <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,%r14
mov    $0x7a1200,%edi
call   10b0 <malloc@plt>
mov    %rax,%r13
mov    $0x7a1200,%edi
call   10b0 <malloc@plt>
mov    %rax,%r15
lea    0xe34(%rip),%rdi
lea    0xe35(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,0x28(%rsp)
lea    0xe26(%rip),%rdi
lea    0xe28(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,0x10(%rsp)
xor    %ebp,%ebp
lea    0x18(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    %r13,0x30(%rsp)
jmp    124b <main+0x9b>
nopw   0x0(%rax,%rax,1)
movslq 0x40(%rsp),%rax
mov    0x38(%rsp),%rbp
add    %rax,%rbp
test   %r12,%r12
mov    0x30(%rsp),%r13
je     13ef <main+0x23f>
mov    %rbp,0x40(%rsp)
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x7a1200,%edx
call   1070 <memset@plt>
mov    %r13,%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),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    $0xf,%esi
mov    0x28(%rsp),%rdx
call   1080 <fgets@plt>
mov    %rax,%r12
test   %rax,%rax
je     12e0 <main+0x130>
mov    %rbx,%rdi
call   1030 <atof@plt>
movsd  %xmm0,(%r14,%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    12f4 <main+0x144>
nopl   0x0(%rax,%rax,1)
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
test   %ebp,%ebp
je     13e1 <main+0x231>
mov    %rbp,0x20(%rsp)
mov    %ebp,%ebp
xor    %ebx,%ebx
nopl   (%rax)
movsd  (%r14,%rbx,8),%xmm0
movsd  0xcf2(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1090 <minimaxsin@plt>
movsd  %xmm0,0x0(%r13,%rbx,8)
movsd  (%r14,%rbx,8),%xmm1
mulsd  0xcd4(%rip),%xmm1
movsd  0xcd4(%rip),%xmm0
subsd  %xmm1,%xmm0
call   1090 <minimaxsin@plt>
movsd  %xmm0,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1300 <main+0x150>
xor    %ebx,%ebx
mov    0x8(%rsp),%edi
call   10c0 <usec_diff@plt>
mov    %rax,0x38(%rsp)
test   %bl,%bl
lea    0xcd0(%rip),%rbx
jne    1230 <main+0x80>
mov    0x20(%rsp),%r13d
xor    %ebp,%ebp
jmp    13a8 <main+0x1f8>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
mov    0x10(%rsp),%rdi
lea    0xcae(%rip),%rsi
mov    $0x3,%al
call   10a0 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
je     1230 <main+0x80>
movsd  (%r15,%rbp,8),%xmm1
movsd  0xc5a(%rip),%xmm0
ucomisd %xmm1,%xmm0
mov    0x30(%rsp),%rax
movsd  (%rax,%rbp,8),%xmm0
jbe    1380 <main+0x1d0>
ucomisd 0xc4a(%rip),%xmm1
jbe    1380 <main+0x1d0>
mov    0x10(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x2,%al
call   10a0 <fprintf@plt>
jmp    139b <main+0x1eb>
xor    %eax,%eax
mov    %rax,0x20(%rsp)
mov    $0x1,%bl
jmp    134e <main+0x19e>
mov    0x28(%rsp),%rdi
call   1040 <fclose@plt>
mov    0x10(%rsp),%rdi
call   1040 <fclose@plt>
mov    0x18(%rsp),%edi
call   10c0 <usec_diff@plt>
mov    %rax,%rbx
lea    0xc3c(%rip),%rdi
mov    %ebp,%esi
call   1050 <printf@plt>
lea    0xc51(%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 @minimaxsin(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 @minimaxsin(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 = %81, %0
%18 = phi i64 [ 0, %0 ], [ %61, %81 ]
%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 %54, label %37
37: ; preds = %31, %33
%38 = phi i32 [ 1000000, %31 ], [ %34, %33 ]
%39 = zext i32 %38 to i64
br label %40
40: ; preds = %37, %40
%41 = phi i64 [ 0, %37 ], [ %52, %40 ]
%42 = getelementptr inbounds double, double* %6, i64 %41
%43 = load double, double* %42
%44 = fmul double %43, 0x3F91DF46A2529D39
%45 = call double @minimaxsin(double %44)
%46 = getelementptr inbounds double, double* %8, i64 %41
store double %45, double* %46
%47 = load double, double* %42
%48 = fneg double %47
%49 = call double @llvm.fmuladd.f64(double %48, double 0x3F91DF46A2529D39, double 0x3FF921FB54442D18)
%50 = call double @minimaxsin(double %49)
%51 = getelementptr inbounds double, double* %10, i64 %41
store double %50, double* %51
%52 = add nuw nsw i64 %41, 1
%53 = icmp eq i64 %52, %39
br i1 %53, label %54, label %40
54: ; preds = %40, %33
%55 = phi i1 [ true, %33 ], [ false, %40 ]
%56 = phi i32 [ 0, %33 ], [ %38, %40 ]
%57 = load i32, i32* %16
%58 = call i64 @usec_diff(i32 %57)
%59 = shl i64 %18, 32
%60 = ashr exact i64 %59, 32
%61 = add nsw i64 %58, %60
br i1 %55, label %81, label %62
62: ; preds = %54
%63 = zext i32 %56 to i64
br label %64
64: ; preds = %62, %78
%65 = phi i64 [ 0, %62 ], [ %79, %78 ]
%66 = getelementptr inbounds double, double* %10, i64 %65
%67 = load double, double* %66
%68 = fcmp olt double %67, 1.000000e-09
%69 = fcmp ogt double %67, -1.000000e-09
%70 = and i1 %68, %69
%71 = getelementptr inbounds double, double* %8, i64 %65
%72 = load double, double* %71
br i1 %70, label %73, label %75
73: ; preds = %64
%74 = 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 %72, double %67)
br label %78
75: ; preds = %64
%76 = fdiv double %72, %67
%77 = 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 %72, double %67, double %76)
br label %78
78: ; preds = %73, %75
%79 = add nuw nsw i64 %65, 1
%80 = icmp eq i64 %79, %63
br i1 %80, label %81, label %64
81: ; preds = %78, %54
br i1 %25, label %82, label %17
82: ; preds = %81
%83 = trunc i64 %61 to i32
%84 = call i32 @fclose(i32* %11)
%85 = call i32 @fclose(i32* %12)
%86 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%87 = load i32, i32* %86
%88 = call i64 @usec_diff(i32 %87)
%89 = trunc i64 %88 to i32
%90 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), i32 %83)
%91 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i32 %89)
ret i32 0
}