#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*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char opcao = ' ';
  printf("Digite um numero de 0 a 9 (if simples): ");
  scanf("%c", &opcao);
  if (opcao == '0') {
    printf("Opcao digitada foi ZERO!\n");
  }
  getchar();
  char opcao2 = ' ';
  printf("Digite um numero de 0 a 9 (if com E): ");
  scanf("%c", &opcao2);
  if ((opcao2 != '0') && (opcao2 != '1')) {
    printf("Opcao digitada diferente de ZERO e UM!\n");
  }
  getchar();
  char opcao3 = ' ';
  printf("Digite um numero de 0 a 9 (if com OU): ");
  scanf("%c", &opcao3);
  if ((opcao3 == '0') || (opcao3 == '9')) {
    printf("Opcao digitada igual a ZERO ou igual a NOVE!\n");
  }
  getchar();
  char opcao4 = ' ';
  printf("Digite um numero de 0 a 9 (if com else): ");
  scanf("%c", &opcao4);
  if (opcao4 == '0') {
    printf("Opcao digitada igual a ZERO!\n");
  } else {
    printf("Opcao digitada diferente de ZERO!\n");
  }
  getchar();
  char opcao5 = ' ';
  printf("Digite um numero de 0 a 9 (if com else if): ");
  scanf("%c", &opcao5);
  if (opcao5 == '0') {
    printf("Opcao digitada igual a ZERO!\n");
  } else if (opcao5 == '1') {
    printf("Opcao digitada igual a UM!\n");
  } else {
    printf("Opcao digitada diferente de ZERO e UM!\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x20,-0x5(%rbp)
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jne    1178 <main+0x48>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movb   $0x20,-0x6(%rbp)
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
lea    0xe93(%rip),%rdi
lea    -0x6(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x6(%rbp),%eax
cmp    $0x30,%eax
je     11c5 <main+0x95>
movsbl -0x6(%rbp),%eax
cmp    $0x31,%eax
je     11c5 <main+0x95>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movb   $0x20,-0x7(%rbp)
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
lea    0xe46(%rip),%rdi
lea    -0x7(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x7(%rbp),%eax
cmp    $0x30,%eax
je     1206 <main+0xd6>
movsbl -0x7(%rbp),%eax
cmp    $0x39,%eax
jne    1212 <main+0xe2>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movb   $0x20,-0x8(%rbp)
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
lea    0xdf9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x8(%rbp),%eax
cmp    $0x30,%eax
jne    1257 <main+0x127>
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
jmp    1263 <main+0x133>
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movb   $0x20,-0x9(%rbp)
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
lea    0xda8(%rip),%rdi
lea    -0x9(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x9(%rbp),%eax
cmp    $0x30,%eax
jne    12a8 <main+0x178>
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
jmp    12d7 <main+0x1a7>
movsbl -0x9(%rbp),%eax
cmp    $0x31,%eax
jne    12c6 <main+0x196>
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <main+0x1a2>
lea    0xda0(%rip),%rdi
call   1030 <printf@plt>
jmp    12d7 <main+0x1a7>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movb   $0x20,0x7(%rsp)
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1060 <scanf@plt>
cmpb   $0x30,0x7(%rsp)
jne    1179 <main+0x39>
lea    0x100c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
movb   $0x20,0x6(%rsp)
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
lea    0xe91(%rip),%rdi
lea    0x6(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x6(%rsp),%al
and    $0xfe,%al
cmp    $0x30,%al
je     11b8 <main+0x78>
lea    0xfa6(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
movb   $0x20,0x5(%rsp)
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
lea    0xe52(%rip),%rdi
lea    0x5(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x5(%rsp),%al
cmp    $0x39,%al
je     11ed <main+0xad>
cmp    $0x30,%al
jne    11f9 <main+0xb9>
lea    0xf38(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
movb   $0x20,0x4(%rsp)
lea    0xe6f(%rip),%rdi
call   1040 <printf@plt>
lea    0xe11(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
cmpb   $0x30,0x4(%rsp)
lea    0xede(%rip),%r14
lea    0xe9a(%rip),%rdi
cmove  %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
movb   $0x20,0x3(%rsp)
lea    0xe51(%rip),%rdi
call   1040 <printf@plt>
lea    0x3(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    0x3(%rsp),%al
cmp    $0x31,%al
lea    0xe81(%rip),%rcx
lea    0xedf(%rip),%rdi
cmove  %rcx,%rdi
cmp    $0x30,%al
cmove  %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Digite um numero de 0 a 9 (if simples): \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [26 x i8] c"Opcao digitada foi ZERO!\0A\00"
@.str.3 = [39 x i8] c"Digite um numero de 0 a 9 (if com E): \00"
@.str.4 = [40 x i8] c"Opcao digitada diferente de ZERO e UM!\0A\00"
@.str.5 = [40 x i8] c"Digite um numero de 0 a 9 (if com OU): \00"
@.str.6 = [46 x i8] c"Opcao digitada igual a ZERO ou igual a NOVE!\0A\00"
@.str.7 = [42 x i8] c"Digite um numero de 0 a 9 (if com else): \00"
@.str.8 = [30 x i8] c"Opcao digitada igual a ZERO!\0A\00"
@.str.9 = [35 x i8] c"Opcao digitada diferente de ZERO!\0A\00"
@.str.10 = [45 x i8] c"Digite um numero de 0 a 9 (if com else if): \00"
@.str.11 = [28 x i8] c"Opcao digitada igual a UM!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i32 0, i32* %1
store i8 32, i8* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 48
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %12, %0
%15 = call i32 (...) @getchar()
store i8 32, i8* %3
%16 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%18 = load i8, i8* %3
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 48
br i1 %20, label %21, label %27
21: ; preds = %14
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 49
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
br label %27
27: ; preds = %25, %21, %14
%28 = call i32 (...) @getchar()
store i8 32, i8* %4
%29 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%31 = load i8, i8* %4
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 48
br i1 %33, label %38, label %34
34: ; preds = %27
%35 = load i8, i8* %4
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 57
br i1 %37, label %38, label %40
38: ; preds = %34, %27
%39 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
br label %40
40: ; preds = %38, %34
%41 = call i32 (...) @getchar()
store i8 32, i8* %5
%42 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0))
%43 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%44 = load i8, i8* %5
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 48
br i1 %46, label %47, label %49
47: ; preds = %40
%48 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
br label %51
49: ; preds = %40
%50 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0))
br label %51
51: ; preds = %49, %47
%52 = call i32 (...) @getchar()
store i8 32, i8* %6
%53 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.10, i64 0, i64 0))
%54 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%55 = load i8, i8* %6
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 48
br i1 %57, label %58, label %60
58: ; preds = %51
%59 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
br label %69
60: ; preds = %51
%61 = load i8, i8* %6
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 49
br i1 %63, label %64, label %66
64: ; preds = %60
%65 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0))
br label %68
66: ; preds = %60
%67 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
br label %68
68: ; preds = %66, %64
br label %69
69: ; preds = %68, %58
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"Digite um numero de 0 a 9 (if simples): \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.3 = [39 x i8] c"Digite um numero de 0 a 9 (if com E): \00"
@.str.5 = [40 x i8] c"Digite um numero de 0 a 9 (if com OU): \00"
@.str.7 = [42 x i8] c"Digite um numero de 0 a 9 (if com else): \00"
@.str.10 = [45 x i8] c"Digite um numero de 0 a 9 (if com else if): \00"
@str = [34 x i8] c"Opcao digitada diferente de ZERO!\00"
@str.13 = [27 x i8] c"Opcao digitada igual a UM!\00"
@str.15 = [29 x i8] c"Opcao digitada igual a ZERO!\00"
@str.16 = [45 x i8] c"Opcao digitada igual a ZERO ou igual a NOVE!\00"
@str.17 = [39 x i8] c"Opcao digitada diferente de ZERO e UM!\00"
@str.18 = [25 x i8] c"Opcao digitada foi ZERO!\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
store i8 32, i8* %1
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%8 = load i8, i8* %1
%9 = icmp eq i8 %8, 48
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.18, i64 0, i64 0))
br label %12
12: ; preds = %10, %0
%13 = call i32 (...) @getchar()
store i8 32, i8* %2
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%16 = load i8, i8* %2
%17 = and i8 %16, -2
%18 = icmp eq i8 %17, 48
br i1 %18, label %21, label %19
19: ; preds = %12
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.17, i64 0, i64 0))
br label %21
21: ; preds = %19, %12
%22 = call i32 (...) @getchar()
store i8 32, i8* %3
%23 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%25 = load i8, i8* %3
switch i8 %25, label %28 [
i8 57, label %26
i8 48, label %26
]
26: ; preds = %21, %21
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.16, i64 0, i64 0))
br label %28
28: ; preds = %21, %26
%29 = call i32 (...) @getchar()
store i8 32, i8* %4
%30 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0))
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%32 = load i8, i8* %4
%33 = icmp eq i8 %32, 48
%34 = select i1 %33, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @str.15, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0)
%35 = call i32 @puts(i8* dereferenceable(1) %34)
%36 = call i32 (...) @getchar()
store i8 32, i8* %5
%37 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.10, i64 0, i64 0))
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%39 = load i8, i8* %5
%40 = icmp eq i8 %39, 49
%41 = select i1 %40, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str.13, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @str.17, i64 0, i64 0)
%42 = icmp eq i8 %39, 48
%43 = select i1 %42, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @str.15, i64 0, i64 0), i8* %41
%44 = call i32 @puts(i8* dereferenceable(1) %43)
ret i32 0
}