#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
float *build_comov_r(float *, int, float, float, float);
float *build_z(float, float, int);
float drand48();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
float get_B_from_A(float *, float *, int, float);
int /*<<< orphan*/ sprintf(char *, char *, float, float, float);
int /*<<< orphan*/ srand48(int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int i;
  float omega_m = 0.3;
  float omega_l = 0.7;
  float w = -1.0;
  float *z;
  float *r_comov;
  float min_z = 0.0, max_z = 1.0;
  int n_points = 4000;
  FILE *out;
  char filename[256];
  int id;
  float rnd;
  float tmp;
  z = build_z(min_z, max_z, n_points);
  r_comov = build_comov_r(z, n_points, omega_m, omega_l, w);
  sprintf(filename, "table_z_comovr_%.2f_%.2f_%.2f.dat", omega_m, omega_l, w);
  if (!(out = fopen(filename, "w"))) {
    fprintf(stderr, "problem opening file filename %s\n", filename);
    exit(1);
  }
  for (i = 0; i < n_points; i++) {
    fprintf(out, "%f %f\n", z[i], r_comov[i]);
  }
  fclose(out);
  sprintf(filename, "random_table_findr_%.2f_%.2f_%.2f.dat", omega_m, omega_l,
          w);
  if (!(out = fopen(filename, "w"))) {
    fprintf(stderr, "problem opening file filename %s\n", filename);
    exit(1);
  }
  srand48(n_points);
  for (i = 0; i < n_points; i++) {
    rnd = drand48() * (z[n_points - 1] - z[0]) + z[0];
    tmp = get_B_from_A(z, r_comov, n_points, rnd);
    fprintf(out, "%f %f\n", rnd, tmp);
  }
  fclose(out);
  sprintf(filename, "random_table_findz_%.2f_%.2f_%.2f.dat", omega_m, omega_l,
          w);
  if (!(out = fopen(filename, "w"))) {
    fprintf(stderr, "problem opening file filename %s\n", filename);
    exit(1);
  }
  for (i = 0; i < n_points; i++) {
    rnd = drand48() * (r_comov[n_points - 1] - r_comov[0]) + r_comov[0];
    tmp = get_B_from_A(r_comov, z, n_points, rnd);
    fprintf(out, "%f %f\n", tmp, rnd);
  }
  fclose(out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  0xe4b(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xe3a(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xe29(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  0xe10(%rip),%xmm0
movss  %xmm0,-0x38(%rbp)
movl   $0xfa0,-0x3c(%rbp)
movss  -0x34(%rbp),%xmm0
movss  -0x38(%rbp),%xmm1
mov    -0x3c(%rbp),%edi
call   1050 <build_z@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x3c(%rbp),%esi
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
movss  -0x20(%rbp),%xmm2
call   1070 <build_comov_r@plt>
mov    %rax,-0x30(%rbp)
lea    -0x150(%rbp),%rdi
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
movss  -0x20(%rbp),%xmm2
lea    0xdc2(%rip),%rsi
call   10a0 <sprintf@plt>
lea    -0x150(%rbp),%rdi
lea    0xdd1(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    129d <main+0xfd>
mov    0x2d65(%rip),%rax
movslq (%rax),%rdi
lea    -0x150(%rbp),%rdx
lea    0xda8(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    12f2 <main+0x152>
mov    -0x48(%rbp),%rdi
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xd79(%rip),%rsi
mov    $0x2,%al
call   1060 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12a4 <main+0x104>
mov    -0x48(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x150(%rbp),%rdi
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
movss  -0x20(%rbp),%xmm2
lea    0xd45(%rip),%rsi
call   10a0 <sprintf@plt>
lea    -0x150(%rbp),%rdi
lea    0xd07(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    1367 <main+0x1c7>
mov    0x2c9b(%rip),%rax
movslq (%rax),%rdi
lea    -0x150(%rbp),%rdx
lea    0xcde(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x3c(%rbp),%edi
call   1080 <srand48@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1413 <main+0x273>
mov    $0x0,%al
call   10c0 <drand48@plt>
mov    -0x28(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm2
mov    -0x28(%rbp),%rax
subss  (%rax),%xmm2
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x158(%rbp)
ff
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x3c(%rbp),%edx
movss  -0x158(%rbp),%xmm0
ff
call   1030 <get_B_from_A@plt>
movss  %xmm0,-0x15c(%rbp)
ff
mov    -0x48(%rbp),%rdi
movss  -0x158(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x15c(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
lea    0xc58(%rip),%rsi
mov    $0x2,%al
call   1060 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1376 <main+0x1d6>
mov    -0x48(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x150(%rbp),%rdi
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
movss  -0x20(%rbp),%xmm2
lea    0xc4a(%rip),%rsi
call   10a0 <sprintf@plt>
lea    -0x150(%rbp),%rdi
lea    0xbe6(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    1488 <main+0x2e8>
mov    0x2b7a(%rip),%rax
movslq (%rax),%rdi
lea    -0x150(%rbp),%rdx
lea    0xbbd(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    152c <main+0x38c>
mov    $0x0,%al
call   10c0 <drand48@plt>
mov    -0x30(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm2
mov    -0x30(%rbp),%rax
subss  (%rax),%xmm2
mov    -0x30(%rbp),%rax
movss  (%rax),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x158(%rbp)
ff
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x3c(%rbp),%edx
movss  -0x158(%rbp),%xmm0
ff
call   1030 <get_B_from_A@plt>
movss  %xmm0,-0x15c(%rbp)
ff
mov    -0x48(%rbp),%rdi
movss  -0x15c(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x158(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
lea    0xb3f(%rip),%rsi
mov    $0x2,%al
call   1060 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    148f <main+0x2ef>
mov    -0x48(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x110,%rsp
movss  0xe49(%rip),%xmm1
xorps  %xmm0,%xmm0
mov    $0xfa0,%edi
call   1050 <build_z@plt>
mov    %rax,%r14
movss  0xe35(%rip),%xmm0
movss  0xe31(%rip),%xmm1
movss  0xe2d(%rip),%xmm2
mov    %rax,%rdi
mov    $0xfa0,%esi
call   1070 <build_comov_r@plt>
mov    %rax,%rbx
lea    0xe1a(%rip),%rsi
lea    0x10(%rsp),%r15
mov    %r15,%rdi
movss  0xdfe(%rip),%xmm0
movss  0xdfa(%rip),%xmm1
movss  0xdf6(%rip),%xmm2
call   10a0 <sprintf@plt>
lea    0xe10(%rip),%rsi
mov    %r15,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     1412 <main+0x272>
mov    %rax,%r15
xor    %ebp,%ebp
lea    0xe17(%rip),%r12
nop
movss  (%r14,%rbp,4),%xmm0
cvtss2sd %xmm0,%xmm0
movss  (%rbx,%rbp,4),%xmm1
cvtss2sd %xmm1,%xmm1
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x2,%al
call   1060 <fprintf@plt>
add    $0x1,%rbp
cmp    $0xfa0,%rbp
jne    1240 <main+0xa0>
mov    %r15,%rdi
call   1040 <fclose@plt>
lea    0xde1(%rip),%rsi
lea    0x10(%rsp),%r15
movss  0xd7b(%rip),%xmm0
movss  0xd77(%rip),%xmm1
movss  0xd73(%rip),%xmm2
mov    %r15,%rdi
call   10a0 <sprintf@plt>
lea    0xd8a(%rip),%rsi
mov    %r15,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     1412 <main+0x272>
mov    %rax,%r15
mov    $0xfa0,%ebp
mov    $0xfa0,%edi
call   1080 <srand48@plt>
lea    0xd84(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   10c0 <drand48@plt>
movss  0x3e7c(%r14),%xmm2
movss  (%r14),%xmm1
subss  %xmm1,%xmm2
mulss  %xmm0,%xmm2
addss  %xmm1,%xmm2
movss  %xmm2,0xc(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0xfa0,%edx
movaps %xmm2,%xmm0
call   1030 <get_B_from_A@plt>
movss  0xc(%rsp),%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm1,%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
mov    %r15,%rdi
mov    %r12,%rsi
movaps %xmm2,%xmm0
mov    $0x2,%al
call   1060 <fprintf@plt>
add    $0xffffffff,%ebp
jne    12e0 <main+0x140>
mov    %r15,%rdi
call   1040 <fclose@plt>
lea    0xd31(%rip),%rsi
lea    0x10(%rsp),%r15
movss  0xca5(%rip),%xmm0
movss  0xca1(%rip),%xmm1
movss  0xc9d(%rip),%xmm2
mov    %r15,%rdi
call   10a0 <sprintf@plt>
lea    0xcb4(%rip),%rsi
mov    %r15,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     1412 <main+0x272>
mov    %rax,%r15
mov    $0xfa0,%ebp
lea    0xcb8(%rip),%r12
xchg   %ax,%ax
xor    %eax,%eax
call   10c0 <drand48@plt>
movss  0x3e7c(%rbx),%xmm2
movss  (%rbx),%xmm1
subss  %xmm1,%xmm2
mulss  %xmm0,%xmm2
addss  %xmm1,%xmm2
movss  %xmm2,0xc(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xfa0,%edx
movaps %xmm2,%xmm0
call   1030 <get_B_from_A@plt>
cvtss2sd %xmm0,%xmm0
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x2,%al
call   1060 <fprintf@plt>
add    $0xffffffff,%ebp
jne    13a0 <main+0x200>
mov    %r15,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bc7(%rip),%rax
movslq (%rax),%rdi
lea    0xc11(%rip),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"table_z_comovr_%.2f_%.2f_%.2f.dat\00"
@.str.1 = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.2 = [34 x i8] c"problem opening file filename %s\0A\00"
@.str.3 = [7 x i8] c"%f %f\0A\00"
@.str.4 = [38 x i8] c"random_table_findr_%.2f_%.2f_%.2f.dat\00"
@.str.5 = [38 x i8] c"random_table_findz_%.2f_%.2f_%.2f.dat\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 float
%10 = alloca float*
%11 = alloca float*
%12 = alloca float
%13 = alloca float
%14 = alloca i32
%15 = alloca i32*
%16 = alloca [256 x i8]
%17 = alloca i32
%18 = alloca float
%19 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store float 0x3FD3333340000000, float* %7
store float 0x3FE6666660000000, float* %8
store float -1.000000e+00, float* %9
store float 0.000000e+00, float* %12
store float 1.000000e+00, float* %13
store i32 4000, i32* %14
%20 = load float, float* %12
%21 = load float, float* %13
%22 = load i32, i32* %14
%23 = call float* @build_z(float %20, float %21, i32 %22)
store float* %23, float** %10
%24 = load float*, float** %10
%25 = load i32, i32* %14
%26 = load float, float* %7
%27 = load float, float* %8
%28 = load float, float* %9
%29 = call float* @build_comov_r(float* %24, i32 %25, float %26, float %27, float %28)
store float* %29, float** %11
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%31 = load float, float* %7
%32 = load float, float* %8
%33 = load float, float* %9
%34 = call i32 @sprintf(i8* %30, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), float %31, float %32, float %33)
%35 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%36 = call i32* @fopen(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %36, i32** %15
%37 = icmp ne i32* %36, null
br i1 %37, label %45, label %38
38: ; preds = %2
%39 = load i32, i32* @stderr
%40 = sext i32 %39 to i64
%41 = inttoptr i64 %40 to i32*
%42 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%43 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %42)
%44 = call i32 @exit(i32 1)
unreachable
45: ; preds = %2
store i32 0, i32* %6
br label %46
46: ; preds = %65, %45
%47 = load i32, i32* %6
%48 = load i32, i32* %14
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %68
50: ; preds = %46
%51 = load i32*, i32** %15
%52 = load float*, float** %10
%53 = load i32, i32* %6
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds float, float* %52, i64 %54
%56 = load float, float* %55
%57 = fpext float %56 to double
%58 = load float*, float** %11
%59 = load i32, i32* %6
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds float, float* %58, i64 %60
%62 = load float, float* %61
%63 = fpext float %62 to double
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %51, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %57, double %63)
br label %65
65: ; preds = %50
%66 = load i32, i32* %6
%67 = add nsw i32 %66, 1
store i32 %67, i32* %6
br label %46
68: ; preds = %46
%69 = load i32*, i32** %15
%70 = call i32 @fclose(i32* %69)
%71 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%72 = load float, float* %7
%73 = load float, float* %8
%74 = load float, float* %9
%75 = call i32 @sprintf(i8* %71, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), float %72, float %73, float %74)
%76 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%77 = call i32* @fopen(i8* %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %77, i32** %15
%78 = icmp ne i32* %77, null
br i1 %78, label %86, label %79
79: ; preds = %68
%80 = load i32, i32* @stderr
%81 = sext i32 %80 to i64
%82 = inttoptr i64 %81 to i32*
%83 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%84 = call i32 (i32*, i8*, ...) @fprintf(i32* %82, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %83)
%85 = call i32 @exit(i32 1)
unreachable
86: ; preds = %68
%87 = load i32, i32* %14
%88 = call i32 @srand48(i32 %87)
store i32 0, i32* %6
br label %89
89: ; preds = %120, %86
%90 = load i32, i32* %6
%91 = load i32, i32* %14
%92 = icmp slt i32 %90, %91
br i1 %92, label %93, label %123
93: ; preds = %89
%94 = call float (...) @drand48()
%95 = load float*, float** %10
%96 = load i32, i32* %14
%97 = sub nsw i32 %96, 1
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds float, float* %95, i64 %98
%100 = load float, float* %99
%101 = load float*, float** %10
%102 = getelementptr inbounds float, float* %101, i64 0
%103 = load float, float* %102
%104 = fsub float %100, %103
%105 = load float*, float** %10
%106 = getelementptr inbounds float, float* %105, i64 0
%107 = load float, float* %106
%108 = call float @llvm.fmuladd.f32(float %94, float %104, float %107)
store float %108, float* %18
%109 = load float*, float** %10
%110 = load float*, float** %11
%111 = load i32, i32* %14
%112 = load float, float* %18
%113 = call float @get_B_from_A(float* %109, float* %110, i32 %111, float %112)
store float %113, float* %19
%114 = load i32*, i32** %15
%115 = load float, float* %18
%116 = fpext float %115 to double
%117 = load float, float* %19
%118 = fpext float %117 to double
%119 = call i32 (i32*, i8*, ...) @fprintf(i32* %114, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %116, double %118)
br label %120
120: ; preds = %93
%121 = load i32, i32* %6
%122 = add nsw i32 %121, 1
store i32 %122, i32* %6
br label %89
123: ; preds = %89
%124 = load i32*, i32** %15
%125 = call i32 @fclose(i32* %124)
%126 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%127 = load float, float* %7
%128 = load float, float* %8
%129 = load float, float* %9
%130 = call i32 @sprintf(i8* %126, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), float %127, float %128, float %129)
%131 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%132 = call i32* @fopen(i8* %131, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %132, i32** %15
%133 = icmp ne i32* %132, null
br i1 %133, label %141, label %134
134: ; preds = %123
%135 = load i32, i32* @stderr
%136 = sext i32 %135 to i64
%137 = inttoptr i64 %136 to i32*
%138 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%139 = call i32 (i32*, i8*, ...) @fprintf(i32* %137, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %138)
%140 = call i32 @exit(i32 1)
unreachable
141: ; preds = %123
store i32 0, i32* %6
br label %142
142: ; preds = %173, %141
%143 = load i32, i32* %6
%144 = load i32, i32* %14
%145 = icmp slt i32 %143, %144
br i1 %145, label %146, label %176
146: ; preds = %142
%147 = call float (...) @drand48()
%148 = load float*, float** %11
%149 = load i32, i32* %14
%150 = sub nsw i32 %149, 1
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds float, float* %148, i64 %151
%153 = load float, float* %152
%154 = load float*, float** %11
%155 = getelementptr inbounds float, float* %154, i64 0
%156 = load float, float* %155
%157 = fsub float %153, %156
%158 = load float*, float** %11
%159 = getelementptr inbounds float, float* %158, i64 0
%160 = load float, float* %159
%161 = call float @llvm.fmuladd.f32(float %147, float %157, float %160)
store float %161, float* %18
%162 = load float*, float** %11
%163 = load float*, float** %10
%164 = load i32, i32* %14
%165 = load float, float* %18
%166 = call float @get_B_from_A(float* %162, float* %163, i32 %164, float %165)
store float %166, float* %19
%167 = load i32*, i32** %15
%168 = load float, float* %19
%169 = fpext float %168 to double
%170 = load float, float* %18
%171 = fpext float %170 to double
%172 = call i32 (i32*, i8*, ...) @fprintf(i32* %167, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %169, double %171)
br label %173
173: ; preds = %146
%174 = load i32, i32* %6
%175 = add nsw i32 %174, 1
store i32 %175, i32* %6
br label %142
176: ; preds = %142
%177 = load i32*, i32** %15
%178 = call i32 @fclose(i32* %177)
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"table_z_comovr_%.2f_%.2f_%.2f.dat\00"
@.str.1 = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.2 = [34 x i8] c"problem opening file filename %s\0A\00"
@.str.3 = [7 x i8] c"%f %f\0A\00"
@.str.4 = [38 x i8] c"random_table_findr_%.2f_%.2f_%.2f.dat\00"
@.str.5 = [38 x i8] c"random_table_findz_%.2f_%.2f_%.2f.dat\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = tail call float* @build_z(float 0.000000e+00, float 1.000000e+00, i32 4000)
%6 = tail call float* @build_comov_r(float* %5, i32 4000, float 0x3FD3333340000000, float 0x3FE6666660000000, float -1.000000e+00)
%7 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), float 0x3FD3333340000000, float 0x3FE6666660000000, float -1.000000e+00)
%8 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2, %16
%17 = phi i64 [ %25, %16 ], [ 0, %2 ]
%18 = getelementptr inbounds float, float* %5, i64 %17
%19 = load float, float* %18
%20 = fpext float %19 to double
%21 = getelementptr inbounds float, float* %6, i64 %17
%22 = load float, float* %21
%23 = fpext float %22 to double
%24 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %20, double %23)
%25 = add nuw nsw i64 %17, 1
%26 = icmp eq i64 %25, 4000
br i1 %26, label %27, label %16
27: ; preds = %16
%28 = tail call i32 @fclose(i32* %8)
%29 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), float 0x3FD3333340000000, float 0x3FE6666660000000, float -1.000000e+00)
%30 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %38
32: ; preds = %27
%33 = load i32, i32* @stderr
%34 = sext i32 %33 to i64
%35 = inttoptr i64 %34 to i32*
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %27
%39 = tail call i32 @srand48(i32 4000)
%40 = getelementptr inbounds float, float* %5, i64 3999
br label %41
41: ; preds = %38, %41
%42 = phi i32 [ 0, %38 ], [ %52, %41 ]
%43 = tail call float (...) @drand48()
%44 = load float, float* %40
%45 = load float, float* %5
%46 = fsub float %44, %45
%47 = tail call float @llvm.fmuladd.f32(float %43, float %46, float %45)
%48 = tail call float @get_B_from_A(float* %5, float* %6, i32 4000, float %47)
%49 = fpext float %47 to double
%50 = fpext float %48 to double
%51 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %49, double %50)
%52 = add nuw nsw i32 %42, 1
%53 = icmp eq i32 %52, 4000
br i1 %53, label %54, label %41
54: ; preds = %41
%55 = tail call i32 @fclose(i32* %30)
%56 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), float 0x3FD3333340000000, float 0x3FE6666660000000, float -1.000000e+00)
%57 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%58 = icmp eq i32* %57, null
br i1 %58, label %61, label %59
59: ; preds = %54
%60 = getelementptr inbounds float, float* %6, i64 3999
br label %67
61: ; preds = %54
%62 = load i32, i32* @stderr
%63 = sext i32 %62 to i64
%64 = inttoptr i64 %63 to i32*
%65 = call i32 (i32*, i8*, ...) @fprintf(i32* %64, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%66 = call i32 @exit(i32 1)
unreachable
67: ; preds = %59, %67
%68 = phi i32 [ 0, %59 ], [ %78, %67 ]
%69 = tail call float (...) @drand48()
%70 = load float, float* %60
%71 = load float, float* %6
%72 = fsub float %70, %71
%73 = tail call float @llvm.fmuladd.f32(float %69, float %72, float %71)
%74 = tail call float @get_B_from_A(float* %6, float* %5, i32 4000, float %73)
%75 = fpext float %74 to double
%76 = fpext float %73 to double
%77 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %57, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), double %75, double %76)
%78 = add nuw nsw i32 %68, 1
%79 = icmp eq i32 %78, 4000
br i1 %79, label %80, label %67
80: ; preds = %67
%81 = tail call i32 @fclose(i32* %57)
ret i32 0
}