#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 *, float *);
void main() {
  float AN = 2, AC = 2.2, AS = 4.5, EU = 3.5, AF = 6, OC = 6, cl = 0, total,
        duracion;
  int clave = 0, err = 0;
  printf("Introduce la clave y el tiempo de tu llamada en minutos; separados "
         "por un espacio:\n"
         "CLAVE DURACION:\n");
  scanf("%d %f", &clave, &duracion);
  switch (clave) {
  case 12:
    total = duracion * AN;
    cl = AN;
    break;
  case 15:
    total = duracion * AC;
    cl = AC;
    break;
  case 18:
    total = duracion * AS;
    cl = AS;
    break;
  case 19:
    total = duracion * EU;
    cl = EU;
    break;
  case 23:
    total = duracion * AF;
    cl = AF;
    break;
  case 25:
    total = duracion * OC;
    cl = OC;
    break;
  default:
    err = 1;
    printf("Introduce una clave valida\n");
  }
  if (!err)
    printf("Tiempo     : %.2f\n"
           "Costo x min: %.2f\n"
           "Total      : %.2f\n",
           duracion, cl, total);
  return;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x40000000,-0x4(%rbp)
movl   $0x400ccccd,-0x8(%rbp)
movl   $0x40900000,-0xc(%rbp)
movl   $0x40600000,-0x10(%rbp)
movl   $0x40c00000,-0x14(%rbp)
movl   $0x40c00000,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
lea    0xeca(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf20(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x24(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x28(%rbp),%eax
add    $0xfffffff4,%eax
mov    %eax,%ecx
mov    %rcx,-0x38(%rbp)
sub    $0xd,%eax
ja     1266 <main+0x146>
mov    -0x38(%rbp),%rax
lea    0xe57(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0x24(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    127b <main+0x15b>
movss  -0x24(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    127b <main+0x15b>
movss  -0x24(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    127b <main+0x15b>
movss  -0x24(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    127b <main+0x15b>
movss  -0x24(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    127b <main+0x15b>
movss  -0x24(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    127b <main+0x15b>
movl   $0x1,-0x2c(%rbp)
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x2c(%rbp)
jne    12ae <main+0x18e>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x20(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xe17(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xf6d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf24(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xfffffff4,%eax
cmp    $0xd,%eax
ja     11a6 <main+0x76>
lea    0xecc(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  (%rsp),%xmm0
movss  0xe7e(%rip),%xmm2
mulss  %xmm0,%xmm2
movsd  0xe82(%rip),%xmm1
jmp    1203 <main+0xd3>
movss  (%rsp),%xmm0
movaps %xmm0,%xmm2
addss  %xmm0,%xmm2
movsd  0xe8c(%rip),%xmm1
jmp    1203 <main+0xd3>
lea    0xf63(%rip),%rdi
call   1030 <puts@plt>
pop    %rax
ret
movss  (%rsp),%xmm0
movss  0xe4b(%rip),%xmm2
mulss  %xmm0,%xmm2
movsd  0xe5b(%rip),%xmm1
jmp    1203 <main+0xd3>
movss  (%rsp),%xmm0
movss  0xe2c(%rip),%xmm2
mulss  %xmm0,%xmm2
movsd  0xe38(%rip),%xmm1
jmp    1203 <main+0xd3>
movss  (%rsp),%xmm0
movss  0xe0d(%rip),%xmm2
mulss  %xmm0,%xmm2
movsd  0xe15(%rip),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm2,%xmm2
lea    0xe64(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [100 x i8] c"Introduce la clave y el tiempo de tu llamada en minutos; separados por un espacio:\0ACLAVE DURACION:\0A\00"
@.str.1 = [6 x i8] c"%d %f\00"
@.str.2 = [28 x i8] c"Introduce una clave valida\0A\00"
@.str.3 = [55 x i8] c"Tiempo : %.2f\0ACosto x min: %.2f\0ATotal : %.2f\0A\00"
define void @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
store float 2.000000e+00, float* %1
store float 0x40019999A0000000, float* %2
store float 4.500000e+00, float* %3
store float 3.500000e+00, float* %4
store float 6.000000e+00, float* %5
store float 6.000000e+00, float* %6
store float 0.000000e+00, float* %7
store i32 0, i32* %10
store i32 0, i32* %11
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %10, float* %9)
%14 = load i32, i32* %10
switch i32 %14, label %45 [
i32 12, label %15
i32 15, label %20
i32 18, label %25
i32 19, label %30
i32 23, label %35
i32 25, label %40
]
15: ; preds = %0
%16 = load float, float* %9
%17 = load float, float* %1
%18 = fmul float %16, %17
store float %18, float* %8
%19 = load float, float* %1
store float %19, float* %7
br label %47
20: ; preds = %0
%21 = load float, float* %9
%22 = load float, float* %2
%23 = fmul float %21, %22
store float %23, float* %8
%24 = load float, float* %2
store float %24, float* %7
br label %47
25: ; preds = %0
%26 = load float, float* %9
%27 = load float, float* %3
%28 = fmul float %26, %27
store float %28, float* %8
%29 = load float, float* %3
store float %29, float* %7
br label %47
30: ; preds = %0
%31 = load float, float* %9
%32 = load float, float* %4
%33 = fmul float %31, %32
store float %33, float* %8
%34 = load float, float* %4
store float %34, float* %7
br label %47
35: ; preds = %0
%36 = load float, float* %9
%37 = load float, float* %5
%38 = fmul float %36, %37
store float %38, float* %8
%39 = load float, float* %5
store float %39, float* %7
br label %47
40: ; preds = %0
%41 = load float, float* %9
%42 = load float, float* %6
%43 = fmul float %41, %42
store float %43, float* %8
%44 = load float, float* %6
store float %44, float* %7
br label %47
45: ; preds = %0
store i32 1, i32* %11
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %47
47: ; preds = %45, %40, %35, %30, %25, %20, %15
%48 = load i32, i32* %11
%49 = icmp ne i32 %48, 0
br i1 %49, label %58, label %50
50: ; preds = %47
%51 = load float, float* %9
%52 = fpext float %51 to double
%53 = load float, float* %7
%54 = fpext float %53 to double
%55 = load float, float* %8
%56 = fpext float %55 to double
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0), double %52, double %54, double %56)
br label %58
58: ; preds = %50, %47
ret void
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%d %f\00"
@.str.3 = [55 x i8] c"Tiempo : %.2f\0ACosto x min: %.2f\0ATotal : %.2f\0A\00"
@str = [99 x i8] c"Introduce la clave y el tiempo de tu llamada en minutos; separados por un espacio:\0ACLAVE DURACION:\00"
@str.4 = [27 x i8] c"Introduce una clave valida\00"
define void @main() {
%1 = alloca float
%2 = alloca i32
%3 = bitcast float* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([99 x i8], [99 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, float* %1)
%7 = load i32, i32* %2
switch i32 %7, label %26 [
i32 12, label %8
i32 15, label %11
i32 18, label %14
i32 19, label %17
i32 23, label %20
i32 25, label %23
]
8: ; preds = %0
%9 = load float, float* %1
%10 = fmul float %9, 2.000000e+00
br label %28
11: ; preds = %0
%12 = load float, float* %1
%13 = fmul float %12, 0x40019999A0000000
br label %28
14: ; preds = %0
%15 = load float, float* %1
%16 = fmul float %15, 4.500000e+00
br label %28
17: ; preds = %0
%18 = load float, float* %1
%19 = fmul float %18, 3.500000e+00
br label %28
20: ; preds = %0
%21 = load float, float* %1
%22 = fmul float %21, 6.000000e+00
br label %28
23: ; preds = %0
%24 = load float, float* %1
%25 = fmul float %24, 6.000000e+00
br label %28
26: ; preds = %0
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.4, i64 0, i64 0))
br label %35
28: ; preds = %23, %20, %17, %14, %11, %8
%29 = phi float [ %9, %8 ], [ %12, %11 ], [ %15, %14 ], [ %18, %17 ], [ %21, %20 ], [ %24, %23 ]
%30 = phi double [ 2.000000e+00, %8 ], [ 0x40019999A0000000, %11 ], [ 4.500000e+00, %14 ], [ 3.500000e+00, %17 ], [ 6.000000e+00, %20 ], [ 6.000000e+00, %23 ]
%31 = phi float [ %10, %8 ], [ %13, %11 ], [ %16, %14 ], [ %19, %17 ], [ %22, %20 ], [ %25, %23 ]
%32 = fpext float %29 to double
%33 = fpext float %31 to double
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0), double %32, double %30, double %33)
br label %35
35: ; preds = %26, %28
ret void
}