#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 */
char EOF;
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char c;
  printf("Digite um caractere:\n");
  char c1 = getchar();
  while ((c = getchar()) != '\n' && c != EOF) {
  }
  printf("Digite um caractere:\n");
  char c2 = getchar();
  while ((c = getchar()) != '\n' && c != EOF) {
  }
  printf("Digite um caractere:\n");
  char c3 = getchar();
  while ((c = getchar()) != '\n' && c != EOF) {
  }
  printf(
      "Primeiro caractere: %c\nSegundo caractere: %c\nTerceiro caractere: %c\n",
      c1, c2, c3);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x6(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x9(%rbp)
je     1178 <main+0x58>
movsbl -0x5(%rbp),%eax
mov    0x2e7b(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1188 <main+0x68>
jmp    118d <main+0x6d>
jmp    1147 <main+0x27>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x7(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0xa(%rbp)
je     11d6 <main+0xb6>
movsbl -0x5(%rbp),%eax
mov    0x2e1d(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    11e6 <main+0xc6>
jmp    11eb <main+0xcb>
jmp    11a5 <main+0x85>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0xb(%rbp)
je     1234 <main+0x114>
movsbl -0x5(%rbp),%eax
mov    0x2dbf(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
test   $0x1,%al
jne    1244 <main+0x124>
jmp    1249 <main+0x129>
jmp    1203 <main+0xe3>
movsbl -0x6(%rbp),%esi
movsbl -0x7(%rbp),%edx
movsbl -0x8(%rbp),%ecx
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xf07(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%r15d
mov    0x2e94(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     1170 <main+0x40>
cmp    0x0(%rbp),%al
jne    1160 <main+0x30>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%r14d
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     11a0 <main+0x70>
cmp    0x0(%rbp),%al
jne    1190 <main+0x60>
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     11d0 <main+0xa0>
cmp    0x0(%rbp),%al
jne    11c0 <main+0x90>
movsbl %r15b,%esi
movsbl %r14b,%edx
movsbl %bl,%ecx
lea    0xe1e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Digite um caractere:\0A\00"
@EOF = global i8 0
@.str.1 = [69 x i8] c"Primeiro caractere: %c\0ASegundo caractere: %c\0ATerceiro caractere: %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = call signext i8 (...) @getchar()
store i8 %7, i8* %3
br label %8
8: ; preds = %20, %0
%9 = call signext i8 (...) @getchar()
store i8 %9, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 10
br i1 %11, label %12, label %18
12: ; preds = %8
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = load i8, i8* @EOF
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %14, %16
br label %18
18: ; preds = %12, %8
%19 = phi i1 [ false, %8 ], [ %17, %12 ]
br i1 %19, label %20, label %21
20: ; preds = %18
br label %8
21: ; preds = %18
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%23 = call signext i8 (...) @getchar()
store i8 %23, i8* %4
br label %24
24: ; preds = %36, %21
%25 = call signext i8 (...) @getchar()
store i8 %25, i8* %2
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 10
br i1 %27, label %28, label %34
28: ; preds = %24
%29 = load i8, i8* %2
%30 = sext i8 %29 to i32
%31 = load i8, i8* @EOF
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %30, %32
br label %34
34: ; preds = %28, %24
%35 = phi i1 [ false, %24 ], [ %33, %28 ]
br i1 %35, label %36, label %37
36: ; preds = %34
br label %24
37: ; preds = %34
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%39 = call signext i8 (...) @getchar()
store i8 %39, i8* %5
br label %40
40: ; preds = %52, %37
%41 = call signext i8 (...) @getchar()
store i8 %41, i8* %2
%42 = sext i8 %41 to i32
%43 = icmp ne i32 %42, 10
br i1 %43, label %44, label %50
44: ; preds = %40
%45 = load i8, i8* %2
%46 = sext i8 %45 to i32
%47 = load i8, i8* @EOF
%48 = sext i8 %47 to i32
%49 = icmp ne i32 %46, %48
br label %50
50: ; preds = %44, %40
%51 = phi i1 [ false, %40 ], [ %49, %44 ]
br i1 %51, label %52, label %53
52: ; preds = %50
br label %40
53: ; preds = %50
%54 = load i8, i8* %3
%55 = sext i8 %54 to i32
%56 = load i8, i8* %4
%57 = sext i8 %56 to i32
%58 = load i8, i8* %5
%59 = sext i8 %58 to i32
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0), i32 %55, i32 %57, i32 %59)
%61 = load i32, i32* %1
ret i32 %61
}

LLVM IR (-O2):
@EOF = global i8 0
@.str.1 = [69 x i8] c"Primeiro caractere: %c\0ASegundo caractere: %c\0ATerceiro caractere: %c\0A\00"
@str.3 = [21 x i8] c"Digite um caractere:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.3, i64 0, i64 0))
%2 = tail call signext i8 (...) @getchar()
br label %3
3: ; preds = %3, %0
%4 = tail call signext i8 (...) @getchar()
%5 = icmp ne i8 %4, 10
%6 = load i8, i8* @EOF
%7 = icmp ne i8 %4, %6
%8 = select i1 %5, i1 %7, i1 false
br i1 %8, label %3, label %9
9: ; preds = %3
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.3, i64 0, i64 0))
%11 = tail call signext i8 (...) @getchar()
br label %12
12: ; preds = %12, %9
%13 = tail call signext i8 (...) @getchar()
%14 = icmp ne i8 %13, 10
%15 = load i8, i8* @EOF
%16 = icmp ne i8 %13, %15
%17 = select i1 %14, i1 %16, i1 false
br i1 %17, label %12, label %18
18: ; preds = %12
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.3, i64 0, i64 0))
%20 = tail call signext i8 (...) @getchar()
br label %21
21: ; preds = %21, %18
%22 = tail call signext i8 (...) @getchar()
%23 = icmp ne i8 %22, 10
%24 = load i8, i8* @EOF
%25 = icmp ne i8 %22, %24
%26 = select i1 %23, i1 %25, i1 false
br i1 %26, label %21, label %27
27: ; preds = %21
%28 = sext i8 %2 to i32
%29 = sext i8 %11 to i32
%30 = sext i8 %20 to i32
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0), i32 %28, i32 %29, i32 %30)
ret i32 0
}