#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 timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
double elapsed_time_hr(struct timespec, struct timespec, char *);
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(unsigned int);
int /*<<< orphan*/ printf(char *, ...);
unsigned int rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int mem_read_random(unsigned int size) {
  int i, n;
  unsigned int t;
  double oh, rt;
  unsigned int nbytes = size * 1048576;
  unsigned int nelements = nbytes / sizeof(int);
  struct timespec start, end;
  t = (int)time(NULL);
  int data = rand();
  int receive = 0;
  int *array = (int *)malloc(nbytes);
  if (array == NULL) {
    printf("Out Of Memory: could not allocate space for the array.\n");
    return 0;
  }
  for (i = 0; i < nelements; i++) {
    array[i] = data;
  }
  srand(t);
  clock_gettime(CLOCK_MONOTONIC, &start);
  for (i = 0; i < nelements; i++) {
    n = rand() % (nelements);
  }
  clock_gettime(CLOCK_MONOTONIC, &end);
  oh = elapsed_time_hr(start, end, "Read random");
  printf("Make sure the result is kept: %d\n", n);
  srand(t);
  clock_gettime(CLOCK_MONOTONIC, &start);
  for (i = 0; i < nelements; i++) {
    n = rand() % (nelements);
    receive = array[n];
  }
  clock_gettime(CLOCK_MONOTONIC, &end);
  rt = elapsed_time_hr(start, end, "Read random");
  printf("Make sure the result is kept: %d\n", receive);
  printf("Runtime: %f\n", (rt - oh));
  printf("Finished reading %d MB of memory (%d ints) in a random manner.\n\n",
         size, nelements);
  free(array);
  return 0;
}


x86 assembly (clang, -O0):
<mem_read_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x14,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
shr    $0x2,%rax
mov    %eax,-0x30(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   10a0 <rand@plt>
mov    %eax,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x2c(%rbp),%edi
call   1090 <malloc@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    11ec <mem_read_random+0x6c>
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    136d <mem_read_random+0x1ed>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x30(%rbp),%eax
jae    121b <mem_read_random+0x9b>
mov    -0x44(%rbp),%edx
mov    -0x50(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11f3 <mem_read_random+0x73>
mov    -0x14(%rbp),%edi
call   1070 <srand@plt>
mov    0x2dbe(%rip),%rax
mov    (%rax),%edi
lea    -0x38(%rbp),%rsi
call   1050 <clock_gettime@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x30(%rbp),%eax
jae    1265 <mem_read_random+0xe5>
mov    $0x0,%al
call   10a0 <rand@plt>
xor    %edx,%edx
divl   -0x30(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    123c <mem_read_random+0xbc>
mov    0x2d7c(%rip),%rax
mov    (%rax),%edi
lea    -0x40(%rbp),%rsi
call   1050 <clock_gettime@plt>
mov    -0x38(%rbp),%edi
mov    -0x40(%rbp),%esi
lea    0xdb4(%rip),%rdx
call   1030 <elapsed_time_hr@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%esi
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
call   1070 <srand@plt>
mov    0x2d3a(%rip),%rax
mov    (%rax),%edi
lea    -0x38(%rbp),%rsi
call   1050 <clock_gettime@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x30(%rbp),%eax
jae    12f7 <mem_read_random+0x177>
mov    $0x0,%al
call   10a0 <rand@plt>
xor    %edx,%edx
divl   -0x30(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x50(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x48(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12c0 <mem_read_random+0x140>
mov    0x2cea(%rip),%rax
mov    (%rax),%edi
lea    -0x40(%rbp),%rsi
call   1050 <clock_gettime@plt>
mov    -0x38(%rbp),%edi
mov    -0x40(%rbp),%esi
lea    0xd22(%rip),%rdx
call   1030 <elapsed_time_hr@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x48(%rbp),%esi
lea    0xd1a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
lea    0xd24(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x30(%rbp),%edx
lea    0xd1d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x50(%rbp),%rdi
call   1040 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_read_random>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edi,%r14d
mov    %edi,%r13d
shl    $0x14,%r13d
xor    %edi,%edi
call   1090 <time@plt>
mov    %rax,%r12
xor    %eax,%eax
call   10b0 <rand@plt>
mov    %eax,%ebp
mov    %r13d,%edi
call   10a0 <malloc@plt>
test   %rax,%rax
je     11f5 <mem_read_random+0x65>
mov    %rax,%rbx
mov    %r13d,%r15d
shr    $0x2,%r15d
test   %r13d,%r13d
mov    %r14d,0x1c(%rsp)
je     1206 <mem_read_random+0x76>
cmp    $0x2,%r15d
mov    $0x1,%eax
cmovae %r15d,%eax
cmp    $0x8,%eax
jae    1224 <mem_read_random+0x94>
xor    %ecx,%ecx
jmp    12d0 <mem_read_random+0x140>
lea    0xe80(%rip),%rdi
call   1050 <puts@plt>
jmp    1421 <mem_read_random+0x291>
mov    %r12d,%edi
call   1080 <srand@plt>
mov    0x2dd3(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1060 <clock_gettime@plt>
jmp    1327 <mem_read_random+0x197>
mov    %eax,%ecx
and    $0x3ffc0000,%ecx
movd   %ebp,%xmm0
pshufd $0x0,%xmm0,%xmm0
lea    -0x8(%rcx),%rdx
shr    $0x3,%rdx
mov    %rbx,%rsi
add    $0xf0,%rsi
add    $0x1,%rdx
nopl   0x0(%rax,%rax,1)
movdqu %xmm0,-0xf0(%rsi)
ff
movdqu %xmm0,-0xe0(%rsi)
ff
movdqu %xmm0,-0xd0(%rsi)
ff
movdqu %xmm0,-0xc0(%rsi)
ff
movdqu %xmm0,-0xb0(%rsi)
ff
movdqu %xmm0,-0xa0(%rsi)
ff
movdqu %xmm0,-0x90(%rsi)
ff
movdqu %xmm0,-0x80(%rsi)
movdqu %xmm0,-0x70(%rsi)
movdqu %xmm0,-0x60(%rsi)
movdqu %xmm0,-0x50(%rsi)
movdqu %xmm0,-0x40(%rsi)
movdqu %xmm0,-0x30(%rsi)
movdqu %xmm0,-0x20(%rsi)
movdqu %xmm0,-0x10(%rsi)
movdqu %xmm0,(%rsi)
add    $0x100,%rsi
add    $0xfffffffffffffff8,%rdx
jne    1250 <mem_read_random+0xc0>
cmp    %rax,%rcx
je     12dc <mem_read_random+0x14c>
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,(%rbx,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    12d0 <mem_read_random+0x140>
mov    %r12d,%edi
call   1080 <srand@plt>
mov    0x2cfd(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1060 <clock_gettime@plt>
test   %r13d,%r13d
je     1327 <mem_read_random+0x197>
cmp    $0x2,%r15d
mov    $0x1,%ebp
cmovae %r15d,%ebp
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10b0 <rand@plt>
add    $0xffffffff,%ebp
jne    1310 <mem_read_random+0x180>
xor    %edx,%edx
div    %r15d
mov    %edx,0x10(%rsp)
jmp    1327 <mem_read_random+0x197>
mov    0x2cba(%rip),%r14
mov    (%r14),%edi
lea    0x8(%rsp),%rsi
call   1060 <clock_gettime@plt>
mov    (%rsp),%edi
mov    0x8(%rsp),%esi
lea    0xcb7(%rip),%rdx
call   1030 <elapsed_time_hr@plt>
movq   %xmm0,0x20(%rsp)
lea    0xcb1(%rip),%rdi
xor    %ebp,%ebp
mov    0x10(%rsp),%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r12d,%edi
mov    %r14,%r12
call   1080 <srand@plt>
mov    (%r14),%edi
mov    %rsp,%rsi
call   1060 <clock_gettime@plt>
test   %r13d,%r13d
mov    0x1c(%rsp),%r14d
je     13b4 <mem_read_random+0x224>
cmp    $0x2,%r15d
mov    $0x1,%ebp
cmovae %r15d,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   10b0 <rand@plt>
add    $0xffffffff,%ebp
jne    13a0 <mem_read_random+0x210>
xor    %edx,%edx
div    %r15d
mov    (%rbx,%rdx,4),%ebp
mov    (%r12),%edi
lea    0x8(%rsp),%rsi
call   1060 <clock_gettime@plt>
mov    (%rsp),%edi
mov    0x8(%rsp),%esi
lea    0xc30(%rip),%rdx
call   1030 <elapsed_time_hr@plt>
movq   %xmm0,0x10(%rsp)
lea    0xc2a(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
movsd  0x10(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
lea    0xc30(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
lea    0xc2f(%rip),%rdi
mov    %r14d,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1040 <free@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@.str = [56 x i8] c"Out Of Memory: could not allocate space for the array.\0A\00"
@CLOCK_MONOTONIC = global i32 0
@.str.1 = [12 x i8] c"Read random\00"
@.str.2 = [34 x i8] c"Make sure the result is kept: %d\0A\00"
@.str.3 = [13 x i8] c"Runtime: %f\0A\00"
@.str.4 = [65 x i8] c"Finished reading %d MB of memory (%d ints) in a random manner.\0A\0A\00"
define i32 @mem_read_random(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca %struct.timespec
%12 = alloca %struct.timespec
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32*
store i32 %0, i32* %3
%16 = load i32, i32* %3
%17 = mul i32 %16, 1048576
store i32 %17, i32* %9
%18 = load i32, i32* %9
%19 = zext i32 %18 to i64
%20 = udiv i64 %19, 4
%21 = trunc i64 %20 to i32
store i32 %21, i32* %10
%22 = call i64 @time(i32* null)
%23 = trunc i64 %22 to i32
store i32 %23, i32* %6
%24 = call i32 (...) @rand()
store i32 %24, i32* %13
store i32 0, i32* %14
%25 = load i32, i32* %9
%26 = call i64 @malloc(i32 %25)
%27 = inttoptr i64 %26 to i32*
store i32* %27, i32** %15
%28 = load i32*, i32** %15
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %32
30: ; preds = %1
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %111
32: ; preds = %1
store i32 0, i32* %4
br label %33
33: ; preds = %43, %32
%34 = load i32, i32* %4
%35 = load i32, i32* %10
%36 = icmp ult i32 %34, %35
br i1 %36, label %37, label %46
37: ; preds = %33
%38 = load i32, i32* %13
%39 = load i32*, i32** %15
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %39, i64 %41
store i32 %38, i32* %42
br label %43
43: ; preds = %37
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
store i32 %45, i32* %4
br label %33
46: ; preds = %33
%47 = load i32, i32* %6
%48 = call i32 @srand(i32 %47)
%49 = load i32, i32* @CLOCK_MONOTONIC
%50 = call i32 @clock_gettime(i32 %49, %struct.timespec* %11)
store i32 0, i32* %4
br label %51
51: ; preds = %59, %46
%52 = load i32, i32* %4
%53 = load i32, i32* %10
%54 = icmp ult i32 %52, %53
br i1 %54, label %55, label %62
55: ; preds = %51
%56 = call i32 (...) @rand()
%57 = load i32, i32* %10
%58 = urem i32 %56, %57
store i32 %58, i32* %5
br label %59
59: ; preds = %55
%60 = load i32, i32* %4
%61 = add nsw i32 %60, 1
store i32 %61, i32* %4
br label %51
62: ; preds = %51
%63 = load i32, i32* @CLOCK_MONOTONIC
%64 = call i32 @clock_gettime(i32 %63, %struct.timespec* %12)
%65 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i32 0, i32 0
%66 = load i32, i32* %65
%67 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i32 0, i32 0
%68 = load i32, i32* %67
%69 = call double @elapsed_time_hr(i32 %66, i32 %68, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
store double %69, double* %7
%70 = load i32, i32* %5
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %70)
%72 = load i32, i32* %6
%73 = call i32 @srand(i32 %72)
%74 = load i32, i32* @CLOCK_MONOTONIC
%75 = call i32 @clock_gettime(i32 %74, %struct.timespec* %11)
store i32 0, i32* %4
br label %76
76: ; preds = %89, %62
%77 = load i32, i32* %4
%78 = load i32, i32* %10
%79 = icmp ult i32 %77, %78
br i1 %79, label %80, label %92
80: ; preds = %76
%81 = call i32 (...) @rand()
%82 = load i32, i32* %10
%83 = urem i32 %81, %82
store i32 %83, i32* %5
%84 = load i32*, i32** %15
%85 = load i32, i32* %5
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i32, i32* %84, i64 %86
%88 = load i32, i32* %87
store i32 %88, i32* %14
br label %89
89: ; preds = %80
%90 = load i32, i32* %4
%91 = add nsw i32 %90, 1
store i32 %91, i32* %4
br label %76
92: ; preds = %76
%93 = load i32, i32* @CLOCK_MONOTONIC
%94 = call i32 @clock_gettime(i32 %93, %struct.timespec* %12)
%95 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i32 0, i32 0
%96 = load i32, i32* %95
%97 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i32 0, i32 0
%98 = load i32, i32* %97
%99 = call double @elapsed_time_hr(i32 %96, i32 %98, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
store double %99, double* %8
%100 = load i32, i32* %14
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %100)
%102 = load double, double* %8
%103 = load double, double* %7
%104 = fsub double %102, %103
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), double %104)
%106 = load i32, i32* %3
%107 = load i32, i32* %10
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.4, i64 0, i64 0), i32 %106, i32 %107)
%109 = load i32*, i32** %15
%110 = call i32 @free(i32* %109)
store i32 0, i32* %2
br label %111
111: ; preds = %92, %30
%112 = load i32, i32* %2
ret i32 %112
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_MONOTONIC = global i32 0
@.str.1 = [12 x i8] c"Read random\00"
@.str.2 = [34 x i8] c"Make sure the result is kept: %d\0A\00"
@.str.3 = [13 x i8] c"Runtime: %f\0A\00"
@.str.4 = [65 x i8] c"Finished reading %d MB of memory (%d ints) in a random manner.\0A\0A\00"
@str = [55 x i8] c"Out Of Memory: could not allocate space for the array.\00"
define i32 @mem_read_random(i32 %0) {
%2 = alloca %struct.timespec
%3 = alloca %struct.timespec
%4 = shl i32 %0, 20
%5 = lshr exact i32 %4, 2
%6 = bitcast %struct.timespec* %2 to i8*
%7 = bitcast %struct.timespec* %3 to i8*
%8 = tail call i64 @time(i32* null)
%9 = trunc i64 %8 to i32
%10 = tail call i32 (...) @rand()
%11 = tail call i64 @malloc(i32 %4)
%12 = inttoptr i64 %11 to i32*
%13 = icmp eq i64 %11, 0
br i1 %13, label %78, label %14
14: ; preds = %1
%15 = icmp eq i32 %4, 0
br i1 %15, label %98, label %16
16: ; preds = %14
%17 = call i32 @llvm.umax.i32(i32 %5, i32 1)
%18 = zext i32 %17 to i64
%19 = icmp ult i32 %17, 8
br i1 %19, label %76, label %20
20: ; preds = %16
%21 = and i64 %18, 1073479680
%22 = insertelement <4 x i32> poison, i32 %10, i64 0
%23 = shufflevector <4 x i32> %22, <4 x i32> poison, <4 x i32> zeroinitializer
%24 = insertelement <4 x i32> poison, i32 %10, i64 0
%25 = shufflevector <4 x i32> %24, <4 x i32> poison, <4 x i32> zeroinitializer
%26 = add nsw i64 %21, -8
%27 = lshr exact i64 %26, 3
br label %28
28: ; preds = %28, %20
%29 = phi i64 [ 0, %20 ], [ %70, %28 ]
%30 = phi i64 [ 0, %20 ], [ %71, %28 ]
%31 = getelementptr inbounds i32, i32* %12, i64 %29
%32 = bitcast i32* %31 to <4 x i32>*
store <4 x i32> %23, <4 x i32>* %32
%33 = getelementptr inbounds i32, i32* %31, i64 4
%34 = bitcast i32* %33 to <4 x i32>*
store <4 x i32> %25, <4 x i32>* %34
%35 = or i64 %29, 8
%36 = getelementptr inbounds i32, i32* %12, i64 %35
%37 = bitcast i32* %36 to <4 x i32>*
store <4 x i32> %23, <4 x i32>* %37
%38 = getelementptr inbounds i32, i32* %36, i64 4
%39 = bitcast i32* %38 to <4 x i32>*
store <4 x i32> %25, <4 x i32>* %39
%40 = or i64 %29, 16
%41 = getelementptr inbounds i32, i32* %12, i64 %40
%42 = bitcast i32* %41 to <4 x i32>*
store <4 x i32> %23, <4 x i32>* %42
%43 = getelementptr inbounds i32, i32* %41, i64 4
%44 = bitcast i32* %43 to <4 x i32>*
store <4 x i32> %25, <4 x i32>* %44
%45 = or i64 %29, 24
%46 = getelementptr inbounds i32, i32* %12, i64 %45
%47 = bitcast i32* %46 to <4 x i32>*
store <4 x i32> %23, <4 x i32>* %47
%48 = getelementptr inbounds i32, i32* %46, i64 4
%49 = bitcast i32* %48 to <4 x i32>*
store <4 x i32> %25, <4 x i32>* %49
%50 = or i64 %29, 32
%51 = getelementptr inbounds i32, i32* %12, i64 %50
%52 = bitcast i32* %51 to <4 x i32>*
store <4 x i32> %23, <4 x i32>* %52
%53 = getelementptr inbounds i32, i32* %51, i64 4
%54 = bitcast i32* %53 to <4 x i32>*
store <4 x i32> %25, <4 x i32>* %54
%55 = or i64 %29, 40
%56 = getelementptr inbounds i32, i32* %12, i64 %55
%57 = bitcast i32* %56 to <4 x i32>*
store <4 x i32> %23, <4 x i32>* %57
%58 = getelementptr inbounds i32, i32* %56, i64 4
%59 = bitcast i32* %58 to <4 x i32>*
store <4 x i32> %25, <4 x i32>* %59
%60 = or i64 %29, 48
%61 = getelementptr inbounds i32, i32* %12, i64 %60
%62 = bitcast i32* %61 to <4 x i32>*
store <4 x i32> %23, <4 x i32>* %62
%63 = getelementptr inbounds i32, i32* %61, i64 4
%64 = bitcast i32* %63 to <4 x i32>*
store <4 x i32> %25, <4 x i32>* %64
%65 = or i64 %29, 56
%66 = getelementptr inbounds i32, i32* %12, i64 %65
%67 = bitcast i32* %66 to <4 x i32>*
store <4 x i32> %23, <4 x i32>* %67
%68 = getelementptr inbounds i32, i32* %66, i64 4
%69 = bitcast i32* %68 to <4 x i32>*
store <4 x i32> %25, <4 x i32>* %69
%70 = add nuw i64 %29, 64
%71 = add nuw i64 %30, 8
%72 = or i64 %30, 7
%73 = icmp eq i64 %72, %27
br i1 %73, label %74, label %28
74: ; preds = %28
%75 = icmp eq i64 %21, %18
br i1 %75, label %85, label %76
76: ; preds = %16, %74
%77 = phi i64 [ 0, %16 ], [ %21, %74 ]
br label %80
78: ; preds = %1
%79 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
br label %139
80: ; preds = %76, %80
%81 = phi i64 [ %83, %80 ], [ %77, %76 ]
%82 = getelementptr inbounds i32, i32* %12, i64 %81
store i32 %10, i32* %82
%83 = add nuw nsw i64 %81, 1
%84 = icmp eq i64 %83, %18
br i1 %84, label %85, label %80
85: ; preds = %80, %74
%86 = tail call i32 @srand(i32 %9)
%87 = load i32, i32* @CLOCK_MONOTONIC
%88 = call i32 @clock_gettime(i32 %87, %struct.timespec* %2)
br i1 %15, label %102, label %89
89: ; preds = %85
%90 = call i32 @llvm.umax.i32(i32 %5, i32 1)
br label %91
91: ; preds = %89, %91
%92 = phi i32 [ %94, %91 ], [ 0, %89 ]
%93 = call i32 (...) @rand()
%94 = add nuw nsw i32 %92, 1
%95 = icmp eq i32 %94, %90
br i1 %95, label %96, label %91
96: ; preds = %91
%97 = urem i32 %93, %5
br label %102
98: ; preds = %14
%99 = tail call i32 @srand(i32 %9)
%100 = load i32, i32* @CLOCK_MONOTONIC
%101 = call i32 @clock_gettime(i32 %100, %struct.timespec* %2)
br label %102
102: ; preds = %98, %96, %85
%103 = phi i32 [ %97, %96 ], [ undef, %85 ], [ undef, %98 ]
%104 = load i32, i32* @CLOCK_MONOTONIC
%105 = call i32 @clock_gettime(i32 %104, %struct.timespec* %3)
%106 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
%107 = load i32, i32* %106
%108 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 0
%109 = load i32, i32* %108
%110 = call double @elapsed_time_hr(i32 %107, i32 %109, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%111 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %103)
%112 = call i32 @srand(i32 %9)
%113 = load i32, i32* @CLOCK_MONOTONIC
%114 = call i32 @clock_gettime(i32 %113, %struct.timespec* %2)
br i1 %15, label %127, label %115
115: ; preds = %102
%116 = call i32 @llvm.umax.i32(i32 %5, i32 1)
br label %117
117: ; preds = %115, %117
%118 = phi i32 [ %120, %117 ], [ 0, %115 ]
%119 = call i32 (...) @rand()
%120 = add nuw nsw i32 %118, 1
%121 = icmp eq i32 %120, %116
br i1 %121, label %122, label %117
122: ; preds = %117
%123 = urem i32 %119, %5
%124 = zext i32 %123 to i64
%125 = getelementptr inbounds i32, i32* %12, i64 %124
%126 = load i32, i32* %125
br label %127
127: ; preds = %122, %102
%128 = phi i32 [ %126, %122 ], [ 0, %102 ]
%129 = load i32, i32* @CLOCK_MONOTONIC
%130 = call i32 @clock_gettime(i32 %129, %struct.timespec* %3)
%131 = load i32, i32* %106
%132 = load i32, i32* %108
%133 = call double @elapsed_time_hr(i32 %131, i32 %132, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%134 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %128)
%135 = fsub double %133, %110
%136 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), double %135)
%137 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.4, i64 0, i64 0), i32 %0, i32 %5)
%138 = call i32 @free(i32* %12)
br label %139
139: ; preds = %127, %78
ret i32 0
}