// File: /workspace/github_cpp_makefile_star2_O2/salleaffaire[P]MXFParser/./mxf_base.hpp
// Function: mxf_file::decode_header_partition_pack(klv_item&)
int decode_header_partition_pack(klv_item &klv) {
      int rval = 0;
      
      bit_extractor be(klv.mValue, klv.mLength, BE_BIG_ENDIAN);
      
      m_header.m_hpp.m_major_version      = be.get_bits(16);
      m_header.m_hpp.m_minor_version      = be.get_bits(16);
      m_header.m_hpp.m_kag_size           = be.get_bits(32);
      m_header.m_hpp.m_this_partition     = be.get_64bits();
      m_header.m_hpp.m_previous_partition = be.get_64bits();
      m_header.m_hpp.m_footer_partition   = be.get_64bits();
      m_header.m_hpp.m_header_byte_count  = be.get_64bits();
      m_header.m_hpp.m_index_byte_count   = be.get_64bits();
      m_header.m_hpp.m_index_sid          = be.get_bits(32);
      m_header.m_hpp.m_body_offset        = be.get_64bits();
      m_header.m_hpp.m_body_sid           = be.get_bits(32);
      
      // UL of operational Pattern
      for (int i=0;i<16;++i) {
         m_header.m_hpp.m_operational_pattern.mKey[i] = be.get_bits(8);
      }

      // UL Batch - Skip the 8 bytes 
      be.get_64bits();
      
      uint32_t nunmber_of_ul = be.get_bytes_left();
      m_header.m_hpp.m_essence_containers = new Key<16>[nunmber_of_ul];

      for (int j=0;j<nunmber_of_ul;j++) {
         for (int i=0;i<16;++i) {
            m_header.m_hpp.m_essence_containers[j].mKey[i] = be.get_bits(8);
         }  
      }

      
#if 1
      
      std::cout << "  Major Version        = " << hex_to_string(m_header.m_hpp.m_major_version)
                << std::endl;
      std::cout << "  Minor Version        = " << hex_to_string(m_header.m_hpp.m_minor_version)
                << std::endl;
      std::cout << "  KAG Size             = " << hex_to_string(m_header.m_hpp.m_kag_size)
                << std::endl;
      std::cout << "  This Partition #     = " << hex_to_string(m_header.m_hpp.m_this_partition)
                << std::endl;
      std::cout << "  Previous Partition # = " << hex_to_string(m_header.m_hpp.m_previous_partition)
                << std::endl;
      std::cout << "  Footer Partition #   = " << hex_to_string(m_header.m_hpp.m_footer_partition)
                << std::endl;
      std::cout << "  Header Byte Count    = " << hex_to_string(m_header.m_hpp.m_header_byte_count)
                << std::endl;
      std::cout << "  Index Byte Count     = " << hex_to_string(m_header.m_hpp.m_index_byte_count)
                << std::endl;
      std::cout << "  Index SID            = " << hex_to_string(m_header.m_hpp.m_index_sid)
                << std::endl;
      std::cout << "  Body Offset          = " << hex_to_string(m_header.m_hpp.m_body_offset)
                << std::endl;
      std::cout << "  Body SID             = " << hex_to_string(m_header.m_hpp.m_body_sid)
                << std::endl;
      
#endif

      return rval;
   }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq 0x18(%rsi), %rax
movl 0x10(%rsi), %ecx
leaq 0x30(%rsp), %r14
movq %rax, (%r14)
movl %ecx, 0x8(%r14)
movb $0x0, 0xc(%r14)
andl $0x0, 0x10(%r14)
movb $0x1, 0x14(%r14)
pushq $0x10
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0x3184
movw %ax, 0x18(%rbx)
movq %r14, %rdi
movl %ebp, %esi
callq 0x3184
movw %ax, 0x1a(%rbx)
pushq $0x20
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0x3184
movl %eax, 0x1c(%rbx)
movq %r14, %rdi
callq 0x4988
movq %rax, 0x20(%rbx)
movq %r14, %rdi
callq 0x4988
movq %rax, 0x28(%rbx)
movq %r14, %rdi
callq 0x4988
movq %rax, 0x30(%rbx)
movq %r14, %rdi
callq 0x4988
movq %rax, 0x38(%rbx)
movq %r14, %rdi
callq 0x4988
movq %rax, 0x40(%rbx)
movq %r14, %rdi
movl %ebp, %esi
callq 0x3184
movl %eax, 0x48(%rbx)
movq %r14, %rdi
callq 0x4988
movq %rax, 0x50(%rbx)
movq %r14, %rdi
movl %ebp, %esi
callq 0x3184
movl %eax, 0x58(%rbx)
xorl %r15d, %r15d
pushq $0x8
popq %rbp
cmpq $0x10, %r15
je 0x3cb0
movq %r14, %rdi
movl %ebp, %esi
callq 0x3184
movb %al, 0x5c(%rbx,%r15)
incq %r15
jmp 0x3c96
leaq 0x30(%rsp), %r14
movq %r14, %rdi
callq 0x4988
movl 0x8(%r14), %edi
subl 0x10(%r14), %edi
movq %rdi, 0x28(%rsp)
shlq $0x4, %rdi
callq 0x2030
movq %rax, 0x70(%rbx)
xorl %r12d, %r12d
pushq $0x8
popq %rbp
xorl %r13d, %r13d
cmpq 0x28(%rsp), %r13
je 0x3d13
xorl %r15d, %r15d
cmpq $0x10, %r15
je 0x3d0a
movq %r14, %rdi
movl %ebp, %esi
callq 0x3184
movq 0x70(%rbx), %rcx
addq %r12, %rcx
movb %al, (%r15,%rcx)
incq %r15
jmp 0x3cea
incq %r13
addq $0x10, %r12
jmp 0x3ce0
movq 0x52be(%rip), %rdi      # 0x8fd8
leaq 0x26e5(%rip), %rsi      # 0x6406
callq 0x2180
movq %rax, %r14
movzwl 0x18(%rbx), %esi
leaq 0x8(%rsp), %rdi
callq 0x49a0
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20d0
leaq 0x8(%rsp), %rdi
callq 0x22b8
movq 0x527b(%rip), %rdi      # 0x8fd8
leaq 0x26bc(%rip), %rsi      # 0x6420
callq 0x2180
movq %rax, %r14
movzwl 0x1a(%rbx), %esi
leaq 0x8(%rsp), %rdi
callq 0x49a0
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20d0
leaq 0x8(%rsp), %rdi
callq 0x22b8
movq 0x5238(%rip), %rdi      # 0x8fd8
leaq 0x2693(%rip), %rsi      # 0x643a
callq 0x2180
movq %rax, %r14
movl 0x1c(%rbx), %esi
leaq 0x8(%rsp), %rdi
callq 0x4a3f
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20d0
leaq 0x8(%rsp), %rdi
callq 0x22b8
movq 0x51f6(%rip), %rdi      # 0x8fd8
leaq 0x266b(%rip), %rsi      # 0x6454
callq 0x2180
movq %rax, %r14
movq 0x20(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x4add
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20d0
leaq 0x8(%rsp), %rdi
callq 0x22b8
movq 0x51b3(%rip), %rdi      # 0x8fd8
leaq 0x2642(%rip), %rsi      # 0x646e
callq 0x2180
movq %rax, %r14
movq 0x28(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x4add
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20d0
leaq 0x8(%rsp), %rdi
callq 0x22b8
movq 0x5170(%rip), %rdi      # 0x8fd8
leaq 0x2619(%rip), %rsi      # 0x6488
callq 0x2180
movq %rax, %r14
movq 0x30(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x4add
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20d0
leaq 0x8(%rsp), %rdi
callq 0x22b8
movq 0x512d(%rip), %rdi      # 0x8fd8
leaq 0x25f0(%rip), %rsi      # 0x64a2
callq 0x2180
movq %rax, %r14
movq 0x38(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x4add
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20d0
leaq 0x8(%rsp), %rdi
callq 0x22b8
movq 0x50ea(%rip), %rdi      # 0x8fd8
leaq 0x25c7(%rip), %rsi      # 0x64bc
callq 0x2180
movq %rax, %r14
movq 0x40(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x4add
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20d0
leaq 0x8(%rsp), %rdi
callq 0x22b8
movq 0x50a7(%rip), %rdi      # 0x8fd8
leaq 0x259e(%rip), %rsi      # 0x64d6
callq 0x2180
movq %rax, %r14
movl 0x48(%rbx), %esi
leaq 0x8(%rsp), %rdi
callq 0x4a3f
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20d0
leaq 0x8(%rsp), %rdi
callq 0x22b8
movq 0x5065(%rip), %rdi      # 0x8fd8
leaq 0x2576(%rip), %rsi      # 0x64f0
callq 0x2180
movq %rax, %r14
movq 0x50(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x4add
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20d0
leaq 0x8(%rsp), %rdi
callq 0x22b8
movq 0x5022(%rip), %rdi      # 0x8fd8
leaq 0x254d(%rip), %rsi      # 0x650a
callq 0x2180
movq %rax, %r14
movl 0x58(%rbx), %esi
leaq 0x8(%rsp), %rdi
callq 0x4a3f
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x20d0
leaq 0x8(%rsp), %rdi
callq 0x22b8
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4016
jmp 0x4016
jmp 0x4016
jmp 0x4016
jmp 0x4016
jmp 0x4016
jmp 0x4016
jmp 0x4016
jmp 0x4016
jmp 0x4016
movq %rax, %rbx
jmp 0x403c
jmp 0x402f
jmp 0x402f
jmp 0x402f
jmp 0x402f
jmp 0x402f
jmp 0x402f
jmp 0x402f
jmp 0x402f
jmp 0x402f
jmp 0x402f
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x22b8
movq %rbx, %rdi
callq 0x2290