#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 *, unsigned char);
int((transmission_medium_reqs_dump))(struct ss7 *ss7, int messagetype,
                                     unsigned char *parm, int len) {
  char *type;
  switch (parm[0]) {
  case 0:
    type = "Speech";
    break;
  case 1:
  case 6:
    type = "Spare";
    break;
  case 2:
    type = "64 kbit/s unrestricted";
    break;
  case 3:
    type = "3.1 khz audio";
    break;
  default:
    type = "N x 64kbit/s unrestricted or possibly spare";
    break;
  }
  ss7_message(ss7, "\t\t\t%s (%d)\n", type, parm[0]);
  return 1;
}


x86 assembly (clang, -O0):
<transmission_medium_reqs_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     118f <transmission_medium_reqs_dump+0x7f>
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    119a <transmission_medium_reqs_dump+0x8a>
lea    0xebd(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    119a <transmission_medium_reqs_dump+0x8a>
lea    0xeb3(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    119a <transmission_medium_reqs_dump+0x8a>
lea    0xeba(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    119a <transmission_medium_reqs_dump+0x8a>
lea    0xeb8(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x18(%rbp),%rax
lea    0xecd(%rip),%rsi
movzbl (%rax),%ecx
call   1030 <ss7_message@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.ss7 = type { i32 }
@.str = [7 x i8] c"Speech\00"
@.str.1 = [6 x i8] c"Spare\00"
@.str.2 = [23 x i8] c"64 kbit/s unrestricted\00"
@.str.3 = [14 x i8] c"3.1 khz audio\00"
@.str.4 = [44 x i8] c"N x 64kbit/s unrestricted or possibly spare\00"
@.str.5 = [12 x i8] c"\09\09\09%s (%d)\0A\00"
define i32 @transmission_medium_reqs_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 %18 [
i32 0, label %14
i32 1, label %15
i32 6, label %15
i32 2, label %16
i32 3, label %17
]
14: ; preds = %4
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %9
br label %19
15: ; preds = %4, %4
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %9
br label %19
16: ; preds = %4
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8** %9
br label %19
17: ; preds = %4
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8** %9
br label %19
18: ; preds = %4
store i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i8** %9
br label %19
19: ; preds = %18, %17, %16, %15, %14
%20 = load %struct.ss7*, %struct.ss7** %5
%21 = load i8*, i8** %9
%22 = load i8*, i8** %7
%23 = getelementptr inbounds i8, i8* %22, i64 0
%24 = load i8, i8* %23
%25 = call i32 @ss7_message(%struct.ss7* %20, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %21, i8 zeroext %24)
ret i32 1
}

LLVM IR (-O2):
%struct.ss7 = type { i32 }
@.str = [7 x i8] c"Speech\00"
@.str.1 = [6 x i8] c"Spare\00"
@.str.2 = [23 x i8] c"64 kbit/s unrestricted\00"
@.str.3 = [14 x i8] c"3.1 khz audio\00"
@.str.4 = [44 x i8] c"N x 64kbit/s unrestricted or possibly spare\00"
@.str.5 = [12 x i8] c"\09\09\09%s (%d)\0A\00"
@reltable.transmission_medium_reqs_dump = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.transmission_medium_reqs_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.transmission_medium_reqs_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.transmission_medium_reqs_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.transmission_medium_reqs_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([44 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.transmission_medium_reqs_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([44 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.transmission_medium_reqs_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.transmission_medium_reqs_dump to i64)) to i32)]
define i32 @transmission_medium_reqs_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.transmission_medium_reqs_dump to i8*), i64 %9)
br label %11
11: ; preds = %4, %7
%12 = phi i8* [ %10, %7 ], [ getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), %4 ]
%13 = tail call i32 @ss7_message(%struct.ss7* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %12, i8 zeroext %5)
ret i32 1
}