#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 */
char *armazenando_texto();
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ opcao_1(char *);
int /*<<< orphan*/ opcao_2(char *);
int /*<<< orphan*/ opcao_3(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  char *texto;
  int op;
  texto = armazenando_texto();
  scanf("%d", &op);
  switch (op) {
  case 1:
    opcao_1(texto);
    break;
  case 2:
    opcao_2(texto);
    break;
  case 3:
    opcao_3(texto);
    break;
  }
  free(texto);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
call   1030 <armazenando_texto@plt>
mov    %rax,-0x10(%rbp)
lea    0xe7f(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x1,%eax
je     11c0 <main+0x60>
jmp    119e <main+0x3e>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     11ce <main+0x6e>
jmp    11af <main+0x4f>
mov    -0x18(%rbp),%eax
sub    $0x3,%eax
je     11dc <main+0x7c>
jmp    11e5 <main+0x85>
mov    -0x10(%rbp),%rdi
call   1060 <opcao_1@plt>
jmp    11e5 <main+0x85>
mov    -0x10(%rbp),%rdi
call   1080 <opcao_2@plt>
jmp    11e5 <main+0x85>
mov    -0x10(%rbp),%rdi
call   1050 <opcao_3@plt>
mov    -0x10(%rbp),%rdi
call   1040 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <armazenando_texto@plt>
mov    %rax,%rbx
lea    0xe8a(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x3,%eax
je     119d <main+0x3d>
cmp    $0x2,%eax
je     11a7 <main+0x47>
cmp    $0x1,%eax
jne    11af <main+0x4f>
mov    %rbx,%rdi
call   1060 <opcao_1@plt>
jmp    11af <main+0x4f>
mov    %rbx,%rdi
call   1050 <opcao_3@plt>
jmp    11af <main+0x4f>
mov    %rbx,%rdi
call   1080 <opcao_2@plt>
mov    %rbx,%rdi
call   1040 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i8* (...) @armazenando_texto()
store i8* %4, i8** %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
switch i32 %6, label %16 [
i32 1, label %7
i32 2, label %10
i32 3, label %13
]
7: ; preds = %0
%8 = load i8*, i8** %2
%9 = call i32 @opcao_1(i8* %8)
br label %16
10: ; preds = %0
%11 = load i8*, i8** %2
%12 = call i32 @opcao_2(i8* %11)
br label %16
13: ; preds = %0
%14 = load i8*, i8** %2
%15 = call i32 @opcao_3(i8* %14)
br label %16
16: ; preds = %0, %13, %10, %7
%17 = load i8*, i8** %2
%18 = call i32 @free(i8* %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i8* (...) @armazenando_texto()
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
switch i32 %5, label %12 [
i32 1, label %6
i32 2, label %8
i32 3, label %10
]
6: ; preds = %0
%7 = call i32 @opcao_1(i8* %3)
br label %12
8: ; preds = %0
%9 = call i32 @opcao_2(i8* %3)
br label %12
10: ; preds = %0
%11 = call i32 @opcao_3(i8* %3)
br label %12
12: ; preds = %0, %10, %8, %6
%13 = call i32 @free(i8* %3)
ret i32 0
}