#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 */
scalar_t__ EOF;
int obterLetraCorreta(char);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, char *);
int main(void) {
  char caractere;
  while (scanf("%c", &caractere) != EOF) {
    if (caractere == '\n') {
      printf("\n");
    } else {
      printf("%c", obterLetraCorreta(caractere));
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1050 <scanf@plt>
mov    0x2e92(%rip),%rcx
cmp    (%rcx),%rax
je     119d <main+0x6d>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    117f <main+0x4f>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1198 <main+0x68>
movsbl -0x5(%rbp),%edi
call   1040 <obterLetraCorreta@plt>
mov    %eax,%esi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x2e97(%rip),%r15
cmp    (%r15),%rax
jne    1162 <main+0x32>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe97(%rip),%r14
lea    0xf(%rsp),%rbx
jmp    1185 <main+0x55>
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
cmp    (%r15),%rax
je     1156 <main+0x26>
movzbl 0xf(%rsp),%eax
mov    $0xa,%edi
cmp    $0xa,%al
je     1170 <main+0x40>
movsbl %al,%edi
call   1040 <obterLetraCorreta@plt>
mov    %eax,%edi
jmp    1170 <main+0x40>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@EOF = global i64 0
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
br label %3
3: ; preds = %17, %0
%4 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = load i64, i64* @EOF
%6 = icmp ne i64 %4, %5
br i1 %6, label %7, label %18
7: ; preds = %3
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 10
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %17
13: ; preds = %7
%14 = load i8, i8* %2
%15 = call i32 @obterLetraCorreta(i8 signext %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %13, %11
br label %3
18: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@EOF = global i64 0
define i32 @main() {
%1 = alloca i8
%2 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = load i64, i64* @EOF
%4 = icmp eq i64 %2, %3
br i1 %4, label %16, label %5
5: ; preds = %0, %10
%6 = load i8, i8* %1
%7 = icmp eq i8 %6, 10
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = call i32 @obterLetraCorreta(i8 signext %6)
br label %10
10: ; preds = %5, %8
%11 = phi i32 [ %9, %8 ], [ 10, %5 ]
%12 = call i32 @putchar(i32 %11)
%13 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%14 = load i64, i64* @EOF
%15 = icmp eq i64 %13, %14
br i1 %15, label %16, label %5
16: ; preds = %10, %0
ret i32 0
}