#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_TsPacketLog(int, char *, ...);
int x00_Tag_DescriptorParser(int, unsigned char *);
int x41_Tag_DescriptorParser(int, unsigned char *);
int x47_Tag_DescriptorParser(int, unsigned char *);
int x4A_Tag_DescriptorParser(int, unsigned char *);
int x5F_Tag_DescriptorParser(int, unsigned char *);
int Parser_SectionBAT(unsigned char *section) {
  unsigned short section_len = 0;
  unsigned short descriptor_loop_len = 0;
  unsigned short transport_stream_loop_len = 0;
  unsigned short transport_stream_offset = 0;
  unsigned int i = 0, j = 0;
  unsigned int data_offset = 0;
  int descriptor_offset = 0;
  int ret = -1;
  if (NULL == section) {
    Parser_TsPacketLog((0x00000020), "BAT error: section is NULL !\n");
    return -1;
  }
  if (0x4A != section[0]) {
    Parser_TsPacketLog((0x00000020), "BAT table id is error : %x\n",
                       section[0]);
    return -1;
  }
  section_len = ((section[1] & 0x0F) << 8) | (section[2] & 0xFF);
  Parser_TsPacketLog((0x00000020),
                     "****************BAT Info****************\n");
  Parser_TsPacketLog((0x00000020), "BAT table id = 0x%x\n", section[0]);
  Parser_TsPacketLog((0x00000020), "BAT section_syntax_indicator = 0x%x\n",
                     (section[1] & 0x80) >> 7);
  Parser_TsPacketLog((0x00000020), "BAT section_length = 0x%x\n", section_len);
  Parser_TsPacketLog((0x00000020), "BAT bouquet_id = 0x%x\n",
                     ((section[3] & 0xFF) << 8) | (section[4] & 0xFF));
  Parser_TsPacketLog((0x00000020), "BAT version_number = 0x%x\n",
                     (section[5] & 0x3E) >> 1);
  Parser_TsPacketLog((0x00000020), "BAT current_next_indicator = 0x%x\n",
                     section[5] & 0x01);
  Parser_TsPacketLog((0x00000020), "BAT section_number = 0x%x\n", section[6]);
  Parser_TsPacketLog((0x00000020), "BAT last_section_number = 0x%x\n",
                     section[7]);
  Parser_TsPacketLog((0x00000020), "BAT bouquet_descriptors_length = 0x%x\n",
                     ((section[8] & 0x0F) << 8) | (section[9] & 0xFF));
  Parser_TsPacketLog((0x00000020), "BAT crc = 0x%08x\n",
                     (section[section_len - 1] << 24) |
                         ((section[section_len] & 0xFF) << 16) |
                         ((section[section_len + 1] & 0xFF) << 8) |
                         (section[section_len + 2] & 0xFF));
  descriptor_loop_len = ((section[8] & 0x0F) << 8) | (section[9] & 0xFF);
  data_offset += 10;
  for (i = 0; i < descriptor_loop_len; i += descriptor_offset) {
    switch (section[data_offset]) {
    case 0x47:
      descriptor_offset =
          x47_Tag_DescriptorParser((0x00000020), section + data_offset);
      break;
    case 0x4A:
      descriptor_offset =
          x4A_Tag_DescriptorParser((0x00000020), section + data_offset);
      break;
    case 0x5F:
      descriptor_offset =
          x5F_Tag_DescriptorParser((0x00000020), section + data_offset);
      break;
    default:
      descriptor_offset =
          x00_Tag_DescriptorParser((0x00000020), section + data_offset);
      break;
    }
    descriptor_offset += 2;
    data_offset += descriptor_offset;
  }
  transport_stream_loop_len =
      ((section[data_offset] & 0x0F) << 8) | (section[data_offset + 1] & 0xFF);
  Parser_TsPacketLog((0x00000020), "BAT transport_stream_loop_length = 0x%x\n",
                     transport_stream_loop_len);
  data_offset += 2;
  descriptor_offset = 0;
  for (i = 0; i < transport_stream_loop_len; i += transport_stream_offset) {
    Parser_TsPacketLog((0x00000020), "BAT transport_stream_id = 0x%x\n",
                       ((section[data_offset] & 0xFF) << 8) |
                           (section[data_offset + 1] & 0xFF));
    Parser_TsPacketLog((0x00000020), "BAT original_network_id = 0x%x\n",
                       ((section[data_offset + 2] & 0xFF) << 8) |
                           (section[data_offset + 3] & 0xFF));
    descriptor_loop_len = ((section[data_offset + 4] & 0x0F) << 8) |
                          (section[data_offset + 5] & 0xFF);
    Parser_TsPacketLog((0x00000020),
                       "BAT transport_descriptors_length = 0x%x\n",
                       descriptor_loop_len);
    data_offset += 6;
    for (j = 0; j < descriptor_loop_len; j += descriptor_offset) {
      switch (section[data_offset]) {
      case 0x41:
        descriptor_offset =
            x41_Tag_DescriptorParser((0x00000020), section + data_offset);
        break;
      default:
        descriptor_offset =
            x00_Tag_DescriptorParser((0x00000020), section + data_offset);
        break;
      }
      descriptor_offset += 2;
      data_offset += descriptor_offset;
    }
    transport_stream_offset = descriptor_loop_len;
    transport_stream_offset += 6;
  }
  Parser_TsPacketLog((0x00000020),
                     "****************************************\n");
  ret = 0;
  return ret;
}


x86 assembly (clang, -O0):
<Parser_SectionBAT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movw   $0x0,-0x12(%rbp)
movw   $0x0,-0x14(%rbp)
movw   $0x0,-0x16(%rbp)
movw   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0xffffffff,-0x2c(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    11d2 <Parser_SectionBAT+0x72>
mov    $0x20,%edi
lea    0xe41(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    16ea <Parser_SectionBAT+0x58a>
mov    -0x10(%rbp),%rax
movzbl (%rax),%ecx
mov    $0x4a,%eax
cmp    %ecx,%eax
je     120c <Parser_SectionBAT+0xac>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edx
mov    $0x20,%edi
lea    0xe25(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    16ea <Parser_SectionBAT+0x58a>
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%eax
and    $0xf,%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
and    $0xff,%ecx
or     %ecx,%eax
mov    %ax,-0x12(%rbp)
mov    $0x20,%edi
lea    0xe00(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edx
mov    $0x20,%edi
lea    0xe10(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%edx
and    $0x80,%edx
sar    $0x7,%edx
mov    $0x20,%edi
lea    0xe01(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
movzwl -0x12(%rbp),%edx
mov    $0x20,%edi
lea    0xe0f(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
mov    -0x10(%rbp),%rax
movzbl 0x3(%rax),%edx
and    $0xff,%edx
shl    $0x8,%edx
mov    -0x10(%rbp),%rax
movzbl 0x4(%rax),%eax
and    $0xff,%eax
or     %eax,%edx
mov    $0x20,%edi
lea    0xdf7(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
mov    -0x10(%rbp),%rax
movzbl 0x5(%rax),%edx
and    $0x3e,%edx
sar    $0x1,%edx
mov    $0x20,%edi
lea    0xded(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
mov    -0x10(%rbp),%rax
movzbl 0x5(%rax),%edx
and    $0x1,%edx
mov    $0x20,%edi
lea    0xdea(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
mov    -0x10(%rbp),%rax
movzbl 0x6(%rax),%edx
mov    $0x20,%edi
lea    0xdf2(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
mov    -0x10(%rbp),%rax
movzbl 0x7(%rax),%edx
mov    $0x20,%edi
lea    0xdf2(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
mov    -0x10(%rbp),%rax
movzbl 0x8(%rax),%edx
and    $0xf,%edx
shl    $0x8,%edx
mov    -0x10(%rbp),%rax
movzbl 0x9(%rax),%eax
and    $0xff,%eax
or     %eax,%edx
mov    $0x20,%edi
lea    0xde2(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
mov    -0x10(%rbp),%rax
movzwl -0x12(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edx
shl    $0x18,%edx
mov    -0x10(%rbp),%rax
movzwl -0x12(%rbp),%ecx
movzbl (%rax,%rcx,1),%eax
and    $0xff,%eax
shl    $0x10,%eax
or     %eax,%edx
mov    -0x10(%rbp),%rax
movzwl -0x12(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
and    $0xff,%eax
shl    $0x8,%eax
or     %eax,%edx
mov    -0x10(%rbp),%rax
movzwl -0x12(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
and    $0xff,%eax
or     %eax,%edx
mov    $0x20,%edi
lea    0xd96(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
mov    -0x10(%rbp),%rax
movzbl 0x8(%rax),%eax
and    $0xf,%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
movzbl 0x9(%rcx),%ecx
and    $0xff,%ecx
or     %ecx,%eax
mov    %ax,-0x14(%rbp)
mov    -0x24(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
movzwl -0x14(%rbp),%ecx
cmp    %ecx,%eax
jae    14eb <Parser_SectionBAT+0x38b>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x30(%rbp)
sub    $0x47,%eax
je     1460 <Parser_SectionBAT+0x300>
jmp    143e <Parser_SectionBAT+0x2de>
mov    -0x30(%rbp),%eax
sub    $0x4a,%eax
je     147c <Parser_SectionBAT+0x31c>
jmp    144f <Parser_SectionBAT+0x2ef>
mov    -0x30(%rbp),%eax
sub    $0x5f,%eax
je     1498 <Parser_SectionBAT+0x338>
jmp    14b4 <Parser_SectionBAT+0x354>
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%eax
add    %rax,%rsi
mov    $0x20,%edi
call   1040 <x47_Tag_DescriptorParser@plt>
mov    %eax,-0x28(%rbp)
jmp    14cb <Parser_SectionBAT+0x36b>
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%eax
add    %rax,%rsi
mov    $0x20,%edi
call   1070 <x4A_Tag_DescriptorParser@plt>
mov    %eax,-0x28(%rbp)
jmp    14cb <Parser_SectionBAT+0x36b>
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%eax
add    %rax,%rsi
mov    $0x20,%edi
call   1080 <x5F_Tag_DescriptorParser@plt>
mov    %eax,-0x28(%rbp)
jmp    14cb <Parser_SectionBAT+0x36b>
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%eax
add    %rax,%rsi
mov    $0x20,%edi
call   1060 <x00_Tag_DescriptorParser@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1413 <Parser_SectionBAT+0x2b3>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
movzbl (%rax,%rcx,1),%eax
and    $0xf,%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
mov    -0x24(%rbp),%edx
add    $0x1,%edx
mov    %edx,%edx
movzbl (%rcx,%rdx,1),%ecx
and    $0xff,%ecx
or     %ecx,%eax
mov    %ax,-0x16(%rbp)
movzwl -0x16(%rbp),%edx
mov    $0x20,%edi
lea    0xc5a(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
mov    -0x24(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
movzwl -0x16(%rbp),%ecx
cmp    %ecx,%eax
jae    16ca <Parser_SectionBAT+0x56a>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
movzbl (%rax,%rcx,1),%edx
and    $0xff,%edx
shl    $0x8,%edx
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
and    $0xff,%eax
or     %eax,%edx
mov    $0x20,%edi
lea    0xc1f(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x2,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%edx
and    $0xff,%edx
shl    $0x8,%edx
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x3,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
and    $0xff,%eax
or     %eax,%edx
mov    $0x20,%edi
lea    0xbfc(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x4,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
and    $0xf,%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
mov    -0x24(%rbp),%edx
add    $0x5,%edx
mov    %edx,%edx
movzbl (%rcx,%rdx,1),%ecx
and    $0xff,%ecx
or     %ecx,%eax
mov    %ax,-0x14(%rbp)
movzwl -0x14(%rbp),%edx
mov    $0x20,%edi
lea    0xbd3(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
mov    -0x24(%rbp),%eax
add    $0x6,%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
movzwl -0x14(%rbp),%ecx
cmp    %ecx,%eax
jae    16a8 <Parser_SectionBAT+0x548>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    (%rax,%rcx,1),%al
sub    $0x41,%al
jne    1671 <Parser_SectionBAT+0x511>
jmp    1655 <Parser_SectionBAT+0x4f5>
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%eax
add    %rax,%rsi
mov    $0x20,%edi
call   1030 <x41_Tag_DescriptorParser@plt>
mov    %eax,-0x28(%rbp)
jmp    1688 <Parser_SectionBAT+0x528>
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%eax
add    %rax,%rsi
mov    $0x20,%edi
call   1060 <x00_Tag_DescriptorParser@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    162f <Parser_SectionBAT+0x4cf>
mov    -0x14(%rbp),%ax
mov    %ax,-0x18(%rbp)
movzwl -0x18(%rbp),%eax
add    $0x6,%eax
mov    %ax,-0x18(%rbp)
movzwl -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1546 <Parser_SectionBAT+0x3e6>
mov    $0x20,%edi
lea    0xb3e(%rip),%rsi
mov    $0x0,%al
call   1050 <Parser_TsPacketLog@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Parser_SectionBAT>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     1467 <Parser_SectionBAT+0x307>
mov    %rdi,%r13
movzbl (%rdi),%edx
cmp    $0x4a,%edx
jne    1481 <Parser_SectionBAT+0x321>
movzbl 0x1(%r13),%eax
and    $0xf,%eax
shl    $0x8,%rax
movzbl 0x2(%r13),%r14d
or     %rax,%r14
lea    0xe9c(%rip),%rsi
xor    %r15d,%r15d
mov    $0x20,%edi
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
movzbl 0x0(%r13),%edx
lea    0xeab(%rip),%rsi
mov    $0x20,%edi
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
movzbl 0x1(%r13),%edx
shr    $0x7,%edx
lea    0xea5(%rip),%rsi
mov    $0x20,%edi
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
lea    0xeb7(%rip),%rsi
mov    $0x20,%edi
mov    %r14d,%edx
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
movzwl 0x3(%r13),%edx
shl    $0x10,%edx
bswap  %edx
lea    0xeb2(%rip),%rsi
mov    $0x20,%edi
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
movzbl 0x5(%r13),%edx
shr    %edx
and    $0x1f,%edx
lea    0xeac(%rip),%rsi
mov    $0x20,%edi
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
movzbl 0x5(%r13),%edx
and    $0x1,%edx
lea    0xeac(%rip),%rsi
mov    $0x20,%edi
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
movzbl 0x6(%r13),%edx
lea    0xeb7(%rip),%rsi
mov    $0x20,%edi
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
movzbl 0x7(%r13),%edx
lea    0xeba(%rip),%rsi
mov    $0x20,%edi
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
movzbl 0x8(%r13),%eax
and    $0xf,%eax
shl    $0x8,%eax
movzbl 0x9(%r13),%edx
or     %eax,%edx
lea    0xeb5(%rip),%rsi
mov    $0x20,%edi
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
mov    -0x1(%r13,%r14,1),%edx
bswap  %edx
lea    0xec2(%rip),%rsi
mov    $0x20,%edi
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
movzbl 0x8(%r13),%eax
and    $0xf,%eax
shl    $0x8,%eax
movzbl 0x9(%r13),%ebp
mov    $0xa,%ebx
or     %eax,%ebp
jne    142a <Parser_SectionBAT+0x2ca>
mov    %ebx,%eax
movzbl 0x0(%r13,%rax,1),%ebp
and    $0xf,%ebp
shl    $0x8,%ebp
lea    0x1(%rbx),%eax
movzbl 0x0(%r13,%rax,1),%r14d
lea    0xe8d(%rip),%rsi
mov    %ebp,%edx
or     %r14d,%edx
mov    $0x20,%edi
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
or     %r14d,%ebp
mov    %ebp,0x4(%rsp)
je     149b <Parser_SectionBAT+0x33b>
add    $0x2,%ebx
xor    %r14d,%r14d
jmp    1332 <Parser_SectionBAT+0x1d2>
nopl   0x0(%rax,%rax,1)
add    %r15d,%r14d
add    $0x6,%r14d
cmp    0x4(%rsp),%r14d
jae    149b <Parser_SectionBAT+0x33b>
mov    %ebx,%eax
movzbl 0x0(%r13,%rax,1),%eax
shl    $0x8,%eax
lea    0x1(%rbx),%ecx
movzbl 0x0(%r13,%rcx,1),%edx
or     %eax,%edx
mov    $0x20,%edi
lea    0xe57(%rip),%rsi
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
lea    0x2(%rbx),%eax
movzbl 0x0(%r13,%rax,1),%eax
shl    $0x8,%eax
lea    0x3(%rbx),%ecx
movzbl 0x0(%r13,%rcx,1),%edx
or     %eax,%edx
mov    $0x20,%edi
lea    0xe4d(%rip),%rsi
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
lea    0x4(%rbx),%eax
movzbl 0x0(%r13,%rax,1),%r15d
and    $0xf,%r15d
shl    $0x8,%r15d
lea    0x5(%rbx),%eax
movzbl 0x0(%r13,%rax,1),%ebp
mov    %r15d,%edx
or     %ebp,%edx
mov    $0x20,%edi
lea    0xe3b(%rip),%rsi
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
add    $0x6,%ebx
or     %ebp,%r15d
je     1320 <Parser_SectionBAT+0x1c0>
xor    %r12d,%r12d
jmp    13ef <Parser_SectionBAT+0x28f>
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1060 <x00_Tag_DescriptorParser@plt>
add    %eax,%ebx
add    $0x2,%ebx
add    %eax,%r12d
add    $0x2,%r12d
cmp    %r15d,%r12d
jae    1320 <Parser_SectionBAT+0x1c0>
mov    %ebx,%eax
lea    (%rax,%r13,1),%rsi
cmpb   $0x41,0x0(%r13,%rax,1)
jne    13d0 <Parser_SectionBAT+0x270>
mov    $0x20,%edi
call   1030 <x41_Tag_DescriptorParser@plt>
jmp    13da <Parser_SectionBAT+0x27a>
nopl   0x0(%rax)
call   1070 <x4A_Tag_DescriptorParser@plt>
add    %eax,%ebx
add    $0x2,%ebx
add    %eax,%r15d
add    $0x2,%r15d
cmp    %ebp,%r15d
jae    12d7 <Parser_SectionBAT+0x177>
mov    %ebx,%eax
lea    (%rax,%r13,1),%rsi
movzbl 0x0(%r13,%rax,1),%eax
mov    $0x20,%edi
cmp    $0x5f,%al
je     1450 <Parser_SectionBAT+0x2f0>
cmp    $0x4a,%al
je     1410 <Parser_SectionBAT+0x2b0>
cmp    $0x47,%al
jne    1460 <Parser_SectionBAT+0x300>
call   1040 <x47_Tag_DescriptorParser@plt>
jmp    1415 <Parser_SectionBAT+0x2b5>
xchg   %ax,%ax
call   1080 <x5F_Tag_DescriptorParser@plt>
jmp    1415 <Parser_SectionBAT+0x2b5>
nopw   0x0(%rax,%rax,1)
call   1060 <x00_Tag_DescriptorParser@plt>
jmp    1415 <Parser_SectionBAT+0x2b5>
lea    0xb92(%rip),%rsi
mov    $0x20,%edi
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
mov    $0xffffffff,%ebx
jmp    14b0 <Parser_SectionBAT+0x350>
lea    0xb96(%rip),%rsi
mov    $0x20,%edi
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
mov    $0xffffffff,%ebx
jmp    14b0 <Parser_SectionBAT+0x350>
lea    0xd72(%rip),%rsi
xor    %ebx,%ebx
mov    $0x20,%edi
xor    %eax,%eax
call   1050 <Parser_TsPacketLog@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"BAT error: section is NULL !\0A\00"
@.str.1 = [28 x i8] c"BAT table id is error : %x\0A\00"
@.str.2 = [42 x i8] c"****************BAT Info****************\0A\00"
@.str.3 = [21 x i8] c"BAT table id = 0x%x\0A\00"
@.str.4 = [37 x i8] c"BAT section_syntax_indicator = 0x%x\0A\00"
@.str.5 = [27 x i8] c"BAT section_length = 0x%x\0A\00"
@.str.6 = [23 x i8] c"BAT bouquet_id = 0x%x\0A\00"
@.str.7 = [27 x i8] c"BAT version_number = 0x%x\0A\00"
@.str.8 = [35 x i8] c"BAT current_next_indicator = 0x%x\0A\00"
@.str.9 = [27 x i8] c"BAT section_number = 0x%x\0A\00"
@.str.10 = [32 x i8] c"BAT last_section_number = 0x%x\0A\00"
@.str.11 = [39 x i8] c"BAT bouquet_descriptors_length = 0x%x\0A\00"
@.str.12 = [18 x i8] c"BAT crc = 0x%08x\0A\00"
@.str.13 = [41 x i8] c"BAT transport_stream_loop_length = 0x%x\0A\00"
@.str.14 = [32 x i8] c"BAT transport_stream_id = 0x%x\0A\00"
@.str.15 = [32 x i8] c"BAT original_network_id = 0x%x\0A\00"
@.str.16 = [41 x i8] c"BAT transport_descriptors_length = 0x%x\0A\00"
@.str.17 = [42 x i8] c"****************************************\0A\00"
define i32 @Parser_SectionBAT(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i16
%5 = alloca i16
%6 = alloca i16
%7 = alloca i16
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %3
store i16 0, i16* %4
store i16 0, i16* %5
store i16 0, i16* %6
store i16 0, i16* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 -1, i32* %12
%13 = load i8*, i8** %3
%14 = icmp eq i8* null, %13
br i1 %14, label %15, label %17
15: ; preds = %1
%16 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %348
17: ; preds = %1
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i64 0
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = icmp ne i32 74, %21
br i1 %22, label %23, label %29
23: ; preds = %17
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i64 0
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %27)
store i32 -1, i32* %2
br label %348
29: ; preds = %17
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i64 1
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = and i32 %33, 15
%35 = shl i32 %34, 8
%36 = load i8*, i8** %3
%37 = getelementptr inbounds i8, i8* %36, i64 2
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = and i32 %39, 255
%41 = or i32 %35, %40
%42 = trunc i32 %41 to i16
store i16 %42, i16* %4
%43 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%44 = load i8*, i8** %3
%45 = getelementptr inbounds i8, i8* %44, i64 0
%46 = load i8, i8* %45
%47 = zext i8 %46 to i32
%48 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %47)
%49 = load i8*, i8** %3
%50 = getelementptr inbounds i8, i8* %49, i64 1
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = and i32 %52, 128
%54 = ashr i32 %53, 7
%55 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i32 %54)
%56 = load i16, i16* %4
%57 = zext i16 %56 to i32
%58 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %57)
%59 = load i8*, i8** %3
%60 = getelementptr inbounds i8, i8* %59, i64 3
%61 = load i8, i8* %60
%62 = zext i8 %61 to i32
%63 = and i32 %62, 255
%64 = shl i32 %63, 8
%65 = load i8*, i8** %3
%66 = getelementptr inbounds i8, i8* %65, i64 4
%67 = load i8, i8* %66
%68 = zext i8 %67 to i32
%69 = and i32 %68, 255
%70 = or i32 %64, %69
%71 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %70)
%72 = load i8*, i8** %3
%73 = getelementptr inbounds i8, i8* %72, i64 5
%74 = load i8, i8* %73
%75 = zext i8 %74 to i32
%76 = and i32 %75, 62
%77 = ashr i32 %76, 1
%78 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i32 %77)
%79 = load i8*, i8** %3
%80 = getelementptr inbounds i8, i8* %79, i64 5
%81 = load i8, i8* %80
%82 = zext i8 %81 to i32
%83 = and i32 %82, 1
%84 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0), i32 %83)
%85 = load i8*, i8** %3
%86 = getelementptr inbounds i8, i8* %85, i64 6
%87 = load i8, i8* %86
%88 = zext i8 %87 to i32
%89 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i32 %88)
%90 = load i8*, i8** %3
%91 = getelementptr inbounds i8, i8* %90, i64 7
%92 = load i8, i8* %91
%93 = zext i8 %92 to i32
%94 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0), i32 %93)
%95 = load i8*, i8** %3
%96 = getelementptr inbounds i8, i8* %95, i64 8
%97 = load i8, i8* %96
%98 = zext i8 %97 to i32
%99 = and i32 %98, 15
%100 = shl i32 %99, 8
%101 = load i8*, i8** %3
%102 = getelementptr inbounds i8, i8* %101, i64 9
%103 = load i8, i8* %102
%104 = zext i8 %103 to i32
%105 = and i32 %104, 255
%106 = or i32 %100, %105
%107 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.11, i64 0, i64 0), i32 %106)
%108 = load i8*, i8** %3
%109 = load i16, i16* %4
%110 = zext i16 %109 to i32
%111 = sub nsw i32 %110, 1
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i8, i8* %108, i64 %112
%114 = load i8, i8* %113
%115 = zext i8 %114 to i32
%116 = shl i32 %115, 24
%117 = load i8*, i8** %3
%118 = load i16, i16* %4
%119 = zext i16 %118 to i64
%120 = getelementptr inbounds i8, i8* %117, i64 %119
%121 = load i8, i8* %120
%122 = zext i8 %121 to i32
%123 = and i32 %122, 255
%124 = shl i32 %123, 16
%125 = or i32 %116, %124
%126 = load i8*, i8** %3
%127 = load i16, i16* %4
%128 = zext i16 %127 to i32
%129 = add nsw i32 %128, 1
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i8, i8* %126, i64 %130
%132 = load i8, i8* %131
%133 = zext i8 %132 to i32
%134 = and i32 %133, 255
%135 = shl i32 %134, 8
%136 = or i32 %125, %135
%137 = load i8*, i8** %3
%138 = load i16, i16* %4
%139 = zext i16 %138 to i32
%140 = add nsw i32 %139, 2
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds i8, i8* %137, i64 %141
%143 = load i8, i8* %142
%144 = zext i8 %143 to i32
%145 = and i32 %144, 255
%146 = or i32 %136, %145
%147 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i32 %146)
%148 = load i8*, i8** %3
%149 = getelementptr inbounds i8, i8* %148, i64 8
%150 = load i8, i8* %149
%151 = zext i8 %150 to i32
%152 = and i32 %151, 15
%153 = shl i32 %152, 8
%154 = load i8*, i8** %3
%155 = getelementptr inbounds i8, i8* %154, i64 9
%156 = load i8, i8* %155
%157 = zext i8 %156 to i32
%158 = and i32 %157, 255
%159 = or i32 %153, %158
%160 = trunc i32 %159 to i16
store i16 %160, i16* %5
%161 = load i32, i32* %10
%162 = add i32 %161, 10
store i32 %162, i32* %10
store i32 0, i32* %8
br label %163
163: ; preds = %205, %29
%164 = load i32, i32* %8
%165 = load i16, i16* %5
%166 = zext i16 %165 to i32
%167 = icmp ult i32 %164, %166
br i1 %167, label %168, label %209
168: ; preds = %163
%169 = load i8*, i8** %3
%170 = load i32, i32* %10
%171 = zext i32 %170 to i64
%172 = getelementptr inbounds i8, i8* %169, i64 %171
%173 = load i8, i8* %172
%174 = zext i8 %173 to i32
switch i32 %174, label %193 [
i32 71, label %175
i32 74, label %181
i32 95, label %187
]
175: ; preds = %168
%176 = load i8*, i8** %3
%177 = load i32, i32* %10
%178 = zext i32 %177 to i64
%179 = getelementptr inbounds i8, i8* %176, i64 %178
%180 = call i32 @x47_Tag_DescriptorParser(i32 32, i8* %179)
store i32 %180, i32* %11
br label %199
181: ; preds = %168
%182 = load i8*, i8** %3
%183 = load i32, i32* %10
%184 = zext i32 %183 to i64
%185 = getelementptr inbounds i8, i8* %182, i64 %184
%186 = call i32 @x4A_Tag_DescriptorParser(i32 32, i8* %185)
store i32 %186, i32* %11
br label %199
187: ; preds = %168
%188 = load i8*, i8** %3
%189 = load i32, i32* %10
%190 = zext i32 %189 to i64
%191 = getelementptr inbounds i8, i8* %188, i64 %190
%192 = call i32 @x5F_Tag_DescriptorParser(i32 32, i8* %191)
store i32 %192, i32* %11
br label %199
193: ; preds = %168
%194 = load i8*, i8** %3
%195 = load i32, i32* %10
%196 = zext i32 %195 to i64
%197 = getelementptr inbounds i8, i8* %194, i64 %196
%198 = call i32 @x00_Tag_DescriptorParser(i32 32, i8* %197)
store i32 %198, i32* %11
br label %199
199: ; preds = %193, %187, %181, %175
%200 = load i32, i32* %11
%201 = add nsw i32 %200, 2
store i32 %201, i32* %11
%202 = load i32, i32* %11
%203 = load i32, i32* %10
%204 = add i32 %203, %202
store i32 %204, i32* %10
br label %205
205: ; preds = %199
%206 = load i32, i32* %11
%207 = load i32, i32* %8
%208 = add i32 %207, %206
store i32 %208, i32* %8
br label %163
209: ; preds = %163
%210 = load i8*, i8** %3
%211 = load i32, i32* %10
%212 = zext i32 %211 to i64
%213 = getelementptr inbounds i8, i8* %210, i64 %212
%214 = load i8, i8* %213
%215 = zext i8 %214 to i32
%216 = and i32 %215, 15
%217 = shl i32 %216, 8
%218 = load i8*, i8** %3
%219 = load i32, i32* %10
%220 = add i32 %219, 1
%221 = zext i32 %220 to i64
%222 = getelementptr inbounds i8, i8* %218, i64 %221
%223 = load i8, i8* %222
%224 = zext i8 %223 to i32
%225 = and i32 %224, 255
%226 = or i32 %217, %225
%227 = trunc i32 %226 to i16
store i16 %227, i16* %6
%228 = load i16, i16* %6
%229 = zext i16 %228 to i32
%230 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.13, i64 0, i64 0), i32 %229)
%231 = load i32, i32* %10
%232 = add i32 %231, 2
store i32 %232, i32* %10
store i32 0, i32* %11
store i32 0, i32* %8
br label %233
233: ; preds = %340, %209
%234 = load i32, i32* %8
%235 = load i16, i16* %6
%236 = zext i16 %235 to i32
%237 = icmp ult i32 %234, %236
br i1 %237, label %238, label %345
238: ; preds = %233
%239 = load i8*, i8** %3
%240 = load i32, i32* %10
%241 = zext i32 %240 to i64
%242 = getelementptr inbounds i8, i8* %239, i64 %241
%243 = load i8, i8* %242
%244 = zext i8 %243 to i32
%245 = and i32 %244, 255
%246 = shl i32 %245, 8
%247 = load i8*, i8** %3
%248 = load i32, i32* %10
%249 = add i32 %248, 1
%250 = zext i32 %249 to i64
%251 = getelementptr inbounds i8, i8* %247, i64 %250
%252 = load i8, i8* %251
%253 = zext i8 %252 to i32
%254 = and i32 %253, 255
%255 = or i32 %246, %254
%256 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.14, i64 0, i64 0), i32 %255)
%257 = load i8*, i8** %3
%258 = load i32, i32* %10
%259 = add i32 %258, 2
%260 = zext i32 %259 to i64
%261 = getelementptr inbounds i8, i8* %257, i64 %260
%262 = load i8, i8* %261
%263 = zext i8 %262 to i32
%264 = and i32 %263, 255
%265 = shl i32 %264, 8
%266 = load i8*, i8** %3
%267 = load i32, i32* %10
%268 = add i32 %267, 3
%269 = zext i32 %268 to i64
%270 = getelementptr inbounds i8, i8* %266, i64 %269
%271 = load i8, i8* %270
%272 = zext i8 %271 to i32
%273 = and i32 %272, 255
%274 = or i32 %265, %273
%275 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.15, i64 0, i64 0), i32 %274)
%276 = load i8*, i8** %3
%277 = load i32, i32* %10
%278 = add i32 %277, 4
%279 = zext i32 %278 to i64
%280 = getelementptr inbounds i8, i8* %276, i64 %279
%281 = load i8, i8* %280
%282 = zext i8 %281 to i32
%283 = and i32 %282, 15
%284 = shl i32 %283, 8
%285 = load i8*, i8** %3
%286 = load i32, i32* %10
%287 = add i32 %286, 5
%288 = zext i32 %287 to i64
%289 = getelementptr inbounds i8, i8* %285, i64 %288
%290 = load i8, i8* %289
%291 = zext i8 %290 to i32
%292 = and i32 %291, 255
%293 = or i32 %284, %292
%294 = trunc i32 %293 to i16
store i16 %294, i16* %5
%295 = load i16, i16* %5
%296 = zext i16 %295 to i32
%297 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.16, i64 0, i64 0), i32 %296)
%298 = load i32, i32* %10
%299 = add i32 %298, 6
store i32 %299, i32* %10
store i32 0, i32* %9
br label %300
300: ; preds = %330, %238
%301 = load i32, i32* %9
%302 = load i16, i16* %5
%303 = zext i16 %302 to i32
%304 = icmp ult i32 %301, %303
br i1 %304, label %305, label %334
305: ; preds = %300
%306 = load i8*, i8** %3
%307 = load i32, i32* %10
%308 = zext i32 %307 to i64
%309 = getelementptr inbounds i8, i8* %306, i64 %308
%310 = load i8, i8* %309
%311 = zext i8 %310 to i32
switch i32 %311, label %318 [
i32 65, label %312
]
312: ; preds = %305
%313 = load i8*, i8** %3
%314 = load i32, i32* %10
%315 = zext i32 %314 to i64
%316 = getelementptr inbounds i8, i8* %313, i64 %315
%317 = call i32 @x41_Tag_DescriptorParser(i32 32, i8* %316)
store i32 %317, i32* %11
br label %324
318: ; preds = %305
%319 = load i8*, i8** %3
%320 = load i32, i32* %10
%321 = zext i32 %320 to i64
%322 = getelementptr inbounds i8, i8* %319, i64 %321
%323 = call i32 @x00_Tag_DescriptorParser(i32 32, i8* %322)
store i32 %323, i32* %11
br label %324
324: ; preds = %318, %312
%325 = load i32, i32* %11
%326 = add nsw i32 %325, 2
store i32 %326, i32* %11
%327 = load i32, i32* %11
%328 = load i32, i32* %10
%329 = add i32 %328, %327
store i32 %329, i32* %10
br label %330
330: ; preds = %324
%331 = load i32, i32* %11
%332 = load i32, i32* %9
%333 = add i32 %332, %331
store i32 %333, i32* %9
br label %300
334: ; preds = %300
%335 = load i16, i16* %5
store i16 %335, i16* %7
%336 = load i16, i16* %7
%337 = zext i16 %336 to i32
%338 = add nsw i32 %337, 6
%339 = trunc i32 %338 to i16
store i16 %339, i16* %7
br label %340
340: ; preds = %334
%341 = load i16, i16* %7
%342 = zext i16 %341 to i32
%343 = load i32, i32* %8
%344 = add i32 %343, %342
store i32 %344, i32* %8
br label %233
345: ; preds = %233
%346 = call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.17, i64 0, i64 0))
store i32 0, i32* %12
%347 = load i32, i32* %12
store i32 %347, i32* %2
br label %348
348: ; preds = %345, %23, %15
%349 = load i32, i32* %2
ret i32 %349
}

LLVM IR (-O2):
@.str = [30 x i8] c"BAT error: section is NULL !\0A\00"
@.str.1 = [28 x i8] c"BAT table id is error : %x\0A\00"
@.str.2 = [42 x i8] c"****************BAT Info****************\0A\00"
@.str.3 = [21 x i8] c"BAT table id = 0x%x\0A\00"
@.str.4 = [37 x i8] c"BAT section_syntax_indicator = 0x%x\0A\00"
@.str.5 = [27 x i8] c"BAT section_length = 0x%x\0A\00"
@.str.6 = [23 x i8] c"BAT bouquet_id = 0x%x\0A\00"
@.str.7 = [27 x i8] c"BAT version_number = 0x%x\0A\00"
@.str.8 = [35 x i8] c"BAT current_next_indicator = 0x%x\0A\00"
@.str.9 = [27 x i8] c"BAT section_number = 0x%x\0A\00"
@.str.10 = [32 x i8] c"BAT last_section_number = 0x%x\0A\00"
@.str.11 = [39 x i8] c"BAT bouquet_descriptors_length = 0x%x\0A\00"
@.str.12 = [18 x i8] c"BAT crc = 0x%08x\0A\00"
@.str.13 = [41 x i8] c"BAT transport_stream_loop_length = 0x%x\0A\00"
@.str.14 = [32 x i8] c"BAT transport_stream_id = 0x%x\0A\00"
@.str.15 = [32 x i8] c"BAT original_network_id = 0x%x\0A\00"
@.str.16 = [41 x i8] c"BAT transport_descriptors_length = 0x%x\0A\00"
@.str.17 = [42 x i8] c"****************************************\0A\00"
define i32 @Parser_SectionBAT(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %208
5: ; preds = %1
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 74
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = zext i8 %6 to i32
%10 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %208
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %0, i64 1
%13 = load i8, i8* %12
%14 = and i8 %13, 15
%15 = zext i8 %14 to i16
%16 = shl nuw nsw i16 %15, 8
%17 = getelementptr inbounds i8, i8* %0, i64 2
%18 = load i8, i8* %17
%19 = zext i8 %18 to i16
%20 = or i16 %16, %19
%21 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%22 = load i8, i8* %0
%23 = zext i8 %22 to i32
%24 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %23)
%25 = load i8, i8* %12
%26 = lshr i8 %25, 7
%27 = zext i8 %26 to i32
%28 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i32 %27)
%29 = zext i16 %20 to i32
%30 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds i8, i8* %0, i64 3
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = shl nuw nsw i32 %33, 8
%35 = getelementptr inbounds i8, i8* %0, i64 4
%36 = load i8, i8* %35
%37 = zext i8 %36 to i32
%38 = or i32 %34, %37
%39 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %38)
%40 = getelementptr inbounds i8, i8* %0, i64 5
%41 = load i8, i8* %40
%42 = lshr i8 %41, 1
%43 = and i8 %42, 31
%44 = zext i8 %43 to i32
%45 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i32 %44)
%46 = load i8, i8* %40
%47 = and i8 %46, 1
%48 = zext i8 %47 to i32
%49 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0), i32 %48)
%50 = getelementptr inbounds i8, i8* %0, i64 6
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i32 %52)
%54 = getelementptr inbounds i8, i8* %0, i64 7
%55 = load i8, i8* %54
%56 = zext i8 %55 to i32
%57 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0), i32 %56)
%58 = getelementptr inbounds i8, i8* %0, i64 8
%59 = load i8, i8* %58
%60 = and i8 %59, 15
%61 = zext i8 %60 to i32
%62 = shl nuw nsw i32 %61, 8
%63 = getelementptr inbounds i8, i8* %0, i64 9
%64 = load i8, i8* %63
%65 = zext i8 %64 to i32
%66 = or i32 %62, %65
%67 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.11, i64 0, i64 0), i32 %66)
%68 = add nsw i32 %29, -1
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8, i8* %0, i64 %69
%71 = load i8, i8* %70
%72 = zext i8 %71 to i32
%73 = shl nuw i32 %72, 24
%74 = zext i16 %20 to i64
%75 = getelementptr inbounds i8, i8* %0, i64 %74
%76 = load i8, i8* %75
%77 = zext i8 %76 to i32
%78 = shl nuw nsw i32 %77, 16
%79 = or i32 %78, %73
%80 = add nuw nsw i32 %29, 1
%81 = zext i32 %80 to i64
%82 = getelementptr inbounds i8, i8* %0, i64 %81
%83 = load i8, i8* %82
%84 = zext i8 %83 to i32
%85 = shl nuw nsw i32 %84, 8
%86 = or i32 %79, %85
%87 = add nuw nsw i32 %29, 2
%88 = zext i32 %87 to i64
%89 = getelementptr inbounds i8, i8* %0, i64 %88
%90 = load i8, i8* %89
%91 = zext i8 %90 to i32
%92 = or i32 %86, %91
%93 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i32 %92)
%94 = load i8, i8* %58
%95 = and i8 %94, 15
%96 = zext i8 %95 to i32
%97 = shl nuw nsw i32 %96, 8
%98 = load i8, i8* %63
%99 = zext i8 %98 to i32
%100 = or i32 %97, %99
%101 = icmp eq i32 %100, 0
br i1 %101, label %122, label %102
102: ; preds = %11, %116
%103 = phi i32 [ %119, %116 ], [ 10, %11 ]
%104 = phi i32 [ %120, %116 ], [ 0, %11 ]
%105 = zext i32 %103 to i64
%106 = getelementptr inbounds i8, i8* %0, i64 %105
%107 = load i8, i8* %106
switch i8 %107, label %114 [
i8 71, label %108
i8 74, label %110
i8 95, label %112
]
108: ; preds = %102
%109 = tail call i32 @x47_Tag_DescriptorParser(i32 32, i8* %106)
br label %116
110: ; preds = %102
%111 = tail call i32 @x4A_Tag_DescriptorParser(i32 32, i8* %106)
br label %116
112: ; preds = %102
%113 = tail call i32 @x5F_Tag_DescriptorParser(i32 32, i8* %106)
br label %116
114: ; preds = %102
%115 = tail call i32 @x00_Tag_DescriptorParser(i32 32, i8* %106)
br label %116
116: ; preds = %114, %112, %110, %108
%117 = phi i32 [ %115, %114 ], [ %113, %112 ], [ %111, %110 ], [ %109, %108 ]
%118 = add nsw i32 %117, 2
%119 = add i32 %118, %103
%120 = add i32 %118, %104
%121 = icmp ult i32 %120, %100
br i1 %121, label %102, label %122
122: ; preds = %116, %11
%123 = phi i32 [ 10, %11 ], [ %119, %116 ]
%124 = zext i32 %123 to i64
%125 = getelementptr inbounds i8, i8* %0, i64 %124
%126 = load i8, i8* %125
%127 = and i8 %126, 15
%128 = zext i8 %127 to i32
%129 = shl nuw nsw i32 %128, 8
%130 = add i32 %123, 1
%131 = zext i32 %130 to i64
%132 = getelementptr inbounds i8, i8* %0, i64 %131
%133 = load i8, i8* %132
%134 = zext i8 %133 to i32
%135 = or i32 %129, %134
%136 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.13, i64 0, i64 0), i32 %135)
%137 = icmp eq i32 %135, 0
br i1 %137, label %206, label %138
138: ; preds = %122
%139 = add i32 %123, 2
br label %140
140: ; preds = %138, %201
%141 = phi i32 [ %202, %201 ], [ %139, %138 ]
%142 = phi i32 [ %204, %201 ], [ 0, %138 ]
%143 = zext i32 %141 to i64
%144 = getelementptr inbounds i8, i8* %0, i64 %143
%145 = load i8, i8* %144
%146 = zext i8 %145 to i32
%147 = shl nuw nsw i32 %146, 8
%148 = add i32 %141, 1
%149 = zext i32 %148 to i64
%150 = getelementptr inbounds i8, i8* %0, i64 %149
%151 = load i8, i8* %150
%152 = zext i8 %151 to i32
%153 = or i32 %147, %152
%154 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.14, i64 0, i64 0), i32 %153)
%155 = add i32 %141, 2
%156 = zext i32 %155 to i64
%157 = getelementptr inbounds i8, i8* %0, i64 %156
%158 = load i8, i8* %157
%159 = zext i8 %158 to i32
%160 = shl nuw nsw i32 %159, 8
%161 = add i32 %141, 3
%162 = zext i32 %161 to i64
%163 = getelementptr inbounds i8, i8* %0, i64 %162
%164 = load i8, i8* %163
%165 = zext i8 %164 to i32
%166 = or i32 %160, %165
%167 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.15, i64 0, i64 0), i32 %166)
%168 = add i32 %141, 4
%169 = zext i32 %168 to i64
%170 = getelementptr inbounds i8, i8* %0, i64 %169
%171 = load i8, i8* %170
%172 = and i8 %171, 15
%173 = zext i8 %172 to i32
%174 = shl nuw nsw i32 %173, 8
%175 = add i32 %141, 5
%176 = zext i32 %175 to i64
%177 = getelementptr inbounds i8, i8* %0, i64 %176
%178 = load i8, i8* %177
%179 = zext i8 %178 to i32
%180 = or i32 %174, %179
%181 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.16, i64 0, i64 0), i32 %180)
%182 = add i32 %141, 6
%183 = icmp eq i32 %180, 0
br i1 %183, label %201, label %184
184: ; preds = %140, %195
%185 = phi i32 [ %198, %195 ], [ %182, %140 ]
%186 = phi i32 [ %199, %195 ], [ 0, %140 ]
%187 = zext i32 %185 to i64
%188 = getelementptr inbounds i8, i8* %0, i64 %187
%189 = load i8, i8* %188
%190 = icmp eq i8 %189, 65
br i1 %190, label %191, label %193
191: ; preds = %184
%192 = tail call i32 @x41_Tag_DescriptorParser(i32 32, i8* %188)
br label %195
193: ; preds = %184
%194 = tail call i32 @x00_Tag_DescriptorParser(i32 32, i8* %188)
br label %195
195: ; preds = %193, %191
%196 = phi i32 [ %192, %191 ], [ %194, %193 ]
%197 = add nsw i32 %196, 2
%198 = add i32 %197, %185
%199 = add i32 %197, %186
%200 = icmp ult i32 %199, %180
br i1 %200, label %184, label %201
201: ; preds = %195, %140
%202 = phi i32 [ %182, %140 ], [ %198, %195 ]
%203 = add i32 %142, 6
%204 = add i32 %203, %180
%205 = icmp ult i32 %204, %135
br i1 %205, label %140, label %206
206: ; preds = %201, %122
%207 = tail call i32 (i32, i8*, ...) @Parser_TsPacketLog(i32 32, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.17, i64 0, i64 0))
br label %208
208: ; preds = %206, %8, %3
%209 = phi i32 [ -1, %3 ], [ -1, %8 ], [ 0, %206 ]
ret i32 %209
}