#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 detecta(char);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char letra;
  printf("Programa que detecta se a letra e maiuscula e ou minuscula");
  printf("\nDigite uma letra: ");
  scanf("%c", &letra);
  int x = detecta(letra);
  if (x == 0)
    printf("\nA letra digitada e minuscula!");
  else if (x == 1)
    printf("\nA letra digitada e maiscula!");
  else if (x == -1)
    printf("\nA letra digitada não pertence ao alfabeto");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%edi
call   1050 <detecta@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    118e <main+0x5e>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
jmp    11c9 <main+0x99>
cmpl   $0x1,-0xc(%rbp)
jne    11a9 <main+0x79>
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
jmp    11c4 <main+0x94>
cmpl   $0xffffffff,-0xc(%rbp)
jne    11bf <main+0x8f>
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
jmp    11c4 <main+0x94>
jmp    11c9 <main+0x99>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
movsbl 0x7(%rsp),%edi
call   1050 <detecta@plt>
add    $0x1,%eax
cmp    $0x2,%eax
ja     1181 <main+0x51>
cltq
lea    0xf47(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [59 x i8] c"Programa que detecta se a letra e maiuscula e ou minuscula\00"
@.str.1 = [20 x i8] c"\0ADigite uma letra: \00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [31 x i8] c"\0AA letra digitada e minuscula!\00"
@.str.4 = [30 x i8] c"\0AA letra digitada e maiscula!\00"
@.str.5 = [44 x i8] c"\0AA letra digitada n\C3\A3o pertence ao alfabeto\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%7 = load i8, i8* %2
%8 = call i32 @detecta(i8 signext %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %25
13: ; preds = %0
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
br label %24
18: ; preds = %13
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
br label %23
23: ; preds = %21, %18
br label %24
24: ; preds = %23, %16
br label %25
25: ; preds = %24, %11
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
@.str = [59 x i8] c"Programa que detecta se a letra e maiuscula e ou minuscula\00"
@.str.1 = [20 x i8] c"\0ADigite uma letra: \00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [31 x i8] c"\0AA letra digitada e minuscula!\00"
@.str.4 = [30 x i8] c"\0AA letra digitada e maiscula!\00"
@.str.5 = [44 x i8] c"\0AA letra digitada n\C3\A3o pertence ao alfabeto\00"
@reltable.main = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([44 x i8]* @.str.5 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([31 x i8]* @.str.3 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([30 x i8]* @.str.4 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%5 = load i8, i8* %1
%6 = call i32 @detecta(i8 signext %5)
%7 = add i32 %6, 1
%8 = icmp ult i32 %7, 3
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = sext i32 %7 to i64
%11 = shl i64 %10, 2
%12 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.main to i8*), i64 %11)
%13 = call i32 @printf(i8* dereferenceable(1) %12)
br label %14
14: ; preds = %0, %9
ret i32 0
}