#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*/ deleteIntArray(int **);
int *newIntArray(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int *a = newIntArray(5);
  int *iterator, *end;
  for (iterator = a, end = a + 5; iterator < end; iterator++) {
    scanf("%d", iterator);
  }
  printf("Dados cadastrados:\n");
  for (iterator = a; iterator < end; iterator++) {
    printf("%d\n", *iterator);
  }
  printf("a    = %p\n", a);
  printf("&a   = %p\n", &a);
  deleteIntArray(&a);
  printf("a    = %p\n", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
call   1060 <newIntArray@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    11a0 <main+0x60>
mov    -0x18(%rbp),%rsi
lea    0xe76(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
jmp    1171 <main+0x31>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    11e9 <main+0xa9>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
jmp    11b6 <main+0x76>
mov    -0x10(%rbp),%rsi
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe24(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
call   1040 <deleteIntArray@plt>
mov    -0x10(%rbp),%rsi
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x5,%edi
call   1070 <newIntArray@plt>
mov    %rax,%rbx
mov    %rax,(%rsp)
lea    0xe94(%rip),%r14
mov    %r14,%rdi
mov    %rax,%rsi
call   1060 <scanf@plt>
lea    0x4(%rbx),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0x8(%rbx),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0xc(%rbx),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0x10(%rbx),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%esi
lea    0xe47(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe06(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdfd(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <deleteIntArray@plt>
mov    (%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [20 x i8] c"Dados cadastrados:\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [11 x i8] c"a = %p\0A\00"
@.str.4 = [11 x i8] c"&a = %p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
store i32 0, i32* %1
%5 = call i32* @newIntArray(i32 5)
store i32* %5, i32** %2
%6 = load i32*, i32** %2
store i32* %6, i32** %3
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 5
store i32* %8, i32** %4
br label %9
9: ; preds = %16, %0
%10 = load i32*, i32** %3
%11 = load i32*, i32** %4
%12 = icmp ult i32* %10, %11
br i1 %12, label %13, label %19
13: ; preds = %9
%14 = load i32*, i32** %3
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %14)
br label %16
16: ; preds = %13
%17 = load i32*, i32** %3
%18 = getelementptr inbounds i32, i32* %17, i32 1
store i32* %18, i32** %3
br label %9
19: ; preds = %9
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32*, i32** %2
store i32* %21, i32** %3
br label %22
22: ; preds = %30, %19
%23 = load i32*, i32** %3
%24 = load i32*, i32** %4
%25 = icmp ult i32* %23, %24
br i1 %25, label %26, label %33
26: ; preds = %22
%27 = load i32*, i32** %3
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %26
%31 = load i32*, i32** %3
%32 = getelementptr inbounds i32, i32* %31, i32 1
store i32* %32, i32** %3
br label %22
33: ; preds = %22
%34 = load i32*, i32** %2
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32* %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32** %2)
%37 = call i32 @deleteIntArray(i32** %2)
%38 = load i32*, i32** %2
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32* %38)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [11 x i8] c"a = %p\0A\00"
@.str.4 = [11 x i8] c"&a = %p\0A\00"
@str = [19 x i8] c"Dados cadastrados:\00"
define i32 @main() {
%1 = alloca i32*
%2 = bitcast i32** %1 to i8*
%3 = tail call i32* @newIntArray(i32 5)
store i32* %3, i32** %1
%4 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%5 = getelementptr inbounds i32, i32* %3, i64 1
%6 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%7 = getelementptr inbounds i32, i32* %3, i64 2
%8 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%9 = getelementptr inbounds i32, i32* %3, i64 3
%10 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%11 = getelementptr inbounds i32, i32* %3, i64 4
%12 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %11)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%14 = load i32, i32* %3
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds i32, i32* %3, i64 1
%17 = load i32, i32* %16
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds i32, i32* %3, i64 2
%20 = load i32, i32* %19
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds i32, i32* %3, i64 3
%23 = load i32, i32* %22
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = getelementptr inbounds i32, i32* %3, i64 4
%26 = load i32, i32* %25
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32** %1)
%30 = call i32 @deleteIntArray(i32** %1)
%31 = load i32*, i32** %1
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32* %31)
ret i32 0
}