// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, (%rsp)
movq %rdi, %r14
movq $0x0, 0x6130(%rdi)
movq %r15, %rbx
xorl %r12d, %r12d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x38fa7
movl $0x0, %r15d
testl %eax, %eax
jne 0x38f8c
movq 0x6120(%r14), %r13
movq 0x6128(%r14), %rcx
movq 0x6130(%r14), %rax
movq %rcx, 0x6130(%r14)
movb $0x1, %r12b
movq %rax, %rbp
subq %rcx, %rbp
jne 0x38e8c
movq %rbx, %r15
jmp 0x38f8c
addq %rax, %r13
movq %rbx, %r15
movq %r14, %rdi
callq 0x382e5
movl %eax, %r12d
leal -0x3a(%r12), %eax
cmpl $-0xb, %eax
ja 0x38f08
movl %r12d, %eax
andl $-0x21, %eax
addl $-0x47, %eax
cmpl $-0x6, %eax
jae 0x38f08
movl %r12d, 0x6100(%r14)
movq (%rsp), %rcx
testq %rcx, %rcx
je 0x38ed0
movl 0x6128(%r14), %eax
addl %ebp, %eax
movl %eax, (%rcx)
movq 0x6128(%r14), %rsi
addq %rbp, %rsi
movq %r14, %rdi
callq 0x39095
movq %rax, %r15
testq %rax, %rax
je 0x38f03
movq 0x6120(%r14), %rsi
movq 0x6128(%r14), %rdx
addq %rbp, %rdx
movq %r15, %rdi
callq 0x3230
xorl %r12d, %r12d
jmp 0x38f76
movq %r14, %rdi
callq 0x382e5
leal -0x3a(%rax), %ecx
cmpl $-0xb, %ecx
ja 0x38f38
movl %eax, %ecx
andl $-0x21, %ecx
addl $-0x47, %ecx
cmpl $-0x6, %ecx
jae 0x38f38
movl $0x4, 0x19214(%r14)
xorl %r12d, %r12d
xorl %r15d, %r15d
jmp 0x38f76
movsbl %r12b, %ecx
movl %r12d, %edx
andl $0x7, %edx
addl $0x9, %edx
addl $-0x30, %r12d
cmpl $0x41, %ecx
cmovgel %edx, %r12d
shll $0x4, %r12d
movl %eax, %ecx
andl $0x7, %ecx
addl $0x9, %ecx
movl %eax, %edx
addl $0xd0, %edx
cmpb $0x41, %al
cmovgel %ecx, %edx
addl %r12d, %edx
movb %dl, (%r13)
incq %r13
movb $0x1, %r12b
testb %r12b, %r12b
je 0x38f8c
leaq 0x1(%rbp), %rax
cmpq $-0x1, %rbp
movq %rax, %rbp
jne 0x38e92
testb %r12b, %r12b
jne 0x38e3d
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq