#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((opt_forward_call_ind_dump))(struct ss7 *ss7, int messagetype,
                                 unsigned char *parm, int len) {
  char *desc;
  switch (parm[0] & 0x03) {
  case 0:
    desc = "non-CUG call";
    break;
  case 2:
    desc = "closed user group call, outgoing access allowed";
    break;
  case 3:
    desc = "closed user group call, outgoing access not allowed";
    break;
  default:
    desc = "spare";
  }
  ss7_message(ss7, "\t\t\tClosed user group call indicator: %s\n", desc);
  ss7_message(
      ss7, "\t\t\tSimple segmentation indicator: %s\n",
      (parm[0] & (1 << 2))
          ? "additional information will be sent in segmentation message"
          : "no additional message will be sent");
  ss7_message(ss7, "\t\t\tConnected line identify request indicator %s\n",
              (parm[0] & (1 << 7)) ? "requested" : "not requested");
  return 1;
}


x86 assembly (clang, -O0):
<opt_forward_call_ind_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,-0x2c(%rbp)
je     1160 <opt_forward_call_ind_dump+0x50>
jmp    113e <opt_forward_call_ind_dump+0x2e>
mov    -0x2c(%rbp),%eax
sub    $0x2,%eax
je     1170 <opt_forward_call_ind_dump+0x60>
jmp    114f <opt_forward_call_ind_dump+0x3f>
mov    -0x2c(%rbp),%eax
sub    $0x3,%eax
je     1180 <opt_forward_call_ind_dump+0x70>
jmp    1190 <opt_forward_call_ind_dump+0x80>
lea    0xe99(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    119b <opt_forward_call_ind_dump+0x8b>
lea    0xe96(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    119b <opt_forward_call_ind_dump+0x8b>
lea    0xeb6(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    119b <opt_forward_call_ind_dump+0x8b>
lea    0xeda(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xecd(%rip),%rsi
call   1030 <ss7_message@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movzbl (%rax),%ecx
and    $0x4,%ecx
lea    0xf3e(%rip),%rdx
lea    0xefb(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xec7(%rip),%rsi
call   1030 <ss7_message@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movzbl (%rax),%ecx
and    $0x80,%ecx
lea    0xf60(%rip),%rdx
lea    0xf5d(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xf1a(%rip),%rsi
call   1030 <ss7_message@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opt_forward_call_ind_dump>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rdi,%r14
movzbl (%rdx),%eax
and    $0x3,%eax
lea    0x103d(%rip),%rcx
movslq (%rcx,%rax,4),%rdx
add    %rcx,%rdx
lea    0xf42(%rip),%rsi
call   1030 <ss7_message@plt>
testb  $0x4,(%rbx)
lea    0xfbe(%rip),%rax
lea    0xf7b(%rip),%rdx
cmove  %rax,%rdx
lea    0xf4a(%rip),%rsi
mov    %r14,%rdi
call   1030 <ss7_message@plt>
cmpb   $0x0,(%rbx)
lea    0xfee(%rip),%rax
lea    0xfeb(%rip),%rdx
cmovns %rax,%rdx
lea    0xfab(%rip),%rsi
mov    %r14,%rdi
call   1030 <ss7_message@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.ss7 = type { i32 }
@.str = [13 x i8] c"non-CUG call\00"
@.str.1 = [48 x i8] c"closed user group call, outgoing access allowed\00"
@.str.2 = [52 x i8] c"closed user group call, outgoing access not allowed\00"
@.str.3 = [6 x i8] c"spare\00"
@.str.4 = [41 x i8] c"\09\09\09Closed user group call indicator: %s\0A\00"
@.str.5 = [38 x i8] c"\09\09\09Simple segmentation indicator: %s\0A\00"
@.str.6 = [60 x i8] c"additional information will be sent in segmentation message\00"
@.str.7 = [35 x i8] c"no additional message will be sent\00"
@.str.8 = [49 x i8] c"\09\09\09Connected line identify request indicator %s\0A\00"
@.str.9 = [10 x i8] c"requested\00"
@.str.10 = [14 x i8] c"not requested\00"
define i32 @opt_forward_call_ind_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 %18 [
i32 0, label %15
i32 2, label %16
i32 3, label %17
]
15: ; preds = %4
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %9
br label %19
16: ; preds = %4
store i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8** %9
br label %19
17: ; preds = %4
store i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i8** %9
br label %19
18: ; preds = %4
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %9
br label %19
19: ; preds = %18, %17, %16, %15
%20 = load %struct.ss7*, %struct.ss7** %5
%21 = load i8*, i8** %9
%22 = call i32 @ss7_message(%struct.ss7* %20, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* %21)
%23 = load %struct.ss7*, %struct.ss7** %5
%24 = load i8*, i8** %7
%25 = getelementptr inbounds i8, i8* %24, i64 0
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = and i32 %27, 4
%29 = icmp ne i32 %28, 0
%30 = zext i1 %29 to i64
%31 = select i1 %29, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0)
%32 = call i32 @ss7_message(%struct.ss7* %23, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i8* %31)
%33 = load %struct.ss7*, %struct.ss7** %5
%34 = load i8*, i8** %7
%35 = getelementptr inbounds i8, i8* %34, i64 0
%36 = load i8, i8* %35
%37 = zext i8 %36 to i32
%38 = and i32 %37, 128
%39 = icmp ne i32 %38, 0
%40 = zext i1 %39 to i64
%41 = select i1 %39, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0)
%42 = call i32 @ss7_message(%struct.ss7* %33, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0), i8* %41)
ret i32 1
}

LLVM IR (-O2):
%struct.ss7 = type { i32 }
@.str = [13 x i8] c"non-CUG call\00"
@.str.1 = [48 x i8] c"closed user group call, outgoing access allowed\00"
@.str.2 = [52 x i8] c"closed user group call, outgoing access not allowed\00"
@.str.3 = [6 x i8] c"spare\00"
@.str.4 = [41 x i8] c"\09\09\09Closed user group call indicator: %s\0A\00"
@.str.5 = [38 x i8] c"\09\09\09Simple segmentation indicator: %s\0A\00"
@.str.6 = [60 x i8] c"additional information will be sent in segmentation message\00"
@.str.7 = [35 x i8] c"no additional message will be sent\00"
@.str.8 = [49 x i8] c"\09\09\09Connected line identify request indicator %s\0A\00"
@.str.9 = [10 x i8] c"requested\00"
@.str.10 = [14 x i8] c"not requested\00"
@reltable.opt_forward_call_ind_dump = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str to i64), i64 ptrtoint ([4 x i32]* @reltable.opt_forward_call_ind_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.opt_forward_call_ind_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([48 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.opt_forward_call_ind_dump to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([52 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.opt_forward_call_ind_dump to i64)) to i32)]
define i32 @opt_forward_call_ind_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.opt_forward_call_ind_dump to i8*), i64 %8)
%10 = tail call i32 @ss7_message(%struct.ss7* %0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* %9)
%11 = load i8, i8* %2
%12 = and i8 %11, 4
%13 = icmp eq i8 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.6, i64 0, i64 0)
%15 = tail call i32 @ss7_message(%struct.ss7* %0, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i8* %14)
%16 = load i8, i8* %2
%17 = icmp sgt i8 %16, -1
%18 = select i1 %17, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0)
%19 = tail call i32 @ss7_message(%struct.ss7* %0, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0), i8* %18)
ret i32 1
}