// File: /workspace/github_cpp_makefile_star2_O1/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 0x1b88
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %rdi, %r14
movq 0x58(%rdi), %rcx
testq %rcx, %rcx
je 0x1bb8
movq 0x18(%r14), %rsi
testq %rsi, %rsi
je 0x1bf9
movq 0x20(%r14), %rdi
movl $0x1, %edx
xorl %r8d, %r8d
imulq (%rdi,%r8,8), %rdx
incq %r8
cmpq %r8, %rsi
jne 0x1ba9
jmp 0x1bfe
movslq 0x40(%r14), %r15
imulq 0x28(%r14), %r15
shrq $0x3, %r15
movq %r15, %rdi
callq 0x1140
movq %rax, 0x48(%r14)
testq %rax, %rax
je 0x1c80
movl 0x50(%r14), %edi
movq %rax, %rsi
movq %r15, %rdx
callq 0x10f0
testq %rax, %rax
js 0x1c8a
cmpq %r15, %rax
jne 0x1b80
jmp 0x1c1e
movl $0x1, %edx
movslq 0x40(%r14), %rsi
imulq %rdx, %rsi
shrq $0x3, %rsi
addq %rax, %rsi
cmpq 0x60(%r14), %rsi
jne 0x1b80
addq %rax, %rcx
movq %rcx, 0x48(%r14)
xorl %ebx, %ebx
cmpl $0x1, 0x34(%r14)
je 0x1b80
movl $0x1, 0x34(%r14)
movslq 0x40(%r14), %rdx
addq $-0x8, %rdx
rolq $0x3d, %rdx
cmpq $0x7, %rdx
ja 0x1d16
movq 0x28(%r14), %rax
movq 0x48(%r14), %rcx
leaq 0x13e8(%rip), %rsi      # 0x3040
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
testq %rax, %rax
je 0x1b80
xorl %ebx, %ebx
xorl %edx, %edx
rolw $0x8, (%rcx,%rdx,2)
incq %rdx
cmpq %rdx, %rax
jne 0x1c6e
jmp 0x1b80
movl $0xc, %ebx
jmp 0x1b80
callq 0x1050
movl (%rax), %ebx
jmp 0x1b80
testq %rax, %rax
je 0x1b80
xorl %ebx, %ebx
xorl %edx, %edx
movb (%rcx,%rdx,4), %sil
movb 0x3(%rcx,%rdx,4), %dil
movb %sil, 0x3(%rcx,%rdx,4)
movb %dil, (%rcx,%rdx,4)
rolw $0x8, 0x1(%rcx,%rdx,4)
incq %rdx
cmpq %rdx, %rax
jne 0x1ca3
jmp 0x1b80
testq %rax, %rax
je 0x1b80
xorl %ebx, %ebx
xorl %edx, %edx
movb 0x7(%rcx,%rdx,8), %sil
movb (%rcx,%rdx,8), %dil
movb %dil, 0x7(%rcx,%rdx,8)
movb %sil, (%rcx,%rdx,8)
movzwl 0x1(%rcx,%rdx,8), %esi
rolw $0x8, %si
movzwl 0x5(%rcx,%rdx,8), %edi
rolw $0x8, %di
movw %di, 0x1(%rcx,%rdx,8)
movw %si, 0x5(%rcx,%rdx,8)
rolw $0x8, 0x3(%rcx,%rdx,8)
incq %rdx
cmpq %rdx, %rax
jne 0x1cd5
jmp 0x1b80
movl $0x5f, %ebx
jmp 0x1b80