#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*/ displayAngle();
int /*<<< orphan*/ displayCentreOfMedians();
int /*<<< orphan*/ displayCrossVector();
int /*<<< orphan*/ displayDeterminant();
int /*<<< orphan*/ displayDirection();
int /*<<< orphan*/ displayDistanceBetweenPoints();
int /*<<< orphan*/ displayEqualVectors();
int /*<<< orphan*/ displayLengthOfVector();
int /*<<< orphan*/ displayLessOrEqualOrMoreThan90();
int /*<<< orphan*/ displayMiddlePoint();
int /*<<< orphan*/ displayParametricEquation();
int /*<<< orphan*/ displayProjection();
int /*<<< orphan*/ displayScalarProduct();
int /*<<< orphan*/ displayTwoUnknown();
int /*<<< orphan*/ displayUnitVector();
int /*<<< orphan*/ displayVectorView();
char fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ stdin;
int handleVector() {
  bool run = true;
  while (run) {
    displayVectorView();
    char answer = fgetc(stdin);
    char enter = fgetc(stdin);
    printf("\n You answered: %c\n", answer);
    if (answer == 'A') {
      displayScalarProduct();
    } else if (answer == 'C') {
      displayCentreOfMedians();
    } else if (answer == 'D') {
      displayDistanceBetweenPoints();
    } else if (answer == 'E') {
      displayEqualVectors();
    } else if (answer == 'L') {
      displayLengthOfVector();
    } else if (answer == 'M') {
      displayMiddlePoint();
    } else if (answer == 'N') {
      displayLessOrEqualOrMoreThan90();
    } else if (answer == 'O') {
      displayCrossVector();
    } else if (answer == 'P') {
      displayProjection();
    } else if (answer == 'R') {
      displayParametricEquation();
    } else if (answer == 'S') {
      displayDirection();
    } else if (answer == 'T') {
      displayDeterminant();
    } else if (answer == 'U') {
      displayUnitVector();
    } else if (answer == 'V') {
      displayAngle();
    } else if (answer == 'W') {
      displayTwoUnknown();
    } else if (answer == 'X') {
      run = false;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<handleVector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     144d <handleVector+0x22d>
mov    $0x0,%al
call   10d0 <displayVectorView@plt>
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
call   1080 <fgetc@plt>
mov    %al,-0x5(%rbp)
mov    0x2d90(%rip),%rax
mov    (%rax),%edi
call   1080 <fgetc@plt>
mov    %al,-0x6(%rbp)
lea    0xd97(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1060 <printf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jne    128b <handleVector+0x6b>
mov    $0x0,%al
call   10f0 <displayScalarProduct@plt>
jmp    1448 <handleVector+0x228>
movsbl -0x5(%rbp),%eax
cmp    $0x43,%eax
jne    12a4 <handleVector+0x84>
mov    $0x0,%al
call   10c0 <displayCentreOfMedians@plt>
jmp    1443 <handleVector+0x223>
movsbl -0x5(%rbp),%eax
cmp    $0x44,%eax
jne    12bd <handleVector+0x9d>
mov    $0x0,%al
call   10b0 <displayDistanceBetweenPoints@plt>
jmp    143e <handleVector+0x21e>
movsbl -0x5(%rbp),%eax
cmp    $0x45,%eax
jne    12d6 <handleVector+0xb6>
mov    $0x0,%al
call   1030 <displayEqualVectors@plt>
jmp    1439 <handleVector+0x219>
movsbl -0x5(%rbp),%eax
cmp    $0x4c,%eax
jne    12ef <handleVector+0xcf>
mov    $0x0,%al
call   10e0 <displayLengthOfVector@plt>
jmp    1434 <handleVector+0x214>
movsbl -0x5(%rbp),%eax
cmp    $0x4d,%eax
jne    1308 <handleVector+0xe8>
mov    $0x0,%al
call   1070 <displayMiddlePoint@plt>
jmp    142f <handleVector+0x20f>
movsbl -0x5(%rbp),%eax
cmp    $0x4e,%eax
jne    1321 <handleVector+0x101>
mov    $0x0,%al
call   1110 <displayLessOrEqualOrMoreThan90@plt>
jmp    142a <handleVector+0x20a>
movsbl -0x5(%rbp),%eax
cmp    $0x4f,%eax
jne    133a <handleVector+0x11a>
mov    $0x0,%al
call   1090 <displayCrossVector@plt>
jmp    1425 <handleVector+0x205>
movsbl -0x5(%rbp),%eax
cmp    $0x50,%eax
jne    1353 <handleVector+0x133>
mov    $0x0,%al
call   1120 <displayProjection@plt>
jmp    1420 <handleVector+0x200>
movsbl -0x5(%rbp),%eax
cmp    $0x52,%eax
jne    136c <handleVector+0x14c>
mov    $0x0,%al
call   1140 <displayParametricEquation@plt>
jmp    141b <handleVector+0x1fb>
movsbl -0x5(%rbp),%eax
cmp    $0x53,%eax
jne    1385 <handleVector+0x165>
mov    $0x0,%al
call   1100 <displayDirection@plt>
jmp    1416 <handleVector+0x1f6>
movsbl -0x5(%rbp),%eax
cmp    $0x54,%eax
jne    139e <handleVector+0x17e>
mov    $0x0,%al
call   1130 <displayDeterminant@plt>
jmp    1411 <handleVector+0x1f1>
movsbl -0x5(%rbp),%eax
cmp    $0x55,%eax
jne    13b7 <handleVector+0x197>
mov    $0x0,%al
call   1040 <displayUnitVector@plt>
jmp    140c <handleVector+0x1ec>
movsbl -0x5(%rbp),%eax
cmp    $0x56,%eax
jne    13d0 <handleVector+0x1b0>
mov    $0x0,%al
call   1050 <displayAngle@plt>
jmp    1407 <handleVector+0x1e7>
movsbl -0x5(%rbp),%eax
cmp    $0x57,%eax
jne    13e9 <handleVector+0x1c9>
mov    $0x0,%al
call   10a0 <displayTwoUnknown@plt>
jmp    1402 <handleVector+0x1e2>
movsbl -0x5(%rbp),%eax
cmp    $0x58,%eax
jne    13fd <handleVector+0x1dd>
movl   $0x0,-0x4(%rbp)
jmp    1402 <handleVector+0x1e2>
jmp    1407 <handleVector+0x1e7>
jmp    140c <handleVector+0x1ec>
jmp    1411 <handleVector+0x1f1>
jmp    1416 <handleVector+0x1f6>
jmp    141b <handleVector+0x1fb>
jmp    1420 <handleVector+0x200>
jmp    1425 <handleVector+0x205>
jmp    142a <handleVector+0x20a>
jmp    142f <handleVector+0x20f>
jmp    1434 <handleVector+0x214>
jmp    1439 <handleVector+0x219>
jmp    143e <handleVector+0x21e>
jmp    1443 <handleVector+0x223>
jmp    1448 <handleVector+0x228>
jmp    122f <handleVector+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handleVector>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x2db9(%rip),%r15
lea    0xe2a(%rip),%r14
lea    0xdc3(%rip),%r12
jmp    1250 <handleVector+0x30>
xor    %eax,%eax
call   10a0 <displayTwoUnknown@plt>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   10d0 <displayVectorView@plt>
mov    (%r15),%edi
call   1080 <fgetc@plt>
mov    %eax,%ebx
mov    (%r15),%edi
call   1080 <fgetc@plt>
movsbl %bl,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1060 <printf@plt>
add    $0xbf,%bpl
cmp    $0x17,%bpl
ja     1250 <handleVector+0x30>
movzbl %bpl,%eax
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
xor    %eax,%eax
call   10f0 <displayScalarProduct@plt>
jmp    1250 <handleVector+0x30>
xor    %eax,%eax
call   10c0 <displayCentreOfMedians@plt>
jmp    1250 <handleVector+0x30>
xor    %eax,%eax
call   10b0 <displayDistanceBetweenPoints@plt>
jmp    1250 <handleVector+0x30>
xor    %eax,%eax
call   1030 <displayEqualVectors@plt>
jmp    1250 <handleVector+0x30>
xor    %eax,%eax
call   10e0 <displayLengthOfVector@plt>
jmp    1250 <handleVector+0x30>
xor    %eax,%eax
call   1070 <displayMiddlePoint@plt>
jmp    1250 <handleVector+0x30>
xor    %eax,%eax
call   1110 <displayLessOrEqualOrMoreThan90@plt>
jmp    1250 <handleVector+0x30>
xor    %eax,%eax
call   1090 <displayCrossVector@plt>
jmp    1250 <handleVector+0x30>
xor    %eax,%eax
call   1120 <displayProjection@plt>
jmp    1250 <handleVector+0x30>
xor    %eax,%eax
call   1140 <displayParametricEquation@plt>
jmp    1250 <handleVector+0x30>
xor    %eax,%eax
call   1100 <displayDirection@plt>
jmp    1250 <handleVector+0x30>
xor    %eax,%eax
call   1130 <displayDeterminant@plt>
jmp    1250 <handleVector+0x30>
xor    %eax,%eax
call   1040 <displayUnitVector@plt>
jmp    1250 <handleVector+0x30>
xor    %eax,%eax
call   1050 <displayAngle@plt>
jmp    1250 <handleVector+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [20 x i8] c"\0A You answered: %c\0A\00"
define i32 @handleVector() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
store i32 1, i32* %1
br label %4
4: ; preds = %124, %0
%5 = load i32, i32* %1
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %125
7: ; preds = %4
%8 = call i32 (...) @displayVectorView()
%9 = load i32, i32* @stdin
%10 = call signext i8 @fgetc(i32 %9)
store i8 %10, i8* %2
%11 = load i32, i32* @stdin
%12 = call signext i8 @fgetc(i32 %11)
store i8 %12, i8* %3
%13 = load i8, i8* %2
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8 signext %13)
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 65
br i1 %17, label %18, label %20
18: ; preds = %7
%19 = call i32 (...) @displayScalarProduct()
br label %124
20: ; preds = %7
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 67
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 (...) @displayCentreOfMedians()
br label %123
26: ; preds = %20
%27 = load i8, i8* %2
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 68
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 (...) @displayDistanceBetweenPoints()
br label %122
32: ; preds = %26
%33 = load i8, i8* %2
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 69
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = call i32 (...) @displayEqualVectors()
br label %121
38: ; preds = %32
%39 = load i8, i8* %2
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 76
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = call i32 (...) @displayLengthOfVector()
br label %120
44: ; preds = %38
%45 = load i8, i8* %2
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 77
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = call i32 (...) @displayMiddlePoint()
br label %119
50: ; preds = %44
%51 = load i8, i8* %2
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 78
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = call i32 (...) @displayLessOrEqualOrMoreThan90()
br label %118
56: ; preds = %50
%57 = load i8, i8* %2
%58 = sext i8 %57 to i32
%59 = icmp eq i32 %58, 79
br i1 %59, label %60, label %62
60: ; preds = %56
%61 = call i32 (...) @displayCrossVector()
br label %117
62: ; preds = %56
%63 = load i8, i8* %2
%64 = sext i8 %63 to i32
%65 = icmp eq i32 %64, 80
br i1 %65, label %66, label %68
66: ; preds = %62
%67 = call i32 (...) @displayProjection()
br label %116
68: ; preds = %62
%69 = load i8, i8* %2
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 82
br i1 %71, label %72, label %74
72: ; preds = %68
%73 = call i32 (...) @displayParametricEquation()
br label %115
74: ; preds = %68
%75 = load i8, i8* %2
%76 = sext i8 %75 to i32
%77 = icmp eq i32 %76, 83
br i1 %77, label %78, label %80
78: ; preds = %74
%79 = call i32 (...) @displayDirection()
br label %114
80: ; preds = %74
%81 = load i8, i8* %2
%82 = sext i8 %81 to i32
%83 = icmp eq i32 %82, 84
br i1 %83, label %84, label %86
84: ; preds = %80
%85 = call i32 (...) @displayDeterminant()
br label %113
86: ; preds = %80
%87 = load i8, i8* %2
%88 = sext i8 %87 to i32
%89 = icmp eq i32 %88, 85
br i1 %89, label %90, label %92
90: ; preds = %86
%91 = call i32 (...) @displayUnitVector()
br label %112
92: ; preds = %86
%93 = load i8, i8* %2
%94 = sext i8 %93 to i32
%95 = icmp eq i32 %94, 86
br i1 %95, label %96, label %98
96: ; preds = %92
%97 = call i32 (...) @displayAngle()
br label %111
98: ; preds = %92
%99 = load i8, i8* %2
%100 = sext i8 %99 to i32
%101 = icmp eq i32 %100, 87
br i1 %101, label %102, label %104
102: ; preds = %98
%103 = call i32 (...) @displayTwoUnknown()
br label %110
104: ; preds = %98
%105 = load i8, i8* %2
%106 = sext i8 %105 to i32
%107 = icmp eq i32 %106, 88
br i1 %107, label %108, label %109
108: ; preds = %104
store i32 0, i32* %1
br label %109
109: ; preds = %108, %104
br label %110
110: ; preds = %109, %102
br label %111
111: ; preds = %110, %96
br label %112
112: ; preds = %111, %90
br label %113
113: ; preds = %112, %84
br label %114
114: ; preds = %113, %78
br label %115
115: ; preds = %114, %72
br label %116
116: ; preds = %115, %66
br label %117
117: ; preds = %116, %60
br label %118
118: ; preds = %117, %54
br label %119
119: ; preds = %118, %48
br label %120
120: ; preds = %119, %42
br label %121
121: ; preds = %120, %36
br label %122
122: ; preds = %121, %30
br label %123
123: ; preds = %122, %24
br label %124
124: ; preds = %123, %18
br label %4
125: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [20 x i8] c"\0A You answered: %c\0A\00"
define i32 @handleVector() {
br label %1
1: ; preds = %8, %0
%2 = tail call i32 (...) @displayVectorView()
%3 = load i32, i32* @stdin
%4 = tail call signext i8 @fgetc(i32 %3)
%5 = load i32, i32* @stdin
%6 = tail call signext i8 @fgetc(i32 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8 signext %4)
switch i8 %4, label %8 [
i8 65, label %9
i8 67, label %11
i8 68, label %13
i8 69, label %15
i8 76, label %17
i8 77, label %19
i8 78, label %21
i8 79, label %23
i8 80, label %25
i8 82, label %27
i8 83, label %29
i8 84, label %31
i8 85, label %33
i8 86, label %35
i8 87, label %37
i8 88, label %39
]
8: ; preds = %1, %11, %15, %19, %23, %27, %31, %35, %37, %33, %29, %25, %21, %17, %13, %9
br label %1
9: ; preds = %1
%10 = tail call i32 (...) @displayScalarProduct()
br label %8
11: ; preds = %1
%12 = tail call i32 (...) @displayCentreOfMedians()
br label %8
13: ; preds = %1
%14 = tail call i32 (...) @displayDistanceBetweenPoints()
br label %8
15: ; preds = %1
%16 = tail call i32 (...) @displayEqualVectors()
br label %8
17: ; preds = %1
%18 = tail call i32 (...) @displayLengthOfVector()
br label %8
19: ; preds = %1
%20 = tail call i32 (...) @displayMiddlePoint()
br label %8
21: ; preds = %1
%22 = tail call i32 (...) @displayLessOrEqualOrMoreThan90()
br label %8
23: ; preds = %1
%24 = tail call i32 (...) @displayCrossVector()
br label %8
25: ; preds = %1
%26 = tail call i32 (...) @displayProjection()
br label %8
27: ; preds = %1
%28 = tail call i32 (...) @displayParametricEquation()
br label %8
29: ; preds = %1
%30 = tail call i32 (...) @displayDirection()
br label %8
31: ; preds = %1
%32 = tail call i32 (...) @displayDeterminant()
br label %8
33: ; preds = %1
%34 = tail call i32 (...) @displayUnitVector()
br label %8
35: ; preds = %1
%36 = tail call i32 (...) @displayAngle()
br label %8
37: ; preds = %1
%38 = tail call i32 (...) @displayTwoUnknown()
br label %8
39: ; preds = %1
ret i32 0
}