#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*/ emit_text(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ generate(int /*<<< orphan*/ *, char *, double);
int main() {
  FILE *f = fopen("bgr2gu8.h", "wb");
  emit_text(f, "#ifndef __bgr2gu8__\n#define __bgr2gu8__\n\n\t");
  generate(f, "g_pixel_chunk_b_lut", 0.0721);
  generate(f, "g_pixel_chunk_g_lut", 0.7154);
  generate(f, "g_pixel_chunk_r_lut", 0.2125);
  emit_text(f, "#endif\n\n");
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
lea    0xec5(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb4(%rip),%rsi
call   1060 <emit_text@plt>
mov    -0x10(%rbp),%rdi
lea    0xecf(%rip),%rsi
movsd  0xe87(%rip),%xmm0
call   1050 <generate@plt>
mov    -0x10(%rbp),%rdi
lea    0xecb(%rip),%rsi
movsd  0xe67(%rip),%xmm0
call   1050 <generate@plt>
mov    -0x10(%rbp),%rdi
lea    0xec7(%rip),%rsi
movsd  0xe47(%rip),%xmm0
call   1050 <generate@plt>
mov    -0x10(%rbp),%rdi
lea    0xec3(%rip),%rsi
call   1060 <emit_text@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed0(%rip),%rdi
lea    0xed3(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
lea    0xec7(%rip),%rsi
mov    %rax,%rdi
call   1060 <emit_text@plt>
lea    0xee3(%rip),%rsi
movsd  0xe8b(%rip),%xmm0
mov    %rbx,%rdi
call   1050 <generate@plt>
lea    0xee0(%rip),%rsi
movsd  0xe7c(%rip),%xmm0
mov    %rbx,%rdi
call   1050 <generate@plt>
lea    0xedd(%rip),%rsi
movsd  0xe6d(%rip),%xmm0
mov    %rbx,%rdi
call   1050 <generate@plt>
lea    0xeda(%rip),%rsi
mov    %rbx,%rdi
call   1060 <emit_text@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"bgr2gu8.h\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [43 x i8] c"#ifndef __bgr2gu8__\0A#define __bgr2gu8__\0A\0A\09\00"
@.str.3 = [20 x i8] c"g_pixel_chunk_b_lut\00"
@.str.4 = [20 x i8] c"g_pixel_chunk_g_lut\00"
@.str.5 = [20 x i8] c"g_pixel_chunk_r_lut\00"
@.str.6 = [9 x i8] c"#endif\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @emit_text(i32* %4, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%6 = load i32*, i32** %2
%7 = call i32 @generate(i32* %6, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), double 7.210000e-02)
%8 = load i32*, i32** %2
%9 = call i32 @generate(i32* %8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), double 7.154000e-01)
%10 = load i32*, i32** %2
%11 = call i32 @generate(i32* %10, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), double 2.125000e-01)
%12 = load i32*, i32** %2
%13 = call i32 @emit_text(i32* %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%14 = load i32*, i32** %2
%15 = call i32 @fclose(i32* %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"bgr2gu8.h\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [43 x i8] c"#ifndef __bgr2gu8__\0A#define __bgr2gu8__\0A\0A\09\00"
@.str.3 = [20 x i8] c"g_pixel_chunk_b_lut\00"
@.str.4 = [20 x i8] c"g_pixel_chunk_g_lut\00"
@.str.5 = [20 x i8] c"g_pixel_chunk_r_lut\00"
@.str.6 = [9 x i8] c"#endif\0A\0A\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @emit_text(i32* %1, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @generate(i32* %1, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), double 7.210000e-02)
%4 = tail call i32 @generate(i32* %1, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), double 7.154000e-01)
%5 = tail call i32 @generate(i32* %1, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), double 2.125000e-01)
%6 = tail call i32 @emit_text(i32* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%7 = tail call i32 @fclose(i32* %1)
ret i32 0
}