#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 getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ sleep(int);
void tudo_bem(void) {
  printf("\nTudo otimo, e com voce?\n");
  putchar('\n');
  sleep(2);
  printf("\e[H\e[2J");
  printf("1. Uma bosta\n");
  printf("2. Tudo bem\n");
  while (getchar() == '\n')
    ;
  printf("\e[H\e[2J");
  printf("\nAhh...\n");
  sleep(2);
  printf("\e[H\e[2J");
  return;
}


x86 assembly (clang, -O0):
<tudo_bem>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2,%edi
call   1060 <sleep@plt>
lea    0xeaf(%rip),%rdi
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
jne    11a0 <tudo_bem+0x60>
jmp    1188 <tudo_bem+0x48>
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x2,%edi
call   1060 <sleep@plt>
lea    0xe51(%rip),%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tudo_bem>:
push   %rbx
lea    0xeb0(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2,%edi
call   1070 <sleep@plt>
lea    0xe88(%rip),%rdi
call   1050 <printf@plt>
lea    0xe9d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9e(%rip),%rdi
call   1040 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%al
je     11a0 <tudo_bem+0x50>
lea    0xe4e(%rip),%rbx
mov    %rbx,%rdi
call   1050 <printf@plt>
lea    0xe79(%rip),%rdi
call   1040 <puts@plt>
mov    $0x2,%edi
call   1070 <sleep@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"\0ATudo otimo, e com voce?\0A\00"
@.str.1 = [8 x i8] c"\1B[H\1B[2J\00"
@.str.2 = [14 x i8] c"1. Uma bosta\0A\00"
@.str.3 = [13 x i8] c"2. Tudo bem\0A\00"
@.str.4 = [9 x i8] c"\0AAhh...\0A\00"
define void @tudo_bem() {
%1 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @putchar(i8 signext 10)
%3 = call i32 @sleep(i32 2)
%4 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %7
7: ; preds = %11, %0
%8 = call signext i8 (...) @getchar()
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 10
br i1 %10, label %11, label %12
11: ; preds = %7
br label %7
12: ; preds = %7
%13 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @sleep(i32 2)
%16 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"\1B[H\1B[2J\00"
@str = [25 x i8] c"\0ATudo otimo, e com voce?\00"
@str.5 = [13 x i8] c"1. Uma bosta\00"
@str.6 = [12 x i8] c"2. Tudo bem\00"
@str.7 = [8 x i8] c"\0AAhh...\00"
define void @tudo_bem() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @putchar(i8 signext 10)
%3 = tail call i32 @sleep(i32 2)
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.5, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.6, i64 0, i64 0))
br label %7
7: ; preds = %7, %0
%8 = tail call signext i8 (...) @getchar()
%9 = icmp eq i8 %8, 10
br i1 %9, label %7, label %10
10: ; preds = %7
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.7, i64 0, i64 0))
%13 = tail call i32 @sleep(i32 2)
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret void
}