#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 */
int alreadyhave(char *, char *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ trim(char *);
int main(int argc, char *argv[]) {
  FILE *fp;
  int count = 0, flag = 0;
  char *buffer, *p, *p1, buf[256];
  if (argc != 3) {
    printf("Usage: title2cl [titles.txt] [charlist.txt]\n");
    return 1;
  }
  fp = fopen(argv[1], "r");
  if (fp == NULL) {
    printf("Cannot open file: %s\n", argv[1]);
    return 1;
  }
  buffer = (char *)malloc(sizeof(char) * 65536);
  if (buffer == NULL) {
    printf("Memory allocation Error!\n");
    return 1;
  }
  p = buffer;
  while (fgets(buf, 256, fp) != NULL) {
    trim(buf);
    if (strcmp(buf, "{") == 0) {
      flag = 1;
    } else if (strcmp(buf, "}") == 0) {
      flag = 0;
    } else if (flag) {
      p1 = buf;
      while (*p1) {
        int t = alreadyhave(buffer, p, p1);
        if (t > 0) {
          p1 += t;
          continue;
        }
        if ((*p1 & 0x80) == 0) {
          p1++;
          continue;
        } else if ((*p1 & 0xE0) == 0xC0) {
          *p++ = *p1++;
          *p++ = *p1++;
          *p++ = '\n';
          count++;
        } else if ((*p1 & 0xF0) == 0xE0) {
          *p++ = *p1++;
          *p++ = *p1++;
          *p++ = *p1++;
          *p++ = '\n';
          count++;
        }
      }
    }
  }
  fclose(fp);
  *p = '\0';
  fp = fopen(argv[2], "w");
  if (fp == NULL) {
    free(buffer);
    printf("cannot write to file %s\n", argv[2]);
    return 1;
  }
  fprintf(fp, "%d\n", count + 94);
  fputs("ABCDEFGHIJKLMNOPQRSTUVWXYZ\n", fp);
  fputs("abcdefghijklmnopqrstuvwxyz\n", fp);
  fputs("`1234567890-=\\\n", fp);
  fputs("~!@#$%^&*()_+|\n", fp);
  fputs("[]{};\':\",./<>?\n", fp);
  fputs(buffer, fp);
  free(buffer);
  fclose(fp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11fb <main+0x4b>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1596 <main+0x3e6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe23(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1240 <main+0x90>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1596 <main+0x3e6>
mov    $0x10000,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1273 <main+0xc3>
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1596 <main+0x3e6>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x140(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x100,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     14b3 <main+0x303>
lea    -0x140(%rbp),%rdi
call   1060 <trim@plt>
lea    -0x140(%rbp),%rdi
lea    0xdab(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    12cf <main+0x11f>
movl   $0x1,-0x20(%rbp)
jmp    14ae <main+0x2fe>
lea    -0x140(%rbp),%rdi
lea    0xd84(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    12f8 <main+0x148>
movl   $0x0,-0x20(%rbp)
jmp    14a9 <main+0x2f9>
cmpl   $0x0,-0x20(%rbp)
je     14a4 <main+0x2f4>
lea    -0x140(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmpb   $0x0,(%rax)
je     149f <main+0x2ef>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   1090 <alreadyhave@plt>
mov    %eax,-0x144(%rbp)
cmpl   $0x0,-0x144(%rbp)
jle    1357 <main+0x1a7>
mov    -0x144(%rbp),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
jmp    130d <main+0x15d>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
jne    137d <main+0x1cd>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    130d <main+0x15d>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
and    $0xe0,%eax
cmp    $0xc0,%eax
jne    13f8 <main+0x248>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
mov    (%rax),%cl
mov    -0x30(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x30(%rbp)
mov    %cl,(%rax)
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
mov    (%rax),%cl
mov    -0x30(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x30(%rbp)
mov    %cl,(%rax)
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
movb   $0xa,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1495 <main+0x2e5>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
and    $0xf0,%eax
cmp    $0xe0,%eax
jne    1490 <main+0x2e0>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
mov    (%rax),%cl
mov    -0x30(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x30(%rbp)
mov    %cl,(%rax)
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
mov    (%rax),%cl
mov    -0x30(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x30(%rbp)
mov    %cl,(%rax)
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
mov    (%rax),%cl
mov    -0x30(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x30(%rbp)
mov    %cl,(%rax)
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
movb   $0xa,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1495 <main+0x2e5>
jmp    149a <main+0x2ea>
jmp    130d <main+0x15d>
jmp    14a4 <main+0x2f4>
jmp    14a9 <main+0x2f9>
jmp    14ae <main+0x2fe>
jmp    127b <main+0xcb>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xb91(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1511 <main+0x361>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xb67(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1596 <main+0x3e6>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
add    $0x5e,%edx
lea    0xb5c(%rip),%rsi
call   10b0 <fprintf@plt>
mov    -0x18(%rbp),%rsi
lea    0xb50(%rip),%rdi
call   1070 <fputs@plt>
mov    -0x18(%rbp),%rsi
lea    0xb5c(%rip),%rdi
call   1070 <fputs@plt>
mov    -0x18(%rbp),%rsi
lea    0xb68(%rip),%rdi
call   1070 <fputs@plt>
mov    -0x18(%rbp),%rsi
lea    0xb68(%rip),%rdi
call   1070 <fputs@plt>
mov    -0x18(%rbp),%rsi
lea    0xb68(%rip),%rdi
call   1070 <fputs@plt>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <fputs@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
cmp    $0x3,%edi
jne    135d <main+0x18d>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe08(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     136e <main+0x19e>
mov    %rax,%r13
mov    $0x10000,%edi
call   10d0 <malloc@plt>
test   %rax,%rax
je     137e <main+0x1ae>
mov    %rax,%r12
mov    %rbx,0x8(%rsp)
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x100,%esi
mov    %r13,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
je     1387 <main+0x1b7>
xor    %ebp,%ebp
mov    %r12,%rbx
movl   $0x0,0x4(%rsp)
jmp    127f <main+0xaf>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %r15d,%r15d
mov    %r14,%rdi
mov    $0x100,%esi
mov    %r13,%rdx
call   1090 <fgets@plt>
mov    %r15d,%ebp
test   %rax,%rax
je     1392 <main+0x1c2>
mov    %r14,%rdi
call   1070 <trim@plt>
mov    %r14,%rdi
lea    0xd87(%rip),%rsi
call   10b0 <strcmp@plt>
mov    $0x1,%r15d
test   %rax,%rax
je     1263 <main+0x93>
mov    %r14,%rdi
lea    0xd6f(%rip),%rsi
call   10b0 <strcmp@plt>
test   %ebp,%ebp
je     1260 <main+0x90>
test   %rax,%rax
je     1260 <main+0x90>
cmpb   $0x0,0x10(%rsp)
je     1263 <main+0x93>
mov    %r13,%rbp
mov    %r14,%r13
jmp    12dc <main+0x10c>
nopl   0x0(%rax,%rax,1)
mov    %eax,%eax
add    %rax,%r13
cmpb   $0x0,0x0(%r13)
je     1355 <main+0x185>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
call   10a0 <alreadyhave@plt>
test   %eax,%eax
jg     12d0 <main+0x100>
movzbl 0x0(%r13),%eax
test   $0x80,%al
jne    12fd <main+0x12d>
add    $0x1,%r13
jmp    12d5 <main+0x105>
movzbl %al,%ecx
mov    %ecx,%edx
and    $0xffffffe0,%edx
cmp    $0xc0,%edx
jne    1325 <main+0x155>
mov    %al,(%rbx)
movzbl 0x1(%r13),%eax
add    $0x2,%r13
mov    %al,0x1(%rbx)
movb   $0xa,0x2(%rbx)
add    $0x3,%rbx
jmp    134e <main+0x17e>
and    $0xfffffff0,%ecx
cmp    $0xe0,%ecx
jne    12d5 <main+0x105>
mov    %al,(%rbx)
movzbl 0x1(%r13),%eax
mov    %al,0x1(%rbx)
movzbl 0x2(%r13),%eax
add    $0x3,%r13
mov    %al,0x2(%rbx)
movb   $0xa,0x3(%rbx)
add    $0x4,%rbx
addl   $0x1,0x4(%rsp)
jmp    12d5 <main+0x105>
mov    %rbp,%r13
jmp    1263 <main+0x93>
lea    0xd58(%rip),%rdi
call   1040 <puts@plt>
jmp    148a <main+0x2ba>
mov    0x8(%rbx),%rsi
lea    0xc89(%rip),%rdi
jmp    1483 <main+0x2b3>
lea    0xd1e(%rip),%rdi
jmp    1364 <main+0x194>
movl   $0x0,0x4(%rsp)
mov    %r12,%rbx
mov    %r13,%rdi
call   1050 <fclose@plt>
movb   $0x0,(%rbx)
mov    0x8(%rsp),%rbp
mov    0x10(%rbp),%rdi
lea    0xc6f(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     1470 <main+0x2a0>
mov    %rax,%rbx
mov    0x4(%rsp),%edx
add    $0x5e,%edx
lea    0xc6b(%rip),%rsi
mov    %rax,%rdi
call   10c0 <fprintf@plt>
lea    0xc60(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10f0 <fwrite@plt>
lea    0xc63(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10f0 <fwrite@plt>
lea    0xc66(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10f0 <fwrite@plt>
lea    0xc5d(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10f0 <fwrite@plt>
lea    0xc54(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10f0 <fwrite@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1080 <fputs@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
jmp    148f <main+0x2bf>
mov    %r12,%rdi
call   1030 <free@plt>
mov    0x10(%rbp),%rsi
lea    0xb9b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Usage: title2cl [titles.txt] [charlist.txt]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [22 x i8] c"Cannot open file: %s\0A\00"
@.str.3 = [26 x i8] c"Memory allocation Error!\0A\00"
@.str.4 = [2 x i8] c"{\00"
@.str.5 = [2 x i8] c"}\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [25 x i8] c"cannot write to file %s\0A\00"
@.str.8 = [4 x i8] c"%d\0A\00"
@.str.9 = [28 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ\0A\00"
@.str.10 = [28 x i8] c"abcdefghijklmnopqrstuvwxyz\0A\00"
@.str.11 = [16 x i8] c"`1234567890-=\\\0A\00"
@.str.12 = [16 x i8] c"~!@#$%^&*()_+|\0A\00"
@.str.13 = [16 x i8] c"[]{};':\22,./<>?\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca [256 x i8]
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %8
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 3
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %179
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %22, i32** %6
%23 = load i32*, i32** %6
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %30
25: ; preds = %18
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %28)
store i32 1, i32* %3
br label %179
30: ; preds = %18
%31 = call i64 @malloc(i32 65536)
%32 = inttoptr i64 %31 to i8*
store i8* %32, i8** %9
%33 = load i8*, i8** %9
%34 = icmp eq i8* %33, null
br i1 %34, label %35, label %37
35: ; preds = %30
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %179
37: ; preds = %30
%38 = load i8*, i8** %9
store i8* %38, i8** %10
br label %39
39: ; preds = %139, %37
%40 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%41 = load i32*, i32** %6
%42 = call i32* @fgets(i8* %40, i32 256, i32* %41)
%43 = icmp ne i32* %42, null
br i1 %43, label %44, label %140
44: ; preds = %39
%45 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%46 = call i32 @trim(i8* %45)
%47 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%48 = call i64 @strcmp(i8* %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %51
50: ; preds = %44
store i32 1, i32* %8
br label %139
51: ; preds = %44
%52 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%53 = call i64 @strcmp(i8* %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %56
55: ; preds = %51
store i32 0, i32* %8
br label %138
56: ; preds = %51
%57 = load i32, i32* %8
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %137
59: ; preds = %56
%60 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
store i8* %60, i8** %11
br label %61
61: ; preds = %135, %83, %72, %59
%62 = load i8*, i8** %11
%63 = load i8, i8* %62
%64 = icmp ne i8 %63, 0
br i1 %64, label %65, label %136
65: ; preds = %61
%66 = load i8*, i8** %9
%67 = load i8*, i8** %10
%68 = load i8*, i8** %11
%69 = call i32 @alreadyhave(i8* %66, i8* %67, i8* %68)
store i32 %69, i32* %13
%70 = load i32, i32* %13
%71 = icmp sgt i32 %70, 0
br i1 %71, label %72, label %77
72: ; preds = %65
%73 = load i32, i32* %13
%74 = load i8*, i8** %11
%75 = sext i32 %73 to i64
%76 = getelementptr inbounds i8, i8* %74, i64 %75
store i8* %76, i8** %11
br label %61
77: ; preds = %65
%78 = load i8*, i8** %11
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = and i32 %80, 128
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %86
83: ; preds = %77
%84 = load i8*, i8** %11
%85 = getelementptr inbounds i8, i8* %84, i32 1
store i8* %85, i8** %11
br label %61
86: ; preds = %77
%87 = load i8*, i8** %11
%88 = load i8, i8* %87
%89 = sext i8 %88 to i32
%90 = and i32 %89, 224
%91 = icmp eq i32 %90, 192
br i1 %91, label %92, label %107
92: ; preds = %86
%93 = load i8*, i8** %11
%94 = getelementptr inbounds i8, i8* %93, i32 1
store i8* %94, i8** %11
%95 = load i8, i8* %93
%96 = load i8*, i8** %10
%97 = getelementptr inbounds i8, i8* %96, i32 1
store i8* %97, i8** %10
store i8 %95, i8* %96
%98 = load i8*, i8** %11
%99 = getelementptr inbounds i8, i8* %98, i32 1
store i8* %99, i8** %11
%100 = load i8, i8* %98
%101 = load i8*, i8** %10
%102 = getelementptr inbounds i8, i8* %101, i32 1
store i8* %102, i8** %10
store i8 %100, i8* %101
%103 = load i8*, i8** %10
%104 = getelementptr inbounds i8, i8* %103, i32 1
store i8* %104, i8** %10
store i8 10, i8* %103
%105 = load i32, i32* %7
%106 = add nsw i32 %105, 1
store i32 %106, i32* %7
br label %134
107: ; preds = %86
%108 = load i8*, i8** %11
%109 = load i8, i8* %108
%110 = sext i8 %109 to i32
%111 = and i32 %110, 240
%112 = icmp eq i32 %111, 224
br i1 %112, label %113, label %133
113: ; preds = %107
%114 = load i8*, i8** %11
%115 = getelementptr inbounds i8, i8* %114, i32 1
store i8* %115, i8** %11
%116 = load i8, i8* %114
%117 = load i8*, i8** %10
%118 = getelementptr inbounds i8, i8* %117, i32 1
store i8* %118, i8** %10
store i8 %116, i8* %117
%119 = load i8*, i8** %11
%120 = getelementptr inbounds i8, i8* %119, i32 1
store i8* %120, i8** %11
%121 = load i8, i8* %119
%122 = load i8*, i8** %10
%123 = getelementptr inbounds i8, i8* %122, i32 1
store i8* %123, i8** %10
store i8 %121, i8* %122
%124 = load i8*, i8** %11
%125 = getelementptr inbounds i8, i8* %124, i32 1
store i8* %125, i8** %11
%126 = load i8, i8* %124
%127 = load i8*, i8** %10
%128 = getelementptr inbounds i8, i8* %127, i32 1
store i8* %128, i8** %10
store i8 %126, i8* %127
%129 = load i8*, i8** %10
%130 = getelementptr inbounds i8, i8* %129, i32 1
store i8* %130, i8** %10
store i8 10, i8* %129
%131 = load i32, i32* %7
%132 = add nsw i32 %131, 1
store i32 %132, i32* %7
br label %133
133: ; preds = %113, %107
br label %134
134: ; preds = %133, %92
br label %135
135: ; preds = %134
br label %61
136: ; preds = %61
br label %137
137: ; preds = %136, %56
br label %138
138: ; preds = %137, %55
br label %139
139: ; preds = %138, %50
br label %39
140: ; preds = %39
%141 = load i32*, i32** %6
%142 = call i32 @fclose(i32* %141)
%143 = load i8*, i8** %10
store i8 0, i8* %143
%144 = load i8**, i8*** %5
%145 = getelementptr inbounds i8*, i8** %144, i64 2
%146 = load i8*, i8** %145
%147 = call i32* @fopen(i8* %146, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %147, i32** %6
%148 = load i32*, i32** %6
%149 = icmp eq i32* %148, null
br i1 %149, label %150, label %157
150: ; preds = %140
%151 = load i8*, i8** %9
%152 = call i32 @free(i8* %151)
%153 = load i8**, i8*** %5
%154 = getelementptr inbounds i8*, i8** %153, i64 2
%155 = load i8*, i8** %154
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i8* %155)
store i32 1, i32* %3
br label %179
157: ; preds = %140
%158 = load i32*, i32** %6
%159 = load i32, i32* %7
%160 = add nsw i32 %159, 94
%161 = call i32 @fprintf(i32* %158, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %160)
%162 = load i32*, i32** %6
%163 = call i32 @fputs(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i32* %162)
%164 = load i32*, i32** %6
%165 = call i32 @fputs(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), i32* %164)
%166 = load i32*, i32** %6
%167 = call i32 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i32* %166)
%168 = load i32*, i32** %6
%169 = call i32 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i32* %168)
%170 = load i32*, i32** %6
%171 = call i32 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i32* %170)
%172 = load i8*, i8** %9
%173 = load i32*, i32** %6
%174 = call i32 @fputs(i8* %172, i32* %173)
%175 = load i8*, i8** %9
%176 = call i32 @free(i8* %175)
%177 = load i32*, i32** %6
%178 = call i32 @fclose(i32* %177)
br label %179
179: ; preds = %157, %150, %35, %25, %16
%180 = load i32, i32* %3
ret i32 %180
}

LLVM IR (-O2):
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [22 x i8] c"Cannot open file: %s\0A\00"
@.str.4 = [2 x i8] c"{\00"
@.str.5 = [2 x i8] c"}\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [25 x i8] c"cannot write to file %s\0A\00"
@.str.8 = [4 x i8] c"%d\0A\00"
@.str.9 = [28 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ\0A\00"
@.str.10 = [28 x i8] c"abcdefghijklmnopqrstuvwxyz\0A\00"
@.str.11 = [16 x i8] c"`1234567890-=\\\0A\00"
@.str.12 = [16 x i8] c"~!@#$%^&*()_+|\0A\00"
@.str.13 = [16 x i8] c"[]{};':\22,./<>?\0A\00"
@str = [25 x i8] c"Memory allocation Error!\00"
@str.14 = [44 x i8] c"Usage: title2cl [titles.txt] [charlist.txt]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 3
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.14, i64 0, i64 0))
br label %116
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load i8*, i8** %9
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %14)
br label %116
16: ; preds = %8
%17 = tail call i64 @malloc(i32 65536)
%18 = inttoptr i64 %17 to i8*
%19 = icmp eq i64 %17, 0
br i1 %19, label %23, label %20
20: ; preds = %16
%21 = call i32* @fgets(i8* %4, i32 256, i32* %11)
%22 = icmp eq i32* %21, null
br i1 %22, label %93, label %25
23: ; preds = %16
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %116
25: ; preds = %20, %87
%26 = phi i8* [ %90, %87 ], [ %18, %20 ]
%27 = phi i32 [ %89, %87 ], [ 0, %20 ]
%28 = phi i32 [ %88, %87 ], [ 0, %20 ]
%29 = call i32 @trim(i8* %4)
%30 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %87, label %32
32: ; preds = %25
%33 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
%35 = icmp eq i32 %27, 0
%36 = or i1 %35, %34
br i1 %36, label %87, label %37
37: ; preds = %32
%38 = load i8, i8* %4
%39 = icmp eq i8 %38, 0
br i1 %39, label %87, label %40
40: ; preds = %37, %81
%41 = phi i8* [ %84, %81 ], [ %4, %37 ]
%42 = phi i8* [ %83, %81 ], [ %26, %37 ]
%43 = phi i32 [ %82, %81 ], [ %28, %37 ]
%44 = call i32 @alreadyhave(i8* %18, i8* %42, i8* %41)
%45 = icmp sgt i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %40
%47 = zext i32 %44 to i64
%48 = getelementptr inbounds i8, i8* %41, i64 %47
br label %81
49: ; preds = %40
%50 = load i8, i8* %41
%51 = zext i8 %50 to i32
%52 = and i32 %51, 128
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %49
%55 = getelementptr inbounds i8, i8* %41, i64 1
br label %81
56: ; preds = %49
%57 = and i32 %51, 224
%58 = icmp eq i32 %57, 192
br i1 %58, label %59, label %67
59: ; preds = %56
%60 = getelementptr inbounds i8, i8* %41, i64 1
%61 = getelementptr inbounds i8, i8* %42, i64 1
store i8 %50, i8* %42
%62 = getelementptr inbounds i8, i8* %41, i64 2
%63 = load i8, i8* %60
%64 = getelementptr inbounds i8, i8* %42, i64 2
store i8 %63, i8* %61
%65 = getelementptr inbounds i8, i8* %42, i64 3
store i8 10, i8* %64
%66 = add nsw i32 %43, 1
br label %81
67: ; preds = %56
%68 = and i32 %51, 240
%69 = icmp eq i32 %68, 224
br i1 %69, label %70, label %81
70: ; preds = %67
%71 = getelementptr inbounds i8, i8* %41, i64 1
%72 = getelementptr inbounds i8, i8* %42, i64 1
store i8 %50, i8* %42
%73 = getelementptr inbounds i8, i8* %41, i64 2
%74 = load i8, i8* %71
%75 = getelementptr inbounds i8, i8* %42, i64 2
store i8 %74, i8* %72
%76 = getelementptr inbounds i8, i8* %41, i64 3
%77 = load i8, i8* %73
%78 = getelementptr inbounds i8, i8* %42, i64 3
store i8 %77, i8* %75
%79 = getelementptr inbounds i8, i8* %42, i64 4
store i8 10, i8* %78
%80 = add nsw i32 %43, 1
br label %81
81: ; preds = %67, %70, %59, %54, %46
%82 = phi i32 [ %43, %46 ], [ %43, %54 ], [ %66, %59 ], [ %80, %70 ], [ %43, %67 ]
%83 = phi i8* [ %42, %46 ], [ %42, %54 ], [ %65, %59 ], [ %79, %70 ], [ %42, %67 ]
%84 = phi i8* [ %48, %46 ], [ %55, %54 ], [ %62, %59 ], [ %76, %70 ], [ %41, %67 ]
%85 = load i8, i8* %84
%86 = icmp eq i8 %85, 0
br i1 %86, label %87, label %40
87: ; preds = %81, %37, %32, %25
%88 = phi i32 [ %28, %25 ], [ %28, %32 ], [ %28, %37 ], [ %82, %81 ]
%89 = phi i32 [ 1, %25 ], [ 0, %32 ], [ 1, %37 ], [ 1, %81 ]
%90 = phi i8* [ %26, %25 ], [ %26, %32 ], [ %26, %37 ], [ %83, %81 ]
%91 = call i32* @fgets(i8* %4, i32 256, i32* %11)
%92 = icmp eq i32* %91, null
br i1 %92, label %93, label %25
93: ; preds = %87, %20
%94 = phi i32 [ 0, %20 ], [ %88, %87 ]
%95 = phi i8* [ %18, %20 ], [ %90, %87 ]
%96 = call i32 @fclose(i32* %11)
store i8 0, i8* %95
%97 = getelementptr inbounds i8*, i8** %1, i64 2
%98 = load i8*, i8** %97
%99 = call i32* @fopen(i8* %98, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%100 = icmp eq i32* %99, null
br i1 %100, label %101, label %105
101: ; preds = %93
%102 = call i32 @free(i8* %18)
%103 = load i8*, i8** %97
%104 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i8* %103)
br label %116
105: ; preds = %93
%106 = add nsw i32 %94, 94
%107 = call i32 @fprintf(i32* %99, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %106)
%108 = call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0), i64 27, i64 1, i32* %99)
%109 = call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), i64 27, i64 1, i32* %99)
%110 = call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i64 15, i64 1, i32* %99)
%111 = call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i64 15, i64 1, i32* %99)
%112 = call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i64 15, i64 1, i32* %99)
%113 = call i32 @fputs(i8* %18, i32* %99)
%114 = call i32 @free(i8* %18)
%115 = call i32 @fclose(i32* %99)
br label %116
116: ; preds = %105, %101, %23, %13, %6
%117 = phi i32 [ 1, %6 ], [ 1, %13 ], [ 1, %23 ], [ 1, %101 ], [ 0, %105 ]
ret i32 %117
}