// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x20(%rbp), %rax
movl 0x18(%rbp), %eax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movl %r9d, -0x30(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x5c9e2
cmpq $0x0, -0x18(%rbp)
je 0x5c9e2
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x5c9ef
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x5cbb3
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5bf30
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x5ca7e
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5bfc0
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0x5ca2b
movq $0x0, -0x8(%rbp)
jmp 0x5cbb3
movl -0x2c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x8(%rax)
movq 0x10(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x38(%rbp), %rax
movl $0x0, 0x38(%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x28(%rax)
jmp 0x5cad5
movq -0x38(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x2c(%rbp), %eax
jne 0x5caa4
movq -0x38(%rbp), %rax
movl 0x38(%rax), %eax
cmpl 0x18(%rbp), %eax
jne 0x5cad3
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
cmpq 0x10(%rbp), %rax
je 0x5cad3
movq -0x10(%rbp), %rdi
addq $0x16d38, %rdi          # imm = 0x16D38
movq -0x18(%rbp), %rsi
callq 0x3090
movq -0x10(%rbp), %rax
movl $0x1a, 0x19214(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x5cbb3
jmp 0x5cad5
cmpq $0x0, 0x20(%rbp)
jne 0x5caf3
cmpq $0x8, 0x10(%rbp)
jb 0x5caf3
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
je 0x5cb90
movl $0x30, %edi
callq 0x3290
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x5cb23
movq -0x10(%rbp), %rax
movl $0x14, 0x19214(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x5cbb3
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movl -0x30(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movl 0x18(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x20(%rax)
cmpq $0x0, 0x20(%rbp)
je 0x5cb73
movq 0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0x5cb82
movq -0x40(%rbp), %rax
leaq -0x8c4e(%rip), %rcx     # 0x53f30
movq %rcx, 0x28(%rax)
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0x5cbab
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)