#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 */

/* Variables and functions */
int /*<<< orphan*/ Parser_DisplayTagInfo(unsigned int, unsigned char);
int /*<<< orphan*/ Parser_TsPacketLog(unsigned int, char *, ...);
int x63_Tag_DescriptorParser(unsigned int type, unsigned char *buff) {
  if (NULL == buff) {
    return -1;
  }
  Parser_DisplayTagInfo(type, buff[0]);
  Parser_TsPacketLog(type, "Descriptor_length = 0x%x\n", buff[1]);
  Parser_TsPacketLog(type, "peak_rate = 0x%x\n",
                     ((buff[2] & 0x3F) << 16) | ((buff[3] & 0xFF) << 8) |
                         (buff[4] & 0xFF));
  Parser_TsPacketLog(type, "minimum_overall_smoothing_rate = 0x%x\n",
                     ((buff[5] & 0x3F) << 16) | ((buff[6] & 0xFF) << 8) |
                         (buff[7] & 0xFF));
  Parser_TsPacketLog(type, "maximum_overall_smoothing_buffer = 0x%x\n",
                     ((buff[8] & 0x3F) << 8) | (buff[9] & 0xFF));
  Parser_TsPacketLog(type, "******END******\n");
  return buff[1];
}


x86 assembly (clang, -O0):
<x63_Tag_DescriptorParser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    1147 <x63_Tag_DescriptorParser+0x27>
movl   $0xffffffff,-0x4(%rbp)
jmp    1239 <x63_Tag_DescriptorParser+0x119>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rax
movzbl (%rax),%esi
call   1040 <Parser_DisplayTagInfo@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%edx
lea    0xe98(%rip),%rsi
mov    $0x0,%al
call   1030 <Parser_TsPacketLog@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rax
movzbl 0x2(%rax),%edx
and    $0x3f,%edx
shl    $0x10,%edx
mov    -0x10(%rbp),%rax
movzbl 0x3(%rax),%eax
and    $0xff,%eax
shl    $0x8,%eax
or     %eax,%edx
mov    -0x10(%rbp),%rax
movzbl 0x4(%rax),%eax
and    $0xff,%eax
or     %eax,%edx
lea    0xe72(%rip),%rsi
mov    $0x0,%al
call   1030 <Parser_TsPacketLog@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rax
movzbl 0x5(%rax),%edx
and    $0x3f,%edx
shl    $0x10,%edx
mov    -0x10(%rbp),%rax
movzbl 0x6(%rax),%eax
and    $0xff,%eax
shl    $0x8,%eax
or     %eax,%edx
mov    -0x10(%rbp),%rax
movzbl 0x7(%rax),%eax
and    $0xff,%eax
or     %eax,%edx
lea    0xe44(%rip),%rsi
mov    $0x0,%al
call   1030 <Parser_TsPacketLog@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rax
movzbl 0x8(%rax),%edx
and    $0x3f,%edx
shl    $0x8,%edx
mov    -0x10(%rbp),%rax
movzbl 0x9(%rax),%eax
and    $0xff,%eax
or     %eax,%edx
lea    0xe3d(%rip),%rsi
mov    $0x0,%al
call   1030 <Parser_TsPacketLog@plt>
mov    -0x8(%rbp),%edi
lea    0xe55(%rip),%rsi
mov    $0x0,%al
call   1030 <Parser_TsPacketLog@plt>
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x63_Tag_DescriptorParser>:
test   %rsi,%rsi
je     11da <x63_Tag_DescriptorParser+0xba>
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
movzbl (%rsi),%esi
call   1040 <Parser_DisplayTagInfo@plt>
movzbl 0x1(%rbx),%edx
lea    0xebc(%rip),%rsi
mov    %ebp,%edi
xor    %eax,%eax
call   1030 <Parser_TsPacketLog@plt>
movzbl 0x2(%rbx),%eax
and    $0x3f,%eax
shl    $0x10,%eax
movzbl 0x3(%rbx),%ecx
shl    $0x8,%ecx
or     %eax,%ecx
movzbl 0x4(%rbx),%edx
or     %ecx,%edx
lea    0xead(%rip),%rsi
mov    %ebp,%edi
xor    %eax,%eax
call   1030 <Parser_TsPacketLog@plt>
movzbl 0x5(%rbx),%eax
and    $0x3f,%eax
shl    $0x10,%eax
movzbl 0x6(%rbx),%ecx
shl    $0x8,%ecx
or     %eax,%ecx
movzbl 0x7(%rbx),%edx
or     %ecx,%edx
lea    0xe96(%rip),%rsi
mov    %ebp,%edi
xor    %eax,%eax
call   1030 <Parser_TsPacketLog@plt>
movzbl 0x8(%rbx),%eax
and    $0x3f,%eax
shl    $0x8,%eax
movzbl 0x9(%rbx),%edx
or     %eax,%edx
lea    0xe9d(%rip),%rsi
mov    %ebp,%edi
xor    %eax,%eax
call   1030 <Parser_TsPacketLog@plt>
lea    0xeb6(%rip),%rsi
mov    %ebp,%edi
xor    %eax,%eax
call   1030 <Parser_TsPacketLog@plt>
movzbl 0x1(%rbx),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Descriptor_length = 0x%x\0A\00"
@.str.1 = [18 x i8] c"peak_rate = 0x%x\0A\00"
@.str.2 = [39 x i8] c"minimum_overall_smoothing_rate = 0x%x\0A\00"
@.str.3 = [41 x i8] c"maximum_overall_smoothing_buffer = 0x%x\0A\00"
@.str.4 = [17 x i8] c"******END******\0A\00"
define i32 @x63_Tag_DescriptorParser(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = icmp eq i8* null, %6
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 -1, i32* %3
br label %83
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = call i32 @Parser_DisplayTagInfo(i32 %10, i8 zeroext %13)
%15 = load i32, i32* %4
%16 = load i8*, i8** %5
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %15, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %4
%22 = load i8*, i8** %5
%23 = getelementptr inbounds i8, i8* %22, i64 2
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = and i32 %25, 63
%27 = shl i32 %26, 16
%28 = load i8*, i8** %5
%29 = getelementptr inbounds i8, i8* %28, i64 3
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = and i32 %31, 255
%33 = shl i32 %32, 8
%34 = or i32 %27, %33
%35 = load i8*, i8** %5
%36 = getelementptr inbounds i8, i8* %35, i64 4
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = and i32 %38, 255
%40 = or i32 %34, %39
%41 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %21, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %4
%43 = load i8*, i8** %5
%44 = getelementptr inbounds i8, i8* %43, i64 5
%45 = load i8, i8* %44
%46 = zext i8 %45 to i32
%47 = and i32 %46, 63
%48 = shl i32 %47, 16
%49 = load i8*, i8** %5
%50 = getelementptr inbounds i8, i8* %49, i64 6
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = and i32 %52, 255
%54 = shl i32 %53, 8
%55 = or i32 %48, %54
%56 = load i8*, i8** %5
%57 = getelementptr inbounds i8, i8* %56, i64 7
%58 = load i8, i8* %57
%59 = zext i8 %58 to i32
%60 = and i32 %59, 255
%61 = or i32 %55, %60
%62 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %42, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %61)
%63 = load i32, i32* %4
%64 = load i8*, i8** %5
%65 = getelementptr inbounds i8, i8* %64, i64 8
%66 = load i8, i8* %65
%67 = zext i8 %66 to i32
%68 = and i32 %67, 63
%69 = shl i32 %68, 8
%70 = load i8*, i8** %5
%71 = getelementptr inbounds i8, i8* %70, i64 9
%72 = load i8, i8* %71
%73 = zext i8 %72 to i32
%74 = and i32 %73, 255
%75 = or i32 %69, %74
%76 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %63, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i32 %75)
%77 = load i32, i32* %4
%78 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %77, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%79 = load i8*, i8** %5
%80 = getelementptr inbounds i8, i8* %79, i64 1
%81 = load i8, i8* %80
%82 = zext i8 %81 to i32
store i32 %82, i32* %3
br label %83
83: ; preds = %9, %8
%84 = load i32, i32* %3
ret i32 %84
}

LLVM IR (-O2):
@.str = [26 x i8] c"Descriptor_length = 0x%x\0A\00"
@.str.1 = [18 x i8] c"peak_rate = 0x%x\0A\00"
@.str.2 = [39 x i8] c"minimum_overall_smoothing_rate = 0x%x\0A\00"
@.str.3 = [41 x i8] c"maximum_overall_smoothing_buffer = 0x%x\0A\00"
@.str.4 = [17 x i8] c"******END******\0A\00"
define i32 @x63_Tag_DescriptorParser(i32 %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %54, label %4
4: ; preds = %2
%5 = load i8, i8* %1
%6 = tail call i32 @Parser_DisplayTagInfo(i32 %0, i8 zeroext %5)
%7 = getelementptr inbounds i8, i8* %1, i64 1
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds i8, i8* %1, i64 2
%12 = load i8, i8* %11
%13 = and i8 %12, 63
%14 = zext i8 %13 to i32
%15 = shl nuw nsw i32 %14, 16
%16 = getelementptr inbounds i8, i8* %1, i64 3
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = shl nuw nsw i32 %18, 8
%20 = or i32 %15, %19
%21 = getelementptr inbounds i8, i8* %1, i64 4
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = or i32 %20, %23
%25 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds i8, i8* %1, i64 5
%27 = load i8, i8* %26
%28 = and i8 %27, 63
%29 = zext i8 %28 to i32
%30 = shl nuw nsw i32 %29, 16
%31 = getelementptr inbounds i8, i8* %1, i64 6
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = shl nuw nsw i32 %33, 8
%35 = or i32 %30, %34
%36 = getelementptr inbounds i8, i8* %1, i64 7
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = or i32 %35, %38
%40 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %0, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %39)
%41 = getelementptr inbounds i8, i8* %1, i64 8
%42 = load i8, i8* %41
%43 = and i8 %42, 63
%44 = zext i8 %43 to i32
%45 = shl nuw nsw i32 %44, 8
%46 = getelementptr inbounds i8, i8* %1, i64 9
%47 = load i8, i8* %46
%48 = zext i8 %47 to i32
%49 = or i32 %45, %48
%50 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %0, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i32 %49)
%51 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%52 = load i8, i8* %7
%53 = zext i8 %52 to i32
br label %54
54: ; preds = %2, %4
%55 = phi i32 [ %53, %4 ], [ -1, %2 ]
ret i32 %55
}