#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*/ check_frequency5(int *, int *);
int /*<<< orphan*/ check_wins4(int *);
int /*<<< orphan*/ display_user_nums2(int *);
int /*<<< orphan*/ enter_nums1(int *, int *, int *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ print_menu();
int /*<<< orphan*/ print_welcome();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ sort3(int *);
main() {
  char option;
  int user_nums[6];
  int valid = 0;
  int flag_freq = 0;
  print_welcome();
  do {
    print_menu();
    scanf("%1s", &option);
    switch (option) {
    case '1': {
      enter_nums1(&valid, &flag_freq, user_nums);
      break;
    }
    case '2': {
      if (valid == 0) {
        printf("\n*** ERROR: You must enter valid numbers first!\n");
      } else {
        display_user_nums2(user_nums);
      }
      break;
    }
    case '3': {
      if (valid == 0) {
        printf("\n*** ERROR: You must enter valid numbers first!\n");
      } else {
        sort3(user_nums);
      }
      break;
    }
    case '4': {
      if (valid == 0) {
        printf("\n*** ERROR: You must enter valid numbers first!\n");
      } else {
        check_wins4(user_nums);
      }
      break;
    }
    case '5': {
      if (valid == 0) {
        printf("\n*** ERROR: You must enter valid numbers first!\n");
      } else {
        check_frequency5(&flag_freq, user_nums);
      }
      break;
    }
    case '6': {
      option = 6;
      getchar();
      printf("\n\t\t\tYou selected Option 6 - Exit Game\n");
      printf("\n   Thank You for Playing - Goodbye!\n");
      printf("\n   - Press 'enter' to exit.");
      break;
    }
    default: {
      printf("\n*** ERROR: Please enter a VALID OPTION 1-6\n");
      break;
    }
    }
  } while (option != 6);
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    $0x0,%al
call   1090 <print_welcome@plt>
xor    %eax,%eax
call   1060 <print_menu@plt>
lea    0xe46(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   10a0 <scanf@plt>
movsbl -0x5(%rbp),%eax
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x5,%eax
ja     12f7 <main+0x157>
mov    -0x30(%rbp),%rax
lea    0xe04(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x20(%rbp),%rdx
lea    -0x24(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1070 <enter_nums1@plt>
jmp    1303 <main+0x163>
cmpl   $0x0,-0x24(%rbp)
jne    1236 <main+0x96>
lea    0xdf0(%rip),%rdi
call   1030 <printf@plt>
jmp    123f <main+0x9f>
lea    -0x20(%rbp),%rdi
call   10b0 <display_user_nums2@plt>
jmp    1303 <main+0x163>
cmpl   $0x0,-0x24(%rbp)
jne    125f <main+0xbf>
lea    0xdc7(%rip),%rdi
call   1030 <printf@plt>
jmp    1268 <main+0xc8>
lea    -0x20(%rbp),%rdi
call   10c0 <sort3@plt>
jmp    1303 <main+0x163>
cmpl   $0x0,-0x24(%rbp)
jne    1288 <main+0xe8>
lea    0xd9e(%rip),%rdi
call   1030 <printf@plt>
jmp    1291 <main+0xf1>
lea    -0x20(%rbp),%rdi
call   1040 <check_wins4@plt>
jmp    1303 <main+0x163>
cmpl   $0x0,-0x24(%rbp)
jne    12b1 <main+0x111>
lea    0xd75(%rip),%rdi
call   1030 <printf@plt>
jmp    12be <main+0x11e>
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdi
call   1080 <check_frequency5@plt>
jmp    1303 <main+0x163>
movb   $0x6,-0x5(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
lea    0xd78(%rip),%rdi
call   1030 <printf@plt>
lea    0xd93(%rip),%rdi
call   1030 <printf@plt>
lea    0xdad(%rip),%rdi
call   1030 <printf@plt>
jmp    1303 <main+0x163>
lea    0xdb9(%rip),%rdi
call   1030 <printf@plt>
jmp    1308 <main+0x168>
movsbl -0x5(%rbp),%eax
cmp    $0x6,%eax
jne    11c4 <main+0x24>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movl   $0x0,0x8(%rsp)
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
call   10a0 <print_welcome@plt>
lea    0xe3c(%rip),%r14
lea    0x7(%rsp),%rbx
lea    0xe18(%rip),%r12
lea    0xc(%rsp),%r13
lea    0x10(%rsp),%rbp
lea    0xe8b(%rip),%r15
jmp    1213 <main+0x63>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <puts@plt>
cmpb   $0x6,0x7(%rsp)
je     12dc <main+0x12c>
xor    %eax,%eax
call   1070 <print_menu@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   10b0 <scanf@plt>
movsbl 0x7(%rsp),%eax
add    $0xffffffcf,%eax
cmp    $0x5,%eax
ja     124d <main+0x9d>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
lea    0x8(%rsp),%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
call   1080 <enter_nums1@plt>
jmp    1208 <main+0x58>
lea    0xe60(%rip),%rdi
jmp    1203 <main+0x53>
cmpl   $0x0,0x8(%rsp)
je     1200 <main+0x50>
mov    %rbp,%rdi
call   10c0 <display_user_nums2@plt>
jmp    1208 <main+0x58>
cmpl   $0x0,0x8(%rsp)
je     1200 <main+0x50>
mov    %rbp,%rdi
call   10d0 <sort3@plt>
jmp    1208 <main+0x58>
cmpl   $0x0,0x8(%rsp)
je     1200 <main+0x50>
mov    %rbp,%rdi
call   1050 <check_wins4@plt>
jmp    1208 <main+0x58>
cmpl   $0x0,0x8(%rsp)
je     1200 <main+0x50>
mov    %r13,%rdi
mov    %rbp,%rsi
call   1090 <check_frequency5@plt>
jmp    1208 <main+0x58>
movb   $0x6,0x7(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
lea    0xd7f(%rip),%rdi
call   1030 <puts@plt>
lea    0xd99(%rip),%rdi
call   1030 <puts@plt>
lea    0xd4a(%rip),%rdi
call   1040 <printf@plt>
jmp    1208 <main+0x58>
xor    %eax,%eax
call   1060 <getchar@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%1s\00"
@.str.1 = [49 x i8] c"\0A*** ERROR: You must enter valid numbers first!\0A\00"
@.str.2 = [39 x i8] c"\0A\09\09\09You selected Option 6 - Exit Game\0A\00"
@.str.3 = [38 x i8] c"\0A Thank You for Playing - Goodbye!\0A\00"
@.str.4 = [29 x i8] c"\0A - Press 'enter' to exit.\00"
@.str.5 = [45 x i8] c"\0A*** ERROR: Please enter a VALID OPTION 1-6\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca [6 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
%6 = call i32 (...) @print_welcome()
br label %7
7: ; preds = %59, %0
%8 = call i32 (...) @print_menu()
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
switch i32 %11, label %56 [
i32 49, label %12
i32 50, label %15
i32 51, label %24
i32 52, label %33
i32 53, label %42
i32 54, label %51
]
12: ; preds = %7
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%14 = call i32 @enter_nums1(i32* %4, i32* %5, i32* %13)
br label %58
15: ; preds = %7
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
br label %23
20: ; preds = %15
%21 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%22 = call i32 @display_user_nums2(i32* %21)
br label %23
23: ; preds = %20, %18
br label %58
24: ; preds = %7
%25 = load i32, i32* %4
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
br label %32
29: ; preds = %24
%30 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%31 = call i32 @sort3(i32* %30)
br label %32
32: ; preds = %29, %27
br label %58
33: ; preds = %7
%34 = load i32, i32* %4
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
br label %41
38: ; preds = %33
%39 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%40 = call i32 @check_wins4(i32* %39)
br label %41
41: ; preds = %38, %36
br label %58
42: ; preds = %7
%43 = load i32, i32* %4
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
br label %50
47: ; preds = %42
%48 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%49 = call i32 @check_frequency5(i32* %5, i32* %48)
br label %50
50: ; preds = %47, %45
br label %58
51: ; preds = %7
store i8 6, i8* %2
%52 = call i32 (...) @getchar()
%53 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%54 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%55 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
br label %58
56: ; preds = %7
%57 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
br label %58
58: ; preds = %56, %51, %50, %41, %32, %23, %12
br label %59
59: ; preds = %58
%60 = load i8, i8* %2
%61 = sext i8 %60 to i32
%62 = icmp ne i32 %61, 6
br i1 %62, label %7, label %63
63: ; preds = %59
%64 = call i32 (...) @getchar()
%65 = load i32, i32* %1
ret i32 %65
}

LLVM IR (-O2):
@.str = [4 x i8] c"%1s\00"
@.str.4 = [29 x i8] c"\0A - Press 'enter' to exit.\00"
@str = [38 x i8] c"\0A\09\09\09You selected Option 6 - Exit Game\00"
@str.6 = [37 x i8] c"\0A Thank You for Playing - Goodbye!\00"
@str.10 = [48 x i8] c"\0A*** ERROR: You must enter valid numbers first!\00"
@str.11 = [44 x i8] c"\0A*** ERROR: Please enter a VALID OPTION 1-6\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca [6 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = bitcast [6 x i32]* %2 to i8*
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%8 = tail call i32 (...) @print_welcome()
%9 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
br label %10
10: ; preds = %52, %0
%11 = call i32 (...) @print_menu()
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%13 = load i8, i8* %1
%14 = sext i8 %13 to i32
switch i32 %14, label %50 [
i32 49, label %15
i32 50, label %17
i32 51, label %24
i32 52, label %31
i32 53, label %38
i32 54, label %45
]
15: ; preds = %10
%16 = call i32 @enter_nums1(i32* %3, i32* %4, i32* %9)
br label %52
17: ; preds = %10
%18 = load i32, i32* %3
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.10, i64 0, i64 0))
br label %52
22: ; preds = %17
%23 = call i32 @display_user_nums2(i32* %9)
br label %52
24: ; preds = %10
%25 = load i32, i32* %3
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.10, i64 0, i64 0))
br label %52
29: ; preds = %24
%30 = call i32 @sort3(i32* %9)
br label %52
31: ; preds = %10
%32 = load i32, i32* %3
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.10, i64 0, i64 0))
br label %52
36: ; preds = %31
%37 = call i32 @check_wins4(i32* %9)
br label %52
38: ; preds = %10
%39 = load i32, i32* %3
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.10, i64 0, i64 0))
br label %52
43: ; preds = %38
%44 = call i32 @check_frequency5(i32* %4, i32* %9)
br label %52
45: ; preds = %10
store i8 6, i8* %1
%46 = call i32 (...) @getchar()
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%48 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.6, i64 0, i64 0))
%49 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
br label %52
50: ; preds = %10
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.11, i64 0, i64 0))
br label %52
52: ; preds = %15, %45, %50, %22, %20, %29, %27, %36, %34, %43, %41
%53 = load i8, i8* %1
%54 = icmp eq i8 %53, 6
br i1 %54, label %55, label %10
55: ; preds = %52
%56 = call i32 (...) @getchar()
ret i32 0
}