#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 */
char getchar();
scalar_t__ isdigit(char);
int /*<<< orphan*/ printf(char *);
void Menu(int *choice) {
  char local;
  printf("\nEnter\t1 to add item,\n\t2 to remove item\n\\t3 to print "
         "queue\n\t4 to quit\n");
  do {
    local = getchar();
    if ((isdigit(local) == 0) && (local != '\n')) {
      printf("\nyou must enter an integer.\n");
      printf("Enter 1 to add, 2 to remove, 3 to print, 4 to quit\n");
    }
  } while (isdigit((unsigned char)local) == 0);
  *choice = (int)local - '0';
}


x86 assembly (clang, -O0):
<Menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
jne    118a <Menu+0x5a>
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
je     118a <Menu+0x5a>
lea    0xece(%rip),%rdi
call   1040 <printf@plt>
lea    0xedf(%rip),%rdi
call   1040 <printf@plt>
jmp    118f <Menu+0x5f>
movsbl -0x9(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1148 <Menu+0x18>
movsbl -0x9(%rbp),%ecx
sub    $0x30,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Menu>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xebf(%rip),%rdi
call   1040 <puts@plt>
lea    0xef9(%rip),%r15
lea    0xf0e(%rip),%rbx
jmp    116c <Menu+0x3c>
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    119a <Menu+0x6a>
xor    %eax,%eax
call   1050 <getchar@plt>
movsbl %al,%ebp
mov    %ebp,%edi
call   1030 <isdigit@plt>
cmp    $0xa,%bpl
je     1160 <Menu+0x30>
test   %rax,%rax
jne    1160 <Menu+0x30>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
jmp    1160 <Menu+0x30>
add    $0xffffffd0,%ebp
mov    %ebp,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [71 x i8] c"\0AEnter\091 to add item,\0A\092 to remove item\0A\\t3 to print queue\0A\094 to quit\0A\00"
@.str.1 = [29 x i8] c"\0Ayou must enter an integer.\0A\00"
@.str.2 = [52 x i8] c"Enter 1 to add, 2 to remove, 3 to print, 4 to quit\0A\00"
define void @Menu(i32* %0) {
%2 = alloca i32*
%3 = alloca i8
store i32* %0, i32** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %18, %1
%6 = call signext i8 (...) @getchar()
store i8 %6, i8* %3
%7 = load i8, i8* %3
%8 = call i64 @isdigit(i8 signext %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %5
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 10
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %14, %10, %5
br label %18
18: ; preds = %17
%19 = load i8, i8* %3
%20 = call i64 @isdigit(i8 signext %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %5, label %22
22: ; preds = %18
%23 = load i8, i8* %3
%24 = sext i8 %23 to i32
%25 = sub nsw i32 %24, 48
%26 = load i32*, i32** %2
store i32 %25, i32* %26
ret void
}

LLVM IR (-O2):
@str = [70 x i8] c"\0AEnter\091 to add item,\0A\092 to remove item\0A\\t3 to print queue\0A\094 to quit\00"
@str.3 = [28 x i8] c"\0Ayou must enter an integer.\00"
@str.4 = [51 x i8] c"Enter 1 to add, 2 to remove, 3 to print, 4 to quit\00"
define void @Menu(i32* nocapture writeonly %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str, i64 0, i64 0))
br label %3
3: ; preds = %12, %1
%4 = tail call signext i8 (...) @getchar()
%5 = tail call i64 @isdigit(i8 signext %4)
%6 = icmp eq i64 %5, 0
%7 = icmp ne i8 %4, 10
%8 = and i1 %7, %6
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.3, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.4, i64 0, i64 0))
br label %12
12: ; preds = %3, %9
%13 = tail call i64 @isdigit(i8 signext %4)
%14 = icmp eq i64 %13, 0
br i1 %14, label %3, label %15
15: ; preds = %12
%16 = sext i8 %4 to i32
%17 = add nsw i32 %16, -48
store i32 %17, i32* %0
ret void
}