// File: /workspace/github_c_makefile_star2_O1/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_id_forward
SOAP_FMAC1
void*
SOAP_FMAC2
soap_id_forward(struct soap *soap, const char *href, void *p, size_t len, int st, int tt, size_t n, unsigned int k, void (*fcopy)(struct soap*, int, int, void*, size_t, const void*, size_t))
{ struct soap_ilist *ip;
  if (!p || !href || !*href)
    return p;
  ip = soap_lookup(soap, href); /* lookup pointer to hash table entry for string id */
  if (!ip)
  { if (!(ip = soap_enter(soap, href))) /* new hash table entry for string id */
      return NULL;
    ip->type = st;
    ip->size = n;
    ip->link = NULL;
    ip->copy = NULL;
    ip->ptr = NULL;
    ip->level = 0;
    ip->flist = NULL;
    DBGLOG(TEST,SOAP_MESSAGE(fdebug, "New entry href='%s' type=%d size=%lu level=%d location=%p\n", href, st, (unsigned long)n, k, p));
  }
  else if (ip->type != st || (ip->level == k && ip->size != n))
  { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Type incompatibility id='%s' expect type=%d size=%lu level=%u got type=%d size=%lu\n", href, ip->type, (unsigned long)ip->size, k, st, (unsigned long)n));
    strcpy(soap->id, href);
    soap->error = SOAP_HREF;
    return NULL;
  }
  if (fcopy || n < sizeof(void*) || *href != '#')
  { register struct soap_flist *fp = (struct soap_flist*)SOAP_MALLOC(soap, sizeof(struct soap_flist));
    if (!fp)
    { soap->error = SOAP_EOM;
      return NULL;
    }
    fp->next = ip->flist;
    fp->type = tt;
    fp->ptr = p;
    fp->level = k;
    fp->len = len;
    if (fcopy)
      fp->fcopy = fcopy;
    else
      fp->fcopy = soap_fcopy;
    ip->flist = fp;
    DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarding type=%d (target type=%d) size=%lu location=%p level=%u len=%lu href='%s'\n", st, tt, (unsigned long)n, p, k, (unsigned long)len, href));
  }
  else
  { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarding copying address %p for type=%d href='%s'\n", p, st, href));
    *(void**)p = ip->copy;
    ip->copy = p;
  }
  return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
testq %rdx, %rdx
sete %al
testq %rsi, %rsi
sete %dl
orb %al, %dl
jne 0x3fff8
movq %rsi, %r12
cmpb $0x0, (%rsi)
je 0x3fff8
movl %r9d, %ebp
movl %r8d, %r14d
movq %rdi, %r15
movq %rcx, (%rsp)
movq %r12, %rsi
callq 0x3f8ea
testq %rax, %rax
je 0x3ff3d
movq %rax, %r13
cmpl %r14d, 0x8(%rax)
jne 0x3ff1e
movl 0x48(%rsp), %eax
cmpl %eax, 0x38(%r13)
jne 0x3ff76
movq 0x40(%rsp), %rax
cmpq %rax, 0x10(%r13)
je 0x3ff76
leaq 0x16d38(%r15), %rdi
movq %r12, %rsi
callq 0x3090
movl $0x1a, 0x19214(%r15)
jmp 0x3fff6
movq %r15, %rdi
movq %r12, %rsi
callq 0x3f975
testq %rax, %rax
je 0x3fff6
movq %rax, %r13
movl %r14d, 0x8(%rax)
movq 0x40(%rsp), %rax
movq %rax, 0x10(%r13)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%r13)
movups %xmm0, 0x28(%r13)
movl $0x0, 0x38(%r13)
movq 0x50(%rsp), %r14
testq %r14, %r14
setne %al
cmpq $0x8, 0x40(%rsp)
setb %cl
orb %al, %cl
jne 0x3ffa2
cmpb $0x23, (%r12)
jne 0x3ffa2
movq 0x20(%r13), %rax
movq %rax, (%rbx)
movq %rbx, 0x20(%r13)
jmp 0x3fff8
movl $0x30, %edi
callq 0x3280
testq %rax, %rax
je 0x3ffe6
testq %r14, %r14
movq 0x28(%r13), %rcx
movq %rcx, (%rax)
movl %ebp, 0x8(%rax)
movq %rbx, 0x10(%rax)
movl 0x48(%rsp), %ecx
movl %ecx, 0x18(%rax)
movq (%rsp), %rcx
movq %rcx, 0x20(%rax)
leaq -0x5711(%rip), %rcx     # 0x3a8c7
cmovneq %r14, %rcx
movq %rcx, 0x28(%rax)
movq %rax, 0x28(%r13)
jmp 0x3fff1
movl $0x14, 0x19214(%r15)
testq %rax, %rax
jne 0x3fff8
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq