#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
float peakbandwidth_client(float, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
float sqrt(float);
float peakbandwidth(float ccnt_overhead) {
  float avg = 0.0;
  float stddev = 0.0;
  float max = 0.0;
  float min = 1000000000.0;
  printf("Local test\n");
  for (int i = 0; i < 10; i++) {
    printf("Trial %d\n", (i + 1));
    if (i != 0)
      sleep(10);
    float latency = peakbandwidth_client(ccnt_overhead, "localhost");
    if (latency < 0) {
      continue;
    }
    float prev_avg = avg;
    unsigned int k = i + 1;
    avg += (latency - avg) / k;
    stddev +=
        ((float)(k - 1)) / k * (latency - prev_avg) * (latency - prev_avg);
    if (latency > max) {
      max = latency;
    }
    if (latency < min) {
      min = latency;
    }
    printf(
        "Cumulative Average Send Time: %f\t Max: %f\t Min: %f\t Std. Dev: %f\n",
        avg, max, min, stddev);
    printf("==================================================================="
           "===\n");
  }
  stddev = sqrt(stddev);
  printf("Average Send Time: %f\t Max: %f\t Min: %f\t Std. Dev: %f\n", avg, max,
         min, stddev);
  printf("Remote test\n");
  for (int i = 0; i < 10; i++) {
    printf("Trial %d\n", (i + 1));
    if (i != 0)
      sleep(5);
    float latency = peakbandwidth_client(ccnt_overhead, "76.167.145.48");
    if (latency < 0) {
      continue;
    }
    float prev_avg = avg;
    unsigned int k = i + 1;
    avg += (latency - avg) / k;
    stddev +=
        ((float)(k - 1)) / k * (latency - prev_avg) * (latency - prev_avg);
    if (latency > max) {
      max = latency;
    }
    if (latency < min) {
      min = latency;
    }
    printf(
        "Cumulative Average Send Time: %f\t Max: %f\t Min: %f\t Std. Dev: %f\n",
        avg, max, min, stddev);
    printf("==================================================================="
           "===\n");
  }
  stddev = sqrt(stddev);
  printf("Average Send Time: %f\t Max: %f\t Min: %f\t Std. Dev: %f\n", avg, max,
         min, stddev);
  return avg;
}


x86 assembly (clang, -O0):
<peakbandwidth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe93(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jge    12db <peakbandwidth+0x19b>
mov    -0x18(%rbp),%esi
add    $0x1,%esi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
je     11b9 <peakbandwidth+0x79>
mov    $0xa,%edi
call   1060 <sleep@plt>
movss  -0x4(%rbp),%xmm0
lea    0xe55(%rip),%rdi
call   1040 <peakbandwidth_client@plt>
movss  %xmm0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x1c(%rbp),%xmm0
jbe    11e1 <peakbandwidth+0xa1>
jmp    12cd <peakbandwidth+0x18d>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
subss  %xmm0,%xmm1
mov    -0x24(%rbp),%eax
cvtsi2ss %rax,%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
cvtsi2ss %rcx,%xmm0
cvtsi2ss %rax,%xmm1
divss  %xmm1,%xmm0
movss  -0x1c(%rbp),%xmm1
subss  -0x20(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  -0x1c(%rbp),%xmm2
subss  -0x20(%rbp),%xmm2
movss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x1c(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1270 <peakbandwidth+0x130>
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    128d <peakbandwidth+0x14d>
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x14(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0xc(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xd6c(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1187 <peakbandwidth+0x47>
movss  -0xc(%rbp),%xmm0
call   1050 <sqrt@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x14(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0xc(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xd1a(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
cmpl   $0xa,-0x28(%rbp)
jge    1485 <peakbandwidth+0x345>
mov    -0x28(%rbp),%esi
add    $0x1,%esi
lea    0xcc8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x28(%rbp)
je     1363 <peakbandwidth+0x223>
mov    $0x5,%edi
call   1060 <sleep@plt>
movss  -0x4(%rbp),%xmm0
lea    0xd4c(%rip),%rdi
call   1040 <peakbandwidth_client@plt>
movss  %xmm0,-0x2c(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x2c(%rbp),%xmm0
jbe    138b <peakbandwidth+0x24b>
jmp    1477 <peakbandwidth+0x337>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
movss  -0x2c(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
subss  %xmm0,%xmm1
mov    -0x34(%rbp),%eax
cvtsi2ss %rax,%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
cvtsi2ss %rcx,%xmm0
cvtsi2ss %rax,%xmm1
divss  %xmm1,%xmm0
movss  -0x2c(%rbp),%xmm1
subss  -0x30(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  -0x2c(%rbp),%xmm2
subss  -0x30(%rbp),%xmm2
movss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x2c(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    141a <peakbandwidth+0x2da>
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x2c(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1437 <peakbandwidth+0x2f7>
movss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x14(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0xc(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xbc2(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
lea    0xbf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1331 <peakbandwidth+0x1f1>
movss  -0xc(%rbp),%xmm0
call   1050 <sqrt@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x14(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0xc(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xb70(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<peakbandwidth>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
movss  %xmm0,0x18(%rsp)
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
lea    0xe92(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe89(%rip),%rdi
movss  0x18(%rsp),%xmm0
call   1050 <peakbandwidth_client@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jbe    11c7 <peakbandwidth+0x77>
movss  0xe5c(%rip),%xmm0
movss  %xmm0,0x14(%rsp)
xorps  %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
xorps  %xmm0,%xmm0
movss  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
jmp    123d <peakbandwidth+0xed>
movaps %xmm0,%xmm2
xorps  %xmm0,%xmm0
movaps %xmm2,%xmm1
addss  %xmm0,%xmm1
movaps %xmm2,%xmm4
mulss  %xmm0,%xmm4
mulss  %xmm2,%xmm4
addss  %xmm0,%xmm4
movaps %xmm2,%xmm3
maxss  %xmm0,%xmm3
minss  0xe0e(%rip),%xmm2
movss  %xmm1,0xc(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movss  %xmm3,0x8(%rsp)
xorps  %xmm1,%xmm1
cvtss2sd %xmm3,%xmm1
movss  %xmm2,0x14(%rsp)
cvtss2sd %xmm2,%xmm2
movss  %xmm4,0x10(%rsp)
xorps  %xmm3,%xmm3
cvtss2sd %xmm4,%xmm3
lea    0xdf2(%rip),%rdi
mov    $0x4,%al
call   1040 <printf@plt>
lea    0xe4b(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%ebx
lea    0xdbf(%rip),%r14
lea    0xdc2(%rip),%r15
lea    0xdc5(%rip),%r12
lea    0xe25(%rip),%r13
jmp    126c <peakbandwidth+0x11c>
add    $0x1,%ebx
cmp    $0xb,%ebx
je     1337 <peakbandwidth+0x1e7>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1070 <sleep@plt>
movss  0x18(%rsp),%xmm0
mov    %r15,%rdi
call   1050 <peakbandwidth_client@plt>
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
ja     1260 <peakbandwidth+0x110>
lea    -0x1(%rbx),%eax
movaps %xmm1,%xmm0
movss  0xc(%rsp),%xmm3
subss  %xmm3,%xmm0
mov    %ebx,%ecx
movaps %xmm1,%xmm5
xorps  %xmm1,%xmm1
cvtsi2ss %rcx,%xmm1
mov    %eax,%eax
xorps  %xmm2,%xmm2
cvtsi2ss %rax,%xmm2
divss  %xmm1,%xmm2
mulss  %xmm0,%xmm2
mulss  %xmm0,%xmm2
divss  %xmm1,%xmm0
addss  %xmm0,%xmm3
movss  0x10(%rsp),%xmm4
addss  %xmm2,%xmm4
movaps %xmm5,%xmm1
maxss  0x8(%rsp),%xmm1
movss  %xmm1,0x8(%rsp)
minss  0x14(%rsp),%xmm5
movss  %xmm5,0x14(%rsp)
movss  %xmm3,0xc(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
cvtss2sd %xmm1,%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm5,%xmm2
movss  %xmm4,0x10(%rsp)
xorps  %xmm3,%xmm3
cvtss2sd %xmm4,%xmm3
mov    %r12,%rdi
mov    $0x4,%al
call   1040 <printf@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
jmp    1260 <peakbandwidth+0x110>
xorps  %xmm1,%xmm1
movss  0x10(%rsp),%xmm0
ucomiss %xmm1,%xmm0
jb     134e <peakbandwidth+0x1fe>
xorps  %xmm3,%xmm3
sqrtss %xmm0,%xmm3
jmp    1356 <peakbandwidth+0x206>
call   1060 <sqrt@plt>
movaps %xmm0,%xmm3
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
movss  %xmm1,0x8(%rsp)
movss  %xmm0,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x14(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  %xmm3,0x10(%rsp)
cvtss2sd %xmm3,%xmm3
lea    0xc96(%rip),%rdi
mov    $0x4,%al
call   1040 <printf@plt>
lea    0xcd8(%rip),%rdi
call   1030 <puts@plt>
lea    0xc5d(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xca0(%rip),%rdi
movss  0x18(%rsp),%xmm0
call   1050 <peakbandwidth_client@plt>
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jbe    13df <peakbandwidth+0x28f>
movss  0x8(%rsp),%xmm1
jmp    1471 <peakbandwidth+0x321>
movaps %xmm1,%xmm0
movss  0xc(%rsp),%xmm2
subss  %xmm2,%xmm0
addss  %xmm0,%xmm2
movaps %xmm1,%xmm4
xorps  %xmm1,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
movss  0x10(%rsp),%xmm3
addss  %xmm1,%xmm3
movaps %xmm4,%xmm1
maxss  0x8(%rsp),%xmm1
movss  %xmm1,0x1c(%rsp)
minss  0x14(%rsp),%xmm4
movss  %xmm4,0x8(%rsp)
movss  %xmm2,0xc(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
cvtss2sd %xmm1,%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm4,%xmm2
movss  %xmm3,0x10(%rsp)
cvtss2sd %xmm3,%xmm3
lea    0xbd0(%rip),%rdi
mov    $0x4,%al
call   1040 <printf@plt>
lea    0xc29(%rip),%rdi
call   1030 <puts@plt>
movss  0x1c(%rsp),%xmm1
movss  0x8(%rsp),%xmm0
movss  %xmm0,0x14(%rsp)
mov    $0x2,%ebx
lea    0xb8b(%rip),%r14
lea    0xbda(%rip),%r15
lea    0xb91(%rip),%r12
lea    0xbf1(%rip),%r13
jmp    14b2 <peakbandwidth+0x362>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movss  0x8(%rsp),%xmm1
add    $0x1,%ebx
cmp    $0xb,%ebx
je     1583 <peakbandwidth+0x433>
movss  %xmm1,0x8(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x5,%edi
call   1070 <sleep@plt>
movss  0x18(%rsp),%xmm0
mov    %r15,%rdi
call   1050 <peakbandwidth_client@plt>
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
ja     14a0 <peakbandwidth+0x350>
lea    -0x1(%rbx),%eax
movaps %xmm1,%xmm0
movss  0xc(%rsp),%xmm3
subss  %xmm3,%xmm0
mov    %ebx,%ecx
movaps %xmm1,%xmm5
xorps  %xmm1,%xmm1
cvtsi2ss %rcx,%xmm1
mov    %eax,%eax
xorps  %xmm2,%xmm2
cvtsi2ss %rax,%xmm2
divss  %xmm1,%xmm2
mulss  %xmm0,%xmm2
mulss  %xmm0,%xmm2
divss  %xmm1,%xmm0
addss  %xmm0,%xmm3
movss  0x10(%rsp),%xmm4
addss  %xmm2,%xmm4
movaps %xmm5,%xmm1
maxss  0x8(%rsp),%xmm1
movss  %xmm1,0x8(%rsp)
minss  0x14(%rsp),%xmm5
movss  %xmm5,0x14(%rsp)
movss  %xmm3,0xc(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
cvtss2sd %xmm1,%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm5,%xmm2
movss  %xmm4,0x10(%rsp)
xorps  %xmm3,%xmm3
cvtss2sd %xmm4,%xmm3
mov    %r12,%rdi
mov    $0x4,%al
call   1040 <printf@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
jmp    14a0 <peakbandwidth+0x350>
xorps  %xmm2,%xmm2
movss  0x10(%rsp),%xmm0
ucomiss %xmm2,%xmm0
jb     1597 <peakbandwidth+0x447>
sqrtss %xmm0,%xmm0
jmp    15a8 <peakbandwidth+0x458>
movss  %xmm1,0x8(%rsp)
call   1060 <sqrt@plt>
movss  0x8(%rsp),%xmm1
movss  0xc(%rsp),%xmm2
xorps  %xmm4,%xmm4
cvtss2sd %xmm2,%xmm4
cvtss2sd %xmm1,%xmm1
movss  0x14(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
xorps  %xmm3,%xmm3
cvtss2sd %xmm0,%xmm3
lea    0xa56(%rip),%rdi
movaps %xmm4,%xmm0
mov    $0x4,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Local test\0A\00"
@.str.1 = [10 x i8] c"Trial %d\0A\00"
@.str.2 = [10 x i8] c"localhost\00"
@.str.3 = [66 x i8] c"Cumulative Average Send Time: %f\09 Max: %f\09 Min: %f\09 Std. Dev: %f\0A\00"
@.str.4 = [72 x i8] c"======================================================================\0A\00"
@.str.5 = [55 x i8] c"Average Send Time: %f\09 Max: %f\09 Min: %f\09 Std. Dev: %f\0A\00"
@.str.6 = [13 x i8] c"Remote test\0A\00"
@.str.7 = [14 x i8] c"76.167.145.48\00"
define float @peakbandwidth(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca float
%13 = alloca float
%14 = alloca i32
store float %0, float* %2
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %4
store float 0.000000e+00, float* %5
store float 1.000000e+09, float* %6
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %16
16: ; preds = %82, %1
%17 = load i32, i32* %7
%18 = icmp slt i32 %17, 10
br i1 %18, label %19, label %85
19: ; preds = %16
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 1
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %7
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %19
%26 = call i32 @sleep(i32 10)
br label %27
27: ; preds = %25, %19
%28 = load float, float* %2
%29 = call float @peakbandwidth_client(float %28, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
store float %29, float* %8
%30 = load float, float* %8
%31 = fcmp olt float %30, 0.000000e+00
br i1 %31, label %32, label %33
32: ; preds = %27
br label %82
33: ; preds = %27
%34 = load float, float* %3
store float %34, float* %9
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %10
%37 = load float, float* %8
%38 = load float, float* %3
%39 = fsub float %37, %38
%40 = load i32, i32* %10
%41 = uitofp i32 %40 to float
%42 = fdiv float %39, %41
%43 = load float, float* %3
%44 = fadd float %43, %42
store float %44, float* %3
%45 = load i32, i32* %10
%46 = sub i32 %45, 1
%47 = uitofp i32 %46 to float
%48 = load i32, i32* %10
%49 = uitofp i32 %48 to float
%50 = fdiv float %47, %49
%51 = load float, float* %8
%52 = load float, float* %9
%53 = fsub float %51, %52
%54 = fmul float %50, %53
%55 = load float, float* %8
%56 = load float, float* %9
%57 = fsub float %55, %56
%58 = load float, float* %4
%59 = call float @llvm.fmuladd.f32(float %54, float %57, float %58)
store float %59, float* %4
%60 = load float, float* %8
%61 = load float, float* %5
%62 = fcmp ogt float %60, %61
br i1 %62, label %63, label %65
63: ; preds = %33
%64 = load float, float* %8
store float %64, float* %5
br label %65
65: ; preds = %63, %33
%66 = load float, float* %8
%67 = load float, float* %6
%68 = fcmp olt float %66, %67
br i1 %68, label %69, label %71
69: ; preds = %65
%70 = load float, float* %8
store float %70, float* %6
br label %71
71: ; preds = %69, %65
%72 = load float, float* %3
%73 = fpext float %72 to double
%74 = load float, float* %5
%75 = fpext float %74 to double
%76 = load float, float* %6
%77 = fpext float %76 to double
%78 = load float, float* %4
%79 = fpext float %78 to double
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0), double %73, double %75, double %77, double %79)
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.4, i64 0, i64 0))
br label %82
82: ; preds = %71, %32
%83 = load i32, i32* %7
%84 = add nsw i32 %83, 1
store i32 %84, i32* %7
br label %16
85: ; preds = %16
%86 = load float, float* %4
%87 = call float @sqrt(float %86)
store float %87, float* %4
%88 = load float, float* %3
%89 = fpext float %88 to double
%90 = load float, float* %5
%91 = fpext float %90 to double
%92 = load float, float* %6
%93 = fpext float %92 to double
%94 = load float, float* %4
%95 = fpext float %94 to double
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0), double %89, double %91, double %93, double %95)
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %11
br label %98
98: ; preds = %164, %85
%99 = load i32, i32* %11
%100 = icmp slt i32 %99, 10
br i1 %100, label %101, label %167
101: ; preds = %98
%102 = load i32, i32* %11
%103 = add nsw i32 %102, 1
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %103)
%105 = load i32, i32* %11
%106 = icmp ne i32 %105, 0
br i1 %106, label %107, label %109
107: ; preds = %101
%108 = call i32 @sleep(i32 5)
br label %109
109: ; preds = %107, %101
%110 = load float, float* %2
%111 = call float @peakbandwidth_client(float %110, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
store float %111, float* %12
%112 = load float, float* %12
%113 = fcmp olt float %112, 0.000000e+00
br i1 %113, label %114, label %115
114: ; preds = %109
br label %164
115: ; preds = %109
%116 = load float, float* %3
store float %116, float* %13
%117 = load i32, i32* %11
%118 = add nsw i32 %117, 1
store i32 %118, i32* %14
%119 = load float, float* %12
%120 = load float, float* %3
%121 = fsub float %119, %120
%122 = load i32, i32* %14
%123 = uitofp i32 %122 to float
%124 = fdiv float %121, %123
%125 = load float, float* %3
%126 = fadd float %125, %124
store float %126, float* %3
%127 = load i32, i32* %14
%128 = sub i32 %127, 1
%129 = uitofp i32 %128 to float
%130 = load i32, i32* %14
%131 = uitofp i32 %130 to float
%132 = fdiv float %129, %131
%133 = load float, float* %12
%134 = load float, float* %13
%135 = fsub float %133, %134
%136 = fmul float %132, %135
%137 = load float, float* %12
%138 = load float, float* %13
%139 = fsub float %137, %138
%140 = load float, float* %4
%141 = call float @llvm.fmuladd.f32(float %136, float %139, float %140)
store float %141, float* %4
%142 = load float, float* %12
%143 = load float, float* %5
%144 = fcmp ogt float %142, %143
br i1 %144, label %145, label %147
145: ; preds = %115
%146 = load float, float* %12
store float %146, float* %5
br label %147
147: ; preds = %145, %115
%148 = load float, float* %12
%149 = load float, float* %6
%150 = fcmp olt float %148, %149
br i1 %150, label %151, label %153
151: ; preds = %147
%152 = load float, float* %12
store float %152, float* %6
br label %153
153: ; preds = %151, %147
%154 = load float, float* %3
%155 = fpext float %154 to double
%156 = load float, float* %5
%157 = fpext float %156 to double
%158 = load float, float* %6
%159 = fpext float %158 to double
%160 = load float, float* %4
%161 = fpext float %160 to double
%162 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0), double %155, double %157, double %159, double %161)
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.4, i64 0, i64 0))
br label %164
164: ; preds = %153, %114
%165 = load i32, i32* %11
%166 = add nsw i32 %165, 1
store i32 %166, i32* %11
br label %98
167: ; preds = %98
%168 = load float, float* %4
%169 = call float @sqrt(float %168)
store float %169, float* %4
%170 = load float, float* %3
%171 = fpext float %170 to double
%172 = load float, float* %5
%173 = fpext float %172 to double
%174 = load float, float* %6
%175 = fpext float %174 to double
%176 = load float, float* %4
%177 = fpext float %176 to double
%178 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0), double %171, double %173, double %175, double %177)
%179 = load float, float* %3
ret float %179
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"Trial %d\0A\00"
@.str.2 = [10 x i8] c"localhost\00"
@.str.3 = [66 x i8] c"Cumulative Average Send Time: %f\09 Max: %f\09 Min: %f\09 Std. Dev: %f\0A\00"
@.str.5 = [55 x i8] c"Average Send Time: %f\09 Max: %f\09 Min: %f\09 Std. Dev: %f\0A\00"
@.str.7 = [14 x i8] c"76.167.145.48\00"
@str = [11 x i8] c"Local test\00"
@str.8 = [12 x i8] c"Remote test\00"
@str.10 = [71 x i8] c"======================================================================\00"
define float @peakbandwidth(float %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 1)
%4 = tail call float @peakbandwidth_client(float %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%5 = fcmp olt float %4, 0.000000e+00
br i1 %5, label %20, label %6
6: ; preds = %1
%7 = fadd float %4, 0.000000e+00
%8 = fmul float %4, 0.000000e+00
%9 = tail call float @llvm.fmuladd.f32(float %8, float %4, float 0.000000e+00)
%10 = fcmp ogt float %4, 0.000000e+00
%11 = select i1 %10, float %4, float 0.000000e+00
%12 = fcmp olt float %4, 1.000000e+09
%13 = select i1 %12, float %4, float 1.000000e+09
%14 = fpext float %7 to double
%15 = fpext float %11 to double
%16 = fpext float %13 to double
%17 = fpext float %9 to double
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0), double %14, double %15, double %16, double %17)
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str.10, i64 0, i64 0))
br label %20
20: ; preds = %1, %6
%21 = phi float [ 0.000000e+00, %1 ], [ %7, %6 ]
%22 = phi float [ 0.000000e+00, %1 ], [ %9, %6 ]
%23 = phi float [ 0.000000e+00, %1 ], [ %11, %6 ]
%24 = phi float [ 1.000000e+09, %1 ], [ %13, %6 ]
br label %56
25: ; preds = %86
%26 = tail call float @sqrt(float %89)
%27 = fpext float %90 to double
%28 = fpext float %88 to double
%29 = fpext float %87 to double
%30 = fpext float %26 to double
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0), double %27, double %28, double %29, double %30)
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.8, i64 0, i64 0))
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 1)
%34 = tail call float @peakbandwidth_client(float %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%35 = fcmp olt float %34, 0.000000e+00
br i1 %35, label %51, label %36
36: ; preds = %25
%37 = fsub float %34, %90
%38 = fadd float %90, %37
%39 = fmul float %37, 0.000000e+00
%40 = tail call float @llvm.fmuladd.f32(float %39, float %37, float %26)
%41 = fcmp ogt float %34, %88
%42 = select i1 %41, float %34, float %88
%43 = fcmp olt float %34, %87
%44 = select i1 %43, float %34, float %87
%45 = fpext float %38 to double
%46 = fpext float %42 to double
%47 = fpext float %44 to double
%48 = fpext float %40 to double
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0), double %45, double %46, double %47, double %48)
%50 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str.10, i64 0, i64 0))
br label %51
51: ; preds = %25, %36
%52 = phi float [ %90, %25 ], [ %38, %36 ]
%53 = phi float [ %26, %25 ], [ %40, %36 ]
%54 = phi float [ %88, %25 ], [ %42, %36 ]
%55 = phi float [ %87, %25 ], [ %44, %36 ]
br label %99
56: ; preds = %20, %86
%57 = phi float [ %90, %86 ], [ %21, %20 ]
%58 = phi float [ %89, %86 ], [ %22, %20 ]
%59 = phi float [ %88, %86 ], [ %23, %20 ]
%60 = phi float [ %87, %86 ], [ %24, %20 ]
%61 = phi i32 [ %62, %86 ], [ 1, %20 ]
%62 = add nuw nsw i32 %61, 1
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %62)
%64 = tail call i32 @sleep(i32 10)
%65 = tail call float @peakbandwidth_client(float %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%66 = fcmp olt float %65, 0.000000e+00
br i1 %66, label %86, label %67
67: ; preds = %56
%68 = fsub float %65, %57
%69 = uitofp i32 %62 to float
%70 = fdiv float %68, %69
%71 = fadd float %57, %70
%72 = uitofp i32 %61 to float
%73 = fdiv float %72, %69
%74 = fmul float %73, %68
%75 = tail call float @llvm.fmuladd.f32(float %74, float %68, float %58)
%76 = fcmp ogt float %65, %59
%77 = select i1 %76, float %65, float %59
%78 = fcmp olt float %65, %60
%79 = select i1 %78, float %65, float %60
%80 = fpext float %71 to double
%81 = fpext float %77 to double
%82 = fpext float %79 to double
%83 = fpext float %75 to double
%84 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0), double %80, double %81, double %82, double %83)
%85 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str.10, i64 0, i64 0))
br label %86
86: ; preds = %56, %67
%87 = phi float [ %79, %67 ], [ %60, %56 ]
%88 = phi float [ %77, %67 ], [ %59, %56 ]
%89 = phi float [ %75, %67 ], [ %58, %56 ]
%90 = phi float [ %71, %67 ], [ %57, %56 ]
%91 = icmp eq i32 %62, 10
br i1 %91, label %25, label %56
92: ; preds = %129
%93 = tail call float @sqrt(float %132)
%94 = fpext float %133 to double
%95 = fpext float %131 to double
%96 = fpext float %130 to double
%97 = fpext float %93 to double
%98 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0), double %94, double %95, double %96, double %97)
ret float %133
99: ; preds = %51, %129
%100 = phi float [ %133, %129 ], [ %52, %51 ]
%101 = phi float [ %132, %129 ], [ %53, %51 ]
%102 = phi float [ %131, %129 ], [ %54, %51 ]
%103 = phi i32 [ %105, %129 ], [ 1, %51 ]
%104 = phi float [ %130, %129 ], [ %55, %51 ]
%105 = add nuw nsw i32 %103, 1
%106 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %105)
%107 = tail call i32 @sleep(i32 5)
%108 = tail call float @peakbandwidth_client(float %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%109 = fcmp olt float %108, 0.000000e+00
br i1 %109, label %129, label %110
110: ; preds = %99
%111 = fsub float %108, %100
%112 = uitofp i32 %105 to float
%113 = fdiv float %111, %112
%114 = fadd float %100, %113
%115 = uitofp i32 %103 to float
%116 = fdiv float %115, %112
%117 = fmul float %116, %111
%118 = tail call float @llvm.fmuladd.f32(float %117, float %111, float %101)
%119 = fcmp ogt float %108, %102
%120 = select i1 %119, float %108, float %102
%121 = fcmp olt float %108, %104
%122 = select i1 %121, float %108, float %104
%123 = fpext float %114 to double
%124 = fpext float %120 to double
%125 = fpext float %122 to double
%126 = fpext float %118 to double
%127 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0), double %123, double %124, double %125, double %126)
%128 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str.10, i64 0, i64 0))
br label %129
129: ; preds = %99, %110
%130 = phi float [ %122, %110 ], [ %104, %99 ]
%131 = phi float [ %120, %110 ], [ %102, %99 ]
%132 = phi float [ %118, %110 ], [ %101, %99 ]
%133 = phi float [ %114, %110 ], [ %100, %99 ]
%134 = icmp eq i32 %105, 10
br i1 %134, label %92, label %99
}