#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;

/* Variables and functions */
int dump_font(char const *, char *);
int /*<<< orphan*/ getname(char *, int, char const *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  const char *filename;
  char name[128];
  int font_size[128];
  int i;
  printf("/* This file was generated automatically by fbftoqe */\n\n"
         "#include \"qe.h\"\n"
         "#include \"fbfrender.h\"\n"
         "\n");
  for (i = 1; i < argc; i++) {
    filename = argv[i];
    getname(name, sizeof(name), filename);
    font_size[i] = dump_font(filename, name);
  }
  printf("const struct fbf_font fbf_fonts[] = {\n");
  for (i = 1; i < argc; i++) {
    filename = argv[i];
    getname(name, sizeof(name), filename);
    printf("    { font_%s, %d },\n", name, font_size[i]);
  }
  printf("    { NULL, 0 },\n");
  printf("};\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x2a4(%rbp)
mov    -0x2a4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11cc <main+0x9c>
mov    -0x10(%rbp),%rax
movslq -0x2a4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x80,%esi
call   1050 <getname@plt>
mov    -0x18(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1040 <dump_font@plt>
mov    %eax,%ecx
movslq -0x2a4(%rbp),%rax
mov    %ecx,-0x2a0(%rbp,%rax,4)
mov    -0x2a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2a4(%rbp)
jmp    1161 <main+0x31>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x2a4(%rbp)
mov    -0x2a4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1252 <main+0x122>
mov    -0x10(%rbp),%rax
movslq -0x2a4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x80,%esi
call   1050 <getname@plt>
lea    -0xa0(%rbp),%rsi
movslq -0x2a4(%rbp),%rax
mov    -0x2a0(%rbp,%rax,4),%edx
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2a4(%rbp)
jmp    11e4 <main+0xb4>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x2b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x288,%rsp
mov    %rsi,%r15
mov    %edi,%r14d
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x1,%r14d
jle    1200 <main+0xc0>
mov    %r14d,%r12d
mov    $0x1,%ebp
mov    %rsp,%r13
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbp,8),%rbx
mov    %r13,%rdi
mov    $0x80,%esi
mov    %rbx,%rdx
call   1060 <getname@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <dump_font@plt>
mov    %eax,0x80(%rsp,%rbp,4)
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1180 <main+0x40>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x2,%r14d
jl     120c <main+0xcc>
mov    $0x1,%ebx
mov    %rsp,%rbp
lea    0xe30(%rip),%r14
mov    (%r15,%rbx,8),%rdx
mov    %rbp,%rdi
mov    $0x80,%esi
call   1060 <getname@plt>
mov    0x80(%rsp,%rbx,4),%edx
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    11d0 <main+0x90>
jmp    120c <main+0xcc>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8e(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x288,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [97 x i8] c"/* This file was generated automatically by fbftoqe */\0A\0A#include \22qe.h\22\0A#include \22fbfrender.h\22\0A\0A\00"
@.str.1 = [39 x i8] c"const struct fbf_font fbf_fonts[] = {\0A\00"
@.str.2 = [22 x i8] c" { font_%s, %d },\0A\00"
@.str.3 = [18 x i8] c" { NULL, 0 },\0A\00"
@.str.4 = [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 [128 x i32]
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %9
br label %11
11: ; preds = %30, %2
%12 = load i32, i32* %9
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %33
15: ; preds = %11
%16 = load i8**, i8*** %5
%17 = load i32, i32* %9
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
store i8* %20, i8** %6
%21 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%22 = load i8*, i8** %6
%23 = call i32 @getname(i8* %21, i32 128, i8* %22)
%24 = load i8*, i8** %6
%25 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%26 = call i32 @dump_font(i8* %24, i8* %25)
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [128 x i32], [128 x i32]* %8, i64 0, i64 %28
store i32 %26, i32* %29
br label %30
30: ; preds = %15
%31 = load i32, i32* %9
%32 = add nsw i32 %31, 1
store i32 %32, i32* %9
br label %11
33: ; preds = %11
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %9
br label %35
35: ; preds = %54, %33
%36 = load i32, i32* %9
%37 = load i32, i32* %4
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %57
39: ; preds = %35
%40 = load i8**, i8*** %5
%41 = load i32, i32* %9
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
store i8* %44, i8** %6
%45 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%46 = load i8*, i8** %6
%47 = call i32 @getname(i8* %45, i32 128, i8* %46)
%48 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%49 = load i32, i32* %9
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [128 x i32], [128 x i32]* %8, i64 0, i64 %50
%52 = load i32, i32* %51
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %48, i32 %52)
br label %54
54: ; preds = %39
%55 = load i32, i32* %9
%56 = add nsw i32 %55, 1
store i32 %56, i32* %9
br label %35
57: ; preds = %35
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

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