#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((circuit_group_supervision_dump))(struct ss7 *ss7, int messagetype,
                                      unsigned char *parm, int len) {
  char *name;
  switch (parm[0] & 0x3) {
  case 0:
    name = "Maintenance oriented";
    break;
  case 1:
    name = "Hardware Failure oriented";
    break;
  case 2:
    name = "Reserved for national use";
    break;
  case 3:
    name = "Spare";
    break;
  default:
    name = "Huh?!";
  }
  ss7_message(ss7, "\t\t\tType indicator: %s\n", name);
  return 1;
}


x86 assembly (clang, -O0):
<circuit_group_supervision_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
and    $0x3,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x3,%eax
ja     1193 <circuit_group_supervision_dump+0x83>
mov    -0x30(%rbp),%rax
lea    0xeb6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeb6(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    119e <circuit_group_supervision_dump+0x8e>
lea    0xebb(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    119e <circuit_group_supervision_dump+0x8e>
lea    0xec5(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    119e <circuit_group_supervision_dump+0x8e>
lea    0xecf(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    119e <circuit_group_supervision_dump+0x8e>
lea    0xec5(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xeb8(%rip),%rsi
call   1030 <ss7_message@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<circuit_group_supervision_dump>:
push   %rax
movzbl (%rdx),%eax
and    $0x3,%eax
lea    0xf4a(%rip),%rcx
movslq (%rcx,%rax,4),%rdx
add    %rcx,%rdx
lea    0xf23(%rip),%rsi
call   1030 <ss7_message@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.ss7 = type { i32 }
@.str = [21 x i8] c"Maintenance oriented\00"
@.str.1 = [26 x i8] c"Hardware Failure oriented\00"
@.str.2 = [26 x i8] c"Reserved for national use\00"
@.str.3 = [6 x i8] c"Spare\00"
@.str.4 = [6 x i8] c"Huh?!\00"
@.str.5 = [23 x i8] c"\09\09\09Type indicator: %s\0A\00"
define i32 @circuit_group_supervision_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
%14 = and i32 %13, 3
switch i32 %14, label %19 [
i32 0, label %15
i32 1, label %16
i32 2, label %17
i32 3, label %18
]
15: ; preds = %4
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8** %9
br label %20
16: ; preds = %4
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8** %9
br label %20
17: ; preds = %4
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8** %9
br label %20
18: ; preds = %4
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %9
br label %20
19: ; preds = %4
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8** %9
br label %20
20: ; preds = %19, %18, %17, %16, %15
%21 = load %struct.ss7*, %struct.ss7** %5
%22 = load i8*, i8** %9
%23 = call i32 @ss7_message(%struct.ss7* %21, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %22)
ret i32 1
}

LLVM IR (-O2):
%struct.ss7 = type { i32 }
@.str = [21 x i8] c"Maintenance oriented\00"
@.str.1 = [26 x i8] c"Hardware Failure oriented\00"
@.str.2 = [26 x i8] c"Reserved for national use\00"
@.str.3 = [6 x i8] c"Spare\00"
@.str.5 = [23 x i8] c"\09\09\09Type indicator: %s\0A\00"
@reltable.circuit_group_supervision_dump = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str to i64), i64 ptrtoint ([4 x i32]* @reltable.circuit_group_supervision_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.circuit_group_supervision_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.circuit_group_supervision_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.circuit_group_supervision_dump to i64)) to i32)]
define i32 @circuit_group_supervision_dump(%struct.ss7* %0, i32 %1, i8* nocapture %2, i32 %3) {
%5 = load i8, i8* %2
%6 = and i8 %5, 3
%7 = zext i8 %6 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.circuit_group_supervision_dump to i8*), i64 %8)
%10 = tail call i32 @ss7_message(%struct.ss7* %0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %9)
ret i32 1
}