#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*/ copia(int *, int, int *);
int /*<<< orphan*/ free(int *);
int *malloc(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int tam = 3;
  int *vet = malloc(tam * sizeof(int));
  int *novo = malloc(tam * sizeof(int));
  vet[0] = 1;
  vet[1] = 2;
  vet[2] = 3;
  copia(vet, tam, novo);
  printf("0 -> %d\n", novo[0]);
  printf("1 -> %d\n", novo[1]);
  printf("2 -> %d\n", novo[2]);
  free(novo);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x3,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2,0x4(%rax)
mov    -0x10(%rbp),%rax
movl   $0x3,0x8(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1040 <copia@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe4e(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%esi
lea    0xe44(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%esi
lea    0xe3a(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xc,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    $0xc,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
movabs $0x200000001,%rax
mov    %rax,(%rbx)
movl   $0x3,0x8(%rbx)
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %r14,%rdx
call   1040 <copia@plt>
mov    (%r14),%esi
lea    0xe74(%rip),%rdi
call   1050 <printf@plt>
mov    0x4(%r14),%esi
lea    0xe6d(%rip),%rdi
call   1050 <printf@plt>
mov    0x8(%r14),%esi
lea    0xe66(%rip),%rdi
call   1050 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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