#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 atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ f_ani();
int /*<<< orphan*/ gtmotion();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char **);
void f_menu() {
  for (;;) {
    printf("\n\tgMOP3D MOtion Path with 3D animation\n\n");
    printf("Manipulator or axle base Robotics path model builder system.\n");
    printf("Simulation with openSCAD, but you must build path model again.\n");
    printf(
        "Robot model with 6 axle, robot model changed by source code only.\n");
    printf("Path only support cube only, build path by your self by "
           "instructions.\n");
    printf("1. Build path model as build openSCAD model.\n");
    printf("2. Start animation of path model.\n");
    printf("99. Escape the Program and Save parameters.\n");
    printf("->");
    int c;
    char s_c[10];
    scanf("%s", &s_c);
    c = atoi(s_c);
    switch (c) {
    case 99:
      printf("Thanks for your use GMOP3D, and see you next time!\n");
      exit(0);
    case 1:
      gtmotion();
      break;
    case 2:
      f_ani();
      break;
    default:
      printf("\nError input! Please enter integer between 1 or 99 only.\n");
      break;
    }
  }
}


x86 assembly (clang, -O0):
<f_menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xe91(%rip),%rdi
call   1050 <printf@plt>
lea    0xeae(%rip),%rdi
call   1050 <printf@plt>
lea    0xee0(%rip),%rdi
call   1050 <printf@plt>
lea    0xf14(%rip),%rdi
call   1050 <printf@plt>
lea    0xf4b(%rip),%rdi
call   1050 <printf@plt>
lea    0xf86(%rip),%rdi
call   1050 <printf@plt>
lea    0xfa8(%rip),%rdi
call   1050 <printf@plt>
lea    0xfbf(%rip),%rdi
call   1050 <printf@plt>
lea    0xfe0(%rip),%rdi
call   1050 <printf@plt>
lea    0xfd7(%rip),%rdi
lea    -0xe(%rbp),%rsi
mov    %rsi,-0x20(%rbp)
call   1060 <scanf@plt>
mov    -0x20(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     123d <f_menu+0xdd>
jmp    1208 <f_menu+0xa8>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1249 <f_menu+0xe9>
jmp    1219 <f_menu+0xb9>
mov    -0x14(%rbp),%eax
sub    $0x63,%eax
jne    1255 <f_menu+0xf5>
jmp    122a <f_menu+0xca>
lea    0xf84(%rip),%rdi
call   1050 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>
mov    $0x0,%al
call   1040 <gtmotion@plt>
jmp    1261 <f_menu+0x101>
mov    $0x0,%al
call   1030 <f_ani@plt>
jmp    1261 <f_menu+0x101>
lea    0xf8d(%rip),%rdi
call   1050 <printf@plt>
jmp    1168 <f_menu+0x8>

x86 assembly (clang, -O2):
<f_menu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xfad(%rip),%rbp
lea    0xfd3(%rip),%r14
lea    0xfee(%rip),%r15
lea    0xe66(%rip),%r12
lea    0xe62(%rip),%r13
lea    0xe(%rsp),%rbx
jmp    11b7 <f_menu+0x47>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <f_ani@plt>
lea    0xe48(%rip),%rdi
call   1050 <puts@plt>
lea    0xe64(%rip),%rdi
call   1050 <puts@plt>
lea    0xe95(%rip),%rdi
call   1050 <puts@plt>
lea    0xec8(%rip),%rdi
call   1050 <puts@plt>
lea    0xefe(%rip),%rdi
call   1050 <puts@plt>
mov    %rbp,%rdi
call   1050 <puts@plt>
mov    %r14,%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
call   1050 <puts@plt>
mov    %r12,%rdi
call   1060 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1080 <atoi@plt>
cmp    $0x1,%eax
je     1250 <f_menu+0xe0>
cmp    $0x2,%eax
je     11b0 <f_menu+0x40>
cmp    $0x63,%eax
je     125c <f_menu+0xec>
lea    0xfa4(%rip),%rdi
call   1050 <puts@plt>
jmp    11b7 <f_menu+0x47>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <gtmotion@plt>
jmp    11b7 <f_menu+0x47>
lea    0xf4a(%rip),%rdi
call   1050 <puts@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"\0A\09gMOP3D MOtion Path with 3D animation\0A\0A\00"
@.str.1 = [62 x i8] c"Manipulator or axle base Robotics path model builder system.\0A\00"
@.str.2 = [64 x i8] c"Simulation with openSCAD, but you must build path model again.\0A\00"
@.str.3 = [67 x i8] c"Robot model with 6 axle, robot model changed by source code only.\0A\00"
@.str.4 = [71 x i8] c"Path only support cube only, build path by your self by instructions.\0A\00"
@.str.5 = [46 x i8] c"1. Build path model as build openSCAD model.\0A\00"
@.str.6 = [35 x i8] c"2. Start animation of path model.\0A\00"
@.str.7 = [45 x i8] c"99. Escape the Program and Save parameters.\0A\00"
@.str.8 = [3 x i8] c"->\00"
@.str.9 = [3 x i8] c"%s\00"
@.str.10 = [52 x i8] c"Thanks for your use GMOP3D, and see you next time!\0A\00"
@.str.11 = [58 x i8] c"\0AError input! Please enter integer between 1 or 99 only.\0A\00"
define void @f_menu() {
%1 = alloca i32
%2 = alloca [10 x i8]
br label %3
3: ; preds = %27, %0
%4 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%13 = bitcast [10 x i8]* %2 to i8**
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8** %13)
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %1
%17 = load i32, i32* %1
switch i32 %17, label %25 [
i32 99, label %18
i32 1, label %21
i32 2, label %23
]
18: ; preds = %3
%19 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.10, i64 0, i64 0))
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %3
%22 = call i32 (...) @gtmotion()
br label %27
23: ; preds = %3
%24 = call i32 (...) @f_ani()
br label %27
25: ; preds = %3
%26 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.11, i64 0, i64 0))
br label %27
27: ; preds = %25, %23, %21
br label %3
}

LLVM IR (-O2):
@.str.8 = [3 x i8] c"->\00"
@.str.9 = [3 x i8] c"%s\00"
@str = [40 x i8] c"\0A\09gMOP3D MOtion Path with 3D animation\0A\00"
@str.12 = [61 x i8] c"Manipulator or axle base Robotics path model builder system.\00"
@str.13 = [63 x i8] c"Simulation with openSCAD, but you must build path model again.\00"
@str.14 = [66 x i8] c"Robot model with 6 axle, robot model changed by source code only.\00"
@str.15 = [70 x i8] c"Path only support cube only, build path by your self by instructions.\00"
@str.16 = [45 x i8] c"1. Build path model as build openSCAD model.\00"
@str.17 = [34 x i8] c"2. Start animation of path model.\00"
@str.18 = [44 x i8] c"99. Escape the Program and Save parameters.\00"
@str.19 = [51 x i8] c"Thanks for your use GMOP3D, and see you next time!\00"
@str.20 = [57 x i8] c"\0AError input! Please enter integer between 1 or 99 only.\00"
define void @f_menu() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = bitcast [10 x i8]* %1 to i8**
br label %4
4: ; preds = %25, %0
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.12, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str.13, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.14, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str.15, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.16, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.17, i64 0, i64 0))
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.18, i64 0, i64 0))
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8** %3)
%15 = call i32 @atoi(i8* %2)
switch i32 %15, label %23 [
i32 99, label %16
i32 1, label %19
i32 2, label %21
]
16: ; preds = %4
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.19, i64 0, i64 0))
%18 = call i32 @exit(i32 0)
unreachable
19: ; preds = %4
%20 = call i32 (...) @gtmotion()
br label %25
21: ; preds = %4
%22 = call i32 (...) @f_ani()
br label %25
23: ; preds = %4
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.20, i64 0, i64 0))
br label %25
25: ; preds = %23, %21, %19
br label %4
}