#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*/ JumpBehindCode;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
void write_header(FILE *dest, size_t size) {
  static char JumpBehindCode[] = {
      0xeb, 0x1b, 'C',  'O', 'N', 'F', 'I', 'G', 32 - 2 - 6 - 2 - 3,
      0,    0,    1,    2,   0,   1,   0,   'n', 'u',
      's',  'e',  'd',  8,   7,   6,   5,   4,   3,
      2,    1,    0xe9, 0,   0};
  struct x {
    char y[sizeof(JumpBehindCode) == 0x20 ? 1 : -1];
  };
  fseek(dest, 0, SEEK_SET);
  *(short *)&JumpBehindCode[0x1e] += (short)size;
  fwrite(JumpBehindCode, 1, 0x20, dest);
}


x86 assembly (clang, -O0):
<write_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea5(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <fseek@plt>
mov    -0x10(%rbp),%rax
movswl %ax,%ecx
movswl 0x2f0c(%rip),%eax
add    %ecx,%eax
mov    %ax,0x2f03(%rip)
mov    -0x8(%rbp),%rcx
lea    0x2eda(%rip),%rdi
mov    $0x1,%esi
mov    $0x20,%edx
call   1040 <fwrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_header>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2eaf(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <fseek@plt>
add    %r14w,0x2f1c(%rip)
lea    0x2ef7(%rip),%rdi
mov    $0x1,%esi
mov    $0x20,%edx
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@write_header.JumpBehindCode = internal global [32 x i8] c"\EB\1BCONFIG\13\00\00\01\02\00\01\00nused\08\07\06\05\04\03\02\01\E9\00\00"
@SEEK_SET = global i32 0
define void @write_header(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* @SEEK_SET
%7 = call i32 @fseek(i32* %5, i32 0, i32 %6)
%8 = load i64, i64* %4
%9 = trunc i64 %8 to i16
%10 = sext i16 %9 to i32
%11 = load i16, i16* bitcast (i8* getelementptr inbounds ([32 x i8], [32 x i8]* @write_header.JumpBehindCode, i64 0, i64 30) to i16*)
%12 = sext i16 %11 to i32
%13 = add nsw i32 %12, %10
%14 = trunc i32 %13 to i16
store i16 %14, i16* bitcast (i8* getelementptr inbounds ([32 x i8], [32 x i8]* @write_header.JumpBehindCode, i64 0, i64 30) to i16*)
%15 = load i32*, i32** %3
%16 = call i32 @fwrite(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @write_header.JumpBehindCode, i64 0, i64 0), i32 1, i32 32, i32* %15)
ret void
}

LLVM IR (-O2):
@write_header.JumpBehindCode = internal global [32 x i8] c"\EB\1BCONFIG\13\00\00\01\02\00\01\00nused\08\07\06\05\04\03\02\01\E9\00\00"
@SEEK_SET = global i32 0
define void @write_header(i32* nocapture %0, i64 %1) {
%3 = load i32, i32* @SEEK_SET
%4 = tail call i32 @fseek(i32* %0, i32 0, i32 %3)
%5 = trunc i64 %1 to i16
%6 = load i16, i16* bitcast (i8* getelementptr inbounds ([32 x i8], [32 x i8]* @write_header.JumpBehindCode, i64 0, i64 30) to i16*)
%7 = add i16 %6, %5
store i16 %7, i16* bitcast (i8* getelementptr inbounds ([32 x i8], [32 x i8]* @write_header.JumpBehindCode, i64 0, i64 30) to i16*)
%8 = tail call i32 @fwrite(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @write_header.JumpBehindCode, i64 0, i64 0), i32 1, i32 32, i32* %0)
ret void
}