#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 *genRandom();
int /*<<< orphan*/ printf(char *, int, double, ...);
int main(int argc, char *argv[]) {
  int a[2][3] = {{0, 1, 2}, {3, 4, 5}};
  int i = 0;
  int j = 0;
  for (i = 0; i < 2; i++) {
    for (j = 0; j < 3; j++) {
      printf("a[%d][%d] = %d\n", i, j, a[i][j]);
    }
  }
  int *p;
  p = genRandom();
  for (i = 0; i < 10; i++) {
    printf("p[%d] : %d\n", i, p[i]);
  }
  double weights[5] = {180.0, 175.3, 130.2, 100.0, 87.5};
  double *ptr_weights;
  ptr_weights = weights;
  for (i = 0; i < 5; i++) {
    printf("weights[%i] : %f, ptr_weights[%i] : [%f]\n", i, weights[i], i,
           ptr_weights[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xee0(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xedd(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x2,-0x34(%rbp)
jge    11e7 <main+0xb7>
movl   $0x0,-0x38(%rbp)
cmpl   $0x3,-0x38(%rbp)
jge    11d4 <main+0xa4>
mov    -0x34(%rbp),%esi
cvtsi2sdl -0x38(%rbp),%xmm0
movslq -0x34(%rbp),%rcx
lea    -0x30(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe89(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1190 <main+0x60>
jmp    11d9 <main+0xa9>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    117f <main+0x4f>
mov    $0x0,%al
call   1050 <genRandom@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    122f <main+0xff>
mov    -0x34(%rbp),%esi
mov    -0x40(%rbp),%rax
movslq -0x34(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm0
lea    0xe3e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11f9 <main+0xc9>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movsd  0xdd9(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xdc4(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xdaf(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xd9a(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xd85(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
lea    -0x70(%rbp),%rax
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x5,-0x34(%rbp)
jge    12d2 <main+0x1a2>
mov    -0x34(%rbp),%esi
movslq -0x34(%rbp),%rax
movsd  -0x70(%rbp,%rax,8),%xmm0
mov    -0x34(%rbp),%edx
mov    -0x78(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xda7(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    128f <main+0x15f>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xf0d(%rip),%rbx
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xebc(%rip),%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xeab(%rip),%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x2,%edx
mov    $0x1,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    $0x1,%al
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
movsd  0xe6b(%rip),%xmm0
mov    $0x4,%edx
mov    $0x1,%al
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
movsd  0xe57(%rip),%xmm0
mov    $0x5,%edx
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <genRandom@plt>
mov    %rax,%rbx
xorps  %xmm0,%xmm0
cvtsi2sdl (%rax),%xmm0
lea    0xe73(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x1,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x4(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x1,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x8(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x2,%esi
mov    $0x1,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0xc(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x3,%esi
mov    $0x1,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x10(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x1,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x14(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x5,%esi
mov    $0x1,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x18(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x6,%esi
mov    $0x1,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x1c(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x7,%esi
mov    $0x1,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x20(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x8,%esi
mov    $0x1,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x24(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x9,%esi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xd9d(%rip),%rbx
movsd  0xd51(%rip),%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
movsd  0xd40(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
movsd  0xd29(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x2,%edx
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
movsd  0xd12(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
movsd  0xcfb(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.a = [2 x [3 x i32]] [[3 x i32] [i32 0, i32 1, i32 2], [3 x i32] [i32 3, i32 4, i32 5]]
@.str = [16 x i8] c"a[%d][%d] = %d\0A\00"
@.str.1 = [12 x i8] c"p[%d] : %d\0A\00"
@.str.2 = [42 x i8] c"weights[%i] : %f, ptr_weights[%i] : [%f]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x [3 x i32]]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca [5 x double]
%11 = alloca double*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = bitcast [2 x [3 x i32]]* %6 to i8*
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %7
br label %13
13: ; preds = %36, %2
%14 = load i32, i32* %7
%15 = icmp slt i32 %14, 2
br i1 %15, label %16, label %39
16: ; preds = %13
store i32 0, i32* %8
br label %17
17: ; preds = %32, %16
%18 = load i32, i32* %8
%19 = icmp slt i32 %18, 3
br i1 %19, label %20, label %35
20: ; preds = %17
%21 = load i32, i32* %7
%22 = load i32, i32* %8
%23 = sitofp i32 %22 to double
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [2 x [3 x i32]], [2 x [3 x i32]]* %6, i64 0, i64 %25
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [3 x i32], [3 x i32]* %26, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %21, double %23, i32 %30)
br label %32
32: ; preds = %20
%33 = load i32, i32* %8
%34 = add nsw i32 %33, 1
store i32 %34, i32* %8
br label %17
35: ; preds = %17
br label %36
36: ; preds = %35
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %13
39: ; preds = %13
%40 = call i32* (...) @genRandom()
store i32* %40, i32** %9
store i32 0, i32* %7
br label %41
41: ; preds = %53, %39
%42 = load i32, i32* %7
%43 = icmp slt i32 %42, 10
br i1 %43, label %44, label %56
44: ; preds = %41
%45 = load i32, i32* %7
%46 = load i32*, i32** %9
%47 = load i32, i32* %7
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i32, i32* %46, i64 %48
%50 = load i32, i32* %49
%51 = sitofp i32 %50 to double
%52 = call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %45, double %51)
br label %53
53: ; preds = %44
%54 = load i32, i32* %7
%55 = add nsw i32 %54, 1
store i32 %55, i32* %7
br label %41
56: ; preds = %41
%57 = bitcast [5 x double]* %10 to i8*
%58 = bitcast i8* %57 to [5 x double]*
%59 = getelementptr inbounds [5 x double], [5 x double]* %58, i32 0, i32 0
store double 1.800000e+02, double* %59
%60 = getelementptr inbounds [5 x double], [5 x double]* %58, i32 0, i32 1
store double 1.753000e+02, double* %60
%61 = getelementptr inbounds [5 x double], [5 x double]* %58, i32 0, i32 2
store double 1.302000e+02, double* %61
%62 = getelementptr inbounds [5 x double], [5 x double]* %58, i32 0, i32 3
store double 1.000000e+02, double* %62
%63 = getelementptr inbounds [5 x double], [5 x double]* %58, i32 0, i32 4
store double 8.750000e+01, double* %63
%64 = getelementptr inbounds [5 x double], [5 x double]* %10, i64 0, i64 0
store double* %64, double** %11
store i32 0, i32* %7
br label %65
65: ; preds = %81, %56
%66 = load i32, i32* %7
%67 = icmp slt i32 %66, 5
br i1 %67, label %68, label %84
68: ; preds = %65
%69 = load i32, i32* %7
%70 = load i32, i32* %7
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [5 x double], [5 x double]* %10, i64 0, i64 %71
%73 = load double, double* %72
%74 = load i32, i32* %7
%75 = load double*, double** %11
%76 = load i32, i32* %7
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds double, double* %75, i64 %77
%79 = load double, double* %78
%80 = call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %69, double %73, i32 %74, double %79)
br label %81
81: ; preds = %68
%82 = load i32, i32* %7
%83 = add nsw i32 %82, 1
store i32 %83, i32* %7
br label %65
84: ; preds = %65
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"a[%d][%d] = %d\0A\00"
@.str.1 = [12 x i8] c"p[%d] : %d\0A\00"
@.str.2 = [42 x i8] c"weights[%i] : %f, ptr_weights[%i] : [%f]\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 0, double 0.000000e+00, i32 0)
%4 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 0, double 1.000000e+00, i32 1)
%5 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 0, double 2.000000e+00, i32 2)
%6 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 1, double 0.000000e+00, i32 3)
%7 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 1, double 1.000000e+00, i32 4)
%8 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 1, double 2.000000e+00, i32 5)
%9 = tail call i32* (...) @genRandom()
%10 = load i32, i32* %9
%11 = sitofp i32 %10 to double
%12 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 0, double %11)
%13 = getelementptr inbounds i32, i32* %9, i64 1
%14 = load i32, i32* %13
%15 = sitofp i32 %14 to double
%16 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 1, double %15)
%17 = getelementptr inbounds i32, i32* %9, i64 2
%18 = load i32, i32* %17
%19 = sitofp i32 %18 to double
%20 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 2, double %19)
%21 = getelementptr inbounds i32, i32* %9, i64 3
%22 = load i32, i32* %21
%23 = sitofp i32 %22 to double
%24 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 3, double %23)
%25 = getelementptr inbounds i32, i32* %9, i64 4
%26 = load i32, i32* %25
%27 = sitofp i32 %26 to double
%28 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 4, double %27)
%29 = getelementptr inbounds i32, i32* %9, i64 5
%30 = load i32, i32* %29
%31 = sitofp i32 %30 to double
%32 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 5, double %31)
%33 = getelementptr inbounds i32, i32* %9, i64 6
%34 = load i32, i32* %33
%35 = sitofp i32 %34 to double
%36 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 6, double %35)
%37 = getelementptr inbounds i32, i32* %9, i64 7
%38 = load i32, i32* %37
%39 = sitofp i32 %38 to double
%40 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 7, double %39)
%41 = getelementptr inbounds i32, i32* %9, i64 8
%42 = load i32, i32* %41
%43 = sitofp i32 %42 to double
%44 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 8, double %43)
%45 = getelementptr inbounds i32, i32* %9, i64 9
%46 = load i32, i32* %45
%47 = sitofp i32 %46 to double
%48 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 9, double %47)
%49 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 0, double 1.800000e+02, i32 0, double 1.800000e+02)
%50 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 1, double 1.753000e+02, i32 1, double 1.753000e+02)
%51 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 2, double 1.302000e+02, i32 2, double 1.302000e+02)
%52 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 3, double 1.000000e+02, i32 3, double 1.000000e+02)
%53 = tail call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 4, double 8.750000e+01, i32 4, double 8.750000e+01)
ret i32 0
}