// File: onai[P]npio/npio_test_c.c
// Function: test2
void test2()
{
  int err;
  size_t i;
  float *data, total;
  npio_Array array;

  npio_init_array(&array);
  err = npio_load("test2.npy", &array);
  if (err)
  {
    fprintf(stderr, "npio_load: %s\n", strerror(err));
    exit(1);
  }

  printf("data type: ");
  if (array.floating_point)
    printf("%d-bit float\n", array.bit_width);
  else if (array.is_signed)
    printf("%d-bit signed integer\n", array.bit_width);
  else
    printf("%d-bit unsigned integer\n", array.bit_width);

  printf("shape: ");
  for (i = 0; i < array.dim; ++i)
    printf("%ld ", array.shape[i]);
  printf("\n");

  assert(array.bit_width == 32 && array.floating_point);

  data = (float*) array.data;
  total = 0;
  for (i = 0; i < array.size; ++i)
    total += data[i];
  assert(fabs(total / 5005.37f - 1.0f) < 1e-6f);

  npio_free_array(&array);
  printf("test2 passed\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
leaq -0xa8(%rbp), %rdi
callq 0x14d0
leaq 0x2a21(%rip), %rdi      # 0x412f
leaq -0xa8(%rbp), %rsi
callq 0x15c0
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0x175e
movq 0x48ce(%rip), %rax      # 0x5ff8
movq (%rax), %rax
movq %rax, -0xb0(%rbp)
movl -0x4(%rbp), %edi
callq 0x11c0
movq -0xb0(%rbp), %rdi
movq %rax, %rdx
leaq 0x2903(%rip), %rsi      # 0x4050
movb $0x0, %al
callq 0x10f0
movl $0x1, %edi
callq 0x11b0
leaq 0x28fa(%rip), %rdi      # 0x405f
movb $0x0, %al
callq 0x1090
cmpl $0x0, -0x70(%rbp)
je 0x1785
movl -0x68(%rbp), %esi
leaq 0x28ef(%rip), %rdi      # 0x406b
movb $0x0, %al
callq 0x1090
jmp 0x17b1
cmpl $0x0, -0x6c(%rbp)
je 0x179e
movl -0x68(%rbp), %esi
leaq 0x28e4(%rip), %rdi      # 0x4079
movb $0x0, %al
callq 0x1090
jmp 0x17af
movl -0x68(%rbp), %esi
leaq 0x28e8(%rip), %rdi      # 0x4090
movb $0x0, %al
callq 0x1090
jmp 0x17b1
leaq 0x28f1(%rip), %rdi      # 0x40a9
movb $0x0, %al
callq 0x1090
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x90(%rbp), %rax
jae 0x17ff
movq -0x88(%rbp), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x28c7(%rip), %rdi      # 0x40b1
movb $0x0, %al
callq 0x1090
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x17c7
leaq 0x2927(%rip), %rdi      # 0x412d
movb $0x0, %al
callq 0x1090
cmpl $0x20, -0x68(%rbp)
jne 0x181b
cmpl $0x0, -0x70(%rbp)
je 0x181b
jmp 0x183a
leaq 0x2917(%rip), %rdi      # 0x4139
leaq 0x28cf(%rip), %rsi      # 0x40f8
movl $0x53, %edx
leaq 0x2932(%rip), %rcx      # 0x4167
callq 0x10b0
movq -0x60(%rbp), %rax
movq %rax, -0x18(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x1c(%rbp)
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x80(%rbp), %rax
jae 0x1881
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
addss -0x1c(%rbp), %xmm0
movss %xmm0, -0x1c(%rbp)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x1852
movss -0x1c(%rbp), %xmm0
movss 0x2796(%rip), %xmm1     # 0x4024
divss %xmm1, %xmm0
movss 0x2786(%rip), %xmm1     # 0x4020
subss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm1
movaps 0x2767(%rip), %xmm0     # 0x4010
pand %xmm0, %xmm1
movsd 0x2753(%rip), %xmm0     # 0x4008
ucomisd %xmm1, %xmm0
jbe 0x18bd
jmp 0x18dc
leaq 0x28b0(%rip), %rdi      # 0x4174
leaq 0x282d(%rip), %rsi      # 0x40f8
movl $0x59, %edx
leaq 0x2890(%rip), %rcx      # 0x4167
callq 0x10b0
leaq -0xa8(%rbp), %rdi
callq 0x15f0
leaq 0x28ab(%rip), %rdi      # 0x419a
movb $0x0, %al
callq 0x1090
addq $0xb0, %rsp
popq %rbp
retq
nop