#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 e_n();
int i_areas();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int source();
int main() {
  int c, cc = 0;
  printf("Choose method to calculate cyclomatic Complexity: \n");
  printf("\t1.Using source code.\n\t");
  printf("2.Using number of edges and nodes.\n\t");
  printf("3.Using number of independent areas.\n\n");
  scanf("%d", &c);
  switch (c) {
  case 1:
    cc = source();
    break;
  case 2:
    cc = e_n();
    break;
  case 3:
    cc = i_areas();
    break;
  default:
    printf("Error");
    break;
  }
  printf("The cyclomatic Complexity is %d\n", cc);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xe93(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x11(%rbp)
call   1030 <printf@plt>
mov    -0x11(%rbp),%al
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x11(%rbp),%al
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x11(%rbp),%al
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     11ea <main+0x9a>
jmp    11c8 <main+0x78>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     11f9 <main+0xa9>
jmp    11d9 <main+0x89>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     1208 <main+0xb8>
jmp    1217 <main+0xc7>
mov    $0x0,%al
call   1060 <source@plt>
mov    %eax,-0xc(%rbp)
jmp    1225 <main+0xd5>
mov    $0x0,%al
call   1050 <e_n@plt>
mov    %eax,-0xc(%rbp)
jmp    1225 <main+0xd5>
mov    $0x0,%al
call   1070 <i_areas@plt>
mov    %eax,-0xc(%rbp)
jmp    1225 <main+0xd5>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xefb(%rip),%rdi
call   1030 <puts@plt>
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf06(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9d(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x3,%eax
je     11c8 <main+0x68>
cmp    $0x2,%eax
je     11d3 <main+0x73>
cmp    $0x1,%eax
jne    11de <main+0x7e>
xor    %eax,%eax
call   1070 <source@plt>
mov    %eax,%ebx
jmp    11ee <main+0x8e>
xor    %eax,%eax
call   1080 <i_areas@plt>
mov    %eax,%ebx
jmp    11ee <main+0x8e>
xor    %eax,%eax
call   1060 <e_n@plt>
mov    %eax,%ebx
jmp    11ee <main+0x8e>
lea    0xe5b(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe51(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [52 x i8] c"Choose method to calculate cyclomatic Complexity: \0A\00"
@.str.1 = [24 x i8] c"\091.Using source code.\0A\09\00"
@.str.2 = [37 x i8] c"2.Using number of edges and nodes.\0A\09\00"
@.str.3 = [39 x i8] c"3.Using number of independent areas.\0A\0A\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [6 x i8] c"Error\00"
@.str.6 = [33 x i8] c"The cyclomatic Complexity is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
switch i32 %9, label %16 [
i32 1, label %10
i32 2, label %12
i32 3, label %14
]
10: ; preds = %0
%11 = call i32 (...) @source()
store i32 %11, i32* %3
br label %18
12: ; preds = %0
%13 = call i32 (...) @e_n()
store i32 %13, i32* %3
br label %18
14: ; preds = %0
%15 = call i32 (...) @i_areas()
store i32 %15, i32* %3
br label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %18
18: ; preds = %16, %14, %12, %10
%19 = load i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [24 x i8] c"\091.Using source code.\0A\09\00"
@.str.2 = [37 x i8] c"2.Using number of edges and nodes.\0A\09\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [6 x i8] c"Error\00"
@.str.6 = [33 x i8] c"The cyclomatic Complexity is %d\0A\00"
@str = [51 x i8] c"Choose method to calculate cyclomatic Complexity: \00"
@str.7 = [38 x i8] c"3.Using number of independent areas.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.7, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
switch i32 %8, label %15 [
i32 1, label %9
i32 2, label %11
i32 3, label %13
]
9: ; preds = %0
%10 = call i32 (...) @source()
br label %17
11: ; preds = %0
%12 = call i32 (...) @e_n()
br label %17
13: ; preds = %0
%14 = call i32 (...) @i_areas()
br label %17
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %17
17: ; preds = %15, %13, %11, %9
%18 = phi i32 [ 0, %15 ], [ %14, %13 ], [ %12, %11 ], [ %10, %9 ]
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i32 %18)
ret i32 0
}