// File: /workspace/github_c_makefile_star2_O2/lecram[P]congif/mbf2c.c
// Function: main
int
main(int argc, char *argv[])
{
    Font *font;
    int i;

    if (argc != 2) {
        fprintf(stderr, "Usage: %s font.mbf\n", argv[0]);
        return 1;
    }
    font = load_font(argv[1]);
    if (font == NULL) {
        fprintf(stderr, "Failed to load font '%s'.\n", argv[1]);
        return 1;
    }

    printf("static Range "FN"_ranges[%d] = {\n", font->header.nr);
    for(i=0; i<font->header.nr; i++) {
        printf("    { %d, %d }%s\n",
            (int) font->ranges[i].offset,
            (int) font->ranges[i].length,
            i+1 == font->header.nr?"":",");
    }
    printf("};\n\n");

    printf("static uint8_t "FN"_data[] = {\n");
    for (i = 0; i < font->header.ng * font->stride * font->header.h; i++) {
        if (i%12 == 0) {
            if (i) printf(",\n");
            printf("    ");
        } else
            printf(", ");
        printf("0x%02x", font->data[i]);
    }
    printf("\n};\n\n");

    printf("Font "FN"[1] = {{ ");

    printf("{ %d, %d, %d, %d }, ",
        (int) font->header.ng,
        (int) font->header.w,
        (int) font->header.h,
        (int) font->header.nr);

    printf("%d, "FN"_ranges, "FN"_data }};\n",
        (int) font->stride);

    free(font);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
cmpl $0x2, %edi
jne 0x14ba
movq 0x8(%r14), %rdi
callq 0x11ac
testq %rax, %rax
je 0x14d0
movq %rax, %rbx
movzwl 0x4(%rax), %esi
leaq 0xcc0(%rip), %rdi       # 0x2033
xorl %eax, %eax
callq 0x1050
leaq 0xcb1(%rip), %r15       # 0x2032
leaq 0xd7f(%rip), %r12       # 0x2107
leaq 0xcce(%rip), %r14       # 0x205d
xorl %r13d, %r13d
movzwl 0x4(%rbx), %eax
cmpq %rax, %r13
jae 0x13c3
movq 0x10(%rbx), %rcx
movzwl (%rcx,%r13,4), %esi
movzwl 0x2(%rcx,%r13,4), %edx
incq %r13
cmpq %rax, %r13
movq %r12, %rcx
cmoveq %r15, %rcx
movq %r14, %rdi
xorl %eax, %eax
callq 0x1050
jmp 0x1392
leaq 0xd39(%rip), %rdi       # 0x2103
callq 0x1040
leaq 0xd05(%rip), %rdi       # 0x20db
callq 0x1040
pushq $0xc
popq %rbp
leaq 0xcc3(%rip), %r13       # 0x20a8
leaq 0xc83(%rip), %r14       # 0x206f
leaq 0xc81(%rip), %r15       # 0x2074
xorl %r12d, %r12d
movl %r12d, %eax
xorl %edx, %edx
divl %ebp
movzwl (%rbx), %ecx
movslq 0x8(%rbx), %rdx
imulq %rcx, %rdx
movzbl 0x3(%rbx), %ecx
imulq %rdx, %rcx
cmpq %rcx, %r12
jge 0x1456
imull $-0xc, %eax, %eax
movq %r13, %rdi
addl %r12d, %eax
jne 0x1437
movq %r14, %rdi
testq %r12, %r12
je 0x1437
leaq 0xcd8(%rip), %rdi       # 0x2107
callq 0x1040
movq %r14, %rdi
xorl %eax, %eax
callq 0x1050
movq 0x18(%rbx), %rax
movzbl (%rax,%r12), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1050
incq %r12
jmp 0x13f6
leaq 0xca5(%rip), %rdi       # 0x2102
callq 0x1040
leaq 0xc12(%rip), %rdi       # 0x207b
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x1050
movzwl (%rbx), %esi
movzbl 0x2(%rbx), %edx
movzbl 0x3(%rbx), %ecx
movzwl 0x4(%rbx), %r8d
leaq 0xc0d(%rip), %rdi       # 0x2096
xorl %eax, %eax
callq 0x1050
movl 0x8(%rbx), %esi
leaq 0xc11(%rip), %rdi       # 0x20ab
xorl %eax, %eax
callq 0x1050
movq %rbx, %rdi
callq 0x1030
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2b37(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq (%r14), %rdx
leaq 0xb36(%rip), %rsi       # 0x2004
jmp 0x14e5
movq 0x2b21(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq 0x8(%r14), %rdx
leaq 0xb33(%rip), %rsi       # 0x2018
xorl %eax, %eax
callq 0x1080
pushq $0x1
popq %rbp
jmp 0x14a9