#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 uint8_t;
typedef int /*<<< orphan*/ string;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fprintf(int /*<<< orphan*/ *, char *, ...);
scalar_t__ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ print_error(char *, ...);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcat(char *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(int argc, char **argv) {
  if (argc < 2) {
    printf("Usage:\t%s <fontfile>\n", argv[0]);
    exit(0);
  }
  int fontfile_name_length = strlen(argv[1]);
  char *font_c_filename = NULL;
  font_c_filename = (char *)malloc(sizeof(char) * fontfile_name_length + 3);
  if (font_c_filename == NULL) {
    print_error("Failed to allocate memory.\n");
    exit(0);
  }
  strcpy(font_c_filename, argv[1]);
  strcat(font_c_filename, ".c");
  FILE *font_file, *font_c;
  font_file = fopen(argv[1], "r");
  font_c = fopen(font_c_filename, "w");
  fprintf(font_c, "const char %s[] = {", argv[1]);
  int line_num = 0, char_size_counter = 0, char_counter = 0;
  char translating_flag = 0;
  int last_string_length = 0;
  while (1) {
    line_num++;
    char string[32], *newline_p;
    fgets(string, sizeof(string), font_file);
    if (feof(font_file))
      break;
    if ((newline_p = strchr(string, '\n')) != NULL)
      *newline_p = '\0';
    if (string[0] == '*' || string[0] == '.') {
      if (translating_flag == 0) {
        fprintf(font_c, "\n/* 0x%02x start */", char_counter);
        translating_flag = 1;
      }
      uint8_t data = 0;
      for (int i = 0; i < 8; i++) {
        if (string[i] == '*') {
          data |= (0b10000000 >> i);
        }
      }
      fprintf(font_c, "\n\t0x%02x,", data);
      char_size_counter++;
    } else if (char_size_counter != 0) {
      if (char_size_counter != 16) {
        print_error("%s:%d: size of the character is wrong.\n", argv[1],
                    line_num);
        exit(0);
      } else {
        last_string_length =
            fprintf(font_c, "\n/* 0x%02x end */", char_counter);
        char_counter++;
        char_size_counter = 0;
        translating_flag = 0;
      }
    }
  }
  if (translating_flag == 0) {
    if (fseek(font_c, -(long)last_string_length - 1, SEEK_CUR)) {
      printf("fseek error!\n");
      exit(0);
    }
    fprintf(font_c, "\n/* 0x%02x end */", char_counter - 1);
    fprintf(font_c, "\n};");
  } else {
    if (fseek(font_c, -1, SEEK_CUR)) {
      printf("fseek error!\n");
      exit(0);
    }
    fprintf(font_c, "\n/* 0x%02x end */", char_counter);
    fprintf(font_c, "\n};");
  }
  fclose(font_file);
  fclose(font_c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    121f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
xor    %edi,%edi
call   1100 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x0,%rax
add    $0x3,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    126e <main+0x8e>
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1040 <print_error@plt>
xor    %edi,%edi
call   1100 <exit@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rdi
lea    0xda8(%rip),%rsi
call   10f0 <strcat@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd97(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xd85(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd6b(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movb   $0x0,-0x3d(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x20,%esi
call   1090 <fgets@plt>
mov    -0x28(%rbp),%rdi
call   10b0 <feof@plt>
cmp    $0x0,%rax
je     1328 <main+0x148>
jmp    146a <main+0x28a>
lea    -0x70(%rbp),%rdi
mov    $0xa,%esi
call   1070 <strchr@plt>
mov    %rax,-0x78(%rbp)
cmp    $0x0,%rax
je     134b <main+0x16b>
mov    -0x78(%rbp),%rax
movb   $0x0,(%rax)
movsbl -0x70(%rbp),%eax
cmp    $0x2a,%eax
je     1365 <main+0x185>
movsbl -0x70(%rbp),%eax
cmp    $0x2e,%eax
jne    13fb <main+0x21b>
movsbl -0x3d(%rbp),%eax
cmp    $0x0,%eax
jne    138b <main+0x1ab>
mov    -0x30(%rbp),%rdi
mov    -0x3c(%rbp),%edx
lea    0xccd(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movb   $0x1,-0x3d(%rbp)
movl   $0x0,-0x7c(%rbp)
movl   $0x0,-0x80(%rbp)
cmpl   $0x8,-0x80(%rbp)
jge    13d8 <main+0x1f8>
movslq -0x80(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x2a,%eax
jne    13c5 <main+0x1e5>
mov    -0x80(%rbp),%ecx
mov    $0x80,%eax
sar    %cl,%eax
or     -0x7c(%rbp),%eax
mov    %eax,-0x7c(%rbp)
jmp    13ca <main+0x1ea>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    1399 <main+0x1b9>
mov    -0x30(%rbp),%rdi
mov    -0x7c(%rbp),%edx
lea    0xc7b(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1465 <main+0x285>
cmpl   $0x0,-0x38(%rbp)
je     1460 <main+0x280>
cmpl   $0x10,-0x38(%rbp)
je     142f <main+0x24f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x34(%rbp),%edx
lea    0xc4a(%rip),%rdi
mov    $0x0,%al
call   1040 <print_error@plt>
xor    %edi,%edi
call   1100 <exit@plt>
mov    -0x30(%rbp),%rdi
mov    -0x3c(%rbp),%edx
lea    0xc56(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    %eax,-0x44(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
movl   $0x0,-0x38(%rbp)
movb   $0x0,-0x3d(%rbp)
jmp    1460 <main+0x280>
jmp    1465 <main+0x285>
jmp    12f5 <main+0x115>
movsbl -0x3d(%rbp),%eax
cmp    $0x0,%eax
jne    14e6 <main+0x306>
mov    -0x30(%rbp),%rdi
movslq -0x44(%rbp),%rcx
xor    %eax,%eax
sub    %rcx,%rax
sub    $0x1,%rax
mov    %eax,%esi
mov    0x2b57(%rip),%rax
mov    (%rax),%edx
call   10d0 <fseek@plt>
cmp    $0x0,%rax
je     14b7 <main+0x2d7>
lea    0xbfc(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
xor    %edi,%edi
call   1100 <exit@plt>
mov    -0x30(%rbp),%rdi
mov    -0x3c(%rbp),%edx
sub    $0x1,%edx
lea    0xbcb(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xbd9(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
jmp    1543 <main+0x363>
mov    -0x30(%rbp),%rdi
mov    0x2af7(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   10d0 <fseek@plt>
cmp    $0x0,%rax
je     151c <main+0x33c>
lea    0xb97(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
xor    %edi,%edi
call   1100 <exit@plt>
mov    -0x30(%rbp),%rdi
mov    -0x3c(%rbp),%edx
lea    0xb69(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xb77(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r14
cmp    $0x1,%edi
jle    14c7 <main+0x2c7>
mov    0x8(%r14),%rdi
call   1070 <strlen@plt>
lea    0x3(%rax),%edi
call   10d0 <malloc@plt>
test   %rax,%rax
je     14df <main+0x2df>
mov    %rax,%rbp
mov    0x8(%r14),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
lea    0xe08(%rip),%rsi
mov    %rbp,%rdi
call   1100 <strcat@plt>
mov    0x8(%r14),%rdi
lea    0xdf8(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,%rbx
lea    0xdeb(%rip),%rsi
mov    %rbp,%rdi
call   10f0 <fopen@plt>
mov    0x8(%r14),%rdx
lea    0xdda(%rip),%rsi
xor    %ebp,%ebp
mov    %rax,(%rsp)
mov    %rax,%rdi
xor    %eax,%eax
call   10b0 <fprintf@plt>
lea    0x10(%rsp),%rdi
mov    $0x20,%esi
mov    %rbx,%rdx
call   10a0 <fgets@plt>
mov    %rbx,%rdi
call   10c0 <feof@plt>
test   %rax,%rax
je     12d9 <main+0xd9>
xor    %r13d,%r13d
not    %ebp
mov    0x2d2e(%rip),%rax
mov    (%rax),%edx
mov    (%rsp),%rdi
mov    %ebp,%esi
call   10e0 <fseek@plt>
test   %rax,%rax
jne    14f4 <main+0x2f4>
add    $0xffffffff,%r13d
jmp    144c <main+0x24c>
mov    %r14,0x30(%rsp)
mov    $0x1,%ebp
lea    0x10(%rsp),%r15
movl   $0x0,0xc(%rsp)
xor    %r14d,%r14d
xor    %r13d,%r13d
xor    %r12d,%r12d
jmp    13ab <main+0x1ab>
xchg   %ax,%ax
test   %r14b,%r14b
je     1405 <main+0x205>
xor    %eax,%eax
cmp    $0x2a,%cl
sete   %al
shl    $0x7,%eax
xor    %ecx,%ecx
cmpb   $0x2a,0x11(%rsp)
sete   %cl
shl    $0x6,%ecx
xor    %edx,%edx
cmpb   $0x2a,0x12(%rsp)
sete   %dl
shl    $0x5,%edx
movd   0x13(%rsp),%xmm0
pcmpeqb 0xcc4(%rip),%xmm0
punpcklbw %xmm0,%xmm0
punpcklwd %xmm0,%xmm0
pand   0xcc4(%rip),%xmm0
xor    %esi,%esi
cmpb   $0x2a,0x17(%rsp)
sete   %sil
pshufd $0xee,%xmm0,%xmm1
por    %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
por    %xmm1,%xmm0
movd   %xmm0,%edi
or     %ecx,%edx
or     %eax,%edx
or     %esi,%edx
or     %edi,%edx
mov    (%rsp),%rdi
lea    0xd01(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
add    $0x1,%r12d
add    $0x1,%ebp
mov    %r15,%rdi
mov    $0x20,%esi
mov    %rbx,%rdx
call   10a0 <fgets@plt>
mov    %rbx,%rdi
call   10c0 <feof@plt>
test   %rax,%rax
jne    1427 <main+0x227>
mov    %r15,%rdi
mov    $0xa,%esi
call   1080 <strchr@plt>
test   %rax,%rax
je     13c0 <main+0x1c0>
movb   $0x0,(%rax)
movzbl 0x10(%rsp),%ecx
mov    %ecx,%eax
and    $0xfb,%al
cmp    $0x2a,%al
je     1300 <main+0x100>
test   %r12d,%r12d
je     138b <main+0x18b>
cmp    $0x10,%r12d
jne    14a7 <main+0x2a7>
xor    %r12d,%r12d
mov    (%rsp),%rdi
lea    0xcc5(%rip),%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    %eax,0xc(%rsp)
add    $0x1,%r13d
xor    %r14d,%r14d
jmp    138b <main+0x18b>
mov    (%rsp),%rdi
lea    0xc5d(%rip),%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    $0x1,%r14b
movzbl 0x10(%rsp),%ecx
jmp    1309 <main+0x109>
test   %r14b,%r14b
je     149e <main+0x29e>
mov    0x2bb5(%rip),%rax
mov    (%rax),%edx
mov    (%rsp),%rdi
mov    $0xffffffff,%esi
call   10e0 <fseek@plt>
test   %rax,%rax
jne    14f4 <main+0x2f4>
lea    0xc60(%rip),%rsi
mov    (%rsp),%rbp
mov    %rbp,%rdi
mov    %r13d,%edx
xor    %eax,%eax
call   10b0 <fprintf@plt>
lea    0xc5a(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1120 <fwrite@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    %rbp,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0xc(%rsp),%ebp
jmp    12b1 <main+0xb1>
mov    0x30(%rsp),%rax
mov    0x8(%rax),%rsi
lea    0xbd4(%rip),%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <print_error@plt>
xor    %edi,%edi
call   1110 <exit@plt>
mov    (%r14),%rsi
lea    0xb4f(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
xor    %edi,%edi
call   1110 <exit@plt>
lea    0xb50(%rip),%rdi
xor    %eax,%eax
call   1050 <print_error@plt>
xor    %edi,%edi
call   1110 <exit@plt>
lea    0xbce(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Usage:\09%s <fontfile>\0A\00"
@.str.1 = [28 x i8] c"Failed to allocate memory.\0A\00"
@.str.2 = [3 x i8] c".c\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [20 x i8] c"const char %s[] = {\00"
@.str.6 = [20 x i8] c"\0A/* 0x%02x start */\00"
@.str.7 = [10 x i8] c"\0A\090x%02x,\00"
@.str.8 = [40 x i8] c"%s:%d: size of the character is wrong.\0A\00"
@.str.9 = [18 x i8] c"\0A/* 0x%02x end */\00"
@SEEK_CUR = global i32 0
@.str.10 = [14 x i8] c"fseek error!\0A\00"
@.str.11 = [4 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 i8*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8
%14 = alloca i32
%15 = alloca [32 x i8]
%16 = alloca i8*
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = load i32, i32* %4
%20 = icmp slt i32 %19, 2
br i1 %20, label %21, label %27
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = call i32 @exit(i32 0)
unreachable
27: ; preds = %2
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @strlen(i8* %30)
store i32 %31, i32* %6
store i8* null, i8** %7
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = mul i64 1, %33
%35 = add i64 %34, 3
%36 = trunc i64 %35 to i32
%37 = call i64 @malloc(i32 %36)
%38 = inttoptr i64 %37 to i8*
store i8* %38, i8** %7
%39 = load i8*, i8** %7
%40 = icmp eq i8* %39, null
br i1 %40, label %41, label %44
41: ; preds = %27
%42 = call i32 (i8*, ...) @print_error(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%43 = call i32 @exit(i32 0)
unreachable
44: ; preds = %27
%45 = load i8*, i8** %7
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 1
%48 = load i8*, i8** %47
%49 = call i32 @strcpy(i8* %45, i8* %48)
%50 = load i8*, i8** %7
%51 = call i32 @strcat(i8* %50, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 1
%54 = load i8*, i8** %53
%55 = call i32* @fopen(i8* %54, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %55, i32** %8
%56 = load i8*, i8** %7
%57 = call i32* @fopen(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %57, i32** %9
%58 = load i32*, i32** %9
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 1
%61 = load i8*, i8** %60
%62 = call i32 (i32*, i8*, ...) @fprintf(i32* %58, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %61)
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
store i8 0, i8* %13
store i32 0, i32* %14
br label %63
63: ; preds = %44, %144
%64 = load i32, i32* %10
%65 = add nsw i32 %64, 1
store i32 %65, i32* %10
%66 = getelementptr inbounds [32 x i8], [32 x i8]* %15, i64 0, i64 0
%67 = load i32*, i32** %8
%68 = call i32 @fgets(i8* %66, i32 32, i32* %67)
%69 = load i32*, i32** %8
%70 = call i64 @feof(i32* %69)
%71 = icmp ne i64 %70, 0
br i1 %71, label %72, label %73
72: ; preds = %63
br label %145
73: ; preds = %63
%74 = getelementptr inbounds [32 x i8], [32 x i8]* %15, i64 0, i64 0
%75 = call i8* @strchr(i8* %74, i8 signext 10)
store i8* %75, i8** %16
%76 = icmp ne i8* %75, null
br i1 %76, label %77, label %79
77: ; preds = %73
%78 = load i8*, i8** %16
store i8 0, i8* %78
br label %79
79: ; preds = %77, %73
%80 = getelementptr inbounds [32 x i8], [32 x i8]* %15, i64 0, i64 0
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = icmp eq i32 %82, 42
br i1 %83, label %89, label %84
84: ; preds = %79
%85 = getelementptr inbounds [32 x i8], [32 x i8]* %15, i64 0, i64 0
%86 = load i8, i8* %85
%87 = sext i8 %86 to i32
%88 = icmp eq i32 %87, 46
br i1 %88, label %89, label %123
89: ; preds = %84, %79
%90 = load i8, i8* %13
%91 = sext i8 %90 to i32
%92 = icmp eq i32 %91, 0
br i1 %92, label %93, label %97
93: ; preds = %89
%94 = load i32*, i32** %9
%95 = load i32, i32* %12
%96 = call i32 (i32*, i8*, ...) @fprintf(i32* %94, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %95)
store i8 1, i8* %13
br label %97
97: ; preds = %93, %89
store i32 0, i32* %17
store i32 0, i32* %18
br label %98
98: ; preds = %114, %97
%99 = load i32, i32* %18
%100 = icmp slt i32 %99, 8
br i1 %100, label %101, label %117
101: ; preds = %98
%102 = load i32, i32* %18
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [32 x i8], [32 x i8]* %15, i64 0, i64 %103
%105 = load i8, i8* %104
%106 = sext i8 %105 to i32
%107 = icmp eq i32 %106, 42
br i1 %107, label %108, label %113
108: ; preds = %101
%109 = load i32, i32* %18
%110 = ashr i32 128, %109
%111 = load i32, i32* %17
%112 = or i32 %111, %110
store i32 %112, i32* %17
br label %113
113: ; preds = %108, %101
br label %114
114: ; preds = %113
%115 = load i32, i32* %18
%116 = add nsw i32 %115, 1
store i32 %116, i32* %18
br label %98
117: ; preds = %98
%118 = load i32*, i32** %9
%119 = load i32, i32* %17
%120 = call i32 (i32*, i8*, ...) @fprintf(i32* %118, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %119)
%121 = load i32, i32* %11
%122 = add nsw i32 %121, 1
store i32 %122, i32* %11
br label %144
123: ; preds = %84
%124 = load i32, i32* %11
%125 = icmp ne i32 %124, 0
br i1 %125, label %126, label %143
126: ; preds = %123
%127 = load i32, i32* %11
%128 = icmp ne i32 %127, 16
br i1 %128, label %129, label %136
129: ; preds = %126
%130 = load i8**, i8*** %5
%131 = getelementptr inbounds i8*, i8** %130, i64 1
%132 = load i8*, i8** %131
%133 = load i32, i32* %10
%134 = call i32 (i8*, ...) @print_error(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i8* %132, i32 %133)
%135 = call i32 @exit(i32 0)
unreachable
136: ; preds = %126
%137 = load i32*, i32** %9
%138 = load i32, i32* %12
%139 = call i32 (i32*, i8*, ...) @fprintf(i32* %137, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i32 %138)
store i32 %139, i32* %14
%140 = load i32, i32* %12
%141 = add nsw i32 %140, 1
store i32 %141, i32* %12
store i32 0, i32* %11
store i8 0, i8* %13
br label %142
142: ; preds = %136
br label %143
143: ; preds = %142, %123
br label %144
144: ; preds = %143, %117
br label %63
145: ; preds = %72
%146 = load i8, i8* %13
%147 = sext i8 %146 to i32
%148 = icmp eq i32 %147, 0
br i1 %148, label %149, label %169
149: ; preds = %145
%150 = load i32*, i32** %9
%151 = load i32, i32* %14
%152 = sext i32 %151 to i64
%153 = sub nsw i64 0, %152
%154 = sub nsw i64 %153, 1
%155 = trunc i64 %154 to i32
%156 = load i32, i32* @SEEK_CUR
%157 = call i64 @fseek(i32* %150, i32 %155, i32 %156)
%158 = icmp ne i64 %157, 0
br i1 %158, label %159, label %162
159: ; preds = %149
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%161 = call i32 @exit(i32 0)
unreachable
162: ; preds = %149
%163 = load i32*, i32** %9
%164 = load i32, i32* %12
%165 = sub nsw i32 %164, 1
%166 = call i32 (i32*, i8*, ...) @fprintf(i32* %163, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i32 %165)
%167 = load i32*, i32** %9
%168 = call i32 (i32*, i8*, ...) @fprintf(i32* %167, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
br label %183
169: ; preds = %145
%170 = load i32*, i32** %9
%171 = load i32, i32* @SEEK_CUR
%172 = call i64 @fseek(i32* %170, i32 -1, i32 %171)
%173 = icmp ne i64 %172, 0
br i1 %173, label %174, label %177
174: ; preds = %169
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%176 = call i32 @exit(i32 0)
unreachable
177: ; preds = %169
%178 = load i32*, i32** %9
%179 = load i32, i32* %12
%180 = call i32 (i32*, i8*, ...) @fprintf(i32* %178, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i32 %179)
%181 = load i32*, i32** %9
%182 = call i32 (i32*, i8*, ...) @fprintf(i32* %181, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
br label %183
183: ; preds = %177, %162
%184 = load i32*, i32** %8
%185 = call i32 @fclose(i32* %184)
%186 = load i32*, i32** %9
%187 = call i32 @fclose(i32* %186)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Usage:\09%s <fontfile>\0A\00"
@.str.1 = [28 x i8] c"Failed to allocate memory.\0A\00"
@.str.2 = [3 x i8] c".c\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [20 x i8] c"const char %s[] = {\00"
@.str.6 = [20 x i8] c"\0A/* 0x%02x start */\00"
@.str.7 = [10 x i8] c"\0A\090x%02x,\00"
@.str.8 = [40 x i8] c"%s:%d: size of the character is wrong.\0A\00"
@.str.9 = [18 x i8] c"\0A/* 0x%02x end */\00"
@SEEK_CUR = global i32 0
@.str.11 = [4 x i8] c"\0A};\00"
@str.12 = [13 x i8] c"fseek error!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [32 x i8]
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 0)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @strlen(i8* %11)
%13 = add i32 %12, 3
%14 = tail call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to i8*
%16 = icmp eq i64 %14, 0
br i1 %16, label %17, label %20
17: ; preds = %9
%18 = tail call i32 (i8*, ...) @print_error(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%19 = tail call i32 @exit(i32 0)
unreachable
20: ; preds = %9
%21 = load i8*, i8** %10
%22 = tail call i32 @strcpy(i8* %15, i8* %21)
%23 = tail call i32 @strcat(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%24 = load i8*, i8** %10
%25 = tail call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%26 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%27 = load i8*, i8** %10
%28 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %27)
%29 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%30 = call i32 @fgets(i8* %29, i32 32, i32* %25)
%31 = call i64 @feof(i32* %25)
%32 = icmp eq i64 %31, 0
br i1 %32, label %34, label %33
33: ; preds = %20
br label %101
34: ; preds = %20
%35 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 1
%36 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 2
%37 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 3
%38 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 7
%39 = bitcast i8* %37 to <4 x i8>*
br label %40
40: ; preds = %34, %90
%41 = phi i32 [ %95, %90 ], [ 1, %34 ]
%42 = phi i32 [ %94, %90 ], [ 0, %34 ]
%43 = phi i8 [ %93, %90 ], [ 0, %34 ]
%44 = phi i32 [ %92, %90 ], [ 0, %34 ]
%45 = phi i32 [ %91, %90 ], [ 0, %34 ]
%46 = call i8* @strchr(i8* %29, i8 signext 10)
%47 = icmp eq i8* %46, null
br i1 %47, label %49, label %48
48: ; preds = %40
store i8 0, i8* %46
br label %49
49: ; preds = %48, %40
%50 = load i8, i8* %29
%51 = and i8 %50, -5
%52 = icmp eq i8 %51, 42
br i1 %52, label %53, label %82
53: ; preds = %49
%54 = icmp eq i8 %43, 0
br i1 %54, label %55, label %58
55: ; preds = %53
%56 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %44)
%57 = load i8, i8* %29
br label %58
58: ; preds = %55, %53
%59 = phi i8 [ %57, %55 ], [ %50, %53 ]
%60 = phi i8 [ 1, %55 ], [ %43, %53 ]
%61 = icmp eq i8 %59, 42
%62 = select i1 %61, i32 128, i32 0
%63 = load i8, i8* %35
%64 = icmp eq i8 %63, 42
%65 = select i1 %64, i32 64, i32 0
%66 = load i8, i8* %36
%67 = icmp eq i8 %66, 42
%68 = select i1 %67, i32 32, i32 0
%69 = load <4 x i8>, <4 x i8>* %39
%70 = icmp eq <4 x i8> %69, <i8 42, i8 42, i8 42, i8 42>
%71 = select <4 x i1> %70, <4 x i32> <i32 16, i32 8, i32 4, i32 2>, <4 x i32> zeroinitializer
%72 = load i8, i8* %38
%73 = icmp eq i8 %72, 42
%74 = zext i1 %73 to i32
%75 = call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> %71)
%76 = or i32 %75, %68
%77 = or i32 %76, %65
%78 = or i32 %77, %62
%79 = or i32 %78, %74
%80 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32 %79)
%81 = add nsw i32 %45, 1
br label %90
82: ; preds = %49
switch i32 %45, label %83 [
i32 0, label %90
i32 16, label %87
]
83: ; preds = %82
%84 = load i8*, i8** %10
%85 = call i32 (i8*, ...) @print_error(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i8* %84, i32 %41)
%86 = call i32 @exit(i32 0)
unreachable
87: ; preds = %82
%88 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i32 %44)
%89 = add nsw i32 %44, 1
br label %90
90: ; preds = %58, %87, %82
%91 = phi i32 [ %81, %58 ], [ 0, %87 ], [ %45, %82 ]
%92 = phi i32 [ %44, %58 ], [ %89, %87 ], [ %44, %82 ]
%93 = phi i8 [ %60, %58 ], [ 0, %87 ], [ %43, %82 ]
%94 = phi i32 [ %42, %58 ], [ %88, %87 ], [ %42, %82 ]
%95 = add nuw nsw i32 %41, 1
%96 = call i32 @fgets(i8* %29, i32 32, i32* %25)
%97 = call i64 @feof(i32* %25)
%98 = icmp eq i64 %97, 0
br i1 %98, label %40, label %99
99: ; preds = %90
%100 = icmp eq i8 %93, 0
br i1 %100, label %101, label %113
101: ; preds = %33, %99
%102 = phi i32 [ 0, %33 ], [ %94, %99 ]
%103 = phi i32 [ 0, %33 ], [ %92, %99 ]
%104 = xor i32 %102, -1
%105 = load i32, i32* @SEEK_CUR
%106 = call i64 @fseek(i32* %26, i32 %104, i32 %105)
%107 = icmp eq i64 %106, 0
br i1 %107, label %111, label %108
108: ; preds = %101
%109 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.12, i64 0, i64 0))
%110 = call i32 @exit(i32 0)
unreachable
111: ; preds = %101
%112 = add nsw i32 %103, -1
br label %120
113: ; preds = %99
%114 = load i32, i32* @SEEK_CUR
%115 = call i64 @fseek(i32* %26, i32 -1, i32 %114)
%116 = icmp eq i64 %115, 0
br i1 %116, label %120, label %117
117: ; preds = %113
%118 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.12, i64 0, i64 0))
%119 = call i32 @exit(i32 0)
unreachable
120: ; preds = %113, %111
%121 = phi i32 [ %112, %111 ], [ %92, %113 ]
%122 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i32 %121)
%123 = call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i64 3, i64 1, i32* %26)
%124 = call i32 @fclose(i32* %25)
%125 = call i32 @fclose(i32* %26)
ret i32 0
}