#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 */

/* Variables and functions */
int /*<<< orphan*/ close_note(int, int);
scalar_t__ cut_beginning();
int /*<<< orphan*/ mf_write_midi_event(int, int, char *, int);
void copy_noteoff(int chan, int c1, int c2) {
  char data[2];
  close_note(chan, c1);
  if (cut_beginning())
    return;
  data[0] = (char)c1;
  data[1] = (char)c2;
  mf_write_midi_event(0x80, chan, data, 2);
}


x86 assembly (clang, -O0):
<copy_noteoff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <close_note@plt>
mov    $0x0,%al
call   1050 <cut_beginning@plt>
cmp    $0x0,%rax
je     1162 <copy_noteoff+0x32>
jmp    1184 <copy_noteoff+0x54>
mov    -0x8(%rbp),%eax
mov    %al,-0xe(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,-0xd(%rbp)
mov    -0x4(%rbp),%esi
lea    -0xe(%rbp),%rdx
mov    $0x80,%edi
mov    $0x2,%ecx
call   1030 <mf_write_midi_event@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_noteoff>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
call   1040 <close_note@plt>
xor    %eax,%eax
call   1050 <cut_beginning@plt>
test   %rax,%rax
jne    1170 <copy_noteoff+0x40>
mov    %bpl,0xe(%rsp)
mov    %r14b,0xf(%rsp)
lea    0xe(%rsp),%rdx
mov    $0x80,%edi
mov    %ebx,%esi
mov    $0x2,%ecx
call   1030 <mf_write_midi_event@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @copy_noteoff(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [2 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = call i32 @close_note(i32 %8, i32 %9)
%11 = call i64 (...) @cut_beginning()
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %3
br label %24
14: ; preds = %3
%15 = load i32, i32* %5
%16 = trunc i32 %15 to i8
%17 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
store i8 %16, i8* %17
%18 = load i32, i32* %6
%19 = trunc i32 %18 to i8
%20 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 1
store i8 %19, i8* %20
%21 = load i32, i32* %4
%22 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%23 = call i32 @mf_write_midi_event(i32 128, i32 %21, i8* %22, i32 2)
br label %24
24: ; preds = %14, %13
ret void
}

LLVM IR (-O2):
define void @copy_noteoff(i32 %0, i32 %1, i32 %2) {
%4 = alloca [2 x i8]
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%6 = tail call i32 @close_note(i32 %0, i32 %1)
%7 = tail call i64 (...) @cut_beginning()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %3
%10 = trunc i32 %1 to i8
store i8 %10, i8* %5
%11 = trunc i32 %2 to i8
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 1
store i8 %11, i8* %12
%13 = call i32 @mf_write_midi_event(i32 128, i32 %0, i8* %5, i32 2)
br label %14
14: ; preds = %3, %9
ret void
}