// File: /workspace/github_cpp_makefile_star2_O3/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 %rbx
movq 0x8(%rdi), %rax
xorl %ecx, %ecx
cmpb $0x1, (%rdi)
setne %cl
leaq (%rax,%rcx,2), %rax
addq $0xa, %rax
movl $0x16, %ebx
testb $0xf, %al
je 0x1ae4
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %rdi, %r14
movq 0x58(%rdi), %rcx
testq %rcx, %rcx
je 0x1b14
movq 0x18(%r14), %rsi
testq %rsi, %rsi
je 0x1b55
movq 0x20(%r14), %rdi
movl $0x1, %edx
xorl %r8d, %r8d
imulq (%rdi,%r8,8), %rdx
incq %r8
cmpq %r8, %rsi
jne 0x1b05
jmp 0x1b5a
movslq 0x40(%r14), %r15
imulq 0x28(%r14), %r15
shrq $0x3, %r15
movq %r15, %rdi
callq 0x1140
movq %rax, 0x48(%r14)
testq %rax, %rax
je 0x1bdc
movl 0x50(%r14), %edi
movq %rax, %rsi
movq %r15, %rdx
callq 0x10f0
testq %rax, %rax
js 0x1be6
cmpq %r15, %rax
jne 0x1adc
jmp 0x1b7a
movl $0x1, %edx
movslq 0x40(%r14), %rsi
imulq %rdx, %rsi
shrq $0x3, %rsi
addq %rax, %rsi
cmpq 0x60(%r14), %rsi
jne 0x1adc
addq %rax, %rcx
movq %rcx, 0x48(%r14)
xorl %ebx, %ebx
cmpl $0x1, 0x34(%r14)
je 0x1adc
movl $0x1, 0x34(%r14)
movslq 0x40(%r14), %rdx
addq $-0x8, %rdx
rolq $0x3d, %rdx
cmpq $0x7, %rdx
ja 0x1c66
movq 0x28(%r14), %rax
movq 0x48(%r14), %rcx
leaq 0x14ac(%rip), %rsi      # 0x3060
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
testq %rax, %rax
je 0x1adc
xorl %ebx, %ebx
xorl %edx, %edx
rolw $0x8, (%rcx,%rdx,2)
incq %rdx
cmpq %rdx, %rax
jne 0x1bca
jmp 0x1adc
movl $0xc, %ebx
jmp 0x1adc
callq 0x1050
movl (%rax), %ebx
jmp 0x1adc
testq %rax, %rax
je 0x1adc
xorl %ebx, %ebx
pxor %xmm0, %xmm0
xorl %edx, %edx
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
cmpq %rdx, %rax
jne 0x1c03
jmp 0x1adc
testq %rax, %rax
je 0x1adc
xorl %ebx, %ebx
pxor %xmm0, %xmm0
xorl %edx, %edx
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
cmpq %rdx, %rax
jne 0x1c38
jmp 0x1adc
movl $0x5f, %ebx
jmp 0x1adc