#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*/ alsa_close();
int /*<<< orphan*/ dsp_close();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout_close();
void sound_close(int outp) {
  switch (outp) {
  case 1:
    alsa_close();
    break;
  case 2:
    dsp_close();
    break;
  case 3:
    stdout_close();
    break;
  default:
    fprintf(stderr, "Unknown output method\n");
  }
}


x86 assembly (clang, -O0):
<sound_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1,%eax
je     1181 <sound_close+0x41>
jmp    115f <sound_close+0x1f>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     118d <sound_close+0x4d>
jmp    1170 <sound_close+0x30>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
je     1199 <sound_close+0x59>
jmp    11a5 <sound_close+0x65>
mov    $0x0,%al
call   1030 <alsa_close@plt>
jmp    11ba <sound_close+0x7a>
mov    $0x0,%al
call   1060 <dsp_close@plt>
jmp    11ba <sound_close+0x7a>
mov    $0x0,%al
call   1040 <stdout_close@plt>
jmp    11ba <sound_close+0x7a>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
lea    0xe4b(%rip),%rsi
call   1050 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sound_close>:
cmp    $0x3,%edi
je     1156 <sound_close+0x16>
cmp    $0x2,%edi
je     115d <sound_close+0x1d>
cmp    $0x1,%edi
jne    1164 <sound_close+0x24>
xor    %eax,%eax
jmp    1030 <alsa_close@plt>
xor    %eax,%eax
jmp    1040 <stdout_close@plt>
xor    %eax,%eax
jmp    1060 <dsp_close@plt>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
lea    0xe8c(%rip),%rsi
jmp    1050 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"Unknown output method\0A\00"
define void @sound_close(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %10 [
i32 1, label %4
i32 2, label %6
i32 3, label %8
]
4: ; preds = %1
%5 = call i32 (...) @alsa_close()
br label %13
6: ; preds = %1
%7 = call i32 (...) @dsp_close()
br label %13
8: ; preds = %1
%9 = call i32 (...) @stdout_close()
br label %13
10: ; preds = %1
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"Unknown output method\0A\00"
define void @sound_close(i32 %0) {
switch i32 %0, label %8 [
i32 1, label %2
i32 2, label %4
i32 3, label %6
]
2: ; preds = %1
%3 = tail call i32 (...) @alsa_close()
br label %11
4: ; preds = %1
%5 = tail call i32 (...) @dsp_close()
br label %11
6: ; preds = %1
%7 = tail call i32 (...) @stdout_close()
br label %11
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %8, %6, %4, %2
ret void
}