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


x86 assembly (clang, -O0):
<mf_write_meta_event>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <WriteVarLen@plt>
mov    $0xff,%edi
mov    $0x0,%al
call   1040 <eputc@plt>
mov    -0x14(%rbp),%edi
mov    $0x0,%al
call   1040 <eputc@plt>
movslq -0x24(%rbp),%rdi
mov    $0x0,%al
call   1030 <WriteVarLen@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11c7 <mf_write_meta_event+0xa7>
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
and    $0xff,%edi
mov    $0x0,%al
call   1040 <eputc@plt>
mov    -0x20(%rbp),%rcx
movslq -0x28(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
and    $0xff,%ecx
cmp    %ecx,%eax
je     11b4 <mf_write_meta_event+0x94>
movl   $0xffffffff,-0x4(%rbp)
jmp    11cd <mf_write_meta_event+0xad>
jmp    11b9 <mf_write_meta_event+0x99>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1169 <mf_write_meta_event+0x49>
mov    -0x24(%rbp),%eax
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   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %esi,%ebp
xor    %eax,%eax
call   1030 <WriteVarLen@plt>
mov    $0xff,%edi
xor    %eax,%eax
call   1040 <eputc@plt>
mov    %ebp,%edi
xor    %eax,%eax
call   1040 <eputc@plt>
movslq %r14d,%rbp
mov    %rbp,%rdi
xor    %eax,%eax
call   1030 <WriteVarLen@plt>
test   %ebp,%ebp
jle    1194 <mf_write_meta_event+0x74>
mov    %r14d,%r15d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
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    118e <mf_write_meta_event+0x6e>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1170 <mf_write_meta_event+0x50>
jmp    1194 <mf_write_meta_event+0x74>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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