#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 main(void) {
  int opcion, diametro, area, perimetro;
  float radio, pi;
  opcion = 0;
  pi = 3.14;
  while (opcion != 4) {
    printf("Escoge una opcion: ");
    printf("1) Calcular el diametro.");
    printf("2) Calcular el perimetro.");
    printf("3) Calcular el area.");
    printf("4) Salir.");
    printf("Teclea 1, 2, 3, o 4 y pulsa el retorno de carro: \n");
    scanf("%d", &opcion);
    printf("Dame el radio de un circulo: ");
    scanf("%f", &radio);
    if (opcion == 1) {
      diametro = 2 * radio;
      printf("El diámetro es %d", diametro);
    } else if (opcion == 2) {
      perimetro = 2 * pi * radio;
      printf("El perimetro es %d", perimetro);
    } else if (opcion == 3) {
      area = pi * radio * 8;
      printf("El  area es %d", area);
    } else if (opcion < 0) {
      printf("S ́lo hay cuatro opciones: 1, 2, 3 o 4. T ́has tecleado %d",
             opcion);
    } else if (opcion > 4) {
      printf("S ́lo hay cuatro opciones: 1, 2, 3 o 4. T ́has tecleado %d",
             opcion);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movss  0xec2(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     12d1 <main+0x1b1>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf8e(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefb(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    1207 <main+0xe7>
movss  0xe23(%rip),%xmm0
mulss  -0x18(%rbp),%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12cc <main+0x1ac>
cmpl   $0x2,-0x8(%rbp)
jne    1240 <main+0x120>
movss  0xdef(%rip),%xmm0
mulss  -0x1c(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c7 <main+0x1a7>
cmpl   $0x3,-0x8(%rbp)
jne    127d <main+0x15d>
movss  -0x1c(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  0xda8(%rip),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c2 <main+0x1a2>
cmpl   $0x0,-0x8(%rbp)
jge    129d <main+0x17d>
mov    -0x8(%rbp),%esi
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12bd <main+0x19d>
cmpl   $0x4,-0x8(%rbp)
jle    12b8 <main+0x198>
mov    -0x8(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12bd <main+0x19d>
jmp    12c2 <main+0x1a2>
jmp    12c7 <main+0x1a7>
jmp    12cc <main+0x1ac>
jmp    1143 <main+0x23>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xfbc(%rip),%rbp
lea    0xfb2(%rip),%r14
lea    0x4(%rsp),%r15
lea    0xf15(%rip),%r12
lea    0xf2c(%rip),%r13
mov    %rsp,%rbx
nopw   0x0(%rax,%rax,1)
lea    0xe95(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
cmp    $0x3,%esi
je     1230 <main+0x100>
cmp    $0x2,%esi
je     1210 <main+0xe0>
cmp    $0x1,%esi
jne    1260 <main+0x130>
movss  (%rsp),%xmm0
addss  %xmm0,%xmm0
cvttss2si %xmm0,%esi
lea    0xe8a(%rip),%rdi
jmp    1270 <main+0x140>
nopl   0x0(%rax,%rax,1)
movss  (%rsp),%xmm0
mulss  0xdeb(%rip),%xmm0
cvttss2si %xmm0,%esi
lea    0xe7f(%rip),%rdi
jmp    1270 <main+0x140>
nopw   0x0(%rax,%rax,1)
movss  (%rsp),%xmm0
mulss  0xdc3(%rip),%xmm0
mulss  0xdbf(%rip),%xmm0
cvttss2si %xmm0,%esi
lea    0xe6a(%rip),%rdi
jmp    1270 <main+0x140>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %esi,%esi
js     1269 <main+0x139>
cmp    $0x5,%esi
jb     127b <main+0x14b>
lea    0xe59(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
cmp    $0x4,%esi
jne    1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Escoge una opcion: \00"
@.str.1 = [25 x i8] c"1) Calcular el diametro.\00"
@.str.2 = [26 x i8] c"2) Calcular el perimetro.\00"
@.str.3 = [21 x i8] c"3) Calcular el area.\00"
@.str.4 = [10 x i8] c"4) Salir.\00"
@.str.5 = [51 x i8] c"Teclea 1, 2, 3, o 4 y pulsa el retorno de carro: \0A\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [30 x i8] c"Dame el radio de un circulo: \00"
@.str.8 = [3 x i8] c"%f\00"
@.str.9 = [20 x i8] c"El dia\CC\81metro es %d\00"
@.str.10 = [19 x i8] c"El perimetro es %d\00"
@.str.11 = [15 x i8] c"El area es %d\00"
@.str.12 = [61 x i8] c"S \CC\81lo hay cuatro opciones: 1, 2, 3 o 4. T \CC\81has tecleado %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
store i32 0, i32* %2
store float 0x40091EB860000000, float* %7
br label %8
8: ; preds = %67, %0
%9 = load i32, i32* %2
%10 = icmp ne i32 %9, 4
br i1 %10, label %11, label %68
11: ; preds = %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %6)
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %29
23: ; preds = %11
%24 = load float, float* %6
%25 = fmul float 2.000000e+00, %24
%26 = fptosi float %25 to i32
store i32 %26, i32* %3
%27 = load i32, i32* %3
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i32 %27)
br label %67
29: ; preds = %11
%30 = load i32, i32* %2
%31 = icmp eq i32 %30, 2
br i1 %31, label %32, label %40
32: ; preds = %29
%33 = load float, float* %7
%34 = fmul float 2.000000e+00, %33
%35 = load float, float* %6
%36 = fmul float %34, %35
%37 = fptosi float %36 to i32
store i32 %37, i32* %5
%38 = load i32, i32* %5
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %38)
br label %66
40: ; preds = %29
%41 = load i32, i32* %2
%42 = icmp eq i32 %41, 3
br i1 %42, label %43, label %51
43: ; preds = %40
%44 = load float, float* %7
%45 = load float, float* %6
%46 = fmul float %44, %45
%47 = fmul float %46, 8.000000e+00
%48 = fptosi float %47 to i32
store i32 %48, i32* %4
%49 = load i32, i32* %4
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), i32 %49)
br label %65
51: ; preds = %40
%52 = load i32, i32* %2
%53 = icmp slt i32 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %51
%55 = load i32, i32* %2
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.12, i64 0, i64 0), i32 %55)
br label %64
57: ; preds = %51
%58 = load i32, i32* %2
%59 = icmp sgt i32 %58, 4
br i1 %59, label %60, label %63
60: ; preds = %57
%61 = load i32, i32* %2
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.12, i64 0, i64 0), i32 %61)
br label %63
63: ; preds = %60, %57
br label %64
64: ; preds = %63, %54
br label %65
65: ; preds = %64, %43
br label %66
66: ; preds = %65, %32
br label %67
67: ; preds = %66, %23
br label %8
68: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Escoge una opcion: \00"
@.str.1 = [25 x i8] c"1) Calcular el diametro.\00"
@.str.2 = [26 x i8] c"2) Calcular el perimetro.\00"
@.str.3 = [21 x i8] c"3) Calcular el area.\00"
@.str.4 = [10 x i8] c"4) Salir.\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [30 x i8] c"Dame el radio de un circulo: \00"
@.str.8 = [3 x i8] c"%f\00"
@.str.9 = [20 x i8] c"El dia\CC\81metro es %d\00"
@.str.10 = [19 x i8] c"El perimetro es %d\00"
@.str.11 = [15 x i8] c"El area es %d\00"
@.str.12 = [61 x i8] c"S \CC\81lo hay cuatro opciones: 1, 2, 3 o 4. T \CC\81has tecleado %d\00"
@str = [50 x i8] c"Teclea 1, 2, 3, o 4 y pulsa el retorno de carro: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = bitcast i32* %1 to i8*
%4 = bitcast float* %2 to i8*
store i32 0, i32* %1
br label %5
5: ; preds = %0, %42
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %2)
%15 = load i32, i32* %1
switch i32 %15, label %32 [
i32 1, label %16
i32 2, label %21
i32 3, label %26
]
16: ; preds = %5
%17 = load float, float* %2
%18 = fmul float %17, 2.000000e+00
%19 = fptosi float %18 to i32
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i32 %19)
br label %40
21: ; preds = %5
%22 = load float, float* %2
%23 = fmul float %22, 0x40191EB860000000
%24 = fptosi float %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %24)
br label %40
26: ; preds = %5
%27 = load float, float* %2
%28 = fmul float %27, 0x40091EB860000000
%29 = fmul float %28, 8.000000e+00
%30 = fptosi float %29 to i32
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.11, i64 0, i64 0), i32 %30)
br label %40
32: ; preds = %5
%33 = icmp slt i32 %15, 0
br i1 %33, label %34, label %36
34: ; preds = %32
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.12, i64 0, i64 0), i32 %15)
br label %40
36: ; preds = %32
%37 = icmp ugt i32 %15, 4
br i1 %37, label %38, label %42
38: ; preds = %36
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.12, i64 0, i64 0), i32 %15)
br label %40
40: ; preds = %16, %26, %38, %34, %21
%41 = load i32, i32* %1
br label %42
42: ; preds = %40, %36
%43 = phi i32 [ %41, %40 ], [ %15, %36 ]
%44 = icmp eq i32 %43, 4
br i1 %44, label %45, label %5
45: ; preds = %42
ret i32 0
}