#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 fprint_header(FILE *output_file) {
  fprintf(output_file, "#include <stdint.h>\n");
  fprintf(output_file, "#include <igzip_lib.h>\n\n");
  fprintf(output_file,
          "#if IGZIP_HIST_SIZE > %d\n"
          "# error \"Invalid history size for the custom hufftable\"\n"
          "#endif\n",
          (32 * 1024));
  fprintf(output_file, "#ifdef LONGER_HUFFTABLE\n"
                       "# error \"Custom hufftable requires LONGER_HUFFTABLE "
                       "to not be defined \"\n"
                       "#endif\n");
  fprintf(output_file, "\n");
  fprintf(output_file, "const uint8_t gzip_hdr[] = {\n"
                       "\t0x1f, 0x8b, 0x08, 0x00, 0x00,\n"
                       "\t0x00, 0x00, 0x00, 0x00, 0xff\t};\n\n");
  fprintf(output_file, "const uint32_t gzip_hdr_bytes = %d;\n", 10);
  fprintf(output_file, "const uint32_t gzip_trl_bytes = %d;\n\n", 8);
  fprintf(output_file, "const uint8_t zlib_hdr[] = { 0x78, 0x01 };\n\n");
  fprintf(output_file, "const uint32_t zlib_hdr_bytes = %d;\n", 2);
  fprintf(output_file, "const uint32_t zlib_trl_bytes = %d;\n", 4);
}


x86 assembly (clang, -O0):
<fprint_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xedc(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xee3(%rip),%rsi
mov    $0x8000,%edx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf25(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x1023(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf69(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xfb6(%rip),%rsi
mov    $0xa,%edx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xfc4(%rip),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xfd3(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xfee(%rip),%rsi
mov    $0x2,%edx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xffc(%rip),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprint_header>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
mov    $0x14,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xec1(%rip),%rdi
mov    $0x18,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xec1(%rip),%rsi
mov    %rbx,%rdi
mov    $0x8000,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xf04(%rip),%rdi
mov    $0x67,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
lea    0xf46(%rip),%rdi
mov    $0x5e,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xf8c(%rip),%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xf9b(%rip),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xfab(%rip),%rdi
mov    $0x2c,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xfbf(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xfce(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
xor    %eax,%eax
pop    %rbx
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"#include <stdint.h>\0A\00"
@.str.1 = [25 x i8] c"#include <igzip_lib.h>\0A\0A\00"
@.str.2 = [89 x i8] c"#if IGZIP_HIST_SIZE > %d\0A# error \22Invalid history size for the custom hufftable\22\0A#endif\0A\00"
@.str.3 = [104 x i8] c"#ifdef LONGER_HUFFTABLE\0A# error \22Custom hufftable requires LONGER_HUFFTABLE to not be defined \22\0A#endif\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [95 x i8] c"const uint8_t gzip_hdr[] = {\0A\090x1f, 0x8b, 0x08, 0x00, 0x00,\0A\090x00, 0x00, 0x00, 0x00, 0xff\09};\0A\0A\00"
@.str.6 = [37 x i8] c"const uint32_t gzip_hdr_bytes = %d;\0A\00"
@.str.7 = [38 x i8] c"const uint32_t gzip_trl_bytes = %d;\0A\0A\00"
@.str.8 = [45 x i8] c"const uint8_t zlib_hdr[] = { 0x78, 0x01 };\0A\0A\00"
@.str.9 = [37 x i8] c"const uint32_t zlib_hdr_bytes = %d;\0A\00"
@.str.10 = [37 x i8] c"const uint32_t zlib_trl_bytes = %d;\0A\00"
define void @fprint_header(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 (i32*, i8*, ...) @fprintf(i32* %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32*, i32** %2
%8 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str.2, i64 0, i64 0), i32 32768)
%9 = load i32*, i32** %2
%10 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str.3, i64 0, i64 0))
%11 = load i32*, i32** %2
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%13 = load i32*, i32** %2
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str.5, i64 0, i64 0))
%15 = load i32*, i32** %2
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i32 10)
%17 = load i32*, i32** %2
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i32 8)
%19 = load i32*, i32** %2
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.8, i64 0, i64 0))
%21 = load i32*, i32** %2
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0), i32 2)
%23 = load i32*, i32** %2
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.10, i64 0, i64 0), i32 4)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"#include <stdint.h>\0A\00"
@.str.1 = [25 x i8] c"#include <igzip_lib.h>\0A\0A\00"
@.str.2 = [89 x i8] c"#if IGZIP_HIST_SIZE > %d\0A# error \22Invalid history size for the custom hufftable\22\0A#endif\0A\00"
@.str.3 = [104 x i8] c"#ifdef LONGER_HUFFTABLE\0A# error \22Custom hufftable requires LONGER_HUFFTABLE to not be defined \22\0A#endif\0A\00"
@.str.5 = [95 x i8] c"const uint8_t gzip_hdr[] = {\0A\090x1f, 0x8b, 0x08, 0x00, 0x00,\0A\090x00, 0x00, 0x00, 0x00, 0xff\09};\0A\0A\00"
@.str.6 = [37 x i8] c"const uint32_t gzip_hdr_bytes = %d;\0A\00"
@.str.7 = [38 x i8] c"const uint32_t gzip_trl_bytes = %d;\0A\0A\00"
@.str.8 = [45 x i8] c"const uint8_t zlib_hdr[] = { 0x78, 0x01 };\0A\0A\00"
@.str.9 = [37 x i8] c"const uint32_t zlib_hdr_bytes = %d;\0A\00"
@.str.10 = [37 x i8] c"const uint32_t zlib_trl_bytes = %d;\0A\00"
define void @fprint_header(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 20, i64 1, i32* %0)
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i64 24, i64 1, i32* %0)
%4 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str.2, i64 0, i64 0), i32 32768)
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str.3, i64 0, i64 0), i64 103, i64 1, i32* %0)
%6 = tail call i32 @fputc(i32 10, i32* %0)
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str.5, i64 0, i64 0), i64 94, i64 1, i32* %0)
%8 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i32 10)
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i32 8)
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.8, i64 0, i64 0), i64 44, i64 1, i32* %0)
%11 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0), i32 2)
%12 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.10, i64 0, i64 0), i32 4)
ret void
}