#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*/ GetUserInput(char *, int);
size_t atoi(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
int Menu() {
  char choose[2];
  size_t sel = 1;
  while (1) {
    printf("\n Please select option \n");
    printf(" Log out from server ------------------> 3  \n");
    printf(" Disconnect from server ---------------> 4  \n");
    printf(" Delete user --------------------------> 5  \n");
    printf(" Create new group ---------------------> 6  \n");
    printf(" Join to group ------------------------> 7  \n");
    printf(" Leave group --------------------------> 8  \n");
    printf(" Show all groups ----------------------> 9  \n");
    printf(" To Exit Press-------------------------> 0  \n");
    GetUserInput(choose, 2);
    sel = atoi(choose);
    system("clear");
    if (sel != 1 && sel != 2) {
      break;
    }
  }
  return sel;
}


x86 assembly (clang, -O0):
<Menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x1,-0x10(%rbp)
lea    0xea9(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb6(%rip),%rdi
call   1050 <printf@plt>
lea    0xed8(%rip),%rdi
call   1050 <printf@plt>
lea    0xefa(%rip),%rdi
call   1050 <printf@plt>
lea    0xf1c(%rip),%rdi
call   1050 <printf@plt>
lea    0xf3e(%rip),%rdi
call   1050 <printf@plt>
lea    0xf60(%rip),%rdi
call   1050 <printf@plt>
lea    0xf82(%rip),%rdi
call   1050 <printf@plt>
lea    0xfa4(%rip),%rdi
call   1050 <printf@plt>
lea    -0x2(%rbp),%rdi
mov    $0x2,%esi
call   1030 <GetUserInput@plt>
lea    -0x2(%rbp),%rdi
call   1060 <atoi@plt>
mov    %rax,-0x10(%rbp)
lea    0xfab(%rip),%rdi
call   1040 <system@plt>
cmpq   $0x1,-0x10(%rbp)
je     11fe <Menu+0xbe>
cmpq   $0x2,-0x10(%rbp)
je     11fe <Menu+0xbe>
jmp    1203 <Menu+0xc3>
jmp    1150 <Menu+0x10>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Menu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xfad(%rip),%r14
lea    0xfd3(%rip),%r15
lea    0xff9(%rip),%r12
lea    0x6(%rsp),%r13
lea    0xe94(%rip),%rbx
nopl   0x0(%rax)
lea    0xe8f(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9b(%rip),%rdi
call   1040 <puts@plt>
lea    0xebc(%rip),%rdi
call   1040 <puts@plt>
lea    0xedd(%rip),%rdi
call   1040 <puts@plt>
lea    0xefe(%rip),%rdi
call   1040 <puts@plt>
lea    0xf1f(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
mov    $0x2,%esi
call   1030 <GetUserInput@plt>
mov    %r13,%rdi
call   1060 <atoi@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1050 <system@plt>
lea    -0x3(%rbp),%rax
cmp    $0xfffffffffffffffd,%rax
ja     1170 <Menu+0x30>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\0A Please select option \0A\00"
@.str.1 = [46 x i8] c" Log out from server ------------------> 3 \0A\00"
@.str.2 = [46 x i8] c" Disconnect from server ---------------> 4 \0A\00"
@.str.3 = [46 x i8] c" Delete user --------------------------> 5 \0A\00"
@.str.4 = [46 x i8] c" Create new group ---------------------> 6 \0A\00"
@.str.5 = [46 x i8] c" Join to group ------------------------> 7 \0A\00"
@.str.6 = [46 x i8] c" Leave group --------------------------> 8 \0A\00"
@.str.7 = [46 x i8] c" Show all groups ----------------------> 9 \0A\00"
@.str.8 = [46 x i8] c" To Exit Press-------------------------> 0 \0A\00"
@.str.9 = [6 x i8] c"clear\00"
define i32 @Menu() {
%1 = alloca [2 x i8]
%2 = alloca i64
store i64 1, i64* %2
br label %3
3: ; preds = %0, %24
%4 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 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 ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0))
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%14 = call i32 @GetUserInput(i8* %13, i32 2)
%15 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%16 = call i64 @atoi(i8* %15)
store i64 %16, i64* %2
%17 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%18 = load i64, i64* %2
%19 = icmp ne i64 %18, 1
br i1 %19, label %20, label %24
20: ; preds = %3
%21 = load i64, i64* %2
%22 = icmp ne i64 %21, 2
br i1 %22, label %23, label %24
23: ; preds = %20
br label %25
24: ; preds = %20, %3
br label %3
25: ; preds = %23
%26 = load i64, i64* %2
%27 = trunc i64 %26 to i32
ret i32 %27
}

LLVM IR (-O2):
@.str.9 = [6 x i8] c"clear\00"
@str = [24 x i8] c"\0A Please select option \00"
@str.10 = [45 x i8] c" Log out from server ------------------> 3 \00"
@str.11 = [45 x i8] c" Disconnect from server ---------------> 4 \00"
@str.12 = [45 x i8] c" Delete user --------------------------> 5 \00"
@str.13 = [45 x i8] c" Create new group ---------------------> 6 \00"
@str.14 = [45 x i8] c" Join to group ------------------------> 7 \00"
@str.15 = [45 x i8] c" Leave group --------------------------> 8 \00"
@str.16 = [45 x i8] c" Show all groups ----------------------> 9 \00"
@str.17 = [45 x i8] c" To Exit Press-------------------------> 0 \00"
define i32 @Menu() {
%1 = alloca [2 x i8]
%2 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %3, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.10, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.11, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.12, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.13, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.14, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.15, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.16, i64 0, i64 0))
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.17, i64 0, i64 0))
%13 = call i32 @GetUserInput(i8* %2, i32 2)
%14 = call i64 @atoi(i8* %2)
%15 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%16 = add i64 %14, -3
%17 = icmp ult i64 %16, -2
br i1 %17, label %18, label %3
18: ; preds = %3
%19 = trunc i64 %14 to i32
ret i32 %19
}