#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*/ event_init(int, char **, char **);
int /*<<< orphan*/ free_abbreviations();
int /*<<< orphan*/ init();
int /*<<< orphan*/ init_abbreviations();
int /*<<< orphan*/ parsefile(char *);
int convert(const char *name) {
  init();
  char *names[2];
  names[0] = "abc2midi";
  names[1] = name;
  char *filename;
  event_init(2, names, &filename);
  init_abbreviations();
  parsefile(filename);
  free_abbreviations();
  return 0;
}


x86 assembly (clang, -O0):
<convert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <init@plt>
lea    0xe96(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rsi
mov    $0x2,%edi
lea    -0x28(%rbp),%rdx
call   1060 <event_init@plt>
mov    $0x0,%al
call   1070 <init_abbreviations@plt>
mov    -0x28(%rbp),%rdi
call   1050 <parsefile@plt>
mov    $0x0,%al
call   1030 <free_abbreviations@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <init@plt>
lea    0xe9a(%rip),%rax
mov    %rax,0x10(%rsp)
mov    %rbx,0x18(%rsp)
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    $0x2,%edi
call   1060 <event_init@plt>
xor    %eax,%eax
call   1070 <init_abbreviations@plt>
mov    0x8(%rsp),%rdi
call   1050 <parsefile@plt>
xor    %eax,%eax
call   1030 <free_abbreviations@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"abc2midi\00"
define i32 @convert(i8* %0) {
%2 = alloca i8*
%3 = alloca [2 x i8*]
%4 = alloca i8*
store i8* %0, i8** %2
%5 = call i32 (...) @init()
%6 = getelementptr inbounds [2 x i8*], [2 x i8*]* %3, i64 0, i64 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = load i8*, i8** %2
%8 = getelementptr inbounds [2 x i8*], [2 x i8*]* %3, i64 0, i64 1
store i8* %7, i8** %8
%9 = getelementptr inbounds [2 x i8*], [2 x i8*]* %3, i64 0, i64 0
%10 = call i32 @event_init(i32 2, i8** %9, i8** %4)
%11 = call i32 (...) @init_abbreviations()
%12 = load i8*, i8** %4
%13 = call i32 @parsefile(i8* %12)
%14 = call i32 (...) @free_abbreviations()
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"abc2midi\00"
define i32 @convert(i8* %0) {
%2 = alloca [2 x i8*]
%3 = alloca i8*
%4 = tail call i32 (...) @init()
%5 = bitcast [2 x i8*]* %2 to i8*
%6 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 1
store i8* %0, i8** %7
%8 = bitcast i8** %3 to i8*
%9 = call i32 @event_init(i32 2, i8** %6, i8** %3)
%10 = call i32 (...) @init_abbreviations()
%11 = load i8*, i8** %3
%12 = call i32 @parsefile(i8* %11)
%13 = call i32 (...) @free_abbreviations()
ret i32 0
}