#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*/ calc_gravity(double *, double **, double **, double,
                                double **, double *, int);
int /*<<< orphan*/ energy(double *, double **, double *, int, double *,
                          double *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ g5_close();
int /*<<< orphan*/ g5_open();
int /*<<< orphan*/ g5_set_range(double, double, double);
int /*<<< orphan*/ get_cputime(double *, double *);
int /*<<< orphan*/ printf(char *, double, ...);
int /*<<< orphan*/ push_position(double **, double **, double **, double, int);
int /*<<< orphan*/ push_velocity(double **, double **, double, int);
int /*<<< orphan*/ readnbody(int *, double *, double **, double **, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ writenbody(int, double *, double **, double **, char *);
int main(int argc, char **argv) {
  static double mj[((1 << 16))], xj[((1 << 16))][3], vj[((1 << 16))][3],
      epsj2[((1 << 16))];
  static double a[((1 << 16))][3], p[((1 << 16))];
  double xmax, xmin, mmin;
  double time;
  double dt, endt;
  double e, e0, ke, pe;
  double LapTime, SpritTime, IntPerSec, Gflops;
  int nj;
  int nstep, step;
  dt = 0.01;
  endt = 10.0;
  time = 0.0;
  nstep = endt / dt;
  xmax = 10.0;
  xmin = -10.0;
  if (argc < 3) {
    fprintf(stderr, "usage: %s <infile> <outfile>\n", argv[0]);
    exit(1);
  }
  readnbody(&nj, mj, xj, vj, argv[1]);
  mmin = mj[0];
  double eps;
  eps = 0.02;
  g5_open();
  g5_set_range(xmin, xmax, mmin);
  calc_gravity(mj, xj, vj, eps, a, p, nj);
  energy(mj, vj, p, nj, &ke, &pe);
  e0 = ke + pe;
  get_cputime(&LapTime, &SpritTime);
  for (step = 1; step < nstep; step++) {
    push_velocity(vj, a, 0.5 * dt, nj);
    push_position(xj, vj, a, dt, nj);
    time = time + dt;
    calc_gravity(mj, xj, vj, eps, a, p, nj);
    push_velocity(vj, a, 0.5 * dt, nj);
    if (step % (nstep / 10) == 0) {
      energy(mj, vj, p, nj, &ke, &pe);
      e = ke + pe;
      get_cputime(&LapTime, &SpritTime);
      IntPerSec = ((double)nj * (double)nj * (long)(nstep / 10)) / LapTime;
      Gflops = IntPerSec * 38. * 1.e-9;
      printf("step: %d time: %e\n", step, time);
      printf("e: %e de: %e\n", e, e - e0);
      printf("ke: %e pe: %e\n", ke, pe);
      printf("ke/pe: %e\n\n", ke / pe);
      printf("%e interaction per sec, %f Gflops \n", IntPerSec, Gflops);
    }
  }
  g5_close();
  writenbody(nj, mj, xj, vj, argv[2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xe1f(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe0a(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x40(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x88(%rbp)
movsd  0xde1(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xdcc(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1269 <main+0x99>
mov    0x2d96(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdde(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%r8
lea    -0x84(%rbp),%rdi
lea    0x2e21(%rip),%rsi
lea    0x82e1a(%rip),%rdx
lea    0x202e13(%rip),%rcx
call   10c0 <readnbody@plt>
movsd  0x2e06(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xd71(%rip),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    $0x0,%al
call   10e0 <g5_open@plt>
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1080 <g5_set_range@plt>
movsd  -0x98(%rbp),%xmm0
ff
mov    -0x84(%rbp),%r9d
lea    0x2dc0(%rip),%rdi
lea    0x82db9(%rip),%rsi
lea    0x202db2(%rip),%rdx
lea    0x402dab(%rip),%rcx
lea    0x582da4(%rip),%r8
call   10d0 <calc_gravity@plt>
mov    -0x84(%rbp),%ecx
lea    0x2d92(%rip),%rdi
lea    0x202d8b(%rip),%rsi
lea    0x582d84(%rip),%rdx
lea    -0x58(%rbp),%r8
lea    -0x60(%rbp),%r9
call   1070 <energy@plt>
movsd  -0x58(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
lea    -0x68(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1050 <get_cputime@plt>
movl   $0x1,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x88(%rbp),%eax
jge    1578 <main+0x3a8>
movsd  0xcb7(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
mov    -0x84(%rbp),%edx
lea    0x202d25(%rip),%rdi
lea    0x402d1e(%rip),%rsi
call   1030 <push_velocity@plt>
movsd  -0x38(%rbp),%xmm0
mov    -0x84(%rbp),%ecx
lea    0x82d07(%rip),%rdi
lea    0x202d00(%rip),%rsi
lea    0x402cf9(%rip),%rdx
call   10b0 <push_position@plt>
movsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
mov    -0x84(%rbp),%r9d
lea    0x2ccf(%rip),%rdi
lea    0x82cc8(%rip),%rsi
lea    0x202cc1(%rip),%rdx
lea    0x402cba(%rip),%rcx
lea    0x582cb3(%rip),%r8
call   10d0 <calc_gravity@plt>
movsd  0xc26(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
mov    -0x84(%rbp),%edx
lea    0x202c94(%rip),%rdi
lea    0x402c8d(%rip),%rsi
call   1030 <push_velocity@plt>
mov    -0x8c(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x88(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x9c(%rbp),%eax
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    155f <main+0x38f>
mov    -0x84(%rbp),%ecx
lea    0x2c4d(%rip),%rdi
lea    0x202c46(%rip),%rsi
lea    0x582c3f(%rip),%rdx
lea    -0x58(%rbp),%r8
lea    -0x60(%rbp),%r9
call   1070 <energy@plt>
movsd  -0x58(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
lea    -0x68(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1050 <get_cputime@plt>
cvtsi2sdl -0x84(%rbp),%xmm0
ff
cvtsi2sdl -0x84(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
mov    -0x88(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cltq
cvtsi2sd %rax,%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xb67(%rip),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  0xb52(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
cvtsi2sdl -0x8c(%rbp),%xmm0
ff
movsd  -0x30(%rbp),%xmm1
lea    0xb63(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movsd  -0x48(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
subsd  -0x50(%rbp),%xmm1
lea    0xb59(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
lea    0xb4f(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movsd  -0x58(%rbp),%xmm0
divsd  -0x60(%rbp),%xmm0
lea    0xb46(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  -0x78(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm1
lea    0xb3a(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
jmp    1564 <main+0x394>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    134f <main+0x17f>
mov    $0x0,%al
call   1090 <g5_close@plt>
mov    -0x84(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%r8
lea    0x2b0c(%rip),%rsi
lea    0x82b05(%rip),%rdx
lea    0x202afe(%rip),%rcx
call   1040 <writenbody@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
cmp    $0x2,%edi
jle    14f4 <main+0x324>
mov    %rsi,0x38(%rsp)
mov    0x8(%rsi),%r8
lea    0x2ea9(%rip),%r15
lea    0x82ea2(%rip),%r12
lea    0x202e9b(%rip),%rbx
lea    0xc(%rsp),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
call   10c0 <readnbody@plt>
movsd  0x2e80(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
xor    %r14d,%r14d
xor    %eax,%eax
call   10e0 <g5_open@plt>
movsd  0xdc8(%rip),%xmm0
movsd  0xdc8(%rip),%xmm1
movsd  0x10(%rsp),%xmm2
call   1080 <g5_set_range@plt>
mov    0xc(%rsp),%r9d
lea    0x382e49(%rip),%r13
lea    0x502e42(%rip),%rbp
movsd  0xdaa(%rip),%xmm0
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r13,%rcx
mov    %rbp,%r8
call   10d0 <calc_gravity@plt>
mov    0xc(%rsp),%ecx
lea    0x20(%rsp),%r8
lea    0x18(%rsp),%r9
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1070 <energy@plt>
movsd  0x20(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x40(%rsp)
lea    0x30(%rsp),%rdi
lea    0x60(%rsp),%rsi
call   1050 <get_cputime@plt>
movsd  0xd59(%rip),%xmm0
xorps  %xmm1,%xmm1
movsd  %xmm1,0x10(%rsp)
mov    $0x1,%r15w
movsd  %xmm0,0x28(%rsp)
jmp    1309 <main+0x139>
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0x28(%rsp),%xmm0
addsd  0xd2a(%rip),%xmm0
movsd  %xmm0,0x28(%rsp)
add    $0xffffffff,%r14d
add    $0x1,%r15d
cmp    $0xfffffc19,%r14d
je     14b5 <main+0x2e5>
movzwl %r15w,%eax
shr    $0x2,%eax
imul   $0x147b,%eax,%eax
shr    $0x11,%eax
imul   $0xffffff9c,%eax,%ebp
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    %r13,%rsi
movsd  0xcf2(%rip),%xmm0
call   1030 <push_velocity@plt>
mov    0xc(%rsp),%ecx
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
movsd  0xce0(%rip),%xmm0
call   10b0 <push_position@plt>
movsd  0x10(%rsp),%xmm0
addsd  0xccd(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    0xc(%rsp),%r9d
lea    0x2d33(%rip),%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
movsd  0xc95(%rip),%xmm0
mov    %r13,%rcx
lea    0x502d1b(%rip),%r8
call   10d0 <calc_gravity@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    %r13,%rsi
movsd  0xc84(%rip),%xmm0
call   1030 <push_velocity@plt>
or     $0x1,%ebp
cmp    %r14w,%bp
jne    12e0 <main+0x110>
mov    0xc(%rsp),%ecx
lea    0x2ce7(%rip),%rdi
mov    %rbx,%rsi
lea    0x502cdd(%rip),%rdx
lea    0x20(%rsp),%r8
lea    0x18(%rsp),%r9
call   1070 <energy@plt>
movsd  0x20(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x48(%rsp)
lea    0x30(%rsp),%rdi
lea    0x60(%rsp),%rsi
call   1050 <get_cputime@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0xc(%rsp),%xmm0
mulsd  %xmm0,%xmm0
mulsd  0xc28(%rip),%xmm0
divsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x58(%rsp)
mulsd  0xc1c(%rip),%xmm0
mulsd  0xc1c(%rip),%xmm0
movsd  %xmm0,0x50(%rsp)
lea    0xc35(%rip),%rdi
movsd  0x28(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    $0x2,%al
call   1060 <printf@plt>
movsd  0x48(%rsp),%xmm0
movapd %xmm0,%xmm1
subsd  0x40(%rsp),%xmm1
lea    0xc1e(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movsd  0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
lea    0xc12(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movsd  0x20(%rsp),%xmm0
divsd  0x18(%rsp),%xmm0
lea    0xc07(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xc05(%rip),%rdi
movsd  0x58(%rsp),%xmm0
movsd  0x50(%rsp),%xmm1
mov    $0x2,%al
call   1060 <printf@plt>
jmp    12e0 <main+0x110>
xor    %eax,%eax
call   1090 <g5_close@plt>
mov    0xc(%rsp),%edi
mov    0x38(%rsp),%rax
mov    0x10(%rax),%r8
lea    0x2bd0(%rip),%rsi
lea    0x82bc9(%rip),%rdx
lea    0x202bc2(%rip),%rcx
call   1040 <writenbody@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2ae5(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xb41(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@main.mj = internal global [65536 x double] zeroinitializer
@main.xj = internal global [65536 x [3 x double]] zeroinitializer
@main.vj = internal global [65536 x [3 x double]] zeroinitializer
@main.epsj2 = internal global [65536 x double] zeroinitializer
@main.a = internal global [65536 x [3 x double]] zeroinitializer
@main.p = internal global [65536 x double] zeroinitializer
@stderr = global i32 0
@.str = [30 x i8] c"usage: %s <infile> <outfile>\0A\00"
@.str.1 = [19 x i8] c"step: %d time: %e\0A\00"
@.str.2 = [14 x i8] c"e: %e de: %e\0A\00"
@.str.3 = [15 x i8] c"ke: %e pe: %e\0A\00"
@.str.4 = [12 x i8] c"ke/pe: %e\0A\0A\00"
@.str.5 = [36 x i8] c"%e interaction per sec, %f Gflops \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 1.000000e-02, double* %10
store double 1.000000e+01, double* %11
store double 0.000000e+00, double* %9
%24 = load double, double* %11
%25 = load double, double* %10
%26 = fdiv double %24, %25
%27 = fptosi double %26 to i32
store i32 %27, i32* %21
store double 1.000000e+01, double* %6
store double -1.000000e+01, double* %7
%28 = load i32, i32* %4
%29 = icmp slt i32 %28, 3
br i1 %29, label %30, label %37
30: ; preds = %2
%31 = load i32, i32* @stderr
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %34)
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %2
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = call i32 @readnbody(i32* %20, double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.mj, i64 0, i64 0), double** bitcast ([65536 x [3 x double]]* @main.xj to double**), double** bitcast ([65536 x [3 x double]]* @main.vj to double**), i8* %40)
%42 = load double, double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.mj, i64 0, i64 0)
store double %42, double* %8
store double 2.000000e-02, double* %23
%43 = call i32 (...) @g5_open()
%44 = load double, double* %7
%45 = load double, double* %6
%46 = load double, double* %8
%47 = call i32 @g5_set_range(double %44, double %45, double %46)
%48 = load double, double* %23
%49 = load i32, i32* %20
%50 = call i32 @calc_gravity(double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.mj, i64 0, i64 0), double** bitcast ([65536 x [3 x double]]* @main.xj to double**), double** bitcast ([65536 x [3 x double]]* @main.vj to double**), double %48, double** bitcast ([65536 x [3 x double]]* @main.a to double**), double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.p, i64 0, i64 0), i32 %49)
%51 = load i32, i32* %20
%52 = call i32 @energy(double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.mj, i64 0, i64 0), double** bitcast ([65536 x [3 x double]]* @main.vj to double**), double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.p, i64 0, i64 0), i32 %51, double* %14, double* %15)
%53 = load double, double* %14
%54 = load double, double* %15
%55 = fadd double %53, %54
store double %55, double* %13
%56 = call i32 @get_cputime(double* %16, double* %17)
store i32 1, i32* %22
br label %57
57: ; preds = %126, %37
%58 = load i32, i32* %22
%59 = load i32, i32* %21
%60 = icmp slt i32 %58, %59
br i1 %60, label %61, label %129
61: ; preds = %57
%62 = load double, double* %10
%63 = fmul double 5.000000e-01, %62
%64 = load i32, i32* %20
%65 = call i32 @push_velocity(double** bitcast ([65536 x [3 x double]]* @main.vj to double**), double** bitcast ([65536 x [3 x double]]* @main.a to double**), double %63, i32 %64)
%66 = load double, double* %10
%67 = load i32, i32* %20
%68 = call i32 @push_position(double** bitcast ([65536 x [3 x double]]* @main.xj to double**), double** bitcast ([65536 x [3 x double]]* @main.vj to double**), double** bitcast ([65536 x [3 x double]]* @main.a to double**), double %66, i32 %67)
%69 = load double, double* %9
%70 = load double, double* %10
%71 = fadd double %69, %70
store double %71, double* %9
%72 = load double, double* %23
%73 = load i32, i32* %20
%74 = call i32 @calc_gravity(double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.mj, i64 0, i64 0), double** bitcast ([65536 x [3 x double]]* @main.xj to double**), double** bitcast ([65536 x [3 x double]]* @main.vj to double**), double %72, double** bitcast ([65536 x [3 x double]]* @main.a to double**), double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.p, i64 0, i64 0), i32 %73)
%75 = load double, double* %10
%76 = fmul double 5.000000e-01, %75
%77 = load i32, i32* %20
%78 = call i32 @push_velocity(double** bitcast ([65536 x [3 x double]]* @main.vj to double**), double** bitcast ([65536 x [3 x double]]* @main.a to double**), double %76, i32 %77)
%79 = load i32, i32* %22
%80 = load i32, i32* %21
%81 = sdiv i32 %80, 10
%82 = srem i32 %79, %81
%83 = icmp eq i32 %82, 0
br i1 %83, label %84, label %125
84: ; preds = %61
%85 = load i32, i32* %20
%86 = call i32 @energy(double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.mj, i64 0, i64 0), double** bitcast ([65536 x [3 x double]]* @main.vj to double**), double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.p, i64 0, i64 0), i32 %85, double* %14, double* %15)
%87 = load double, double* %14
%88 = load double, double* %15
%89 = fadd double %87, %88
store double %89, double* %12
%90 = call i32 @get_cputime(double* %16, double* %17)
%91 = load i32, i32* %20
%92 = sitofp i32 %91 to double
%93 = load i32, i32* %20
%94 = sitofp i32 %93 to double
%95 = fmul double %92, %94
%96 = load i32, i32* %21
%97 = sdiv i32 %96, 10
%98 = sext i32 %97 to i64
%99 = sitofp i64 %98 to double
%100 = fmul double %95, %99
%101 = load double, double* %16
%102 = fdiv double %100, %101
store double %102, double* %18
%103 = load double, double* %18
%104 = fmul double %103, 3.800000e+01
%105 = fmul double %104, 1.000000e-09
store double %105, double* %19
%106 = load i32, i32* %22
%107 = sitofp i32 %106 to double
%108 = load double, double* %9
%109 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), double %107, double %108)
%110 = load double, double* %12
%111 = load double, double* %12
%112 = load double, double* %13
%113 = fsub double %111, %112
%114 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %110, double %113)
%115 = load double, double* %14
%116 = load double, double* %15
%117 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %115, double %116)
%118 = load double, double* %14
%119 = load double, double* %15
%120 = fdiv double %118, %119
%121 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %120)
%122 = load double, double* %18
%123 = load double, double* %19
%124 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), double %122, double %123)
br label %125
125: ; preds = %84, %61
br label %126
126: ; preds = %125
%127 = load i32, i32* %22
%128 = add nsw i32 %127, 1
store i32 %128, i32* %22
br label %57
129: ; preds = %57
%130 = call i32 (...) @g5_close()
%131 = load i32, i32* %20
%132 = load i8**, i8*** %5
%133 = getelementptr inbounds i8*, i8** %132, i64 2
%134 = load i8*, i8** %133
%135 = call i32 @writenbody(i32 %131, double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.mj, i64 0, i64 0), double** bitcast ([65536 x [3 x double]]* @main.xj to double**), double** bitcast ([65536 x [3 x double]]* @main.vj to double**), i8* %134)
ret i32 0
}

LLVM IR (-O2):
@main.mj = internal global [65536 x double] zeroinitializer
@main.xj = internal global [65536 x [3 x double]] zeroinitializer
@main.vj = internal global [65536 x [3 x double]] zeroinitializer
@main.a = internal global [65536 x [3 x double]] zeroinitializer
@main.p = internal global [65536 x double] zeroinitializer
@stderr = global i32 0
@.str = [30 x i8] c"usage: %s <infile> <outfile>\0A\00"
@.str.1 = [19 x i8] c"step: %d time: %e\0A\00"
@.str.2 = [14 x i8] c"e: %e de: %e\0A\00"
@.str.3 = [15 x i8] c"ke: %e pe: %e\0A\00"
@.str.4 = [12 x i8] c"ke/pe: %e\0A\0A\00"
@.str.5 = [36 x i8] c"%e interaction per sec, %f Gflops \0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = bitcast double* %3 to i8*
%9 = bitcast double* %4 to i8*
%10 = bitcast double* %5 to i8*
%11 = bitcast double* %6 to i8*
%12 = bitcast i32* %7 to i8*
%13 = icmp slt i32 %0, 3
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %1
%17 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %2
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @readnbody(i32* %7, double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.mj, i64 0, i64 0), double** bitcast ([65536 x [3 x double]]* @main.xj to double**), double** bitcast ([65536 x [3 x double]]* @main.vj to double**), i8* %21)
%23 = load double, double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.mj, i64 0, i64 0)
%24 = call i32 (...) @g5_open()
%25 = call i32 @g5_set_range(double -1.000000e+01, double 1.000000e+01, double %23)
%26 = load i32, i32* %7
%27 = call i32 @calc_gravity(double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.mj, i64 0, i64 0), double** bitcast ([65536 x [3 x double]]* @main.xj to double**), double** bitcast ([65536 x [3 x double]]* @main.vj to double**), double 2.000000e-02, double** bitcast ([65536 x [3 x double]]* @main.a to double**), double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.p, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %7
%29 = call i32 @energy(double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.mj, i64 0, i64 0), double** bitcast ([65536 x [3 x double]]* @main.vj to double**), double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.p, i64 0, i64 0), i32 %28, double* %3, double* %4)
%30 = load double, double* %3
%31 = load double, double* %4
%32 = fadd double %30, %31
%33 = call i32 @get_cputime(double* %5, double* %6)
br label %34
34: ; preds = %19, %76
%35 = phi double [ 0.000000e+00, %19 ], [ %41, %76 ]
%36 = phi i32 [ 1, %19 ], [ %77, %76 ]
%37 = load i32, i32* %7
%38 = call i32 @push_velocity(double** bitcast ([65536 x [3 x double]]* @main.vj to double**), double** bitcast ([65536 x [3 x double]]* @main.a to double**), double 5.000000e-03, i32 %37)
%39 = load i32, i32* %7
%40 = call i32 @push_position(double** bitcast ([65536 x [3 x double]]* @main.xj to double**), double** bitcast ([65536 x [3 x double]]* @main.vj to double**), double** bitcast ([65536 x [3 x double]]* @main.a to double**), double 1.000000e-02, i32 %39)
%41 = fadd double %35, 1.000000e-02
%42 = load i32, i32* %7
%43 = call i32 @calc_gravity(double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.mj, i64 0, i64 0), double** bitcast ([65536 x [3 x double]]* @main.xj to double**), double** bitcast ([65536 x [3 x double]]* @main.vj to double**), double 2.000000e-02, double** bitcast ([65536 x [3 x double]]* @main.a to double**), double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.p, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %7
%45 = call i32 @push_velocity(double** bitcast ([65536 x [3 x double]]* @main.vj to double**), double** bitcast ([65536 x [3 x double]]* @main.a to double**), double 5.000000e-03, i32 %44)
%46 = trunc i32 %36 to i16
%47 = urem i16 %46, 100
%48 = icmp eq i16 %47, 0
br i1 %48, label %49, label %76
49: ; preds = %34
%50 = load i32, i32* %7
%51 = call i32 @energy(double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.mj, i64 0, i64 0), double** bitcast ([65536 x [3 x double]]* @main.vj to double**), double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.p, i64 0, i64 0), i32 %50, double* %3, double* %4)
%52 = load double, double* %3
%53 = load double, double* %4
%54 = fadd double %52, %53
%55 = call i32 @get_cputime(double* %5, double* %6)
%56 = load i32, i32* %7
%57 = sitofp i32 %56 to double
%58 = fmul double %57, %57
%59 = fmul double %58, 1.000000e+02
%60 = load double, double* %5
%61 = fdiv double %59, %60
%62 = fmul double %61, 3.800000e+01
%63 = fmul double %62, 1.000000e-09
%64 = sitofp i32 %36 to double
%65 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), double %64, double %41)
%66 = fsub double %54, %32
%67 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double %54, double %66)
%68 = load double, double* %3
%69 = load double, double* %4
%70 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %68, double %69)
%71 = load double, double* %3
%72 = load double, double* %4
%73 = fdiv double %71, %72
%74 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %73)
%75 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), double %61, double %63)
br label %76
76: ; preds = %34, %49
%77 = add nuw nsw i32 %36, 1
%78 = icmp eq i32 %77, 1000
br i1 %78, label %79, label %34
79: ; preds = %76
%80 = call i32 (...) @g5_close()
%81 = load i32, i32* %7
%82 = getelementptr inbounds i8*, i8** %1, i64 2
%83 = load i8*, i8** %82
%84 = call i32 @writenbody(i32 %81, double* getelementptr inbounds ([65536 x double], [65536 x double]* @main.mj, i64 0, i64 0), double** bitcast ([65536 x [3 x double]]* @main.xj to double**), double** bitcast ([65536 x [3 x double]]* @main.vj to double**), i8* %83)
ret i32 0
}