#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*/ system(char *);
void select_mode(char mmsel, char mval) {
  switch (mmsel) {
  case 2:
    if (mval == 0) {
      system("amixer -c 0 set \"External Speaker\" on > /dev/null");
      system("amixer -c 0 set \"Headphone\" off > /dev/null");
    } else {
      system("amixer -c 0 set \"External Speaker\" off > /dev/null");
      system("amixer -c 0 set \"Headphone\" on > /dev/null");
    }
    break;
  case 4:
    if (mval == 0) {
      system("amixer -c 0 sset \"RADC input Mixer MIC1 boost\" unmute > "
             "/dev/null");
      system("amixer -c 0 sset \"LADC input Mixer MIC1 boost\" unmute > "
             "/dev/null");
      system(
          "amixer -c 0 sset \"RADC input Mixer MIC2 boost\" mute > /dev/null");
      system(
          "amixer -c 0 sset \"LADC input Mixer MIC2 boost\" mute > /dev/null");
      system("amixer -c 0 sset \"ADCL Mux\" ADC > /dev/null");
      system("amixer -c 0 sset \"ADCR Mux\" ADC > /dev/null");
      system("amixer -c 0 sset \"AIF1 AD0L Mixer ADCL\" ADC > /dev/null");
      system("amixer -c 0 sset \"AIF1 AD0R Mixer ADCR\" ADC > /dev/null");
    } else {
      system("amixer -c 0 sset \"RADC input Mixer MIC2 boost\" unmute > "
             "/dev/null");
      system("amixer -c 0 sset \"LADC input Mixer MIC2 boost\" unmute > "
             "/dev/null");
      system(
          "amixer -c 0 sset \"RADC input Mixer MIC1 boost\" mute > /dev/null");
      system(
          "amixer -c 0 sset \"LADC input Mixer MIC1 boost\" mute > /dev/null");
      system("amixer -c 0 sset \"ADCL Mux\" ADC > /dev/null");
      system("amixer -c 0 sset \"ADCR Mux\" ADC > /dev/null");
      system("amixer -c 0 sset \"AIF1 AD0L Mixer ADCL\" ADC > /dev/null");
      system("amixer -c 0 sset \"AIF1 AD0R Mixer ADCR\" ADC > /dev/null");
    }
    break;
  }
}


x86 assembly (clang, -O0):
<select_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x2,%eax
je     114a <select_mode+0x3a>
jmp    1139 <select_mode+0x29>
mov    -0x8(%rbp),%eax
sub    $0x4,%eax
je     1191 <select_mode+0x81>
jmp    1268 <select_mode+0x158>
movsbl -0x2(%rbp),%eax
cmp    $0x0,%eax
jne    1174 <select_mode+0x64>
lea    0xea2(%rip),%rdi
call   1030 <system@plt>
lea    0xec8(%rip),%rdi
call   1030 <system@plt>
jmp    118c <select_mode+0x7c>
lea    0xee3(%rip),%rdi
call   1030 <system@plt>
lea    0xf0a(%rip),%rdi
call   1030 <system@plt>
jmp    1268 <select_mode+0x158>
movsbl -0x2(%rbp),%eax
cmp    $0x0,%eax
jne    1203 <select_mode+0xf3>
lea    0xf17(%rip),%rdi
call   1030 <system@plt>
lea    0xf4d(%rip),%rdi
call   1030 <system@plt>
lea    0xf83(%rip),%rdi
call   1030 <system@plt>
lea    0xfb7(%rip),%rdi
call   1030 <system@plt>
lea    0xfeb(%rip),%rdi
call   1030 <system@plt>
lea    0x100b(%rip),%rdi
call   1030 <system@plt>
lea    0x102b(%rip),%rdi
call   1030 <system@plt>
lea    0x1057(%rip),%rdi
call   1030 <system@plt>
jmp    1263 <select_mode+0x153>
lea    0x107e(%rip),%rdi
call   1030 <system@plt>
lea    0x10b4(%rip),%rdi
call   1030 <system@plt>
lea    0x10ea(%rip),%rdi
call   1030 <system@plt>
lea    0x111e(%rip),%rdi
call   1030 <system@plt>
lea    0xf86(%rip),%rdi
call   1030 <system@plt>
lea    0xfa6(%rip),%rdi
call   1030 <system@plt>
lea    0xfc6(%rip),%rdi
call   1030 <system@plt>
lea    0xff2(%rip),%rdi
call   1030 <system@plt>
jmp    1268 <select_mode+0x158>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<select_mode>:
push   %rbx
cmp    $0x4,%edi
je     1147 <select_mode+0x37>
cmp    $0x2,%edi
jne    1179 <select_mode+0x69>
test   %sil,%sil
lea    0xedb(%rip),%rax
lea    0xf32(%rip),%rdi
cmove  %rax,%rdi
lea    0xefb(%rip),%rax
lea    0xf53(%rip),%rbx
cmove  %rax,%rbx
jmp    11d1 <select_mode+0xc1>
test   %sil,%sil
je     117b <select_mode+0x6b>
lea    0x1135(%rip),%rdi
call   1030 <system@plt>
lea    0x116b(%rip),%rdi
call   1030 <system@plt>
lea    0x11a1(%rip),%rdi
call   1030 <system@plt>
lea    0x11d5(%rip),%rdi
jmp    11a6 <select_mode+0x96>
pop    %rbx
ret
lea    0xf3a(%rip),%rdi
call   1030 <system@plt>
lea    0xf70(%rip),%rdi
call   1030 <system@plt>
lea    0xfa6(%rip),%rdi
call   1030 <system@plt>
lea    0xfda(%rip),%rdi
call   1030 <system@plt>
lea    0x100e(%rip),%rdi
call   1030 <system@plt>
lea    0x102e(%rip),%rdi
call   1030 <system@plt>
lea    0x1086(%rip),%rbx
lea    0x1047(%rip),%rdi
call   1030 <system@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <system@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"amixer -c 0 set \22External Speaker\22 on > /dev/null\00"
@.str.1 = [44 x i8] c"amixer -c 0 set \22Headphone\22 off > /dev/null\00"
@.str.2 = [51 x i8] c"amixer -c 0 set \22External Speaker\22 off > /dev/null\00"
@.str.3 = [43 x i8] c"amixer -c 0 set \22Headphone\22 on > /dev/null\00"
@.str.4 = [66 x i8] c"amixer -c 0 sset \22RADC input Mixer MIC1 boost\22 unmute > /dev/null\00"
@.str.5 = [66 x i8] c"amixer -c 0 sset \22LADC input Mixer MIC1 boost\22 unmute > /dev/null\00"
@.str.6 = [64 x i8] c"amixer -c 0 sset \22RADC input Mixer MIC2 boost\22 mute > /dev/null\00"
@.str.7 = [64 x i8] c"amixer -c 0 sset \22LADC input Mixer MIC2 boost\22 mute > /dev/null\00"
@.str.8 = [44 x i8] c"amixer -c 0 sset \22ADCL Mux\22 ADC > /dev/null\00"
@.str.9 = [44 x i8] c"amixer -c 0 sset \22ADCR Mux\22 ADC > /dev/null\00"
@.str.10 = [56 x i8] c"amixer -c 0 sset \22AIF1 AD0L Mixer ADCL\22 ADC > /dev/null\00"
@.str.11 = [56 x i8] c"amixer -c 0 sset \22AIF1 AD0R Mixer ADCR\22 ADC > /dev/null\00"
@.str.12 = [66 x i8] c"amixer -c 0 sset \22RADC input Mixer MIC2 boost\22 unmute > /dev/null\00"
@.str.13 = [66 x i8] c"amixer -c 0 sset \22LADC input Mixer MIC2 boost\22 unmute > /dev/null\00"
@.str.14 = [64 x i8] c"amixer -c 0 sset \22RADC input Mixer MIC1 boost\22 mute > /dev/null\00"
@.str.15 = [64 x i8] c"amixer -c 0 sset \22LADC input Mixer MIC1 boost\22 mute > /dev/null\00"
define void @select_mode(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
switch i32 %6, label %41 [
i32 2, label %7
i32 4, label %18
]
7: ; preds = %2
%8 = load i8, i8* %4
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = call i32 @system(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @system(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
br label %17
14: ; preds = %7
%15 = call i32 @system(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @system(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
br label %17
17: ; preds = %14, %11
br label %41
18: ; preds = %2
%19 = load i8, i8* %4
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %31
22: ; preds = %18
%23 = call i32 @system(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.4, i64 0, i64 0))
%24 = call i32 @system(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.5, i64 0, i64 0))
%25 = call i32 @system(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.6, i64 0, i64 0))
%26 = call i32 @system(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.7, i64 0, i64 0))
%27 = call i32 @system(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0))
%28 = call i32 @system(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.9, i64 0, i64 0))
%29 = call i32 @system(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.10, i64 0, i64 0))
%30 = call i32 @system(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.11, i64 0, i64 0))
br label %40
31: ; preds = %18
%32 = call i32 @system(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.12, i64 0, i64 0))
%33 = call i32 @system(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.13, i64 0, i64 0))
%34 = call i32 @system(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.14, i64 0, i64 0))
%35 = call i32 @system(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.15, i64 0, i64 0))
%36 = call i32 @system(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0))
%37 = call i32 @system(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.9, i64 0, i64 0))
%38 = call i32 @system(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.10, i64 0, i64 0))
%39 = call i32 @system(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.11, i64 0, i64 0))
br label %40
40: ; preds = %31, %22
br label %41
41: ; preds = %2, %40, %17
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"amixer -c 0 set \22External Speaker\22 on > /dev/null\00"
@.str.1 = [44 x i8] c"amixer -c 0 set \22Headphone\22 off > /dev/null\00"
@.str.2 = [51 x i8] c"amixer -c 0 set \22External Speaker\22 off > /dev/null\00"
@.str.3 = [43 x i8] c"amixer -c 0 set \22Headphone\22 on > /dev/null\00"
@.str.4 = [66 x i8] c"amixer -c 0 sset \22RADC input Mixer MIC1 boost\22 unmute > /dev/null\00"
@.str.5 = [66 x i8] c"amixer -c 0 sset \22LADC input Mixer MIC1 boost\22 unmute > /dev/null\00"
@.str.6 = [64 x i8] c"amixer -c 0 sset \22RADC input Mixer MIC2 boost\22 mute > /dev/null\00"
@.str.7 = [64 x i8] c"amixer -c 0 sset \22LADC input Mixer MIC2 boost\22 mute > /dev/null\00"
@.str.8 = [44 x i8] c"amixer -c 0 sset \22ADCL Mux\22 ADC > /dev/null\00"
@.str.9 = [44 x i8] c"amixer -c 0 sset \22ADCR Mux\22 ADC > /dev/null\00"
@.str.10 = [56 x i8] c"amixer -c 0 sset \22AIF1 AD0L Mixer ADCL\22 ADC > /dev/null\00"
@.str.11 = [56 x i8] c"amixer -c 0 sset \22AIF1 AD0R Mixer ADCR\22 ADC > /dev/null\00"
@.str.12 = [66 x i8] c"amixer -c 0 sset \22RADC input Mixer MIC2 boost\22 unmute > /dev/null\00"
@.str.13 = [66 x i8] c"amixer -c 0 sset \22LADC input Mixer MIC2 boost\22 unmute > /dev/null\00"
@.str.14 = [64 x i8] c"amixer -c 0 sset \22RADC input Mixer MIC1 boost\22 mute > /dev/null\00"
@.str.15 = [64 x i8] c"amixer -c 0 sset \22LADC input Mixer MIC1 boost\22 mute > /dev/null\00"
define void @select_mode(i8 signext %0, i8 signext %1) {
%3 = sext i8 %0 to i32
switch i32 %3, label %29 [
i32 2, label %4
i32 4, label %8
]
4: ; preds = %2
%5 = icmp eq i8 %1, 0
%6 = select i1 %5, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0)
%7 = select i1 %5, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0)
br label %24
8: ; preds = %2
%9 = icmp eq i8 %1, 0
br i1 %9, label %10, label %17
10: ; preds = %8
%11 = tail call i32 @system(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.4, i64 0, i64 0))
%12 = tail call i32 @system(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.5, i64 0, i64 0))
%13 = tail call i32 @system(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.6, i64 0, i64 0))
%14 = tail call i32 @system(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.7, i64 0, i64 0))
%15 = tail call i32 @system(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0))
%16 = tail call i32 @system(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.9, i64 0, i64 0))
br label %24
17: ; preds = %8
%18 = tail call i32 @system(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.12, i64 0, i64 0))
%19 = tail call i32 @system(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.13, i64 0, i64 0))
%20 = tail call i32 @system(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.14, i64 0, i64 0))
%21 = tail call i32 @system(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.15, i64 0, i64 0))
%22 = tail call i32 @system(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0))
%23 = tail call i32 @system(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.9, i64 0, i64 0))
br label %24
24: ; preds = %4, %17, %10
%25 = phi i8* [ getelementptr inbounds ([56 x i8], [56 x i8]* @.str.10, i64 0, i64 0), %10 ], [ getelementptr inbounds ([56 x i8], [56 x i8]* @.str.10, i64 0, i64 0), %17 ], [ %6, %4 ]
%26 = phi i8* [ getelementptr inbounds ([56 x i8], [56 x i8]* @.str.11, i64 0, i64 0), %10 ], [ getelementptr inbounds ([56 x i8], [56 x i8]* @.str.11, i64 0, i64 0), %17 ], [ %7, %4 ]
%27 = tail call i32 @system(i8* %25)
%28 = tail call i32 @system(i8* %26)
br label %29
29: ; preds = %24, %2
ret void
}