int main(void) {
  int x[7];
  process(x, 7);
  printf("The number of bytes in an integer is: %d\n", sizeof(int));
  int num_elements = sizeof(x) / sizeof(int);
  printf("The max number of elements in x is: %d\n", num_elements);
  int *y[3];
  int a = 12;
  int b = 7;
  int c = -4;
  y[0] = &a;
  y[1] = &b;
  y[2] = &c;
  int i;
  for (i = 0; i < 3; ++i) {
    printf("y[%d] = 0x%x, dereferenced = %d\n", i, y[i], *y[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x7,%esi
mov    $0x0,%al
call   1040 <process@plt>
lea    0xeba(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x7,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xc,-0x44(%rbp)
movl   $0x7,-0x48(%rbp)
movl   $0xfffffffc,-0x4c(%rbp)
lea    -0x44(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x48(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x4c(%rbp),%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x50(%rbp)
cmpl   $0x3,-0x50(%rbp)
jge    11db <main+0xbb>
mov    -0x50(%rbp),%esi
movslq -0x50(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdx
movslq -0x50(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
mov    (%rax),%ecx
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    119e <main+0x7e>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0x10(%rsp),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <process@plt>
lea    0xec3(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0xc,0xc(%rsp)
movl   $0x7,0x8(%rsp)
movl   $0xfffffffc,0x4(%rsp)
ff
lea    0xed7(%rip),%rbx
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xc,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x7,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0xfffffffc,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"The number of bytes in an integer is: %d\0A\00"
@.str.1 = [40 x i8] c"The max number of elements in x is: %d\0A\00"
@.str.2 = [33 x i8] c"y[%d] = 0x%x, dereferenced = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i32]
%3 = alloca i32
%4 = alloca [3 x i32*]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%10 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @process to i32 (i32*, i32, ...)*)(i32* %9, i32 7)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i64 4)
store i32 7, i32* %3
%12 = load i32, i32* %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %12)
store i32 12, i32* %5
store i32 7, i32* %6
store i32 -4, i32* %7
%14 = getelementptr inbounds [3 x i32*], [3 x i32*]* %4, i64 0, i64 0
store i32* %5, i32** %14
%15 = getelementptr inbounds [3 x i32*], [3 x i32*]* %4, i64 0, i64 1
store i32* %6, i32** %15
%16 = getelementptr inbounds [3 x i32*], [3 x i32*]* %4, i64 0, i64 2
store i32* %7, i32** %16
store i32 0, i32* %8
br label %17
17: ; preds = %32, %0
%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* %8
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [3 x i32*], [3 x i32*]* %4, i64 0, i64 %23
%25 = load i32*, i32** %24
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [3 x i32*], [3 x i32*]* %4, i64 0, i64 %27
%29 = load i32*, i32** %28
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32* %25, 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
ret i32 0
}

LLVM IR (-O2):
@.str = [42 x i8] c"The number of bytes in an integer is: %d\0A\00"
@.str.1 = [40 x i8] c"The max number of elements in x is: %d\0A\00"
@.str.2 = [33 x i8] c"y[%d] = 0x%x, dereferenced = %d\0A\00"
define i32 @main() {
%1 = alloca [7 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast [7 x i32]* %1 to i8*
%6 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%7 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @process to i32 (i32*, i32, ...)*)(i32* %6, i32 7)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i64 4)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 7)
%10 = bitcast i32* %2 to i8*
store i32 12, i32* %2
%11 = bitcast i32* %3 to i8*
store i32 7, i32* %3
%12 = bitcast i32* %4 to i8*
store i32 -4, i32* %4
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 0, i32* %2, i32 12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 1, i32* %3, i32 7)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 2, i32* %4, i32 -4)
ret i32 0
}