#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*/ printf(char *, int, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  int *vetor1, *vetor2;
  int idx;
  vetor1 = (int *)malloc(5 * sizeof(int));
  vetor2 = (int *)malloc(5 * sizeof(int));
  for (idx = 0; idx < 5; idx++) {
    printf("Posição [%d]: ", idx);
    scanf("%d", vetor1 + idx);
    vetor2[idx] = vetor1[idx] * 3;
  }
  for (idx = 0; idx < 5; idx++) {
    printf("Vetor1 [%d]: %d\n", idx, vetor1[idx]);
    printf("Vetor2 [%d]: %d\n", idx, vetor2[idx]);
  }
  free(vetor1);
  free(vetor2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x14,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x14,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    11d4 <main+0x94>
mov    -0x24(%rbp),%esi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe67(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
imul   $0x3,(%rax,%rcx,4),%edx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1179 <main+0x39>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    122b <main+0xeb>
mov    -0x24(%rbp),%esi
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11db <main+0x9b>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x14,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    $0x14,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
lea    0xe97(%rip),%r15
mov    %r15,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe95(%rip),%r12
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    (%rbx),%eax
lea    (%rax,%rax,2),%eax
mov    %eax,(%r14)
mov    %r15,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rbx),%rsi
mov    %r12,%rdi
call   1060 <scanf@plt>
mov    0x4(%rbx),%eax
lea    (%rax,%rax,2),%eax
mov    %eax,0x4(%r14)
mov    %r15,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rbx),%rsi
mov    %r12,%rdi
call   1060 <scanf@plt>
mov    0x8(%rbx),%eax
lea    (%rax,%rax,2),%eax
mov    %eax,0x8(%r14)
mov    %r15,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rbx),%rsi
mov    %r12,%rdi
call   1060 <scanf@plt>
mov    0xc(%rbx),%eax
lea    (%rax,%rax,2),%eax
mov    %eax,0xc(%r14)
mov    %r15,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rbx),%rsi
mov    %r12,%rdi
call   1060 <scanf@plt>
mov    0x10(%rbx),%eax
lea    (%rax,%rax,2),%eax
mov    %eax,0x10(%r14)
mov    (%rbx),%edx
lea    0xde8(%rip),%r15
mov    %r15,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r14),%edx
lea    0xde3(%rip),%r12
mov    %r12,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rbx),%edx
mov    %r15,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%r14),%edx
mov    %r12,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%edx
mov    %r15,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%r14),%edx
mov    %r12,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rbx),%edx
mov    %r15,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%r14),%edx
mov    %r12,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rbx),%edx
mov    %r15,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%r14),%edx
mov    %r12,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Posi\C3\A7\C3\A3o [%d]: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [17 x i8] c"Vetor1 [%d]: %d\0A\00"
@.str.3 = [17 x i8] c"Vetor2 [%d]: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i64 @malloc(i32 20)
%10 = inttoptr i64 %9 to i32*
store i32* %10, i32** %6
%11 = call i64 @malloc(i32 20)
%12 = inttoptr i64 %11 to i32*
store i32* %12, i32** %7
store i32 0, i32* %8
br label %13
13: ; preds = %34, %2
%14 = load i32, i32* %8
%15 = icmp slt i32 %14, 5
br i1 %15, label %16, label %37
16: ; preds = %13
%17 = load i32, i32* %8
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i32*, i32** %6
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = load i32*, i32** %6
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
%28 = load i32, i32* %27
%29 = mul nsw i32 %28, 3
%30 = load i32*, i32** %7
%31 = load i32, i32* %8
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
store i32 %29, i32* %33
br label %34
34: ; preds = %16
%35 = load i32, i32* %8
%36 = add nsw i32 %35, 1
store i32 %36, i32* %8
br label %13
37: ; preds = %13
store i32 0, i32* %8
br label %38
38: ; preds = %56, %37
%39 = load i32, i32* %8
%40 = icmp slt i32 %39, 5
br i1 %40, label %41, label %59
41: ; preds = %38
%42 = load i32, i32* %8
%43 = load i32*, i32** %6
%44 = load i32, i32* %8
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %43, i64 %45
%47 = load i32, i32* %46
%48 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %42, i32 %47)
%49 = load i32, i32* %8
%50 = load i32*, i32** %7
%51 = load i32, i32* %8
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32, i32* %50, i64 %52
%54 = load i32, i32* %53
%55 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %49, i32 %54)
br label %56
56: ; preds = %41
%57 = load i32, i32* %8
%58 = add nsw i32 %57, 1
store i32 %58, i32* %8
br label %38
59: ; preds = %38
%60 = load i32*, i32** %6
%61 = call i32 @free(i32* %60)
%62 = load i32*, i32** %7
%63 = call i32 @free(i32* %62)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Posi\C3\A7\C3\A3o [%d]: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [17 x i8] c"Vetor1 [%d]: %d\0A\00"
@.str.3 = [17 x i8] c"Vetor2 [%d]: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 20)
%4 = inttoptr i64 %3 to i32*
%5 = tail call i64 @malloc(i32 20)
%6 = inttoptr i64 %5 to i32*
%7 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 0)
%8 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%9 = load i32, i32* %4
%10 = mul nsw i32 %9, 3
store i32 %10, i32* %6
%11 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 1)
%12 = getelementptr inbounds i32, i32* %4, i64 1
%13 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = load i32, i32* %12
%15 = mul nsw i32 %14, 3
%16 = getelementptr inbounds i32, i32* %6, i64 1
store i32 %15, i32* %16
%17 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 2)
%18 = getelementptr inbounds i32, i32* %4, i64 2
%19 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%20 = load i32, i32* %18
%21 = mul nsw i32 %20, 3
%22 = getelementptr inbounds i32, i32* %6, i64 2
store i32 %21, i32* %22
%23 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 3)
%24 = getelementptr inbounds i32, i32* %4, i64 3
%25 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %24)
%26 = load i32, i32* %24
%27 = mul nsw i32 %26, 3
%28 = getelementptr inbounds i32, i32* %6, i64 3
store i32 %27, i32* %28
%29 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 4)
%30 = getelementptr inbounds i32, i32* %4, i64 4
%31 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %30)
%32 = load i32, i32* %30
%33 = mul nsw i32 %32, 3
%34 = getelementptr inbounds i32, i32* %6, i64 4
store i32 %33, i32* %34
%35 = load i32, i32* %4
%36 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 %35)
%37 = load i32, i32* %6
%38 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 %37)
%39 = load i32, i32* %12
%40 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 %39)
%41 = load i32, i32* %16
%42 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 %41)
%43 = load i32, i32* %18
%44 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 %43)
%45 = load i32, i32* %22
%46 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 2, i32 %45)
%47 = load i32, i32* %24
%48 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 %47)
%49 = load i32, i32* %28
%50 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 3, i32 %49)
%51 = load i32, i32* %30
%52 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 %51)
%53 = load i32, i32* %34
%54 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 4, i32 %53)
%55 = tail call i32 @free(i32* %4)
%56 = tail call i32 @free(i32* %6)
ret i32 0
}