#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 /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ hexdump(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ strcpy(char *, char *);
char *strrchr(char *, char);
int main(int argc, char **argv) {
  FILE *fo;
  FILE *fi;
  char name[256];
  char *basename;
  char *p;
  int i, len;
  if (argc < 3) {
    fprintf(stderr, "usage: fontdump output.c input.dat\n");
    return 1;
  }
  fo = fopen(argv[1], "wb");
  if (!fo) {
    fprintf(stderr, "fontdump: could not open output file '%s'\n", argv[1]);
    return 1;
  }
  for (i = 2; i < argc; i++) {
    fi = fopen(argv[i], "rb");
    if (!fi) {
      fprintf(stderr, "fontdump: could not open input file '%s'\n", argv[i]);
      return 1;
    }
    basename = strrchr(argv[i], '/');
    if (!basename)
      basename = strrchr(argv[i], '\\');
    if (basename)
      basename++;
    else
      basename = argv[i];
    strcpy(name, basename);
    p = name;
    while (*p) {
      if ((*p == '/') || (*p == '.') || (*p == '\\') || (*p == '-'))
        *p = '_';
      p++;
    }
    fseek(fi, 0, SEEK_END);
    len = ftell(fi);
    fseek(fi, 0, SEEK_SET);
    fprintf(fo, "const unsigned int pdf_font_%s_len = %d;\n", name, len);
    fprintf(fo, "#ifdef __linux__\n");
    fprintf(fo, "asm(\".globl pdf_font_%s_buf\");\n", name);
    fprintf(fo, "asm(\".balign 8\");\n");
    fprintf(fo, "asm(\"pdf_font_%s_buf:\");\n", name);
    fprintf(fo, "asm(\".incbin \\\"%s\\\"\");\n", argv[i]);
    fprintf(fo, "#else\n");
    fprintf(fo, "const unsigned char pdf_font_%s_buf[%d] = {\n", name, len);
    hexdump(fo, fi);
    fprintf(fo, "};\n");
    fprintf(fo, "#endif\n");
    fclose(fi);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11c7 <main+0x47>
mov    0x2e2e(%rip),%rax
mov    (%rax),%rdi
lea    0xe4c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1506 <main+0x386>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe4e(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1216 <main+0x96>
mov    0x2de7(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe24(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1506 <main+0x386>
movl   $0x2,-0x134(%rbp)
mov    -0x134(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    14ff <main+0x37f>
mov    -0x10(%rbp),%rax
movslq -0x134(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe0d(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    128c <main+0x10c>
mov    0x2d78(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
movslq -0x134(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xddc(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1506 <main+0x386>
mov    -0x10(%rbp),%rax
movslq -0x134(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x2f,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x128(%rbp)
cmpq   $0x0,-0x128(%rbp)
jne    12da <main+0x15a>
mov    -0x10(%rbp),%rax
movslq -0x134(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x5c,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x128(%rbp)
cmpq   $0x0,-0x128(%rbp)
je     12ff <main+0x17f>
mov    -0x128(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x128(%rbp)
jmp    1315 <main+0x195>
mov    -0x10(%rbp),%rax
movslq -0x134(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x128(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x128(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x120(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    -0x130(%rbp),%rax
cmpb   $0x0,(%rax)
je     13b3 <main+0x233>
mov    -0x130(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     1392 <main+0x212>
mov    -0x130(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     1392 <main+0x212>
mov    -0x130(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
je     1392 <main+0x212>
mov    -0x130(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    139c <main+0x21c>
mov    -0x130(%rbp),%rax
movb   $0x5f,(%rax)
mov    -0x130(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x130(%rbp)
jmp    1336 <main+0x1b6>
mov    -0x20(%rbp),%rdi
mov    0x2c2a(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <fseek@plt>
mov    -0x20(%rbp),%rdi
call   1070 <ftell@plt>
mov    %eax,-0x138(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2bef(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <fseek@plt>
mov    -0x18(%rbp),%rdi
lea    -0x120(%rbp),%rdx
mov    -0x138(%rbp),%ecx
lea    0xc7d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xc95(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    0xc8e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xc9c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    0xc96(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x134(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xc8f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xc95(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x120(%rbp),%rdx
mov    -0x138(%rbp),%ecx
lea    0xc7d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1080 <hexdump@plt>
mov    -0x18(%rbp),%rdi
lea    0xc8b(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xc7d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    1220 <main+0xa0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
cmp    $0x2,%edi
jg     11cb <main+0x3b>
mov    0x2e2b(%rip),%rax
mov    (%rax),%rcx
lea    0xe49(%rip),%rdi
mov    $0x23,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
jmp    1433 <main+0x2a3>
mov    %rsi,%r13
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
lea    0xe49(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,0x10(%rsp)
test   %rax,%rax
je     13ff <main+0x26f>
mov    %ebp,%eax
mov    %rax,0x8(%rsp)
mov    $0x2,%ebp
movabs $0x800000000007,%r12
jmp    1362 <main+0x1d2>
nopl   0x0(%rax)
mov    0x2dd1(%rip),%rax
mov    (%rax),%edx
movl   $0x0,(%rsp)
mov    %r15,%rdi
xor    %esi,%esi
call   1090 <fseek@plt>
mov    %r15,%rdi
call   1070 <ftell@plt>
mov    %eax,%ebx
mov    %eax,0x4(%rsp)
mov    0x2d91(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1090 <fseek@plt>
mov    0x10(%rsp),%r14
mov    %r14,%rdi
lea    0xe25(%rip),%rsi
lea    0x20(%rsp),%rdx
mov    %ebx,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x11,%esi
mov    $0x1,%edx
lea    0xe30(%rip),%rdi
mov    %r14,%rcx
call   10b0 <fwrite@plt>
mov    %r14,%rdi
lea    0xe30(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x12,%esi
mov    $0x1,%edx
lea    0xe30(%rip),%rdi
mov    %r14,%rcx
call   10b0 <fwrite@plt>
mov    %r14,%rdi
lea    0xe31(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x0(%r13,%rbp,8),%rdx
mov    %r14,%rdi
lea    0xe32(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x6,%esi
mov    $0x1,%edx
lea    0xe32(%rip),%rdi
mov    %r14,%rcx
call   10b0 <fwrite@plt>
mov    %r14,%rdi
lea    0xe27(%rip),%rsi
mov    %rbx,%rdx
mov    0x4(%rsp),%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1080 <hexdump@plt>
mov    $0x3,%esi
mov    $0x1,%edx
lea    0xe2a(%rip),%rdi
mov    %r14,%rcx
call   10b0 <fwrite@plt>
mov    $0x7,%esi
mov    $0x1,%edx
lea    0xe15(%rip),%rdi
mov    %r14,%rcx
call   10b0 <fwrite@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
add    $0x1,%rbp
cmp    0x8(%rsp),%rbp
je     143a <main+0x2aa>
mov    0x0(%r13,%rbp,8),%rdi
lea    0xce4(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1416 <main+0x286>
mov    %rax,%r15
mov    %rbp,0x18(%rsp)
mov    0x0(%r13,%rbp,8),%rbp
mov    %rbp,%rdi
mov    $0x2f,%esi
call   1050 <strrchr@plt>
test   %rax,%rax
jne    13ad <main+0x21d>
mov    %rbp,%rdi
mov    $0x5c,%esi
call   1050 <strrchr@plt>
test   %rax,%rax
je     13b4 <main+0x224>
add    $0x1,%rax
mov    %rax,%rbp
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
mov    0x18(%rsp),%rbp
jmp    13e4 <main+0x254>
nopl   0x0(%rax,%rax,1)
test   %cl,%cl
je     1210 <main+0x80>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14
movzbl (%r14),%ecx
lea    -0x2d(%rcx),%edx
cmp    $0x2f,%dl
ja     13d0 <main+0x240>
movzbl %dl,%edx
bt     %rdx,%r12
jae    13d0 <main+0x240>
movb   $0x5f,(%r14)
jmp    13e0 <main+0x250>
mov    0x2bd2(%rip),%rax
mov    (%rax),%rdi
mov    0x8(%r13),%rdx
lea    0xc13(%rip),%rsi
jmp    142c <main+0x29c>
mov    0x2bbb(%rip),%rax
mov    (%rax),%rdi
mov    0x0(%r13,%rbp,8),%rdx
lea    0xc29(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
movl   $0x1,(%rsp)
mov    (%rsp),%eax
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32* null
@.str = [36 x i8] c"usage: fontdump output.c input.dat\0A\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [43 x i8] c"fontdump: could not open output file '%s'\0A\00"
@.str.3 = [3 x i8] c"rb\00"
@.str.4 = [42 x i8] c"fontdump: could not open input file '%s'\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.5 = [42 x i8] c"const unsigned int pdf_font_%s_len = %d;\0A\00"
@.str.6 = [18 x i8] c"#ifdef __linux__\0A\00"
@.str.7 = [32 x i8] c"asm(\22.globl pdf_font_%s_buf\22);\0A\00"
@.str.8 = [19 x i8] c"asm(\22.balign 8\22);\0A\00"
@.str.9 = [26 x i8] c"asm(\22pdf_font_%s_buf:\22);\0A\00"
@.str.10 = [24 x i8] c"asm(\22.incbin \\\22%s\\\22\22);\0A\00"
@.str.11 = [7 x i8] c"#else\0A\00"
@.str.12 = [45 x i8] c"const unsigned char pdf_font_%s_buf[%d] = {\0A\00"
@.str.13 = [4 x i8] c"};\0A\00"
@.str.14 = [8 x i8] c"#endif\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 [256 x i8]
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 3
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = load i32*, i32** @stderr
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %164
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 ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %22, i32** %6
%23 = load i32*, i32** %6
%24 = icmp ne i32* %23, null
br i1 %24, label %31, label %25
25: ; preds = %18
%26 = load i32*, i32** @stderr
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i8* %29)
store i32 1, i32* %3
br label %164
31: ; preds = %18
store i32 2, i32* %11
br label %32
32: ; preds = %160, %31
%33 = load i32, i32* %11
%34 = load i32, i32* %4
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %163
36: ; preds = %32
%37 = load i8**, i8*** %5
%38 = load i32, i32* %11
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %37, i64 %39
%41 = load i8*, i8** %40
%42 = call i32* @fopen(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %42, i32** %7
%43 = load i32*, i32** %7
%44 = icmp ne i32* %43, null
br i1 %44, label %53, label %45
45: ; preds = %36
%46 = load i32*, i32** @stderr
%47 = load i8**, i8*** %5
%48 = load i32, i32* %11
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
%51 = load i8*, i8** %50
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %46, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i8* %51)
store i32 1, i32* %3
br label %164
53: ; preds = %36
%54 = load i8**, i8*** %5
%55 = load i32, i32* %11
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8*, i8** %54, i64 %56
%58 = load i8*, i8** %57
%59 = call i8* @strrchr(i8* %58, i8 signext 47)
store i8* %59, i8** %9
%60 = load i8*, i8** %9
%61 = icmp ne i8* %60, null
br i1 %61, label %69, label %62
62: ; preds = %53
%63 = load i8**, i8*** %5
%64 = load i32, i32* %11
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8*, i8** %63, i64 %65
%67 = load i8*, i8** %66
%68 = call i8* @strrchr(i8* %67, i8 signext 92)
store i8* %68, i8** %9
br label %69
69: ; preds = %62, %53
%70 = load i8*, i8** %9
%71 = icmp ne i8* %70, null
br i1 %71, label %72, label %75
72: ; preds = %69
%73 = load i8*, i8** %9
%74 = getelementptr inbounds i8, i8* %73, i32 1
store i8* %74, i8** %9
br label %81
75: ; preds = %69
%76 = load i8**, i8*** %5
%77 = load i32, i32* %11
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8*, i8** %76, i64 %78
%80 = load i8*, i8** %79
store i8* %80, i8** %9
br label %81
81: ; preds = %75, %72
%82 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%83 = load i8*, i8** %9
%84 = call i32 @strcpy(i8* %82, i8* %83)
%85 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
store i8* %85, i8** %10
br label %86
86: ; preds = %112, %81
%87 = load i8*, i8** %10
%88 = load i8, i8* %87
%89 = icmp ne i8 %88, 0
br i1 %89, label %90, label %115
90: ; preds = %86
%91 = load i8*, i8** %10
%92 = load i8, i8* %91
%93 = sext i8 %92 to i32
%94 = icmp eq i32 %93, 47
br i1 %94, label %110, label %95
95: ; preds = %90
%96 = load i8*, i8** %10
%97 = load i8, i8* %96
%98 = sext i8 %97 to i32
%99 = icmp eq i32 %98, 46
br i1 %99, label %110, label %100
100: ; preds = %95
%101 = load i8*, i8** %10
%102 = load i8, i8* %101
%103 = sext i8 %102 to i32
%104 = icmp eq i32 %103, 92
br i1 %104, label %110, label %105
105: ; preds = %100
%106 = load i8*, i8** %10
%107 = load i8, i8* %106
%108 = sext i8 %107 to i32
%109 = icmp eq i32 %108, 45
br i1 %109, label %110, label %112
110: ; preds = %105, %100, %95, %90
%111 = load i8*, i8** %10
store i8 95, i8* %111
br label %112
112: ; preds = %110, %105
%113 = load i8*, i8** %10
%114 = getelementptr inbounds i8, i8* %113, i32 1
store i8* %114, i8** %10
br label %86
115: ; preds = %86
%116 = load i32*, i32** %7
%117 = load i32, i32* @SEEK_END
%118 = call i32 @fseek(i32* %116, i32 0, i32 %117)
%119 = load i32*, i32** %7
%120 = call i32 @ftell(i32* %119)
store i32 %120, i32* %12
%121 = load i32*, i32** %7
%122 = load i32, i32* @SEEK_SET
%123 = call i32 @fseek(i32* %121, i32 0, i32 %122)
%124 = load i32*, i32** %6
%125 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%126 = load i32, i32* %12
%127 = call i32 (i32*, i8*, ...) @fprintf(i32* %124, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i8* %125, i32 %126)
%128 = load i32*, i32** %6
%129 = call i32 (i32*, i8*, ...) @fprintf(i32* %128, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
%130 = load i32*, i32** %6
%131 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%132 = call i32 (i32*, i8*, ...) @fprintf(i32* %130, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* %131)
%133 = load i32*, i32** %6
%134 = call i32 (i32*, i8*, ...) @fprintf(i32* %133, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
%135 = load i32*, i32** %6
%136 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%137 = call i32 (i32*, i8*, ...) @fprintf(i32* %135, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i8* %136)
%138 = load i32*, i32** %6
%139 = load i8**, i8*** %5
%140 = load i32, i32* %11
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds i8*, i8** %139, i64 %141
%143 = load i8*, i8** %142
%144 = call i32 (i32*, i8*, ...) @fprintf(i32* %138, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), i8* %143)
%145 = load i32*, i32** %6
%146 = call i32 (i32*, i8*, ...) @fprintf(i32* %145, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
%147 = load i32*, i32** %6
%148 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%149 = load i32, i32* %12
%150 = call i32 (i32*, i8*, ...) @fprintf(i32* %147, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.12, i64 0, i64 0), i8* %148, i32 %149)
%151 = load i32*, i32** %6
%152 = load i32*, i32** %7
%153 = call i32 @hexdump(i32* %151, i32* %152)
%154 = load i32*, i32** %6
%155 = call i32 (i32*, i8*, ...) @fprintf(i32* %154, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0))
%156 = load i32*, i32** %6
%157 = call i32 (i32*, i8*, ...) @fprintf(i32* %156, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0))
%158 = load i32*, i32** %7
%159 = call i32 @fclose(i32* %158)
br label %160
160: ; preds = %115
%161 = load i32, i32* %11
%162 = add nsw i32 %161, 1
store i32 %162, i32* %11
br label %32
163: ; preds = %32
store i32 0, i32* %3
br label %164
164: ; preds = %163, %45, %25, %15
%165 = load i32, i32* %3
ret i32 %165
}

LLVM IR (-O2):
@stderr = global i32* null
@.str = [36 x i8] c"usage: fontdump output.c input.dat\0A\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [43 x i8] c"fontdump: could not open output file '%s'\0A\00"
@.str.3 = [3 x i8] c"rb\00"
@.str.4 = [42 x i8] c"fontdump: could not open input file '%s'\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.5 = [42 x i8] c"const unsigned int pdf_font_%s_len = %d;\0A\00"
@.str.6 = [18 x i8] c"#ifdef __linux__\0A\00"
@.str.7 = [32 x i8] c"asm(\22.globl pdf_font_%s_buf\22);\0A\00"
@.str.8 = [19 x i8] c"asm(\22.balign 8\22);\0A\00"
@.str.9 = [26 x i8] c"asm(\22pdf_font_%s_buf:\22);\0A\00"
@.str.10 = [24 x i8] c"asm(\22.incbin \\\22%s\\\22\22);\0A\00"
@.str.11 = [7 x i8] c"#else\0A\00"
@.str.12 = [45 x i8] c"const unsigned char pdf_font_%s_buf[%d] = {\0A\00"
@.str.13 = [4 x i8] c"};\0A\00"
@.str.14 = [8 x i8] c"#endif\0A\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 slt i32 %0, 3
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i32*, i32** @stderr
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i64 35, i64 1, i32* %7)
br label %70
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = zext i32 %0 to i64
br label %20
16: ; preds = %9
%17 = load i32*, i32** @stderr
%18 = load i8*, i8** %10
%19 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %70
20: ; preds = %14, %49
%21 = phi i64 [ 2, %14 ], [ %68, %49 ]
%22 = getelementptr inbounds i8*, i8** %1, i64 %21
%23 = load i8*, i8** %22
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %30
26: ; preds = %20
%27 = load i32*, i32** @stderr
%28 = load i8*, i8** %22
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i8* %28)
br label %70
30: ; preds = %20
%31 = load i8*, i8** %22
%32 = call i8* @strrchr(i8* dereferenceable(1) %31, i8 signext 47)
%33 = icmp eq i8* %32, null
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = call i8* @strrchr(i8* dereferenceable(1) %31, i8 signext 92)
%36 = icmp eq i8* %35, null
br i1 %36, label %40, label %37
37: ; preds = %30, %34
%38 = phi i8* [ %35, %34 ], [ %32, %30 ]
%39 = getelementptr inbounds i8, i8* %38, i64 1
br label %40
40: ; preds = %34, %37
%41 = phi i8* [ %39, %37 ], [ %31, %34 ]
%42 = call i32 @strcpy(i8* %4, i8* %41)
br label %43
43: ; preds = %47, %40
%44 = phi i8* [ %4, %40 ], [ %48, %47 ]
%45 = load i8, i8* %44
switch i8 %45, label %47 [
i8 0, label %49
i8 47, label %46
i8 46, label %46
i8 92, label %46
i8 45, label %46
]
46: ; preds = %43, %43, %43, %43
store i8 95, i8* %44
br label %47
47: ; preds = %43, %46
%48 = getelementptr inbounds i8, i8* %44, i64 1
br label %43
49: ; preds = %43
%50 = load i32, i32* @SEEK_END
%51 = call i32 @fseek(i32* %24, i32 0, i32 %50)
%52 = call i32 @ftell(i32* %24)
%53 = load i32, i32* @SEEK_SET
%54 = call i32 @fseek(i32* %24, i32 0, i32 %53)
%55 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i8* %4, i32 %52)
%56 = call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i64 17, i64 1, i32* %12)
%57 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* %4)
%58 = call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i64 18, i64 1, i32* %12)
%59 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i8* %4)
%60 = load i8*, i8** %22
%61 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), i8* %60)
%62 = call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i64 6, i64 1, i32* %12)
%63 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.12, i64 0, i64 0), i8* %4, i32 %52)
%64 = call i32 @hexdump(i32* %12, i32* %24)
%65 = call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i64 3, i64 1, i32* %12)
%66 = call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i64 7, i64 1, i32* %12)
%67 = call i32 @fclose(i32* %24)
%68 = add nuw nsw i64 %21, 1
%69 = icmp eq i64 %68, %15
br i1 %69, label %70, label %20
70: ; preds = %49, %26, %16, %6
%71 = phi i32 [ 1, %6 ], [ 1, %26 ], [ 1, %16 ], [ 0, %49 ]
ret i32 %71
}