#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*/ MostraTodos(char **);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char memoria[3][30];
  for (int i = 0; i < 3; i++) {
    printf("Introduza o seu nome\n");
    scanf("%s", &memoria[i][0]);
  }
  MostraTodos(memoria);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x64(%rbp)
cmpl   $0x3,-0x64(%rbp)
jge    1185 <main+0x55>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
movslq -0x64(%rbp),%rax
lea    -0x60(%rbp),%rsi
imul   $0x1e,%rax,%rax
add    %rax,%rsi
lea    0xea4(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1146 <main+0x16>
lea    -0x60(%rbp),%rdi
call   1050 <MostraTodos@plt>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
lea    0xec3(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xeb1(%rip),%r14
mov    %rsp,%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0x1e(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0x3c(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    %r15,%rdi
call   1050 <MostraTodos@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Introduza o seu nome\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x [30 x i8]]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %14, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 3
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [3 x [30 x i8]], [3 x [30 x i8]]* %2, i64 0, i64 %10
%12 = getelementptr inbounds [30 x i8], [30 x i8]* %11, i64 0, i64 0
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %7
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %4
17: ; preds = %4
%18 = getelementptr inbounds [3 x [30 x i8]], [3 x [30 x i8]]* %2, i64 0, i64 0
%19 = bitcast [30 x i8]* %18 to i8**
%20 = call i32 @MostraTodos(i8** %19)
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@str = [21 x i8] c"Introduza o seu nome\00"
define i32 @main() {
%1 = alloca [3 x [30 x i8]]
%2 = getelementptr inbounds [3 x [30 x i8]], [3 x [30 x i8]]* %1, i64 0, i64 0, i64 0
%3 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%6 = getelementptr inbounds [3 x [30 x i8]], [3 x [30 x i8]]* %1, i64 0, i64 1, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%9 = getelementptr inbounds [3 x [30 x i8]], [3 x [30 x i8]]* %1, i64 0, i64 2, i64 0
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = bitcast [3 x [30 x i8]]* %1 to i8**
%12 = call i32 @MostraTodos(i8** %11)
ret i32 0
}