#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*/ printf(char *, ...);
int main(void) {
  int num1 = 9;
  int *num2 = &num1;
  printf("Direction of num1: %p\n", &num1);
  printf("Direction when num2 is stored in memory: %p\n", &num2);
  printf("Direction that num2 is pointing to: %p\n", num2);
  printf("Value of num2: %d\n", *num2);
  *num2 = 2000;
  printf("Value of num1: %d\n", num1);
  int animals[4] = {50, 100, 3, 4};
  int *zoologico = animals;
  printf("Direction in memory where the pointer is stored %p\n", &zoologico);
  printf("Direction where pointer is pointing %p\n", zoologico);
  printf("SEcond element of animals: %d\n", *zoologico);
  zoologico++;
  printf("Direction in memory where the pointer is stored %p\n", &zoologico);
  printf("Direction where pointer is pointing %p\n", zoologico);
  printf("SEcond element of animals: %d\n", *zoologico);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x9,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0xecb(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xefb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movl   $0x7d0,(%rax)
mov    -0x8(%rbp),%esi
lea    0xef3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xf76(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xf73(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xeda(%rip),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
lea    0xf0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
lea    0xe96(%rip),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
movl   $0x9,0x14(%rsp)
lea    0x14(%rsp),%rsi
mov    %rsi,0x18(%rsp)
lea    0xecc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x18(%rsp),%rsi
lea    0xeea(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x18(%rsp),%rax
mov    (%rax),%esi
lea    0xefd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x18(%rsp),%rax
movl   $0x7d0,(%rax)
mov    0x14(%rsp),%esi
lea    0xef3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movaps 0xf76(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x20(%rsp),%rax
mov    %rax,0x8(%rsp)
lea    0xee2(%rip),%r15
lea    0x8(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%rsi
lea    0xef8(%rip),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%esi
lea    0xf08(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
addq   $0x4,0x8(%rsp)
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Direction of num1: %p\0A\00"
@.str.1 = [45 x i8] c"Direction when num2 is stored in memory: %p\0A\00"
@.str.2 = [40 x i8] c"Direction that num2 is pointing to: %p\0A\00"
@.str.3 = [19 x i8] c"Value of num2: %d\0A\00"
@.str.4 = [19 x i8] c"Value of num1: %d\0A\00"
@__const.main.animals = [4 x i32] [i32 50, i32 100, i32 3, i32 4]
@.str.5 = [52 x i8] c"Direction in memory where the pointer is stored %p\0A\00"
@.str.6 = [40 x i8] c"Direction where pointer is pointing %p\0A\00"
@.str.7 = [31 x i8] c"SEcond element of animals: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [4 x i32]
%5 = alloca i32*
store i32 0, i32* %1
store i32 9, i32* %2
store i32* %2, i32** %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32** %3)
%8 = load i32*, i32** %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%10 = load i32*, i32** %3
%11 = load i32, i32* %10
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = load i32*, i32** %3
store i32 2000, i32* %13
%14 = load i32, i32* %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %14)
%16 = bitcast [4 x i32]* %4 to i8*
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
store i32* %17, i32** %5
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i32** %5)
%19 = load i32*, i32** %5
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i32* %19)
%21 = load i32*, i32** %5
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i32 %22)
%24 = load i32*, i32** %5
%25 = getelementptr inbounds i32, i32* %24, i32 1
store i32* %25, i32** %5
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i32** %5)
%27 = load i32*, i32** %5
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i32* %27)
%29 = load i32*, i32** %5
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Direction of num1: %p\0A\00"
@.str.1 = [45 x i8] c"Direction when num2 is stored in memory: %p\0A\00"
@.str.2 = [40 x i8] c"Direction that num2 is pointing to: %p\0A\00"
@.str.3 = [19 x i8] c"Value of num2: %d\0A\00"
@.str.4 = [19 x i8] c"Value of num1: %d\0A\00"
@__const.main.animals = [4 x i32] [i32 50, i32 100, i32 3, i32 4]
@.str.5 = [52 x i8] c"Direction in memory where the pointer is stored %p\0A\00"
@.str.6 = [40 x i8] c"Direction where pointer is pointing %p\0A\00"
@.str.7 = [31 x i8] c"SEcond element of animals: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [4 x i32]
%4 = alloca i32*
%5 = bitcast i32* %1 to i8*
store i32 9, i32* %1
%6 = bitcast i32** %2 to i8*
store i32* %1, i32** %2
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32** %2)
%9 = load i32*, i32** %2
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32* %9)
%11 = load i32*, i32** %2
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = load i32*, i32** %2
store i32 2000, i32* %14
%15 = load i32, i32* %1
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %15)
%17 = bitcast [4 x i32]* %3 to i8*
%18 = bitcast i32** %4 to i8*
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
store i32* %19, i32** %4
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i32** %4)
%21 = load i32*, i32** %4
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i32* %21)
%23 = load i32*, i32** %4
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i32 %24)
%26 = load i32*, i32** %4
%27 = getelementptr inbounds i32, i32* %26, i64 1
store i32* %27, i32** %4
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i32** %4)
%29 = load i32*, i32** %4
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i32* %29)
%31 = load i32*, i32** %4
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i32 %32)
ret i32 0
}