// File: /workspace/github_c_makefile_star2_O2/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, %rbx
andq $0x0, 0x6130(%rdi)
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x35e4f
testl %eax, %eax
jne 0x35e3e
movq 0x6128(%rbx), %r12
movq 0x6130(%rbx), %rax
movq 0x6120(%rbx), %r13
addq %rax, %r13
movq %r12, %r14
subq %rax, %r14
movq %r12, 0x6130(%rbx)
subl %eax, %r12d
movq %r14, %rbp
subq $0x1, %rbp
jb 0x35d10
movq %rbx, %rdi
callq 0x352a1
movl %eax, %r15d
leal -0x3a(%r15), %eax
cmpl $-0xb, %eax
ja 0x35d77
movl %r15d, %eax
andl $-0x21, %eax
addl $-0x47, %eax
cmpl $-0x6, %eax
jb 0x35dde
movq %rbx, %rdi
callq 0x352a1
leal -0x3a(%rax), %ecx
cmpl $-0xb, %ecx
ja 0x35d98
movl %eax, %ecx
andl $-0x21, %ecx
addl $-0x47, %ecx
cmpl $-0x7, %ecx
jbe 0x35e34
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, (%r13)
incq %r13
decq %r12
movq %rbp, %r14
jmp 0x35d4f
movl %r15d, 0x6100(%rbx)
movq 0x6128(%rbx), %rax
movq %rax, %rsi
subq %r14, %rsi
movq (%rsp), %rcx
testq %rcx, %rcx
je 0x35e00
subl %r12d, %eax
movl %eax, (%rcx)
movq %rbx, %rdi
callq 0x35f17
testq %rax, %rax
je 0x35e3e
movq 0x6120(%rbx), %rsi
movq 0x6128(%rbx), %rdx
subq %r14, %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