#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 /*<<< orphan*/ sqrt(float);
void main() {
  char choice;
  float side, base, height, perimetros, upoteinousa, aktina;
  printf("-------------------------\n");
  printf(" 1 -> Tetragwno\n");
  printf(" 2 -> Parallhlogrammo\n");
  printf(" 3 -> Orthogwnio Trigwno\n");
  printf(" 4 -> Kuklos\n");
  printf("-------------------------\n");
  printf("Epelekse sxhma\n");
  scanf("%c%c", &choice);
  switch (choice) {
  case '1': {
    printf("Eisagwgh pleuras\n");
    scanf(" %f", &side);
    perimetros = side * 4;
    printf("Perimetros tetragwnou = %f\n", perimetros);
  } break;
  case '2': {
    printf("Eisagwgh vasis kai ipsous \n");
    scanf(" %f %f", &base, &height);
    perimetros = 2 * base + 2 * height;
    printf("Perimetros parallhlogrammou = %f\n", perimetros);
  } break;
  case '3': {
    printf("Eisagwgh pleuras 1 kai 2\n");
    scanf(" %f %f", &base, &side);
    upoteinousa = base * base + side * side;
    perimetros = base + side + sqrt(upoteinousa);
    printf("Perimetros orthogwniou trigwnou = %f\n", perimetros);
  } break;
  case '4': {
    printf("Eisagwgh aktinas\n");
    scanf(" %f", &aktina);
    perimetros = 2 * 3.142 * aktina;
    printf("Perimetros kuklou = %f\n", perimetros);
  } break;
  default: {
    printf("Den epelekses sxhma\n");
    break;
  }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xee1(%rip),%rdi
mov    %rdi,-0x38(%rbp)
xor    %eax,%eax
mov    %al,-0x29(%rbp)
call   1030 <printf@plt>
mov    -0x29(%rbp),%al
lea    0xee4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x29(%rbp),%al
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x29(%rbp),%al
lea    0xeee(%rip),%rdi
call   1030 <printf@plt>
mov    -0x29(%rbp),%al
lea    0xef9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x29(%rbp),%al
call   1030 <printf@plt>
mov    -0x29(%rbp),%al
lea    0xeec(%rip),%rdi
call   1030 <printf@plt>
mov    -0x29(%rbp),%al
lea    0xeed(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x1(%rbp),%eax
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x3,%eax
ja     1374 <main+0x244>
mov    -0x28(%rbp),%rax
lea    0xe38(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  0xe03(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe8f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1382 <main+0x252>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea6(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
movss  0xda8(%rip),%xmm1
mulss  -0x10(%rbp),%xmm1
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe6f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1382 <main+0x252>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe47(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x8(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x18(%rbp),%xmm0
call   1050 <sqrt@plt>
movss  -0x3c(%rbp),%xmm0
cvtsi2ss %eax,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe1f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1382 <main+0x252>
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdbe(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xcb5(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdfd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1382 <main+0x252>
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xfa4(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xf49(%rip),%rdi
call   1030 <puts@plt>
lea    0xf4d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf57(%rip),%rdi
call   1030 <puts@plt>
lea    0xf64(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xf77(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7d(%rip),%rdi
lea    0x7(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movsbl 0x7(%rsp),%eax
add    $0xffffffcf,%eax
cmp    $0x3,%eax
ja     1202 <main+0xc2>
lea    0xe4d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf8f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe65(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  (%rsp),%xmm0
mulss  0xe16(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe24(%rip),%rdi
jmp    12fe <main+0x1be>
lea    0xf66(%rip),%rdi
call   1030 <puts@plt>
jmp    1305 <main+0x1c5>
lea    0xf29(%rip),%rdi
call   1030 <puts@plt>
lea    0xe17(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm0
movss  (%rsp),%xmm1
addss  %xmm1,%xmm1
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xded(%rip),%rdi
jmp    12fe <main+0x1be>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
lea    0xdce(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm2
movss  (%rsp),%xmm1
movaps %xmm2,%xmm0
addss  %xmm1,%xmm2
movss  %xmm2,0xc(%rsp)
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
call   1060 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
addss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xda7(%rip),%rdi
jmp    12fe <main+0x1be>
lea    0xe51(%rip),%rdi
call   1030 <puts@plt>
lea    0xd6c(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xd11(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd8e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"-------------------------\0A\00"
@.str.1 = [17 x i8] c" 1 -> Tetragwno\0A\00"
@.str.2 = [23 x i8] c" 2 -> Parallhlogrammo\0A\00"
@.str.3 = [26 x i8] c" 3 -> Orthogwnio Trigwno\0A\00"
@.str.4 = [14 x i8] c" 4 -> Kuklos\0A\00"
@.str.5 = [16 x i8] c"Epelekse sxhma\0A\00"
@.str.6 = [5 x i8] c"%c%c\00"
@.str.7 = [18 x i8] c"Eisagwgh pleuras\0A\00"
@.str.8 = [4 x i8] c" %f\00"
@.str.9 = [28 x i8] c"Perimetros tetragwnou = %f\0A\00"
@.str.10 = [28 x i8] c"Eisagwgh vasis kai ipsous \0A\00"
@.str.11 = [7 x i8] c" %f %f\00"
@.str.12 = [34 x i8] c"Perimetros parallhlogrammou = %f\0A\00"
@.str.13 = [26 x i8] c"Eisagwgh pleuras 1 kai 2\0A\00"
@.str.14 = [38 x i8] c"Perimetros orthogwniou trigwnou = %f\0A\00"
@.str.15 = [18 x i8] c"Eisagwgh aktinas\0A\00"
@.str.16 = [24 x i8] c"Perimetros kuklou = %f\0A\00"
@.str.17 = [21 x i8] c"Den epelekses sxhma\0A\00"
define void @main() {
%1 = alloca i8
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %1)
%16 = load i8, i8* %1
%17 = sext i8 %16 to i32
switch i32 %17, label %65 [
i32 49, label %18
i32 50, label %26
i32 51, label %36
i32 52, label %55
]
18: ; preds = %0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), float* %2)
%21 = load float, float* %2
%22 = fmul float %21, 4.000000e+00
store float %22, float* %5
%23 = load float, float* %5
%24 = fpext float %23 to double
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), double %24)
br label %67
26: ; preds = %0
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0))
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), float* %3, float* %4)
%29 = load float, float* %3
%30 = load float, float* %4
%31 = fmul float 2.000000e+00, %30
%32 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %29, float %31)
store float %32, float* %5
%33 = load float, float* %5
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), double %34)
br label %67
36: ; preds = %0
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0))
%38 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), float* %3, float* %2)
%39 = load float, float* %3
%40 = load float, float* %3
%41 = load float, float* %2
%42 = load float, float* %2
%43 = fmul float %41, %42
%44 = call float @llvm.fmuladd.f32(float %39, float %40, float %43)
store float %44, float* %6
%45 = load float, float* %3
%46 = load float, float* %2
%47 = fadd float %45, %46
%48 = load float, float* %6
%49 = call i32 @sqrt(float %48)
%50 = sitofp i32 %49 to float
%51 = fadd float %47, %50
store float %51, float* %5
%52 = load float, float* %5
%53 = fpext float %52 to double
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.14, i64 0, i64 0), double %53)
br label %67
55: ; preds = %0
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0))
%57 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), float* %7)
%58 = load float, float* %7
%59 = fpext float %58 to double
%60 = fmul double 6.284000e+00, %59
%61 = fptrunc double %60 to float
store float %61, float* %5
%62 = load float, float* %5
%63 = fpext float %62 to double
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0), double %63)
br label %67
65: ; preds = %0
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i64 0, i64 0))
br label %67
67: ; preds = %65, %55, %36, %26, %18
ret void
}

LLVM IR (-O2):
@.str.6 = [5 x i8] c"%c%c\00"
@.str.8 = [4 x i8] c" %f\00"
@.str.9 = [28 x i8] c"Perimetros tetragwnou = %f\0A\00"
@.str.11 = [7 x i8] c" %f %f\00"
@.str.12 = [34 x i8] c"Perimetros parallhlogrammou = %f\0A\00"
@.str.14 = [38 x i8] c"Perimetros orthogwniou trigwnou = %f\0A\00"
@.str.16 = [24 x i8] c"Perimetros kuklou = %f\0A\00"
@str.18 = [16 x i8] c" 1 -> Tetragwno\00"
@str.19 = [22 x i8] c" 2 -> Parallhlogrammo\00"
@str.20 = [25 x i8] c" 3 -> Orthogwnio Trigwno\00"
@str.21 = [13 x i8] c" 4 -> Kuklos\00"
@str.22 = [26 x i8] c"-------------------------\00"
@str.23 = [15 x i8] c"Epelekse sxhma\00"
@str.24 = [17 x i8] c"Eisagwgh aktinas\00"
@str.25 = [25 x i8] c"Eisagwgh pleuras 1 kai 2\00"
@str.26 = [27 x i8] c"Eisagwgh vasis kai ipsous \00"
@str.27 = [17 x i8] c"Eisagwgh pleuras\00"
@str.28 = [20 x i8] c"Den epelekses sxhma\00"
define void @main() {
%1 = alloca i8
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = bitcast float* %2 to i8*
%7 = bitcast float* %3 to i8*
%8 = bitcast float* %4 to i8*
%9 = bitcast float* %5 to i8*
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.22, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.18, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.19, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.20, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.21, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.22, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.23, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %1)
%18 = load i8, i8* %1
%19 = sext i8 %18 to i32
switch i32 %19, label %58 [
i32 49, label %20
i32 50, label %27
i32 51, label %36
i32 52, label %49
]
20: ; preds = %0
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.27, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), float* %2)
%23 = load float, float* %2
%24 = fmul float %23, 4.000000e+00
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), double %25)
br label %60
27: ; preds = %0
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.26, i64 0, i64 0))
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), float* %3, float* %4)
%30 = load float, float* %3
%31 = load float, float* %4
%32 = fmul float %31, 2.000000e+00
%33 = call float @llvm.fmuladd.f32(float %30, float 2.000000e+00, float %32)
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), double %34)
br label %60
36: ; preds = %0
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.25, i64 0, i64 0))
%38 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), float* %3, float* %2)
%39 = load float, float* %3
%40 = load float, float* %2
%41 = fmul float %40, %40
%42 = call float @llvm.fmuladd.f32(float %39, float %39, float %41)
%43 = fadd float %39, %40
%44 = call i32 @sqrt(float %42)
%45 = sitofp i32 %44 to float
%46 = fadd float %43, %45
%47 = fpext float %46 to double
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.14, i64 0, i64 0), double %47)
br label %60
49: ; preds = %0
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.24, i64 0, i64 0))
%51 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), float* %5)
%52 = load float, float* %5
%53 = fpext float %52 to double
%54 = fmul double %53, 6.284000e+00
%55 = fptrunc double %54 to float
%56 = fpext float %55 to double
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0), double %56)
br label %60
58: ; preds = %0
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.28, i64 0, i64 0))
br label %60
60: ; preds = %58, %49, %36, %27, %20
ret void
}