// File: /workspace/github_cpp_makefile_star2_O3/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 $0x38, %rsp
movq %rdi, %rbx
movq 0x18(%rsi), %rax
movl 0x10(%rsi), %ecx
leaq 0x20(%rsp), %r14
movq %rax, (%r14)
movl %ecx, 0x8(%r14)
movb $0x0, 0xc(%r14)
movl $0x0, 0x10(%r14)
movb $0x1, 0x14(%r14)
movq %r14, %rdi
movl $0x10, %esi
callq 0x3b9c
movzbl 0xc(%r14), %ecx
movl %ecx, %edx
addl $0x10, %edx
shrl $0x3, %edx
addl %edx, 0x10(%r14)
andb $0x7, %cl
movb %cl, 0xc(%r14)
movw %ax, 0x18(%rbx)
movq %r14, %rdi
movl $0x10, %esi
callq 0x3b9c
movzbl 0xc(%r14), %ecx
movl %ecx, %edx
addl $0x10, %edx
shrl $0x3, %edx
addl %edx, 0x10(%r14)
andb $0x7, %cl
movb %cl, 0xc(%r14)
movw %ax, 0x1a(%rbx)
movq %r14, %rdi
movl $0x20, %esi
callq 0x3b9c
movzbl 0xc(%r14), %ecx
movl %ecx, %edx
addl $0x20, %edx
shrl $0x3, %edx
addl %edx, 0x10(%r14)
andb $0x7, %cl
movb %cl, 0xc(%r14)
movl %eax, 0x1c(%rbx)
movq %r14, %rdi
callq 0x5d30
movq %rax, 0x20(%rbx)
movq %r14, %rdi
callq 0x5d30
movq %rax, 0x28(%rbx)
movq %r14, %rdi
callq 0x5d30
movq %rax, 0x30(%rbx)
movq %r14, %rdi
callq 0x5d30
movq %rax, 0x38(%rbx)
movq %r14, %rdi
callq 0x5d30
movq %rax, 0x40(%rbx)
movq %r14, %rdi
movl $0x20, %esi
callq 0x3b9c
movzbl 0xc(%r14), %ecx
movl %ecx, %edx
addl $0x20, %edx
shrl $0x3, %edx
addl %edx, 0x10(%r14)
andb $0x7, %cl
movb %cl, 0xc(%r14)
movl %eax, 0x48(%rbx)
movq %r14, %rdi
callq 0x5d30
movq %rax, 0x50(%rbx)
movq %r14, %rdi
movl $0x20, %esi
callq 0x3b9c
movzbl 0xc(%r14), %ecx
movl %ecx, %edx
addl $0x20, %edx
shrl $0x3, %edx
addl %edx, 0x10(%r14)
andb $0x7, %cl
movb %cl, 0xc(%r14)
movl %eax, 0x58(%rbx)
xorl %r15d, %r15d
movq %r14, %rdi
movl $0x8, %esi
callq 0x3b9c
movzbl 0x2c(%rsp), %ecx
movl %ecx, %edx
addl $0x8, %edx
shrl $0x3, %edx
addl %edx, 0x30(%rsp)
andb $0x7, %cl
movb %cl, 0x2c(%rsp)
movb %al, 0x5c(%rbx,%r15)
incq %r15
cmpq $0x10, %r15
jne 0x4735
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x5d30
movl 0x8(%r14), %ebp
movl 0x10(%r14), %r14d
movl %ebp, %r15d
subl %r14d, %r15d
movq %r15, %rdi
shlq $0x4, %rdi
callq 0x2030
movq %rax, 0x70(%rbx)
cmpl %r14d, %ebp
je 0x47ea
xorl %r12d, %r12d
leaq 0x20(%rsp), %r14
xorl %r13d, %r13d
xorl %ebp, %ebp
movq %r14, %rdi
movl $0x8, %esi
callq 0x3b9c
movzbl 0x2c(%rsp), %ecx
movl %ecx, %edx
addl $0x8, %edx
shrl $0x3, %edx
addl %edx, 0x30(%rsp)
andb $0x7, %cl
movb %cl, 0x2c(%rsp)
movq 0x70(%rbx), %rcx
addq %r12, %rcx
movb %al, (%rbp,%rcx)
incq %rbp
cmpq $0x10, %rbp
jne 0x47a5
incq %r13
addq $0x10, %r12
cmpq %r15, %r13
jne 0x47a3
movq 0x57e7(%rip), %rdi      # 0x9fd8
leaq 0x2c0e(%rip), %rsi      # 0x7406
movl $0x19, %edx
callq 0x21a0
movzwl 0x18(%rbx), %esi
movq %rsp, %rdi
callq 0x5d48
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x57ba(%rip), %rdi      # 0x9fd8
callq 0x21a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
leaq 0x10(%rsp), %r15
movq -0x10(%r15), %rdi
cmpq %r15, %rdi
je 0x4868
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x5769(%rip), %rdi      # 0x9fd8
leaq 0x2baa(%rip), %rsi      # 0x7420
movl $0x19, %edx
callq 0x21a0
movzwl 0x1a(%rbx), %esi
movq %rsp, %rdi
callq 0x5d48
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x573c(%rip), %rdi      # 0x9fd8
callq 0x21a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x48e1
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x56f0(%rip), %rdi      # 0x9fd8
leaq 0x2b4b(%rip), %rsi      # 0x743a
movl $0x19, %edx
callq 0x21a0
movl 0x1c(%rbx), %esi
movq %rsp, %rdi
callq 0x5e4a
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x56c4(%rip), %rdi      # 0x9fd8
callq 0x21a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x4959
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x5678(%rip), %rdi      # 0x9fd8
leaq 0x2aed(%rip), %rsi      # 0x7454
movl $0x19, %edx
callq 0x21a0
movq 0x20(%rbx), %rsi
movq %rsp, %rdi
callq 0x5f4b
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x564b(%rip), %rdi      # 0x9fd8
callq 0x21a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x49d2
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x55ff(%rip), %rdi      # 0x9fd8
leaq 0x2a8e(%rip), %rsi      # 0x746e
movl $0x19, %edx
callq 0x21a0
movq 0x28(%rbx), %rsi
movq %rsp, %rdi
callq 0x5f4b
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x55d2(%rip), %rdi      # 0x9fd8
callq 0x21a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x4a4b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x5586(%rip), %rdi      # 0x9fd8
leaq 0x2a2f(%rip), %rsi      # 0x7488
movl $0x19, %edx
callq 0x21a0
movq 0x30(%rbx), %rsi
movq %rsp, %rdi
callq 0x5f4b
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x5559(%rip), %rdi      # 0x9fd8
callq 0x21a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x4ac4
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x550d(%rip), %rdi      # 0x9fd8
leaq 0x29d0(%rip), %rsi      # 0x74a2
movl $0x19, %edx
callq 0x21a0
movq 0x38(%rbx), %rsi
movq %rsp, %rdi
callq 0x5f4b
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x54e0(%rip), %rdi      # 0x9fd8
callq 0x21a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x4b3d
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x5494(%rip), %rdi      # 0x9fd8
leaq 0x2971(%rip), %rsi      # 0x74bc
movl $0x19, %edx
callq 0x21a0
movq 0x40(%rbx), %rsi
movq %rsp, %rdi
callq 0x5f4b
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x5467(%rip), %rdi      # 0x9fd8
callq 0x21a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x4bb6
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x541b(%rip), %rdi      # 0x9fd8
leaq 0x2912(%rip), %rsi      # 0x74d6
movl $0x19, %edx
callq 0x21a0
movl 0x48(%rbx), %esi
movq %rsp, %rdi
callq 0x5e4a
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x53ef(%rip), %rdi      # 0x9fd8
callq 0x21a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x4c2e
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x53a3(%rip), %rdi      # 0x9fd8
leaq 0x28b4(%rip), %rsi      # 0x74f0
movl $0x19, %edx
callq 0x21a0
movq 0x50(%rbx), %rsi
movq %rsp, %rdi
callq 0x5f4b
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x5376(%rip), %rdi      # 0x9fd8
callq 0x21a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x4ca7
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
movq 0x532a(%rip), %rdi      # 0x9fd8
leaq 0x2855(%rip), %rsi      # 0x750a
movl $0x19, %edx
callq 0x21a0
movl 0x58(%rbx), %esi
movq %rsp, %rdi
callq 0x5e4a
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x52fe(%rip), %rdi      # 0x9fd8
callq 0x21a0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20e0
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x4d1f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4d44
jmp 0x4d44
jmp 0x4d44
jmp 0x4d44
jmp 0x4d44
jmp 0x4d44
jmp 0x4d44
jmp 0x4d44
jmp 0x4d44
jmp 0x4d44
movq %rax, %rbx
jmp 0x4d74
jmp 0x4d5b
jmp 0x4d5b
jmp 0x4d5b
jmp 0x4d5b
jmp 0x4d5b
jmp 0x4d5b
jmp 0x4d5b
jmp 0x4d5b
jmp 0x4d5b
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x4d74
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2250
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x4d67
jmp 0x4d74
nop