#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*/ __fpurge(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ system(char *);
int tela_inicial() {
  char senha[100];
  system("clear");
  printf("Programa do Sistema da Biblioteca\n\n");
  printf("\tPara fazer cadastro digite sua SENHA.\n");
  printf("\tAperte ENTER para realizar empréstimos.\n");
  printf("\tPrecione 's' para SAIR do Programa\n");
  scanf("%[^\n]s", senha);
  __fpurge(stdin);
  if (!strcmp(senha, "mac")) {
    return 0;
  } else if (!strcmp(senha, "s")) {
    return 2;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<tela_inicial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    0xea1(%rip),%rdi
call   1040 <system@plt>
lea    0xe9b(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb3(%rip),%rdi
call   1050 <printf@plt>
lea    0xecf(%rip),%rdi
call   1050 <printf@plt>
lea    0xeee(%rip),%rdi
call   1050 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xf03(%rip),%rdi
call   1070 <scanf@plt>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
call   1030 <__fpurge@plt>
lea    -0x70(%rbp),%rdi
lea    0xeec(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    11d7 <tela_inicial+0x87>
movl   $0x0,-0x4(%rbp)
jmp    1203 <tela_inicial+0xb3>
lea    -0x70(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    11fc <tela_inicial+0xac>
movl   $0x2,-0x4(%rbp)
jmp    1203 <tela_inicial+0xb3>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tela_inicial>:
sub    $0x68,%rsp
lea    0xeb5(%rip),%rdi
call   1050 <system@plt>
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf06(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7f(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
call   1040 <__fpurge@plt>
mov    (%rsp),%ecx
xor    %edx,%edx
cmp    $0x73,%cx
sete   %dl
add    $0x1,%edx
xor    %eax,%eax
cmp    $0x63616d,%ecx
cmovne %edx,%eax
add    $0x68,%rsp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [36 x i8] c"Programa do Sistema da Biblioteca\0A\0A\00"
@.str.2 = [40 x i8] c"\09Para fazer cadastro digite sua SENHA.\0A\00"
@.str.3 = [43 x i8] c"\09Aperte ENTER para realizar empr\C3\A9stimos.\0A\00"
@.str.4 = [37 x i8] c"\09Precione 's' para SAIR do Programa\0A\00"
@.str.5 = [7 x i8] c"%[^\0A]s\00"
@stdin = global i32 0
@.str.6 = [4 x i8] c"mac\00"
@.str.7 = [2 x i8] c"s\00"
define i32 @tela_inicial() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @stdin
%11 = call i32 @__fpurge(i32 %10)
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%13 = call i32 @strcmp(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %0
store i32 0, i32* %1
br label %22
16: ; preds = %0
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%18 = call i32 @strcmp(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %16
store i32 2, i32* %1
br label %22
21: ; preds = %16
store i32 1, i32* %1
br label %22
22: ; preds = %21, %20, %15
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.5 = [7 x i8] c"%[^\0A]s\00"
@stdin = global i32 0
@str = [35 x i8] c"Programa do Sistema da Biblioteca\0A\00"
@str.8 = [39 x i8] c"\09Para fazer cadastro digite sua SENHA.\00"
@str.9 = [42 x i8] c"\09Aperte ENTER para realizar empr\C3\A9stimos.\00"
@str.10 = [36 x i8] c"\09Precione 's' para SAIR do Programa\00"
define i32 @tela_inicial() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.8, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.9, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.10, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %2)
%9 = load i32, i32* @stdin
%10 = call i32 @__fpurge(i32 %9)
%11 = bitcast [100 x i8]* %1 to i32*
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 6513005
%14 = trunc i32 %12 to i16
%15 = icmp eq i16 %14, 115
%16 = select i1 %15, i32 2, i32 1
%17 = select i1 %13, i32 0, i32 %16
ret i32 %17
}