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

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ dump_font(char const *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ getname(char *, int, char const *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  const char *filename;
  char name[128];
  int i;
  printf("#include \"qe.h\"\n\n");
  for (i = 1; i < argc; i++) {
    filename = argv[i];
    getname(name, sizeof(name), filename);
    dump_font(filename, name);
  }
  printf("const void *fbf_fonts[] = {\n");
  for (i = 1; i < argc; i++) {
    FILE *f;
    int size;
    filename = argv[i];
    f = fopen(filename, "r");
    fseek(f, 0, SEEK_END);
    size = ftell(f);
    fclose(f);
    getname(name, sizeof(name), filename);
    printf("font_%s, (void *)%d,\n", name, size);
  }
  printf("NULL,\n");
  printf("};\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0xa4(%rbp)
mov    -0xa4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11fc <main+0x8c>
mov    -0x10(%rbp),%rax
movslq -0xa4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x80,%esi
call   1060 <getname@plt>
mov    -0x18(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1050 <dump_font@plt>
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    11a1 <main+0x31>
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0xa4(%rbp)
mov    -0xa4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12c6 <main+0x156>
mov    -0x10(%rbp),%rax
movslq -0xa4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xdee(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0xb0(%rbp)
mov    -0xb0(%rbp),%rdi
mov    0x2d8d(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1080 <fseek@plt>
mov    -0xb0(%rbp),%rdi
call   1070 <ftell@plt>
mov    %eax,-0xb4(%rbp)
mov    -0xb0(%rbp),%rdi
call   1030 <fclose@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x80,%esi
call   1060 <getname@plt>
lea    -0xa0(%rbp),%rsi
mov    -0xb4(%rbp),%edx
lea    0xd86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    1214 <main+0xa4>
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%r13
mov    %edi,%r14d
lea    0xe7a(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x1,%r14d
jle    127f <main+0xff>
mov    %r14d,%r12d
mov    $0x1,%ebp
mov    %rsp,%r15
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13,%rbp,8),%rbx
mov    %r15,%rdi
mov    $0x80,%esi
mov    %rbx,%rdx
call   1070 <getname@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <dump_font@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    11c0 <main+0x40>
lea    0xe39(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x2,%r14d
jl     128b <main+0x10b>
mov    $0x1,%r15d
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x0(%r13,%r15,8),%rbx
mov    %rbx,%rdi
lea    0xde1(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%rbp
mov    0x2dba(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   1090 <fseek@plt>
mov    %rbp,%rdi
call   1080 <ftell@plt>
mov    %eax,%r14d
mov    %rbp,%rdi
call   1040 <fclose@plt>
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    $0x80,%esi
mov    %rbx,%rdx
call   1070 <getname@plt>
lea    0xd9b(%rip),%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15
cmp    %r15,%r12
jne    1210 <main+0x90>
jmp    128b <main+0x10b>
lea    0xda3(%rip),%rdi
call   1030 <puts@plt>
lea    0xdb3(%rip),%rdi
call   1030 <puts@plt>
lea    0xdad(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"#include \22qe.h\22\0A\0A\00"
@.str.1 = [29 x i8] c"const void *fbf_fonts[] = {\0A\00"
@.str.2 = [2 x i8] c"r\00"
@SEEK_END = global i32 0
@.str.3 = [22 x i8] c"font_%s, (void *)%d,\0A\00"
@.str.4 = [7 x i8] c"NULL,\0A\00"
@.str.5 = [4 x i8] c"};\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [128 x i8]
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %8
br label %12
12: ; preds = %28, %2
%13 = load i32, i32* %8
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %31
16: ; preds = %12
%17 = load i8**, i8*** %5
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
store i8* %21, i8** %6
%22 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%23 = load i8*, i8** %6
%24 = call i32 @getname(i8* %22, i32 128, i8* %23)
%25 = load i8*, i8** %6
%26 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%27 = call i32 @dump_font(i8* %25, i8* %26)
br label %28
28: ; preds = %16
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 1
store i32 %30, i32* %8
br label %12
31: ; preds = %12
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %8
br label %33
33: ; preds = %58, %31
%34 = load i32, i32* %8
%35 = load i32, i32* %4
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %61
37: ; preds = %33
%38 = load i8**, i8*** %5
%39 = load i32, i32* %8
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8*, i8** %38, i64 %40
%42 = load i8*, i8** %41
store i8* %42, i8** %6
%43 = load i8*, i8** %6
%44 = call i32* @fopen(i8* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %44, i32** %9
%45 = load i32*, i32** %9
%46 = load i32, i32* @SEEK_END
%47 = call i32 @fseek(i32* %45, i32 0, i32 %46)
%48 = load i32*, i32** %9
%49 = call i32 @ftell(i32* %48)
store i32 %49, i32* %10
%50 = load i32*, i32** %9
%51 = call i32 @fclose(i32* %50)
%52 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%53 = load i8*, i8** %6
%54 = call i32 @getname(i8* %52, i32 128, i8* %53)
%55 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%56 = load i32, i32* %10
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %55, i32 %56)
br label %58
58: ; preds = %37
%59 = load i32, i32* %8
%60 = add nsw i32 %59, 1
store i32 %60, i32* %8
br label %33
61: ; preds = %33
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [2 x i8] c"r\00"
@SEEK_END = global i32 0
@.str.3 = [22 x i8] c"font_%s, (void *)%d,\0A\00"
@str = [17 x i8] c"#include \22qe.h\22\0A\00"
@str.6 = [28 x i8] c"const void *fbf_fonts[] = {\00"
@str.7 = [6 x i8] c"NULL,\00"
@str.8 = [3 x i8] c"};\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%6 = icmp sgt i32 %0, 1
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.6, i64 0, i64 0))
br label %36
9: ; preds = %2
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 1, %9 ], [ %17, %11 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = call i32 @getname(i8* %4, i32 128, i8* %14)
%16 = call i32 @dump_font(i8* %14, i8* %4)
%17 = add nuw nsw i64 %12, 1
%18 = icmp eq i64 %17, %10
br i1 %18, label %19, label %11
19: ; preds = %11
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.6, i64 0, i64 0))
br i1 %6, label %21, label %36
21: ; preds = %19
%22 = zext i32 %0 to i64
br label %23
23: ; preds = %21, %23
%24 = phi i64 [ 1, %21 ], [ %34, %23 ]
%25 = getelementptr inbounds i8*, i8** %1, i64 %24
%26 = load i8*, i8** %25
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%28 = load i32, i32* @SEEK_END
%29 = call i32 @fseek(i32* %27, i32 0, i32 %28)
%30 = call i32 @ftell(i32* %27)
%31 = call i32 @fclose(i32* %27)
%32 = call i32 @getname(i8* %4, i32 128, i8* %26)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %4, i32 %30)
%34 = add nuw nsw i64 %24, 1
%35 = icmp eq i64 %34, %22
br i1 %35, label %36, label %23
36: ; preds = %23, %7, %19
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.7, i64 0, i64 0))
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.8, i64 0, i64 0))
ret i32 0
}