#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*/ delete (int);
int /*<<< orphan*/ deleteFirst();
int /*<<< orphan*/ deleteLast();
int /*<<< orphan*/ init();
int /*<<< orphan*/ insert(int);
int /*<<< orphan*/ printList();
int /*<<< orphan*/ scanf(char *, ...);
int strlen(char *);
int main() {
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for (i = 0; i < n; i++) {
    scanf("%s%d", com, &key);
    if (com[0] == 'i') {
      insert(key);
      np++;
      size++;
    } else if (com[0] == 'd') {
      if (strlen(com) > 6) {
        if (com[6] == 'F')
          deleteFirst();
        else if (com[6] == 'L')
          deleteLast();
      } else {
        delete (key);
        nd++;
      }
      size--;
    }
  }
  printList();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
lea    0xe57(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    $0x0,%al
call   1040 <init@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    129a <main+0x11a>
lea    -0x30(%rbp),%rsi
lea    0xe25(%rip),%rdi
lea    -0x8(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
movsbl -0x30(%rbp),%eax
cmp    $0x69,%eax
jne    1212 <main+0x92>
mov    -0x8(%rbp),%edi
call   1070 <insert@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1287 <main+0x107>
movsbl -0x30(%rbp),%eax
cmp    $0x64,%eax
jne    1282 <main+0x102>
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x6,%eax
jle    1268 <main+0xe8>
movsbl -0x2a(%rbp),%eax
cmp    $0x46,%eax
jne    124a <main+0xca>
mov    $0x0,%al
call   1090 <deleteFirst@plt>
jmp    1263 <main+0xe3>
movsbl -0x2a(%rbp),%eax
cmp    $0x4c,%eax
jne    125e <main+0xde>
mov    $0x0,%al
call   1050 <deleteLast@plt>
jmp    1263 <main+0xe3>
jmp    1279 <main+0xf9>
mov    -0x8(%rbp),%edi
call   1080 <delete@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1287 <main+0x107>
jmp    128c <main+0x10c>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c4 <main+0x44>
mov    $0x0,%al
call   10a0 <printList@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xe71(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
xor    %eax,%eax
call   1040 <init@plt>
cmpl   $0x0,0x8(%rsp)
jle    123c <main+0xbc>
lea    0xe4a(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xc(%rsp),%r15
xor    %ebp,%ebp
jmp    11d9 <main+0x59>
mov    0xc(%rsp),%edi
call   1080 <delete@plt>
nopl   (%rax)
add    $0x1,%ebp
cmp    0x8(%rsp),%ebp
jge    123c <main+0xbc>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
movzbl 0x10(%rsp),%eax
cmp    $0x64,%al
je     1210 <main+0x90>
cmp    $0x69,%al
jne    11d0 <main+0x50>
mov    0xc(%rsp),%edi
call   1070 <insert@plt>
jmp    11d0 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x7,%eax
jl     11c4 <main+0x44>
movzbl 0x16(%rsp),%eax
cmp    $0x4c,%al
je     1233 <main+0xb3>
cmp    $0x46,%al
jne    11d0 <main+0x50>
xor    %eax,%eax
call   1090 <deleteFirst@plt>
jmp    11d0 <main+0x50>
xor    %eax,%eax
call   1050 <deleteLast@plt>
jmp    11d0 <main+0x50>
xor    %eax,%eax
call   10a0 <printList@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%s%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [20 x i8]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %7
store i32 0, i32* %8
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = call i32 (...) @init()
store i32 0, i32* %4
br label %11
11: ; preds = %64, %0
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %67
15: ; preds = %11
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %16, i32* %2)
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 105
br i1 %21, label %22, label %29
22: ; preds = %15
%23 = load i32, i32* %2
%24 = call i32 @insert(i32 %23)
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %63
29: ; preds = %15
%30 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 100
br i1 %33, label %34, label %62
34: ; preds = %29
%35 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%36 = call i32 @strlen(i8* %35)
%37 = icmp sgt i32 %36, 6
br i1 %37, label %38, label %54
38: ; preds = %34
%39 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 6
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 70
br i1 %42, label %43, label %45
43: ; preds = %38
%44 = call i32 (...) @deleteFirst()
br label %53
45: ; preds = %38
%46 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 6
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 76
br i1 %49, label %50, label %52
50: ; preds = %45
%51 = call i32 (...) @deleteLast()
br label %52
52: ; preds = %50, %45
br label %53
53: ; preds = %52, %43
br label %59
54: ; preds = %34
%55 = load i32, i32* %2
%56 = call i32 @delete(i32 %55)
%57 = load i32, i32* %8
%58 = add nsw i32 %57, 1
store i32 %58, i32* %8
br label %59
59: ; preds = %54, %53
%60 = load i32, i32* %5
%61 = add nsw i32 %60, -1
store i32 %61, i32* %5
br label %62
62: ; preds = %59, %29
br label %63
63: ; preds = %62, %22
br label %64
64: ; preds = %63
%65 = load i32, i32* %4
%66 = add nsw i32 %65, 1
store i32 %66, i32* %4
br label %11
67: ; preds = %11
%68 = call i32 (...) @printList()
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%s%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x i8]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = call i32 (...) @init()
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %36
11: ; preds = %0
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 6
br label %13
13: ; preds = %11, %32
%14 = phi i32 [ 0, %11 ], [ %33, %32 ]
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %6, i32* %1)
%16 = load i8, i8* %6
switch i8 %16, label %32 [
i8 105, label %17
i8 100, label %20
]
17: ; preds = %13
%18 = load i32, i32* %1
%19 = call i32 @insert(i32 %18)
br label %32
20: ; preds = %13
%21 = call i32 @strlen(i8* %6)
%22 = icmp sgt i32 %21, 6
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = load i8, i8* %12
switch i8 %24, label %32 [
i8 70, label %25
i8 76, label %27
]
25: ; preds = %23
%26 = call i32 (...) @deleteFirst()
br label %32
27: ; preds = %23
%28 = call i32 (...) @deleteLast()
br label %32
29: ; preds = %20
%30 = load i32, i32* %1
%31 = call i32 @delete(i32 %30)
br label %32
32: ; preds = %29, %27, %25, %23, %13, %17
%33 = add nuw nsw i32 %14, 1
%34 = load i32, i32* %2
%35 = icmp slt i32 %33, %34
br i1 %35, label %13, label %36
36: ; preds = %32, %0
%37 = call i32 (...) @printList()
ret i32 0
}