#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*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           unsigned long, char const *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strerror(int);
void WM_ERROR(const char *func, unsigned long int lne, int wmerno,
              const char *wmfor, int error) {
  static const char *errors[] = {"Unable to obtain memory\0",
                                 "Unable to stat\0",
                                 "Unable to load\0",
                                 "Unable to open\0",
                                 "Unable to read\0",
                                 "Invalid or Unsuported file format\0",
                                 "File corrupt\0",
                                 "Library not Initialized\0",
                                 "Invalid argument\0"};
  if (wmfor != NULL) {
    if (error != 0) {
      fprintf(stderr, "\rlibWildMidi(%s:%lu): ERROR %s %s (%s)\n", func, lne,
              errors[wmerno], wmfor, strerror(error));
    } else {
      fprintf(stderr, "\rlibWildMidi(%s:%lu): ERROR %s %s\n", func, lne,
              errors[wmerno], wmfor);
    }
  } else {
    if (error != 0) {
      fprintf(stderr, "\rlibWildMidi(%s:%lu): ERROR %s (%s)\n", func, lne,
              errors[wmerno], strerror(error));
    } else {
      fprintf(stderr, "\rlibWildMidi(%s:%lu): ERROR %s\n", func, lne,
              errors[wmerno]);
    }
  }
}


x86 assembly (clang, -O0):
<WM_ERROR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11f2 <WM_ERROR+0xd2>
cmpl   $0x0,-0x24(%rbp)
je     11bb <WM_ERROR+0x9b>
mov    0x2e86(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
movslq -0x14(%rbp),%rcx
lea    0x2ec6(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%edi
call   1040 <strerror@plt>
mov    -0x4c(%rbp),%edi
mov    -0x48(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x38(%rbp),%r8
mov    -0x30(%rbp),%r9
lea    0xf09(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11ed <WM_ERROR+0xcd>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rsi
lea    0x2e69(%rip),%rax
mov    (%rax,%rsi,8),%r8
mov    -0x20(%rbp),%r9
lea    0xef7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    128b <WM_ERROR+0x16b>
cmpl   $0x0,-0x24(%rbp)
je     1258 <WM_ERROR+0x138>
mov    0x2ddd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x60(%rbp)
movslq -0x14(%rbp),%rcx
lea    0x2e1d(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x58(%rbp)
mov    -0x24(%rbp),%edi
call   1040 <strerror@plt>
mov    -0x6c(%rbp),%edi
mov    -0x68(%rbp),%rdx
mov    -0x60(%rbp),%rcx
mov    -0x58(%rbp),%r8
mov    %eax,%r9d
lea    0xeb4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1286 <WM_ERROR+0x166>
mov    0x2d81(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rsi
lea    0x2dcc(%rip),%rax
mov    (%rax,%rsi,8),%r8
lea    0xea6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    128b <WM_ERROR+0x16b>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WM_ERROR>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%rbx
mov    %rsi,%r14
mov    %rdi,%r12
mov    0x2ea4(%rip),%rax
mov    (%rax),%ebp
movslq %edx,%rax
lea    0x2c88(%rip),%rcx
mov    (%rcx,%rax,8),%r15
test   %rbx,%rbx
je     118a <WM_ERROR+0x6a>
test   %r8d,%r8d
je     11bf <WM_ERROR+0x9f>
mov    %r8d,%edi
call   1040 <strerror@plt>
mov    %eax,(%rsp)
lea    0xf4d(%rip),%rsi
mov    %ebp,%edi
mov    %r12,%rdx
mov    %r14,%rcx
mov    %r15,%r8
mov    %rbx,%r9
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
test   %r8d,%r8d
je     11e7 <WM_ERROR+0xc7>
mov    %r8d,%edi
call   1040 <strerror@plt>
lea    0xf62(%rip),%rsi
mov    %ebp,%edi
mov    %r12,%rdx
mov    %r14,%rcx
mov    %r15,%r8
mov    %eax,%r9d
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>
lea    0xf17(%rip),%rsi
mov    %ebp,%edi
mov    %r12,%rdx
mov    %r14,%rcx
mov    %r15,%r8
mov    %rbx,%r9
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>
lea    0xf37(%rip),%rsi
mov    %ebp,%edi
mov    %r12,%rdx
mov    %r14,%rcx
mov    %r15,%r8
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@WM_ERROR.errors = internal global [9 x i8*] [i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i32 0, i32 0)]
@.str = [25 x i8] c"Unable to obtain memory\00\00"
@.str.1 = [16 x i8] c"Unable to stat\00\00"
@.str.2 = [16 x i8] c"Unable to load\00\00"
@.str.3 = [16 x i8] c"Unable to open\00\00"
@.str.4 = [16 x i8] c"Unable to read\00\00"
@.str.5 = [35 x i8] c"Invalid or Unsuported file format\00\00"
@.str.6 = [14 x i8] c"File corrupt\00\00"
@.str.7 = [25 x i8] c"Library not Initialized\00\00"
@.str.8 = [18 x i8] c"Invalid argument\00\00"
@stderr = global i32 0
@.str.9 = [40 x i8] c"\0DlibWildMidi(%s:%lu): ERROR %s %s (%s)\0A\00"
@.str.10 = [35 x i8] c"\0DlibWildMidi(%s:%lu): ERROR %s %s\0A\00"
@.str.11 = [37 x i8] c"\0DlibWildMidi(%s:%lu): ERROR %s (%s)\0A\00"
@.str.12 = [32 x i8] c"\0DlibWildMidi(%s:%lu): ERROR %s\0A\00"
define void @WM_ERROR(i8* %0, i64 %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %6
store i64 %1, i64* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i8*, i8** %9
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %39
13: ; preds = %5
%14 = load i32, i32* %10
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %28
16: ; preds = %13
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %6
%19 = load i64, i64* %7
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [9 x i8*], [9 x i8*]* @WM_ERROR.errors, i64 0, i64 %21
%23 = load i8*, i8** %22
%24 = load i8*, i8** %9
%25 = load i32, i32* %10
%26 = call i32 @strerror(i32 %25)
%27 = call i32 (i32, i8*, i8*, i64, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0), i8* %18, i64 %19, i8* %23, i8* %24, i32 %26)
br label %38
28: ; preds = %13
%29 = load i32, i32* @stderr
%30 = load i8*, i8** %6
%31 = load i64, i64* %7
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [9 x i8*], [9 x i8*]* @WM_ERROR.errors, i64 0, i64 %33
%35 = load i8*, i8** %34
%36 = load i8*, i8** %9
%37 = call i32 (i32, i8*, i8*, i64, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0), i8* %30, i64 %31, i8* %35, i8* %36)
br label %38
38: ; preds = %28, %16
br label %63
39: ; preds = %5
%40 = load i32, i32* %10
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %53
42: ; preds = %39
%43 = load i32, i32* @stderr
%44 = load i8*, i8** %6
%45 = load i64, i64* %7
%46 = load i32, i32* %8
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [9 x i8*], [9 x i8*]* @WM_ERROR.errors, i64 0, i64 %47
%49 = load i8*, i8** %48
%50 = load i32, i32* %10
%51 = call i32 @strerror(i32 %50)
%52 = call i32 (i32, i8*, i8*, i64, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0), i8* %44, i64 %45, i8* %49, i32 %51)
br label %62
53: ; preds = %39
%54 = load i32, i32* @stderr
%55 = load i8*, i8** %6
%56 = load i64, i64* %7
%57 = load i32, i32* %8
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [9 x i8*], [9 x i8*]* @WM_ERROR.errors, i64 0, i64 %58
%60 = load i8*, i8** %59
%61 = call i32 (i32, i8*, i8*, i64, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0), i8* %55, i64 %56, i8* %60)
br label %62
62: ; preds = %53, %42
br label %63
63: ; preds = %62, %38
ret void
}

LLVM IR (-O2):
@WM_ERROR.errors = internal unnamed_addr constant [9 x i8*] [i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i32 0, i32 0)]
@.str = [25 x i8] c"Unable to obtain memory\00\00"
@.str.1 = [16 x i8] c"Unable to stat\00\00"
@.str.2 = [16 x i8] c"Unable to load\00\00"
@.str.3 = [16 x i8] c"Unable to open\00\00"
@.str.4 = [16 x i8] c"Unable to read\00\00"
@.str.5 = [35 x i8] c"Invalid or Unsuported file format\00\00"
@.str.6 = [14 x i8] c"File corrupt\00\00"
@.str.7 = [25 x i8] c"Library not Initialized\00\00"
@.str.8 = [18 x i8] c"Invalid argument\00\00"
@stderr = global i32 0
@.str.9 = [40 x i8] c"\0DlibWildMidi(%s:%lu): ERROR %s %s (%s)\0A\00"
@.str.10 = [35 x i8] c"\0DlibWildMidi(%s:%lu): ERROR %s %s\0A\00"
@.str.11 = [37 x i8] c"\0DlibWildMidi(%s:%lu): ERROR %s (%s)\0A\00"
@.str.12 = [32 x i8] c"\0DlibWildMidi(%s:%lu): ERROR %s\0A\00"
define void @WM_ERROR(i8* %0, i64 %1, i32 %2, i8* %3, i32 %4) {
%6 = icmp eq i8* %3, null
%7 = icmp eq i32 %4, 0
%8 = load i32, i32* @stderr
%9 = sext i32 %2 to i64
%10 = getelementptr inbounds [9 x i8*], [9 x i8*]* @WM_ERROR.errors, i64 0, i64 %9
%11 = load i8*, i8** %10
br i1 %6, label %18, label %12
12: ; preds = %5
br i1 %7, label %16, label %13
13: ; preds = %12
%14 = tail call i32 @strerror(i32 %4)
%15 = tail call i32 (i32, i8*, i8*, i64, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.9, i64 0, i64 0), i8* %0, i64 %1, i8* %11, i8* %3, i32 %14)
br label %24
16: ; preds = %12
%17 = tail call i32 (i32, i8*, i8*, i64, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0), i8* %0, i64 %1, i8* %11, i8* %3)
br label %24
18: ; preds = %5
br i1 %7, label %22, label %19
19: ; preds = %18
%20 = tail call i32 @strerror(i32 %4)
%21 = tail call i32 (i32, i8*, i8*, i64, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.11, i64 0, i64 0), i8* %0, i64 %1, i8* %11, i32 %20)
br label %24
22: ; preds = %18
%23 = tail call i32 (i32, i8*, i8*, i64, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.12, i64 0, i64 0), i8* %0, i64 %1, i8* %11)
br label %24
24: ; preds = %19, %22, %13, %16
ret void
}