#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 ss7 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ss7_message(struct ss7 *, char *, char *);
int((event_info_dump))(struct ss7 *ss7, int messagetype, unsigned char *parm,
                       int len) {
  char *name;
  switch (parm[0]) {
  case 0:
    name = "spare";
    break;
  case 1:
    name = "ALERTING";
    break;
  case 2:
    name = "PROGRESS";
    break;
  case 3:
    name = "In-band information or an appropriate pattern is now available";
    break;
  case 4:
    name = "Call forward on busy";
    break;
  case 5:
    name = "Call forward on no reply";
    break;
  case 6:
    name = "Call forward unconditional";
    break;
  default:
    name = "Spare";
    break;
  }
  ss7_message(ss7, "\t\t\t%s\n", name);
  return 1;
}


x86 assembly (clang, -O0):
<event_info_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
mov    %rax,-0x30(%rbp)
sub    $0x6,%rax
ja     11bf <event_info_dump+0xaf>
mov    -0x30(%rbp),%rax
lea    0xeba(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xec6(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    11ca <event_info_dump+0xba>
lea    0xebc(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    11ca <event_info_dump+0xba>
lea    0xeb5(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    11ca <event_info_dump+0xba>
lea    0xeae(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    11ca <event_info_dump+0xba>
lea    0xedd(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    11ca <event_info_dump+0xba>
lea    0xee2(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    11ca <event_info_dump+0xba>
lea    0xeeb(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    11ca <event_info_dump+0xba>
lea    0xef6(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xee9(%rip),%rsi
call   1030 <ss7_message@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<event_info_dump>:
push   %rax
movsbq (%rdx),%rax
cmp    $0x6,%rax
ja     112b <event_info_dump+0x1b>
lea    0xf8e(%rip),%rcx
movslq (%rcx,%rax,4),%rdx
add    %rcx,%rdx
jmp    1132 <event_info_dump+0x22>
lea    0xf6e(%rip),%rdx
lea    0xf6d(%rip),%rsi
call   1030 <ss7_message@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.ss7 = type { i32 }
@.str = [6 x i8] c"spare\00"
@.str.1 = [9 x i8] c"ALERTING\00"
@.str.2 = [9 x i8] c"PROGRESS\00"
@.str.3 = [63 x i8] c"In-band information or an appropriate pattern is now available\00"
@.str.4 = [21 x i8] c"Call forward on busy\00"
@.str.5 = [25 x i8] c"Call forward on no reply\00"
@.str.6 = [27 x i8] c"Call forward unconditional\00"
@.str.7 = [6 x i8] c"Spare\00"
@.str.8 = [7 x i8] c"\09\09\09%s\0A\00"
define i32 @event_info_dump(%struct.ss7* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca %struct.ss7*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
store %struct.ss7* %0, %struct.ss7** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i8*, i8** %7
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
switch i32 %13, label %21 [
i32 0, label %14
i32 1, label %15
i32 2, label %16
i32 3, label %17
i32 4, label %18
i32 5, label %19
i32 6, label %20
]
14: ; preds = %4
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %9
br label %22
15: ; preds = %4
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %9
br label %22
16: ; preds = %4
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %9
br label %22
17: ; preds = %4
store i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.3, i64 0, i64 0), i8** %9
br label %22
18: ; preds = %4
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8** %9
br label %22
19: ; preds = %4
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8** %9
br label %22
20: ; preds = %4
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8** %9
br label %22
21: ; preds = %4
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8** %9
br label %22
22: ; preds = %21, %20, %19, %18, %17, %16, %15, %14
%23 = load %struct.ss7*, %struct.ss7** %5
%24 = load i8*, i8** %9
%25 = call i32 @ss7_message(%struct.ss7* %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %24)
ret i32 1
}

LLVM IR (-O2):
%struct.ss7 = type { i32 }
@.str = [6 x i8] c"spare\00"
@.str.1 = [9 x i8] c"ALERTING\00"
@.str.2 = [9 x i8] c"PROGRESS\00"
@.str.3 = [63 x i8] c"In-band information or an appropriate pattern is now available\00"
@.str.4 = [21 x i8] c"Call forward on busy\00"
@.str.5 = [25 x i8] c"Call forward on no reply\00"
@.str.6 = [27 x i8] c"Call forward unconditional\00"
@.str.7 = [6 x i8] c"Spare\00"
@.str.8 = [7 x i8] c"\09\09\09%s\0A\00"
@reltable.event_info_dump = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.event_info_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.event_info_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.event_info_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([63 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.event_info_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.event_info_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([25 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.event_info_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([27 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.event_info_dump to i64)) to i32)]
define i32 @event_info_dump(%struct.ss7* %0, i32 %1, i8* nocapture %2, i32 %3) {
%5 = load i8, i8* %2
%6 = icmp ult i8 %5, 7
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = sext i8 %5 to i64
%9 = shl i64 %8, 2
%10 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.event_info_dump to i8*), i64 %9)
br label %11
11: ; preds = %4, %7
%12 = phi i8* [ %10, %7 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), %4 ]
%13 = tail call i32 @ss7_message(%struct.ss7* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %12)
ret i32 1
}