#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 EOF;
int getchar();
scalar_t__ isItemTag(int *);
scalar_t__ isTitleTag(int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(int);
int main(int argc, char *argv[]) {
  int character;
  int tag[3];
  int state = 0;
  while ((character = getchar()) != EOF) {
    if (character == '<') {
      tag[0] = getchar();
      tag[1] = getchar();
      tag[2] = getchar();
      if ((state == 0) && (isItemTag(tag)))
        state = 1;
      else if ((state == 1) && (isTitleTag(tag)))
        state = 2;
    } else if (character == '>' && state == 2) {
      while ((character = getchar()) != '<')
        putchar(character);
      printf("\n");
      state = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e6a(%rip),%rcx
cmp    (%rcx),%eax
je     125b <main+0x10b>
cmpl   $0x3c,-0x14(%rbp)
jne    1205 <main+0xb5>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %eax,-0x20(%rbp)
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    11d7 <main+0x87>
lea    -0x20(%rbp),%rdi
call   1050 <isItemTag@plt>
cmp    $0x0,%rax
je     11d7 <main+0x87>
movl   $0x1,-0x24(%rbp)
jmp    1200 <main+0xb0>
cmpl   $0x1,-0x24(%rbp)
jne    11fb <main+0xab>
lea    -0x20(%rbp),%rdi
call   1040 <isTitleTag@plt>
cmp    $0x0,%rax
je     11fb <main+0xab>
movl   $0x2,-0x24(%rbp)
jmp    1200 <main+0xb0>
jmp    1256 <main+0x106>
cmpl   $0x3e,-0x14(%rbp)
jne    1251 <main+0x101>
cmpl   $0x2,-0x24(%rbp)
jne    1251 <main+0x101>
jmp    121e <main+0xce>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x3c,%eax
je     123e <main+0xee>
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
jmp    121e <main+0xce>
lea    0xdbb(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x24(%rbp)
jmp    1256 <main+0x106>
jmp    116d <main+0x1d>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e92(%rip),%rbx
cmp    (%rbx),%eax
jne    1165 <main+0x25>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0x4(%rsp),%r14
xor    %ebp,%ebp
jmp    1187 <main+0x47>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%rbx),%eax
je     115a <main+0x1a>
cmp    $0x3c,%eax
jne    11d0 <main+0x90>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x4(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0x8(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,0xc(%rsp)
cmp    $0x1,%ebp
je     11f5 <main+0xb5>
test   %ebp,%ebp
jne    117c <main+0x3c>
mov    %r14,%rdi
call   1050 <isItemTag@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
jmp    117c <main+0x3c>
nopl   0x0(%rax)
cmp    $0x3e,%eax
jne    117c <main+0x3c>
cmp    $0x2,%ebp
jne    117c <main+0x3c>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0x3c,%eax
je     1170 <main+0x30>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    11e0 <main+0xa0>
mov    %r14,%rdi
call   1040 <isTitleTag@plt>
cmp    $0x1,%rax
mov    $0x2,%ebp
sbb    $0x0,%ebp
jmp    117c <main+0x3c>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [3 x i32]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
br label %9
9: ; preds = %56, %2
%10 = call i32 (...) @getchar()
store i32 %10, i32* %6
%11 = load i32, i32* @EOF
%12 = icmp ne i32 %10, %11
br i1 %12, label %13, label %57
13: ; preds = %9
%14 = load i32, i32* %6
%15 = icmp eq i32 %14, 60
br i1 %15, label %16, label %40
16: ; preds = %13
%17 = call i32 (...) @getchar()
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
store i32 %17, i32* %18
%19 = call i32 (...) @getchar()
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 1
store i32 %19, i32* %20
%21 = call i32 (...) @getchar()
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 2
store i32 %21, i32* %22
%23 = load i32, i32* %8
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %16
%26 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%27 = call i64 @isItemTag(i32* %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %25
store i32 1, i32* %8
br label %39
30: ; preds = %25, %16
%31 = load i32, i32* %8
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = getelementptr inbounds [3 x i32], [3 x i32]* %7, i64 0, i64 0
%35 = call i64 @isTitleTag(i32* %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %33
store i32 2, i32* %8
br label %38
38: ; preds = %37, %33, %30
br label %39
39: ; preds = %38, %29
br label %56
40: ; preds = %13
%41 = load i32, i32* %6
%42 = icmp eq i32 %41, 62
br i1 %42, label %43, label %55
43: ; preds = %40
%44 = load i32, i32* %8
%45 = icmp eq i32 %44, 2
br i1 %45, label %46, label %55
46: ; preds = %43
br label %47
47: ; preds = %50, %46
%48 = call i32 (...) @getchar()
store i32 %48, i32* %6
%49 = icmp ne i32 %48, 60
br i1 %49, label %50, label %53
50: ; preds = %47
%51 = load i32, i32* %6
%52 = call i32 @putchar(i32 %51)
br label %47
53: ; preds = %47
%54 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %8
br label %55
55: ; preds = %53, %43, %40
br label %56
56: ; preds = %55, %39
br label %9
57: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x i32]
%4 = bitcast [3 x i32]* %3 to i8*
%5 = call i32 (...) @getchar()
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %47, label %8
8: ; preds = %2
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2
br label %12
12: ; preds = %8, %42
%13 = phi i32 [ %5, %8 ], [ %44, %42 ]
%14 = phi i32 [ 0, %8 ], [ %43, %42 ]
%15 = icmp eq i32 %13, 60
br i1 %15, label %16, label %28
16: ; preds = %12
%17 = call i32 (...) @getchar()
store i32 %17, i32* %9
%18 = call i32 (...) @getchar()
store i32 %18, i32* %10
%19 = call i32 (...) @getchar()
store i32 %19, i32* %11
switch i32 %14, label %42 [
i32 0, label %20
i32 1, label %24
]
20: ; preds = %16
%21 = call i64 @isItemTag(i32* %9)
%22 = icmp ne i64 %21, 0
%23 = zext i1 %22 to i32
br label %42
24: ; preds = %16
%25 = call i64 @isTitleTag(i32* %9)
%26 = icmp eq i64 %25, 0
%27 = select i1 %26, i32 1, i32 2
br label %42
28: ; preds = %12
%29 = icmp eq i32 %13, 62
%30 = icmp eq i32 %14, 2
%31 = select i1 %29, i1 %30, i1 false
br i1 %31, label %32, label %42
32: ; preds = %28
%33 = call i32 (...) @getchar()
%34 = icmp eq i32 %33, 60
br i1 %34, label %40, label %35
35: ; preds = %32, %35
%36 = phi i32 [ %38, %35 ], [ %33, %32 ]
%37 = call i32 @putchar(i32 %36)
%38 = call i32 (...) @getchar()
%39 = icmp eq i32 %38, 60
br i1 %39, label %40, label %35
40: ; preds = %35, %32
%41 = call i32 @putchar(i32 10)
br label %42
42: ; preds = %20, %24, %16, %28, %40
%43 = phi i32 [ 0, %40 ], [ %14, %28 ], [ %14, %16 ], [ %27, %24 ], [ %23, %20 ]
%44 = call i32 (...) @getchar()
%45 = load i32, i32* @EOF
%46 = icmp eq i32 %44, %45
br i1 %46, label %47, label %12
47: ; preds = %42, %2
ret i32 0
}