int mf_write_meta_event(delta_time, type, data, size)
unsigned long delta_time;
unsigned char *data, type;
unsigned long size;
{
  int i;
  WriteVarLen(delta_time);
  eputc(0xFF);
  eputc(type);
  WriteVarLen(size);
  for (i = 0; i < size; i++) {
    if (eputc(data[i]) != data[i])
      return (-1);
  }
  return (size);
}


x86 assembly (clang, -O0):
<mf_write_meta_event>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <WriteVarLen@plt>
mov    $0xff,%edi
mov    $0x0,%al
call   1040 <eputc@plt>
movzbl -0x11(%rbp),%edi
mov    $0x0,%al
call   1040 <eputc@plt>
mov    -0x28(%rbp),%rdi
mov    $0x0,%al
call   1030 <WriteVarLen@plt>
movl   $0x0,-0x2c(%rbp)
movslq -0x2c(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    11c2 <mf_write_meta_event+0xa2>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
mov    $0x0,%al
call   1040 <eputc@plt>
mov    -0x20(%rbp),%rcx
movslq -0x2c(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     11af <mf_write_meta_event+0x8f>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c9 <mf_write_meta_event+0xa9>
jmp    11b4 <mf_write_meta_event+0x94>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    116e <mf_write_meta_event+0x4e>
mov    -0x28(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mf_write_meta_event>:
push   %rbp
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%ebp
xor    %eax,%eax
call   1030 <WriteVarLen@plt>
mov    $0xff,%edi
xor    %eax,%eax
call   1040 <eputc@plt>
movzbl %bpl,%edi
xor    %eax,%eax
call   1040 <eputc@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <WriteVarLen@plt>
test   %r14,%r14
je     1184 <mf_write_meta_event+0x64>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movzbl (%rbx,%rbp,1),%edi
xor    %eax,%eax
call   1040 <eputc@plt>
movzbl (%rbx,%rbp,1),%ecx
cmp    %ecx,%eax
jne    117e <mf_write_meta_event+0x5e>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1160 <mf_write_meta_event+0x40>
jmp    1184 <mf_write_meta_event+0x64>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @mf_write_meta_event(i64 %0, i32 %1, i8* %2, i64 %3) {
%5 = alloca i32
%6 = alloca i64
%7 = alloca i8
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = trunc i32 %1 to i8
store i64 %0, i64* %6
store i8 %11, i8* %7
store i8* %2, i8** %8
store i64 %3, i64* %9
%12 = load i64, i64* %6
%13 = call i32 (i64, ...) bitcast (i32 (...)* @WriteVarLen to i32 (i64, ...)*)(i64 %12)
%14 = call i32 (i32, ...) bitcast (i32 (...)* @eputc to i32 (i32, ...)*)(i32 255)
%15 = load i8, i8* %7
%16 = zext i8 %15 to i32
%17 = call i32 (i32, ...) bitcast (i32 (...)* @eputc to i32 (i32, ...)*)(i32 %16)
%18 = load i64, i64* %9
%19 = call i32 (i64, ...) bitcast (i32 (...)* @WriteVarLen to i32 (i64, ...)*)(i64 %18)
store i32 0, i32* %10
br label %20
20: ; preds = %42, %4
%21 = load i32, i32* %10
%22 = sext i32 %21 to i64
%23 = load i64, i64* %9
%24 = icmp ult i64 %22, %23
br i1 %24, label %25, label %45
25: ; preds = %20
%26 = load i8*, i8** %8
%27 = load i32, i32* %10
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = call i32 (i32, ...) bitcast (i32 (...)* @eputc to i32 (i32, ...)*)(i32 %31)
%33 = load i8*, i8** %8
%34 = load i32, i32* %10
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = icmp ne i32 %32, %38
br i1 %39, label %40, label %41
40: ; preds = %25
store i32 -1, i32* %5
br label %48
41: ; preds = %25
br label %42
42: ; preds = %41
%43 = load i32, i32* %10
%44 = add nsw i32 %43, 1
store i32 %44, i32* %10
br label %20
45: ; preds = %20
%46 = load i64, i64* %9
%47 = trunc i64 %46 to i32
store i32 %47, i32* %5
br label %48
48: ; preds = %45, %40
%49 = load i32, i32* %5
ret i32 %49
}

LLVM IR (-O2):
define i32 @mf_write_meta_event(i64 %0, i32 %1, i8* nocapture %2, i64 %3) {
%5 = tail call i32 (i64, ...) bitcast (i32 (...)* @WriteVarLen to i32 (i64, ...)*)(i64 %0)
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @eputc to i32 (i32, ...)*)(i32 255)
%7 = and i32 %1, 255
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @eputc to i32 (i32, ...)*)(i32 %7)
%9 = tail call i32 (i64, ...) bitcast (i32 (...)* @WriteVarLen to i32 (i64, ...)*)(i64 %3)
%10 = icmp eq i64 %3, 0
br i1 %10, label %23, label %13
11: ; preds = %13
%12 = icmp eq i64 %22, %3
br i1 %12, label %23, label %13
13: ; preds = %4, %11
%14 = phi i64 [ %22, %11 ], [ 0, %4 ]
%15 = getelementptr inbounds i8, i8* %2, i64 %14
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = tail call i32 (i32, ...) bitcast (i32 (...)* @eputc to i32 (i32, ...)*)(i32 %17)
%19 = load i8, i8* %15
%20 = zext i8 %19 to i32
%21 = icmp eq i32 %18, %20
%22 = add nuw i64 %14, 1
br i1 %21, label %11, label %25
23: ; preds = %11, %4
%24 = trunc i64 %3 to i32
br label %25
25: ; preds = %13, %23
%26 = phi i32 [ %24, %23 ], [ -1, %13 ]
ret i32 %26
}