#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*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void CreateFontHeaderFile(FILE *out) {
  register int i;
  fprintf(out,
          "// (c) 2009, 2010 Lutz Sammer, License: AGPLv3\n\n"
          "\t/// bitmap font structure\n"
          "struct bitmap_font {\n"
          "\tunsigned char Width;\t\t///< max. character width\n"
          "\tunsigned char Height;\t\t///< character height\n"
          "\tunsigned short Chars;\t\t///< number of characters in font\n"
          "\tconst unsigned char *Widths;\t///< width of each character\n"
          "\tconst unsigned short *Index;\t///< encoding to character index\n"
          "\tconst unsigned char *Bitmap;\t///< bitmap of all characters\n"
          "};\n\n");
  fprintf(out, "\t/// @{ defines to have human readable font files\n");
  for (i = 0; i < 256; ++i) {
    fprintf(out, "#define %c%c%c%c%c%c%c%c 0x%02X\n", (i & 0x80) ? 'X' : '_',
            (i & 0x40) ? 'X' : '_', (i & 0x20) ? 'X' : '_',
            (i & 0x10) ? 'X' : '_', (i & 0x08) ? 'X' : '_',
            (i & 0x04) ? 'X' : '_', (i & 0x02) ? 'X' : '_',
            (i & 0x01) ? 'X' : '_', i);
  }
  fprintf(out, "\t/// @}\n");
}


x86 assembly (clang, -O0):
<CreateFontHeaderFile>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rdi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xed6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rdi
lea    0x1078(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x100,-0x1c(%rbp)
jge    124d <CreateFontHeaderFile+0x13d>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%ecx
and    $0x80,%ecx
mov    $0x5f,%edx
mov    $0x58,%eax
cmp    $0x0,%ecx
cmovne %eax,%edx
mov    -0x1c(%rbp),%esi
and    $0x40,%esi
mov    $0x5f,%ecx
mov    $0x58,%eax
cmp    $0x0,%esi
cmovne %eax,%ecx
mov    -0x1c(%rbp),%esi
and    $0x20,%esi
mov    $0x5f,%r8d
mov    $0x58,%eax
cmp    $0x0,%esi
cmovne %eax,%r8d
mov    -0x1c(%rbp),%esi
and    $0x10,%esi
mov    $0x5f,%r9d
mov    $0x58,%eax
cmp    $0x0,%esi
cmovne %eax,%r9d
mov    -0x1c(%rbp),%esi
and    $0x8,%esi
mov    $0x5f,%r14d
mov    $0x58,%eax
cmp    $0x0,%esi
cmovne %eax,%r14d
mov    -0x1c(%rbp),%esi
and    $0x4,%esi
mov    $0x5f,%ebx
mov    $0x58,%eax
cmp    $0x0,%esi
cmovne %eax,%ebx
mov    -0x1c(%rbp),%esi
and    $0x2,%esi
mov    $0x5f,%r11d
mov    $0x58,%eax
cmp    $0x0,%esi
cmovne %eax,%r11d
mov    -0x1c(%rbp),%esi
and    $0x1,%esi
mov    $0x5f,%r10d
mov    $0x58,%eax
cmp    $0x0,%esi
cmovne %eax,%r10d
mov    -0x1c(%rbp),%eax
lea    0xfc5(%rip),%rsi
mov    %r14d,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %eax,0x20(%rsp)
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114a <CreateFontHeaderFile+0x3a>
mov    -0x18(%rbp),%rdi
lea    0xfb0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<CreateFontHeaderFile>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r15
lea    0xeed(%rip),%rdi
mov    $0x1b3,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1040 <fwrite@plt>
lea    0x1088(%rip),%rdi
mov    $0x32,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1040 <fwrite@plt>
lea    0x10a2(%rip),%r14
xor    %ebx,%ebx
jmp    119d <CreateFontHeaderFile+0x7d>
nopl   0x0(%rax)
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
push   %rbx
push   %r10
push   %r13
push   %r12
push   %r11
call   1030 <fprintf@plt>
add    $0x30,%rsp
add    $0x1,%ebx
cmp    $0x100,%ebx
je     1257 <CreateFontHeaderFile+0x137>
movd   %ebx,%xmm0
pshufd $0x0,%xmm0,%xmm0
movdqa %xmm0,%xmm1
pand   0xe4e(%rip),%xmm1
pand   0xe56(%rip),%xmm0
pxor   %xmm2,%xmm2
pcmpeqd %xmm2,%xmm0
pcmpeqd %xmm2,%xmm1
packssdw %xmm0,%xmm1
packsswb %xmm1,%xmm1
pmovmskb %xmm1,%eax
mov    $0x5f,%r10d
mov    $0x5f,%edx
test   $0x80,%al
jne    11e6 <CreateFontHeaderFile+0xc6>
mov    $0x58,%edx
mov    $0x5f,%ecx
test   $0x40,%al
jne    11f4 <CreateFontHeaderFile+0xd4>
mov    $0x58,%ecx
mov    $0x5f,%r8d
test   $0x20,%al
jne    1204 <CreateFontHeaderFile+0xe4>
mov    $0x58,%r8d
mov    $0x5f,%r9d
test   $0x10,%al
jne    1214 <CreateFontHeaderFile+0xf4>
mov    $0x58,%r9d
mov    $0x5f,%r11d
test   $0x8,%al
jne    1224 <CreateFontHeaderFile+0x104>
mov    $0x58,%r11d
mov    $0x5f,%r12d
test   $0x4,%al
jne    1234 <CreateFontHeaderFile+0x114>
mov    $0x58,%r12d
mov    $0x5f,%r13d
test   $0x2,%al
jne    1244 <CreateFontHeaderFile+0x124>
mov    $0x58,%r13d
test   $0x1,%al
jne    1170 <CreateFontHeaderFile+0x50>
mov    $0x58,%r10d
jmp    1170 <CreateFontHeaderFile+0x50>
lea    0xfca(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    %r15,%rcx
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [436 x i8] c"// (c) 2009, 2010 Lutz Sammer, License: AGPLv3\0A\0A\09/// bitmap font structure\0Astruct bitmap_font {\0A\09unsigned char Width;\09\09///< max. character width\0A\09unsigned char Height;\09\09///< character height\0A\09unsigned short Chars;\09\09///< number of characters in font\0A\09const unsigned char *Widths;\09///< width of each character\0A\09const unsigned short *Index;\09///< encoding to character index\0A\09const unsigned char *Bitmap;\09///< bitmap of all characters\0A};\0A\0A\00"
@.str.1 = [51 x i8] c"\09/// @{ defines to have human readable font files\0A\00"
@.str.2 = [33 x i8] c"#define %c%c%c%c%c%c%c%c 0x%02X\0A\00"
@.str.3 = [9 x i8] c"\09/// @}\0A\00"
define void @CreateFontHeaderFile(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 (i32*, i8*, ...) @fprintf(i32* %4, i8* getelementptr inbounds ([436 x i8], [436 x i8]* @.str, i64 0, i64 0))
%6 = load i32*, i32** %2
%7 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %8
8: ; preds = %55, %1
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 256
br i1 %10, label %11, label %58
11: ; preds = %8
%12 = load i32*, i32** %2
%13 = load i32, i32* %3
%14 = and i32 %13, 128
%15 = icmp ne i32 %14, 0
%16 = zext i1 %15 to i64
%17 = select i1 %15, i32 88, i32 95
%18 = load i32, i32* %3
%19 = and i32 %18, 64
%20 = icmp ne i32 %19, 0
%21 = zext i1 %20 to i64
%22 = select i1 %20, i32 88, i32 95
%23 = load i32, i32* %3
%24 = and i32 %23, 32
%25 = icmp ne i32 %24, 0
%26 = zext i1 %25 to i64
%27 = select i1 %25, i32 88, i32 95
%28 = load i32, i32* %3
%29 = and i32 %28, 16
%30 = icmp ne i32 %29, 0
%31 = zext i1 %30 to i64
%32 = select i1 %30, i32 88, i32 95
%33 = load i32, i32* %3
%34 = and i32 %33, 8
%35 = icmp ne i32 %34, 0
%36 = zext i1 %35 to i64
%37 = select i1 %35, i32 88, i32 95
%38 = load i32, i32* %3
%39 = and i32 %38, 4
%40 = icmp ne i32 %39, 0
%41 = zext i1 %40 to i64
%42 = select i1 %40, i32 88, i32 95
%43 = load i32, i32* %3
%44 = and i32 %43, 2
%45 = icmp ne i32 %44, 0
%46 = zext i1 %45 to i64
%47 = select i1 %45, i32 88, i32 95
%48 = load i32, i32* %3
%49 = and i32 %48, 1
%50 = icmp ne i32 %49, 0
%51 = zext i1 %50 to i64
%52 = select i1 %50, i32 88, i32 95
%53 = load i32, i32* %3
%54 = call i32 (i32*, i8*, ...) @fprintf(i32* %12, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %17, i32 %22, i32 %27, i32 %32, i32 %37, i32 %42, i32 %47, i32 %52, i32 %53)
br label %55
55: ; preds = %11
%56 = load i32, i32* %3
%57 = add nsw i32 %56, 1
store i32 %57, i32* %3
br label %8
58: ; preds = %8
%59 = load i32*, i32** %2
%60 = call i32 (i32*, i8*, ...) @fprintf(i32* %59, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [436 x i8] c"// (c) 2009, 2010 Lutz Sammer, License: AGPLv3\0A\0A\09/// bitmap font structure\0Astruct bitmap_font {\0A\09unsigned char Width;\09\09///< max. character width\0A\09unsigned char Height;\09\09///< character height\0A\09unsigned short Chars;\09\09///< number of characters in font\0A\09const unsigned char *Widths;\09///< width of each character\0A\09const unsigned short *Index;\09///< encoding to character index\0A\09const unsigned char *Bitmap;\09///< bitmap of all characters\0A};\0A\0A\00"
@.str.1 = [51 x i8] c"\09/// @{ defines to have human readable font files\0A\00"
@.str.2 = [33 x i8] c"#define %c%c%c%c%c%c%c%c 0x%02X\0A\00"
@.str.3 = [9 x i8] c"\09/// @}\0A\00"
define void @CreateFontHeaderFile(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([436 x i8], [436 x i8]* @.str, i64 0, i64 0), i64 435, i64 1, i32* %0)
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i64 50, i64 1, i32* %0)
br label %4
4: ; preds = %1, %4
%5 = phi i32 [ 0, %1 ], [ %27, %4 ]
%6 = insertelement <8 x i32> poison, i32 %5, i64 0
%7 = shufflevector <8 x i32> %6, <8 x i32> poison, <8 x i32> zeroinitializer
%8 = and <8 x i32> %7, <i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128>
%9 = icmp eq <8 x i32> %8, zeroinitializer
%10 = extractelement <8 x i1> %9, i64 7
%11 = select i1 %10, i32 95, i32 88
%12 = extractelement <8 x i1> %9, i64 6
%13 = select i1 %12, i32 95, i32 88
%14 = extractelement <8 x i1> %9, i64 5
%15 = select i1 %14, i32 95, i32 88
%16 = extractelement <8 x i1> %9, i64 4
%17 = select i1 %16, i32 95, i32 88
%18 = extractelement <8 x i1> %9, i64 3
%19 = select i1 %18, i32 95, i32 88
%20 = extractelement <8 x i1> %9, i64 2
%21 = select i1 %20, i32 95, i32 88
%22 = extractelement <8 x i1> %9, i64 1
%23 = select i1 %22, i32 95, i32 88
%24 = extractelement <8 x i1> %9, i64 0
%25 = select i1 %24, i32 95, i32 88
%26 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 %13, i32 %15, i32 %17, i32 %19, i32 %21, i32 %23, i32 %25, i32 %5)
%27 = add nuw nsw i32 %5, 1
%28 = icmp eq i32 %27, 256
br i1 %28, label %29, label %4
29: ; preds = %4
%30 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 8, i64 1, i32* %0)
ret void
}