#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 */
struct node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ not_random_add(struct node **, struct node **, int);
int /*<<< orphan*/ print_colors(struct node *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ random_add(struct node **, struct node **, int);
int /*<<< orphan*/ scanf(char *, ...);
void entering_menu(struct node **head, struct node **tail) {
  int list_number, x;
  char random[2];
  printf("How many items do you want to enter? ");
  scanf("%d", &list_number);
  printf("Would you like your inputs to be random? (y/n) ");
  scanf("%s", random);
  for (x = 0; x < list_number; x++) {
    if (random[0] == 'n') {
      not_random_add(head, tail, x);
    } else if (random[0] == 'y') {
      random_add(head, tail, x);
    }
  }
  print_colors(*head);
}


x86 assembly (clang, -O0):
<entering_menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb3(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
lea    -0x1a(%rbp),%rsi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1206 <entering_menu+0xb6>
movsbl -0x1a(%rbp),%eax
cmp    $0x6e,%eax
jne    11d1 <entering_menu+0x81>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1070 <not_random_add@plt>
jmp    11f3 <entering_menu+0xa3>
movsbl -0x1a(%rbp),%eax
cmp    $0x79,%eax
jne    11ee <entering_menu+0x9e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1040 <random_add@plt>
jmp    11f3 <entering_menu+0xa3>
jmp    11f8 <entering_menu+0xa8>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a3 <entering_menu+0x53>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1050 <print_colors@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<entering_menu>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
xor    %ebp,%ebp
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    0xa(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jg     11d6 <entering_menu+0x86>
mov    (%rbx),%rdi
call   1050 <print_colors@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <random_add@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    11a5 <entering_menu+0x55>
movzbl 0xa(%rsp),%eax
cmp    $0x79,%al
je     11c0 <entering_menu+0x70>
cmp    $0x6e,%al
jne    11cd <entering_menu+0x7d>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1070 <not_random_add@plt>
jmp    11cd <entering_menu+0x7d>

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [38 x i8] c"How many items do you want to enter? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [48 x i8] c"Would you like your inputs to be random? (y/n) \00"
@.str.3 = [3 x i8] c"%s\00"
define void @entering_menu(%struct.node** %0, %struct.node** %1) {
%3 = alloca %struct.node**
%4 = alloca %struct.node**
%5 = alloca i32
%6 = alloca i32
%7 = alloca [2 x i8]
store %struct.node** %0, %struct.node*** %3
store %struct.node** %1, %struct.node*** %4
%8 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%10 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%11 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %11)
store i32 0, i32* %6
br label %13
13: ; preds = %39, %2
%14 = load i32, i32* %6
%15 = load i32, i32* %5
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %42
17: ; preds = %13
%18 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 110
br i1 %21, label %22, label %27
22: ; preds = %17
%23 = load %struct.node**, %struct.node*** %3
%24 = load %struct.node**, %struct.node*** %4
%25 = load i32, i32* %6
%26 = call i32 @not_random_add(%struct.node** %23, %struct.node** %24, i32 %25)
br label %38
27: ; preds = %17
%28 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 121
br i1 %31, label %32, label %37
32: ; preds = %27
%33 = load %struct.node**, %struct.node*** %3
%34 = load %struct.node**, %struct.node*** %4
%35 = load i32, i32* %6
%36 = call i32 @random_add(%struct.node** %33, %struct.node** %34, i32 %35)
br label %37
37: ; preds = %32, %27
br label %38
38: ; preds = %37, %22
br label %39
39: ; preds = %38
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %13
42: ; preds = %13
%43 = load %struct.node**, %struct.node*** %3
%44 = load %struct.node*, %struct.node** %43
%45 = call i32 @print_colors(%struct.node* %44)
ret void
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [38 x i8] c"How many items do you want to enter? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [48 x i8] c"Would you like your inputs to be random? (y/n) \00"
@.str.3 = [3 x i8] c"%s\00"
define void @entering_menu(%struct.node** %0, %struct.node** %1) {
%3 = alloca i32
%4 = alloca [2 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %24
13: ; preds = %2, %20
%14 = phi i32 [ %21, %20 ], [ 0, %2 ]
%15 = load i8, i8* %6
switch i8 %15, label %20 [
i8 110, label %16
i8 121, label %18
]
16: ; preds = %13
%17 = call i32 @not_random_add(%struct.node** %0, %struct.node** %1, i32 %14)
br label %20
18: ; preds = %13
%19 = call i32 @random_add(%struct.node** %0, %struct.node** %1, i32 %14)
br label %20
20: ; preds = %13, %16, %18
%21 = add nuw nsw i32 %14, 1
%22 = load i32, i32* %3
%23 = icmp slt i32 %21, %22
br i1 %23, label %13, label %24
24: ; preds = %20, %2
%25 = load %struct.node*, %struct.node** %0
%26 = call i32 @print_colors(%struct.node* %25)
ret void
}