// File: /workspace/github_cpp_makefile_star2_O2/onai[P]npio/./npio.h
// Function: npio_load_data
static inline int npio_load_data2(npio_Array* array, int swap_bytes)
{
  /* These macros work on both GCC and CLANG without an additional include.
     Right now we do not support any other endianness than big and little.
     Numpy also only supports these two ('<' and '>'). */
  static const int little_endian = (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__);
  size_t data_offset;
  size_t sz;
  ssize_t nr;

  /* Check that the header_len matches the alignment requirements
     of the format */
  data_offset = array->header_len + 6 + (array->major_version == 1 ? 4 : 6);
  if (data_offset % 16)
    return EINVAL;

  if (array->_buf)
  {
    /* Check that the indicated data is within the mapped bounds. */
    /* We are also checking here that there is no trailing data. */
    if (data_offset + npio_array_memsize(array) != array->_buf_size)
      return EINVAL;

    /* Set the data pointer to the start of data */
    array->data = (char*) array->_buf + data_offset;
  }
  else
  {
    /* we must allocate memory and read in the data */
    sz = array->size * array->bit_width / 8;
    if ((ssize_t) sz < 0)
      return ERANGE;
    array->data = malloc(sz);
    if (!array->data)
      return ENOMEM;
    nr = read(array->_fd, array->data, sz);
    if (nr < 0)
      return errno;
    if (nr != (ssize_t) sz)
      return EINVAL;
  }

  /* Swap bytes if necessary */
  if (swap_bytes && little_endian != array->little_endian)
  {
    array->little_endian = little_endian;
    return npio_swap_bytes(array->size, array->bit_width, array->data);
  }

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq 0x8(%rdi), %rax
xorl %ecx, %ecx
cmpb $0x1, (%rdi)
setne %cl
leaq (%rax,%rcx,2), %r15
addq $0xa, %r15
pushq $0x16
popq %rbx
testb $0xf, %r15b
je 0x18f2
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rdi, %r14
movq 0x58(%rdi), %r12
testq %r12, %r12
je 0x1978
movq %r14, %rdi
callq 0x23a6
movslq 0x40(%r14), %rcx
imulq %rax, %rcx
shrq $0x3, %rcx
addq %r15, %rcx
cmpq 0x60(%r14), %rcx
jne 0x18e4
addq %r15, %r12
movq %r12, 0x48(%r14)
xorl %ebx, %ebx
cmpl $0x1, 0x34(%r14)
je 0x18e4
movl $0x1, 0x34(%r14)
movslq 0x40(%r14), %rdx
addq $-0x8, %rdx
rolq $0x3d, %rdx
cmpq $0x7, %rdx
ja 0x1a2c
movq 0x28(%r14), %rax
movq 0x48(%r14), %rcx
leaq 0x1708(%rip), %rsi      # 0x3060
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
xorl %ebx, %ebx
xorl %edx, %edx
cmpq %rdx, %rax
je 0x18e4
rolw $0x8, (%rcx,%rdx,2)
incq %rdx
jmp 0x1965
movslq 0x40(%r14), %r15
imulq 0x28(%r14), %r15
shrq $0x3, %r15
movq %r15, %rdi
callq 0x1140
movq %rax, 0x48(%r14)
testq %rax, %rax
je 0x19b8
movl 0x50(%r14), %edi
movq %rax, %rsi
movq %r15, %rdx
callq 0x10f0
testq %rax, %rax
js 0x19bc
cmpq %r15, %rax
je 0x1922
jmp 0x18e4
pushq $0xc
jmp 0x1a2e
callq 0x1050
movl (%rax), %ebx
jmp 0x18e4
xorl %ebx, %ebx
pxor %xmm0, %xmm0
xorl %edx, %edx
cmpq %rdx, %rax
je 0x18e4
movd (%rcx,%rdx,4), %xmm1
punpcklbw %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7]
pshuflw $0x1b, %xmm1, %xmm1     # xmm1 = xmm1[3,2,1,0,4,5,6,7]
packuswb %xmm1, %xmm1
movd %xmm1, (%rcx,%rdx,4)
incq %rdx
jmp 0x19d0
xorl %ebx, %ebx
pxor %xmm0, %xmm0
xorl %edx, %edx
cmpq %rdx, %rax
je 0x18e4
movq (%rcx,%rdx,8), %xmm1
punpcklbw %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3],xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7]
pshufd $0x4e, %xmm1, %xmm1     # xmm1 = xmm1[2,3,0,1]
pshuflw $0x1b, %xmm1, %xmm1     # xmm1 = xmm1[3,2,1,0,4,5,6,7]
pshufhw $0x1b, %xmm1, %xmm1     # xmm1 = xmm1[0,1,2,3,7,6,5,4]
packuswb %xmm1, %xmm1
movq %xmm1, (%rcx,%rdx,8)
incq %rdx
jmp 0x19fd
pushq $0x5f
popq %rbx
jmp 0x18e4