#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*/ cartesian_to_geodetic();
int /*<<< orphan*/ clearScreen();
int /*<<< orphan*/ dd_to_dms();
int /*<<< orphan*/ dms_to_dd();
int /*<<< orphan*/ geodetic_to_cartesian();
int int_input(int, int, char const *);
int /*<<< orphan*/ normal_gravity();
int /*<<< orphan*/ print_menu();
int /*<<< orphan*/ utm_scale_error_distance();
int main(void) {
  int ret;
  clearScreen();
  const char *choose = "Choose operation by number: ";
  while (1) {
    print_menu();
    ret = int_input(1, 8, choose);
    switch (ret) {
    case 1:
      clearScreen();
      dms_to_dd();
      break;
    case 2:
      clearScreen();
      dd_to_dms();
      break;
    case 3:
      clearScreen();
      normal_gravity();
      break;
    case 4:
      clearScreen();
      geodetic_to_cartesian();
      break;
    case 5:
      clearScreen();
      cartesian_to_geodetic();
      break;
    case 6:
      clearScreen();
      utm_scale_error_distance();
      break;
    }
    if (ret == 7) {
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <clearScreen@plt>
lea    0xe6b(%rip),%rax
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
call   1090 <print_menu@plt>
mov    -0x10(%rbp),%rdx
mov    $0x1,%edi
mov    $0x8,%esi
call   1060 <int_input@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5,%eax
ja     1264 <main+0xd4>
mov    -0x18(%rbp),%rax
lea    0xe12(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1080 <clearScreen@plt>
mov    $0x0,%al
call   1040 <dms_to_dd@plt>
jmp    1264 <main+0xd4>
mov    $0x0,%al
call   1080 <clearScreen@plt>
mov    $0x0,%al
call   10b0 <dd_to_dms@plt>
jmp    1264 <main+0xd4>
mov    $0x0,%al
call   1080 <clearScreen@plt>
mov    $0x0,%al
call   10a0 <normal_gravity@plt>
jmp    1264 <main+0xd4>
mov    $0x0,%al
call   1080 <clearScreen@plt>
mov    $0x0,%al
call   1030 <geodetic_to_cartesian@plt>
jmp    1264 <main+0xd4>
mov    $0x0,%al
call   1080 <clearScreen@plt>
mov    $0x0,%al
call   1050 <cartesian_to_geodetic@plt>
jmp    1264 <main+0xd4>
mov    $0x0,%al
call   1080 <clearScreen@plt>
mov    $0x0,%al
call   1070 <utm_scale_error_distance@plt>
cmpl   $0x7,-0x8(%rbp)
jne    1273 <main+0xe3>
jmp    1278 <main+0xe8>
jmp    11b1 <main+0x21>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1080 <clearScreen@plt>
lea    0xe7a(%rip),%r14
lea    0xe57(%rip),%rbx
jmp    11c0 <main+0x30>
xor    %eax,%eax
call   1080 <clearScreen@plt>
xor    %eax,%eax
call   1070 <utm_scale_error_distance@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   1090 <print_menu@plt>
mov    $0x1,%edi
mov    $0x8,%esi
mov    %r14,%rdx
call   1060 <int_input@plt>
add    $0xffffffff,%eax
cmp    $0x6,%eax
ja     11c0 <main+0x30>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1080 <clearScreen@plt>
xor    %eax,%eax
call   1040 <dms_to_dd@plt>
jmp    11c0 <main+0x30>
xor    %eax,%eax
call   1080 <clearScreen@plt>
xor    %eax,%eax
call   10b0 <dd_to_dms@plt>
jmp    11c0 <main+0x30>
xor    %eax,%eax
call   1080 <clearScreen@plt>
xor    %eax,%eax
call   10a0 <normal_gravity@plt>
jmp    11c0 <main+0x30>
xor    %eax,%eax
call   1080 <clearScreen@plt>
xor    %eax,%eax
call   1030 <geodetic_to_cartesian@plt>
jmp    11c0 <main+0x30>
xor    %eax,%eax
call   1080 <clearScreen@plt>
xor    %eax,%eax
call   1050 <cartesian_to_geodetic@plt>
jmp    11c0 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Choose operation by number: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i32 (...) @clearScreen()
store i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8** %3
br label %5
5: ; preds = %0, %32
%6 = call i32 (...) @print_menu()
%7 = load i8*, i8** %3
%8 = call i32 @int_input(i32 1, i32 8, i8* %7)
store i32 %8, i32* %2
%9 = load i32, i32* %2
switch i32 %9, label %28 [
i32 1, label %10
i32 2, label %13
i32 3, label %16
i32 4, label %19
i32 5, label %22
i32 6, label %25
]
10: ; preds = %5
%11 = call i32 (...) @clearScreen()
%12 = call i32 (...) @dms_to_dd()
br label %28
13: ; preds = %5
%14 = call i32 (...) @clearScreen()
%15 = call i32 (...) @dd_to_dms()
br label %28
16: ; preds = %5
%17 = call i32 (...) @clearScreen()
%18 = call i32 (...) @normal_gravity()
br label %28
19: ; preds = %5
%20 = call i32 (...) @clearScreen()
%21 = call i32 (...) @geodetic_to_cartesian()
br label %28
22: ; preds = %5
%23 = call i32 (...) @clearScreen()
%24 = call i32 (...) @cartesian_to_geodetic()
br label %28
25: ; preds = %5
%26 = call i32 (...) @clearScreen()
%27 = call i32 (...) @utm_scale_error_distance()
br label %28
28: ; preds = %5, %25, %22, %19, %16, %13, %10
%29 = load i32, i32* %2
%30 = icmp eq i32 %29, 7
br i1 %30, label %31, label %32
31: ; preds = %28
br label %33
32: ; preds = %28
br label %5
33: ; preds = %31
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Choose operation by number: \00"
define i32 @main() {
%1 = tail call i32 (...) @clearScreen()
br label %2
2: ; preds = %8, %0
%3 = tail call i32 (...) @print_menu()
%4 = tail call i32 @int_input(i32 1, i32 8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
switch i32 %4, label %8 [
i32 1, label %5
i32 2, label %9
i32 3, label %12
i32 4, label %15
i32 5, label %18
i32 6, label %21
i32 7, label %24
]
5: ; preds = %2
%6 = tail call i32 (...) @clearScreen()
%7 = tail call i32 (...) @dms_to_dd()
br label %8
8: ; preds = %5, %9, %12, %15, %18, %21, %2
br label %2
9: ; preds = %2
%10 = tail call i32 (...) @clearScreen()
%11 = tail call i32 (...) @dd_to_dms()
br label %8
12: ; preds = %2
%13 = tail call i32 (...) @clearScreen()
%14 = tail call i32 (...) @normal_gravity()
br label %8
15: ; preds = %2
%16 = tail call i32 (...) @clearScreen()
%17 = tail call i32 (...) @geodetic_to_cartesian()
br label %8
18: ; preds = %2
%19 = tail call i32 (...) @clearScreen()
%20 = tail call i32 (...) @cartesian_to_geodetic()
br label %8
21: ; preds = %2
%22 = tail call i32 (...) @clearScreen()
%23 = tail call i32 (...) @utm_scale_error_distance()
br label %8
24: ; preds = %2
ret i32 0
}