// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rdi, %rbx
movq $0x0, 0x6130(%rdi)
xorl %esi, %esi
xorl %edx, %edx
callq 0x39195
testl %eax, %eax
jne 0x39184
movq 0x6120(%rbx), %rbp
movq 0x6128(%rbx), %r13
movq 0x6130(%rbx), %rax
movq %r13, %r12
movq %r13, 0x6130(%rbx)
subq %rax, %r12
je 0x3911f
addq %rax, %rbp
subl %eax, %r13d
movq %rbx, %rdi
callq 0x38565
movl %eax, %r15d
leal -0x3a(%r15), %eax
cmpl $-0xb, %eax
ja 0x390b8
movl %r15d, %eax
andl $-0x21, %eax
addl $-0x47, %eax
cmpl $-0x6, %eax
jb 0x39127
movq %rbx, %rdi
callq 0x38565
leal -0x3a(%rax), %ecx
cmpl $-0xb, %ecx
ja 0x390d9
movl %eax, %ecx
andl $-0x21, %ecx
addl $-0x47, %ecx
cmpl $-0x7, %ecx
jbe 0x3917a
movsbl %r15b, %ecx
movl %r15d, %edx
andl $0x7, %edx
addl $0x9, %edx
addl $-0x30, %r15d
cmpl $0x41, %ecx
cmovgel %edx, %r15d
shll $0x4, %r15d
movl %eax, %ecx
andl $0x7, %ecx
addl $0x9, %ecx
movl %eax, %edx
addl $0xd0, %edx
cmpb $0x41, %al
cmovgel %ecx, %edx
addl %r15d, %edx
movb %dl, (%rbp)
incq %rbp
decq %r13
decq %r12
jne 0x39096
movq %rbx, %rdi
jmp 0x39057
movl %r15d, 0x6100(%rbx)
movq 0x6128(%rbx), %rax
movq %rax, %rsi
subq %r12, %rsi
testq %r14, %r14
je 0x39146
subl %r13d, %eax
movl %eax, (%r14)
movq %rbx, %rdi
callq 0x39272
testq %rax, %rax
je 0x39184
movq 0x6120(%rbx), %rsi
movq 0x6128(%rbx), %rdx
subq %r12, %rdx
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3240
movl $0x4, 0x19214(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq