#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 atoi(char *);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ init_m(double *, int);
int /*<<< orphan*/ init_r(double *, int);
int /*<<< orphan*/ init_v(double *, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ write_data(double *, char *, int);
int main(int argc, char *argv[]) {
  int size;
  double *m, *x, *y, *z, *vx, *vy, *vz;
  if (argc == 1) {
    size = 1024;
  } else {
    size = atoi(argv[1]);
    if (size == 0) {
      size = atoi(argv[1]);
    }
  }
  m = (double *)malloc(sizeof(double) * size);
  x = (double *)malloc(sizeof(double) * size);
  y = (double *)malloc(sizeof(double) * size);
  z = (double *)malloc(sizeof(double) * size);
  vx = (double *)malloc(sizeof(double) * size);
  vy = (double *)malloc(sizeof(double) * size);
  vz = (double *)malloc(sizeof(double) * size);
  init_m(m, size);
  init_r(x, size);
  init_r(y, size);
  init_r(z, size);
  init_v(x, size);
  init_v(y, size);
  init_v(z, size);
  write_data(m, "m.dat", size);
  write_data(x, "x.dat", size);
  write_data(y, "y.dat", size);
  write_data(z, "z.dat", size);
  write_data(vx, "vx.dat", size);
  write_data(vy, "vy.dat", size);
  write_data(vx, "vz.dat", size);
  free(m);
  free(x);
  free(y);
  free(z);
  free(vx);
  free(vy);
  free(vz);
  printf("success\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11ac <main+0x2c>
movl   $0x400,-0x14(%rbp)
jmp    11db <main+0x5b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11d6 <main+0x56>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    11db <main+0x5b>
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x30(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x38(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x40(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x48(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10a0 <init_m@plt>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <init_r@plt>
mov    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <init_r@plt>
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <init_r@plt>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <init_v@plt>
mov    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <init_v@plt>
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <init_v@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xd3e(%rip),%rsi
call   1070 <write_data@plt>
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xd32(%rip),%rsi
call   1070 <write_data@plt>
mov    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xd26(%rip),%rsi
call   1070 <write_data@plt>
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xd1a(%rip),%rsi
call   1070 <write_data@plt>
mov    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xcf8(%rip),%rsi
call   1070 <write_data@plt>
mov    -0x48(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xcec(%rip),%rsi
call   1070 <write_data@plt>
mov    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xce0(%rip),%rsi
call   1070 <write_data@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
lea    0xc9c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    $0x400,%ebx
cmp    $0x1,%edi
je     11a3 <main+0x23>
mov    0x8(%rsi),%rdi
call   1090 <atoi@plt>
mov    %eax,%ebx
lea    0x0(,%rbx,8),%r14d
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,%rbp
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,%r12
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,%r13
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,0x10(%rsp)
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,0x18(%rsp)
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,0x20(%rsp)
mov    %rbp,0x8(%rsp)
mov    %rbp,%rdi
mov    %ebx,%esi
call   10a0 <init_m@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   1050 <init_r@plt>
mov    %r12,%rdi
mov    %ebx,%esi
call   1050 <init_r@plt>
mov    %r13,%rdi
mov    %ebx,%esi
call   1050 <init_r@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   1060 <init_v@plt>
mov    %r12,%rdi
mov    %ebx,%esi
call   1060 <init_v@plt>
mov    %r13,%rdi
mov    %ebx,%esi
call   1060 <init_v@plt>
lea    0xdb0(%rip),%rsi
mov    %rbp,%rdi
mov    %ebx,%edx
call   1070 <write_data@plt>
lea    0xda6(%rip),%rsi
mov    %r15,%rdi
mov    %ebx,%edx
call   1070 <write_data@plt>
lea    0xd9c(%rip),%rsi
mov    %r12,%rdi
mov    %ebx,%edx
call   1070 <write_data@plt>
lea    0xd92(%rip),%rsi
mov    %r13,%rdi
mov    %ebx,%edx
call   1070 <write_data@plt>
lea    0xd72(%rip),%rsi
mov    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    %ebx,%edx
call   1070 <write_data@plt>
lea    0xd63(%rip),%rsi
mov    0x18(%rsp),%r14
mov    %r14,%rdi
mov    %ebx,%edx
call   1070 <write_data@plt>
lea    0xd54(%rip),%rsi
mov    %rbp,%rdi
mov    %ebx,%edx
call   1070 <write_data@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
lea    0xd0e(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"m.dat\00"
@.str.1 = [6 x i8] c"x.dat\00"
@.str.2 = [6 x i8] c"y.dat\00"
@.str.3 = [6 x i8] c"z.dat\00"
@.str.4 = [7 x i8] c"vx.dat\00"
@.str.5 = [7 x i8] c"vy.dat\00"
@.str.6 = [7 x i8] c"vz.dat\00"
@.str.7 = [9 x i8] c"success\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %17
16: ; preds = %2
store i32 1024, i32* %6
br label %30
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %6
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %17
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @atoi(i8* %27)
store i32 %28, i32* %6
br label %29
29: ; preds = %24, %17
br label %30
30: ; preds = %29, %16
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = mul i64 8, %32
%34 = trunc i64 %33 to i32
%35 = call i64 @malloc(i32 %34)
%36 = inttoptr i64 %35 to double*
store double* %36, double** %7
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = mul i64 8, %38
%40 = trunc i64 %39 to i32
%41 = call i64 @malloc(i32 %40)
%42 = inttoptr i64 %41 to double*
store double* %42, double** %8
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = mul i64 8, %44
%46 = trunc i64 %45 to i32
%47 = call i64 @malloc(i32 %46)
%48 = inttoptr i64 %47 to double*
store double* %48, double** %9
%49 = load i32, i32* %6
%50 = sext i32 %49 to i64
%51 = mul i64 8, %50
%52 = trunc i64 %51 to i32
%53 = call i64 @malloc(i32 %52)
%54 = inttoptr i64 %53 to double*
store double* %54, double** %10
%55 = load i32, i32* %6
%56 = sext i32 %55 to i64
%57 = mul i64 8, %56
%58 = trunc i64 %57 to i32
%59 = call i64 @malloc(i32 %58)
%60 = inttoptr i64 %59 to double*
store double* %60, double** %11
%61 = load i32, i32* %6
%62 = sext i32 %61 to i64
%63 = mul i64 8, %62
%64 = trunc i64 %63 to i32
%65 = call i64 @malloc(i32 %64)
%66 = inttoptr i64 %65 to double*
store double* %66, double** %12
%67 = load i32, i32* %6
%68 = sext i32 %67 to i64
%69 = mul i64 8, %68
%70 = trunc i64 %69 to i32
%71 = call i64 @malloc(i32 %70)
%72 = inttoptr i64 %71 to double*
store double* %72, double** %13
%73 = load double*, double** %7
%74 = load i32, i32* %6
%75 = call i32 @init_m(double* %73, i32 %74)
%76 = load double*, double** %8
%77 = load i32, i32* %6
%78 = call i32 @init_r(double* %76, i32 %77)
%79 = load double*, double** %9
%80 = load i32, i32* %6
%81 = call i32 @init_r(double* %79, i32 %80)
%82 = load double*, double** %10
%83 = load i32, i32* %6
%84 = call i32 @init_r(double* %82, i32 %83)
%85 = load double*, double** %8
%86 = load i32, i32* %6
%87 = call i32 @init_v(double* %85, i32 %86)
%88 = load double*, double** %9
%89 = load i32, i32* %6
%90 = call i32 @init_v(double* %88, i32 %89)
%91 = load double*, double** %10
%92 = load i32, i32* %6
%93 = call i32 @init_v(double* %91, i32 %92)
%94 = load double*, double** %7
%95 = load i32, i32* %6
%96 = call i32 @write_data(double* %94, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %95)
%97 = load double*, double** %8
%98 = load i32, i32* %6
%99 = call i32 @write_data(double* %97, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %98)
%100 = load double*, double** %9
%101 = load i32, i32* %6
%102 = call i32 @write_data(double* %100, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %101)
%103 = load double*, double** %10
%104 = load i32, i32* %6
%105 = call i32 @write_data(double* %103, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %104)
%106 = load double*, double** %11
%107 = load i32, i32* %6
%108 = call i32 @write_data(double* %106, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %107)
%109 = load double*, double** %12
%110 = load i32, i32* %6
%111 = call i32 @write_data(double* %109, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %110)
%112 = load double*, double** %11
%113 = load i32, i32* %6
%114 = call i32 @write_data(double* %112, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %113)
%115 = load double*, double** %7
%116 = call i32 @free(double* %115)
%117 = load double*, double** %8
%118 = call i32 @free(double* %117)
%119 = load double*, double** %9
%120 = call i32 @free(double* %119)
%121 = load double*, double** %10
%122 = call i32 @free(double* %121)
%123 = load double*, double** %11
%124 = call i32 @free(double* %123)
%125 = load double*, double** %12
%126 = call i32 @free(double* %125)
%127 = load double*, double** %13
%128 = call i32 @free(double* %127)
%129 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"m.dat\00"
@.str.1 = [6 x i8] c"x.dat\00"
@.str.2 = [6 x i8] c"y.dat\00"
@.str.3 = [6 x i8] c"z.dat\00"
@.str.4 = [7 x i8] c"vx.dat\00"
@.str.5 = [7 x i8] c"vy.dat\00"
@.str.6 = [7 x i8] c"vz.dat\00"
@str = [8 x i8] c"success\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %4, %2
%9 = phi i32 [ 1024, %2 ], [ %7, %4 ]
%10 = shl i32 %9, 3
%11 = tail call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to double*
%13 = tail call i64 @malloc(i32 %10)
%14 = inttoptr i64 %13 to double*
%15 = tail call i64 @malloc(i32 %10)
%16 = inttoptr i64 %15 to double*
%17 = tail call i64 @malloc(i32 %10)
%18 = inttoptr i64 %17 to double*
%19 = tail call i64 @malloc(i32 %10)
%20 = inttoptr i64 %19 to double*
%21 = tail call i64 @malloc(i32 %10)
%22 = inttoptr i64 %21 to double*
%23 = tail call i64 @malloc(i32 %10)
%24 = inttoptr i64 %23 to double*
%25 = tail call i32 @init_m(double* %12, i32 %9)
%26 = tail call i32 @init_r(double* %14, i32 %9)
%27 = tail call i32 @init_r(double* %16, i32 %9)
%28 = tail call i32 @init_r(double* %18, i32 %9)
%29 = tail call i32 @init_v(double* %14, i32 %9)
%30 = tail call i32 @init_v(double* %16, i32 %9)
%31 = tail call i32 @init_v(double* %18, i32 %9)
%32 = tail call i32 @write_data(double* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %9)
%33 = tail call i32 @write_data(double* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%34 = tail call i32 @write_data(double* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%35 = tail call i32 @write_data(double* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%36 = tail call i32 @write_data(double* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%37 = tail call i32 @write_data(double* %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %9)
%38 = tail call i32 @write_data(double* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %9)
%39 = tail call i32 @free(double* %12)
%40 = tail call i32 @free(double* %14)
%41 = tail call i32 @free(double* %16)
%42 = tail call i32 @free(double* %18)
%43 = tail call i32 @free(double* %20)
%44 = tail call i32 @free(double* %22)
%45 = tail call i32 @free(double* %24)
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret i32 0
}