#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 */
struct timeval {
  long tv_sec;
  long tv_usec;
};
typedef int /*<<< orphan*/ randval;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
double INT_MAX;
int atoi(char *);
int /*<<< orphan*/ bucketSort(double *, int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(unsigned int *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double *malloc(int);
int /*<<< orphan*/ omp_set_num_threads(int);
int /*<<< orphan*/ printf(char *, ...);
double rand();
int /*<<< orphan*/ srand(unsigned int);
int main(int argc, char **argv) {
  if (argc != 4) {
    printf("Usage: %s [how-much] [max-threads] [0|1 (meaning normal|scaled)]\n",
           argv[0]);
    exit(-1);
  }
  int n = atoi(argv[1]);
  int max_threads = atoi(argv[2]);
  int buckets;
  double *array;
  unsigned int randval;
  FILE *f = fopen("/dev/urandom", "r");
  fread(&randval, sizeof(randval), 1, f);
  fclose(f);
  srand(randval);
  double seq_time;
  double speedup, efficiency, karp_flatt;
  for (int threads = 1; threads <= max_threads; threads++) {
    if (atoi(argv[3]) == 1) {
      n = atoi(argv[1]) * threads;
    }
    buckets = n / 1000 + 1;
    array = malloc(sizeof(double) * n);
    omp_set_num_threads(threads);
    int i;
#pragma omp parallel for default(shared) private(i)
    for (i = 0; i < n; i++)
      array[i] = (rand() + 0.0) / INT_MAX;
    struct timeval start, end;
    long secs_used, micros;
    gettimeofday(&start, NULL);
    bucketSort(array, n, buckets);
    gettimeofday(&end, NULL);
    secs_used = (end.tv_sec - start.tv_sec);
    micros = end.tv_usec - start.tv_usec;
    double time = secs_used + 0.0;
    time += ((micros + 0.0) / 1000000);
    if (threads == 1)
      seq_time = time;
    if (atoi(argv[3]) == 0) {
      speedup = seq_time / time;
    } else {
      speedup = threads * seq_time / time;
    }
    efficiency = speedup / threads;
    karp_flatt = (1. / speedup - 1. / threads) / (1. - 1. / threads);
    printf("%d %d %lf %lf %lf %lf\n", n, threads, time, speedup, efficiency,
           karp_flatt);
    free(array);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     1212 <main+0x42>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x18(%rbp)
lea    0xe19(%rip),%rdi
lea    0xe1f(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rcx
lea    -0x2c(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1040 <fread@plt>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x2c(%rbp),%edi
call   1080 <srand@plt>
movl   $0x1,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     14a4 <main+0x2d4>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10d0 <atoi@plt>
cmp    $0x1,%eax
jne    12ae <main+0xde>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10d0 <atoi@plt>
imul   -0x5c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x5c(%rbp),%edi
call   10a0 <omp_set_num_threads@plt>
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1321 <main+0x151>
mov    $0x0,%al
call   10f0 <rand@plt>
xorps  %xmm1,%xmm1
addsd  %xmm1,%xmm0
mov    0x2ce6(%rip),%rax
divsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    12e1 <main+0x111>
lea    -0x70(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <gettimeofday@plt>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   10b0 <bucketSort@plt>
lea    -0x80(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <gettimeofday@plt>
mov    -0x80(%rbp),%rax
sub    -0x70(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x78(%rbp),%rax
sub    -0x68(%rbp),%rax
mov    %rax,-0x90(%rbp)
cvtsi2sdq -0x88(%rbp),%xmm0
ff ff
xorps  %xmm1,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
cvtsi2sdq -0x90(%rbp),%xmm0
ff ff
xorps  %xmm1,%xmm1
addsd  %xmm1,%xmm0
movsd  0xc68(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
cmpl   $0x1,-0x5c(%rbp)
jne    13c3 <main+0x1f3>
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10d0 <atoi@plt>
cmp    $0x0,%eax
jne    13f0 <main+0x220>
movsd  -0x40(%rbp),%xmm0
divsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
jmp    1407 <main+0x237>
cvtsi2sdl -0x5c(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
divsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
cvtsi2sdl -0x5c(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xbe6(%rip),%xmm0
divsd  -0x48(%rbp),%xmm0
cvtsi2sdl -0x5c(%rbp),%xmm2
movsd  0xbd4(%rip),%xmm1
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
cvtsi2sdl -0x5c(%rbp),%xmm1
movsd  0xbbf(%rip),%xmm2
divsd  %xmm1,%xmm2
movsd  0xbb3(%rip),%xmm1
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x5c(%rbp),%edx
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0x48(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm3
lea    0xbdb(%rip),%rdi
mov    $0x4,%al
call   1060 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1278 <main+0xa8>
mov    -0x4(%rbp),%eax
add    $0xa0,%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    %rsi,%r12
cmp    $0x4,%edi
jne    1434 <main+0x264>
mov    0x8(%r12),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%r12),%rdi
call   10d0 <atoi@plt>
mov    %eax,%r14d
lea    0xe58(%rip),%rdi
lea    0xe5e(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%rbx
lea    0x14(%rsp),%rdi
mov    $0x1,%r15d
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1040 <fread@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    0x14(%rsp),%edi
call   1080 <srand@plt>
mov    %r14d,0x10(%rsp)
test   %r14d,%r14d
jle    1423 <main+0x253>
mov    0x2d8c(%rip),%r14
mov    %r12,0x20(%rsp)
jmp    12e2 <main+0x112>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mulsd  0x18(%rsp),%xmm1
movsd  0x28(%rsp),%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm2
divsd  %xmm3,%xmm2
movapd %xmm1,%xmm4
unpcklpd %xmm3,%xmm4
movapd 0xd78(%rip),%xmm3
divpd  %xmm4,%xmm3
movapd %xmm3,%xmm5
unpckhpd %xmm3,%xmm5
subsd  %xmm5,%xmm3
movsd  0xd58(%rip),%xmm4
subsd  %xmm5,%xmm4
divsd  %xmm4,%xmm3
lea    0xdb2(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    $0x4,%al
call   1060 <printf@plt>
mov    %r13,%rdi
call   1030 <free@plt>
lea    0x1(%rbx),%eax
cmp    0x10(%rsp),%ebx
mov    %eax,%r15d
je     1423 <main+0x253>
mov    0x18(%r12),%rdi
call   10d0 <atoi@plt>
cmp    $0x1,%eax
jne    1301 <main+0x131>
mov    0x8(%r12),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebp
imul   %r15d,%ebp
mov    %ebp,0xc(%rsp)
movslq %ebp,%rbx
imul   $0x10624dd3,%rbx,%rbp
mov    %rbp,%r12
sar    $0x26,%r12
shr    $0x3f,%rbp
lea    0x0(,%rbx,8),%edi
call   1090 <malloc@plt>
mov    %rax,%r13
mov    %r15,0x30(%rsp)
mov    %r15d,%edi
call   10a0 <omp_set_num_threads@plt>
test   %ebx,%ebx
jle    1374 <main+0x1a4>
mov    0xc(%rsp),%ebx
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10f0 <rand@plt>
xorpd  %xmm1,%xmm1
addsd  %xmm1,%xmm0
divsd  (%r14),%xmm0
movsd  %xmm0,0x0(%r13,%r15,8)
add    $0x1,%r15
cmp    %r15,%rbx
jne    1350 <main+0x180>
add    %ebp,%r12d
add    $0x1,%r12d
lea    0x48(%rsp),%rdi
xor    %esi,%esi
call   1070 <gettimeofday@plt>
mov    %r13,%rdi
mov    0xc(%rsp),%ebp
mov    %ebp,%esi
mov    %r12d,%edx
call   10b0 <bucketSort@plt>
lea    0x38(%rsp),%rdi
xor    %esi,%esi
call   1070 <gettimeofday@plt>
mov    0x38(%rsp),%rax
mov    0x40(%rsp),%rcx
sub    0x48(%rsp),%rax
sub    0x50(%rsp),%rcx
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %rcx,%xmm1
divsd  0xc30(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x28(%rsp)
movapd %xmm1,%xmm0
mov    0x30(%rsp),%rbx
cmp    $0x1,%ebx
mov    0x20(%rsp),%r12
je     13f3 <main+0x223>
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
mov    0x18(%r12),%rdi
call   10d0 <atoi@plt>
xorps  %xmm3,%xmm3
cvtsi2sd %ebx,%xmm3
movsd  0xbf6(%rip),%xmm1
test   %eax,%eax
je     1270 <main+0xa0>
movapd %xmm3,%xmm1
jmp    1270 <main+0xa0>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%r12),%rsi
lea    0xbe1(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
@.str = [66 x i8] c"Usage: %s [how-much] [max-threads] [0|1 (meaning normal|scaled)]\0A\00"
@.str.1 = [13 x i8] c"/dev/urandom\00"
@.str.2 = [2 x i8] c"r\00"
@INT_MAX = global double 0.000000e+00
@.str.3 = [23 x i8] c"%d %d %lf %lf %lf %lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca i32
%11 = alloca i32*
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca i32
%17 = alloca i32
%18 = alloca %struct.timeval
%19 = alloca %struct.timeval
%20 = alloca i64
%21 = alloca i64
%22 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%23 = load i32, i32* %4
%24 = icmp ne i32 %23, 4
br i1 %24, label %25, label %31
25: ; preds = %2
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 0
%28 = load i8*, i8** %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i8* %28)
%30 = call i32 @exit(i32 -1)
unreachable
31: ; preds = %2
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i32 @atoi(i8* %34)
store i32 %35, i32* %6
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i32 @atoi(i8* %38)
store i32 %39, i32* %7
%40 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %40, i32** %11
%41 = load i32*, i32** %11
%42 = call i32 @fread(i32* %10, i32 4, i32 1, i32* %41)
%43 = load i32*, i32** %11
%44 = call i32 @fclose(i32* %43)
%45 = load i32, i32* %10
%46 = call i32 @srand(i32 %45)
store i32 1, i32* %16
br label %47
47: ; preds = %163, %31
%48 = load i32, i32* %16
%49 = load i32, i32* %7
%50 = icmp sle i32 %48, %49
br i1 %50, label %51, label %166
51: ; preds = %47
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 3
%54 = load i8*, i8** %53
%55 = call i32 @atoi(i8* %54)
%56 = icmp eq i32 %55, 1
br i1 %56, label %57, label %64
57: ; preds = %51
%58 = load i8**, i8*** %5
%59 = getelementptr inbounds i8*, i8** %58, i64 1
%60 = load i8*, i8** %59
%61 = call i32 @atoi(i8* %60)
%62 = load i32, i32* %16
%63 = mul nsw i32 %61, %62
store i32 %63, i32* %6
br label %64
64: ; preds = %57, %51
%65 = load i32, i32* %6
%66 = sdiv i32 %65, 1000
%67 = add nsw i32 %66, 1
store i32 %67, i32* %8
%68 = load i32, i32* %6
%69 = sext i32 %68 to i64
%70 = mul i64 8, %69
%71 = trunc i64 %70 to i32
%72 = call double* @malloc(i32 %71)
store double* %72, double** %9
%73 = load i32, i32* %16
%74 = call i32 @omp_set_num_threads(i32 %73)
store i32 0, i32* %17
br label %75
75: ; preds = %88, %64
%76 = load i32, i32* %17
%77 = load i32, i32* %6
%78 = icmp slt i32 %76, %77
br i1 %78, label %79, label %91
79: ; preds = %75
%80 = call double (...) @rand()
%81 = fadd double %80, 0.000000e+00
%82 = load double, double* @INT_MAX
%83 = fdiv double %81, %82
%84 = load double*, double** %9
%85 = load i32, i32* %17
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %84, i64 %86
store double %83, double* %87
br label %88
88: ; preds = %79
%89 = load i32, i32* %17
%90 = add nsw i32 %89, 1
store i32 %90, i32* %17
br label %75
91: ; preds = %75
%92 = call i32 @gettimeofday(%struct.timeval* %18, i32* null)
%93 = load double*, double** %9
%94 = load i32, i32* %6
%95 = load i32, i32* %8
%96 = call i32 @bucketSort(double* %93, i32 %94, i32 %95)
%97 = call i32 @gettimeofday(%struct.timeval* %19, i32* null)
%98 = getelementptr inbounds %struct.timeval, %struct.timeval* %19, i32 0, i32 0
%99 = load i64, i64* %98
%100 = getelementptr inbounds %struct.timeval, %struct.timeval* %18, i32 0, i32 0
%101 = load i64, i64* %100
%102 = sub nsw i64 %99, %101
store i64 %102, i64* %20
%103 = getelementptr inbounds %struct.timeval, %struct.timeval* %19, i32 0, i32 1
%104 = load i64, i64* %103
%105 = getelementptr inbounds %struct.timeval, %struct.timeval* %18, i32 0, i32 1
%106 = load i64, i64* %105
%107 = sub nsw i64 %104, %106
store i64 %107, i64* %21
%108 = load i64, i64* %20
%109 = sitofp i64 %108 to double
%110 = fadd double %109, 0.000000e+00
store double %110, double* %22
%111 = load i64, i64* %21
%112 = sitofp i64 %111 to double
%113 = fadd double %112, 0.000000e+00
%114 = fdiv double %113, 1.000000e+06
%115 = load double, double* %22
%116 = fadd double %115, %114
store double %116, double* %22
%117 = load i32, i32* %16
%118 = icmp eq i32 %117, 1
br i1 %118, label %119, label %121
119: ; preds = %91
%120 = load double, double* %22
store double %120, double* %12
br label %121
121: ; preds = %119, %91
%122 = load i8**, i8*** %5
%123 = getelementptr inbounds i8*, i8** %122, i64 3
%124 = load i8*, i8** %123
%125 = call i32 @atoi(i8* %124)
%126 = icmp eq i32 %125, 0
br i1 %126, label %127, label %131
127: ; preds = %121
%128 = load double, double* %12
%129 = load double, double* %22
%130 = fdiv double %128, %129
store double %130, double* %13
br label %138
131: ; preds = %121
%132 = load i32, i32* %16
%133 = sitofp i32 %132 to double
%134 = load double, double* %12
%135 = fmul double %133, %134
%136 = load double, double* %22
%137 = fdiv double %135, %136
store double %137, double* %13
br label %138
138: ; preds = %131, %127
%139 = load double, double* %13
%140 = load i32, i32* %16
%141 = sitofp i32 %140 to double
%142 = fdiv double %139, %141
store double %142, double* %14
%143 = load double, double* %13
%144 = fdiv double 1.000000e+00, %143
%145 = load i32, i32* %16
%146 = sitofp i32 %145 to double
%147 = fdiv double 1.000000e+00, %146
%148 = fsub double %144, %147
%149 = load i32, i32* %16
%150 = sitofp i32 %149 to double
%151 = fdiv double 1.000000e+00, %150
%152 = fsub double 1.000000e+00, %151
%153 = fdiv double %148, %152
store double %153, double* %15
%154 = load i32, i32* %6
%155 = load i32, i32* %16
%156 = load double, double* %22
%157 = load double, double* %13
%158 = load double, double* %14
%159 = load double, double* %15
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %154, i32 %155, double %156, double %157, double %158, double %159)
%161 = load double*, double** %9
%162 = call i32 @free(double* %161)
br label %163
163: ; preds = %138
%164 = load i32, i32* %16
%165 = add nsw i32 %164, 1
store i32 %165, i32* %16
br label %47
166: ; preds = %47
%167 = load i32, i32* %3
ret i32 %167
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
@.str = [66 x i8] c"Usage: %s [how-much] [max-threads] [0|1 (meaning normal|scaled)]\0A\00"
@.str.1 = [13 x i8] c"/dev/urandom\00"
@.str.2 = [2 x i8] c"r\00"
@INT_MAX = global double 0.000000e+00
@.str.3 = [23 x i8] c"%d %d %lf %lf %lf %lf\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.timeval
%5 = alloca %struct.timeval
%6 = icmp eq i32 %0, 4
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = load i8*, i8** %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 -1)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = bitcast i32* %3 to i8*
%19 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 @fread(i32* %3, i32 4, i32 1, i32* %19)
%21 = tail call i32 @fclose(i32* %19)
%22 = load i32, i32* %3
%23 = tail call i32 @srand(i32 %22)
%24 = icmp slt i32 %17, 1
br i1 %24, label %33, label %25
25: ; preds = %11
%26 = getelementptr inbounds i8*, i8** %1, i64 3
%27 = bitcast %struct.timeval* %4 to i8*
%28 = bitcast %struct.timeval* %5 to i8*
%29 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 0
%30 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%31 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 1
%32 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
br label %34
33: ; preds = %64, %11
ret i32 0
34: ; preds = %25, %64
%35 = phi i32 [ %14, %25 ], [ %46, %64 ]
%36 = phi double [ undef, %25 ], [ %79, %64 ]
%37 = phi i32 [ 1, %25 ], [ %98, %64 ]
%38 = load i8*, i8** %26
%39 = tail call i32 @atoi(i8* %38)
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %45
41: ; preds = %34
%42 = load i8*, i8** %12
%43 = tail call i32 @atoi(i8* %42)
%44 = mul nsw i32 %43, %37
br label %45
45: ; preds = %41, %34
%46 = phi i32 [ %44, %41 ], [ %35, %34 ]
%47 = sdiv i32 %46, 1000
%48 = add nsw i32 %47, 1
%49 = shl i32 %46, 3
%50 = tail call double* @malloc(i32 %49)
%51 = tail call i32 @omp_set_num_threads(i32 %37)
%52 = icmp sgt i32 %46, 0
br i1 %52, label %53, label %64
53: ; preds = %45
%54 = zext i32 %46 to i64
br label %55
55: ; preds = %53, %55
%56 = phi i64 [ 0, %53 ], [ %62, %55 ]
%57 = tail call double (...) @rand()
%58 = fadd double %57, 0.000000e+00
%59 = load double, double* @INT_MAX
%60 = fdiv double %58, %59
%61 = getelementptr inbounds double, double* %50, i64 %56
store double %60, double* %61
%62 = add nuw nsw i64 %56, 1
%63 = icmp eq i64 %62, %54
br i1 %63, label %64, label %55
64: ; preds = %55, %45
%65 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%66 = tail call i32 @bucketSort(double* %50, i32 %46, i32 %48)
%67 = call i32 @gettimeofday(%struct.timeval* %5, i32* null)
%68 = load i64, i64* %29
%69 = load i64, i64* %30
%70 = sub nsw i64 %68, %69
%71 = load i64, i64* %31
%72 = load i64, i64* %32
%73 = sub nsw i64 %71, %72
%74 = sitofp i64 %70 to double
%75 = sitofp i64 %73 to double
%76 = fdiv double %75, 1.000000e+06
%77 = fadd double %76, %74
%78 = icmp eq i32 %37, 1
%79 = select i1 %78, double %77, double %36
%80 = load i8*, i8** %26
%81 = tail call i32 @atoi(i8* %80)
%82 = icmp eq i32 %81, 0
%83 = sitofp i32 %37 to double
%84 = select i1 %82, double 1.000000e+00, double %83
%85 = fmul double %84, %79
%86 = fdiv double %85, %77
%87 = fdiv double %86, %83
%88 = insertelement <2 x double> poison, double %86, i64 0
%89 = insertelement <2 x double> %88, double %83, i64 1
%90 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %89
%91 = extractelement <2 x double> %90, i64 0
%92 = extractelement <2 x double> %90, i64 1
%93 = fsub double %91, %92
%94 = fsub double 1.000000e+00, %92
%95 = fdiv double %93, %94
%96 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %46, i32 %37, double %77, double %86, double %87, double %95)
%97 = tail call i32 @free(double* %50)
%98 = add nuw i32 %37, 1
%99 = icmp eq i32 %37, %17
br i1 %99, label %33, label %34
}