// File: /workspace/github_c_makefile_star2_O0/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_resolve
SOAP_FMAC2
soap_resolve(struct soap *soap)
{ register int i;
  register struct soap_ilist *ip = NULL;
  register struct soap_flist *fp = NULL;
  short flag;
  DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolving forwarded data\n"));
  for (i = 0; i < SOAP_IDHASH; i++)
  { for (ip = soap->iht[i]; ip; ip = ip->next)
    { if (ip->ptr)
      { register void *p, **q, *r;
        q = (void**)ip->link;
        ip->link = NULL;
        r = ip->ptr;
        DBGLOG(TEST, if (q) SOAP_MESSAGE(fdebug, "Traversing link chain to resolve id='%s'\n", ip->id));
        while (q)
        { p = *q;
          *q = r;
          DBGLOG(TEST,SOAP_MESSAGE(fdebug, "... link %p -> %p\n", q, r));
          q = (void**)p;
        }
      }
      else if (*ip->id == '#')
      { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Missing data for id='%s'\n", ip->id));
        strcpy(soap->id, ip->id + 1);
        return soap->error = SOAP_MISSING_ID;
      }
    }
  }
  do
  { flag = 0;
    DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolution phase\n"));
    for (i = 0; i < SOAP_IDHASH; i++)
    { for (ip = soap->iht[i]; ip; ip = ip->next)
      { if (ip->ptr && !soap_has_copies(soap, (const char*)ip->ptr, (const char*)ip->ptr + ip->size))
        { if (ip->copy)
          { register void *p, **q = (void**)ip->copy;
            DBGLOG(TEST, if (q) SOAP_MESSAGE(fdebug, "Traversing copy chain to resolve id='%s'\n", ip->id));
            ip->copy = NULL;
            do
            { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "... copy %p -> %p (%u bytes)\n", ip->ptr, q, (unsigned int)ip->size));
              p = *q;
              memcpy(q, ip->ptr, ip->size);
              q = (void**)p;
            } while (q);
            flag = 1;
          }
          for (fp = ip->flist; fp; fp = ip->flist)
          { register unsigned int k = fp->level;
            register void *p = ip->ptr;
            DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolving forwarded data type=%d location=%p level=%u,%u id='%s'\n", ip->type, p, ip->level, fp->level, ip->id));
            while (ip->level < k)
            { register void **q = (void**)soap_malloc(soap, sizeof(void*));  
              if (!q)
                return soap->error;
              *q = p;
              DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Descending one level, new location=%p holds=%p...\n", q, *q));
              p = (void*)q;
              k--;
            }
            if (fp->fcopy)
              fp->fcopy(soap, ip->type, fp->type, fp->ptr, fp->len, p, ip->size);
            else
              soap_fcopy(soap, ip->type, fp->type, fp->ptr, fp->len, p, ip->size);
            ip->flist = fp->next;
            SOAP_FREE(soap, fp);
            flag = 1;
          }
        }
      }
    }
  } while (flag);
#ifdef SOAP_DEBUG
  for (i = 0; i < SOAP_IDHASH; i++)
  { for (ip = soap->iht[i]; ip; ip = ip->next)
    { if (ip->copy || ip->flist)
      { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolution error: forwarded data for id='%s' could not be propagated, please report this problem to the developers\n", ip->id));
      }
    }
  }
#endif
  DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolution done\n"));
  return SOAP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x7cf, -0x14(%rbp)     # imm = 0x7CF
jge 0x53bd1
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq 0xa8(%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x53bc1
movq -0x20(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x53b6a
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x53b68
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x53b41
jmp 0x53baf
movq -0x20(%rbp), %rax
movsbl 0x3c(%rax), %eax
cmpl $0x23, %eax
jne 0x53bad
movq -0x10(%rbp), %rdi
addq $0x16d38, %rdi          # imm = 0x16D38
movq -0x20(%rbp), %rsi
addq $0x3c, %rsi
addq $0x1, %rsi
callq 0x3090
movq -0x10(%rbp), %rax
movl $0x19, 0x19214(%rax)
movl $0x19, -0x4(%rbp)
jmp 0x53e0a
jmp 0x53baf
jmp 0x53bb1
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x53b07
jmp 0x53bc3
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x53ae6
jmp 0x53bd3
movw $0x0, -0x2a(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x7cf, -0x14(%rbp)     # imm = 0x7CF
jge 0x53df6
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq 0xa8(%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x53de6
movq -0x20(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x53dd4
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rdx
movq -0x20(%rbp), %rax
addq 0x10(%rax), %rdx
callq 0x53e20
cmpl $0x0, %eax
jne 0x53dd4
movq -0x20(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x53ca1
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x58(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x58(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdx
callq 0x3240
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x53c68
movw $0x1, -0x2a(%rbp)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x53dd2
movq -0x28(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rax
movl 0x38(%rax), %eax
cmpl -0x5c(%rbp), %eax
jae 0x53d23
movq -0x10(%rbp), %rdi
movl $0x8, %esi
callq 0x518f0
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x70(%rbp)
jne 0x53d05
movq -0x10(%rbp), %rax
movl 0x19214(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x53e0a
movq -0x68(%rbp), %rcx
movq -0x70(%rbp), %rax
movq %rcx, (%rax)
movq -0x70(%rbp), %rax
movq %rax, -0x68(%rbp)
movl -0x5c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x53cce
movq -0x28(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x53d6c
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rcx
movl 0x8(%rcx), %esi
movq -0x28(%rbp), %rcx
movl 0x8(%rcx), %edx
movq -0x28(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x28(%rbp), %r8
movq 0x20(%r8), %r8
movq -0x68(%rbp), %r9
movq -0x20(%rbp), %r10
movq 0x10(%r10), %r10
movq %r10, (%rsp)
callq *%rax
jmp 0x53da3
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x28(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x28(%rbp), %rax
movq 0x20(%rax), %r8
movq -0x68(%rbp), %r9
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, (%rsp)
callq 0x53f30
movq -0x28(%rbp), %rax
movq (%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x28(%rbp), %rdi
callq 0x3030
movw $0x1, -0x2a(%rbp)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x53cad
jmp 0x53dd4
jmp 0x53dd6
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x53c01
jmp 0x53de8
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x53be0
jmp 0x53df8
cmpw $0x0, -0x2a(%rbp)
jne 0x53bd3
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)