#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 list_node_s {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ Delete(int, struct list_node_s **);
int /*<<< orphan*/ Free_list(struct list_node_s **);
char Get_command();
int Get_value();
int /*<<< orphan*/ Insert(int, struct list_node_s **);
int /*<<< orphan*/ Member(int, struct list_node_s *);
int /*<<< orphan*/ Print(struct list_node_s *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  char command;
  int value;
  struct list_node_s *head_p = NULL;
  command = Get_command();
  while (command != 'q' && command != 'Q') {
    switch (command) {
    case 'i':
    case 'I':
      value = Get_value();
      Insert(value, &head_p);
      break;
    case 'p':
    case 'P':
      Print(head_p);
      break;
    case 'm':
    case 'M':
      value = Get_value();
      Member(value, head_p);
      break;
    case 'd':
    case 'D':
      value = Get_value();
      Delete(value, &head_p);
      break;
    default:
      printf("There is no %c command\n", command);
      printf("Please try again\n");
    }
    command = Get_command();
  }
  Free_list(&head_p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1050 <Get_command@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%ecx
xor    %eax,%eax
cmp    $0x71,%ecx
mov    %al,-0x19(%rbp)
je     11c0 <main+0x40>
movsbl -0x5(%rbp),%eax
cmp    $0x51,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11d0 <main+0x50>
jmp    1288 <main+0x108>
movsbl -0x5(%rbp),%eax
add    $0xffffffbc,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x2c,%eax
ja     1259 <main+0xd9>
mov    -0x28(%rbp),%rax
lea    0xe0f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1090 <Get_value@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1070 <Insert@plt>
jmp    1279 <main+0xf9>
mov    -0x18(%rbp),%rdi
call   10a0 <Print@plt>
jmp    1279 <main+0xf9>
mov    $0x0,%al
call   1090 <Get_value@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1080 <Member@plt>
jmp    1279 <main+0xf9>
mov    $0x0,%al
call   1090 <Get_value@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1030 <Delete@plt>
jmp    1279 <main+0xf9>
movsbl -0x5(%rbp),%esi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <Get_command@plt>
mov    %al,-0x5(%rbp)
jmp    11a1 <main+0x21>
lea    -0x18(%rbp),%rdi
call   1060 <Free_list@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movq   $0x0,(%rsp)
xor    %eax,%eax
call   1060 <Get_command@plt>
mov    %eax,%ecx
and    $0xdf,%cl
cmp    $0x51,%cl
jne    11c7 <main+0x37>
mov    %rsp,%rdi
call   1070 <Free_list@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xee6(%rip),%r14
lea    0xef7(%rip),%r15
lea    0xe24(%rip),%rbx
mov    %rsp,%r12
jmp    1212 <main+0x82>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10a0 <Get_value@plt>
mov    %eax,%edi
mov    %r12,%rsi
call   1040 <Delete@plt>
xor    %eax,%eax
call   1060 <Get_command@plt>
mov    %eax,%ecx
and    $0xdf,%cl
cmp    $0x51,%cl
je     11b1 <main+0x21>
movsbl %al,%esi
lea    -0x44(%rsi),%eax
cmp    $0x2c,%eax
ja     126b <main+0xdb>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   10a0 <Get_value@plt>
mov    %eax,%edi
mov    %r12,%rsi
call   1080 <Insert@plt>
jmp    1201 <main+0x71>
nopl   0x0(%rax)
xor    %eax,%eax
call   10a0 <Get_value@plt>
mov    (%rsp),%rsi
mov    %eax,%edi
call   1090 <Member@plt>
jmp    1201 <main+0x71>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rsp),%rdi
call   10b0 <Print@plt>
jmp    1201 <main+0x71>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
jmp    1201 <main+0x71>

LLVM IR (-O0):
%struct.list_node_s = type { i32 }
@.str = [24 x i8] c"There is no %c command\0A\00"
@.str.1 = [18 x i8] c"Please try again\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca %struct.list_node_s*
store i32 0, i32* %1
store %struct.list_node_s* null, %struct.list_node_s** %4
%5 = call signext i8 (...) @Get_command()
store i8 %5, i8* %2
br label %6
6: ; preds = %40, %0
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 113
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 81
br label %14
14: ; preds = %10, %6
%15 = phi i1 [ false, %6 ], [ %13, %10 ]
br i1 %15, label %16, label %42
16: ; preds = %14
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
switch i32 %18, label %35 [
i32 105, label %19
i32 73, label %19
i32 112, label %23
i32 80, label %23
i32 109, label %26
i32 77, label %26
i32 100, label %31
i32 68, label %31
]
19: ; preds = %16, %16
%20 = call i32 (...) @Get_value()
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = call i32 @Insert(i32 %21, %struct.list_node_s** %4)
br label %40
23: ; preds = %16, %16
%24 = load %struct.list_node_s*, %struct.list_node_s** %4
%25 = call i32 @Print(%struct.list_node_s* %24)
br label %40
26: ; preds = %16, %16
%27 = call i32 (...) @Get_value()
store i32 %27, i32* %3
%28 = load i32, i32* %3
%29 = load %struct.list_node_s*, %struct.list_node_s** %4
%30 = call i32 @Member(i32 %28, %struct.list_node_s* %29)
br label %40
31: ; preds = %16, %16
%32 = call i32 (...) @Get_value()
store i32 %32, i32* %3
%33 = load i32, i32* %3
%34 = call i32 @Delete(i32 %33, %struct.list_node_s** %4)
br label %40
35: ; preds = %16
%36 = load i8, i8* %2
%37 = sext i8 %36 to i32
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %40
40: ; preds = %35, %31, %26, %23, %19
%41 = call signext i8 (...) @Get_command()
store i8 %41, i8* %2
br label %6
42: ; preds = %14
%43 = call i32 @Free_list(%struct.list_node_s** %4)
ret i32 0
}

LLVM IR (-O2):
%struct.list_node_s = type { i32 }
@.str = [24 x i8] c"There is no %c command\0A\00"
@str = [17 x i8] c"Please try again\00"
define i32 @main() {
%1 = alloca %struct.list_node_s*
%2 = bitcast %struct.list_node_s** %1 to i8*
store %struct.list_node_s* null, %struct.list_node_s** %1
%3 = tail call signext i8 (...) @Get_command()
%4 = and i8 %3, -33
%5 = icmp eq i8 %4, 81
br i1 %5, label %29, label %6
6: ; preds = %0, %25
%7 = phi i8 [ %26, %25 ], [ %3, %0 ]
%8 = sext i8 %7 to i32
switch i32 %8, label %22 [
i32 105, label %9
i32 73, label %9
i32 112, label %12
i32 80, label %12
i32 109, label %15
i32 77, label %15
i32 100, label %19
i32 68, label %19
]
9: ; preds = %6, %6
%10 = call i32 (...) @Get_value()
%11 = call i32 @Insert(i32 %10, %struct.list_node_s** %1)
br label %25
12: ; preds = %6, %6
%13 = load %struct.list_node_s*, %struct.list_node_s** %1
%14 = call i32 @Print(%struct.list_node_s* %13)
br label %25
15: ; preds = %6, %6
%16 = call i32 (...) @Get_value()
%17 = load %struct.list_node_s*, %struct.list_node_s** %1
%18 = call i32 @Member(i32 %16, %struct.list_node_s* %17)
br label %25
19: ; preds = %6, %6
%20 = call i32 (...) @Get_value()
%21 = call i32 @Delete(i32 %20, %struct.list_node_s** %1)
br label %25
22: ; preds = %6
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %8)
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %25
25: ; preds = %22, %19, %15, %12, %9
%26 = call signext i8 (...) @Get_command()
%27 = and i8 %26, -33
%28 = icmp eq i8 %27, 81
br i1 %28, label %29, label %6
29: ; preds = %25, %0
%30 = call i32 @Free_list(%struct.list_node_s** %1)
ret i32 0
}