#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 scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
int /*<<< orphan*/ VectorMathAdd(float *, float *, float *, unsigned int);
int /*<<< orphan*/ VectorMathExp(float *, float *, unsigned int);
int /*<<< orphan*/ VectorMathSin(float *, float *, unsigned int);
scalar_t__ clock();
float expf(float);
float fabs(float);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, double);
float sinf(float);
int /*<<< orphan*/ stderr;
int main() {
  unsigned int N = 5000, Ntries = 10000, j = 0, i = 0;
  double y = 0.;
  float phases[N], phases2[N], phases3[N], sinphis[N];
  float ssephases[N], ssephases2[N], ssephases3[N], ssesinphis[N];
  float maxerr = 0.;
  for (j = 0; j < N; j++) {
    phases[j] = 2. * 3.14 * (float)j * 0.16757247;
    phases2[j] = 2. * 3.14 * (float)j * 0.87523986;
    ssephases[j] = 2. * 3.14 * (float)j * 0.16757247;
    ssephases2[j] = 2. * 3.14 * (float)j * 0.87523986;
  }
  clock_t begin = clock();
  for (j = 0; j < Ntries; j++) {
    VectorMathSin(ssesinphis, ssephases, N);
  }
  clock_t end = clock();
  double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
  fprintf(stderr, "time \"SSE\" vector math sin = %.5lf\n", time_spent);
  begin = clock();
  for (j = 0; j < Ntries; j++) {
    for (i = 0; i < N; i++) {
      sinphis[i] = sinf(phases[i]);
    }
  }
  end = clock();
  time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
  fprintf(stderr, "time \"math.h\" sin = %.5lf\n", time_spent);
  for (i = 0; i < N; i++) {
    if (fabs(sinphis[i] - ssesinphis[i]) > maxerr) {
      maxerr = fabs(sinphis[i] - ssesinphis[i]);
    }
  }
  fprintf(stderr, "maximum sin error = %.12f\n", maxerr);
  begin = clock();
  for (j = 0; j < Ntries; j++) {
    VectorMathExp(ssephases3, ssesinphis, N);
  }
  end = clock();
  time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
  fprintf(stderr, "time \"SSE\" vector math exp = %.5lf\n", time_spent);
  begin = clock();
  for (j = 0; j < Ntries; j++) {
    for (i = 0; i < N; i++) {
      phases3[i] = expf(sinphis[i]);
    }
  }
  end = clock();
  time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
  fprintf(stderr, "time \"math.h\" exp = %.5lf\n", time_spent);
  maxerr = 0.;
  for (i = 0; i < N; i++) {
    if (fabs(phases3[i] - ssephases3[i]) > maxerr) {
      maxerr = fabs(phases3[i] - ssephases3[i]);
    }
  }
  fprintf(stderr, "maximum exp error = %.12f\n", maxerr);
  begin = clock();
  for (j = 0; j < Ntries; j++) {
    VectorMathAdd(phases3, phases, phases2, N);
  }
  end = clock();
  time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
  fprintf(stderr, "time \"SSE\" vector add = %.5lf\n", time_spent);
  begin = clock();
  for (j = 0; j < Ntries; j++) {
    for (i = 0; i < N; i++) {
      phases3[i] = phases[i] + phases2[i];
    }
  }
  end = clock();
  time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
  fprintf(stderr, "time looped vector add = %.5lf\n", time_spent);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1388,-0x8(%rbp)
movl   $0x2710,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xc8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xc0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
mov    -0x8(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x98(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x60(%rbp)
mov    -0x8(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x90(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x68(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x6c(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    13b9 <main+0x239>
mov    -0xa0(%rbp),%rax
mov    -0xa8(%rbp),%rcx
mov    -0xc0(%rbp),%rdx
mov    -0xc8(%rbp),%rsi
mov    -0x10(%rbp),%edi
cvtsi2ss %rdi,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xce8(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  0xce4(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rsi,%rdi,4)
mov    -0x10(%rbp),%esi
cvtsi2ss %rsi,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm2,%xmm0
movsd  0xcaf(%rip),%xmm3
mulsd  %xmm3,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rdx,%rsi,4)
mov    -0x10(%rbp),%edx
cvtsi2ss %rdx,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rcx,%rdx,4)
mov    -0x10(%rbp),%ecx
cvtsi2ss %rcx,%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xc79(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xc65(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%ecx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    12e4 <main+0x164>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    13fb <main+0x27b>
mov    -0xa8(%rbp),%rsi
mov    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%edx
call   1030 <VectorMathSin@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    13cb <main+0x24b>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rax
sub    -0x78(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2bce(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    0x2bab(%rip),%rax
mov    (%rax),%edi
movsd  -0x88(%rbp),%xmm0
ff
lea    0xbda(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    14b8 <main+0x338>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    14a5 <main+0x325>
mov    -0xc8(%rbp),%rax
mov    -0x14(%rbp),%ecx
movss  (%rax,%rcx,4),%xmm0
call   1040 <sinf@plt>
mov    -0xb0(%rbp),%rax
mov    -0x14(%rbp),%ecx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1468 <main+0x2e8>
jmp    14aa <main+0x32a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1455 <main+0x2d5>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rax
sub    -0x78(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2b11(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    0x2aee(%rip),%rax
mov    (%rax),%edi
movsd  -0x88(%rbp),%xmm0
ff
lea    0xb41(%rip),%rsi
call   1080 <fprintf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    157b <main+0x3fb>
mov    -0x90(%rbp),%rax
mov    -0xb0(%rbp),%rcx
mov    -0x14(%rbp),%edx
movss  (%rcx,%rdx,4),%xmm0
mov    -0x14(%rbp),%ecx
subss  (%rax,%rcx,4),%xmm0
call   1070 <fabs@plt>
ucomiss -0x6c(%rbp),%xmm0
jbe    1568 <main+0x3e8>
mov    -0x90(%rbp),%rax
mov    -0xb0(%rbp),%rcx
mov    -0x14(%rbp),%edx
movss  (%rcx,%rdx,4),%xmm0
mov    -0x14(%rbp),%ecx
subss  (%rax,%rcx,4),%xmm0
call   1070 <fabs@plt>
movss  %xmm0,-0x6c(%rbp)
jmp    156d <main+0x3ed>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1507 <main+0x387>
mov    0x2a56(%rip),%rax
mov    (%rax),%edi
movss  -0x6c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xac3(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    15db <main+0x45b>
mov    -0x90(%rbp),%rsi
mov    -0x98(%rbp),%rdi
mov    -0x8(%rbp),%edx
call   10a0 <VectorMathExp@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    15ab <main+0x42b>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rax
sub    -0x78(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x29ee(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    0x29cb(%rip),%rax
mov    (%rax),%edi
movsd  -0x88(%rbp),%xmm0
ff
lea    0xa54(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1698 <main+0x518>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1685 <main+0x505>
mov    -0xb0(%rbp),%rax
mov    -0x14(%rbp),%ecx
movss  (%rax,%rcx,4),%xmm0
call   1060 <expf@plt>
mov    -0xb8(%rbp),%rax
mov    -0x14(%rbp),%ecx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1648 <main+0x4c8>
jmp    168a <main+0x50a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1635 <main+0x4b5>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rax
sub    -0x78(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2931(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    0x290e(%rip),%rax
mov    (%rax),%edi
movsd  -0x88(%rbp),%xmm0
ff
lea    0x9bb(%rip),%rsi
call   1080 <fprintf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x6c(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1763 <main+0x5e3>
mov    -0x98(%rbp),%rax
mov    -0xb8(%rbp),%rcx
mov    -0x14(%rbp),%edx
movss  (%rcx,%rdx,4),%xmm0
mov    -0x14(%rbp),%ecx
subss  (%rax,%rcx,4),%xmm0
call   1070 <fabs@plt>
ucomiss -0x6c(%rbp),%xmm0
jbe    1750 <main+0x5d0>
mov    -0x98(%rbp),%rax
mov    -0xb8(%rbp),%rcx
mov    -0x14(%rbp),%edx
movss  (%rcx,%rdx,4),%xmm0
mov    -0x14(%rbp),%ecx
subss  (%rax,%rcx,4),%xmm0
call   1070 <fabs@plt>
movss  %xmm0,-0x6c(%rbp)
jmp    1755 <main+0x5d5>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    16ef <main+0x56f>
mov    0x286e(%rip),%rax
mov    (%rax),%edi
movss  -0x6c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0x935(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    17ca <main+0x64a>
mov    -0xc0(%rbp),%rdx
mov    -0xc8(%rbp),%rsi
mov    -0xb8(%rbp),%rdi
mov    -0x8(%rbp),%ecx
call   1090 <VectorMathAdd@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1793 <main+0x613>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rax
sub    -0x78(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x27ff(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    0x27dc(%rip),%rax
mov    (%rax),%edi
movsd  -0x88(%rbp),%xmm0
ff
lea    0x8bf(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1891 <main+0x711>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    187e <main+0x6fe>
mov    -0xb8(%rbp),%rax
mov    -0xc0(%rbp),%rcx
mov    -0xc8(%rbp),%rdx
mov    -0x14(%rbp),%esi
movss  (%rdx,%rsi,4),%xmm0
mov    -0x14(%rbp),%edx
addss  (%rcx,%rdx,4),%xmm0
mov    -0x14(%rbp),%ecx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1837 <main+0x6b7>
jmp    1883 <main+0x703>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1824 <main+0x6a4>
mov    $0x0,%al
call   1050 <clock@plt>
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rax
sub    -0x78(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2738(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    0x2715(%rip),%rax
mov    (%rax),%edi
movsd  -0x88(%rbp),%xmm0
ff
lea    0x817(%rip),%rsi
call   1080 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x222e8,%rsp
movdqa 0xe77(%rip),%xmm2
mov    $0x4,%eax
movdqa 0xe79(%rip),%xmm10
movdqa 0xe80(%rip),%xmm11
movdqa 0xe87(%rip),%xmm12
movaps 0xe8f(%rip),%xmm13
movapd 0xe97(%rip),%xmm5
movapd 0xe9f(%rip),%xmm6
movapd 0xea7(%rip),%xmm7
movdqa 0xeae(%rip),%xmm8
movdqa 0xeb5(%rip),%xmm9
nopl   0x0(%rax,%rax,1)
movdqa %xmm2,%xmm0
pand   %xmm10,%xmm0
por    %xmm11,%xmm0
movdqa %xmm2,%xmm1
psrld  $0x10,%xmm1
por    %xmm12,%xmm1
subps  %xmm13,%xmm1
addps  %xmm0,%xmm1
cvtps2pd %xmm1,%xmm4
movhlps %xmm1,%xmm1
cvtps2pd %xmm1,%xmm1
mulpd  %xmm5,%xmm4
mulpd  %xmm5,%xmm1
movapd %xmm1,%xmm3
movapd %xmm4,%xmm0
mulpd  %xmm6,%xmm0
cvtpd2ps %xmm0,%xmm0
mulpd  %xmm6,%xmm3
cvtpd2ps %xmm3,%xmm3
unpcklpd %xmm3,%xmm0
movapd %xmm0,-0x10(%rsp,%rax,4)
mulpd  %xmm7,%xmm4
cvtpd2ps %xmm4,%xmm3
mulpd  %xmm7,%xmm1
cvtpd2ps %xmm1,%xmm1
unpcklpd %xmm1,%xmm3
movapd %xmm3,0xea50(%rsp,%rax,4)
movapd %xmm0,0x1d4b0(%rsp,%rax,4)
movdqa %xmm2,%xmm0
paddd  %xmm8,%xmm0
movdqa %xmm0,%xmm1
pand   %xmm10,%xmm1
por    %xmm11,%xmm1
psrld  $0x10,%xmm0
por    %xmm12,%xmm0
subps  %xmm13,%xmm0
addps  %xmm1,%xmm0
cvtps2pd %xmm0,%xmm1
movhlps %xmm0,%xmm0
cvtps2pd %xmm0,%xmm0
mulpd  %xmm5,%xmm1
mulpd  %xmm5,%xmm0
movapd %xmm0,%xmm3
mulpd  %xmm6,%xmm3
movapd %xmm1,%xmm4
mulpd  %xmm6,%xmm4
cvtpd2ps %xmm4,%xmm4
cvtpd2ps %xmm3,%xmm3
unpcklpd %xmm3,%xmm4
movapd %xmm4,(%rsp,%rax,4)
mulpd  %xmm7,%xmm0
mulpd  %xmm7,%xmm1
cvtpd2ps %xmm1,%xmm1
cvtpd2ps %xmm0,%xmm0
unpcklpd %xmm0,%xmm1
movapd %xmm1,0xea60(%rsp,%rax,4)
movapd %xmm4,0x1d4c0(%rsp,%rax,4)
paddd  %xmm9,%xmm2
add    $0x8,%rax
cmp    $0x138c,%rax
jne    11e0 <main+0x70>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r14
mov    $0x2710,%ebp
lea    0x13880(%rsp),%r15
lea    0x1d4c0(%rsp),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x1388,%edx
call   1030 <VectorMathSin@plt>
add    $0xffffffff,%ebp
jne    1310 <main+0x1a0>
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <clock@plt>
sub    %r14,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mov    0x2ca8(%rip),%r12
divsd  (%r12),%xmm0
mov    0x2c8b(%rip),%r13
mov    0x0(%r13),%edi
lea    0xd58(%rip),%rsi
call   1070 <fprintf@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r14
nopw   0x0(%rax,%rax,1)
mov    $0x4,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movss  -0x10(%rsp,%rbx,4),%xmm0
call   1040 <sinf@plt>
movss  %xmm0,0x4e10(%rsp,%rbx,4)
movss  -0xc(%rsp,%rbx,4),%xmm0
call   1040 <sinf@plt>
movss  %xmm0,0x4e14(%rsp,%rbx,4)
movss  -0x8(%rsp,%rbx,4),%xmm0
call   1040 <sinf@plt>
movss  %xmm0,0x4e18(%rsp,%rbx,4)
movss  -0x4(%rsp,%rbx,4),%xmm0
call   1040 <sinf@plt>
movss  %xmm0,0x4e1c(%rsp,%rbx,4)
movss  (%rsp,%rbx,4),%xmm0
call   1040 <sinf@plt>
movss  %xmm0,0x4e20(%rsp,%rbx,4)
add    $0x5,%rbx
cmp    $0x138c,%rbx
jne    1380 <main+0x210>
add    $0x1,%ebp
cmp    $0x2710,%ebp
jne    1370 <main+0x200>
xor    %eax,%eax
call   1050 <clock@plt>
sub    %r14,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r12),%xmm0
mov    0x0(%r13),%edi
lea    0xcb2(%rip),%rsi
call   1070 <fprintf@plt>
xorpd  %xmm0,%xmm0
mov    $0x1,%eax
movaps 0xc69(%rip),%xmm2
nopw   0x0(%rax,%rax,1)
movss  0x4e1c(%rsp,%rax,4),%xmm1
subss  0x1387c(%rsp,%rax,4),%xmm1
andps  %xmm2,%xmm1
maxss  %xmm0,%xmm1
movss  0x4e20(%rsp,%rax,4),%xmm0
subss  0x13880(%rsp,%rax,4),%xmm0
andps  %xmm2,%xmm0
maxss  %xmm1,%xmm0
add    $0x2,%rax
cmp    $0x1389,%rax
jne    1440 <main+0x2d0>
mov    0x0(%r13),%edi
cvtss2sd %xmm0,%xmm0
lea    0xc62(%rip),%rsi
call   1070 <fprintf@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r14
mov    $0x2710,%ebp
lea    0x186a0(%rsp),%r15
lea    0x13880(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x1388,%edx
call   1090 <VectorMathExp@plt>
add    $0xffffffff,%ebp
jne    14c0 <main+0x350>
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <clock@plt>
sub    %r14,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r12),%xmm0
mov    0x0(%r13),%edi
lea    0xc10(%rip),%rsi
call   1070 <fprintf@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r14
nopl   0x0(%rax)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  0x4e20(%rsp,%rbx,4),%xmm0
call   1060 <expf@plt>
movss  %xmm0,0x9c40(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x1388,%rbx
jne    1520 <main+0x3b0>
add    $0x1,%ebp
cmp    $0x2710,%ebp
jne    1510 <main+0x3a0>
xor    %eax,%eax
call   1050 <clock@plt>
sub    %r14,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r12),%xmm0
mov    0x0(%r13),%edi
lea    0xbbc(%rip),%rsi
call   1070 <fprintf@plt>
xorpd  %xmm0,%xmm0
mov    $0x1,%eax
movaps 0xb19(%rip),%xmm2
nopw   0x0(%rax,%rax,1)
movss  0x9c3c(%rsp,%rax,4),%xmm1
subss  0x1869c(%rsp,%rax,4),%xmm1
andps  %xmm2,%xmm1
maxss  %xmm0,%xmm1
movss  0x9c40(%rsp,%rax,4),%xmm0
subss  0x186a0(%rsp,%rax,4),%xmm0
andps  %xmm2,%xmm0
maxss  %xmm1,%xmm0
add    $0x2,%rax
cmp    $0x1389,%rax
jne    1590 <main+0x420>
mov    0x0(%r13),%edi
cvtss2sd %xmm0,%xmm0
lea    0xb6c(%rip),%rsi
call   1070 <fprintf@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r14
mov    $0x2710,%ebp
lea    0x9c40(%rsp),%r15
mov    %rsp,%r12
lea    0xea60(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    $0x1388,%ecx
call   1080 <VectorMathAdd@plt>
add    $0xffffffff,%ebp
jne    1610 <main+0x4a0>
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <clock@plt>
sub    %r14,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mov    0x29a5(%rip),%r14
divsd  (%r14),%xmm0
mov    0x0(%r13),%edi
lea    0xb11(%rip),%rsi
call   1070 <fprintf@plt>
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%rbx
jmp    167b <main+0x50b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebp
cmp    $0x2710,%ebp
je     16e1 <main+0x571>
mov    $0xc,%eax
movaps -0x30(%rsp,%rax,4),%xmm0
movaps -0x20(%rsp,%rax,4),%xmm1
addps  0xea30(%rsp,%rax,4),%xmm0
addps  0xea40(%rsp,%rax,4),%xmm1
movaps %xmm0,0x9c10(%rsp,%rax,4)
movaps %xmm1,0x9c20(%rsp,%rax,4)
cmp    $0x138c,%rax
je     1670 <main+0x500>
movaps -0x10(%rsp,%rax,4),%xmm0
movaps (%rsp,%rax,4),%xmm1
addps  0xea50(%rsp,%rax,4),%xmm0
addps  0xea60(%rsp,%rax,4),%xmm1
movaps %xmm0,0x9c30(%rsp,%rax,4)
movaps %xmm1,0x9c40(%rsp,%rax,4)
add    $0x10,%rax
jmp    1680 <main+0x510>
xor    %eax,%eax
call   1050 <clock@plt>
sub    %rbx,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%r14),%xmm0
mov    0x0(%r13),%edi
lea    0xa80(%rip),%rsi
call   1070 <fprintf@plt>
xor    %eax,%eax
add    $0x222e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global double 0.000000e+00
@stderr = global i32 0
@.str = [36 x i8] c"time \22SSE\22 vector math sin = %.5lf\0A\00"
@.str.1 = [27 x i8] c"time \22math.h\22 sin = %.5lf\0A\00"
@.str.2 = [27 x i8] c"maximum sin error = %.12f\0A\00"
@.str.3 = [36 x i8] c"time \22SSE\22 vector math exp = %.5lf\0A\00"
@.str.4 = [27 x i8] c"time \22math.h\22 exp = %.5lf\0A\00"
@.str.5 = [27 x i8] c"maximum exp error = %.12f\0A\00"
@.str.6 = [31 x i8] c"time \22SSE\22 vector add = %.5lf\0A\00"
@.str.7 = [32 x i8] c"time looped vector add = %.5lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca float
%17 = alloca i64
%18 = alloca i64
%19 = alloca double
store i32 0, i32* %1
store i32 5000, i32* %2
store i32 10000, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store double 0.000000e+00, double* %6
%20 = load i32, i32* %2
%21 = zext i32 %20 to i64
%22 = call i8* @llvm.stacksave()
store i8* %22, i8** %7
%23 = alloca float, i64 %21
store i64 %21, i64* %8
%24 = load i32, i32* %2
%25 = zext i32 %24 to i64
%26 = alloca float, i64 %25
store i64 %25, i64* %9
%27 = load i32, i32* %2
%28 = zext i32 %27 to i64
%29 = alloca float, i64 %28
store i64 %28, i64* %10
%30 = load i32, i32* %2
%31 = zext i32 %30 to i64
%32 = alloca float, i64 %31
store i64 %31, i64* %11
%33 = load i32, i32* %2
%34 = zext i32 %33 to i64
%35 = alloca float, i64 %34
store i64 %34, i64* %12
%36 = load i32, i32* %2
%37 = zext i32 %36 to i64
%38 = alloca float, i64 %37
store i64 %37, i64* %13
%39 = load i32, i32* %2
%40 = zext i32 %39 to i64
%41 = alloca float, i64 %40
store i64 %40, i64* %14
%42 = load i32, i32* %2
%43 = zext i32 %42 to i64
%44 = alloca float, i64 %43
store i64 %43, i64* %15
store float 0.000000e+00, float* %16
store i32 0, i32* %4
br label %45
45: ; preds = %86, %0
%46 = load i32, i32* %4
%47 = load i32, i32* %2
%48 = icmp ult i32 %46, %47
br i1 %48, label %49, label %89
49: ; preds = %45
%50 = load i32, i32* %4
%51 = uitofp i32 %50 to float
%52 = fpext float %51 to double
%53 = fmul double 6.280000e+00, %52
%54 = fmul double %53, 0x3FC57303C32E128D
%55 = fptrunc double %54 to float
%56 = load i32, i32* %4
%57 = zext i32 %56 to i64
%58 = getelementptr inbounds float, float* %23, i64 %57
store float %55, float* %58
%59 = load i32, i32* %4
%60 = uitofp i32 %59 to float
%61 = fpext float %60 to double
%62 = fmul double 6.280000e+00, %61
%63 = fmul double %62, 0x3FEC01F705DB613A
%64 = fptrunc double %63 to float
%65 = load i32, i32* %4
%66 = zext i32 %65 to i64
%67 = getelementptr inbounds float, float* %26, i64 %66
store float %64, float* %67
%68 = load i32, i32* %4
%69 = uitofp i32 %68 to float
%70 = fpext float %69 to double
%71 = fmul double 6.280000e+00, %70
%72 = fmul double %71, 0x3FC57303C32E128D
%73 = fptrunc double %72 to float
%74 = load i32, i32* %4
%75 = zext i32 %74 to i64
%76 = getelementptr inbounds float, float* %35, i64 %75
store float %73, float* %76
%77 = load i32, i32* %4
%78 = uitofp i32 %77 to float
%79 = fpext float %78 to double
%80 = fmul double 6.280000e+00, %79
%81 = fmul double %80, 0x3FEC01F705DB613A
%82 = fptrunc double %81 to float
%83 = load i32, i32* %4
%84 = zext i32 %83 to i64
%85 = getelementptr inbounds float, float* %38, i64 %84
store float %82, float* %85
br label %86
86: ; preds = %49
%87 = load i32, i32* %4
%88 = add i32 %87, 1
store i32 %88, i32* %4
br label %45
89: ; preds = %45
%90 = call i64 (...) @clock()
store i64 %90, i64* %17
store i32 0, i32* %4
br label %91
91: ; preds = %98, %89
%92 = load i32, i32* %4
%93 = load i32, i32* %3
%94 = icmp ult i32 %92, %93
br i1 %94, label %95, label %101
95: ; preds = %91
%96 = load i32, i32* %2
%97 = call i32 @VectorMathSin(float* %44, float* %35, i32 %96)
br label %98
98: ; preds = %95
%99 = load i32, i32* %4
%100 = add i32 %99, 1
store i32 %100, i32* %4
br label %91
101: ; preds = %91
%102 = call i64 (...) @clock()
store i64 %102, i64* %18
%103 = load i64, i64* %18
%104 = load i64, i64* %17
%105 = sub nsw i64 %103, %104
%106 = sitofp i64 %105 to double
%107 = load double, double* @CLOCKS_PER_SEC
%108 = fdiv double %106, %107
store double %108, double* %19
%109 = load i32, i32* @stderr
%110 = load double, double* %19
%111 = call i32 @fprintf(i32 %109, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), double %110)
%112 = call i64 (...) @clock()
store i64 %112, i64* %17
store i32 0, i32* %4
br label %113
113: ; preds = %135, %101
%114 = load i32, i32* %4
%115 = load i32, i32* %3
%116 = icmp ult i32 %114, %115
br i1 %116, label %117, label %138
117: ; preds = %113
store i32 0, i32* %5
br label %118
118: ; preds = %131, %117
%119 = load i32, i32* %5
%120 = load i32, i32* %2
%121 = icmp ult i32 %119, %120
br i1 %121, label %122, label %134
122: ; preds = %118
%123 = load i32, i32* %5
%124 = zext i32 %123 to i64
%125 = getelementptr inbounds float, float* %23, i64 %124
%126 = load float, float* %125
%127 = call float @sinf(float %126)
%128 = load i32, i32* %5
%129 = zext i32 %128 to i64
%130 = getelementptr inbounds float, float* %32, i64 %129
store float %127, float* %130
br label %131
131: ; preds = %122
%132 = load i32, i32* %5
%133 = add i32 %132, 1
store i32 %133, i32* %5
br label %118
134: ; preds = %118
br label %135
135: ; preds = %134
%136 = load i32, i32* %4
%137 = add i32 %136, 1
store i32 %137, i32* %4
br label %113
138: ; preds = %113
%139 = call i64 (...) @clock()
store i64 %139, i64* %18
%140 = load i64, i64* %18
%141 = load i64, i64* %17
%142 = sub nsw i64 %140, %141
%143 = sitofp i64 %142 to double
%144 = load double, double* @CLOCKS_PER_SEC
%145 = fdiv double %143, %144
store double %145, double* %19
%146 = load i32, i32* @stderr
%147 = load double, double* %19
%148 = call i32 @fprintf(i32 %146, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), double %147)
store i32 0, i32* %5
br label %149
149: ; preds = %178, %138
%150 = load i32, i32* %5
%151 = load i32, i32* %2
%152 = icmp ult i32 %150, %151
br i1 %152, label %153, label %181
153: ; preds = %149
%154 = load i32, i32* %5
%155 = zext i32 %154 to i64
%156 = getelementptr inbounds float, float* %32, i64 %155
%157 = load float, float* %156
%158 = load i32, i32* %5
%159 = zext i32 %158 to i64
%160 = getelementptr inbounds float, float* %44, i64 %159
%161 = load float, float* %160
%162 = fsub float %157, %161
%163 = call float @fabs(float %162)
%164 = load float, float* %16
%165 = fcmp ogt float %163, %164
br i1 %165, label %166, label %177
166: ; preds = %153
%167 = load i32, i32* %5
%168 = zext i32 %167 to i64
%169 = getelementptr inbounds float, float* %32, i64 %168
%170 = load float, float* %169
%171 = load i32, i32* %5
%172 = zext i32 %171 to i64
%173 = getelementptr inbounds float, float* %44, i64 %172
%174 = load float, float* %173
%175 = fsub float %170, %174
%176 = call float @fabs(float %175)
store float %176, float* %16
br label %177
177: ; preds = %166, %153
br label %178
178: ; preds = %177
%179 = load i32, i32* %5
%180 = add i32 %179, 1
store i32 %180, i32* %5
br label %149
181: ; preds = %149
%182 = load i32, i32* @stderr
%183 = load float, float* %16
%184 = fpext float %183 to double
%185 = call i32 @fprintf(i32 %182, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), double %184)
%186 = call i64 (...) @clock()
store i64 %186, i64* %17
store i32 0, i32* %4
br label %187
187: ; preds = %194, %181
%188 = load i32, i32* %4
%189 = load i32, i32* %3
%190 = icmp ult i32 %188, %189
br i1 %190, label %191, label %197
191: ; preds = %187
%192 = load i32, i32* %2
%193 = call i32 @VectorMathExp(float* %41, float* %44, i32 %192)
br label %194
194: ; preds = %191
%195 = load i32, i32* %4
%196 = add i32 %195, 1
store i32 %196, i32* %4
br label %187
197: ; preds = %187
%198 = call i64 (...) @clock()
store i64 %198, i64* %18
%199 = load i64, i64* %18
%200 = load i64, i64* %17
%201 = sub nsw i64 %199, %200
%202 = sitofp i64 %201 to double
%203 = load double, double* @CLOCKS_PER_SEC
%204 = fdiv double %202, %203
store double %204, double* %19
%205 = load i32, i32* @stderr
%206 = load double, double* %19
%207 = call i32 @fprintf(i32 %205, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), double %206)
%208 = call i64 (...) @clock()
store i64 %208, i64* %17
store i32 0, i32* %4
br label %209
209: ; preds = %231, %197
%210 = load i32, i32* %4
%211 = load i32, i32* %3
%212 = icmp ult i32 %210, %211
br i1 %212, label %213, label %234
213: ; preds = %209
store i32 0, i32* %5
br label %214
214: ; preds = %227, %213
%215 = load i32, i32* %5
%216 = load i32, i32* %2
%217 = icmp ult i32 %215, %216
br i1 %217, label %218, label %230
218: ; preds = %214
%219 = load i32, i32* %5
%220 = zext i32 %219 to i64
%221 = getelementptr inbounds float, float* %32, i64 %220
%222 = load float, float* %221
%223 = call float @expf(float %222)
%224 = load i32, i32* %5
%225 = zext i32 %224 to i64
%226 = getelementptr inbounds float, float* %29, i64 %225
store float %223, float* %226
br label %227
227: ; preds = %218
%228 = load i32, i32* %5
%229 = add i32 %228, 1
store i32 %229, i32* %5
br label %214
230: ; preds = %214
br label %231
231: ; preds = %230
%232 = load i32, i32* %4
%233 = add i32 %232, 1
store i32 %233, i32* %4
br label %209
234: ; preds = %209
%235 = call i64 (...) @clock()
store i64 %235, i64* %18
%236 = load i64, i64* %18
%237 = load i64, i64* %17
%238 = sub nsw i64 %236, %237
%239 = sitofp i64 %238 to double
%240 = load double, double* @CLOCKS_PER_SEC
%241 = fdiv double %239, %240
store double %241, double* %19
%242 = load i32, i32* @stderr
%243 = load double, double* %19
%244 = call i32 @fprintf(i32 %242, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), double %243)
store float 0.000000e+00, float* %16
store i32 0, i32* %5
br label %245
245: ; preds = %274, %234
%246 = load i32, i32* %5
%247 = load i32, i32* %2
%248 = icmp ult i32 %246, %247
br i1 %248, label %249, label %277
249: ; preds = %245
%250 = load i32, i32* %5
%251 = zext i32 %250 to i64
%252 = getelementptr inbounds float, float* %29, i64 %251
%253 = load float, float* %252
%254 = load i32, i32* %5
%255 = zext i32 %254 to i64
%256 = getelementptr inbounds float, float* %41, i64 %255
%257 = load float, float* %256
%258 = fsub float %253, %257
%259 = call float @fabs(float %258)
%260 = load float, float* %16
%261 = fcmp ogt float %259, %260
br i1 %261, label %262, label %273
262: ; preds = %249
%263 = load i32, i32* %5
%264 = zext i32 %263 to i64
%265 = getelementptr inbounds float, float* %29, i64 %264
%266 = load float, float* %265
%267 = load i32, i32* %5
%268 = zext i32 %267 to i64
%269 = getelementptr inbounds float, float* %41, i64 %268
%270 = load float, float* %269
%271 = fsub float %266, %270
%272 = call float @fabs(float %271)
store float %272, float* %16
br label %273
273: ; preds = %262, %249
br label %274
274: ; preds = %273
%275 = load i32, i32* %5
%276 = add i32 %275, 1
store i32 %276, i32* %5
br label %245
277: ; preds = %245
%278 = load i32, i32* @stderr
%279 = load float, float* %16
%280 = fpext float %279 to double
%281 = call i32 @fprintf(i32 %278, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), double %280)
%282 = call i64 (...) @clock()
store i64 %282, i64* %17
store i32 0, i32* %4
br label %283
283: ; preds = %290, %277
%284 = load i32, i32* %4
%285 = load i32, i32* %3
%286 = icmp ult i32 %284, %285
br i1 %286, label %287, label %293
287: ; preds = %283
%288 = load i32, i32* %2
%289 = call i32 @VectorMathAdd(float* %29, float* %23, float* %26, i32 %288)
br label %290
290: ; preds = %287
%291 = load i32, i32* %4
%292 = add i32 %291, 1
store i32 %292, i32* %4
br label %283
293: ; preds = %283
%294 = call i64 (...) @clock()
store i64 %294, i64* %18
%295 = load i64, i64* %18
%296 = load i64, i64* %17
%297 = sub nsw i64 %295, %296
%298 = sitofp i64 %297 to double
%299 = load double, double* @CLOCKS_PER_SEC
%300 = fdiv double %298, %299
store double %300, double* %19
%301 = load i32, i32* @stderr
%302 = load double, double* %19
%303 = call i32 @fprintf(i32 %301, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), double %302)
%304 = call i64 (...) @clock()
store i64 %304, i64* %17
store i32 0, i32* %4
br label %305
305: ; preds = %331, %293
%306 = load i32, i32* %4
%307 = load i32, i32* %3
%308 = icmp ult i32 %306, %307
br i1 %308, label %309, label %334
309: ; preds = %305
store i32 0, i32* %5
br label %310
310: ; preds = %327, %309
%311 = load i32, i32* %5
%312 = load i32, i32* %2
%313 = icmp ult i32 %311, %312
br i1 %313, label %314, label %330
314: ; preds = %310
%315 = load i32, i32* %5
%316 = zext i32 %315 to i64
%317 = getelementptr inbounds float, float* %23, i64 %316
%318 = load float, float* %317
%319 = load i32, i32* %5
%320 = zext i32 %319 to i64
%321 = getelementptr inbounds float, float* %26, i64 %320
%322 = load float, float* %321
%323 = fadd float %318, %322
%324 = load i32, i32* %5
%325 = zext i32 %324 to i64
%326 = getelementptr inbounds float, float* %29, i64 %325
store float %323, float* %326
br label %327
327: ; preds = %314
%328 = load i32, i32* %5
%329 = add i32 %328, 1
store i32 %329, i32* %5
br label %310
330: ; preds = %310
br label %331
331: ; preds = %330
%332 = load i32, i32* %4
%333 = add i32 %332, 1
store i32 %333, i32* %4
br label %305
334: ; preds = %305
%335 = call i64 (...) @clock()
store i64 %335, i64* %18
%336 = load i64, i64* %18
%337 = load i64, i64* %17
%338 = sub nsw i64 %336, %337
%339 = sitofp i64 %338 to double
%340 = load double, double* @CLOCKS_PER_SEC
%341 = fdiv double %339, %340
store double %341, double* %19
%342 = load i32, i32* @stderr
%343 = load double, double* %19
%344 = call i32 @fprintf(i32 %342, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), double %343)
store i32 0, i32* %1
%345 = load i8*, i8** %7
%346 = load i32, i32* %1
ret i32 %346
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global double 0.000000e+00
@stderr = global i32 0
@.str = [36 x i8] c"time \22SSE\22 vector math sin = %.5lf\0A\00"
@.str.1 = [27 x i8] c"time \22math.h\22 sin = %.5lf\0A\00"
@.str.2 = [27 x i8] c"maximum sin error = %.12f\0A\00"
@.str.3 = [36 x i8] c"time \22SSE\22 vector math exp = %.5lf\0A\00"
@.str.4 = [27 x i8] c"time \22math.h\22 exp = %.5lf\0A\00"
@.str.5 = [27 x i8] c"maximum exp error = %.12f\0A\00"
@.str.6 = [31 x i8] c"time \22SSE\22 vector add = %.5lf\0A\00"
@.str.7 = [32 x i8] c"time looped vector add = %.5lf\0A\00"
define i32 @main() {
%1 = alloca [5000 x float]
%2 = alloca [5000 x float]
%3 = alloca [5000 x float]
%4 = alloca [5000 x float]
%5 = alloca [5000 x float]
%6 = alloca [5000 x float]
%7 = alloca [5000 x float]
%8 = getelementptr inbounds [5000 x float], [5000 x float]* %7, i64 0, i64 0
%9 = getelementptr inbounds [5000 x float], [5000 x float]* %5, i64 0, i64 0
%10 = getelementptr inbounds [5000 x float], [5000 x float]* %2, i64 0, i64 0
br label %11
11: ; preds = %11, %0
%12 = phi i64 [ 0, %0 ], [ %42, %11 ]
%13 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %0 ], [ %43, %11 ]
%14 = uitofp <4 x i32> %13 to <4 x float>
%15 = fpext <4 x float> %14 to <4 x double>
%16 = fmul <4 x double> %15, <double 6.280000e+00, double 6.280000e+00, double 6.280000e+00, double 6.280000e+00>
%17 = fmul <4 x double> %16, <double 0x3FC57303C32E128D, double 0x3FC57303C32E128D, double 0x3FC57303C32E128D, double 0x3FC57303C32E128D>
%18 = fptrunc <4 x double> %17 to <4 x float>
%19 = getelementptr inbounds [5000 x float], [5000 x float]* %1, i64 0, i64 %12
%20 = bitcast float* %19 to <4 x float>*
store <4 x float> %18, <4 x float>* %20
%21 = fmul <4 x double> %16, <double 0x3FEC01F705DB613A, double 0x3FEC01F705DB613A, double 0x3FEC01F705DB613A, double 0x3FEC01F705DB613A>
%22 = fptrunc <4 x double> %21 to <4 x float>
%23 = getelementptr inbounds [5000 x float], [5000 x float]* %2, i64 0, i64 %12
%24 = bitcast float* %23 to <4 x float>*
store <4 x float> %22, <4 x float>* %24
%25 = getelementptr inbounds [5000 x float], [5000 x float]* %5, i64 0, i64 %12
%26 = bitcast float* %25 to <4 x float>*
store <4 x float> %18, <4 x float>* %26
%27 = or i64 %12, 4
%28 = add <4 x i32> %13, <i32 4, i32 4, i32 4, i32 4>
%29 = uitofp <4 x i32> %28 to <4 x float>
%30 = fpext <4 x float> %29 to <4 x double>
%31 = fmul <4 x double> %30, <double 6.280000e+00, double 6.280000e+00, double 6.280000e+00, double 6.280000e+00>
%32 = fmul <4 x double> %31, <double 0x3FC57303C32E128D, double 0x3FC57303C32E128D, double 0x3FC57303C32E128D, double 0x3FC57303C32E128D>
%33 = fptrunc <4 x double> %32 to <4 x float>
%34 = getelementptr inbounds [5000 x float], [5000 x float]* %1, i64 0, i64 %27
%35 = bitcast float* %34 to <4 x float>*
store <4 x float> %33, <4 x float>* %35
%36 = fmul <4 x double> %31, <double 0x3FEC01F705DB613A, double 0x3FEC01F705DB613A, double 0x3FEC01F705DB613A, double 0x3FEC01F705DB613A>
%37 = fptrunc <4 x double> %36 to <4 x float>
%38 = getelementptr inbounds [5000 x float], [5000 x float]* %2, i64 0, i64 %27
%39 = bitcast float* %38 to <4 x float>*
store <4 x float> %37, <4 x float>* %39
%40 = getelementptr inbounds [5000 x float], [5000 x float]* %5, i64 0, i64 %27
%41 = bitcast float* %40 to <4 x float>*
store <4 x float> %33, <4 x float>* %41
%42 = add nuw nsw i64 %12, 8
%43 = add <4 x i32> %13, <i32 8, i32 8, i32 8, i32 8>
%44 = icmp eq i64 %42, 5000
br i1 %44, label %45, label %11
45: ; preds = %11
%46 = getelementptr inbounds [5000 x float], [5000 x float]* %3, i64 0, i64 0
%47 = tail call i64 (...) @clock()
br label %48
48: ; preds = %45, %48
%49 = phi i32 [ 0, %45 ], [ %51, %48 ]
%50 = call i32 @VectorMathSin(float* %8, float* %9, i32 5000)
%51 = add nuw nsw i32 %49, 1
%52 = icmp eq i32 %51, 10000
br i1 %52, label %53, label %48
53: ; preds = %48
%54 = getelementptr inbounds [5000 x float], [5000 x float]* %6, i64 0, i64 0
%55 = call i64 (...) @clock()
%56 = sub nsw i64 %55, %47
%57 = sitofp i64 %56 to double
%58 = load double, double* @CLOCKS_PER_SEC
%59 = fdiv double %57, %58
%60 = load i32, i32* @stderr
%61 = call i32 @fprintf(i32 %60, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), double %59)
%62 = call i64 (...) @clock()
br label %63
63: ; preds = %53, %93
%64 = phi i32 [ 0, %53 ], [ %94, %93 ]
br label %65
65: ; preds = %65, %63
%66 = phi i64 [ 0, %63 ], [ %91, %65 ]
%67 = getelementptr inbounds [5000 x float], [5000 x float]* %1, i64 0, i64 %66
%68 = load float, float* %67
%69 = call float @sinf(float %68)
%70 = getelementptr inbounds [5000 x float], [5000 x float]* %4, i64 0, i64 %66
store float %69, float* %70
%71 = add nuw nsw i64 %66, 1
%72 = getelementptr inbounds [5000 x float], [5000 x float]* %1, i64 0, i64 %71
%73 = load float, float* %72
%74 = call float @sinf(float %73)
%75 = getelementptr inbounds [5000 x float], [5000 x float]* %4, i64 0, i64 %71
store float %74, float* %75
%76 = add nuw nsw i64 %66, 2
%77 = getelementptr inbounds [5000 x float], [5000 x float]* %1, i64 0, i64 %76
%78 = load float, float* %77
%79 = call float @sinf(float %78)
%80 = getelementptr inbounds [5000 x float], [5000 x float]* %4, i64 0, i64 %76
store float %79, float* %80
%81 = add nuw nsw i64 %66, 3
%82 = getelementptr inbounds [5000 x float], [5000 x float]* %1, i64 0, i64 %81
%83 = load float, float* %82
%84 = call float @sinf(float %83)
%85 = getelementptr inbounds [5000 x float], [5000 x float]* %4, i64 0, i64 %81
store float %84, float* %85
%86 = add nuw nsw i64 %66, 4
%87 = getelementptr inbounds [5000 x float], [5000 x float]* %1, i64 0, i64 %86
%88 = load float, float* %87
%89 = call float @sinf(float %88)
%90 = getelementptr inbounds [5000 x float], [5000 x float]* %4, i64 0, i64 %86
store float %89, float* %90
%91 = add nuw nsw i64 %66, 5
%92 = icmp eq i64 %91, 5000
br i1 %92, label %93, label %65
93: ; preds = %65
%94 = add nuw nsw i32 %64, 1
%95 = icmp eq i32 %94, 10000
br i1 %95, label %96, label %63
96: ; preds = %93
%97 = call i64 (...) @clock()
%98 = sub nsw i64 %97, %62
%99 = sitofp i64 %98 to double
%100 = load double, double* @CLOCKS_PER_SEC
%101 = fdiv double %99, %100
%102 = load i32, i32* @stderr
%103 = call i32 @fprintf(i32 %102, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), double %101)
br label %104
104: ; preds = %104, %96
%105 = phi i64 [ 0, %96 ], [ %124, %104 ]
%106 = phi float [ 0.000000e+00, %96 ], [ %123, %104 ]
%107 = getelementptr inbounds [5000 x float], [5000 x float]* %4, i64 0, i64 %105
%108 = load float, float* %107
%109 = getelementptr inbounds [5000 x float], [5000 x float]* %7, i64 0, i64 %105
%110 = load float, float* %109
%111 = fsub float %108, %110
%112 = call float @llvm.fabs.f32(float %111)
%113 = fcmp ogt float %112, %106
%114 = select i1 %113, float %112, float %106
%115 = or i64 %105, 1
%116 = getelementptr inbounds [5000 x float], [5000 x float]* %4, i64 0, i64 %115
%117 = load float, float* %116
%118 = getelementptr inbounds [5000 x float], [5000 x float]* %7, i64 0, i64 %115
%119 = load float, float* %118
%120 = fsub float %117, %119
%121 = call float @llvm.fabs.f32(float %120)
%122 = fcmp ogt float %121, %114
%123 = select i1 %122, float %121, float %114
%124 = add nuw nsw i64 %105, 2
%125 = icmp eq i64 %124, 5000
br i1 %125, label %126, label %104
126: ; preds = %104
%127 = load i32, i32* @stderr
%128 = fpext float %123 to double
%129 = call i32 @fprintf(i32 %127, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), double %128)
%130 = call i64 (...) @clock()
br label %131
131: ; preds = %126, %131
%132 = phi i32 [ 0, %126 ], [ %134, %131 ]
%133 = call i32 @VectorMathExp(float* %54, float* %8, i32 5000)
%134 = add nuw nsw i32 %132, 1
%135 = icmp eq i32 %134, 10000
br i1 %135, label %136, label %131
136: ; preds = %131
%137 = call i64 (...) @clock()
%138 = sub nsw i64 %137, %130
%139 = sitofp i64 %138 to double
%140 = load double, double* @CLOCKS_PER_SEC
%141 = fdiv double %139, %140
%142 = load i32, i32* @stderr
%143 = call i32 @fprintf(i32 %142, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), double %141)
%144 = call i64 (...) @clock()
br label %145
145: ; preds = %136, %155
%146 = phi i32 [ 0, %136 ], [ %156, %155 ]
br label %147
147: ; preds = %145, %147
%148 = phi i64 [ 0, %145 ], [ %153, %147 ]
%149 = getelementptr inbounds [5000 x float], [5000 x float]* %4, i64 0, i64 %148
%150 = load float, float* %149
%151 = call float @expf(float %150)
%152 = getelementptr inbounds [5000 x float], [5000 x float]* %3, i64 0, i64 %148
store float %151, float* %152
%153 = add nuw nsw i64 %148, 1
%154 = icmp eq i64 %153, 5000
br i1 %154, label %155, label %147
155: ; preds = %147
%156 = add nuw nsw i32 %146, 1
%157 = icmp eq i32 %156, 10000
br i1 %157, label %158, label %145
158: ; preds = %155
%159 = call i64 (...) @clock()
%160 = sub nsw i64 %159, %144
%161 = sitofp i64 %160 to double
%162 = load double, double* @CLOCKS_PER_SEC
%163 = fdiv double %161, %162
%164 = load i32, i32* @stderr
%165 = call i32 @fprintf(i32 %164, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), double %163)
br label %166
166: ; preds = %166, %158
%167 = phi i64 [ 0, %158 ], [ %186, %166 ]
%168 = phi float [ 0.000000e+00, %158 ], [ %185, %166 ]
%169 = getelementptr inbounds [5000 x float], [5000 x float]* %3, i64 0, i64 %167
%170 = load float, float* %169
%171 = getelementptr inbounds [5000 x float], [5000 x float]* %6, i64 0, i64 %167
%172 = load float, float* %171
%173 = fsub float %170, %172
%174 = call float @llvm.fabs.f32(float %173)
%175 = fcmp ogt float %174, %168
%176 = select i1 %175, float %174, float %168
%177 = or i64 %167, 1
%178 = getelementptr inbounds [5000 x float], [5000 x float]* %3, i64 0, i64 %177
%179 = load float, float* %178
%180 = getelementptr inbounds [5000 x float], [5000 x float]* %6, i64 0, i64 %177
%181 = load float, float* %180
%182 = fsub float %179, %181
%183 = call float @llvm.fabs.f32(float %182)
%184 = fcmp ogt float %183, %176
%185 = select i1 %184, float %183, float %176
%186 = add nuw nsw i64 %167, 2
%187 = icmp eq i64 %186, 5000
br i1 %187, label %188, label %166
188: ; preds = %166
%189 = getelementptr inbounds [5000 x float], [5000 x float]* %1, i64 0, i64 0
%190 = load i32, i32* @stderr
%191 = fpext float %185 to double
%192 = call i32 @fprintf(i32 %190, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), double %191)
%193 = call i64 (...) @clock()
br label %194
194: ; preds = %188, %194
%195 = phi i32 [ 0, %188 ], [ %197, %194 ]
%196 = call i32 @VectorMathAdd(float* %46, float* %189, float* %10, i32 5000)
%197 = add nuw nsw i32 %195, 1
%198 = icmp eq i32 %197, 10000
br i1 %198, label %199, label %194
199: ; preds = %194
%200 = call i64 (...) @clock()
%201 = sub nsw i64 %200, %193
%202 = sitofp i64 %201 to double
%203 = load double, double* @CLOCKS_PER_SEC
%204 = fdiv double %202, %203
%205 = load i32, i32* @stderr
%206 = call i32 @fprintf(i32 %205, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), double %204)
%207 = call i64 (...) @clock()
br label %208
208: ; preds = %252, %199
%209 = phi i32 [ 0, %199 ], [ %253, %252 ]
br label %210
210: ; preds = %232, %208
%211 = phi i64 [ 0, %208 ], [ %251, %232 ]
%212 = getelementptr inbounds [5000 x float], [5000 x float]* %1, i64 0, i64 %211
%213 = bitcast float* %212 to <4 x float>*
%214 = load <4 x float>, <4 x float>* %213
%215 = getelementptr inbounds float, float* %212, i64 4
%216 = bitcast float* %215 to <4 x float>*
%217 = load <4 x float>, <4 x float>* %216
%218 = getelementptr inbounds [5000 x float], [5000 x float]* %2, i64 0, i64 %211
%219 = bitcast float* %218 to <4 x float>*
%220 = load <4 x float>, <4 x float>* %219
%221 = getelementptr inbounds float, float* %218, i64 4
%222 = bitcast float* %221 to <4 x float>*
%223 = load <4 x float>, <4 x float>* %222
%224 = fadd <4 x float> %214, %220
%225 = fadd <4 x float> %217, %223
%226 = getelementptr inbounds [5000 x float], [5000 x float]* %3, i64 0, i64 %211
%227 = bitcast float* %226 to <4 x float>*
store <4 x float> %224, <4 x float>* %227
%228 = getelementptr inbounds float, float* %226, i64 4
%229 = bitcast float* %228 to <4 x float>*
store <4 x float> %225, <4 x float>* %229
%230 = or i64 %211, 8
%231 = icmp eq i64 %230, 5000
br i1 %231, label %252, label %232
232: ; preds = %210
%233 = getelementptr inbounds [5000 x float], [5000 x float]* %1, i64 0, i64 %230
%234 = bitcast float* %233 to <4 x float>*
%235 = load <4 x float>, <4 x float>* %234
%236 = getelementptr inbounds float, float* %233, i64 4
%237 = bitcast float* %236 to <4 x float>*
%238 = load <4 x float>, <4 x float>* %237
%239 = getelementptr inbounds [5000 x float], [5000 x float]* %2, i64 0, i64 %230
%240 = bitcast float* %239 to <4 x float>*
%241 = load <4 x float>, <4 x float>* %240
%242 = getelementptr inbounds float, float* %239, i64 4
%243 = bitcast float* %242 to <4 x float>*
%244 = load <4 x float>, <4 x float>* %243
%245 = fadd <4 x float> %235, %241
%246 = fadd <4 x float> %238, %244
%247 = getelementptr inbounds [5000 x float], [5000 x float]* %3, i64 0, i64 %230
%248 = bitcast float* %247 to <4 x float>*
store <4 x float> %245, <4 x float>* %248
%249 = getelementptr inbounds float, float* %247, i64 4
%250 = bitcast float* %249 to <4 x float>*
store <4 x float> %246, <4 x float>* %250
%251 = add nuw nsw i64 %211, 16
br label %210
252: ; preds = %210
%253 = add nuw nsw i32 %209, 1
%254 = icmp eq i32 %253, 10000
br i1 %254, label %255, label %208
255: ; preds = %252
%256 = call i64 (...) @clock()
%257 = sub nsw i64 %256, %207
%258 = sitofp i64 %257 to double
%259 = load double, double* @CLOCKS_PER_SEC
%260 = fdiv double %258, %259
%261 = load i32, i32* @stderr
%262 = call i32 @fprintf(i32 %261, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), double %260)
ret i32 0
}