#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*/ free(int *);
int *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int *a = malloc(3 * sizeof(int));
  a[0] = 33;
  a[1] = 66;
  a[2] = 99;
  printf("sizeof(int): %d\n", sizeof(int));
  printf("&a[0]: %lu\n", &a[0]);
  printf("&a[1]: %lu\n", &a[1]);
  printf("&a[2]: %lu\n", &a[2]);
  printf("a: %lu\n", a);
  printf("(a+1): %lu\n", a + 1);
  printf("(a+2): %lu\n", a + 2);
  printf("*a: %d\n", *a);
  printf("*(a+1): %d\n", *(a + 1));
  printf("*(a+2): %d\n", *(a + 2));
  free(a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xc,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x21,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x42,0x4(%rax)
mov    -0x10(%rbp),%rax
movl   $0x63,0x8(%rax)
lea    0xe8c(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
add    $0x4,%rsi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
add    $0x4,%rsi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%esi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%esi
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0xc,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
movabs $0x4200000021,%rax
mov    %rax,(%rbx)
lea    0x4(%rbx),%r15
lea    0x8(%rbx),%r14
movl   $0x63,0x8(%rbx)
lea    0xe9b(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe99(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe94(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8f(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8a(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe81(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe7c(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%esi
lea    0xe75(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rbx),%esi
lea    0xe6c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%esi
lea    0xe67(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [17 x i8] c"sizeof(int): %d\0A\00"
@.str.1 = [12 x i8] c"&a[0]: %lu\0A\00"
@.str.2 = [12 x i8] c"&a[1]: %lu\0A\00"
@.str.3 = [12 x i8] c"&a[2]: %lu\0A\00"
@.str.4 = [8 x i8] c"a: %lu\0A\00"
@.str.5 = [12 x i8] c"(a+1): %lu\0A\00"
@.str.6 = [12 x i8] c"(a+2): %lu\0A\00"
@.str.7 = [8 x i8] c"*a: %d\0A\00"
@.str.8 = [12 x i8] c"*(a+1): %d\0A\00"
@.str.9 = [12 x i8] c"*(a+2): %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @malloc(i32 12)
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 0
store i32 33, i32* %5
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 1
store i32 66, i32* %7
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 2
store i32 99, i32* %9
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 4)
%11 = load i32*, i32** %2
%12 = getelementptr inbounds i32, i32* %11, i64 0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = load i32*, i32** %2
%15 = getelementptr inbounds i32, i32* %14, i64 1
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %15)
%17 = load i32*, i32** %2
%18 = getelementptr inbounds i32, i32* %17, i64 2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32* %18)
%20 = load i32*, i32** %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32* %20)
%22 = load i32*, i32** %2
%23 = getelementptr inbounds i32, i32* %22, i64 1
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32* %23)
%25 = load i32*, i32** %2
%26 = getelementptr inbounds i32, i32* %25, i64 2
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32* %26)
%28 = load i32*, i32** %2
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %29)
%31 = load i32*, i32** %2
%32 = getelementptr inbounds i32, i32* %31, i64 1
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i32 %33)
%35 = load i32*, i32** %2
%36 = getelementptr inbounds i32, i32* %35, i64 2
%37 = load i32, i32* %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i32 %37)
%39 = load i32*, i32** %2
%40 = call i32 @free(i32* %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"sizeof(int): %d\0A\00"
@.str.1 = [12 x i8] c"&a[0]: %lu\0A\00"
@.str.2 = [12 x i8] c"&a[1]: %lu\0A\00"
@.str.3 = [12 x i8] c"&a[2]: %lu\0A\00"
@.str.4 = [8 x i8] c"a: %lu\0A\00"
@.str.5 = [12 x i8] c"(a+1): %lu\0A\00"
@.str.6 = [12 x i8] c"(a+2): %lu\0A\00"
@.str.7 = [8 x i8] c"*a: %d\0A\00"
@.str.8 = [12 x i8] c"*(a+1): %d\0A\00"
@.str.9 = [12 x i8] c"*(a+2): %d\0A\00"
define i32 @main() {
%1 = tail call i32* @malloc(i32 12)
store i32 33, i32* %1
%2 = getelementptr inbounds i32, i32* %1, i64 1
store i32 66, i32* %2
%3 = getelementptr inbounds i32, i32* %1, i64 2
store i32 99, i32* %3
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 4)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %1
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %2
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %3
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0), i32 %15)
%17 = tail call i32 @free(i32* %1)
ret i32 0
}