#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 */
#define EBUSY 132
#define ENODEV 131
#define ENOENT 130
#define ENOSPC 129
#define ENXIO 128
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void describe_error(void) {
  switch (errno) {
  case ENODEV:
    fprintf(stderr, "The device file was found in /dev but\n"
                    "OSS is not loaded. You need to load it by executing\n"
                    "the soundon command.\n");
    break;
  case ENXIO:
    fprintf(stderr, "There are no sound devices available.\n"
                    "The most likely reason is that the device you have\n"
                    "is malfunctioning or it's not supported by OSS.\n"
                    "\n"
                    "NOTE! It may be necessary to reboot the system after "
                    "installing OSS\n");
    break;
  case ENOSPC:
    fprintf(stderr, "Your system cannot allocate memory for the device\n"
                    "buffers. Reboot your machine and try again.\n");
    break;
  case ENOENT:
    fprintf(
        stderr,
        "The device file is missing from /dev.\n"
        "Perhaps you have not installed and started Open Sound System yet\n");
    break;
  case EBUSY:
    fprintf(stderr, "The device is busy. There is some other application\n"
                    "using it.\n");
  default:;
  }
}


x86 assembly (clang, -O0):
<describe_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x8(%rbp)
sub    $0x4,%eax
ja     11c4 <describe_error+0xb4>
mov    -0x8(%rbp),%rax
lea    0xec2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
lea    0xebd(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11c9 <describe_error+0xb9>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
lea    0xf13(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11c9 <describe_error+0xb9>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
lea    0xfc8(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11c9 <describe_error+0xb9>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    0x100d(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11c9 <describe_error+0xb9>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
lea    0x105b(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11c9 <describe_error+0xb9>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<describe_error>:
mov    0x2ec1(%rip),%rax
mov    (%rax),%eax
add    $0xffffff80,%eax
cmp    $0x4,%eax
ja     113f <describe_error+0x2f>
cltq
lea    0x111e(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fprintf@plt>
ret

LLVM IR (-O0):
@errno = global i32 0
@stderr = global i32 0
@.str = [112 x i8] c"The device file was found in /dev but\0AOSS is not loaded. You need to load it by executing\0Athe soundon command.\0A\00"
@.str.1 = [207 x i8] c"There are no sound devices available.\0AThe most likely reason is that the device you have\0Ais malfunctioning or it's not supported by OSS.\0A\0ANOTE! It may be necessary to reboot the system after installing OSS\0A\00"
@.str.2 = [95 x i8] c"Your system cannot allocate memory for the device\0Abuffers. Reboot your machine and try again.\0A\00"
@.str.3 = [104 x i8] c"The device file is missing from /dev.\0APerhaps you have not installed and started Open Sound System yet\0A\00"
@.str.4 = [63 x i8] c"The device is busy. There is some other application\0Ausing it.\0A\00"
define void @describe_error() {
%1 = load i32, i32* @errno
switch i32 %1, label %17 [
i32 131, label %2
i32 128, label %5
i32 129, label %8
i32 130, label %11
i32 132, label %14
]
2: ; preds = %0
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([112 x i8], [112 x i8]* @.str, i64 0, i64 0))
br label %18
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([207 x i8], [207 x i8]* @.str.1, i64 0, i64 0))
br label %18
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str.2, i64 0, i64 0))
br label %18
11: ; preds = %0
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str.3, i64 0, i64 0))
br label %18
14: ; preds = %0
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.4, i64 0, i64 0))
br label %17
17: ; preds = %0, %14
br label %18
18: ; preds = %17, %11, %8, %5, %2
ret void
}

LLVM IR (-O2):
@errno = global i32 0
@stderr = global i32 0
@.str = [112 x i8] c"The device file was found in /dev but\0AOSS is not loaded. You need to load it by executing\0Athe soundon command.\0A\00"
@.str.1 = [207 x i8] c"There are no sound devices available.\0AThe most likely reason is that the device you have\0Ais malfunctioning or it's not supported by OSS.\0A\0ANOTE! It may be necessary to reboot the system after installing OSS\0A\00"
@.str.2 = [95 x i8] c"Your system cannot allocate memory for the device\0Abuffers. Reboot your machine and try again.\0A\00"
@.str.3 = [104 x i8] c"The device file is missing from /dev.\0APerhaps you have not installed and started Open Sound System yet\0A\00"
@.str.4 = [63 x i8] c"The device is busy. There is some other application\0Ausing it.\0A\00"
@reltable.describe_error = [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([207 x i8]* @.str.1 to i64), i64 ptrtoint ([5 x i32]* @reltable.describe_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([95 x i8]* @.str.2 to i64), i64 ptrtoint ([5 x i32]* @reltable.describe_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([104 x i8]* @.str.3 to i64), i64 ptrtoint ([5 x i32]* @reltable.describe_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([112 x i8]* @.str to i64), i64 ptrtoint ([5 x i32]* @reltable.describe_error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([63 x i8]* @.str.4 to i64), i64 ptrtoint ([5 x i32]* @reltable.describe_error to i64)) to i32)]
define void @describe_error() {
%1 = load i32, i32* @errno
%2 = add i32 %1, -128
%3 = icmp ult i32 %2, 5
br i1 %3, label %4, label %10
4: ; preds = %0
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([5 x i32]* @reltable.describe_error to i8*), i64 %6)
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* %7)
br label %10
10: ; preds = %0, %4
ret void
}