// File: /workspace/github_cpp_makefile_star2_O1/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:
cmpq %rdx, %rsi
jae 0x1881
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r15
cmpb $0x7b, (%rsi)
jne 0x1888
movq %rdx, %rbx
movq %rdi, %r12
incq %r15
leaq -0x1(%rdx), %rax
movq %rax, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
cmpq %rbx, %r15
jae 0x146c
movsbl (%r15), %edi
callq 0x1040
testl %eax, %eax
je 0x146c
incq %r15
cmpq %rbx, %r15
jne 0x1454
movq %rbx, %r15
cmpq %rbx, %r15
jae 0x1888
movzbl (%r15), %eax
cmpl $0x7d, %eax
je 0x189e
cmpl $0x27, %eax
je 0x1490
cmpl $0x22, %eax
jne 0x1888
leaq 0x6(%r15), %r14
cmpq %rbx, %r14
jae 0x14cc
movl 0x1(%r15), %ecx
movl $0x63736564, %edx       # imm = 0x63736564
xorl %edx, %ecx
movzbl 0x5(%r15), %edx
xorl $0x72, %edx
orl %ecx, %edx
je 0x150a
cmpq %rbx, %r14
jae 0x14cc
movl 0x1(%r15), %ecx
movl $0x70616873, %edx       # imm = 0x70616873
xorl %edx, %ecx
movzbl 0x5(%r15), %edx
xorl $0x65, %edx
orl %ecx, %edx
je 0x150e
leaq 0xe(%r15), %r14
cmpq %rbx, %r14
jae 0x1888
movq 0x1(%r15), %rcx
movabsq $0x5f6e617274726f66, %rdx # imm = 0x5F6E617274726F66
xorq %rdx, %rcx
movq 0x6(%r15), %rdx
movabsq $0x726564726f5f6e61, %rsi # imm = 0x726564726F5F6E61
xorq %rsi, %rdx
orq %rcx, %rdx
movl $0x2, %ebp
je 0x1513
jmp 0x1888
xorl %ebp, %ebp
jmp 0x1513
movl $0x1, %ebp
cmpb %al, (%r14)
jne 0x1888
incq %r14
cmpq %rbx, %r14
jae 0x153c
movsbl (%r14), %edi
callq 0x1040
testl %eax, %eax
je 0x153c
incq %r14
cmpq %rbx, %r14
jne 0x1524
movq %rbx, %r14
cmpq %rbx, %r14
jae 0x1888
cmpb $0x3a, (%r14)
jne 0x1888
incq %r14
cmpq %rbx, %r14
jae 0x156f
movsbl (%r14), %edi
callq 0x1040
testl %eax, %eax
je 0x156f
incq %r14
cmpq %rbx, %r14
jne 0x1557
movq %rbx, %r14
cmpq %rbx, %r14
je 0x1888
cmpl $0x2, %ebp
je 0x170f
cmpl $0x1, %ebp
jne 0x175a
cmpb $0x28, (%r14)
jne 0x17d3
movq $0x8, 0x70(%r12)
movl $0x40, %edi
callq 0x10d0
movq %rax, 0x20(%r12)
testq %rax, %rax
je 0x17dd
movl $0x16, 0x4(%rsp)
movq %r14, %r15
movq %r15, %r12
incq %r12
cmpq %rbx, %r12
jae 0x15e4
movsbl (%r12), %edi
callq 0x1040
testl %eax, %eax
je 0x15e4
incq %r12
cmpq %rbx, %r12
jne 0x15cb
movq %rbx, %r12
movq %r12, %r15
cmpq %rbx, %r12
setb %r13b
jae 0x1635
movb (%r12), %al
addb $-0x30, %al
movb $0x1, %r13b
movq %r12, %r15
cmpb $0x9, %al
ja 0x1635
leaq 0x1(%r12), %r15
movq 0x10(%rsp), %rcx
subq %r12, %rcx
movq %r15, %rax
testq %rcx, %rcx
je 0x162b
movb (%rax), %dl
addb $-0x30, %dl
leaq 0x1(%rax), %r15
decq %rcx
cmpb $0x9, %dl
jbe 0x160d
decq %r15
jmp 0x162e
movq %rbx, %r15
cmpq %rbx, %rax
setb %r13b
cmpq %rbx, %r15
je 0x1820
cmpq %r15, %r12
jae 0x16c2
movq %r15, %rax
subq %r12, %rax
xorl %ecx, %ecx
xorl %ebp, %ebp
movsbq (%r12,%rcx), %rdx
leaq (,%rbp,4), %rsi
addq %rbp, %rsi
leaq (%rdx,%rsi,2), %rbp
addq $-0x30, %rbp
incq %rcx
cmpq %rcx, %rax
jne 0x164d
movq 0x8(%rsp), %r12
movq 0x70(%r12), %rsi
cmpq %rsi, 0x18(%r12)
jne 0x169f
leaq (%rsi,%rsi), %rax
movq %rax, 0x70(%r12)
movq 0x20(%r12), %rdi
shlq $0x4, %rsi
callq 0x10f0
testq %rax, %rax
je 0x1706
movq %rax, 0x20(%r12)
movq 0x18(%r12), %rax
movq 0x20(%r12), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, 0x18(%r12)
movq %rbp, (%rcx,%rax,8)
xorl %eax, %eax
movb $0x1, %cl
testb %cl, %cl
je 0x181c
testb %r13b, %r13b
je 0x16e6
movq 0x8(%rsp), %r12
movsbl (%r15), %edi
callq 0x1040
testl %eax, %eax
je 0x16eb
incq %r15
cmpq %rbx, %r15
jne 0x16cc
movq %rbx, %r15
jmp 0x16eb
movq 0x8(%rsp), %r12
cmpq %rbx, %r15
je 0x183f
movzbl (%r15), %eax
cmpl $0x2c, %eax
je 0x15c0
jmp 0x17f2
movl $0xc, %eax
xorl %ecx, %ecx
jmp 0x16ba
leaq 0x4(%r14), %r13
cmpq %rbx, %r13
jae 0x1725
cmpl $0x65757254, (%r14)     # imm = 0x65757254
je 0x17e7
leaq 0x5(%r14), %r13
cmpq %rbx, %r13
jae 0x1888
movl (%r14), %eax
movl $0x736c6146, %ecx       # imm = 0x736C6146
xorl %ecx, %eax
movzbl 0x4(%r14), %ecx
xorl $0x65, %ecx
orl %eax, %ecx
jne 0x1888
movl $0x0, 0x30(%r12)
jmp 0x184a
movzbl (%r14), %eax
cmpl $0x27, %eax
je 0x176c
cmpl $0x22, %eax
jne 0x1888
leaq 0x1(%r14), %r15
movq %r15, %r12
cmpq %rbx, %r15
jae 0x1794
movq 0x10(%rsp), %rcx
subq %r14, %rcx
movq %r15, %r12
cmpb %al, (%r12)
je 0x1794
incq %r12
decq %rcx
jne 0x1783
movq %rbx, %r12
cmpq %rbx, %r12
je 0x1888
leaq 0x1(%r12), %r13
subq %r15, %r12
leaq 0x1(%r12), %rdi
callq 0x10d0
movq %rax, %r14
movq 0x8(%rsp), %rbp
movq %rax, 0x10(%rbp)
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x10b0
movb $0x0, (%r14,%r12)
movq %rbp, %r12
jmp 0x184a
movl $0x16, 0x4(%rsp)
jmp 0x183f
movl $0xc, 0x4(%rsp)
jmp 0x183f
movl $0x1, 0x30(%r12)
jmp 0x184a
cmpl $0x29, %eax
jne 0x183f
movq 0x18(%r12), %rcx
testq %rcx, %rcx
je 0x1827
movq 0x20(%r12), %rdx
movl $0x1, %eax
xorl %esi, %esi
imulq (%rdx,%rsi,8), %rax
incq %rsi
cmpq %rsi, %rcx
jne 0x180d
jmp 0x182c
movl %eax, 0x4(%rsp)
movq 0x8(%rsp), %r12
jmp 0x183f
movl $0x1, %eax
incq %r15
movq %rax, 0x28(%r12)
movl $0x0, 0x4(%rsp)
movq %r15, %r14
movq %r14, %r13
movl 0x4(%rsp), %esi
testl %esi, %esi
jne 0x188d
cmpq %rbx, %r13
jae 0x1868
movsbl (%r13), %edi
callq 0x1040
testl %eax, %eax
je 0x1868
incq %r13
cmpq %rbx, %r13
jne 0x184f
movq %rbx, %r13
cmpq %rbx, %r13
je 0x1888
xorl %r15d, %r15d
cmpb $0x2c, (%r13)
sete %r15b
addq %r13, %r15
jmp 0x144f
movl $0x16, %esi
jmp 0x189b
movl $0x16, %esi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
movl %esi, %eax
retq
movq 0x10(%r12), %r14
movq %r14, %rdi
callq 0x1070
movl $0x5f, %esi
cmpq $0x3, %rax
jne 0x188d
movzbl (%r14), %ecx
movl $0x1, %eax
movl $0x1, %edx
cmpl $0x3c, %ecx
je 0x18d0
cmpl $0x3e, %ecx
jne 0x188d
xorl %edx, %edx
movl %edx, 0x34(%r12)
movzbl 0x1(%r14), %ecx
cmpl $0x66, %ecx
je 0x18ef
cmpl $0x69, %ecx
je 0x18eb
cmpl $0x75, %ecx
jne 0x188d
xorl %eax, %eax
xorl %ecx, %ecx
jmp 0x18f4
movl $0x1, %ecx
movl %eax, 0x3c(%r12)
movl %ecx, 0x38(%r12)
movb 0x2(%r14), %al
addb $-0x31, %al
cmpb $0x8, %al
jae 0x188d
movzbl %al, %eax
movl $0x8b, %ecx
btl %eax, %ecx
jae 0x188d
leaq 0x784(%rip), %rcx       # 0x20a4
movl (%rcx,%rax,4), %eax
movl %eax, 0x40(%r12)
xorl %esi, %esi
jmp 0x188d
nop