#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 */
struct commandData {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ toDasaDemostr(char *, char *);
void mode(struct commandData *words, int arg) {
  switch (arg) {
  case 0:
    toDasaDemostr("MODE", "SHOWER");
    break;
  case 1:
    toDasaDemostr("MODE", "RAIN");
    break;
  case 2:
    toDasaDemostr("MODE", "MASSAGE");
    break;
  case 3:
    toDasaDemostr("MODE", "JET");
    break;
  default:
    printf("error");
  }
}


x86 assembly (clang, -O0):
<mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x3,%rax
ja     11b4 <mode+0x94>
mov    -0x18(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeb5(%rip),%rdi
lea    0xeb3(%rip),%rsi
call   1040 <toDasaDemostr@plt>
jmp    11c0 <mode+0xa0>
lea    0xe9d(%rip),%rdi
lea    0xea2(%rip),%rsi
call   1040 <toDasaDemostr@plt>
jmp    11c0 <mode+0xa0>
lea    0xe85(%rip),%rdi
lea    0xe8f(%rip),%rsi
call   1040 <toDasaDemostr@plt>
jmp    11c0 <mode+0xa0>
lea    0xe6d(%rip),%rdi
lea    0xe7f(%rip),%rsi
call   1040 <toDasaDemostr@plt>
jmp    11c0 <mode+0xa0>
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mode>:
cmp    $0x3,%esi
ja     114a <mode+0x2a>
mov    %esi,%eax
lea    0xed2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed2(%rip),%rdi
lea    0xed0(%rip),%rsi
jmp    1040 <toDasaDemostr@plt>
lea    0xedc(%rip),%rdi
jmp    1030 <printf@plt>
lea    0xeb3(%rip),%rdi
lea    0xeb8(%rip),%rsi
jmp    1040 <toDasaDemostr@plt>
lea    0xea0(%rip),%rdi
lea    0xeaa(%rip),%rsi
jmp    1040 <toDasaDemostr@plt>
lea    0xe8d(%rip),%rdi
lea    0xe9f(%rip),%rsi
jmp    1040 <toDasaDemostr@plt>

LLVM IR (-O0):
%struct.commandData = type { i32 }
@.str = [5 x i8] c"MODE\00"
@.str.1 = [7 x i8] c"SHOWER\00"
@.str.2 = [5 x i8] c"RAIN\00"
@.str.3 = [8 x i8] c"MASSAGE\00"
@.str.4 = [4 x i8] c"JET\00"
@.str.5 = [6 x i8] c"error\00"
define void @mode(%struct.commandData* %0, i32 %1) {
%3 = alloca %struct.commandData*
%4 = alloca i32
store %struct.commandData* %0, %struct.commandData** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %14 [
i32 0, label %6
i32 1, label %8
i32 2, label %10
i32 3, label %12
]
6: ; preds = %2
%7 = call i32 @toDasaDemostr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %16
8: ; preds = %2
%9 = call i32 @toDasaDemostr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %16
10: ; preds = %2
%11 = call i32 @toDasaDemostr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %16
12: ; preds = %2
%13 = call i32 @toDasaDemostr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %16
14: ; preds = %2
%15 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %16
16: ; preds = %14, %12, %10, %8, %6
ret void
}

LLVM IR (-O2):
%struct.commandData = type { i32 }
@.str = [5 x i8] c"MODE\00"
@.str.1 = [7 x i8] c"SHOWER\00"
@.str.2 = [5 x i8] c"RAIN\00"
@.str.3 = [8 x i8] c"MASSAGE\00"
@.str.4 = [4 x i8] c"JET\00"
@.str.5 = [6 x i8] c"error\00"
define void @mode(%struct.commandData* nocapture readnone %0, i32 %1) {
switch i32 %1, label %11 [
i32 0, label %3
i32 1, label %5
i32 2, label %7
i32 3, label %9
]
3: ; preds = %2
%4 = tail call i32 @toDasaDemostr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %13
5: ; preds = %2
%6 = tail call i32 @toDasaDemostr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %13
7: ; preds = %2
%8 = tail call i32 @toDasaDemostr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %13
9: ; preds = %2
%10 = tail call i32 @toDasaDemostr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %13
11: ; preds = %2
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %13
13: ; preds = %11, %9, %7, %5, %3
ret void
}