#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*/ FILE;

/* Variables and functions */
char *GetNextToken(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
void GenTopicList(FILE *infile, FILE *outfile) {
  char *token;
  fseek(infile, 0, SEEK_SET);
  fprintf(outfile, "# Topic List\n");
  fprintf(outfile, "*.topicList: ");
  while ((token = GetNextToken(infile, 1)) != NULL) {
    if ((strcmp(token, "{") != 0) && (strcmp(token, "}") != 0))
      fprintf(outfile, "\\\n\t%s ", token);
    free(token);
  }
  fprintf(outfile, "\n\n");
}


x86 assembly (clang, -O0):
<GenTopicList>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e75(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1070 <fseek@plt>
mov    -0x10(%rbp),%rdi
lea    0xe81(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe7d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1040 <GetNextToken@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     120c <GenTopicList+0xbc>
mov    -0x18(%rbp),%rdi
lea    0xe5d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11fe <GenTopicList+0xae>
mov    -0x18(%rbp),%rdi
lea    0xe45(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11fe <GenTopicList+0xae>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe29(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
jmp    1198 <GenTopicList+0x48>
mov    -0x10(%rbp),%rdi
lea    0xe10(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GenTopicList>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r13
mov    0x2e68(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1070 <fseek@plt>
lea    0xe78(%rip),%rdi
mov    $0xd,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
lea    0xe6d(%rip),%rdi
mov    $0xd,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
mov    %r13,%rdi
mov    $0x1,%esi
call   1040 <GetNextToken@plt>
test   %rax,%rax
je     122f <GenTopicList+0xcf>
mov    %rax,%rbx
lea    0xe4d(%rip),%r15
lea    0xe48(%rip),%r12
lea    0xe43(%rip),%rbp
jmp    11fd <GenTopicList+0x9d>
nop
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
mov    $0x1,%esi
call   1040 <GetNextToken@plt>
mov    %rax,%rbx
test   %rax,%rax
je     122f <GenTopicList+0xcf>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11e0 <GenTopicList+0x80>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11e0 <GenTopicList+0x80>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    11e0 <GenTopicList+0x80>
lea    0xdf1(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <fwrite@plt>

LLVM IR (-O0):
@SEEK_SET = global i32 0
@.str = [14 x i8] c"# Topic List\0A\00"
@.str.1 = [14 x i8] c"*.topicList: \00"
@.str.2 = [2 x i8] c"{\00"
@.str.3 = [2 x i8] c"}\00"
@.str.4 = [7 x i8] c"\\\0A\09%s \00"
@.str.5 = [3 x i8] c"\0A\0A\00"
define void @GenTopicList(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i8*
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32, i32* @SEEK_SET
%8 = call i32 @fseek(i32* %6, i32 0, i32 %7)
%9 = load i32*, i32** %4
%10 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%11 = load i32*, i32** %4
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %29, %2
%14 = load i32*, i32** %3
%15 = call i8* @GetNextToken(i32* %14, i32 1)
store i8* %15, i8** %5
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %32
17: ; preds = %13
%18 = load i8*, i8** %5
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %29
21: ; preds = %17
%22 = load i8*, i8** %5
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = load i32*, i32** %4
%27 = load i8*, i8** %5
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %25, %21, %17
%30 = load i8*, i8** %5
%31 = call i32 @free(i8* %30)
br label %13
32: ; preds = %13
%33 = load i32*, i32** %4
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
@.str = [14 x i8] c"# Topic List\0A\00"
@.str.1 = [14 x i8] c"*.topicList: \00"
@.str.2 = [2 x i8] c"{\00"
@.str.3 = [2 x i8] c"}\00"
@.str.4 = [7 x i8] c"\\\0A\09%s \00"
@.str.5 = [3 x i8] c"\0A\0A\00"
define void @GenTopicList(i32* %0, i32* nocapture %1) {
%3 = load i32, i32* @SEEK_SET
%4 = tail call i32 @fseek(i32* %0, i32 0, i32 %3)
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 13, i64 1, i32* %1)
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i64 13, i64 1, i32* %1)
%7 = tail call i8* @GetNextToken(i32* %0, i32 1)
%8 = icmp eq i8* %7, null
br i1 %8, label %22, label %9
9: ; preds = %2, %18
%10 = phi i8* [ %20, %18 ], [ %7, %2 ]
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %9
%14 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %10)
br label %18
18: ; preds = %16, %13, %9
%19 = tail call i32 @free(i8* %10)
%20 = tail call i8* @GetNextToken(i32* %0, i32 1)
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %9
22: ; preds = %18, %2
%23 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i64 2, i64 1, i32* %1)
ret void
}