#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;
scalar_t__ 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*/ printf(char *, char *, char *, int);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ strcpy(char *, char *);
char *strrchr(char *, char);
int main(int argc, char **argv) {
  FILE *fo;
  FILE *fi;
  char fontname[256];
  char origname[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;
  }
  fprintf(fo, "#ifndef __STRICT_ANSI__\n");
  fprintf(fo, "#if defined(__linux__) || defined(__FreeBSD__)\n");
  fprintf(fo, "#define HAVE_INCBIN\n");
  fprintf(fo, "#endif\n");
  fprintf(fo, "#endif\n");
  for (i = 2; i < argc; i++) {
    fi = fopen(argv[i], "rb");
    if (!fi) {
      fclose(fo);
      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(origname, basename);
    p = strrchr(origname, '.');
    if (p)
      *p = 0;
    strcpy(fontname, origname);
    p = fontname;
    while (*p) {
      if (*p == '/' || *p == '.' || *p == '\\' || *p == '-')
        *p = '_';
      p++;
    }
    fseek(fi, 0, SEEK_END);
    len = ftell(fi);
    fseek(fi, 0, SEEK_SET);
    printf("\t{\"%s\",pdf_font_%s,%d},\n", origname, fontname, len);
    fprintf(fo, "\n#ifdef HAVE_INCBIN\n");
    fprintf(fo, "extern const unsigned char pdf_font_%s[%d];\n", fontname, len);
    fprintf(fo, "asm(\".globl pdf_font_%s\");\n", fontname);
    fprintf(fo, "asm(\".balign 8\");\n");
    fprintf(fo, "asm(\"pdf_font_%s:\");\n", fontname);
    fprintf(fo, "asm(\".incbin \\\"%s\\\"\");\n", argv[i]);
    fprintf(fo, "#else\n");
    fprintf(fo, "static const unsigned char pdf_font_%s[%d] = {\n", fontname,
            len);
    hexdump(fo, fi);
    fprintf(fo, "};\n");
    fprintf(fo, "#endif\n");
    fclose(fi);
  }
  if (fclose(fo)) {
    fprintf(stderr, "fontdump: could not close output file '%s'\n", argv[1]);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11d7 <main+0x47>
mov    0x2e1e(%rip),%rax
mov    (%rax),%rdi
lea    0xe3c(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    161b <main+0x48b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3e(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1226 <main+0x96>
mov    0x2dd7(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe14(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    161b <main+0x48b>
mov    -0x18(%rbp),%rdi
lea    0xe21(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe28(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe46(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe49(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe37(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x2,-0x234(%rbp)
mov    -0x234(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    15d5 <main+0x445>
mov    -0x10(%rbp),%rax
movslq -0x234(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe09(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    12ff <main+0x16f>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2d05(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
movslq -0x234(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xdcf(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    161b <main+0x48b>
mov    -0x10(%rbp),%rax
movslq -0x234(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x2f,%esi
call   1060 <strrchr@plt>
mov    %rax,-0x228(%rbp)
cmpq   $0x0,-0x228(%rbp)
jne    134d <main+0x1bd>
mov    -0x10(%rbp),%rax
movslq -0x234(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x5c,%esi
call   1060 <strrchr@plt>
mov    %rax,-0x228(%rbp)
cmpq   $0x0,-0x228(%rbp)
je     1372 <main+0x1e2>
mov    -0x228(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x228(%rbp)
jmp    1388 <main+0x1f8>
mov    -0x10(%rbp),%rax
movslq -0x234(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x228(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0x228(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x220(%rbp),%rdi
mov    $0x2e,%esi
call   1060 <strrchr@plt>
mov    %rax,-0x230(%rbp)
cmpq   $0x0,-0x230(%rbp)
je     13cb <main+0x23b>
mov    -0x230(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x120(%rbp),%rdi
lea    -0x220(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x120(%rbp),%rax
mov    %rax,-0x230(%rbp)
mov    -0x230(%rbp),%rax
cmpb   $0x0,(%rax)
je     1469 <main+0x2d9>
mov    -0x230(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     1448 <main+0x2b8>
mov    -0x230(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     1448 <main+0x2b8>
mov    -0x230(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
je     1448 <main+0x2b8>
mov    -0x230(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1452 <main+0x2c2>
mov    -0x230(%rbp),%rax
movb   $0x5f,(%rax)
mov    -0x230(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x230(%rbp)
jmp    13ec <main+0x25c>
mov    -0x20(%rbp),%rdi
mov    0x2b74(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    -0x20(%rbp),%rdi
call   1080 <ftell@plt>
mov    %eax,-0x238(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2b39(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10a0 <fseek@plt>
lea    -0x220(%rbp),%rsi
lea    -0x120(%rbp),%rdx
mov    -0x238(%rbp),%ecx
lea    0xc2a(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xc33(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x120(%rbp),%rdx
mov    -0x238(%rbp),%ecx
lea    0xc29(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    0xc3d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xc47(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    0xc41(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x234(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xc36(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xc3c(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x120(%rbp),%rdx
mov    -0x238(%rbp),%ecx
lea    0xc24(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1090 <hexdump@plt>
mov    -0x18(%rbp),%rdi
lea    0xc35(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0xaff(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x234(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x234(%rbp)
jmp    128a <main+0xfa>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     1614 <main+0x484>
mov    0x29e9(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xbd7(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    161b <main+0x48b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
cmp    $0x2,%edi
jg     11db <main+0x3b>
mov    0x2e1b(%rip),%rax
mov    (%rax),%rcx
lea    0xe39(%rip),%rdi
mov    $0x23,%esi
mov    $0x1,%edx
call   10c0 <fwrite@plt>
jmp    151d <main+0x37d>
mov    %rsi,%r15
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
lea    0xe39(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     14bd <main+0x31d>
mov    %rax,%rbx
lea    0xe4f(%rip),%rdi
mov    $0x18,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10c0 <fwrite@plt>
lea    0xe4f(%rip),%rdi
mov    $0x2f,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
lea    0xe66(%rip),%rdi
mov    $0x14,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
lea    0xe62(%rip),%r14
mov    $0x7,%esi
mov    $0x1,%edx
mov    %r14,%rdi
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
mov    $0x7,%esi
mov    $0x1,%edx
mov    %r14,%rdi
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
mov    %ebp,%eax
mov    %rax,0x8(%rsp)
mov    $0x2,%r14d
movabs $0x800000000007,%r13
mov    %r15,%rbp
mov    %r15,(%rsp)
jmp    1402 <main+0x262>
nopl   0x0(%rax,%rax,1)
mov    0x2d41(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    %r15,%rdi
call   1080 <ftell@plt>
mov    %eax,%r12d
mov    0x2d0b(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
lea    0xe0d(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x110(%rsp),%rbp
mov    %rbp,%rdx
mov    %r12d,%ecx
call   1050 <printf@plt>
mov    $0x14,%esi
mov    $0x1,%edx
lea    0xdfd(%rip),%rdi
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
mov    %rbx,%rdi
lea    0xe00(%rip),%rsi
mov    %rbp,%rdx
mov    %r12d,%ecx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %rbx,%rdi
lea    0xe16(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x12,%esi
mov    $0x1,%edx
lea    0xe17(%rip),%rdi
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
mov    %rbx,%rdi
lea    0xe18(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    (%rsp),%rax
mov    (%rax,%r14,8),%rdx
mov    %rbx,%rdi
lea    0xe12(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x6,%esi
mov    $0x1,%edx
lea    0xe12(%rip),%rdi
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
mov    %rbx,%rdi
lea    0xe07(%rip),%rsi
mov    %rbp,%rdx
mov    (%rsp),%rbp
mov    %r12d,%ecx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1090 <hexdump@plt>
mov    $0x3,%esi
mov    $0x1,%edx
lea    0xe0a(%rip),%rdi
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
mov    $0x7,%esi
mov    $0x1,%edx
lea    0xccd(%rip),%rdi
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
add    $0x1,%r14
cmp    0x8(%rsp),%r14
je     14f4 <main+0x354>
mov    0x0(%rbp,%r14,8),%rdi
lea    0xcaa(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     14d4 <main+0x334>
mov    %rax,%r15
mov    0x0(%rbp,%r14,8),%rbp
mov    %rbp,%rdi
mov    $0x2f,%esi
call   1060 <strrchr@plt>
test   %rax,%rax
jne    1448 <main+0x2a8>
mov    %rbp,%rdi
mov    $0x5c,%esi
call   1060 <strrchr@plt>
test   %rax,%rax
je     144f <main+0x2af>
add    $0x1,%rax
mov    %rax,%rbp
lea    0x10(%rsp),%r12
mov    %r12,%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
mov    $0x2e,%esi
call   1060 <strrchr@plt>
test   %rax,%rax
je     1474 <main+0x2d4>
movb   $0x0,(%rax)
lea    0x110(%rsp),%rbp
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
call   1030 <strcpy@plt>
mov    %rbp,%rax
jmp    14a4 <main+0x304>
xchg   %ax,%ax
test   %cl,%cl
je     12a0 <main+0x100>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rax
movzbl (%rax),%ecx
lea    -0x2d(%rcx),%edx
cmp    $0x2f,%dl
ja     1490 <main+0x2f0>
movzbl %dl,%edx
bt     %rdx,%r13
jae    1490 <main+0x2f0>
movb   $0x5f,(%rax)
jmp    14a0 <main+0x300>
mov    0x2b14(%rip),%rax
mov    (%rax),%rdi
mov    0x8(%r15),%rdx
lea    0xb55(%rip),%rsi
jmp    1516 <main+0x376>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x2af5(%rip),%rax
mov    (%rax),%rdi
mov    0x0(%rbp,%r14,8),%rdx
lea    0xbc9(%rip),%rsi
jmp    1516 <main+0x376>
mov    %rbx,%rdi
call   1040 <fclose@plt>
test   %rax,%rax
je     1534 <main+0x394>
mov    0x2ad0(%rip),%rax
mov    (%rax),%rdi
mov    0x8(%rbp),%rdx
lea    0xcc2(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%eax
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
jmp    1522 <main+0x382>

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

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 = [25 x i8] c"#ifndef __STRICT_ANSI__\0A\00"
@.str.4 = [48 x i8] c"#if defined(__linux__) || defined(__FreeBSD__)\0A\00"
@.str.5 = [21 x i8] c"#define HAVE_INCBIN\0A\00"
@.str.6 = [8 x i8] c"#endif\0A\00"
@.str.7 = [3 x i8] c"rb\00"
@.str.8 = [42 x i8] c"fontdump: could not open input file '%s'\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.9 = [25 x i8] c"\09{\22%s\22,pdf_font_%s,%d},\0A\00"
@.str.10 = [21 x i8] c"\0A#ifdef HAVE_INCBIN\0A\00"
@.str.11 = [45 x i8] c"extern const unsigned char pdf_font_%s[%d];\0A\00"
@.str.12 = [28 x i8] c"asm(\22.globl pdf_font_%s\22);\0A\00"
@.str.13 = [19 x i8] c"asm(\22.balign 8\22);\0A\00"
@.str.14 = [22 x i8] c"asm(\22pdf_font_%s:\22);\0A\00"
@.str.15 = [24 x i8] c"asm(\22.incbin \\\22%s\\\22\22);\0A\00"
@.str.16 = [7 x i8] c"#else\0A\00"
@.str.17 = [48 x i8] c"static const unsigned char pdf_font_%s[%d] = {\0A\00"
@.str.18 = [4 x i8] c"};\0A\00"
@.str.19 = [44 x i8] c"fontdump: could not close output file '%s'\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 3
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32*, i32** @stderr
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i64 35, i64 1, i32* %9)
br label %91
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32* @fopen(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %20
16: ; preds = %11
%17 = load i32*, i32** @stderr
%18 = load i8*, i8** %12
%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 %91
20: ; preds = %11
%21 = tail call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i64 24, i64 1, i32* %14)
%22 = tail call i64 @fwrite(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i64 47, i64 1, i32* %14)
%23 = tail call i64 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i64 20, i64 1, i32* %14)
%24 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i64 7, i64 1, i32* %14)
%25 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i64 7, i64 1, i32* %14)
%26 = zext i32 %0 to i64
br label %27
27: ; preds = %20, %62
%28 = phi i64 [ 2, %20 ], [ %82, %62 ]
%29 = getelementptr inbounds i8*, i8** %1, i64 %28
%30 = load i8*, i8** %29
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %38
33: ; preds = %27
%34 = call i64 @fclose(i32* %14)
%35 = load i32*, i32** @stderr
%36 = load i8*, i8** %29
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.8, i64 0, i64 0), i8* %36)
br label %91
38: ; preds = %27
%39 = load i8*, i8** %29
%40 = call i8* @strrchr(i8* dereferenceable(1) %39, i8 signext 47)
%41 = icmp eq i8* %40, null
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = call i8* @strrchr(i8* dereferenceable(1) %39, i8 signext 92)
%44 = icmp eq i8* %43, null
br i1 %44, label %48, label %45
45: ; preds = %38, %42
%46 = phi i8* [ %43, %42 ], [ %40, %38 ]
%47 = getelementptr inbounds i8, i8* %46, i64 1
br label %48
48: ; preds = %42, %45
%49 = phi i8* [ %47, %45 ], [ %39, %42 ]
%50 = call i32 @strcpy(i8* %6, i8* %49)
%51 = call i8* @strrchr(i8* %6, i8 signext 46)
%52 = icmp eq i8* %51, null
br i1 %52, label %54, label %53
53: ; preds = %48
store i8 0, i8* %51
br label %54
54: ; preds = %53, %48
%55 = call i32 @strcpy(i8* %5, i8* %6)
br label %56
56: ; preds = %60, %54
%57 = phi i8* [ %5, %54 ], [ %61, %60 ]
%58 = load i8, i8* %57
switch i8 %58, label %60 [
i8 0, label %62
i8 47, label %59
i8 46, label %59
i8 92, label %59
i8 45, label %59
]
59: ; preds = %56, %56, %56, %56
store i8 95, i8* %57
br label %60
60: ; preds = %56, %59
%61 = getelementptr inbounds i8, i8* %57, i64 1
br label %56
62: ; preds = %56
%63 = load i32, i32* @SEEK_END
%64 = call i32 @fseek(i32* %31, i32 0, i32 %63)
%65 = call i32 @ftell(i32* %31)
%66 = load i32, i32* @SEEK_SET
%67 = call i32 @fseek(i32* %31, i32 0, i32 %66)
%68 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i8* %6, i8* %5, i32 %65)
%69 = call i64 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i64 20, i64 1, i32* %14)
%70 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0), i8* %5, i32 %65)
%71 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i8* %5)
%72 = call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0), i64 18, i64 1, i32* %14)
%73 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.14, i64 0, i64 0), i8* %5)
%74 = load i8*, i8** %29
%75 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.15, i64 0, i64 0), i8* %74)
%76 = call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i64 6, i64 1, i32* %14)
%77 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.17, i64 0, i64 0), i8* %5, i32 %65)
%78 = call i32 @hexdump(i32* %14, i32* %31)
%79 = call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i64 3, i64 1, i32* %14)
%80 = call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i64 7, i64 1, i32* %14)
%81 = call i64 @fclose(i32* %31)
%82 = add nuw nsw i64 %28, 1
%83 = icmp eq i64 %82, %26
br i1 %83, label %84, label %27
84: ; preds = %62
%85 = call i64 @fclose(i32* %14)
%86 = icmp eq i64 %85, 0
br i1 %86, label %91, label %87
87: ; preds = %84
%88 = load i32*, i32** @stderr
%89 = load i8*, i8** %12
%90 = call i32 (i32*, i8*, ...) @fprintf(i32* %88, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.19, i64 0, i64 0), i8* %89)
br label %91
91: ; preds = %84, %87, %33, %16, %8
%92 = phi i32 [ 1, %8 ], [ 1, %33 ], [ 1, %87 ], [ 1, %16 ], [ 0, %84 ]
ret i32 %92
}