#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  printf("Digite algo");
  scanf("%d", &n);
  switch (n) {
  case 1:
    printf("Digitou 1");
    break;
  case 2:
    printf("Digitou 2");
    break;
  default:
    printf("Digitou outro numero diferente de 1 e 2");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     1170 <main+0x50>
jmp    115f <main+0x3f>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1181 <main+0x61>
jmp    1192 <main+0x72>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
jmp    119e <main+0x7e>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
jmp    119e <main+0x7e>
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
lea    0xecd(%rip),%rcx
lea    0xed0(%rip),%rdx
cmove  %rcx,%rdx
cmp    $0x1,%eax
lea    0xeae(%rip),%rdi
cmovne %rdx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Digite algo\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c"Digitou 1\00"
@.str.3 = [10 x i8] c"Digitou 2\00"
@.str.4 = [40 x i8] c"Digitou outro numero diferente de 1 e 2\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
switch i32 %5, label %10 [
i32 1, label %6
i32 2, label %8
]
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %12
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
br label %12
12: ; preds = %10, %8, %6
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Digite algo\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c"Digitou 1\00"
@.str.3 = [10 x i8] c"Digitou 2\00"
@.str.4 = [40 x i8] c"Digitou outro numero diferente de 1 e 2\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 2
%7 = select i1 %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0)
%8 = icmp eq i32 %5, 1
%9 = select i1 %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %7
%10 = call i32 @printf(i8* dereferenceable(1) %9)
ret i32 0
}