#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 *, unsigned char);
int((lspi_dump))(struct ss7 *ss7, int messagetype, unsigned char *parm,
                 int len) {
  ss7_message(ss7, "\t\t\tLSPI Type: %x\n", parm[0] & 0x1f);
  ss7_message(ss7, "\t\t\tEncoding Scheme: %x\n", (parm[0] >> 5) & 0x7);
  ss7_message(ss7, "\t\t\tContext ID: %x\n", parm[1] & 0xf);
  ss7_message(ss7, "\t\t\tSpare: %x\n", (parm[1] >> 4) & 0xf);
  ss7_message(ss7, "\t\t\tLSP Identity: %x\n", parm[2]);
  return len;
}


x86 assembly (clang, -O0):
<lspi_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
and    $0x1f,%eax
lea    0xec5(%rip),%rsi
movzbl %al,%edx
call   1030 <ss7_message@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
sar    $0x5,%eax
and    $0x7,%eax
lea    0xeb7(%rip),%rsi
movzbl %al,%edx
call   1030 <ss7_message@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movzbl 0x1(%rax),%eax
and    $0xf,%eax
lea    0xeb1(%rip),%rsi
movzbl %al,%edx
call   1030 <ss7_message@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movzbl 0x1(%rax),%eax
sar    $0x4,%eax
and    $0xf,%eax
lea    0xea3(%rip),%rsi
movzbl %al,%edx
call   1030 <ss7_message@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
lea    0xe9a(%rip),%rsi
movzbl 0x2(%rax),%edx
call   1030 <ss7_message@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lspi_dump>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rdx,%rbp
mov    %rdi,%rbx
movzbl (%rdx),%edx
and    $0x1f,%edx
lea    0xed6(%rip),%rsi
call   1030 <ss7_message@plt>
mov    0x0(%rbp),%al
shr    $0x5,%al
movzbl %al,%edx
lea    0xed3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <ss7_message@plt>
movzbl 0x1(%rbp),%edx
and    $0xf,%edx
lea    0xed5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <ss7_message@plt>
mov    0x1(%rbp),%al
shr    $0x4,%al
movzbl %al,%edx
lea    0xed0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <ss7_message@plt>
movzbl 0x2(%rbp),%edx
lea    0xecb(%rip),%rsi
mov    %rbx,%rdi
call   1030 <ss7_message@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.ss7 = type { i32 }
@.str = [18 x i8] c"\09\09\09LSPI Type: %x\0A\00"
@.str.1 = [24 x i8] c"\09\09\09Encoding Scheme: %x\0A\00"
@.str.2 = [19 x i8] c"\09\09\09Context ID: %x\0A\00"
@.str.3 = [14 x i8] c"\09\09\09Spare: %x\0A\00"
@.str.4 = [21 x i8] c"\09\09\09LSP Identity: %x\0A\00"
define i32 @lspi_dump(%struct.ss7* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca %struct.ss7*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store %struct.ss7* %0, %struct.ss7** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load %struct.ss7*, %struct.ss7** %5
%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, 31
%15 = trunc i32 %14 to i8
%16 = call i32 @ss7_message(%struct.ss7* %9, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8 zeroext %15)
%17 = load %struct.ss7*, %struct.ss7** %5
%18 = load i8*, i8** %7
%19 = getelementptr inbounds i8, i8* %18, i64 0
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = ashr i32 %21, 5
%23 = and i32 %22, 7
%24 = trunc i32 %23 to i8
%25 = call i32 @ss7_message(%struct.ss7* %17, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %24)
%26 = load %struct.ss7*, %struct.ss7** %5
%27 = load i8*, i8** %7
%28 = getelementptr inbounds i8, i8* %27, i64 1
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = and i32 %30, 15
%32 = trunc i32 %31 to i8
%33 = call i32 @ss7_message(%struct.ss7* %26, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %32)
%34 = load %struct.ss7*, %struct.ss7** %5
%35 = load i8*, i8** %7
%36 = getelementptr inbounds i8, i8* %35, i64 1
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = ashr i32 %38, 4
%40 = and i32 %39, 15
%41 = trunc i32 %40 to i8
%42 = call i32 @ss7_message(%struct.ss7* %34, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8 zeroext %41)
%43 = load %struct.ss7*, %struct.ss7** %5
%44 = load i8*, i8** %7
%45 = getelementptr inbounds i8, i8* %44, i64 2
%46 = load i8, i8* %45
%47 = call i32 @ss7_message(%struct.ss7* %43, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8 zeroext %46)
%48 = load i32, i32* %8
ret i32 %48
}

LLVM IR (-O2):
%struct.ss7 = type { i32 }
@.str = [18 x i8] c"\09\09\09LSPI Type: %x\0A\00"
@.str.1 = [24 x i8] c"\09\09\09Encoding Scheme: %x\0A\00"
@.str.2 = [19 x i8] c"\09\09\09Context ID: %x\0A\00"
@.str.3 = [14 x i8] c"\09\09\09Spare: %x\0A\00"
@.str.4 = [21 x i8] c"\09\09\09LSP Identity: %x\0A\00"
define i32 @lspi_dump(%struct.ss7* %0, i32 %1, i8* nocapture %2, i32 returned %3) {
%5 = load i8, i8* %2
%6 = and i8 %5, 31
%7 = tail call i32 @ss7_message(%struct.ss7* %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
%8 = load i8, i8* %2
%9 = lshr i8 %8, 5
%10 = tail call i32 @ss7_message(%struct.ss7* %0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %9)
%11 = getelementptr inbounds i8, i8* %2, i64 1
%12 = load i8, i8* %11
%13 = and i8 %12, 15
%14 = tail call i32 @ss7_message(%struct.ss7* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %13)
%15 = load i8, i8* %11
%16 = lshr i8 %15, 4
%17 = tail call i32 @ss7_message(%struct.ss7* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8 zeroext %16)
%18 = getelementptr inbounds i8, i8* %2, i64 2
%19 = load i8, i8* %18
%20 = tail call i32 @ss7_message(%struct.ss7* %0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8 zeroext %19)
ret i32 %3
}