// File: /workspace/github_cpp_makefile_star2_O3/onai[P]npio/./npio.h
// Function: npio_ph_parse_dict_(npio_Array*, char const*, char const*)
static inline int npio_ph_parse_dict_(npio_Array* array, const char* start, const char* end)
{
  int err;
  char open_quote;
  const char *p = start;
  const char *dtbeg, *dtend;
  size_t dtsz;
  enum {k_descr, k_shape, k_fortran_order} key;

  if (p >= end)
    return EINVAL;

  if (*p++ != '{')
    return EINVAL;

  /* Go through all key-value pairs. */
  while (1)
  {
    p = npio_ph_skip_spaces_(p, end);
    if (p >= end)
      return EINVAL;

    /* are we done? */
    if (*p == '}')
    {
      ++p;
      break;
    }

    /* Expect the open quote of a key */
    if (!npio_ph_is_quote_(open_quote = *p++))
      return EINVAL;

    /* Check for one of the three possible keys */
    if (p + 5 < end && memcmp(p, "descr", 5) == 0)
    {
      key = k_descr;
      p += 5;
    }
    else if (p + 5 < end && memcmp(p, "shape", 5) == 0)
    {
      key = k_shape;
      p += 5;
    }
    else if (p + 13 < end && memcmp(p, "fortran_order", 13) == 0)
    {
      key = k_fortran_order;
      p += 13;
    }
    else
      return EINVAL;

    /* Expect the close quote of the key */
    if (p >= end || *p++ != open_quote)
      return EINVAL;

    /* Get to the colon */
    p = npio_ph_skip_spaces_(p, end);
    if (p >= end || *p++ != ':')
      return EINVAL;

    /* skip any more spaces */
    p = npio_ph_skip_spaces_(p, end);
    if (p == end)
      return EINVAL;

    switch (key)
    {
      case k_descr:
        if (!npio_ph_is_quote_(open_quote = *p++))
          return EINVAL;
        dtbeg = p;
        while (p < end && *p != open_quote)
          ++p;
        dtend = p;
        if (p == end)
          return EINVAL;
        ++p;
        dtsz = dtend - dtbeg;
        array->dtype = (char*) malloc(dtsz + 1);
        memcpy(array->dtype, dtbeg, dtsz);
        array->dtype[dtsz] = 0;
        break;

      case k_fortran_order:
        if (p + 4 < end && memcmp(p, "True", 4) == 0)
        {
          array->fortran_order = 1;
          p += 4;
        }
        else if (p + 5 < end && memcmp(p, "False", 5) == 0)
        {
          array->fortran_order = 0;
          p += 5;
        }
        else
          return EINVAL;
        break;

      case k_shape:
        if ((err = npio_ph_parse_shape_(array, p, end, &p)))
          return err;
        break;
    }

    /* skip any spaces after end of key : value */
    p = npio_ph_skip_spaces_(p, end);

    if (p == end)
      return EINVAL;

    /* grab that separating comma */
    if (*p == ',')
      ++p;

    /* next iteration takes care of any nonsense that might happen here! */
  }

  /* Parse the (very restricted) numpy dtype and return */
  return npio_ph_parse_dtype_(array);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl $0x16, %ebp
cmpq %rdx, %rsi
jae 0x183a
movq %rsi, %r12
cmpb $0x7b, (%rsi)
jne 0x183a
movq %rdx, %rbx
movq %rdi, %r14
incq %r12
leaq -0x1(%rdx), %rax
movq %rax, 0x10(%rsp)
movl $0x63736564, %r13d      # imm = 0x63736564
movq %rdi, 0x8(%rsp)
cmpq %rbx, %r12
jae 0x1460
movsbl (%r12), %edi
callq 0x1040
testl %eax, %eax
je 0x1460
incq %r12
cmpq %rbx, %r12
jne 0x1447
movq %rbx, %r12
cmpq %rbx, %r12
jae 0x183a
movzbl (%r12), %eax
cmpl $0x7d, %eax
je 0x184b
cmpl $0x27, %eax
je 0x1485
cmpl $0x22, %eax
jne 0x183a
leaq 0x6(%r12), %rbp
cmpq %rbx, %rbp
jae 0x14bd
movl 0x1(%r12), %ecx
xorl %r13d, %ecx
movzbl 0x5(%r12), %edx
xorl $0x72, %edx
orl %ecx, %edx
je 0x14ff
movl 0x1(%r12), %ecx
movl $0x70616873, %edx       # imm = 0x70616873
xorl %edx, %ecx
movzbl 0x5(%r12), %edx
xorl $0x65, %edx
orl %ecx, %edx
je 0x1504
leaq 0xe(%r12), %rbp
cmpq %rbx, %rbp
jae 0x1835
movq 0x1(%r12), %rcx
movabsq $0x5f6e617274726f66, %rdx # imm = 0x5F6E617274726F66
xorq %rdx, %rcx
movq 0x6(%r12), %rdx
movabsq $0x726564726f5f6e61, %rsi # imm = 0x726564726F5F6E61
xorq %rsi, %rdx
orq %rcx, %rdx
movl $0x2, %r12d
je 0x150a
jmp 0x1835
xorl %r12d, %r12d
jmp 0x150a
movl $0x1, %r12d
cmpq %rbx, %rbp
jae 0x1835
cmpb %al, (%rbp)
jne 0x1835
incq %rbp
cmpq %rbx, %rbp
jae 0x153c
movsbl (%rbp), %edi
callq 0x1040
testl %eax, %eax
je 0x153c
incq %rbp
cmpq %rbx, %rbp
jne 0x1524
movq %rbx, %rbp
cmpq %rbx, %rbp
jae 0x1835
cmpb $0x3a, (%rbp)
jne 0x1835
incq %rbp
cmpq %rbx, %rbp
jae 0x156f
movsbl (%rbp), %edi
callq 0x1040
testl %eax, %eax
je 0x156f
incq %rbp
cmpq %rbx, %rbp
jne 0x1557
movq %rbx, %rbp
cmpq %rbx, %rbp
je 0x1835
cmpl $0x2, %r12d
je 0x1718
cmpl $0x1, %r12d
jne 0x1761
cmpb $0x28, (%rbp)
jne 0x1835
movq $0x8, 0x70(%r14)
movl $0x40, %edi
callq 0x10d0
movq %rax, 0x20(%r14)
testq %rax, %rax
je 0x1874
movq %rax, %r12
movq %rbp, %r13
incq %r13
cmpq %rbx, %r13
jae 0x15dc
movsbl (%r13), %edi
callq 0x1040
testl %eax, %eax
je 0x15dc
incq %r13
cmpq %rbx, %r13
jne 0x15c3
movq %rbx, %r13
cmpq %rbx, %r13
jae 0x1615
movb (%r13), %al
addb $-0x30, %al
cmpb $0x9, %al
ja 0x161a
leaq 0x1(%r13), %rbp
movq 0x10(%rsp), %rcx
subq %r13, %rcx
movq %rbp, %rax
testq %rcx, %rcx
je 0x1622
movb (%rax), %dl
addb $-0x30, %dl
leaq 0x1(%rax), %rbp
decq %rcx
cmpb $0x9, %dl
jbe 0x15f7
decq %rbp
jmp 0x1625
xorl %r15d, %r15d
jmp 0x161d
movb $0x1, %r15b
movq %r13, %rbp
jmp 0x162c
movq %rbx, %rbp
cmpq %rbx, %rax
setb %r15b
cmpq %rbx, %rbp
je 0x1835
cmpq %rbp, %r13
jae 0x16a2
movq %rbp, %rax
subq %r13, %rax
xorl %ecx, %ecx
xorl %r14d, %r14d
movsbq (%r13,%rcx), %rdx
leaq (%r14,%r14,4), %rsi
leaq (%rdx,%rsi,2), %r14
addq $-0x30, %r14
incq %rcx
cmpq %rcx, %rax
jne 0x1645
movq 0x8(%rsp), %r13
movq 0x18(%r13), %rsi
cmpq 0x70(%r13), %rsi
jne 0x1696
leaq (%rsi,%rsi), %rax
movq %rax, 0x70(%r13)
shlq $0x4, %rsi
movq %r12, %rdi
callq 0x10f0
testq %rax, %rax
je 0x1874
movq %rax, %r12
movq %rax, 0x20(%r13)
movq 0x18(%r13), %rsi
leaq 0x1(%rsi), %rax
movq %rax, 0x18(%r13)
movq %r14, (%r12,%rsi,8)
testb %r15b, %r15b
je 0x16c8
movq %rbx, %r14
subq %rbp, %r14
addq %rbp, %r14
movsbl (%rbp), %edi
callq 0x1040
testl %eax, %eax
je 0x16c8
incq %rbp
cmpq %rbx, %rbp
jne 0x16b0
movq %r14, %rbp
cmpq %rbx, %rbp
je 0x1835
movzbl (%rbp), %eax
cmpl $0x2c, %eax
je 0x15b8
cmpl $0x29, %eax
jne 0x1835
movq 0x8(%rsp), %r14
movq 0x18(%r14), %rcx
movl $0x1, %eax
testq %rcx, %rcx
je 0x17eb
xorl %edx, %edx
movl $0x63736564, %r13d      # imm = 0x63736564
imulq (%r12,%rdx,8), %rax
incq %rdx
cmpq %rdx, %rcx
jne 0x1706
jmp 0x17f1
leaq 0x4(%rbp), %r15
cmpq %rbx, %r15
jae 0x172e
cmpl $0x65757254, (%rbp)     # imm = 0x65757254
je 0x17e1
leaq 0x5(%rbp), %r15
cmpq %rbx, %r15
jae 0x1835
movl (%rbp), %eax
movl $0x736c6146, %ecx       # imm = 0x736C6146
xorl %ecx, %eax
movzbl 0x4(%rbp), %ecx
xorl $0x65, %ecx
orl %eax, %ecx
jne 0x1835
movl $0x0, 0x30(%r14)
jmp 0x17fb
movzbl (%rbp), %eax
cmpl $0x27, %eax
je 0x1773
cmpl $0x22, %eax
jne 0x1835
leaq 0x1(%rbp), %r12
movq %r12, %r13
cmpq %rbx, %r12
jae 0x179b
movq 0x10(%rsp), %rcx
subq %rbp, %rcx
movq %r12, %r13
cmpb %al, (%r13)
je 0x179b
incq %r13
decq %rcx
jne 0x178a
movq %rbx, %r13
cmpq %rbx, %r13
je 0x1835
leaq 0x1(%r13), %r15
subq %r12, %r13
leaq 0x1(%r13), %rdi
callq 0x10d0
movq %rax, %rbp
movq 0x8(%rsp), %r14
movq %rax, 0x10(%r14)
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x10b0
movb $0x0, (%rbp,%r13)
movl $0x16, %ebp
movl $0x63736564, %r13d      # imm = 0x63736564
jmp 0x1800
movl $0x1, 0x30(%r14)
jmp 0x17fb
movl $0x63736564, %r13d      # imm = 0x63736564
incq %rbp
movq %rax, 0x28(%r14)
movq %rbp, %r15
movl $0x16, %ebp
cmpq %rbx, %r15
jae 0x181d
movsbl (%r15), %edi
callq 0x1040
testl %eax, %eax
je 0x181d
incq %r15
cmpq %rbx, %r15
jne 0x1805
movq %rbx, %r15
cmpq %rbx, %r15
je 0x183a
xorl %r12d, %r12d
cmpb $0x2c, (%r15)
sete %r12b
addq %r15, %r12
jmp 0x1442
movl $0x16, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r14), %r15
movq %r15, %rdi
callq 0x1070
movl $0x5f, %ebp
cmpq $0x3, %rax
jne 0x183a
movzbl (%r15), %eax
cmpl $0x3c, %eax
je 0x187b
cmpl $0x3e, %eax
jne 0x183a
xorl %eax, %eax
jmp 0x1880
movl $0xc, %ebp
jmp 0x183a
movl $0x1, %eax
movl %eax, 0x34(%r14)
movzbl 0x1(%r15), %eax
cmpl $0x66, %eax
je 0x18a7
cmpl $0x69, %eax
je 0x189d
cmpl $0x75, %eax
jne 0x183a
xorps %xmm0, %xmm0
jmp 0x18ae
movsd 0x77b(%rip), %xmm0      # 0x2020
jmp 0x18ae
movaps 0x782(%rip), %xmm0      # 0x2030
movlps %xmm0, 0x38(%r14)
movb 0x2(%r15), %al
addb $-0x31, %al
cmpb $0x7, %al
ja 0x183a
movzbl %al, %eax
movl $0x8b, %ecx
btl %eax, %ecx
jae 0x183a
leaq 0x7eb(%rip), %rcx       # 0x20c4
movl (%rcx,%rax,4), %eax
movl %eax, 0x40(%r14)
xorl %ebp, %ebp
jmp 0x183a
nop