#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*/ add_new_head(int);
int /*<<< orphan*/ append(int);
int /*<<< orphan*/ count();
int /*<<< orphan*/ delete_head();
int /*<<< orphan*/ delete_tail();
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ show();
scalar_t__ strcmp(char **, char *);
int main() {
  int ile, i, var;
  char command[16];
  scanf("%u ", &ile);
  for (i = 0; i < ile; i++) {
    scanf("%s %u", &command, &var);
    if (strcmp(&command, "insert") == 0) {
      append(var);
    } else if (strcmp(&command, "delete_head") == 0) {
      delete_head();
    } else if (strcmp(&command, "delete_tail") == 0) {
      delete_tail();
    } else if (strcmp(&command, "print") == 0) {
      show();
    } else if (strcmp(&command, "count") == 0) {
      count();
    } else if (strcmp(&command, "insert_head") == 0) {
      add_new_head(var);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe6a(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   10a0 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12d7 <main+0x157>
lea    0xe49(%rip),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   10a0 <scanf@plt>
lea    -0x20(%rbp),%rdi
lea    0xe35(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11f1 <main+0x71>
mov    -0x10(%rbp),%edi
call   1040 <append@plt>
jmp    12c4 <main+0x144>
lea    -0x20(%rbp),%rdi
lea    0xe15(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1217 <main+0x97>
mov    $0x0,%al
call   1070 <delete_head@plt>
jmp    12bf <main+0x13f>
lea    -0x20(%rbp),%rdi
lea    0xdfb(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    123d <main+0xbd>
mov    $0x0,%al
call   1080 <delete_tail@plt>
jmp    12ba <main+0x13a>
lea    -0x20(%rbp),%rdi
lea    0xde1(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1263 <main+0xe3>
mov    $0x0,%al
call   1050 <show@plt>
jmp    12b5 <main+0x135>
lea    -0x20(%rbp),%rdi
lea    0xdc1(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1289 <main+0x109>
mov    $0x0,%al
call   1030 <count@plt>
jmp    12b0 <main+0x130>
lea    -0x20(%rbp),%rdi
lea    0xda1(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12ab <main+0x12b>
mov    -0x10(%rbp),%edi
call   1090 <add_new_head@plt>
jmp    12b0 <main+0x130>
jmp    12b5 <main+0x135>
jmp    12ba <main+0x13a>
jmp    12bf <main+0x13f>
jmp    12c4 <main+0x144>
jmp    12c9 <main+0x149>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a8 <main+0x28>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xe6b(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    12b0 <main+0x130>
lea    0xe51(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%r15
lea    0xe46(%rip),%r12
lea    0xe46(%rip),%r13
xor    %ebp,%ebp
jmp    11e6 <main+0x66>
nop
mov    0x8(%rsp),%edi
call   1040 <append@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    12b0 <main+0x130>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11d0 <main+0x50>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1280 <main+0x100>
mov    %rbx,%rdi
lea    0xdfd(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     128c <main+0x10c>
mov    %rbx,%rdi
lea    0xdf5(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1298 <main+0x118>
mov    %rbx,%rdi
lea    0xde7(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12a4 <main+0x124>
mov    %rbx,%rdi
lea    0xdd9(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    11d9 <main+0x59>
mov    0x8(%rsp),%edi
call   1090 <add_new_head@plt>
jmp    11d9 <main+0x59>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <delete_head@plt>
jmp    11d9 <main+0x59>
xor    %eax,%eax
call   1080 <delete_tail@plt>
jmp    11d9 <main+0x59>
xor    %eax,%eax
call   1050 <show@plt>
jmp    11d9 <main+0x59>
xor    %eax,%eax
call   1030 <count@plt>
jmp    11d9 <main+0x59>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%u \00"
@.str.1 = [6 x i8] c"%s %u\00"
@.str.2 = [7 x i8] c"insert\00"
@.str.3 = [12 x i8] c"delete_head\00"
@.str.4 = [12 x i8] c"delete_tail\00"
@.str.5 = [6 x i8] c"print\00"
@.str.6 = [6 x i8] c"count\00"
@.str.7 = [12 x i8] c"insert_head\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [16 x i8]
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %7
7: ; preds = %56, %0
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %59
11: ; preds = %7
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), [16 x i8]* %5, i32* %4)
%13 = bitcast [16 x i8]* %5 to i8**
%14 = call i64 @strcmp(i8** %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i32, i32* %4
%18 = call i32 @append(i32 %17)
br label %55
19: ; preds = %11
%20 = bitcast [16 x i8]* %5 to i8**
%21 = call i64 @strcmp(i8** %20, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 (...) @delete_head()
br label %54
25: ; preds = %19
%26 = bitcast [16 x i8]* %5 to i8**
%27 = call i64 @strcmp(i8** %26, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 (...) @delete_tail()
br label %53
31: ; preds = %25
%32 = bitcast [16 x i8]* %5 to i8**
%33 = call i64 @strcmp(i8** %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = call i32 (...) @show()
br label %52
37: ; preds = %31
%38 = bitcast [16 x i8]* %5 to i8**
%39 = call i64 @strcmp(i8** %38, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = call i32 (...) @count()
br label %51
43: ; preds = %37
%44 = bitcast [16 x i8]* %5 to i8**
%45 = call i64 @strcmp(i8** %44, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = load i32, i32* %4
%49 = call i32 @add_new_head(i32 %48)
br label %50
50: ; preds = %47, %43
br label %51
51: ; preds = %50, %41
br label %52
52: ; preds = %51, %35
br label %53
53: ; preds = %52, %29
br label %54
54: ; preds = %53, %23
br label %55
55: ; preds = %54, %16
br label %56
56: ; preds = %55
%57 = load i32, i32* %3
%58 = add nsw i32 %57, 1
store i32 %58, i32* %3
br label %7
59: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%u \00"
@.str.1 = [6 x i8] c"%s %u\00"
@.str.2 = [7 x i8] c"insert\00"
@.str.3 = [12 x i8] c"delete_head\00"
@.str.4 = [12 x i8] c"delete_tail\00"
@.str.5 = [6 x i8] c"print\00"
@.str.6 = [6 x i8] c"count\00"
@.str.7 = [12 x i8] c"insert_head\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [16 x i8]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %50
10: ; preds = %0
%11 = bitcast [16 x i8]* %3 to i8**
br label %12
12: ; preds = %10, %46
%13 = phi i32 [ 0, %10 ], [ %47, %46 ]
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), [16 x i8]* %3, i32* %2)
%15 = call i64 @strcmp(i8** %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i32, i32* %2
%19 = call i32 @append(i32 %18)
br label %46
20: ; preds = %12
%21 = call i64 @strcmp(i8** %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 (...) @delete_head()
br label %46
25: ; preds = %20
%26 = call i64 @strcmp(i8** %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 (...) @delete_tail()
br label %46
30: ; preds = %25
%31 = call i64 @strcmp(i8** %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 (...) @show()
br label %46
35: ; preds = %30
%36 = call i64 @strcmp(i8** %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 (...) @count()
br label %46
40: ; preds = %35
%41 = call i64 @strcmp(i8** %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = load i32, i32* %2
%45 = call i32 @add_new_head(i32 %44)
br label %46
46: ; preds = %17, %28, %38, %43, %40, %33, %23
%47 = add nuw nsw i32 %13, 1
%48 = load i32, i32* %1
%49 = icmp slt i32 %47, %48
br i1 %49, label %12, label %50
50: ; preds = %46, %0
ret i32 0
}