#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 */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char *, char *);
int /*<<< orphan*/ stdin;
int strlen(char *);
char *strstr(char *, char *);
main() {
  static char buf[200], *p, *q;
  while (fgets(buf, sizeof(buf), stdin)) {
    if ((p = strstr(buf, " \\- ")) == NULL)
      continue;
    *p = '\0';
    p += 4;
    if ((q = strstr(p, "\t")) == NULL)
      continue;
    *q = '\0';
    q++;
    q[strlen(q) - 1] = '\0';
    printf("\\contentsline {section}{\\textbf{%s}: %s}{%s}\n", buf, p, q);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edx
lea    0x2ef1(%rip),%rdi
mov    $0xc8,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     124a <main+0x10a>
lea    0x2ed6(%rip),%rdi
lea    0xe7f(%rip),%rsi
call   1060 <strstr@plt>
mov    %rax,0x2f8b(%rip)
cmp    $0x0,%rax
jne    119c <main+0x5c>
jmp    114f <main+0xf>
mov    0x2f75(%rip),%rax
movb   $0x0,(%rax)
mov    0x2f6b(%rip),%rax
add    $0x4,%rax
mov    %rax,0x2f60(%rip)
mov    0x2f59(%rip),%rdi
lea    0xe3f(%rip),%rsi
call   1060 <strstr@plt>
mov    %rax,0x2f4e(%rip)
cmp    $0x0,%rax
jne    11e1 <main+0xa1>
jmp    114f <main+0xf>
mov    0x2f38(%rip),%rax
movb   $0x0,(%rax)
mov    0x2f2e(%rip),%rax
add    $0x1,%rax
mov    %rax,0x2f23(%rip)
mov    0x2f1c(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2f11(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    0x2eed(%rip),%rdx
mov    0x2eee(%rip),%rcx
lea    0xdce(%rip),%rdi
lea    0x2e10(%rip),%rsi
call   1040 <printf@plt>
jmp    114f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    0x2e88(%rip),%r13
mov    0x0(%r13),%edx
lea    0x2ef5(%rip),%rdi
mov    $0xc8,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     1231 <main+0xe1>
lea    0x2edb(%rip),%r12
lea    0xe74(%rip),%r14
lea    0xe72(%rip),%r15
jmp    11b6 <main+0x66>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x0(%r13),%edx
mov    %r12,%rdi
mov    $0xc8,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     1231 <main+0xe1>
mov    %r12,%rdi
mov    %r14,%rsi
call   1070 <strstr@plt>
mov    %rax,0x2f60(%rip)
test   %rax,%rax
je     11a0 <main+0x50>
movb   $0x0,(%rax)
add    $0x4,%rax
mov    %rax,0x2f4d(%rip)
mov    %rax,%rdi
mov    $0x9,%esi
call   1040 <strchr@plt>
mov    %rax,0x2f41(%rip)
test   %rax,%rax
je     11a0 <main+0x50>
mov    %rax,%rbx
movb   $0x0,(%rax)
mov    %rax,%rdi
add    $0x1,%rdi
mov    %rdi,0x2f28(%rip)
call   1030 <strlen@plt>
cltq
movb   $0x0,(%rax,%rbx,1)
mov    0x2f0e(%rip),%rdx
mov    0x2f0f(%rip),%rcx
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <printf@plt>
jmp    11a0 <main+0x50>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@main.buf = internal global [200 x i8] zeroinitializer
@main.p = internal global i8* null
@main.q = internal global i8* null
@stdin = global i32 0
@.str = [5 x i8] c" \\- \00"
@.str.1 = [2 x i8] c"\09\00"
@.str.2 = [46 x i8] c"\\contentsline {section}{\\textbf{%s}: %s}{%s}\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %18, %17, %9, %0
%3 = load i32, i32* @stdin
%4 = call i64 @fgets(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @main.buf, i64 0, i64 0), i32 200, i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %31
6: ; preds = %2
%7 = call i8* @strstr(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** @main.p
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %6
br label %2
10: ; preds = %6
%11 = load i8*, i8** @main.p
store i8 0, i8* %11
%12 = load i8*, i8** @main.p
%13 = getelementptr inbounds i8, i8* %12, i64 4
store i8* %13, i8** @main.p
%14 = load i8*, i8** @main.p
%15 = call i8* @strstr(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %15, i8** @main.q
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %18
17: ; preds = %10
br label %2
18: ; preds = %10
%19 = load i8*, i8** @main.q
store i8 0, i8* %19
%20 = load i8*, i8** @main.q
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** @main.q
%22 = load i8*, i8** @main.q
%23 = load i8*, i8** @main.q
%24 = call i32 @strlen(i8* %23)
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %22, i64 %26
store i8 0, i8* %27
%28 = load i8*, i8** @main.p
%29 = load i8*, i8** @main.q
%30 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([200 x i8], [200 x i8]* @main.buf, i64 0, i64 0), i8* %28, i8* %29)
br label %2
31: ; preds = %2
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
@main.buf = internal global [200 x i8] zeroinitializer
@main.p = internal unnamed_addr global i8* null
@main.q = internal unnamed_addr global i8* null
@stdin = global i32 0
@.str = [5 x i8] c" \\- \00"
@.str.2 = [46 x i8] c"\\contentsline {section}{\\textbf{%s}: %s}{%s}\0A\00"
define i32 @main() {
%1 = load i32, i32* @stdin
%2 = tail call i64 @fgets(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @main.buf, i64 0, i64 0), i32 200, i32 %1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %24, label %4
4: ; preds = %0, %20
%5 = tail call i8* @strstr(i8* dereferenceable(1) getelementptr inbounds ([200 x i8], [200 x i8]* @main.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** @main.p
%6 = icmp eq i8* %5, null
br i1 %6, label %20, label %7
7: ; preds = %4
store i8 0, i8* %5
%8 = getelementptr inbounds i8, i8* %5, i64 4
store i8* %8, i8** @main.p
%9 = tail call i8* @strchr(i8* %8, i32 9)
store i8* %9, i8** @main.q
%10 = icmp eq i8* %9, null
br i1 %10, label %20, label %11
11: ; preds = %7
store i8 0, i8* %9
%12 = getelementptr inbounds i8, i8* %9, i64 1
store i8* %12, i8** @main.q
%13 = tail call i32 @strlen(i8* %12)
%14 = add nsw i32 %13, -1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %12, i64 %15
store i8 0, i8* %16
%17 = load i8*, i8** @main.p
%18 = load i8*, i8** @main.q
%19 = tail call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([200 x i8], [200 x i8]* @main.buf, i64 0, i64 0), i8* %17, i8* %18)
br label %20
20: ; preds = %11, %4, %7
%21 = load i32, i32* @stdin
%22 = tail call i64 @fgets(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @main.buf, i64 0, i64 0), i32 200, i32 %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %4
24: ; preds = %20, %0
ret i32 0
}