#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*/ print_colors(struct node *);
int /*<<< orphan*/ printf(char *, ...);
struct node *remove_node(struct node *, int);
int /*<<< orphan*/ scanf(char *, ...);
struct node *removing_entries(struct node *head) {
  int list_number, x, number;
  char loop_again, remove;
  do {
    printf("How many items do you want to remove? ");
    scanf("%d", &list_number);
    for (x = 0; x < list_number; x++) {
      printf("Enter #%d: ", (x + 1));
      scanf("%d", &number);
      head = remove_node(head, number);
    }
    print_colors(head);
    printf("\nWould you like to remove more? (y/n) ");
    scanf("%s", &loop_again);
  } while (loop_again == 'y');
  return head;
}


x86 assembly (clang, -O0):
<removing_entries>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c3 <removing_entries+0x83>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8d(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <remove_node@plt>
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1173 <removing_entries+0x33>
mov    -0x8(%rbp),%rdi
call   1040 <print_colors@plt>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7c(%rip),%rdi
lea    -0x15(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movsbl -0x15(%rbp),%eax
cmp    $0x79,%eax
je     114c <removing_entries+0xc>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removing_entries>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
lea    0xecf(%rip),%r15
lea    0xecb(%rip),%r13
lea    0x14(%rsp),%rbp
lea    0xf(%rsp),%r14
jmp    119e <removing_entries+0x5e>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <print_colors@plt>
lea    0xeb7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpb   $0x79,0xf(%rsp)
jne    1209 <removing_entries+0xc9>
lea    0xe5b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,0x10(%rsp)
jle    1170 <removing_entries+0x30>
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r12d
mov    %r13,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
call   1050 <remove_node@plt>
mov    %rax,%rbx
cmp    0x10(%rsp),%r12d
jl     11d0 <removing_entries+0x90>
jmp    1170 <removing_entries+0x30>
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [39 x i8] c"How many items do you want to remove? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"Enter #%d: \00"
@.str.3 = [39 x i8] c"\0AWould you like to remove more? (y/n) \00"
@.str.4 = [3 x i8] c"%s\00"
define %struct.node* @removing_entries(%struct.node* %0) {
%2 = alloca %struct.node*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8
store %struct.node* %0, %struct.node** %2
br label %8
8: ; preds = %31, %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
store i32 0, i32* %4
br label %11
11: ; preds = %23, %8
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %26
15: ; preds = %11
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%20 = load %struct.node*, %struct.node** %2
%21 = load i32, i32* %5
%22 = call %struct.node* @remove_node(%struct.node* %20, i32 %21)
store %struct.node* %22, %struct.node** %2
br label %23
23: ; preds = %15
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %11
26: ; preds = %11
%27 = load %struct.node*, %struct.node** %2
%28 = call i32 @print_colors(%struct.node* %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %6)
br label %31
31: ; preds = %26
%32 = load i8, i8* %6
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 121
br i1 %34, label %8, label %35
35: ; preds = %31
%36 = load %struct.node*, %struct.node** %2
ret %struct.node* %36
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [39 x i8] c"How many items do you want to remove? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"Enter #%d: \00"
@.str.3 = [39 x i8] c"\0AWould you like to remove more? (y/n) \00"
@.str.4 = [3 x i8] c"%s\00"
define %struct.node* @removing_entries(%struct.node* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
br label %7
7: ; preds = %23, %1
%8 = phi %struct.node* [ %0, %1 ], [ %24, %23 ]
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %23
13: ; preds = %7, %13
%14 = phi %struct.node* [ %20, %13 ], [ %8, %7 ]
%15 = phi i32 [ %16, %13 ], [ 0, %7 ]
%16 = add nuw nsw i32 %15, 1
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%19 = load i32, i32* %3
%20 = call %struct.node* @remove_node(%struct.node* %14, i32 %19)
%21 = load i32, i32* %2
%22 = icmp slt i32 %16, %21
br i1 %22, label %13, label %23
23: ; preds = %13, %7
%24 = phi %struct.node* [ %8, %7 ], [ %20, %13 ]
%25 = call i32 @print_colors(%struct.node* %24)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%28 = load i8, i8* %4
%29 = icmp eq i8 %28, 121
br i1 %29, label %7, label %30
30: ; preds = %23
ret %struct.node* %24
}