#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 */
int /*<<< orphan*/ compute0(double *, double *, double *, size_t, double *,
                            double *);
int /*<<< orphan*/ create0(double **, double **, double **, size_t);
int /*<<< orphan*/ destroy0(double *, double *, double *);
int /*<<< orphan*/ setvalues0(double *, double *, double *, size_t);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
void version0(size_t size, size_t nloops, double *x, double *time_spent) {
  srand(0);
  double *vx, *vy, *vz;
  create0(&vx, &vy, &vz, size);
  int iloop;
  for (iloop = 0; iloop < nloops; iloop++) {
    setvalues0(vx, vy, vz, size);
    compute0(vx, vy, vz, size, x, time_spent);
  }
  destroy0(vx, vy, vz);
}


x86 assembly (clang, -O0):
<version0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
xor    %edi,%edi
call   1040 <srand@plt>
mov    -0x8(%rbp),%rcx
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x38(%rbp),%rdx
call   1060 <create0@plt>
movl   $0x0,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11d9 <version0+0x89>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x8(%rbp),%rcx
call   1070 <setvalues0@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
call   1030 <compute0@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    118b <version0+0x3b>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   1050 <destroy0@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<version0>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r12
xor    %edi,%edi
call   1040 <srand@plt>
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
mov    %r12,%rcx
call   1060 <create0@plt>
test   %rbx,%rbx
je     11c8 <version0+0x78>
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
mov    (%rsp),%rdx
mov    %r12,%rcx
call   1070 <setvalues0@plt>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
mov    (%rsp),%rdx
mov    %r12,%rcx
mov    %r15,%r8
mov    %r14,%r9
call   1030 <compute0@plt>
add    $0xffffffffffffffff,%rbx
jne    1190 <version0+0x40>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
mov    (%rsp),%rdx
call   1050 <destroy0@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @version0(i64 %0, i64 %1, double* %2, double* %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca i32
store i64 %0, i64* %5
store i64 %1, i64* %6
store double* %2, double** %7
store double* %3, double** %8
%13 = call i32 @srand(i32 0)
%14 = load i64, i64* %5
%15 = call i32 @create0(double** %9, double** %10, double** %11, i64 %14)
store i32 0, i32* %12
br label %16
16: ; preds = %34, %4
%17 = load i32, i32* %12
%18 = sext i32 %17 to i64
%19 = load i64, i64* %6
%20 = icmp ult i64 %18, %19
br i1 %20, label %21, label %37
21: ; preds = %16
%22 = load double*, double** %9
%23 = load double*, double** %10
%24 = load double*, double** %11
%25 = load i64, i64* %5
%26 = call i32 @setvalues0(double* %22, double* %23, double* %24, i64 %25)
%27 = load double*, double** %9
%28 = load double*, double** %10
%29 = load double*, double** %11
%30 = load i64, i64* %5
%31 = load double*, double** %7
%32 = load double*, double** %8
%33 = call i32 @compute0(double* %27, double* %28, double* %29, i64 %30, double* %31, double* %32)
br label %34
34: ; preds = %21
%35 = load i32, i32* %12
%36 = add nsw i32 %35, 1
store i32 %36, i32* %12
br label %16
37: ; preds = %16
%38 = load double*, double** %9
%39 = load double*, double** %10
%40 = load double*, double** %11
%41 = call i32 @destroy0(double* %38, double* %39, double* %40)
ret void
}

LLVM IR (-O2):
define void @version0(i64 %0, i64 %1, double* %2, double* %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = tail call i32 @srand(i32 0)
%9 = bitcast double** %5 to i8*
%10 = bitcast double** %6 to i8*
%11 = bitcast double** %7 to i8*
%12 = call i32 @create0(double** %5, double** %6, double** %7, i64 %0)
%13 = icmp eq i64 %1, 0
br i1 %13, label %26, label %14
14: ; preds = %4, %14
%15 = phi i64 [ %24, %14 ], [ 0, %4 ]
%16 = load double*, double** %5
%17 = load double*, double** %6
%18 = load double*, double** %7
%19 = call i32 @setvalues0(double* %16, double* %17, double* %18, i64 %0)
%20 = load double*, double** %5
%21 = load double*, double** %6
%22 = load double*, double** %7
%23 = call i32 @compute0(double* %20, double* %21, double* %22, i64 %0, double* %2, double* %3)
%24 = add nuw i64 %15, 1
%25 = icmp eq i64 %24, %1
br i1 %25, label %26, label %14
26: ; preds = %14, %4
%27 = load double*, double** %5
%28 = load double*, double** %6
%29 = load double*, double** %7
%30 = call i32 @destroy0(double* %27, double* %28, double* %29)
ret void
}