// File: /workspace/github_c_makefile_star2_O1/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_id_lookup
SOAP_FMAC1
void*
SOAP_FMAC2
soap_id_lookup(struct soap *soap, const char *id, void **p, int t, size_t n, unsigned int k)
{ struct soap_ilist *ip;
  void **q;
  if (!p || !id || !*id)
    return p;
  ip = soap_lookup(soap, id); /* lookup pointer to hash table entry for string id */
  if (!ip)
  { if (!(ip = soap_enter(soap, id))) /* new hash table entry for string id */
      return NULL;
    DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarding first href='%s' type=%d %p (%u bytes)\n", id, t, p, (unsigned int)n));
    ip->type = t;
    ip->size = n; 
    ip->link = p;
    ip->copy = NULL;
    ip->flist = NULL;
    ip->ptr = NULL;
    ip->level = k;
    *p = NULL;
  }
  else if (ip->ptr)
  { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolved href='%s' type=%d location=%p (%u bytes)\n", id, t, ip->ptr, (unsigned int)n));
    if (ip->type != t)
    { strcpy(soap->id, id);
      soap->error = SOAP_HREF;
      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Type incompatibility: href='%s' id-type=%d href-type=%d\n", id, ip->type, t));
      return NULL;
    }
    while (ip->level < k)
    { q = (void**)soap_malloc(soap, sizeof(void*));  
      if (!q)
        return NULL;
      *p = (void*)q;
      p = q;
      k--;
      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Descending one level...\n"));
    }
    *p = ip->ptr;
  }
  else if (ip->level > k)
  { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolving level %u pointers to href='%s'\n", ip->level, id));
    while (ip->level > k)
    { void *s, **r = &ip->link;
      q = (void**)ip->link;
      while (q)
      { *r = (void*)soap_malloc(soap, sizeof(void*));
        if (!*r)
	  return NULL;
        s = *q;
        *q = *r;
        r = (void**)*r;
        q = (void**)s;
      }
      *r = NULL;
      ip->size = n; 
      ip->copy = NULL;
      ip->level = ip->level - 1;
      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Descending one level...\n"));
    }
    q = (void**)ip->link;
    ip->link = p;
    *p = (void*)q;
  }
  else
  { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarded href='%s' type=%d location=%p (%u bytes)\n", id, t, p, (unsigned int)n));
    while (ip->level < k)
    { q = (void**)soap_malloc(soap, sizeof(void*));  
      if (!q)
        return NULL;
      *p = q;
      p = q;
      k--;
      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Descending one level...\n"));
    }
    q = (void**)ip->link;
    ip->link = p;
    *p = (void*)q;
  }
  return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %r13d
movq %rdx, %r14
testq %rdx, %rdx
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x3fe90
movq %rsi, %rbp
cmpb $0x0, (%rsi)
je 0x3fe90
movl %r9d, %ebx
movq %rdi, %r15
movq %r8, 0x8(%rsp)
movq %rbp, %rsi
callq 0x3f8ea
testq %rax, %rax
je 0x3fd63
movq %rax, %r12
cmpq $0x0, 0x30(%rax)
je 0x3fda0
cmpl %r13d, 0x8(%r12)
jne 0x3fe2d
cmpl %ebx, 0x38(%r12)
jae 0x3fe79
movl $0x8, %esi
movq %r15, %rdi
callq 0x39095
testq %rax, %rax
je 0x3fe47
movq %rax, %r13
movq %rax, (%r14)
decl %ebx
movq %rax, %r14
cmpl %ebx, 0x38(%r12)
jb 0x3fd36
jmp 0x3fe7c
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3f975
testq %rax, %rax
je 0x3fe47
movl %r13d, 0x8(%rax)
movq 0x8(%rsp), %rcx
movq %rcx, 0x10(%rax)
movq %r14, 0x18(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
xorl %ecx, %ecx
movq %rcx, 0x30(%rax)
movl %ebx, 0x38(%rax)
movq %rcx, (%r14)
jmp 0x3fe90
cmpl %ebx, 0x38(%r12)
jbe 0x3fe4c
movq %r12, %rax
addq $0x18, %rax
movq %rax, 0x18(%rsp)
xorl %r13d, %r13d
movq %r14, 0x20(%rsp)
movq %r12, 0x10(%rsp)
cmpl %ebx, 0x38(%r12)
jbe 0x3fe83
movq 0x18(%rsp), %r14
movq (%r14), %r12
testq %r12, %r12
sete %bpl
je 0x3fe04
movl $0x8, %esi
movq %r15, %rdi
callq 0x39095
movq %rax, (%r14)
testq %rax, %rax
je 0x3fe1c
movq %r12, %rcx
movq (%r12), %r12
movq %rax, (%rcx)
movq (%r14), %r14
jmp 0x3fdd7
movq %r13, (%r14)
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rcx, 0x10(%rax)
movq %r13, 0x20(%rax)
decl 0x38(%rax)
testb %bpl, %bpl
movq 0x20(%rsp), %r14
movq 0x10(%rsp), %r12
jne 0x3fdc4
jmp 0x3fe93
leaq 0x16d38(%r15), %rdi
movq %rbp, %rsi
callq 0x3090
movl $0x1a, 0x19214(%r15)
xorl %r13d, %r13d
jmp 0x3fe93
cmpl %ebx, 0x38(%r12)
jae 0x3fea5
movl $0x8, %esi
movq %r15, %rdi
callq 0x39095
testq %rax, %rax
je 0x3fe47
movq %rax, %r13
movq %rax, (%r14)
decl %ebx
movq %rax, %r14
cmpl %ebx, 0x38(%r12)
jb 0x3fe53
jmp 0x3fea8
movq %r14, %r13
movq 0x30(%r12), %rax
jmp 0x3feb2
movq 0x18(%r12), %rax
movq %r14, 0x18(%r12)
movq %rax, (%r14)
movq %r14, %r13
movq %r13, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %r13
movq 0x18(%r12), %rax
movq %r13, 0x18(%r12)
movq %rax, (%r13)
jmp 0x3fe93