#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 */
float atof(char *);
float *build_comov_r(float *, int, float, float, float);
float *build_z(float, float, int);
int /*<<< orphan*/ dump_mock_file(char *, float *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
float get_B_from_A(float *, float *, int, float);
float *load_mock_file(char *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  int n_points;
  float *r;
  float *z;
  int i;
  float omega_m, omega_l, w;
  float a_exp;
  int RSD;
  int n_list = 200000;
  float min_z = 0.0, max_z = 5.0;
  float *z_list, *r_list;
  if (argc != 6) {
    fprintf(stderr, "USAGE: %s\n",
            "./z2r z_file omega_m omega_l w r_recovered_file");
    exit(1);
  }
  z = load_mock_file(argv[1], &n_points);
  omega_m = atof(argv[2]);
  omega_l = atof(argv[3]);
  w = atof(argv[4]);
  fprintf(stdout, "omega_m=%.2f omega_l=%.2f w=%.2f\n", omega_m, omega_l, w);
  z = load_mock_file(argv[1], &n_points);
  z_list = build_z(min_z, max_z, n_list);
  r_list = build_comov_r(z_list, n_list, omega_m, omega_l, w);
  r = load_mock_file(argv[1], &n_points);
  for (i = 0; i < n_points; i++) {
    r[i] = get_B_from_A(z_list, r_list, n_list, z[i]);
  }
  dump_mock_file(argv[5], r, n_points);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x30d40,-0x44(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x48(%rbp)
movss  0xe53(%rip),%xmm0
movss  %xmm0,-0x4c(%rbp)
cmpl   $0x6,-0x8(%rbp)
je     11e4 <main+0x64>
mov    0x2e1d(%rip),%rax
mov    (%rax),%edi
lea    0xe38(%rip),%rsi
lea    0xe3c(%rip),%rdx
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <load_mock_file@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atof@plt>
movss  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <atof@plt>
movss  %xmm0,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1040 <atof@plt>
movss  %xmm0,-0x38(%rbp)
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
movss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x34(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x38(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xde5(%rip),%rsi
mov    $0x3,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <load_mock_file@plt>
mov    %rax,-0x28(%rbp)
movss  -0x48(%rbp),%xmm0
movss  -0x4c(%rbp),%xmm1
mov    -0x44(%rbp),%edi
call   1050 <build_z@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x44(%rbp),%esi
movss  -0x30(%rbp),%xmm0
movss  -0x34(%rbp),%xmm1
movss  -0x38(%rbp),%xmm2
call   1090 <build_comov_r@plt>
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <load_mock_file@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    130b <main+0x18b>
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0x44(%rbp),%edx
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1030 <get_B_from_A@plt>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12c7 <main+0x147>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1080 <dump_mock_file@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x6,%edi
jne    12b6 <main+0x136>
mov    %rsi,%r15
mov    0x8(%rsi),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <load_mock_file@plt>
mov    0x10(%r15),%rdi
call   1040 <atof@plt>
movss  %xmm0,0xc(%rsp)
mov    0x18(%r15),%rdi
call   1040 <atof@plt>
movss  %xmm0,0x8(%rsp)
mov    0x20(%r15),%rdi
call   1040 <atof@plt>
movaps %xmm0,%xmm2
movss  %xmm0,0x14(%rsp)
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x8(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm2,%xmm2
lea    0xe3c(%rip),%rsi
mov    $0x3,%al
call   1070 <fprintf@plt>
mov    0x8(%r15),%rdi
mov    %rbx,%rsi
call   1060 <load_mock_file@plt>
mov    %rax,%r12
movss  0xddf(%rip),%xmm1
xorps  %xmm0,%xmm0
mov    $0x30d40,%edi
call   1050 <build_z@plt>
mov    %rax,%r13
mov    %rax,%rdi
mov    $0x30d40,%esi
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
movss  0x14(%rsp),%xmm2
call   1090 <build_comov_r@plt>
mov    %rax,%r14
mov    0x8(%r15),%rdi
mov    %rbx,%rsi
call   1060 <load_mock_file@plt>
mov    %rax,%rbx
mov    0x10(%rsp),%edx
test   %edx,%edx
jle    1299 <main+0x119>
xor    %ebp,%ebp
nopl   0x0(%rax)
movss  (%r12,%rbp,4),%xmm0
mov    %r13,%rdi
mov    %r14,%rsi
mov    $0x30d40,%edx
call   1030 <get_B_from_A@plt>
movss  %xmm0,(%rbx,%rbp,4)
add    $0x1,%rbp
movslq 0x10(%rsp),%rdx
cmp    %rdx,%rbp
jl     1270 <main+0xf0>
mov    0x28(%r15),%rdi
mov    %rbx,%rsi
call   1080 <dump_mock_file@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d23(%rip),%rax
mov    (%rax),%edi
lea    0xd3e(%rip),%rsi
lea    0xd42(%rip),%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"USAGE: %s\0A\00"
@.str.1 = [48 x i8] c"./z2r z_file omega_m omega_l w r_recovered_file\00"
@stdout = global i32 0
@.str.2 = [34 x i8] c"omega_m=%.2f omega_l=%.2f w=%.2f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca float*
%8 = alloca float*
%9 = alloca i32
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca i32
%15 = alloca i32
%16 = alloca float
%17 = alloca float
%18 = alloca float*
%19 = alloca float*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 200000, i32* %15
store float 0.000000e+00, float* %16
store float 5.000000e+00, float* %17
%20 = load i32, i32* %4
%21 = icmp ne i32 %20, 6
br i1 %21, label %22, label %26
22: ; preds = %2
%23 = load i32, i32* @stderr
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %2
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call float* @load_mock_file(i8* %29, i32* %6)
store float* %30, float** %8
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
%34 = call float @atof(i8* %33)
store float %34, float* %10
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 3
%37 = load i8*, i8** %36
%38 = call float @atof(i8* %37)
store float %38, float* %11
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 4
%41 = load i8*, i8** %40
%42 = call float @atof(i8* %41)
store float %42, float* %12
%43 = load i32, i32* @stdout
%44 = load float, float* %10
%45 = fpext float %44 to double
%46 = load float, float* %11
%47 = fpext float %46 to double
%48 = load float, float* %12
%49 = fpext float %48 to double
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double %45, double %47, double %49)
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 1
%53 = load i8*, i8** %52
%54 = call float* @load_mock_file(i8* %53, i32* %6)
store float* %54, float** %8
%55 = load float, float* %16
%56 = load float, float* %17
%57 = load i32, i32* %15
%58 = call float* @build_z(float %55, float %56, i32 %57)
store float* %58, float** %18
%59 = load float*, float** %18
%60 = load i32, i32* %15
%61 = load float, float* %10
%62 = load float, float* %11
%63 = load float, float* %12
%64 = call float* @build_comov_r(float* %59, i32 %60, float %61, float %62, float %63)
store float* %64, float** %19
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 1
%67 = load i8*, i8** %66
%68 = call float* @load_mock_file(i8* %67, i32* %6)
store float* %68, float** %7
store i32 0, i32* %9
br label %69
69: ; preds = %87, %26
%70 = load i32, i32* %9
%71 = load i32, i32* %6
%72 = icmp slt i32 %70, %71
br i1 %72, label %73, label %90
73: ; preds = %69
%74 = load float*, float** %18
%75 = load float*, float** %19
%76 = load i32, i32* %15
%77 = load float*, float** %8
%78 = load i32, i32* %9
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds float, float* %77, i64 %79
%81 = load float, float* %80
%82 = call float @get_B_from_A(float* %74, float* %75, i32 %76, float %81)
%83 = load float*, float** %7
%84 = load i32, i32* %9
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds float, float* %83, i64 %85
store float %82, float* %86
br label %87
87: ; preds = %73
%88 = load i32, i32* %9
%89 = add nsw i32 %88, 1
store i32 %89, i32* %9
br label %69
90: ; preds = %69
%91 = load i8**, i8*** %5
%92 = getelementptr inbounds i8*, i8** %91, i64 5
%93 = load i8*, i8** %92
%94 = load float*, float** %7
%95 = load i32, i32* %6
%96 = call i32 @dump_mock_file(i8* %93, float* %94, i32 %95)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"USAGE: %s\0A\00"
@.str.1 = [48 x i8] c"./z2r z_file omega_m omega_l w r_recovered_file\00"
@stdout = global i32 0
@.str.2 = [34 x i8] c"omega_m=%.2f omega_l=%.2f w=%.2f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp eq i32 %0, 6
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 ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([48 x i8], [48 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 @atof(i8* %15)
%17 = getelementptr inbounds i8*, i8** %1, i64 3
%18 = load i8*, i8** %17
%19 = call float @atof(i8* %18)
%20 = getelementptr inbounds i8*, i8** %1, i64 4
%21 = load i8*, i8** %20
%22 = call float @atof(i8* %21)
%23 = load i32, i32* @stdout
%24 = fpext float %16 to double
%25 = fpext float %19 to double
%26 = fpext float %22 to double
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double %24, double %25, double %26)
%28 = load i8*, i8** %11
%29 = call float* @load_mock_file(i8* %28, i32* %3)
%30 = call float* @build_z(float 0.000000e+00, float 5.000000e+00, i32 200000)
%31 = call float* @build_comov_r(float* %30, i32 200000, float %16, float %19, float %22)
%32 = load i8*, i8** %11
%33 = call float* @load_mock_file(i8* %32, i32* %3)
%34 = load i32, i32* %3
%35 = icmp sgt i32 %34, 0
br i1 %35, label %36, label %46
36: ; preds = %10, %36
%37 = phi i64 [ %42, %36 ], [ 0, %10 ]
%38 = getelementptr inbounds float, float* %29, i64 %37
%39 = load float, float* %38
%40 = call float @get_B_from_A(float* %30, float* %31, i32 200000, float %39)
%41 = getelementptr inbounds float, float* %33, i64 %37
store float %40, float* %41
%42 = add nuw nsw i64 %37, 1
%43 = load i32, i32* %3
%44 = sext i32 %43 to i64
%45 = icmp slt i64 %42, %44
br i1 %45, label %36, label %46
46: ; preds = %36, %10
%47 = phi i32 [ %34, %10 ], [ %43, %36 ]
%48 = getelementptr inbounds i8*, i8** %1, i64 5
%49 = load i8*, i8** %48
%50 = call i32 @dump_mock_file(i8* %49, float* %33, i32 %47)
ret i32 0
}