#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*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, char *, char *, char *);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ *strstr(char *, char *);
int main() {
  char s[80];
  char beg[16];
  char end[16];
  char prop[16];
  char lastbeg[16];
  char lastend[16];
  char lastprop[16];
  lastprop[0] = 0;
  for (;;) {
    if (fgets(s, sizeof s, stdin) == NULL)
      break;
    if (strstr(s, "LBP_") == NULL || strstr(s, "LBP_Undef") != NULL) {
      if (lastprop[0]) {
        printf("\t{ %s %s %s },\n", lastbeg, lastend, lastprop);
        lastprop[0] = 0;
      }
      printf("%s", s);
      continue;
    }
    sscanf(s, "\t{ %s %s %s }", beg, end, prop);
    if (lastprop[0] && strcmp(lastprop, prop) != 0) {
      printf("\t{ %s %s %s },\n", lastbeg, lastend, lastprop);
      lastprop[0] = 0;
    }
    if (lastprop[0] == 0) {
      strcpy(lastbeg, beg);
      strcpy(lastprop, prop);
    }
    strcpy(lastend, end);
  }
  if (lastprop[0]) {
    printf("\t{ %s %s %s },\n", lastbeg, lastend, prop);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0xc0(%rbp)
lea    -0x60(%rbp),%rdi
mov    0x2e64(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
jne    119f <main+0x3f>
jmp    12df <main+0x17f>
lea    -0x60(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   1080 <strstr@plt>
cmp    $0x0,%rax
je     11d3 <main+0x73>
lea    -0x60(%rbp),%rdi
lea    0xe41(%rip),%rsi
call   1080 <strstr@plt>
cmp    $0x0,%rax
je     1221 <main+0xc1>
cmpb   $0x0,-0xc0(%rbp)
je     120a <main+0xaa>
lea    -0xa0(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
lea    -0xc0(%rbp),%rcx
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movb   $0x0,-0xc0(%rbp)
lea    -0x60(%rbp),%rsi
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1179 <main+0x19>
lea    -0x60(%rbp),%rdi
lea    -0x70(%rbp),%rdx
lea    -0x80(%rbp),%rcx
lea    -0x90(%rbp),%r8
lea    0xde7(%rip),%rsi
call   1070 <sscanf@plt>
movsbl -0xc0(%rbp),%eax
cmp    $0x0,%eax
je     1297 <main+0x137>
lea    -0xc0(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1297 <main+0x137>
lea    -0xa0(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
lea    -0xc0(%rbp),%rcx
lea    0xd86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movb   $0x0,-0xc0(%rbp)
movsbl -0xc0(%rbp),%eax
cmp    $0x0,%eax
jne    12ca <main+0x16a>
lea    -0xa0(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0xc0(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0xb0(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    1179 <main+0x19>
cmpb   $0x0,-0xc0(%rbp)
je     130f <main+0x1af>
lea    -0xa0(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
lea    -0x90(%rbp),%rcx
lea    0xd07(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
movb   $0x0,(%rsp)
mov    0x2e6c(%rip),%r15
mov    (%r15),%edx
lea    0x60(%rsp),%rdi
mov    $0x50,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     12e5 <main+0x185>
lea    0xe62(%rip),%r14
lea    0x60(%rsp),%rbx
lea    0x30(%rsp),%rbp
mov    %rsp,%r12
jmp    11da <main+0x7a>
nopl   (%rax)
lea    0xe68(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     12c2 <main+0x162>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <strstr@plt>
test   %rax,%rax
je     11fe <main+0x9e>
mov    %rbx,%rdi
lea    0xe11(%rip),%rsi
call   1080 <strstr@plt>
test   %rax,%rax
je     1230 <main+0xd0>
cmpb   $0x0,(%rsp)
je     11b0 <main+0x50>
lea    0xe04(%rip),%rdi
lea    0x10(%rsp),%rsi
mov    %rbp,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
movb   $0x0,(%rsp)
jmp    11b0 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
lea    0xde8(%rip),%rsi
lea    0x50(%rsp),%rdx
lea    0x40(%rsp),%rcx
lea    0x20(%rsp),%r13
mov    %r13,%r8
call   1070 <sscanf@plt>
cmpb   $0x0,(%rsp)
je     1289 <main+0x129>
mov    %r12,%rdi
mov    %r13,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12b5 <main+0x155>
lea    0xda1(%rip),%rdi
lea    0x10(%rsp),%rsi
mov    %rbp,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
movb   $0x0,(%rsp)
lea    0x20(%rsp),%r13
lea    0x10(%rsp),%rdi
lea    0x50(%rsp),%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
lea    0x40(%rsp),%rsi
call   1030 <strcpy@plt>
jmp    11c1 <main+0x61>
cmpb   $0x0,(%rsp)
lea    0x20(%rsp),%r13
jne    12a3 <main+0x143>
jmp    1289 <main+0x129>
cmpb   $0x0,(%rsp)
je     12e5 <main+0x185>
lea    0xd40(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x30(%rsp),%rdx
lea    0x20(%rsp),%rcx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [5 x i8] c"LBP_\00"
@.str.1 = [10 x i8] c"LBP_Undef\00"
@.str.2 = [16 x i8] c"\09{ %s %s %s },\0A\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [14 x i8] c"\09{ %s %s %s }\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca [16 x i8]
%4 = alloca [16 x i8]
%5 = alloca [16 x i8]
%6 = alloca [16 x i8]
%7 = alloca [16 x i8]
%8 = alloca [16 x i8]
store i32 0, i32* %1
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
store i8 0, i8* %9
br label %10
10: ; preds = %70, %34, %0
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%12 = load i32, i32* @stdin
%13 = call i32* @fgets(i8* %11, i32 80, i32 %12)
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %16
15: ; preds = %10
br label %74
16: ; preds = %10
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%18 = call i32* @strstr(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %24, label %20
20: ; preds = %16
%21 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%22 = call i32* @strstr(i8* %21, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%23 = icmp ne i32* %22, null
br i1 %23, label %24, label %37
24: ; preds = %20, %16
%25 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%26 = load i8, i8* %25
%27 = icmp ne i8 %26, 0
br i1 %27, label %28, label %34
28: ; preds = %24
%29 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%30 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%31 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%32 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %29, i8* %30, i8* %31)
%33 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
store i8 0, i8* %33
br label %34
34: ; preds = %28, %24
%35 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%36 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %35)
br label %10
37: ; preds = %20
%38 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%39 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%40 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%41 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%42 = call i32 @sscanf(i8* %38, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %39, i8* %40, i8* %41)
%43 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %58
47: ; preds = %37
%48 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%49 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%50 = call i64 @strcmp(i8* %48, i8* %49)
%51 = icmp ne i64 %50, 0
br i1 %51, label %52, label %58
52: ; preds = %47
%53 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%54 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%55 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%56 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %53, i8* %54, i8* %55)
%57 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
store i8 0, i8* %57
br label %58
58: ; preds = %52, %47, %37
%59 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %70
63: ; preds = %58
%64 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%65 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%66 = call i32 @strcpy(i8* %64, i8* %65)
%67 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%68 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%69 = call i32 @strcpy(i8* %67, i8* %68)
br label %70
70: ; preds = %63, %58
%71 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%72 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%73 = call i32 @strcpy(i8* %71, i8* %72)
br label %10
74: ; preds = %15
%75 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%76 = load i8, i8* %75
%77 = icmp ne i8 %76, 0
br i1 %77, label %78, label %83
78: ; preds = %74
%79 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%80 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%81 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%82 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %79, i8* %80, i8* %81)
br label %83
83: ; preds = %78, %74
ret i32 0
}

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