#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 x5D_Tag_DescriptorParser(unsigned int type, unsigned char *buff) {
  unsigned int i = 0, j = 0;
  unsigned int offset = 0, length = 0;
  unsigned char *data = NULL;
  if (NULL == buff) {
    return -1;
  }
  Parser_DisplayTagInfo(type, buff[0]);
  Parser_TsPacketLog(type, "Descriptor_length = 0x%x\n", buff[1]);
  data = buff;
  data += 2;
  if (0 != buff[1]) {
    for (i = 0; i < buff[1]; i += offset) {
      Parser_TsPacketLog(type, "ISO_639_language_code = 0x%x\n",
                         ((data[0] & 0xFF) << 16) | ((data[1] & 0xFF) << 8) |
                             (data[2] & 0xFF));
      Parser_TsPacketLog(type, "ISO_639_language_code : %c%c%c\n", data[0],
                         data[1], data[2]);
      Parser_TsPacketLog(type, "service_provider_name_length = 0x%x\n",
                         data[3]);
      offset = data[3];
      data += 4;
      if (0 != offset) {
        Parser_TsPacketLog(type, "service_provider_name: ");
        for (j = 0; j < offset; j++) {
          Parser_TsPacketLog(type, "%c", data[j]);
        }
        Parser_TsPacketLog(type, "\n");
      }
      data += offset;
      offset += 4;
      length = data[0];
      Parser_TsPacketLog(type, "service_name_length = 0x%x\n", length);
      data += 1;
      if (0 != length) {
        Parser_TsPacketLog(type, "service_name: ");
        for (j = 0; j < length; j++) {
          Parser_TsPacketLog(type, "%c", data[j]);
        }
        Parser_TsPacketLog(type, "\n");
      }
      offset += length;
      offset += 1;
      data += length;
    }
  }
  Parser_TsPacketLog(type, "******END******\n");
  return buff[1];
}


x86 assembly (clang, -O0):
<x5D_Tag_DescriptorParser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    116b <x5D_Tag_DescriptorParser+0x4b>
movl   $0xffffffff,-0x4(%rbp)
jmp    13d6 <x5D_Tag_DescriptorParser+0x2b6>
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    0xe74(%rip),%rsi
mov    $0x0,%al
call   1030 <Parser_TsPacketLog@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
je     13ba <x5D_Tag_DescriptorParser+0x29a>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
cmp    %ecx,%eax
jae    13b5 <x5D_Tag_DescriptorParser+0x295>
mov    -0x8(%rbp),%edi
mov    -0x28(%rbp),%rax
movzbl (%rax),%edx
and    $0xff,%edx
shl    $0x10,%edx
mov    -0x28(%rbp),%rax
movzbl 0x1(%rax),%eax
and    $0xff,%eax
shl    $0x8,%eax
or     %eax,%edx
mov    -0x28(%rbp),%rax
movzbl 0x2(%rax),%eax
and    $0xff,%eax
or     %eax,%edx
lea    0xe0c(%rip),%rsi
mov    $0x0,%al
call   1030 <Parser_TsPacketLog@plt>
mov    -0x8(%rbp),%edi
mov    -0x28(%rbp),%rax
movzbl (%rax),%edx
mov    -0x28(%rbp),%rax
movzbl 0x1(%rax),%ecx
mov    -0x28(%rbp),%rax
movzbl 0x2(%rax),%r8d
lea    0xe01(%rip),%rsi
mov    $0x0,%al
call   1030 <Parser_TsPacketLog@plt>
mov    -0x8(%rbp),%edi
mov    -0x28(%rbp),%rax
movzbl 0x3(%rax),%edx
lea    0xe08(%rip),%rsi
mov    $0x0,%al
call   1030 <Parser_TsPacketLog@plt>
mov    -0x28(%rbp),%rax
movzbl 0x3(%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
cmp    -0x1c(%rbp),%eax
je     12d8 <x5D_Tag_DescriptorParser+0x1b8>
mov    -0x8(%rbp),%edi
lea    0xdfa(%rip),%rsi
mov    $0x0,%al
call   1030 <Parser_TsPacketLog@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    12c7 <x5D_Tag_DescriptorParser+0x1a7>
mov    -0x8(%rbp),%edi
mov    -0x28(%rbp),%rax
mov    -0x18(%rbp),%ecx
movzbl (%rax,%rcx,1),%edx
lea    0xde3(%rip),%rsi
mov    $0x0,%al
call   1030 <Parser_TsPacketLog@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1291 <x5D_Tag_DescriptorParser+0x171>
mov    -0x8(%rbp),%edi
lea    0xe01(%rip),%rsi
mov    $0x0,%al
call   1030 <Parser_TsPacketLog@plt>
mov    -0x1c(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,%ecx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x20(%rbp),%edx
lea    0xd90(%rip),%rsi
mov    $0x0,%al
call   1030 <Parser_TsPacketLog@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
cmp    -0x20(%rbp),%eax
je     1385 <x5D_Tag_DescriptorParser+0x265>
mov    -0x8(%rbp),%edi
lea    0xd84(%rip),%rsi
mov    $0x0,%al
call   1030 <Parser_TsPacketLog@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jae    1374 <x5D_Tag_DescriptorParser+0x254>
mov    -0x8(%rbp),%edi
mov    -0x28(%rbp),%rax
mov    -0x18(%rbp),%ecx
movzbl (%rax,%rcx,1),%edx
lea    0xd36(%rip),%rsi
mov    $0x0,%al
call   1030 <Parser_TsPacketLog@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    133e <x5D_Tag_DescriptorParser+0x21e>
mov    -0x8(%rbp),%edi
lea    0xd54(%rip),%rsi
mov    $0x0,%al
call   1030 <Parser_TsPacketLog@plt>
mov    -0x20(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,%ecx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11c0 <x5D_Tag_DescriptorParser+0xa0>
jmp    13ba <x5D_Tag_DescriptorParser+0x29a>
mov    -0x8(%rbp),%edi
lea    0xcff(%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    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x5D_Tag_DescriptorParser>:
test   %rsi,%rsi
je     1314 <x5D_Tag_DescriptorParser+0x1f4>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%r12d
movzbl (%rsi),%esi
call   1040 <Parser_DisplayTagInfo@plt>
movzbl 0x1(%rbx),%edx
lea    0xeb0(%rip),%rsi
mov    %r12d,%edi
xor    %eax,%eax
call   1030 <Parser_TsPacketLog@plt>
mov    %rbx,(%rsp)
cmpb   $0x0,0x1(%rbx)
je     12ec <x5D_Tag_DescriptorParser+0x1cc>
mov    (%rsp),%rax
lea    0x2(%rax),%r13
lea    0xf1e(%rip),%r14
xor    %r15d,%r15d
jmp    119e <x5D_Tag_DescriptorParser+0x7e>
nopl   0x0(%rax)
add    %rbp,%r13
add    %ebx,%r15d
add    %ebp,%r15d
add    $0x5,%r15d
mov    (%rsp),%rax
movzbl 0x1(%rax),%eax
cmp    %eax,%r15d
jae    12ec <x5D_Tag_DescriptorParser+0x1cc>
movzbl 0x0(%r13),%eax
shl    $0x10,%eax
movzbl 0x1(%r13),%ecx
shl    $0x8,%ecx
or     %eax,%ecx
movzbl 0x2(%r13),%edx
or     %ecx,%edx
mov    %r12d,%edi
lea    0xe59(%rip),%rsi
xor    %eax,%eax
call   1030 <Parser_TsPacketLog@plt>
movzbl 0x0(%r13),%edx
movzbl 0x1(%r13),%ecx
movzbl 0x2(%r13),%r8d
mov    %r12d,%edi
lea    0xe57(%rip),%rsi
xor    %eax,%eax
call   1030 <Parser_TsPacketLog@plt>
movzbl 0x3(%r13),%edx
mov    %r12d,%edi
lea    0xe61(%rip),%rsi
xor    %eax,%eax
call   1030 <Parser_TsPacketLog@plt>
movzbl 0x3(%r13),%ebx
add    $0x4,%r13
test   %ebx,%ebx
mov    %rbx,0x8(%rsp)
je     1262 <x5D_Tag_DescriptorParser+0x142>
mov    %r12d,%edi
lea    0xe63(%rip),%rsi
xor    %eax,%eax
call   1030 <Parser_TsPacketLog@plt>
mov    %ebx,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
movzbl 0x0(%r13,%rbp,1),%edx
mov    %r12d,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <Parser_TsPacketLog@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1230 <x5D_Tag_DescriptorParser+0x110>
mov    %r12d,%edi
lea    0xe7c(%rip),%rsi
xor    %eax,%eax
call   1030 <Parser_TsPacketLog@plt>
mov    0x8(%rsp),%rbx
movzbl 0x0(%r13,%rbx,1),%ebp
mov    %r12d,%edi
lea    0xe26(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <Parser_TsPacketLog@plt>
add    %rbx,%r13
add    $0x1,%r13
test   %ebp,%ebp
je     1180 <x5D_Tag_DescriptorParser+0x60>
mov    %r12d,%edi
lea    0xe20(%rip),%rsi
xor    %eax,%eax
call   1030 <Parser_TsPacketLog@plt>
mov    %rbp,0x10(%rsp)
mov    %ebp,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl 0x0(%r13,%rbp,1),%edx
mov    %r12d,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <Parser_TsPacketLog@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    12b0 <x5D_Tag_DescriptorParser+0x190>
mov    %r12d,%edi
lea    0xdfc(%rip),%rsi
xor    %eax,%eax
call   1030 <Parser_TsPacketLog@plt>
mov    0x8(%rsp),%rbx
mov    0x10(%rsp),%rbp
jmp    1180 <x5D_Tag_DescriptorParser+0x60>
lea    0xdd0(%rip),%rsi
mov    %r12d,%edi
xor    %eax,%eax
call   1030 <Parser_TsPacketLog@plt>
mov    (%rsp),%rax
movzbl 0x1(%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Descriptor_length = 0x%x\0A\00"
@.str.1 = [30 x i8] c"ISO_639_language_code = 0x%x\0A\00"
@.str.2 = [32 x i8] c"ISO_639_language_code : %c%c%c\0A\00"
@.str.3 = [37 x i8] c"service_provider_name_length = 0x%x\0A\00"
@.str.4 = [24 x i8] c"service_provider_name: \00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [28 x i8] c"service_name_length = 0x%x\0A\00"
@.str.8 = [15 x i8] c"service_name: \00"
@.str.9 = [17 x i8] c"******END******\0A\00"
define i32 @x5D_Tag_DescriptorParser(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i8* null, i8** %10
%11 = load i8*, i8** %5
%12 = icmp eq i8* null, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 -1, i32* %3
br label %176
14: ; preds = %2
%15 = load i32, i32* %4
%16 = load i8*, i8** %5
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i8, i8* %17
%19 = call i32 @Parser_DisplayTagInfo(i32 %15, i8 zeroext %18)
%20 = load i32, i32* %4
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %20, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = load i8*, i8** %5
store i8* %26, i8** %10
%27 = load i8*, i8** %10
%28 = getelementptr inbounds i8, i8* %27, i64 2
store i8* %28, i8** %10
%29 = load i8*, i8** %5
%30 = getelementptr inbounds i8, i8* %29, i64 1
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = icmp ne i32 0, %32
br i1 %33, label %34, label %169
34: ; preds = %14
store i32 0, i32* %6
br label %35
35: ; preds = %164, %34
%36 = load i32, i32* %6
%37 = load i8*, i8** %5
%38 = getelementptr inbounds i8, i8* %37, i64 1
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = icmp ult i32 %36, %40
br i1 %41, label %42, label %168
42: ; preds = %35
%43 = load i32, i32* %4
%44 = load i8*, i8** %10
%45 = getelementptr inbounds i8, i8* %44, i64 0
%46 = load i8, i8* %45
%47 = zext i8 %46 to i32
%48 = and i32 %47, 255
%49 = shl i32 %48, 16
%50 = load i8*, i8** %10
%51 = getelementptr inbounds i8, i8* %50, i64 1
%52 = load i8, i8* %51
%53 = zext i8 %52 to i32
%54 = and i32 %53, 255
%55 = shl i32 %54, 8
%56 = or i32 %49, %55
%57 = load i8*, i8** %10
%58 = getelementptr inbounds i8, i8* %57, i64 2
%59 = load i8, i8* %58
%60 = zext i8 %59 to i32
%61 = and i32 %60, 255
%62 = or i32 %56, %61
%63 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %43, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %62)
%64 = load i32, i32* %4
%65 = load i8*, i8** %10
%66 = getelementptr inbounds i8, i8* %65, i64 0
%67 = load i8, i8* %66
%68 = zext i8 %67 to i32
%69 = load i8*, i8** %10
%70 = getelementptr inbounds i8, i8* %69, i64 1
%71 = load i8, i8* %70
%72 = zext i8 %71 to i32
%73 = load i8*, i8** %10
%74 = getelementptr inbounds i8, i8* %73, i64 2
%75 = load i8, i8* %74
%76 = zext i8 %75 to i32
%77 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %64, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %68, i32 %72, i32 %76)
%78 = load i32, i32* %4
%79 = load i8*, i8** %10
%80 = getelementptr inbounds i8, i8* %79, i64 3
%81 = load i8, i8* %80
%82 = zext i8 %81 to i32
%83 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %78, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 %82)
%84 = load i8*, i8** %10
%85 = getelementptr inbounds i8, i8* %84, i64 3
%86 = load i8, i8* %85
%87 = zext i8 %86 to i32
store i32 %87, i32* %8
%88 = load i8*, i8** %10
%89 = getelementptr inbounds i8, i8* %88, i64 4
store i8* %89, i8** %10
%90 = load i32, i32* %8
%91 = icmp ne i32 0, %90
br i1 %91, label %92, label %114
92: ; preds = %42
%93 = load i32, i32* %4
%94 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %93, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %7
br label %95
95: ; preds = %108, %92
%96 = load i32, i32* %7
%97 = load i32, i32* %8
%98 = icmp ult i32 %96, %97
br i1 %98, label %99, label %111
99: ; preds = %95
%100 = load i32, i32* %4
%101 = load i8*, i8** %10
%102 = load i32, i32* %7
%103 = zext i32 %102 to i64
%104 = getelementptr inbounds i8, i8* %101, i64 %103
%105 = load i8, i8* %104
%106 = zext i8 %105 to i32
%107 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %100, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %106)
br label %108
108: ; preds = %99
%109 = load i32, i32* %7
%110 = add i32 %109, 1
store i32 %110, i32* %7
br label %95
111: ; preds = %95
%112 = load i32, i32* %4
%113 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %112, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %114
114: ; preds = %111, %42
%115 = load i32, i32* %8
%116 = load i8*, i8** %10
%117 = zext i32 %115 to i64
%118 = getelementptr inbounds i8, i8* %116, i64 %117
store i8* %118, i8** %10
%119 = load i32, i32* %8
%120 = add i32 %119, 4
store i32 %120, i32* %8
%121 = load i8*, i8** %10
%122 = getelementptr inbounds i8, i8* %121, i64 0
%123 = load i8, i8* %122
%124 = zext i8 %123 to i32
store i32 %124, i32* %9
%125 = load i32, i32* %4
%126 = load i32, i32* %9
%127 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %125, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i32 %126)
%128 = load i8*, i8** %10
%129 = getelementptr inbounds i8, i8* %128, i64 1
store i8* %129, i8** %10
%130 = load i32, i32* %9
%131 = icmp ne i32 0, %130
br i1 %131, label %132, label %154
132: ; preds = %114
%133 = load i32, i32* %4
%134 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %133, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %7
br label %135
135: ; preds = %148, %132
%136 = load i32, i32* %7
%137 = load i32, i32* %9
%138 = icmp ult i32 %136, %137
br i1 %138, label %139, label %151
139: ; preds = %135
%140 = load i32, i32* %4
%141 = load i8*, i8** %10
%142 = load i32, i32* %7
%143 = zext i32 %142 to i64
%144 = getelementptr inbounds i8, i8* %141, i64 %143
%145 = load i8, i8* %144
%146 = zext i8 %145 to i32
%147 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %140, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %146)
br label %148
148: ; preds = %139
%149 = load i32, i32* %7
%150 = add i32 %149, 1
store i32 %150, i32* %7
br label %135
151: ; preds = %135
%152 = load i32, i32* %4
%153 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %152, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %154
154: ; preds = %151, %114
%155 = load i32, i32* %9
%156 = load i32, i32* %8
%157 = add i32 %156, %155
store i32 %157, i32* %8
%158 = load i32, i32* %8
%159 = add i32 %158, 1
store i32 %159, i32* %8
%160 = load i32, i32* %9
%161 = load i8*, i8** %10
%162 = zext i32 %160 to i64
%163 = getelementptr inbounds i8, i8* %161, i64 %162
store i8* %163, i8** %10
br label %164
164: ; preds = %154
%165 = load i32, i32* %8
%166 = load i32, i32* %6
%167 = add i32 %166, %165
store i32 %167, i32* %6
br label %35
168: ; preds = %35
br label %169
169: ; preds = %168, %14
%170 = load i32, i32* %4
%171 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %170, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
%172 = load i8*, i8** %5
%173 = getelementptr inbounds i8, i8* %172, i64 1
%174 = load i8, i8* %173
%175 = zext i8 %174 to i32
store i32 %175, i32* %3
br label %176
176: ; preds = %169, %13
%177 = load i32, i32* %3
ret i32 %177
}

LLVM IR (-O2):
@.str = [26 x i8] c"Descriptor_length = 0x%x\0A\00"
@.str.1 = [30 x i8] c"ISO_639_language_code = 0x%x\0A\00"
@.str.2 = [32 x i8] c"ISO_639_language_code : %c%c%c\0A\00"
@.str.3 = [37 x i8] c"service_provider_name_length = 0x%x\0A\00"
@.str.4 = [24 x i8] c"service_provider_name: \00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [28 x i8] c"service_name_length = 0x%x\0A\00"
@.str.8 = [15 x i8] c"service_name: \00"
@.str.9 = [17 x i8] c"******END******\0A\00"
define i32 @x5D_Tag_DescriptorParser(i32 %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %93, 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 = load i8, i8* %7
%12 = icmp eq i8 %11, 0
br i1 %12, label %89, label %13
13: ; preds = %4
%14 = getelementptr inbounds i8, i8* %1, i64 2
br label %15
15: ; preds = %13, %80
%16 = phi i8* [ %82, %80 ], [ %14, %13 ]
%17 = phi i32 [ %85, %80 ], [ 0, %13 ]
%18 = load i8, i8* %16
%19 = zext i8 %18 to i32
%20 = shl nuw nsw i32 %19, 16
%21 = getelementptr inbounds i8, i8* %16, i64 1
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = shl nuw nsw i32 %23, 8
%25 = or i32 %24, %20
%26 = getelementptr inbounds i8, i8* %16, i64 2
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = or i32 %25, %28
%30 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %0, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = load i8, i8* %16
%32 = zext i8 %31 to i32
%33 = load i8, i8* %21
%34 = zext i8 %33 to i32
%35 = load i8, i8* %26
%36 = zext i8 %35 to i32
%37 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %32, i32 %34, i32 %36)
%38 = getelementptr inbounds i8, i8* %16, i64 3
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %0, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i32 %40)
%42 = load i8, i8* %38
%43 = zext i8 %42 to i32
%44 = getelementptr inbounds i8, i8* %16, i64 4
%45 = icmp eq i8 %42, 0
br i1 %45, label %59, label %46
46: ; preds = %15
%47 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%48 = zext i8 %42 to i64
br label %49
49: ; preds = %46, %49
%50 = phi i64 [ 0, %46 ], [ %55, %49 ]
%51 = getelementptr inbounds i8, i8* %44, i64 %50
%52 = load i8, i8* %51
%53 = zext i8 %52 to i32
%54 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %53)
%55 = add nuw nsw i64 %50, 1
%56 = icmp eq i64 %55, %48
br i1 %56, label %57, label %49
57: ; preds = %49
%58 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %59
59: ; preds = %57, %15
%60 = zext i8 %42 to i64
%61 = getelementptr inbounds i8, i8* %44, i64 %60
%62 = load i8, i8* %61
%63 = zext i8 %62 to i32
%64 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %0, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i32 %63)
%65 = getelementptr inbounds i8, i8* %61, i64 1
%66 = icmp eq i8 %62, 0
br i1 %66, label %80, label %67
67: ; preds = %59
%68 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%69 = zext i8 %62 to i64
br label %70
70: ; preds = %67, %70
%71 = phi i64 [ 0, %67 ], [ %76, %70 ]
%72 = getelementptr inbounds i8, i8* %65, i64 %71
%73 = load i8, i8* %72
%74 = zext i8 %73 to i32
%75 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %74)
%76 = add nuw nsw i64 %71, 1
%77 = icmp eq i64 %76, %69
br i1 %77, label %78, label %70
78: ; preds = %70
%79 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %80
80: ; preds = %78, %59
%81 = zext i8 %62 to i64
%82 = getelementptr inbounds i8, i8* %65, i64 %81
%83 = add i32 %17, 5
%84 = add i32 %83, %43
%85 = add i32 %84, %63
%86 = load i8, i8* %7
%87 = zext i8 %86 to i32
%88 = icmp ult i32 %85, %87
br i1 %88, label %15, label %89
89: ; preds = %80, %4
%90 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
%91 = load i8, i8* %7
%92 = zext i8 %91 to i32
br label %93
93: ; preds = %2, %89
%94 = phi i32 [ %92, %89 ], [ -1, %2 ]
ret i32 %94
}