#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*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
void write_dos_header_and_stub(FILE *file) {
  char buffer[128] = {
      0x4d, 0x5a, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
      0xFF, 0xFF, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x80, 0x00, 0x00, 0x00, 0x0e, 0x1f, 0xba, 0x0e, 0x00, 0xb4, 0x09, 0xcd,
      0x21, 0xb8, 0x01, 0x4c, 0xcd, 0x21, 0x54, 0x68, 0x69, 0x73, 0x20, 0x70,
      0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x20, 0x63, 0x61, 0x6e, 0x6e, 0x6f,
      0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x75, 0x6e, 0x20, 0x69, 0x6e, 0x20,
      0x44, 0x4f, 0x53, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x2e, 0x0d, 0x0d, 0x0a,
      0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  fwrite(buffer, 1, 128, file);
}


x86 assembly (clang, -O0):
<write_dos_header_and_stub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x90(%rbp),%rdi
lea    0xec3(%rip),%rsi
mov    $0x80,%edx
call   1030 <memcpy@plt>
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x80,%edx
call   1040 <fwrite@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_dos_header_and_stub>:
sub    $0x88,%rsp
mov    %rdi,%rcx
movaps 0xf4f(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xf33(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xf17(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xefb(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec3(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe8b(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x80,%edx
call   1030 <fwrite@plt>
add    $0x88,%rsp
ret

LLVM IR (-O0):
@__const.write_dos_header_and_stub.buffer = [128 x i8] c"MZ\90\00\03\00\00\00\04\00\00\00\FF\FF\00\00\B8\00\00\00\00\00\00\00@\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\80\00\00\00\0E\1F\BA\0E\00\B4\09\CD!\B8\01L\CD!This program cannot be run in DOS mode.\0D\0D\0A$\00\00\00\00\00\00\00"
define void @write_dos_header_and_stub(i32* %0) {
%2 = alloca i32*
%3 = alloca [128 x i8]
store i32* %0, i32** %2
%4 = bitcast [128 x i8]* %3 to i8*
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%6 = load i32*, i32** %2
%7 = call i32 @fwrite(i8* %5, i32 1, i32 128, i32* %6)
ret void
}

LLVM IR (-O2):
@__const.write_dos_header_and_stub.buffer = [128 x i8] c"MZ\90\00\03\00\00\00\04\00\00\00\FF\FF\00\00\B8\00\00\00\00\00\00\00@\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\80\00\00\00\0E\1F\BA\0E\00\B4\09\CD!\B8\01L\CD!This program cannot be run in DOS mode.\0D\0D\0A$\00\00\00\00\00\00\00"
define void @write_dos_header_and_stub(i32* nocapture %0) {
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%4 = call i32 @fwrite(i8* %3, i32 1, i32 128, i32* %0)
ret void
}