#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 */
double atof(char *);
int atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int size;
  double run_s, idle_s, run_e, idle_e;
  if (argc != 6) {
    printf("Invalid number of arg\n");
    return 0;
  }
  size = atoi(argv[1]);
  run_s = atof(argv[2]);
  idle_s = atof(argv[3]);
  run_e = atof(argv[4]);
  idle_e = atof(argv[5]);
  if (run_s == run_e) {
    printf("Zero execution time\n");
    return 0;
  }
  if (run_s == 0 || run_e == 0) {
    printf("Zero run time. atof may fail\n");
  }
  printf("Run time: %.1f sec, Idle time %.1f sec, Throughput=%.1fMbps\n",
         run_e - run_s, idle_e - idle_s, size / (run_e - run_s));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x6,-0x8(%rbp)
je     116a <main+0x3a>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1271 <main+0x141>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jne    11f2 <main+0xc2>
jp     11f2 <main+0xc2>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1271 <main+0x141>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    120f <main+0xdf>
jp     120f <main+0xdf>
jmp    1227 <main+0xf7>
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1235 <main+0x105>
jp     1235 <main+0x105>
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x30(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
cvtsi2sdl -0x14(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
subsd  -0x20(%rbp),%xmm3
divsd  %xmm3,%xmm2
lea    0xde7(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
cmp    $0x6,%edi
jne    11b1 <main+0x71>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x10(%rsp)
mov    0x18(%rbx),%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x20(%rsp)
mov    0x20(%rbx),%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x8(%rsp)
mov    0x28(%rbx),%rdi
call   1040 <atof@plt>
movsd  0x8(%rsp),%xmm3
movsd  0x10(%rsp),%xmm1
ucomisd %xmm3,%xmm1
jne    11bf <main+0x7f>
jp     11bf <main+0x7f>
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
jmp    1223 <main+0xe3>
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
jmp    1223 <main+0xe3>
movapd %xmm0,%xmm4
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    11cf <main+0x8f>
jnp    11d7 <main+0x97>
ucomisd %xmm0,%xmm3
jne    11fb <main+0xbb>
jp     11fb <main+0xbb>
lea    0xe5f(%rip),%rdi
movsd  %xmm4,0x18(%rsp)
call   1030 <puts@plt>
movsd  0x18(%rsp),%xmm4
movsd  0x8(%rsp),%xmm3
movsd  0x10(%rsp),%xmm1
subsd  %xmm1,%xmm3
subsd  0x20(%rsp),%xmm4
cvtsi2sd %ebp,%xmm2
divsd  %xmm3,%xmm2
lea    0xdec(%rip),%rdi
movapd %xmm3,%xmm0
movapd %xmm4,%xmm1
mov    $0x3,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Invalid number of arg\0A\00"
@.str.1 = [21 x i8] c"Zero execution time\0A\00"
@.str.2 = [30 x i8] c"Zero run time. atof may fail\0A\00"
@.str.3 = [61 x i8] c"Run time: %.1f sec, Idle time %.1f sec, Throughput=%.1fMbps\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 6
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %63
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @atoi(i8* %18)
store i32 %19, i32* %6
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call double @atof(i8* %22)
store double %23, double* %7
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 3
%26 = load i8*, i8** %25
%27 = call double @atof(i8* %26)
store double %27, double* %8
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 4
%30 = load i8*, i8** %29
%31 = call double @atof(i8* %30)
store double %31, double* %9
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 5
%34 = load i8*, i8** %33
%35 = call double @atof(i8* %34)
store double %35, double* %10
%36 = load double, double* %7
%37 = load double, double* %9
%38 = fcmp oeq double %36, %37
br i1 %38, label %39, label %41
39: ; preds = %15
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %63
41: ; preds = %15
%42 = load double, double* %7
%43 = fcmp oeq double %42, 0.000000e+00
br i1 %43, label %47, label %44
44: ; preds = %41
%45 = load double, double* %9
%46 = fcmp oeq double %45, 0.000000e+00
br i1 %46, label %47, label %49
47: ; preds = %44, %41
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %49
49: ; preds = %47, %44
%50 = load double, double* %9
%51 = load double, double* %7
%52 = fsub double %50, %51
%53 = load double, double* %10
%54 = load double, double* %8
%55 = fsub double %53, %54
%56 = load i32, i32* %6
%57 = sitofp i32 %56 to double
%58 = load double, double* %9
%59 = load double, double* %7
%60 = fsub double %58, %59
%61 = fdiv double %57, %60
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0), double %52, double %55, double %61)
store i32 0, i32* %3
br label %63
63: ; preds = %49, %39, %13
%64 = load i32, i32* %3
ret i32 %64
}

LLVM IR (-O2):
@.str.3 = [61 x i8] c"Run time: %.1f sec, Idle time %.1f sec, Throughput=%.1fMbps\0A\00"
@str = [29 x i8] c"Zero run time. atof may fail\00"
@str.4 = [20 x i8] c"Zero execution time\00"
@str.5 = [22 x i8] c"Invalid number of arg\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 6
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.5, i64 0, i64 0))
br label %37
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call double @atof(i8* %11)
%13 = getelementptr inbounds i8*, i8** %1, i64 3
%14 = load i8*, i8** %13
%15 = tail call double @atof(i8* %14)
%16 = getelementptr inbounds i8*, i8** %1, i64 4
%17 = load i8*, i8** %16
%18 = tail call double @atof(i8* %17)
%19 = getelementptr inbounds i8*, i8** %1, i64 5
%20 = load i8*, i8** %19
%21 = tail call double @atof(i8* %20)
%22 = fcmp oeq double %12, %18
br i1 %22, label %23, label %25
23: ; preds = %6
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.4, i64 0, i64 0))
br label %37
25: ; preds = %6
%26 = fcmp oeq double %12, 0.000000e+00
%27 = fcmp oeq double %18, 0.000000e+00
%28 = select i1 %26, i1 true, i1 %27
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %31
31: ; preds = %25, %29
%32 = fsub double %18, %12
%33 = fsub double %21, %15
%34 = sitofp i32 %9 to double
%35 = fdiv double %34, %32
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0), double %32, double %33, double %35)
br label %37
37: ; preds = %31, %23, %4
ret i32 0
}