#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(void) {
  int x;
  printf("Digite a opcao 1, 2 ou 3: ");
  scanf("%d", &x);
  if (x == 1)
    printf("primeira opcao\n");
  if (x = 2)
    printf("segunda opcao\n");
  if (x == 3)
    printf("terceira opcao\n");
  printf("Opcao selecionada %d \n", x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    1165 <main+0x45>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0x8(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    117b <main+0x5b>
jmp    1189 <main+0x69>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
jne    11a1 <main+0x81>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x1,0x4(%rsp)
jne    1163 <main+0x33>
lea    0xef4(%rip),%rdi
call   1030 <puts@plt>
movl   $0x2,0x4(%rsp)
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%esi
cmp    $0x3,%esi
jne    1190 <main+0x60>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%esi
lea    0xe87(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Digite a opcao 1, 2 ou 3: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"primeira opcao\0A\00"
@.str.3 = [15 x i8] c"segunda opcao\0A\00"
@.str.4 = [16 x i8] c"terceira opcao\0A\00"
@.str.5 = [23 x i8] c"Opcao selecionada %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 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
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
store i32 2, i32* %2
br i1 true, label %10, label %12
10: ; preds = %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %12
12: ; preds = %10, %9
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 3
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
%18 = load i32, i32* %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@.str = [27 x i8] c"Digite a opcao 1, 2 ou 3: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.5 = [23 x i8] c"Opcao selecionada %d \0A\00"
@str = [14 x i8] c"segunda opcao\00"
@str.6 = [15 x i8] c"terceira opcao\00"
@str.7 = [15 x i8] c"primeira opcao\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 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, 1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.7, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
store i32 2, i32* %1
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%11 = load i32, i32* %1
%12 = icmp eq i32 %11, 3
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.6, i64 0, i64 0))
%15 = load i32, i32* %1
br label %16
16: ; preds = %13, %9
%17 = phi i32 [ %15, %13 ], [ %11, %9 ]
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %17)
ret i32 0
}