#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*/ display(int *);
int /*<<< orphan*/ error();
int /*<<< orphan*/ frequency(int *);
int menu();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ read_in(int *, int *, int *);
int /*<<< orphan*/ selection(int *);
int /*<<< orphan*/ welcome();
int /*<<< orphan*/ winner_check(int *);
main() {
  int input_numbers[6], loop = 0, menu_num, input_confirmation = 0, cpy = 0;
  int count[42] = {0};
  int *counter = &count[0];
  int *inputs = &input_numbers[0];
  int *confirm = &input_confirmation;
  int *copy = &cpy;
  welcome();
  while (loop != 1) {
    menu_num = menu();
    switch (menu_num) {
    case 1: {
      read_in(inputs, confirm, counter);
      break;
    }
    case 2: {
      if (input_confirmation == 1) {
        display(inputs);
      } else {
        error();
      }
      break;
    }
    case 3: {
      if (input_confirmation == 1) {
        selection(inputs);
      } else {
        error();
      }
      break;
    }
    case 4: {
      if (input_confirmation == 1) {
        winner_check(inputs);
      } else {
        error();
      }
      break;
    }
    case 5: {
      if (input_confirmation == 1) {
        frequency(counter);
      } else {
        error();
      }
      break;
    }
    case 6: {
      printf("\nThank you for using Paul Brittain's Lotto Checker\n");
      loop = 1;
      break;
    }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
lea    -0xe0(%rbp),%rdi
xor    %esi,%esi
mov    $0xa8,%edx
call   1080 <memset@plt>
lea    -0xe0(%rbp),%rax
mov    %rax,-0xe8(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0xf0(%rbp)
lea    -0x2c(%rbp),%rax
mov    %rax,-0xf8(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x100(%rbp)
mov    $0x0,%al
call   1090 <welcome@plt>
cmpl   $0x1,-0x24(%rbp)
je     1326 <main+0x186>
xor    %eax,%eax
call   1050 <menu@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x108(%rbp)
sub    $0x5,%eax
ja     1321 <main+0x181>
mov    -0x108(%rbp),%rax
lea    0xdb6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0xf0(%rbp),%rdi
mov    -0xf8(%rbp),%rsi
mov    -0xe8(%rbp),%rdx
call   10b0 <read_in@plt>
jmp    1321 <main+0x181>
cmpl   $0x1,-0x2c(%rbp)
jne    128d <main+0xed>
mov    -0xf0(%rbp),%rdi
call   1040 <display@plt>
jmp    1294 <main+0xf4>
mov    $0x0,%al
call   10a0 <error@plt>
jmp    1321 <main+0x181>
cmpl   $0x1,-0x2c(%rbp)
jne    12b4 <main+0x114>
mov    -0xf0(%rbp),%rdi
call   1030 <selection@plt>
jmp    12bb <main+0x11b>
mov    $0x0,%al
call   10a0 <error@plt>
jmp    1321 <main+0x181>
cmpl   $0x1,-0x2c(%rbp)
jne    12db <main+0x13b>
mov    -0xf0(%rbp),%rdi
call   10c0 <winner_check@plt>
jmp    12e2 <main+0x142>
mov    $0x0,%al
call   10a0 <error@plt>
jmp    1321 <main+0x181>
cmpl   $0x1,-0x2c(%rbp)
jne    1302 <main+0x162>
mov    -0xe8(%rbp),%rdi
call   1060 <frequency@plt>
jmp    1309 <main+0x169>
mov    $0x0,%al
call   10a0 <error@plt>
jmp    1321 <main+0x181>
lea    0xd03(%rip),%rdi
call   1070 <printf@plt>
movl   $0x1,-0x24(%rbp)
jmp    1210 <main+0x70>
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xd8,%rsp
movl   $0x0,0xc(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0xb0(%rsp)
xor    %eax,%eax
call   1080 <welcome@plt>
lea    0xe02(%rip),%rbx
lea    0xc0(%rsp),%r12
lea    0xc(%rsp),%r14
lea    0x10(%rsp),%r15
jmp    1227 <main+0x97>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1090 <error@plt>
xor    %eax,%eax
call   1060 <menu@plt>
add    $0xffffffff,%eax
cmp    $0x5,%eax
ja     1227 <main+0x97>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   10a0 <read_in@plt>
jmp    1227 <main+0x97>
cmpl   $0x1,0xc(%rsp)
jne    1220 <main+0x90>
mov    %r12,%rdi
call   1050 <display@plt>
jmp    1227 <main+0x97>
cmpl   $0x1,0xc(%rsp)
jne    1220 <main+0x90>
mov    %r12,%rdi
call   1030 <selection@plt>
jmp    1227 <main+0x97>
cmpl   $0x1,0xc(%rsp)
jne    1220 <main+0x90>
mov    %r12,%rdi
call   10b0 <winner_check@plt>
jmp    1227 <main+0x97>
cmpl   $0x1,0xc(%rsp)
jne    1220 <main+0x90>
mov    %r15,%rdi
call   1070 <frequency@plt>
jmp    1227 <main+0x97>
lea    0xd7e(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [52 x i8] c"\0AThank you for using Paul Brittain's Lotto Checker\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [42 x i32]
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %5
store i32 0, i32* %6
%12 = bitcast [42 x i32]* %7 to i8*
%13 = getelementptr inbounds [42 x i32], [42 x i32]* %7, i64 0, i64 0
store i32* %13, i32** %8
%14 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
store i32* %14, i32** %9
store i32* %5, i32** %10
store i32* %6, i32** %11
%15 = call i32 (...) @welcome()
br label %16
16: ; preds = %65, %0
%17 = load i32, i32* %3
%18 = icmp ne i32 %17, 1
br i1 %18, label %19, label %66
19: ; preds = %16
%20 = call i32 (...) @menu()
store i32 %20, i32* %4
%21 = load i32, i32* %4
switch i32 %21, label %65 [
i32 1, label %22
i32 2, label %27
i32 3, label %36
i32 4, label %45
i32 5, label %54
i32 6, label %63
]
22: ; preds = %19
%23 = load i32*, i32** %9
%24 = load i32*, i32** %10
%25 = load i32*, i32** %8
%26 = call i32 @read_in(i32* %23, i32* %24, i32* %25)
br label %65
27: ; preds = %19
%28 = load i32, i32* %5
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i32*, i32** %9
%32 = call i32 @display(i32* %31)
br label %35
33: ; preds = %27
%34 = call i32 (...) @error()
br label %35
35: ; preds = %33, %30
br label %65
36: ; preds = %19
%37 = load i32, i32* %5
%38 = icmp eq i32 %37, 1
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i32*, i32** %9
%41 = call i32 @selection(i32* %40)
br label %44
42: ; preds = %36
%43 = call i32 (...) @error()
br label %44
44: ; preds = %42, %39
br label %65
45: ; preds = %19
%46 = load i32, i32* %5
%47 = icmp eq i32 %46, 1
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = load i32*, i32** %9
%50 = call i32 @winner_check(i32* %49)
br label %53
51: ; preds = %45
%52 = call i32 (...) @error()
br label %53
53: ; preds = %51, %48
br label %65
54: ; preds = %19
%55 = load i32, i32* %5
%56 = icmp eq i32 %55, 1
br i1 %56, label %57, label %60
57: ; preds = %54
%58 = load i32*, i32** %8
%59 = call i32 @frequency(i32* %58)
br label %62
60: ; preds = %54
%61 = call i32 (...) @error()
br label %62
62: ; preds = %60, %57
br label %65
63: ; preds = %19
%64 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %65
65: ; preds = %19, %63, %62, %53, %44, %35, %22
br label %16
66: ; preds = %16
%67 = load i32, i32* %1
ret i32 %67
}

LLVM IR (-O2):
@str = [51 x i8] c"\0AThank you for using Paul Brittain's Lotto Checker\00"
define i32 @main() {
%1 = alloca [6 x i32]
%2 = alloca i32
%3 = alloca [42 x i32]
%4 = bitcast [6 x i32]* %1 to i8*
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast [42 x i32]* %3 to i8*
%7 = getelementptr inbounds [42 x i32], [42 x i32]* %3, i64 0, i64 0
%8 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%9 = tail call i32 (...) @welcome()
br label %10
10: ; preds = %40, %0
%11 = call i32 (...) @menu()
switch i32 %11, label %40 [
i32 1, label %12
i32 2, label %14
i32 3, label %21
i32 4, label %28
i32 5, label %35
i32 6, label %43
]
12: ; preds = %10
%13 = call i32 @read_in(i32* %8, i32* %2, i32* %7)
br label %40
14: ; preds = %10
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @display(i32* %8)
br label %40
19: ; preds = %14
%20 = call i32 (...) @error()
br label %40
21: ; preds = %10
%22 = load i32, i32* %2
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 @selection(i32* %8)
br label %40
26: ; preds = %21
%27 = call i32 (...) @error()
br label %40
28: ; preds = %10
%29 = load i32, i32* %2
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = call i32 @winner_check(i32* %8)
br label %40
33: ; preds = %28
%34 = call i32 (...) @error()
br label %40
35: ; preds = %10
%36 = load i32, i32* %2
%37 = icmp eq i32 %36, 1
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = call i32 @frequency(i32* %7)
br label %40
40: ; preds = %38, %41, %31, %33, %24, %26, %17, %19, %10, %12
br label %10
41: ; preds = %35
%42 = call i32 (...) @error()
br label %40
43: ; preds = %10
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
ret i32 0
}