#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*/ dump_mock_file(char *, float *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
float *load_mock_file(char *, int *);
float *malloc(int);
scalar_t__ pow(float, int);
float sqrt(scalar_t__);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int n_points;
  int i;
  float *vr;
  float norm_r;
  float *x, *y, *z, *vx, *vy, *vz;
  if (argc != 8) {
    fprintf(stderr, "%s\n", "./rv.x xp yp zp vx vy vz vr_outfile");
    exit(1);
  }
  x = load_mock_file(argv[1], &n_points);
  y = load_mock_file(argv[2], &n_points);
  z = load_mock_file(argv[3], &n_points);
  vx = load_mock_file(argv[4], &n_points);
  vy = load_mock_file(argv[5], &n_points);
  vz = load_mock_file(argv[6], &n_points);
  if (!(vr = malloc(n_points * sizeof(float)))) {
    fprintf(stderr, "Problem in the allocation of the radial velocity array\n");
    exit(1);
  }
  for (i = 0; i < n_points; i++) {
    vr[i] = 0.0;
  }
  for (i = 0; i < n_points; i++) {
    norm_r = sqrt(pow(x[i], 2) + pow(y[i], 2) + pow(z[i], 2));
    vr[i] = (x[i] * vx[i] + y[i] * vy[i] + z[i] * vz[i]) / norm_r;
  }
  dump_mock_file(argv[7], vr, n_points);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x8,-0x8(%rbp)
je     11b8 <main+0x48>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
lea    0xe60(%rip),%rsi
lea    0xe5d(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <load_mock_file@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <load_mock_file@plt>
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <load_mock_file@plt>
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <load_mock_file@plt>
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <load_mock_file@plt>
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <load_mock_file@plt>
mov    %rax,-0x58(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1274 <main+0x104>
mov    0x2d86(%rip),%rax
mov    (%rax),%edi
lea    0xdc5(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12a5 <main+0x135>
mov    -0x20(%rbp),%rax
movslq -0x18(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    127b <main+0x10b>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    139e <main+0x22e>
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    $0x2,%edi
call   1070 <pow@plt>
mov    %rax,-0x68(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    $0x2,%edi
call   1070 <pow@plt>
mov    %rax,%rcx
mov    -0x68(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
mov    -0x40(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    $0x2,%edi
call   1070 <pow@plt>
mov    -0x60(%rbp),%rdi
add    %rax,%rdi
call   1080 <sqrt@plt>
movss  %xmm0,-0x24(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
mov    -0x48(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm2
mov    -0x38(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x50(%rbp),%rax
movslq -0x18(%rbp),%rcx
mulss  (%rax,%rcx,4),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x40(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
divss  -0x24(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12ac <main+0x13c>
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <dump_mock_file@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
cmp    $0x8,%edi
jne    1311 <main+0x191>
mov    %rsi,%r13
mov    0x8(%rsi),%rdi
lea    0xc(%rsp),%rbp
mov    %rbp,%rsi
call   1040 <load_mock_file@plt>
mov    %rax,%r15
mov    0x10(%r13),%rdi
mov    %rbp,%rsi
call   1040 <load_mock_file@plt>
mov    %rax,%r12
mov    0x18(%r13),%rdi
mov    %rbp,%rsi
call   1040 <load_mock_file@plt>
mov    %rax,%rbx
mov    0x20(%r13),%rdi
mov    %rbp,%rsi
call   1040 <load_mock_file@plt>
mov    %rax,0x30(%rsp)
mov    0x28(%r13),%rdi
mov    %rbp,%rsi
call   1040 <load_mock_file@plt>
mov    %rax,%r14
mov    0x30(%r13),%rdi
mov    %rbp,%rsi
call   1040 <load_mock_file@plt>
mov    %rax,0x20(%rsp)
mov    0xc(%rsp),%ebp
lea    0x0(,%rbp,4),%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     1339 <main+0x1b9>
test   %ebp,%ebp
jle    12f2 <main+0x172>
mov    %r13,0x18(%rsp)
shl    $0x2,%rbp
xor    %r13d,%r13d
mov    %rax,%rdi
xor    %esi,%esi
mov    %rbp,%rdx
mov    %rax,0x10(%rsp)
call   1030 <memset@plt>
mov    %r14,0x28(%rsp)
mov    0x20(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
movss  (%r15,%r13,4),%xmm0
mov    $0x2,%edi
call   1080 <pow@plt>
mov    %rax,%rbp
movss  (%r12,%r13,4),%xmm0
mov    $0x2,%edi
call   1080 <pow@plt>
add    %rax,%rbp
movss  (%rbx,%r13,4),%xmm0
mov    $0x2,%edi
call   1080 <pow@plt>
add    %rax,%rbp
mov    %rbp,%rdi
call   1090 <sqrt@plt>
movss  (%r15,%r13,4),%xmm1
movss  (%r12,%r13,4),%xmm2
mov    0x28(%rsp),%rax
mulss  (%rax,%r13,4),%xmm2
mov    0x30(%rsp),%rax
mulss  (%rax,%r13,4),%xmm1
addss  %xmm2,%xmm1
movss  (%rbx,%r13,4),%xmm2
mulss  (%r14,%r13,4),%xmm2
addss  %xmm1,%xmm2
divss  %xmm0,%xmm2
mov    0x10(%rsp),%rax
movss  %xmm2,(%rax,%r13,4)
add    $0x1,%r13
movslq 0xc(%rsp),%rbp
cmp    %rbp,%r13
jl     1250 <main+0xd0>
mov    0x18(%rsp),%r13
mov    0x10(%rsp),%rax
mov    0x38(%r13),%rdi
mov    %rax,%rsi
mov    %ebp,%edx
call   1060 <dump_mock_file@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cc8(%rip),%rax
mov    (%rax),%edi
lea    0xcdf(%rip),%rsi
lea    0xcdc(%rip),%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    0x2ca0(%rip),%rax
mov    (%rax),%edi
lea    0xcdf(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [36 x i8] c"./rv.x xp yp zp vx vy vz vr_outfile\00"
@.str.2 = [56 x i8] c"Problem in the allocation of the radial velocity array\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 float*
%9 = alloca float
%10 = alloca float*
%11 = alloca float*
%12 = alloca float*
%13 = alloca float*
%14 = alloca float*
%15 = alloca float*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 8
br i1 %17, label %18, label %22
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call float* @load_mock_file(i8* %25, i32* %6)
store float* %26, float** %10
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 2
%29 = load i8*, i8** %28
%30 = call float* @load_mock_file(i8* %29, i32* %6)
store float* %30, float** %11
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 3
%33 = load i8*, i8** %32
%34 = call float* @load_mock_file(i8* %33, i32* %6)
store float* %34, float** %12
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 4
%37 = load i8*, i8** %36
%38 = call float* @load_mock_file(i8* %37, i32* %6)
store float* %38, float** %13
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 5
%41 = load i8*, i8** %40
%42 = call float* @load_mock_file(i8* %41, i32* %6)
store float* %42, float** %14
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 6
%45 = load i8*, i8** %44
%46 = call float* @load_mock_file(i8* %45, i32* %6)
store float* %46, float** %15
%47 = load i32, i32* %6
%48 = sext i32 %47 to i64
%49 = mul i64 %48, 4
%50 = trunc i64 %49 to i32
%51 = call float* @malloc(i32 %50)
store float* %51, float** %8
%52 = icmp ne float* %51, null
br i1 %52, label %57, label %53
53: ; preds = %22
%54 = load i32, i32* @stderr
%55 = call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
%56 = call i32 @exit(i32 1)
unreachable
57: ; preds = %22
store i32 0, i32* %7
br label %58
58: ; preds = %67, %57
%59 = load i32, i32* %7
%60 = load i32, i32* %6
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %70
62: ; preds = %58
%63 = load float*, float** %8
%64 = load i32, i32* %7
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds float, float* %63, i64 %65
store float 0.000000e+00, float* %66
br label %67
67: ; preds = %62
%68 = load i32, i32* %7
%69 = add nsw i32 %68, 1
store i32 %69, i32* %7
br label %58
70: ; preds = %58
store i32 0, i32* %7
br label %71
71: ; preds = %136, %70
%72 = load i32, i32* %7
%73 = load i32, i32* %6
%74 = icmp slt i32 %72, %73
br i1 %74, label %75, label %139
75: ; preds = %71
%76 = load float*, float** %10
%77 = load i32, i32* %7
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds float, float* %76, i64 %78
%80 = load float, float* %79
%81 = call i64 @pow(float %80, i32 2)
%82 = load float*, float** %11
%83 = load i32, i32* %7
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds float, float* %82, i64 %84
%86 = load float, float* %85
%87 = call i64 @pow(float %86, i32 2)
%88 = add nsw i64 %81, %87
%89 = load float*, float** %12
%90 = load i32, i32* %7
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds float, float* %89, i64 %91
%93 = load float, float* %92
%94 = call i64 @pow(float %93, i32 2)
%95 = add nsw i64 %88, %94
%96 = call float @sqrt(i64 %95)
store float %96, float* %9
%97 = load float*, float** %10
%98 = load i32, i32* %7
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds float, float* %97, i64 %99
%101 = load float, float* %100
%102 = load float*, float** %13
%103 = load i32, i32* %7
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds float, float* %102, i64 %104
%106 = load float, float* %105
%107 = load float*, float** %11
%108 = load i32, i32* %7
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds float, float* %107, i64 %109
%111 = load float, float* %110
%112 = load float*, float** %14
%113 = load i32, i32* %7
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds float, float* %112, i64 %114
%116 = load float, float* %115
%117 = fmul float %111, %116
%118 = call float @llvm.fmuladd.f32(float %101, float %106, float %117)
%119 = load float*, float** %12
%120 = load i32, i32* %7
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds float, float* %119, i64 %121
%123 = load float, float* %122
%124 = load float*, float** %15
%125 = load i32, i32* %7
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds float, float* %124, i64 %126
%128 = load float, float* %127
%129 = call float @llvm.fmuladd.f32(float %123, float %128, float %118)
%130 = load float, float* %9
%131 = fdiv float %129, %130
%132 = load float*, float** %8
%133 = load i32, i32* %7
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds float, float* %132, i64 %134
store float %131, float* %135
br label %136
136: ; preds = %75
%137 = load i32, i32* %7
%138 = add nsw i32 %137, 1
store i32 %138, i32* %7
br label %71
139: ; preds = %71
%140 = load i8**, i8*** %5
%141 = getelementptr inbounds i8*, i8** %140, i64 7
%142 = load i8*, i8** %141
%143 = load float*, float** %8
%144 = load i32, i32* %6
%145 = call i32 @dump_mock_file(i8* %142, float* %143, i32 %144)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [36 x i8] c"./rv.x xp yp zp vx vy vz vr_outfile\00"
@.str.2 = [56 x i8] c"Problem in the allocation of the radial velocity array\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp eq i32 %0, 8
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call float* @load_mock_file(i8* %12, i32* %3)
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = call float* @load_mock_file(i8* %15, i32* %3)
%17 = getelementptr inbounds i8*, i8** %1, i64 3
%18 = load i8*, i8** %17
%19 = call float* @load_mock_file(i8* %18, i32* %3)
%20 = getelementptr inbounds i8*, i8** %1, i64 4
%21 = load i8*, i8** %20
%22 = call float* @load_mock_file(i8* %21, i32* %3)
%23 = getelementptr inbounds i8*, i8** %1, i64 5
%24 = load i8*, i8** %23
%25 = call float* @load_mock_file(i8* %24, i32* %3)
%26 = getelementptr inbounds i8*, i8** %1, i64 6
%27 = load i8*, i8** %26
%28 = call float* @load_mock_file(i8* %27, i32* %3)
%29 = load i32, i32* %3
%30 = shl i32 %29, 2
%31 = call float* @malloc(i32 %30)
%32 = bitcast float* %31 to i8*
%33 = icmp eq float* %31, null
br i1 %33, label %36, label %34
34: ; preds = %10
%35 = icmp sgt i32 %29, 0
br i1 %35, label %40, label %75
36: ; preds = %10
%37 = load i32, i32* @stderr
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %34
%41 = zext i32 %29 to i64
%42 = shl nuw nsw i64 %41, 2
br label %43
43: ; preds = %40, %43
%44 = phi i64 [ 0, %40 ], [ %71, %43 ]
%45 = getelementptr inbounds float, float* %13, i64 %44
%46 = load float, float* %45
%47 = call i64 @pow(float %46, i32 2)
%48 = getelementptr inbounds float, float* %16, i64 %44
%49 = load float, float* %48
%50 = call i64 @pow(float %49, i32 2)
%51 = add nsw i64 %50, %47
%52 = getelementptr inbounds float, float* %19, i64 %44
%53 = load float, float* %52
%54 = call i64 @pow(float %53, i32 2)
%55 = add nsw i64 %51, %54
%56 = call float @sqrt(i64 %55)
%57 = load float, float* %45
%58 = getelementptr inbounds float, float* %22, i64 %44
%59 = load float, float* %58
%60 = load float, float* %48
%61 = getelementptr inbounds float, float* %25, i64 %44
%62 = load float, float* %61
%63 = fmul float %60, %62
%64 = call float @llvm.fmuladd.f32(float %57, float %59, float %63)
%65 = load float, float* %52
%66 = getelementptr inbounds float, float* %28, i64 %44
%67 = load float, float* %66
%68 = call float @llvm.fmuladd.f32(float %65, float %67, float %64)
%69 = fdiv float %68, %56
%70 = getelementptr inbounds float, float* %31, i64 %44
store float %69, float* %70
%71 = add nuw nsw i64 %44, 1
%72 = load i32, i32* %3
%73 = sext i32 %72 to i64
%74 = icmp slt i64 %71, %73
br i1 %74, label %43, label %75
75: ; preds = %43, %34
%76 = phi i32 [ %29, %34 ], [ %72, %43 ]
%77 = getelementptr inbounds i8*, i8** %1, i64 7
%78 = load i8*, i8** %77
%79 = call i32 @dump_mock_file(i8* %78, float* %31, i32 %76)
ret i32 0
}