#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 *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(int *, int *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int i;
  int *vetor;
  int min = 4;
  int max = 10;
  int *v;
  int *aux;
  vetor = (int *)malloc(min * sizeof(int));
  for (i = 0; i < min; ++i) {
    vetor[i] = i;
    printf("%d\t", vetor[i]);
  }
  printf("\n");
  aux = vetor;
  v = (int *)malloc(max * sizeof(int));
  memcpy(v, vetor, min * sizeof(int));
  vetor = v;
  free(aux);
  for (i = min; i < max; ++i) {
    vetor[i] = i;
    printf("%d\t", vetor[i]);
  }
  printf("\n");
  for (i = 0; i < max; ++i) {
    vetor[i] = i;
    printf("%d\t", vetor[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x14(%rbp)
movl   $0xa,-0x18(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11b8 <main+0x78>
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1177 <main+0x37>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   1050 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1250 <main+0x110>
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    120f <main+0xcf>
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    12a6 <main+0x166>
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1265 <main+0x125>
lea    0xd57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x10,%edi
call   1070 <malloc@plt>
mov    %rax,%r15
movl   $0x0,(%rax)
lea    0xe91(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x1,0x4(%r15)
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x2,0x8(%r15)
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x3,0xc(%r15)
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    $0x28,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    $0x10,%edx
call   1060 <memcpy@plt>
mov    %r15,%rdi
call   1030 <free@plt>
movl   $0x4,0x10(%rbx)
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x5,0x14(%rbx)
mov    %r14,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x6,0x18(%rbx)
mov    %r14,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x7,0x1c(%rbx)
mov    %r14,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x8,0x20(%rbx)
mov    %r14,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x9,0x24(%rbx)
mov    %r14,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
movl   $0x0,(%rbx)
mov    %r14,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x1,0x4(%rbx)
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x2,0x8(%rbx)
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x3,0xc(%rbx)
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x4,0x10(%rbx)
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x5,0x14(%rbx)
mov    %r14,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x6,0x18(%rbx)
mov    %r14,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x7,0x1c(%rbx)
mov    %r14,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x8,0x20(%rbx)
mov    %r14,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x9,0x24(%rbx)
mov    %r14,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\09\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
store i32 0, i32* %1
store i32 4, i32* %4
store i32 10, i32* %5
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = mul i64 %9, 4
%11 = trunc i64 %10 to i32
%12 = call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to i32*
store i32* %13, i32** %3
store i32 0, i32* %2
br label %14
14: ; preds = %30, %0
%15 = load i32, i32* %2
%16 = load i32, i32* %4
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %33
18: ; preds = %14
%19 = load i32, i32* %2
%20 = load i32*, i32** %3
%21 = load i32, i32* %2
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
store i32 %19, i32* %23
%24 = load i32*, i32** %3
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %18
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %14
33: ; preds = %14
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%35 = load i32*, i32** %3
store i32* %35, i32** %7
%36 = load i32, i32* %5
%37 = sext i32 %36 to i64
%38 = mul i64 %37, 4
%39 = trunc i64 %38 to i32
%40 = call i64 @malloc(i32 %39)
%41 = inttoptr i64 %40 to i32*
store i32* %41, i32** %6
%42 = load i32*, i32** %6
%43 = load i32*, i32** %3
%44 = load i32, i32* %4
%45 = sext i32 %44 to i64
%46 = mul i64 %45, 4
%47 = trunc i64 %46 to i32
%48 = call i32 @memcpy(i32* %42, i32* %43, i32 %47)
%49 = load i32*, i32** %6
store i32* %49, i32** %3
%50 = load i32*, i32** %7
%51 = call i32 @free(i32* %50)
%52 = load i32, i32* %4
store i32 %52, i32* %2
br label %53
53: ; preds = %69, %33
%54 = load i32, i32* %2
%55 = load i32, i32* %5
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %72
57: ; preds = %53
%58 = load i32, i32* %2
%59 = load i32*, i32** %3
%60 = load i32, i32* %2
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i32, i32* %59, i64 %61
store i32 %58, i32* %62
%63 = load i32*, i32** %3
%64 = load i32, i32* %2
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i32, i32* %63, i64 %65
%67 = load i32, i32* %66
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %67)
br label %69
69: ; preds = %57
%70 = load i32, i32* %2
%71 = add nsw i32 %70, 1
store i32 %71, i32* %2
br label %53
72: ; preds = %53
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %74
74: ; preds = %90, %72
%75 = load i32, i32* %2
%76 = load i32, i32* %5
%77 = icmp slt i32 %75, %76
br i1 %77, label %78, label %93
78: ; preds = %74
%79 = load i32, i32* %2
%80 = load i32*, i32** %3
%81 = load i32, i32* %2
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i32, i32* %80, i64 %82
store i32 %79, i32* %83
%84 = load i32*, i32** %3
%85 = load i32, i32* %2
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i32, i32* %84, i64 %86
%88 = load i32, i32* %87
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %88)
br label %90
90: ; preds = %78
%91 = load i32, i32* %2
%92 = add nsw i32 %91, 1
store i32 %92, i32* %2
br label %74
93: ; preds = %74
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%95 = load i32, i32* %1
ret i32 %95
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\09\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 16)
%2 = inttoptr i64 %1 to i32*
store i32 0, i32* %2
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = getelementptr inbounds i32, i32* %2, i64 1
store i32 1, i32* %4
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%6 = getelementptr inbounds i32, i32* %2, i64 2
store i32 2, i32* %6
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2)
%8 = getelementptr inbounds i32, i32* %2, i64 3
store i32 3, i32* %8
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%10 = tail call i32 @putchar(i32 10)
%11 = tail call i64 @malloc(i32 40)
%12 = inttoptr i64 %11 to i32*
%13 = tail call i32 @memcpy(i32* %12, i32* %2, i32 16)
%14 = tail call i32 @free(i32* %2)
%15 = getelementptr inbounds i32, i32* %12, i64 4
store i32 4, i32* %15
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4)
%17 = getelementptr inbounds i32, i32* %12, i64 5
store i32 5, i32* %17
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 5)
%19 = getelementptr inbounds i32, i32* %12, i64 6
store i32 6, i32* %19
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 6)
%21 = getelementptr inbounds i32, i32* %12, i64 7
store i32 7, i32* %21
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 7)
%23 = getelementptr inbounds i32, i32* %12, i64 8
store i32 8, i32* %23
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 8)
%25 = getelementptr inbounds i32, i32* %12, i64 9
store i32 9, i32* %25
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 9)
%27 = tail call i32 @putchar(i32 10)
store i32 0, i32* %12
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%29 = getelementptr inbounds i32, i32* %12, i64 1
store i32 1, i32* %29
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%31 = getelementptr inbounds i32, i32* %12, i64 2
store i32 2, i32* %31
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2)
%33 = getelementptr inbounds i32, i32* %12, i64 3
store i32 3, i32* %33
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
store i32 4, i32* %15
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4)
store i32 5, i32* %17
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 5)
store i32 6, i32* %19
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 6)
store i32 7, i32* %21
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 7)
store i32 8, i32* %23
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 8)
store i32 9, i32* %25
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 9)
%41 = tail call i32 @putchar(i32 10)
ret i32 0
}