#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 leDados(int /*<<< orphan*/, int, char **);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
int main(void) {
  char palavras[10][31];
  int numPalavras = leDados(stdin, 10, palavras);
  for (int i = 0; i < numPalavras; i++)
    printf("%s\n", palavras[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
lea    -0x140(%rbp),%rdx
mov    $0xa,%esi
call   1040 <leDados@plt>
mov    %eax,-0x144(%rbp)
movl   $0x0,-0x148(%rbp)
mov    -0x148(%rbp),%eax
cmp    -0x144(%rbp),%eax
jge    11a3 <main+0x83>
movslq -0x148(%rbp),%rax
lea    -0x140(%rbp),%rsi
imul   $0x1f,%rax,%rax
add    %rax,%rsi
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
mov    -0x148(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x148(%rbp)
jmp    115c <main+0x3c>
mov    -0x4(%rbp),%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x140,%rsp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%r15
mov    $0xa,%esi
mov    %r15,%rdx
call   1040 <leDados@plt>
test   %eax,%eax
jle    1175 <main+0x55>
mov    %eax,%ebx
lea    0xeae(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
add    $0x1f,%r15
add    $0xffffffffffffffff,%rbx
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x140,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@stdin = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [10 x [31 x i8]]
%2 = getelementptr inbounds [10 x [31 x i8]], [10 x [31 x i8]]* %1, i64 0, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = bitcast [10 x [31 x i8]]* %1 to i8**
%5 = call i32 @leDados(i32 %3, i32 10, i8** %4)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = zext i32 %5 to i64
br label %10
9: ; preds = %10, %0
ret i32 0
10: ; preds = %7, %10
%11 = phi i64 [ 0, %7 ], [ %14, %10 ]
%12 = getelementptr inbounds [10 x [31 x i8]], [10 x [31 x i8]]* %1, i64 0, i64 %11, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = add nuw nsw i64 %11, 1
%15 = icmp eq i64 %14, %8
br i1 %15, label %9, label %10
}