#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(int argc, char const *argv[]) {
  char a = NULL;
  float b, c;
  scanf(" %c", &a);
  switch (a) {
  case 'Q':
    scanf("%.2f", &b);
    printf("%.2f\n%.2f", b * b, b * 4);
    break;
  case 'R':
    scanf("%.2f %.2f", &b, &c);
    printf("%1.2f\n%1.2f", b * c, (b * 2) + (c * 2));
    break;
  case 'C':
    scanf("%.2f", &b);
    printf("%1.2f\n%1.2f", 3.14 * (b * b), 2 * 3.14 * b);
    break;
  default:
    printf("Nenhuma figura selecionada");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
lea    0xed7(%rip),%rdi
xor    %eax,%eax
lea    -0x11(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x11(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x43,%eax
je     121c <main+0xfc>
jmp    1161 <main+0x41>
mov    -0x20(%rbp),%eax
sub    $0x51,%eax
je     1183 <main+0x63>
jmp    1172 <main+0x52>
mov    -0x20(%rbp),%eax
sub    $0x52,%eax
je     11c7 <main+0xa7>
jmp    1270 <main+0x150>
lea    0xe97(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x18(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0xe69(%rip),%xmm1
mulss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe61(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    127e <main+0x15e>
lea    0xe58(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x18(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
movss  0xe18(%rip),%xmm2
mulss  -0x1c(%rbp),%xmm2
addss  %xmm1,%xmm1
addss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe20(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    127e <main+0x15e>
lea    0xdfe(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x18(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdc4(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xda7(%rip),%xmm1
mulsd  %xmm2,%xmm1
lea    0xdcc(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    127e <main+0x15e>
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movb   $0x0,0xf(%rsp)
lea    0xee4(%rip),%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movsbl 0xf(%rsp),%eax
cmp    $0x43,%eax
je     118d <main+0x6d>
cmp    $0x52,%eax
je     11c4 <main+0xa4>
cmp    $0x51,%eax
jne    1213 <main+0xf3>
lea    0xec2(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0x10(%rsp),%xmm1
movaps %xmm1,%xmm0
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
mulss  0xe90(%rip),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe8d(%rip),%rdi
jmp    120a <main+0xea>
lea    0xe89(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm1
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe46(%rip),%xmm0
mulsd  0xe46(%rip),%xmm1
jmp    1203 <main+0xe3>
lea    0xe57(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x14(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0x10(%rsp),%xmm1
movss  0x14(%rsp),%xmm2
movaps %xmm1,%xmm0
mulss  %xmm2,%xmm0
cvtss2sd %xmm0,%xmm0
addss  %xmm2,%xmm2
addss  %xmm1,%xmm1
addss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe22(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    1221 <main+0x101>
lea    0xe1e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c" %c\00"
@.str.1 = [5 x i8] c"%.2f\00"
@.str.2 = [10 x i8] c"%.2f\0A%.2f\00"
@.str.3 = [10 x i8] c"%.2f %.2f\00"
@.str.4 = [12 x i8] c"%1.2f\0A%1.2f\00"
@.str.5 = [27 x i8] c"Nenhuma figura selecionada\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca float
%8 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 0, i8* %6
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
%10 = load i8, i8* %6
%11 = sext i8 %10 to i32
switch i32 %11, label %45 [
i32 81, label %12
i32 82, label %22
i32 67, label %34
]
12: ; preds = %2
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), float* %7)
%14 = load float, float* %7
%15 = load float, float* %7
%16 = fmul float %14, %15
%17 = fpext float %16 to double
%18 = load float, float* %7
%19 = fmul float %18, 4.000000e+00
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %17, double %20)
br label %47
22: ; preds = %2
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), float* %7, float* %8)
%24 = load float, float* %7
%25 = load float, float* %8
%26 = fmul float %24, %25
%27 = fpext float %26 to double
%28 = load float, float* %7
%29 = load float, float* %8
%30 = fmul float %29, 2.000000e+00
%31 = call float @llvm.fmuladd.f32(float %28, float 2.000000e+00, float %30)
%32 = fpext float %31 to double
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %27, double %32)
br label %47
34: ; preds = %2
%35 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), float* %7)
%36 = load float, float* %7
%37 = load float, float* %7
%38 = fmul float %36, %37
%39 = fpext float %38 to double
%40 = fmul double 3.140000e+00, %39
%41 = load float, float* %7
%42 = fpext float %41 to double
%43 = fmul double 6.280000e+00, %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %40, double %43)
br label %47
45: ; preds = %2
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %47
47: ; preds = %45, %34, %22, %12
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c" %c\00"
@.str.1 = [5 x i8] c"%.2f\00"
@.str.2 = [10 x i8] c"%.2f\0A%.2f\00"
@.str.3 = [10 x i8] c"%.2f %.2f\00"
@.str.4 = [12 x i8] c"%1.2f\0A%1.2f\00"
@.str.5 = [27 x i8] c"Nenhuma figura selecionada\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
%4 = alloca float
%5 = alloca float
store i8 0, i8* %3
%6 = bitcast float* %4 to i8*
%7 = bitcast float* %5 to i8*
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
switch i32 %10, label %38 [
i32 81, label %11
i32 82, label %19
i32 67, label %29
]
11: ; preds = %2
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), float* %4)
%13 = load float, float* %4
%14 = fmul float %13, %13
%15 = fpext float %14 to double
%16 = fmul float %13, 4.000000e+00
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %15, double %17)
br label %40
19: ; preds = %2
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), float* %4, float* %5)
%21 = load float, float* %4
%22 = load float, float* %5
%23 = fmul float %21, %22
%24 = fpext float %23 to double
%25 = fmul float %22, 2.000000e+00
%26 = call float @llvm.fmuladd.f32(float %21, float 2.000000e+00, float %25)
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %24, double %27)
br label %40
29: ; preds = %2
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), float* %4)
%31 = load float, float* %4
%32 = fmul float %31, %31
%33 = fpext float %32 to double
%34 = fmul double %33, 3.140000e+00
%35 = fpext float %31 to double
%36 = fmul double %35, 6.280000e+00
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %34, double %36)
br label %40
38: ; preds = %2
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %40
40: ; preds = %38, %29, %19, %11
ret i32 0
}