#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*/ existingUserloginFunction();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ newUserRegistrationFunction();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int userInput = -1;
  printf(" * * * Welcome to Splits * * * \n\n\n\n");
  while (userInput != 0) {
    printf("Select one of the following options\n");
    printf("1. Login\n");
    printf("2. Create New User\n");
    printf("0. Exit Splits\n");
    scanf("%d", &userInput);
    switch (userInput) {
    case 1:
      existingUserloginFunction();
      break;
    case 2:
      newUserRegistrationFunction();
      break;
    case 0:
      exit(0);
      break;
    default:
      printf("Invalid input. Try again\n");
    }
  }
  while (userInput != 0) {
    printf("Select one of the following options\n");
    printf("1. View past bills\n");
    printf("2. Add a new bill\n");
    printf("3. Change a past bill\n");
    printf("4. Delete a past bill\n");
    printf("0. Exit Splits\n");
    scanf("%d", &userInput);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
je     1221 <main+0xd1>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     1209 <main+0xb9>
jmp    11cf <main+0x7f>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     11f1 <main+0xa1>
jmp    11e0 <main+0x90>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11fd <main+0xad>
jmp    1210 <main+0xc0>
mov    $0x0,%al
call   1060 <existingUserloginFunction@plt>
jmp    121c <main+0xcc>
mov    $0x0,%al
call   1040 <newUserRegistrationFunction@plt>
jmp    121c <main+0xcc>
xor    %edi,%edi
call   1070 <exit@plt>
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
jmp    1172 <main+0x22>
jmp    1226 <main+0xd6>
cmpl   $0x0,-0x8(%rbp)
je     128d <main+0x13d>
lea    0xded(%rip),%rdi
call   1030 <printf@plt>
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
lea    0xdf4(%rip),%rdi
call   1030 <printf@plt>
lea    0xdf8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
jmp    1226 <main+0xd6>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0xffffffff,0x4(%rsp)
ff
lea    0xe99(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%r14
lea    0xecd(%rip),%r15
lea    0xecf(%rip),%r12
lea    0xedb(%rip),%r13
lea    0xe6e(%rip),%rbx
lea    0x4(%rsp),%rbp
jmp    11ae <main+0x5e>
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <newUserRegistrationFunction@plt>
cmpl   $0x0,0x4(%rsp)
je     1209 <main+0xb9>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
je     1200 <main+0xb0>
cmp    $0x2,%eax
je     11a0 <main+0x50>
test   %eax,%eax
je     121a <main+0xca>
lea    0xe83(%rip),%rdi
call   1030 <puts@plt>
jmp    11a7 <main+0x57>
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <existingUserloginFunction@plt>
jmp    11a7 <main+0x57>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [36 x i8] c" * * * Welcome to Splits * * * \0A\0A\0A\0A\00"
@.str.1 = [37 x i8] c"Select one of the following options\0A\00"
@.str.2 = [10 x i8] c"1. Login\0A\00"
@.str.3 = [20 x i8] c"2. Create New User\0A\00"
@.str.4 = [16 x i8] c"0. Exit Splits\0A\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [26 x i8] c"Invalid input. Try again\0A\00"
@.str.7 = [20 x i8] c"1. View past bills\0A\00"
@.str.8 = [19 x i8] c"2. Add a new bill\0A\00"
@.str.9 = [23 x i8] c"3. Change a past bill\0A\00"
@.str.10 = [23 x i8] c"4. Delete a past bill\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %22, %0
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %23
7: ; preds = %4
%8 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
switch i32 %13, label %20 [
i32 1, label %14
i32 2, label %16
i32 0, label %18
]
14: ; preds = %7
%15 = call i32 (...) @existingUserloginFunction()
br label %22
16: ; preds = %7
%17 = call i32 (...) @newUserRegistrationFunction()
br label %22
18: ; preds = %7
%19 = call i32 @exit(i32 0)
unreachable
20: ; preds = %7
%21 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
br label %22
22: ; preds = %20, %16, %14
br label %4
23: ; preds = %4
br label %24
24: ; preds = %27, %23
%25 = load i32, i32* %2
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %35
27: ; preds = %24
%28 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
%30 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
%31 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%32 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0))
%33 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
br label %24
35: ; preds = %24
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
@.str.5 = [3 x i8] c"%d\00"
@str = [35 x i8] c" * * * Welcome to Splits * * * \0A\0A\0A\00"
@str.17 = [36 x i8] c"Select one of the following options\00"
@str.18 = [9 x i8] c"1. Login\00"
@str.19 = [19 x i8] c"2. Create New User\00"
@str.20 = [15 x i8] c"0. Exit Splits\00"
@str.21 = [25 x i8] c"Invalid input. Try again\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 -1, i32* %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %0, %19
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.17, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.18, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.19, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.20, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
switch i32 %10, label %17 [
i32 1, label %11
i32 2, label %13
i32 0, label %15
]
11: ; preds = %4
%12 = call i32 (...) @existingUserloginFunction()
br label %19
13: ; preds = %4
%14 = call i32 (...) @newUserRegistrationFunction()
br label %19
15: ; preds = %4
%16 = call i32 @exit(i32 0)
unreachable
17: ; preds = %4
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.21, i64 0, i64 0))
br label %19
19: ; preds = %17, %13, %11
%20 = load i32, i32* %1
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %4
22: ; preds = %19
ret i32 0
}