#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ fputc_err(char, int /*<<< orphan*/ *);
long ftell_err(int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite_err(char *, int, int, int /*<<< orphan*/ *);
long int Write_MIDI_Track_Header(FILE *outf) {
  long int fp;
  char buffer[4] = {0};
  (assert(outf != NULL));
  fputc_err('M', outf);
  fputc_err('T', outf);
  fputc_err('r', outf);
  fputc_err('k', outf);
  fp = ftell_err(outf);
  fwrite_err(buffer, 4, 1, outf);
  return fp;
}


x86 assembly (clang, -O0):
<Write_MIDI_Track_Header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x14(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rsi
mov    $0x4d,%edi
call   1070 <fputc_err@plt>
mov    -0x8(%rbp),%rsi
mov    $0x54,%edi
call   1070 <fputc_err@plt>
mov    -0x8(%rbp),%rsi
mov    $0x72,%edi
call   1070 <fputc_err@plt>
mov    -0x8(%rbp),%rsi
mov    $0x6b,%edi
call   1070 <fputc_err@plt>
mov    -0x8(%rbp),%rdi
call   1030 <ftell_err@plt>
mov    %rax,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x4,%esi
mov    $0x1,%edx
call   1060 <fwrite_err@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Write_MIDI_Track_Header>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movl   $0x0,0x4(%rsp)
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
mov    $0x4d,%edi
mov    %rbx,%rsi
call   1060 <fputc_err@plt>
mov    $0x54,%edi
mov    %rbx,%rsi
call   1060 <fputc_err@plt>
mov    $0x72,%edi
mov    %rbx,%rsi
call   1060 <fputc_err@plt>
mov    $0x6b,%edi
mov    %rbx,%rsi
call   1060 <fputc_err@plt>
mov    %rbx,%rdi
call   1030 <ftell_err@plt>
mov    %rax,%r14
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite_err@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @Write_MIDI_Track_Header(i32* %0) {
%2 = alloca i32*
%3 = alloca i64
%4 = alloca [4 x i8]
store i32* %0, i32** %2
%5 = bitcast [4 x i8]* %4 to i8*
%6 = load i32*, i32** %2
%7 = icmp ne i32* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i32*, i32** %2
%11 = call i32 @fputc_err(i8 signext 77, i32* %10)
%12 = load i32*, i32** %2
%13 = call i32 @fputc_err(i8 signext 84, i32* %12)
%14 = load i32*, i32** %2
%15 = call i32 @fputc_err(i8 signext 114, i32* %14)
%16 = load i32*, i32** %2
%17 = call i32 @fputc_err(i8 signext 107, i32* %16)
%18 = load i32*, i32** %2
%19 = call i64 @ftell_err(i32* %18)
store i64 %19, i64* %3
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%21 = load i32*, i32** %2
%22 = call i32 @fwrite_err(i8* %20, i32 4, i32 1, i32* %21)
%23 = load i64, i64* %3
ret i64 %23
}

LLVM IR (-O2):
define i64 @Write_MIDI_Track_Header(i32* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = icmp ne i32* %0, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @fputc_err(i8 signext 77, i32* %0)
%8 = tail call i32 @fputc_err(i8 signext 84, i32* %0)
%9 = tail call i32 @fputc_err(i8 signext 114, i32* %0)
%10 = tail call i32 @fputc_err(i8 signext 107, i32* %0)
%11 = tail call i64 @ftell_err(i32* %0)
%12 = call i32 @fwrite_err(i8* %3, i32 4, i32 1, i32* %0)
ret i64 %11
}