#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*/ leValidaNome(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int strlen(char *);
char tolower(char);
char toupper(char);
int main() {
  char nomes[2][30];
  for (int i = 0; i < 2; i++)
    leValidaNome(nomes[i]);
  for (int j = 0; j < strlen(nomes[0]); j++)
    nomes[0][j] = toupper(nomes[0][j]);
  for (int i = 1; i < 2; i++) {
    for (int j = 0; j < strlen(nomes[i]); j++)
      nomes[i][j] = tolower(nomes[i][j]);
  }
  printf("\n%s\n%s", nomes[0], nomes[1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x2,-0x44(%rbp)
jge    1192 <main+0x42>
movslq -0x44(%rbp),%rax
lea    -0x40(%rbp),%rdi
imul   $0x1e,%rax,%rax
add    %rax,%rdi
call   1050 <leValidaNome@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1166 <main+0x16>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x54(%rbp)
lea    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
cmp    %ecx,%eax
jge    11db <main+0x8b>
movslq -0x48(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%edi
call   1030 <toupper@plt>
mov    %al,%cl
movslq -0x48(%rbp),%rax
mov    %cl,-0x40(%rbp,%rax,1)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1199 <main+0x49>
movl   $0x1,-0x4c(%rbp)
cmpl   $0x2,-0x4c(%rbp)
jge    126f <main+0x11f>
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x58(%rbp)
movslq -0x4c(%rbp),%rax
lea    -0x40(%rbp),%rdi
imul   $0x1e,%rax,%rax
add    %rax,%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x58(%rbp),%eax
cmp    %ecx,%eax
jge    125c <main+0x10c>
movslq -0x4c(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0x1e,%rcx,%rcx
add    %rcx,%rax
movslq -0x50(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1070 <tolower@plt>
mov    %al,%dl
movslq -0x4c(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0x1e,%rcx,%rcx
add    %rcx,%rax
movslq -0x50(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    11f3 <main+0xa3>
jmp    1261 <main+0x111>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    11e2 <main+0x92>
lea    -0x40(%rbp),%rsi
lea    -0x40(%rbp),%rdx
add    $0x1e,%rdx
lea    0xd7e(%rip),%rdi
call   1060 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <leValidaNome@plt>
lea    0x1e(%rsp),%r14
mov    %r14,%rdi
call   1050 <leValidaNome@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11af <main+0x5f>
xor    %ebx,%ebx
mov    %rsp,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%rsp,%rbx,1),%edi
call   1030 <toupper@plt>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1190 <main+0x40>
mov    %r14,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11e1 <main+0x91>
xor    %ebx,%ebx
nopl   (%rax)
movsbl 0x1e(%rsp,%rbx,1),%edi
call   1070 <tolower@plt>
mov    %al,0x1e(%rsp,%rbx,1)
add    $0x1,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     11c0 <main+0x70>
lea    0xe18(%rip),%rdi
mov    %rsp,%rsi
mov    %r14,%rdx
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"\0A%s\0A%s\00"
define i32 @main() {
%1 = alloca [2 x [30 x i8]]
%2 = getelementptr inbounds [2 x [30 x i8]], [2 x [30 x i8]]* %1, i64 0, i64 0, i64 0
%3 = call i32 @leValidaNome(i8* %2)
%4 = getelementptr inbounds [2 x [30 x i8]], [2 x [30 x i8]]* %1, i64 0, i64 1, i64 0
%5 = call i32 @leValidaNome(i8* %4)
%6 = call i32 @strlen(i8* %2)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %11, %0
%9 = call i32 @strlen(i8* %4)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %22, label %20
11: ; preds = %0, %11
%12 = phi i64 [ %16, %11 ], [ 0, %0 ]
%13 = getelementptr inbounds [2 x [30 x i8]], [2 x [30 x i8]]* %1, i64 0, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = call signext i8 @toupper(i8 signext %14)
store i8 %15, i8* %13
%16 = add nuw nsw i64 %12, 1
%17 = call i32 @strlen(i8* %2)
%18 = sext i32 %17 to i64
%19 = icmp slt i64 %16, %18
br i1 %19, label %11, label %8
20: ; preds = %22, %8
%21 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %4)
ret i32 0
22: ; preds = %8, %22
%23 = phi i64 [ %27, %22 ], [ 0, %8 ]
%24 = getelementptr inbounds [2 x [30 x i8]], [2 x [30 x i8]]* %1, i64 0, i64 1, i64 %23
%25 = load i8, i8* %24
%26 = call signext i8 @tolower(i8 signext %25)
store i8 %26, i8* %24
%27 = add nuw nsw i64 %23, 1
%28 = call i32 @strlen(i8* %4)
%29 = sext i32 %28 to i64
%30 = icmp slt i64 %27, %29
br i1 %30, label %22, label %20
}