#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 *malloc(int);
int /*<<< orphan*/ printf(char *, int *, int);
int main() {
  int *num = malloc(sizeof(int) * 3);
  num[0] = 10;
  num[1] = 15;
  num[2] = 20;
  printf("%p -> %d \n", num, *num);
  printf("%p -> %d \n", num + 1, *(num + 1));
  printf("%p -> %d \n", num + 2, *(num + 2));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xc,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0xa,(%rax)
mov    -0x8(%rbp),%rax
movl   $0xf,0x4(%rax)
mov    -0x8(%rbp),%rax
movl   $0x14,0x8(%rax)
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edx
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x8,%rsi
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edx
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0xc,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
movabs $0xf0000000a,%rax
mov    %rax,(%rbx)
lea    0x4(%rbx),%r14
lea    0x8(%rbx),%r15
movl   $0x14,0x8(%rbx)
lea    0xea8(%rip),%r12
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0xa,%edx
call   1030 <printf@plt>
mov    0x4(%rbx),%edx
mov    %r12,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    0x8(%rbx),%edx
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%p -> %d \0A\00"
define i32 @main() {
%1 = alloca i32*
%2 = call i32* @malloc(i32 12)
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = getelementptr inbounds i32, i32* %3, i64 0
store i32 10, i32* %4
%5 = load i32*, i32** %1
%6 = getelementptr inbounds i32, i32* %5, i64 1
store i32 15, i32* %6
%7 = load i32*, i32** %1
%8 = getelementptr inbounds i32, i32* %7, i64 2
store i32 20, i32* %8
%9 = load i32*, i32** %1
%10 = load i32*, i32** %1
%11 = load i32, i32* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %9, i32 %11)
%13 = load i32*, i32** %1
%14 = getelementptr inbounds i32, i32* %13, i64 1
%15 = load i32*, i32** %1
%16 = getelementptr inbounds i32, i32* %15, i64 1
%17 = load i32, i32* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %14, i32 %17)
%19 = load i32*, i32** %1
%20 = getelementptr inbounds i32, i32* %19, i64 2
%21 = load i32*, i32** %1
%22 = getelementptr inbounds i32, i32* %21, i64 2
%23 = load i32, i32* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %20, i32 %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"%p -> %d \0A\00"
define i32 @main() {
%1 = tail call i32* @malloc(i32 12)
store i32 10, i32* %1
%2 = getelementptr inbounds i32, i32* %1, i64 1
store i32 15, i32* %2
%3 = getelementptr inbounds i32, i32* %1, i64 2
store i32 20, i32* %3
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %1, i32 10)
%5 = load i32, i32* %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %2, i32 %5)
%7 = load i32, i32* %3
%8 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %3, i32 %7)
ret i32 0
}