#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 emit_header(FILE *f) {
  fprintf(f, "/* \n"
             " * This file is automatically generated from UnicodeData.txt\n"
             " * using udata-gen.c\n"
             " */\n\n");
  fprintf(f, "#include <stdint.h>\n"
             "typedef struct udata_entry_t{\n"
             "  char category[3];\n"
             "  int32_t upper_offset;\n"
             "  int32_t lower_offset;\n"
             "  int32_t title_offset;\n"
             "} udata_entry_t;\n\n");
  fprintf(f, "#define FIRST_SIZE %d\n", 17 * 256);
  fprintf(f, "#define SECOND_SIZE %d\n\n", 256);
  fprintf(f, "#define UDATA_ENTRY(n) \\\n"
             "   (dfsch__udata_properties[dfsch__udata_tables["
             "dfsch__udata_table_type[((n) / SECOND_SIZE) %% FIRST_SIZE]]"
             "[(n) %% SECOND_SIZE]])\n");
  fprintf(f, "#define UDATA_MAX %d\n", 17 * 256 * 256);
  fprintf(f, "extern unsigned char dfsch__udata_table_type[];\n");
  fprintf(f, "extern unsigned char dfsch__udata_tables[][%d];\n", 256);
  fprintf(f, "extern udata_entry_t dfsch__udata_properties[];");
}


x86 assembly (clang, -O0):
<emit_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    0xf23(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xfb2(%rip),%rsi
mov    $0x1100,%edx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xfb2(%rip),%rsi
mov    $0x100,%edx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xfb4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x103e(%rip),%rsi
mov    $0x110000,%edx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x103d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x105c(%rip),%rsi
mov    $0x100,%edx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x1076(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_header>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
mov    $0x5b,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xf18(%rip),%rdi
mov    $0xa0,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xfa0(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1100,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xfa1(%rip),%rsi
mov    %rbx,%rdi
mov    $0x100,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xfa4(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0x102f(%rip),%rsi
mov    %rbx,%rdi
mov    $0x110000,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0x102f(%rip),%rdi
mov    $0x30,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0x1047(%rip),%rsi
mov    %rbx,%rdi
mov    $0x100,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0x1062(%rip),%rdi
mov    $0x2f,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
pop    %rbx
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [92 x i8] c"/* \0A * This file is automatically generated from UnicodeData.txt\0A * using udata-gen.c\0A */\0A\0A\00"
@.str.1 = [161 x i8] c"#include <stdint.h>\0Atypedef struct udata_entry_t{\0A char category[3];\0A int32_t upper_offset;\0A int32_t lower_offset;\0A int32_t title_offset;\0A} udata_entry_t;\0A\0A\00"
@.str.2 = [23 x i8] c"#define FIRST_SIZE %d\0A\00"
@.str.3 = [25 x i8] c"#define SECOND_SIZE %d\0A\0A\00"
@.str.4 = [156 x i8] c"#define UDATA_ENTRY(n) \\\0A (dfsch__udata_properties[dfsch__udata_tables[dfsch__udata_table_type[((n) / SECOND_SIZE) %% FIRST_SIZE]][(n) %% SECOND_SIZE]])\0A\00"
@.str.5 = [22 x i8] c"#define UDATA_MAX %d\0A\00"
@.str.6 = [49 x i8] c"extern unsigned char dfsch__udata_table_type[];\0A\00"
@.str.7 = [49 x i8] c"extern unsigned char dfsch__udata_tables[][%d];\0A\00"
@.str.8 = [48 x i8] c"extern udata_entry_t dfsch__udata_properties[];\00"
define void @emit_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 ([92 x i8], [92 x i8]* @.str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32*, i32** %2
%8 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 4352)
%9 = load i32*, i32** %2
%10 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 256)
%11 = load i32*, i32** %2
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str.4, i64 0, i64 0))
%13 = load i32*, i32** %2
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 1114112)
%15 = load i32*, i32** %2
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0))
%17 = load i32*, i32** %2
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0), i32 256)
%19 = load i32*, i32** %2
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [92 x i8] c"/* \0A * This file is automatically generated from UnicodeData.txt\0A * using udata-gen.c\0A */\0A\0A\00"
@.str.1 = [161 x i8] c"#include <stdint.h>\0Atypedef struct udata_entry_t{\0A char category[3];\0A int32_t upper_offset;\0A int32_t lower_offset;\0A int32_t title_offset;\0A} udata_entry_t;\0A\0A\00"
@.str.2 = [23 x i8] c"#define FIRST_SIZE %d\0A\00"
@.str.3 = [25 x i8] c"#define SECOND_SIZE %d\0A\0A\00"
@.str.4 = [156 x i8] c"#define UDATA_ENTRY(n) \\\0A (dfsch__udata_properties[dfsch__udata_tables[dfsch__udata_table_type[((n) / SECOND_SIZE) %% FIRST_SIZE]][(n) %% SECOND_SIZE]])\0A\00"
@.str.5 = [22 x i8] c"#define UDATA_MAX %d\0A\00"
@.str.6 = [49 x i8] c"extern unsigned char dfsch__udata_table_type[];\0A\00"
@.str.7 = [49 x i8] c"extern unsigned char dfsch__udata_tables[][%d];\0A\00"
@.str.8 = [48 x i8] c"extern udata_entry_t dfsch__udata_properties[];\00"
define void @emit_header(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str, i64 0, i64 0), i64 91, i64 1, i32* %0)
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str.1, i64 0, i64 0), i64 160, i64 1, i32* %0)
%4 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 4352)
%5 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 256)
%6 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 1114112)
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0), i64 48, i64 1, i32* %0)
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0), i32 256)
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0), i64 47, i64 1, i32* %0)
ret void
}