// File: /workspace/github_c_makefile_star2_O0/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_gethex
SOAP_FMAC1
unsigned char*
SOAP_FMAC2
soap_gethex(struct soap *soap, int *n)
{
#ifdef WITH_DOM
  if ((soap->mode & SOAP_XML_DOM) && soap->dom)
  { soap->dom->data = soap_string_in(soap, 0, -1, -1);
    return (unsigned char*)soap_hex2s(soap, soap->dom->data, NULL, 0, n);
  }
#endif
#ifdef WITH_FAST
  soap->labidx = 0;
  for (;;)
  { register char *s;
    register size_t i, k;
    if (soap_append_lab(soap, NULL, 0))
      return NULL;
    s = soap->labbuf + soap->labidx;
    k = soap->lablen - soap->labidx;
    soap->labidx = soap->lablen;
    for (i = 0; i < k; i++)
    { register char d1, d2;
      register soap_wchar c;
      c = soap_get(soap);
      if (soap_isxdigit(c))
      { d1 = (char)c;
        c = soap_get(soap); 
        if (soap_isxdigit(c))
          d2 = (char)c;
        else 
        { soap->error = SOAP_TYPE;
          return NULL;
        }
      }
      else
      { unsigned char *p;
        soap_unget(soap, c);
        if (n)
          *n = (int)(soap->lablen + i - k);
        p = (unsigned char*)soap_malloc(soap, soap->lablen + i - k);
        if (p)
          memcpy(p, soap->labbuf, soap->lablen + i - k);
        return p;
      }
      *s++ = ((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0');
    }
  }
#else
  if (soap_new_block(soap) == NULL)
    return NULL;
  for (;;)
  { register int i;
    register char *s = (char*)soap_push_block(soap, NULL, SOAP_BLKLEN);
    if (!s)
    { soap_end_block(soap, NULL);
      return NULL;
    }
    for (i = 0; i < SOAP_BLKLEN; i++)
    { register char d1, d2;
      register soap_wchar c = soap_get(soap);
      if (soap_isxdigit(c))
      { d1 = (char)c;
        c = soap_get(soap); 
        if (soap_isxdigit(c))
          d2 = (char)c;
        else 
        { soap_end_block(soap, NULL);
          soap->error = SOAP_TYPE;
          return NULL;
        }
      }
      else
      { unsigned char *p;
        soap_unget(soap, c);
        if (n)
          *n = (int)soap_size_block(soap, NULL, i);
        p = (unsigned char*)soap_save_block(soap, NULL, 0);
        return p;
      }
      *s++ = ((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0');
    }
  }
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, 0x6130(%rax)
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x51780
cmpl $0x0, %eax
je 0x515b1
movq $0x0, -0x8(%rbp)
jmp 0x51776
movq -0x10(%rbp), %rax
movq 0x6120(%rax), %rax
movq -0x10(%rbp), %rcx
addq 0x6130(%rcx), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x6128(%rax), %rax
movq -0x10(%rbp), %rcx
subq 0x6130(%rcx), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x6128(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x6130(%rax)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x51771
movq -0x10(%rbp), %rdi
callq 0x503c0
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %edi
callq 0x4f8b0
cmpl $0x0, %eax
je 0x51671
movl -0x38(%rbp), %eax
movb %al, -0x31(%rbp)
movq -0x10(%rbp), %rdi
callq 0x503c0
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %edi
callq 0x4f8b0
cmpl $0x0, %eax
je 0x51651
movl -0x38(%rbp), %eax
movb %al, -0x32(%rbp)
jmp 0x5166c
movq -0x10(%rbp), %rax
movl $0x4, 0x19214(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x51776
jmp 0x516f8
movl -0x38(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x6100(%rax)
cmpq $0x0, -0x18(%rbp)
je 0x516a0
movq -0x10(%rbp), %rax
movq 0x6128(%rax), %rax
addq -0x28(%rbp), %rax
subq -0x30(%rbp), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x6128(%rax), %rsi
addq -0x28(%rbp), %rsi
subq -0x30(%rbp), %rsi
callq 0x518f0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x516ee
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x6120(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x6128(%rax), %rdx
addq -0x28(%rbp), %rdx
subq -0x30(%rbp), %rdx
callq 0x3240
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x51776
movsbl -0x31(%rbp), %eax
cmpl $0x41, %eax
jl 0x51710
movsbl -0x31(%rbp), %eax
andl $0x7, %eax
addl $0x9, %eax
movl %eax, -0x44(%rbp)
jmp 0x5171a
movsbl -0x31(%rbp), %eax
subl $0x30, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
shll $0x4, %eax
movl %eax, -0x48(%rbp)
movsbl -0x32(%rbp), %eax
cmpl $0x41, %eax
jl 0x5173b
movsbl -0x32(%rbp), %eax
andl $0x7, %eax
addl $0x9, %eax
movl %eax, -0x4c(%rbp)
jmp 0x51745
movsbl -0x32(%rbp), %eax
subl $0x30, %eax
movl %eax, -0x4c(%rbp)
movl -0x48(%rbp), %eax
movl -0x4c(%rbp), %ecx
addl %ecx, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x51603
jmp 0x5158f
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq