LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_s2hex
SOAP_FMAC1
char*
SOAP_FMAC2
soap_s2hex(struct soap *soap, const unsigned char *s, char *t, int n)
{ register char *p;
  if (!t)
    t = (char*)soap_malloc(soap, 2 * n + 1);
  if (!t)
    return NULL;
  p = t;
  t[0] = '\0';
  if (s)
  { for (; n > 0; n--)
    { register int m = *s++;
      *t++ = (char)((m >> 4) + (m > 159 ? 'a' - 10 : '0'));
      m &= 0x0F;
      *t++ = (char)(m + (m > 9 ? 'a' - 10 : '0'));
    }
  }
  *t++ = '\0';
  return p;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdx, %rax
movq %rsi, %r14
testq %rdx, %rdx
jne 0x45079
leal 0x1(,%rbx,2), %eax
movslq %eax, %rsi
callq 0x35f17
testq %rax, %rax
je 0x450e5
movb $0x0, (%rax)
testq %r14, %r14
sete %cl
testl %ebx, %ebx
setle %dl
orb %cl, %dl
movq %rax, %rcx
jne 0x450da
incl %ebx
pushq $0x57
popq %rdx
pushq $0x30
popq %rsi
movq %rax, %rcx
movb (%r14), %dil
movl %edx, %r8d
cmpb $-0x60, %dil
jae 0x450a8
movl %esi, %r8d
movl %edi, %r9d
shrb $0x4, %r9b
addb %r9b, %r8b
movb %r8b, (%rcx)
andb $0xf, %dil
movl %edx, %r8d
cmpb $0xa, %dil
jae 0x450c5
movl %esi, %r8d
incq %r14
addb %dil, %r8b
movb %r8b, 0x1(%rcx)
addq $0x2, %rcx
decl %ebx
cmpl $0x1, %ebx
ja 0x45099
movb $0x0, (%rcx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
xorl %eax, %eax
jmp 0x450dd
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_hex2s
SOAP_FMAC1
const char*
SOAP_FMAC2
soap_hex2s(struct soap *soap, const char *s, char *t, size_t l, int *n)
{ register const char *p;
  if (!s || !*s)
  { if (n)
      *n = 0;
    if (soap->error)
      return NULL;
    return SOAP_NON_NULL;
  }
  if (!t)
  { l = strlen(s) / 2;
    t = (char*)soap_malloc(soap, l);
  }
  if (!t)
    return NULL;
  p = t;
  while (l)
  { register int d1, d2;
    d1 = *s++;
    if (!d1)
      break;
    d2 = *s++;
    if (!d2)
      break;
    *t++ = ((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0');
    l--;
  }
  if (n)
    *n = (int)(t - p);
  return p;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rdi, %r12
testq %rsi, %rsi
je 0x45197
movq %rsi, %r14
cmpb $0x0, (%rsi)
je 0x45197
movq %rcx, %r15
movq %rdx, %rax
testq %rdx, %rdx
jne 0x45139
movq %r14, %rdi
callq 0x3110
movq %rax, %r15
shrq %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x35f17
testq %rax, %rax
je 0x451c0
xorl %ecx, %ecx
cmpq %rcx, %r15
je 0x451b7
movb (%r14,%rcx,2), %sil
testb %sil, %sil
je 0x451b7
movb 0x1(%r14,%rcx,2), %dl
testb %dl, %dl
je 0x451b7
movl %esi, %edi
andb $0x7, %dil
addb $0x9, %dil
cmpb $0x41, %sil
movzbl %sil, %esi
movzbl %dil, %edi
cmovll %esi, %edi
shlb $0x4, %dil
movl %edx, %esi
andb $0x7, %sil
addb $0x9, %sil
leal -0x30(%rdx), %r8d
cmpb $0x41, %dl
movzbl %r8b, %edx
movzbl %sil, %esi
cmovll %edx, %esi
addb %dil, %sil
movb %sil, (%rax,%rcx)
incq %rcx
jmp 0x4513b
testq %rbx, %rbx
je 0x4519f
andl $0x0, (%rbx)
xorl %eax, %eax
cmpl $0x0, 0x19214(%r12)
leaq 0x7fb0(%rip), %rcx      # 0x4d161
cmoveq %rcx, %rax
jmp 0x451c2
testq %rbx, %rbx
je 0x451c2
movl %ecx, (%rbx)
jmp 0x451c2
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_response
SOAP_FMAC2
soap_response(struct soap *soap, int status)
{ register size_t count;
  if (!(soap->omode & (SOAP_ENC_XML | SOAP_IO_STORE /* this tests for chunking too */))
   && (status == SOAP_HTML || status == SOAP_FILE))
    soap->omode = (soap->omode & ~SOAP_IO) | SOAP_IO_STORE;
  soap->status = status;
  count = soap_count_attachments(soap);
  if (soap_begin_send(soap))
    return soap->error;
#ifndef WITH_NOHTTP
  if ((soap->mode & SOAP_IO) != SOAP_IO_STORE && !(soap->mode & SOAP_ENC_XML))
  { register int n = soap->mode;
    soap->mode &= ~(SOAP_IO | SOAP_ENC_ZLIB);
    if ((n & SOAP_IO) != SOAP_IO_FLUSH)
      soap->mode |= SOAP_IO_BUFFER;
    if ((soap->error = soap->fresponse(soap, status, count)))
      return soap->error;
#ifndef WITH_LEANER
    if ((n & SOAP_IO) == SOAP_IO_CHUNK)
    { if (soap_flush(soap))
        return soap->error;
    }
#endif
    soap->mode = n;
  }
#endif
  return SOAP_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movl 0xc(%rdi), %eax
movl %eax, %ecx
andl $0x42, %ecx
movl %esi, %edx
andl $-0x2, %edx
xorl $0x3ea, %edx            # imm = 0x3EA
orl %ecx, %edx
jne 0x454b0
andl $-0x44, %eax
orl $0x2, %eax
movl %eax, 0xc(%rbx)
movl %ebp, 0x19210(%rbx)
movq %rbx, %rdi
callq 0x45544
movq %rax, %r14
movq %rbx, %rdi
callq 0x3b303
testl %eax, %eax
je 0x454d5
movl 0x19214(%rbx), %eax
jmp 0x4553b
movl 0x4(%rbx), %r15d
movl %r15d, %r12d
andl $0x3, %r12d
cmpl $0x2, %r12d
sete %cl
movl %r15d, %edx
andl $0x40, %edx
shrl $0x6, %edx
xorl %eax, %eax
orb %cl, %dl
jne 0x4553b
movl %r15d, %eax
andl $0xfffffbbc, %eax       # imm = 0xFFFFFBBC
xorl %ecx, %ecx
testl %r12d, %r12d
setne %cl
orl %eax, %ecx
movl %ecx, 0x4(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq *0x5fa0(%rbx)
movl %eax, 0x19214(%rbx)
testl %eax, %eax
jne 0x4553b
cmpl $0x3, %r12d
jne 0x45535
movq %rbx, %rdi
callq 0x348cc
testl %eax, %eax
jne 0x454cd
movl %r15d, 0x4(%rbx)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_set_validation_fault
static const char*
soap_set_validation_fault(struct soap *soap, const char *s, const char *t)
{ if (*soap->tag)
    sprintf(soap->msgbuf, "Validation constraint violation: %s%s in element '%s'", s, t?t:SOAP_STR_EOS, soap->tag);
  else
    sprintf(soap->msgbuf, "Validation constraint violation: %s%s", s, t?t:SOAP_STR_EOS);
  return soap->msgbuf;
}

// Assembly:
pushq %rbx
movq %rdx, %rax
movq %rsi, %rdx
leaq 0x16138(%rdi), %rbx
testq %rax, %rax
leaq 0x76a4(%rip), %rcx      # 0x4d161
cmovneq %rax, %rcx
cmpb $0x0, 0x16938(%rdi)
je 0x45ae7
movq %rdi, %r8
addq $0x16938, %r8           # imm = 0x16938
leaq 0x8f42(%rip), %rsi      # 0x4ea1d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3370
jmp 0x45af8
leaq 0x8f65(%rip), %rsi      # 0x4ea53
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3370
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_strerror
static const char*
soap_strerror(struct soap *soap)
{ register int err = soap->errnum;
  if (err)
  {
#ifndef WIN32
    return strerror(err);
#else
#ifndef UNDER_CE
    DWORD len;
    *soap->msgbuf = '\0';
    len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)soap->msgbuf, (DWORD)sizeof(soap->msgbuf), NULL);
#else
    DWORD i, len;
    *soap->msgbuf = '\0';
    len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, (LPTSTR)soap->msgbuf, (DWORD)(sizeof(soap->msgbuf)/sizeof(TCHAR)), NULL);
    for (i = 0; i <= len; i++)
    { if (((TCHAR*)soap->msgbuf)[i] < 0x80)
        soap->msgbuf[i] = (char)((TCHAR*)soap->msgbuf)[i];
      else
        soap->msgbuf[i] = '?';
    }
#endif
#endif
  }
  else
  { char *s = soap->msgbuf;
#ifndef WITH_LEAN
    int rt = soap->recv_timeout, st = soap->send_timeout;
    int ru = ' ', su = ' ';
#endif
    strcpy(s, "Operation interrupted or timed out");
#ifndef WITH_LEAN
    if (rt < 0)
    { rt = -rt;
      ru = 'u';
    }
    if (st < 0)
    { st = -st;
      su = 'u';
    }
    if (rt)
      sprintf(s + strlen(s), " (%d%cs receive delay)", rt, ru);
    if (st)
      sprintf(s + strlen(s), " (%d%cs send delay)", st, su);
#endif
  }
  return soap->msgbuf;
}

// Assembly:
movl 0x1921c(%rdi), %eax
testl %eax, %eax
je 0x45b0e
movl %eax, %edi
jmp 0x33b0
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x16138(%rdi), %rbx
movl 0x50(%rdi), %eax
movl 0x54(%rdi), %r13d
movups 0x9171(%rip), %xmm0     # 0x4ec9f
movups %xmm0, 0x16138(%rdi)
movups 0x9173(%rip), %xmm0     # 0x4ecaf
movups %xmm0, 0x16148(%rdi)
movl %r13d, %ebp
negl %ebp
cmovsl %r13d, %ebp
movl $0x74756f, 0x16157(%rdi) # imm = 0x74756F
testl %r13d, %r13d
pushq $0x75
popq %rcx
pushq $0x20
popq %r15
movl %r15d, %r14d
cmovsl %ecx, %r14d
testl %eax, %eax
je 0x45b9b
movl %eax, %r12d
negl %r12d
cmovsl %eax, %r12d
testl %eax, %eax
cmovsl %ecx, %r15d
movq %rbx, %rdi
callq 0x3110
leaq (%rax,%rbx), %rdi
leaq 0x9134(%rip), %rsi      # 0x4ecc2
movl %r12d, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x3370
testl %r13d, %r13d
je 0x45bbf
movq %rbx, %rdi
callq 0x3110
leaq (%rax,%rbx), %rdi
leaq 0x9126(%rip), %rsi      # 0x4ecd9
movl %ebp, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x3370
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: http_error
static const char*
http_error(struct soap *soap, int status)
{ register const char *msg = SOAP_STR_EOS;
#ifndef WITH_LEAN
  msg = soap_code_str(h_http_error_codes, status);
  if (!msg)
    msg = SOAP_STR_EOS;
#endif
  return msg;
}

// Assembly:
pushq %rax
movl %edi, %esi
leaq 0x29fa5(%rip), %rdi     # 0x6fb80
callq 0x35176
testq %rax, %rax
leaq 0x7577(%rip), %rcx      # 0x4d161
cmoveq %rcx, %rax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_send_empty_response
SOAP_FMAC2
soap_send_empty_response(struct soap *soap, int httpstatuscode)
{ register soap_mode m = soap->omode;
  soap->count = 0;
  if ((m & SOAP_IO) == SOAP_IO_CHUNK)
    soap->omode = (m & ~SOAP_IO) | SOAP_IO_BUFFER;
  if (soap_response(soap, httpstatuscode) || soap_end_send(soap))
  { soap->omode = m;
    return soap_closesock(soap);
  }
  soap->omode = m;
  return soap->error = SOAP_STOP; /* stops the server's response */
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0xc(%rdi), %ebp
andq $0x0, 0x6110(%rdi)
movl %ebp, %eax
notl %eax
testb $0x3, %al
jne 0x45f2f
movl %ebp, %eax
andl $-0x3, %eax
movl %eax, 0xc(%rbx)
movq %rbx, %rdi
callq 0x45483
testl %eax, %eax
jne 0x45f47
movq %rbx, %rdi
callq 0x3c2ef
testl %eax, %eax
je 0x45f58
movl %ebp, 0xc(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x3858f
movl %ebp, 0xc(%rbx)
movl $0x3e8, 0x19214(%rbx)   # imm = 0x3E8
movl $0x3e8, %eax            # imm = 0x3E8
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_recv_empty_response
SOAP_FMAC2
soap_recv_empty_response(struct soap *soap)
{ if (!soap_begin_recv(soap))
    soap_end_recv(soap);
  else if (soap->error == SOAP_NO_DATA || soap->error == 202)
    soap->error = SOAP_OK;
  return soap_closesock(soap);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x43f5a
testl %eax, %eax
je 0x45f99
movl 0x19214(%rbx), %eax
cmpl $0xca, %eax
je 0x45f90
cmpl $0xe, %eax
jne 0x45fa1
andl $0x0, 0x19214(%rbx)
jmp 0x45fa1
movq %rbx, %rdi
callq 0x3c8c4
movq %rbx, %rdi
popq %rbx
jmp 0x3858f
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_set_error
static int
soap_set_error(struct soap *soap, const char *faultcode, const char *faultsubcodeQName, const char *faultstring, const char *faultdetailXML, int soaperror)
{ *soap_faultcode(soap) = faultcode;
  if (faultsubcodeQName)
    *soap_faultsubcode(soap) = faultsubcodeQName;
  *soap_faultstring(soap) = faultstring;
  if (faultdetailXML && *faultdetailXML)
  { register const char **s = soap_faultdetail(soap);
    if (s)
      *s = faultdetailXML;
  }
  return soap->error = soaperror;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebx
movq %r8, %r14
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %rbp
movq %rdi, %r15
callq 0x3954
movq %rbp, (%rax)
testq %r13, %r13
je 0x45fdf
movq %r15, %rdi
callq 0x3977
movq %r13, (%rax)
movq %r15, %rdi
callq 0x39d0
movq %r12, (%rax)
testq %r14, %r14
je 0x46005
cmpb $0x0, (%r14)
je 0x46005
movq %r15, %rdi
callq 0x39f3
testq %rax, %rax
je 0x46005
movq %r14, (%rax)
movl %ebx, 0x19214(%r15)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_copy_fault
static int
soap_copy_fault(struct soap *soap, const char *faultcode, const char *faultsubcodeQName, const char *faultstring, const char *faultdetailXML)
{ char *r = NULL, *s = NULL, *t = NULL;
  if (faultsubcodeQName)
    r = soap_strdup(soap, faultsubcodeQName);
  if (faultstring)
    s = soap_strdup(soap, faultstring);
  if (faultdetailXML)
    t = soap_strdup(soap, faultdetailXML);
  return soap_set_error(soap, faultcode, r, s, t, SOAP_FAULT);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r8, %r12
movq %rcx, %r13
movq %rsi, %rbx
movq %rdi, %r14
testq %rdx, %rdx
je 0x46076
movq %r14, %rdi
movq %rdx, %rsi
callq 0x37284
movq %rax, %r15
jmp 0x46079
xorl %r15d, %r15d
testq %r13, %r13
je 0x4608e
movq %r14, %rdi
movq %r13, %rsi
callq 0x37284
movq %rax, %r13
jmp 0x46091
xorl %r13d, %r13d
testq %r12, %r12
je 0x460a6
movq %r14, %rdi
movq %r12, %rsi
callq 0x37284
movq %rax, %r8
jmp 0x460a9
xorl %r8d, %r8d
pushq $0xc
popq %r9
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r13, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x45faa
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_print_fault
SOAP_FMAC2
soap_print_fault(struct soap *soap, FILE *fd)
{ if (soap_check_state(soap))
    fprintf(fd, "Error: soap struct state not initialized\n");
  else if (soap->error)
  { const char *c, *v = NULL, *s, **d;
    d = soap_faultcode(soap);
    if (!*d)
      soap_set_fault(soap);
    c = *d;
    if (soap->version == 2)
      v = *soap_faultsubcode(soap);
    s = *soap_faultstring(soap);
    d = soap_faultdetail(soap);
    fprintf(fd, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, c, v ? v : "no subcode", s ? s : "[no reason]", d && *d ? *d : "[no detail]");
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
testq %rdi, %rdi
je 0x46159
movq %rdi, %r15
movl (%rdi), %eax
decl %eax
cmpw $0x2, %ax
jae 0x46159
cmpl $0x0, 0x19214(%r15)
je 0x46204
movq %r15, %rdi
callq 0x3954
movq (%rax), %r14
testq %r14, %r14
jne 0x46144
movq %rax, %r12
movq %r15, %rdi
callq 0x456ad
movq (%r12), %r14
cmpw $0x2, 0x2(%r15)
jne 0x46177
movq %r15, %rdi
callq 0x3977
movq (%rax), %r12
jmp 0x4617a
leaq 0x8036(%rip), %rdi      # 0x4e196
pushq $0x29
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x3390
xorl %r12d, %r12d
movq %r15, %rdi
callq 0x39d0
movq (%rax), %r13
movq %r15, %rdi
callq 0x39f3
movswl 0x2(%r15), %ecx
leaq 0x8054(%rip), %rsi      # 0x4e1ed
leaq 0x8045(%rip), %rdx      # 0x4e1e5
testl %ecx, %ecx
cmoveq %rsi, %rdx
jne 0x461af
movl 0x19214(%r15), %ecx
testq %r12, %r12
leaq 0x803b(%rip), %r9       # 0x4e1f4
cmovneq %r12, %r9
testq %r13, %r13
leaq 0x8038(%rip), %r10      # 0x4e1ff
cmovneq %r13, %r10
testq %rax, %rax
je 0x461e3
movq (%rax), %rax
testq %rax, %rax
leaq 0x802e(%rip), %r11      # 0x4e20b
cmovneq %rax, %r11
jmp 0x461ea
leaq 0x8021(%rip), %r11      # 0x4e20b
leaq 0x7fcf(%rip), %rsi      # 0x4e1c0
movq %rbx, %rdi
movq %r14, %r8
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x3220
popq %rcx
popq %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_sprint_fault
SOAP_FMAC1
char*
SOAP_FMAC2
soap_sprint_fault(struct soap *soap, char *buf, size_t len)
{ if (soap_check_state(soap))
    strncpy(buf, "Error: soap struct not initialized", len);
  else if (soap->error)
  { const char *c, *v = NULL, *s, **d;
    d = soap_faultcode(soap);
    if (!*d)
      soap_set_fault(soap);
    c = *d;
    if (soap->version == 2)
      v = *soap_faultsubcode(soap);
    s = *soap_faultstring(soap);
    d = soap_faultdetail(soap);
#ifdef HAVE_SNPRINTF
# ifdef WIN32
    _snprintf
# else
    snprintf
# endif
      (buf, len, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, c, v ? v : "no subcode", s ? s : "[no reason]", d && *d ? *d : "[no detail]");
#else
    if (len > 40 + (v ? strlen(v) : 0) + (s ? strlen(s) : 0) + (d && *d ? strlen(*d) : 0))
      sprintf(buf, "%s%d fault: %s [%s]\n\"%s\"\nDetail: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, c, v ? v : "no subcode", s ? s : "[no reason]", d && *d ? *d : "[no detail]");
    else if (len > 40)
      sprintf(buf, "%s%d fault: %s\n", soap->version ? "SOAP 1." : "Error ", soap->version ? (int)soap->version : soap->error, c);
    else
      buf[0] = '\0';
#endif
  }
  return buf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
testq %rdi, %rdi
je 0x46275
movq %rdi, %r12
movl (%rdi), %eax
decl %eax
cmpw $0x2, %ax
jae 0x46275
cmpl $0x0, 0x19214(%r12)
je 0x46330
movq %r12, %rdi
callq 0x3954
movq (%rax), %r15
testq %r15, %r15
jne 0x4625f
movq %rax, %r13
movq %r12, %rdi
callq 0x456ad
movq (%r13), %r15
cmpw $0x2, 0x2(%r12)
jne 0x46295
movq %r12, %rdi
callq 0x3977
movq (%rax), %r13
jmp 0x46298
leaq 0x7f9b(%rip), %rsi      # 0x4e217
movq %rbx, %rdi
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3070
xorl %r13d, %r13d
movq %r12, %rdi
callq 0x39d0
movq (%rax), %rbp
movq %r12, %rdi
callq 0x39f3
movswl 0x2(%r12), %r8d
leaq 0x7f35(%rip), %rdx      # 0x4e1ed
leaq 0x7f26(%rip), %rcx      # 0x4e1e5
testl %r8d, %r8d
cmoveq %rdx, %rcx
jne 0x462d0
movl 0x19214(%r12), %r8d
testq %r13, %r13
leaq 0x7f1a(%rip), %r10      # 0x4e1f4
cmovneq %r13, %r10
testq %rbp, %rbp
leaq 0x7f17(%rip), %r11      # 0x4e1ff
cmovneq %rbp, %r11
testq %rax, %rax
je 0x46304
movq (%rax), %rax
testq %rax, %rax
leaq 0x7f0d(%rip), %r12      # 0x4e20b
cmovneq %rax, %r12
jmp 0x4630b
leaq 0x7f00(%rip), %r12      # 0x4e20b
subq $0x8, %rsp
leaq 0x7eaa(%rip), %rdx      # 0x4e1c0
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %r9
xorl %eax, %eax
pushq %r12
pushq %r11
pushq %r10
callq 0x3150
addq $0x20, %rsp
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_print_fault_location
SOAP_FMAC2
soap_print_fault_location(struct soap *soap, FILE *fd)
{ 
#ifndef WITH_LEAN
  int i, j, c1, c2;
  if (soap->error && soap->error != SOAP_STOP && soap->bufidx <= soap->buflen && soap->buflen > 0 && soap->buflen <= SOAP_BUFLEN)
  { i = (int)soap->bufidx - 1;
    if (i <= 0)
      i = 0;
    c1 = soap->buf[i];
    soap->buf[i] = '\0';
    if ((int)soap->buflen >= i + 1024)
      j = i + 1023;
    else
      j = (int)soap->buflen - 1;
    c2 = soap->buf[j];
    soap->buf[j] = '\0';
    fprintf(fd, "%s%c\n<!-- ** HERE ** -->\n", soap->buf, c1);
    if (soap->bufidx < soap->buflen)
      fprintf(fd, "%s\n", soap->buf + soap->bufidx);
    soap->buf[i] = c1;
    soap->buf[j] = c2;
  }
#endif
}

// Assembly:
movl 0x19214(%rdi), %eax
testl %eax, %eax
je 0x46446
cmpl $0x3e8, %eax            # imm = 0x3E8
je 0x46446
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x60f0(%rdi), %rax
movq 0x60f8(%rdi), %rcx
cmpq %rcx, %rax
seta %dl
decq %rcx
cmpq $0x10000, %rcx          # imm = 0x10000
setae %cl
orb %dl, %cl
jne 0x46438
movq %rsi, %rbx
leal -0x1(%rax), %ecx
xorl %edx, %edx
cmpl $0x2, %eax
cmovll %edx, %ecx
leaq 0x6138(%r14), %r15
movslq %ecx, %r12
movb 0x6138(%r14,%r12), %bpl
movb %dl, 0x6138(%r14,%r12)
movl 0x60f8(%r14), %eax
leal 0x400(%r12), %ecx
leal 0x3ff(%r12), %esi
leal -0x1(%rax), %edi
cmpl %eax, %ecx
cmovlel %esi, %edi
movsbl %bpl, %ecx
movslq %edi, %r13
movb 0x6138(%r14,%r13), %al
movb %al, 0x7(%rsp)
movb %dl, 0x6138(%r14,%r13)
leaq 0x7e3f(%rip), %rsi      # 0x4e23a
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3220
movq 0x60f0(%r14), %rdx
cmpq 0x60f8(%r14), %rdx
jae 0x4642c
addq %r15, %rdx
leaq 0x7dbf(%rip), %rsi      # 0x4e1e1
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3220
movb %bpl, (%r15,%r12)
movb 0x7(%rsp), %al
movb %al, (%r15,%r13)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_register_plugin_arg
SOAP_FMAC2
soap_register_plugin_arg(struct soap *soap, int (*fcreate)(struct soap*, struct soap_plugin*, void*), void *arg)
{ register struct soap_plugin *p;
  register int r;
  if (!(p = (struct soap_plugin*)SOAP_MALLOC(soap, sizeof(struct soap_plugin))))
    return soap->error = SOAP_EOM;
  p->id = NULL;
  p->data = NULL;
  p->fcopy = NULL;
  p->fdelete = NULL;
  r = fcreate(soap, p, arg);
  if (!r && p->fdelete)
  { p->next = soap->plugins;
    soap->plugins = p;
    DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Registered '%s' plugin\n", p->id));
    return SOAP_OK;
  }
  DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not register plugin '%s': plugin returned error %d (or fdelete callback not set)\n", p->id?p->id:"?", r));
  SOAP_FREE(soap, p);
  return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
pushq $0x28
popq %rdi
callq 0x3290
testq %rax, %rax
je 0x4648f
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rax)
movups %xmm0, 0x8(%rax)
movq %rbx, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq *%r15
movl %eax, %ebp
testl %eax, %eax
je 0x4649e
movq %r14, %rdi
callq 0x3030
jmp 0x464b8
movl $0x14, 0x19214(%rbx)
pushq $0x14
popq %rbp
jmp 0x464b8
cmpq $0x0, 0x20(%r14)
je 0x46485
movq 0x5f50(%rbx), %rax
movq %rax, (%r14)
movq %r14, 0x5f50(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: http_send_header
static int
http_send_header(struct soap *soap, const char *s)
{ register const char *t;
  do
  { t = strchr(s, '\n'); /* disallow \n in HTTP headers */
    if (!t)
      t = s + strlen(s);
    if (soap_send_raw(soap, s, t - s))
      return soap->error;
    s = t + 1;
  } while (*t);
  return SOAP_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
pushq $0xa
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0x3130
movq %rax, %r15
testq %rax, %rax
jne 0x464fc
movq %r14, %rdi
callq 0x3110
movq %rax, %r15
addq %r14, %r15
movq %r15, %rdx
subq %r14, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x347c4
testl %eax, %eax
jne 0x4651f
leaq 0x1(%r15), %r14
cmpb $0x0, (%r15)
jne 0x464dc
xorl %eax, %eax
jmp 0x46525
movl 0x19214(%rbx), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/md5.c
// Function: MD5Update
void MD5Update(MD5_CTX *context,unsigned char *input,unsigned int inputlen)
{
    unsigned int i = 0,index = 0,partlen = 0;
    index = (context->count[0] >> 3) & 0x3F;
    partlen = 64 - index;
    context->count[0] += inputlen << 3;
    if(context->count[0] < (inputlen << 3))
        context->count[1]++;
    context->count[1] += inputlen >> 29;

    if(inputlen >= partlen)
    {
        memcpy(&context->buffer[index],input,partlen);
        MD5Transform(context->state,context->buffer);
        for(i = partlen;i+64 <= inputlen;i+=64)
            MD5Transform(context->state,&input[i]);
        index = 0;
    }
    else
    {
        i = 0;
    }
    memcpy(&context->buffer[index],&input[i],inputlen-i);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rdi, %r14
movl (%rdi), %ecx
movl %ecx, %eax
shrl $0x3, %eax
andl $0x3f, %eax
pushq $0x40
popq %rbp
subl %eax, %ebp
leal (,%rbx,8), %edx
movl %ebx, %edi
shrl $0x1d, %edi
addl %ecx, %edx
movl %edx, (%r14)
adcl %edi, 0x4(%r14)
movq %rsi, %r15
cmpl %ebx, %ebp
jbe 0x4658a
movl %eax, %eax
xorl %ebp, %ebp
jmp 0x465cc
leaq 0x18(%r14), %r13
leaq (%r14,%rax), %rdi
addq $0x18, %rdi
movl %ebp, %edx
movq %r15, %rsi
callq 0x3240
leaq 0x8(%r14), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x465f4
leal 0x40(%rbp), %r13d
cmpl %ebx, %r13d
ja 0x465ca
movl %ebp, %esi
addq %r15, %rsi
movq %r12, %rdi
callq 0x465f4
movl %r13d, %ebp
jmp 0x465af
xorl %eax, %eax
leaq (%r14,%rax), %rdi
addq $0x18, %rdi
movl %ebp, %eax
addq %rax, %r15
subl %ebp, %ebx
movq %r15, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3240
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/md5.c
// Function: MD5Final
void MD5Final(MD5_CTX *context,unsigned char digest[16])
{
    unsigned int index = 0,padlen = 0;
    unsigned char bits[8];
    index = (context->count[0] >> 3) & 0x3F;
    padlen = (index < 56)?(56-index):(120-index);
    MD5Encode(bits,context->count,8);
    MD5Update(context,PADDING,padlen);
    MD5Update(context,bits,8);
    MD5Encode(digest,context->state,16);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl (%rdi), %eax
shrl $0x3, %eax
andl $0x3f, %eax
xorl %ebp, %ebp
cmpl $0x38, %eax
setae %bpl
shll $0x6, %ebp
orl $0x38, %ebp
subl %eax, %ebp
leaq 0x8(%rsp), %r15
pushq $0x8
popq %r12
movq %r15, %rdi
movq %r14, %rsi
movl %r12d, %edx
callq 0x46dc8
leaq 0x2949e(%rip), %rsi     # 0x70230
movq %r14, %rdi
movl %ebp, %edx
callq 0x46549
movq %r14, %rdi
movq %r15, %rsi
movl %r12d, %edx
callq 0x46549
addq $0x8, %r14
pushq $0x10
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x46dc8
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/md5.c
// Function: MD5Encode
void MD5Encode(unsigned char *output,unsigned int *input,unsigned int len)
{
    unsigned int i = 0,j = 0;
    while(j < len)
    {
            output[j] = input[i] & 0xFF;
            output[j+1] = (input[i] >> 8) & 0xFF;
            output[j+2] = (input[i] >> 16) & 0xFF;
            output[j+3] = (input[i] >> 24) & 0xFF;
            i++;
            j+=4;
        }
}

// Assembly:
addl $0x3, %edx
shrl $0x2, %edx
xorl %eax, %eax
cmpq %rax, %rdx
je 0x46df8
movb (%rsi,%rax,4), %cl
movb %cl, (%rdi,%rax,4)
movb 0x1(%rsi,%rax,4), %cl
movb %cl, 0x1(%rdi,%rax,4)
movb 0x2(%rsi,%rax,4), %cl
movb %cl, 0x2(%rdi,%rax,4)
movb 0x3(%rsi,%rax,4), %cl
movb %cl, 0x3(%rdi,%rax,4)
incq %rax
jmp 0x46dd0
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/md5.c
// Function: MD_5
char *MD_5(unsigned char *input)
{                   
    MD5_CTX md5;    
    MD5Init(&md5);  
    int i;          
    unsigned char decrypt[16];
    MD5Update(&md5,input,strlen((char *)input));
    MD5Final(&md5,decrypt);
    char buf[40] = {0};
    for (i = 0; i < 16; i++)
    {               
        snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%02x", decrypt[i]);
    }               
    return strdup(buf);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
movaps 0x7f76(%rip), %xmm0     # 0x4eda0
leaq 0x40(%rsp), %r14
movaps %xmm0, (%r14)
movabsq $0x1032547698badcfe, %rax # imm = 0x1032547698BADCFE
movq %rax, 0x10(%r14)
callq 0x3110
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
callq 0x46549
movq %rsp, %rsi
movq %r14, %rdi
callq 0x46d49
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rbx
movaps %xmm0, 0x10(%rbx)
andq $0x0, 0x20(%rbx)
movaps %xmm0, (%rbx)
pushq $0x28
popq %r15
leaq 0x7f33(%rip), %r14      # 0x4edb0
xorl %r12d, %r12d
cmpq $0x10, %r12
je 0x46eb0
movq %rbx, %rdi
callq 0x3110
leaq (%rsp,%rax), %rdi
addq $0x10, %rdi
movq %r15, %rsi
subq %rax, %rsi
movzbl (%rsp,%r12), %ecx
movq %r14, %rdx
xorl %eax, %eax
callq 0x3150
incq %r12
jmp 0x46e80
leaq 0x10(%rsp), %rdi
callq 0x33a0
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_client.c
// Function: monitorTaskAll
int monitorTaskAll()
{
	/* a function need to build calls */
	printf("nonitorajdfkl ajsdlk fjadsf \n");
    SGCRMTask *crm_task = NULL;
    crm_task = initSGCRMTask(crm_task);
    crm_task->search_string = strdup("(586) 4-4536");
    addSGCRMTask(crm_task);
}

// Assembly:
pushq %rbx
leaq 0x7f25(%rip), %rdi      # 0x4ee29
callq 0x30a0
xorl %edi, %edi
callq 0x47459
movq %rax, %rbx
leaq 0x7ea8(%rip), %rdi      # 0x4edc2
callq 0x33a0
movq %rax, (%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x46ecc
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_client.c
// Function: executeRequest
int executeRequest(SGCRMInfoTask *info_task, SGCRMTask *crm_task)
{
	
	if (crm_task->search_result == NULL)
	{
		crm_task->search_result = initSGSearchResult(crm_task->search_result);
	}
	int res = searchAccounts(info_task->server_info, info_task->login_return->session_id, crm_task->search_string, crm_task->search_result);
	if (res == SOAP_OK)
	{
		if (crm_task->search_result->id == NULL)
		{
			printf("Not search ,continue need add\n");
			/* choose added to Account,Contacts,Leads */
			//continue;
		}
		printf("id = %s\nmodule = %s\n", crm_task->search_result->id, crm_task->search_result->module);
	}
	/*
    execute();
    search();
    cdr();
    addCall();
    callLinkUser();
    callLinkContact();*/
    return res;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x10(%rsi), %rcx
testq %rcx, %rcx
jne 0x46f4c
xorl %edi, %edi
callq 0x475cc
movq %rax, %rcx
movq %rax, 0x10(%rbx)
movq (%r14), %rax
movq 0x8(%r14), %rdi
movq (%rax), %rsi
movq (%rbx), %rdx
callq 0x4a088
movl %eax, %ebp
testl %eax, %eax
jne 0x46f95
movq 0x10(%rbx), %rax
movq (%rax), %rsi
testq %rsi, %rsi
jne 0x46f83
leaq 0x7ecf(%rip), %rdi      # 0x4ee46
callq 0x30a0
movq 0x10(%rbx), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq 0x7e41(%rip), %rdi      # 0x4edcf
xorl %eax, %eax
callq 0x3140
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_client.c
// Function: crmClientStart
void crmClientStart()
{
    g_crm_task = 1;
    pthread_t crm_client_phread;
    pthread_attr_t crm_request_attr;
    pthread_attr_init(&crm_request_attr);
    pthread_attr_setstacksize((&crm_request_attr), CRM_STACK_SIZE);
    pthread_attr_setdetachstate((&crm_request_attr), PTHREAD_CREATE_DETACHED); //PTHREAD_CREATE_DETACHED
    //connectConfigDB(DB_CONF_CCRM);
    //connectConfigDB(DB_CDR_CCRM);
    //connectConfigDB(DB_STATUS_CCRM);
    pthread_create(&crm_client_phread, &crm_request_attr, (void *)crmClient, NULL);

}

// Assembly:
pushq %rbx
subq $0x40, %rsp
movl $0x1, 0x2925c(%rip)     # 0x703a0
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x31d0
movl $0x100000, %esi         # imm = 0x100000
movq %rbx, %rdi
callq 0x3420
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x3270
leaq -0x1d4(%rip), %rdx      # 0x46f9c
movq %rsp, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x3300
addq $0x40, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_function.c
// Function: leave_number
char *leave_number(char *dest, char *src)
{
    if(src == NULL){
        return NULL;
    }
    char *p = dest;
    while(*src) {
        if (*src > '9' || *src <  '0') {
            src++;
        } else {
            *dest = *src;
            dest++;
            src++;
        }
    }
    *dest = '\0';
    return p;
}

// Assembly:
testq %rsi, %rsi
je 0x471c0
movq %rdi, %rax
movq %rdi, %rcx
movb (%rsi), %dl
testb %dl, %dl
je 0x471bc
leal -0x3a(%rdx), %edi
cmpb $-0xa, %dil
jb 0x471b7
movb %dl, (%rcx)
incq %rcx
incq %rsi
jmp 0x471a3
movb $0x0, (%rcx)
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_function.c
// Function: addPercent
char *addPercent(char *dest, char *src)
{
    if (src == NULL) {
        return NULL;
    }
    char *p = dest;
    while(*src) {
        *dest++ = '%';
        *dest++ = *src++;
    }
    *dest = '\0';
    return p;
}

// Assembly:
testq %rsi, %rsi
je 0x471e8
movq %rdi, %rax
xorl %ecx, %ecx
cmpb $0x0, (%rsi,%rcx)
je 0x471e3
movb $0x25, (%rax,%rcx,2)
movb (%rsi,%rcx), %dl
movb %dl, 0x1(%rax,%rcx,2)
incq %rcx
jmp 0x471cd
movb $0x0, (%rax,%rcx,2)
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_function.c
// Function: queueInitialize
void queueInitialize(Queue *queue)
{
    QueueNode *q_head_node = malloc(sizeof(QueueNode));
    if (q_head_node)
    {
        q_head_node->value = NULL;
        q_head_node->next = NULL;
    }

    queue->head = queue->end = q_head_node;
    queue->not_empty = 0;

    pthread_mutex_init(&queue->q_h_lock, NULL);
    pthread_mutex_init(&queue->q_t_lock, NULL);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
pushq $0x1
popq %rdi
pushq $0x10
popq %rsi
callq 0x31f0
movq %rax, 0x8(%rbx)
movq %rax, (%rbx)
andl $0x0, 0x60(%rbx)
leaq 0x10(%rbx), %rdi
xorl %esi, %esi
callq 0x33d0
addq $0x38, %rbx
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
jmp 0x33d0
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_function.c
// Function: cleanQueue
void cleanQueue(Queue *queue)
{
    QueueNode *free_q_head_node = NULL;

    if (queue)
    {
        while(queue->head != NULL)
        {
            free_q_head_node = queue->head->next;
            if (queue->head->value != NULL)
            {
                cleanSGCRMTask(queue->head->value);
                queue->head->value = NULL;
            }

            free(queue->head);
            queue->head = free_q_head_node;
        }
    }
}

// Assembly:
testq %rdi, %rdi
je 0x47262
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x4725b
movq (%rdi), %rax
movq 0x8(%rdi), %r14
testq %rax, %rax
je 0x4724e
movq %rax, %rdi
callq 0x47263
movq (%rbx), %rdi
andq $0x0, (%rdi)
callq 0x3030
movq %r14, (%rbx)
movq %r14, %rdi
jmp 0x4722e
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_function.c
// Function: cleanSGCRMTask
void cleanSGCRMTask(struct __sg_crm_task *crm_task)
{
    if (crm_task)
    {
        cleanSGSearchResult(crm_task->search_result);
        cleanSGCallItem(crm_task->call_item);
        cleanSGLinkReturn(crm_task->link_return);
    }
    SAFE_FREE(crm_task);
}

// Assembly:
testq %rdi, %rdi
je 0x47290
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
callq 0x47470
movq 0x18(%rbx), %rdi
callq 0x474f1
movq 0x20(%rbx), %rdi
callq 0x475b3
movq %rbx, %rdi
popq %rbx
jmp 0x3030
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_function.c
// Function: enqueueTask
ENQUEUE_RESULT enqueueTask(Queue *q, SGCRMTask *task)
{
    QueueNode* node = malloc(sizeof(QueueNode));
    if (node != NULL)
    {
        node->value = task;
        node->next = NULL;
    }

    pthread_mutex_lock(&q->q_t_lock);
    if (q->end != NULL)
    {
        q->end->next = node;
        q->end = node;
    }
    else
    {
        q->not_empty = 0;
        pthread_mutex_unlock(&q->q_t_lock);
        return ENQUEUE_FAILED_USER_DELETE;
    }
    q->not_empty = 1;
    pthread_mutex_unlock(&q->q_t_lock);

    return ENQUEUE_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
pushq $0x10
popq %rdi
callq 0x3290
movq %rax, %r15
testq %rax, %rax
je 0x472b6
movq %r14, (%r15)
andq $0x0, 0x8(%r15)
leaq 0x38(%rbx), %r14
movq %r14, %rdi
callq 0x33f0
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x472da
movq %r15, 0x8(%rax)
movq %r15, 0x8(%rbx)
xorl %ebp, %ebp
pushq $0x1
popq %rax
jmp 0x472df
pushq $0x1
popq %rbp
xorl %eax, %eax
movl %eax, 0x60(%rbx)
movq %r14, %rdi
callq 0x3280
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_function.c
// Function: dequeueTask
DEQUEUE_RESULT dequeueTask(Queue *q, SGCRMTask **pvalue)
{
    DEQUEUE_RESULT ret;
    QueueNode *next_node = NULL;

    pthread_mutex_lock(&q->q_h_lock);
    if (0 == q->not_empty)
    {
        pthread_mutex_unlock(&q->q_h_lock);
        return DEQUEUE_FAILED_EMPTY;
    }

    if(q->head != NULL)
    {
        next_node = q->head->next ;
    }

    if (next_node != NULL)
    {
        if (next_node == q->end)
        {
            pthread_mutex_lock(&q->q_t_lock);
            q->end = q->head;
            *pvalue = next_node->value;

            q->not_empty = 0;
			q->head->next = NULL;
            ret = DEQUEUE_SUCCESS_AND_EMPTY;
            pthread_mutex_unlock(&q->q_t_lock);
        }
        else
        {
            *pvalue = next_node->value;
            q->head->next = next_node->next ;
            ret = DEQUEUE_SUCCESS_AND_CONTINUE;
        }

        pthread_mutex_unlock(&q->q_h_lock);
        free(next_node);
    }
    else
    {
        pthread_mutex_unlock(&q->q_h_lock);
        ret = DEQUEUE_FAILED_EMPTY;
    }

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r12
movq %rdi, %r15
leaq 0x10(%rdi), %rbx
movq %rbx, %rdi
callq 0x33f0
cmpl $0x0, 0x60(%r15)
je 0x47348
movq (%r15), %rax
testq %rax, %rax
je 0x47348
movq 0x8(%rax), %r14
testq %r14, %r14
je 0x47348
cmpq 0x8(%r15), %r14
je 0x47355
movq (%r14), %rax
movq %rax, (%r12)
movq 0x8(%r14), %rax
movq (%r15), %rcx
movq %rax, 0x8(%rcx)
xorl %ebp, %ebp
jmp 0x47387
movq %rbx, %rdi
callq 0x3280
pushq $0x2
popq %rbp
jmp 0x47397
leaq 0x38(%r15), %r13
movq %r13, %rdi
callq 0x33f0
movq (%r15), %rax
movq %rax, 0x8(%r15)
movq (%r14), %rax
movq %rax, (%r12)
andl $0x0, 0x60(%r15)
movq (%r15), %rax
andq $0x0, 0x8(%rax)
movq %r13, %rdi
callq 0x3280
pushq $0x1
popq %rbp
movq %rbx, %rdi
callq 0x3280
movq %r14, %rdi
callq 0x3030
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_function.c
// Function: initSGCRMInfoTask
struct __sg_crm_info_task *initSGCRMInfoTask(struct __sg_crm_info_task *crm_info_task)
{
    crm_info_task = (struct __sg_crm_info_task *)malloc(sizeof(struct __sg_crm_info_task));
    crm_info_task->login_return = initSGLoginReturn(crm_info_task->login_return);
    crm_info_task->server_info = initSGServerInfo(crm_info_task->server_info);
    return crm_info_task;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
pushq $0x10
popq %rbx
movq %rbx, %rdi
callq 0x3290
movq %rax, %r14
callq 0x473d9
movq %rax, (%r14)
movq %rbx, %rdi
callq 0x3290
movq %rax, 0x8(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_function.c
// Function: cleanSGCRMInfoTask
void cleanSGCRMInfoTask(struct __sg_crm_info_task *crm_info_task)
{
    if (crm_info_task)
    {
        cleanSGLoginReturn(crm_info_task->login_return);
        cleanSGServerInfo(crm_info_task->server_info);
    }
    SAFE_FREE(crm_info_task);
}

// Assembly:
testq %rdi, %rdi
je 0x4740f
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x47410
movq 0x8(%rbx), %rdi
callq 0x4743d
movq %rbx, %rdi
popq %rbx
jmp 0x3030
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_function.c
// Function: cleanSGLoginReturn
void cleanSGLoginReturn(struct __sg_login_return *login_return)
{
    if (login_return) {
        SAFE_FREE(login_return->session_id);
        SAFE_FREE(login_return->user_id);
    }
    SAFE_FREE(login_return);
}

// Assembly:
testq %rdi, %rdi
je 0x4743c
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x4742a
callq 0x3030
andq $0x0, (%rbx)
movq 0x8(%rbx), %rdi
callq 0x3030
movq %rbx, %rdi
popq %rbx
jmp 0x3030
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_function.c
// Function: cleanSGSearchResult
void cleanSGSearchResult(struct __sg_search_result *search_result)
{
    printf("cleanSearchResult\n");
    if (search_result) {
		printf("youyou\n");
		if (search_result->id)
			printf("asdjfsadfasd\n");
		else
			printf("no nulllllll]n\n");
        SAFE_FREE(search_result->id);
        SAFE_FREE(search_result->module);
		printf("ono\n");
    }
    SAFE_FREE(search_result);
	printf("cleanSearchResult end\n");
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x7d82(%rip), %rdi      # 0x4f1fd
callq 0x30a0
testq %rbx, %rbx
je 0x474e4
leaq 0x7d83(%rip), %rdi      # 0x4f20f
callq 0x30a0
cmpq $0x0, (%rbx)
leaq 0x7d7a(%rip), %rax      # 0x4f216
leaq 0x7d82(%rip), %rdi      # 0x4f225
cmoveq %rax, %rdi
callq 0x30a0
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x474bd
callq 0x3030
andq $0x0, (%rbx)
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x474d0
callq 0x3030
andq $0x0, 0x8(%rbx)
leaq 0x7d5b(%rip), %rdi      # 0x4f232
callq 0x30a0
movq %rbx, %rdi
callq 0x3030
leaq 0x7d4b(%rip), %rdi      # 0x4f236
popq %rbx
jmp 0x30a0
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_function.c
// Function: cleanSGCallItem
void cleanSGCallItem(struct __sg_call_item* call_item)
{
    if (call_item) {
		printf("cleanCallItem\n");
        SAFE_FREE(call_item->name);
        SAFE_FREE(call_item->parent_type);
        SAFE_FREE(call_item->parent_id);
        SAFE_FREE(call_item->direction);
        SAFE_FREE(call_item->description);
        SAFE_FREE(call_item->duration_hours);
        SAFE_FREE(call_item->duration_minutes);
        SAFE_FREE(call_item->date_start);
        SAFE_FREE(call_item->assigned_user_id);
    }
    SAFE_FREE(call_item);
}

// Assembly:
testq %rdi, %rdi
je 0x475b2
pushq %rbx
movq %rdi, %rbx
leaq 0x7d47(%rip), %rdi      # 0x4f24c
callq 0x30a0
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x4751b
callq 0x3030
andq $0x0, (%rbx)
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x4752e
callq 0x3030
andq $0x0, 0x8(%rbx)
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x47541
callq 0x3030
andq $0x0, 0x10(%rbx)
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x47554
callq 0x3030
andq $0x0, 0x18(%rbx)
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x47567
callq 0x3030
andq $0x0, 0x20(%rbx)
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x4757a
callq 0x3030
andq $0x0, 0x30(%rbx)
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x4758d
callq 0x3030
andq $0x0, 0x28(%rbx)
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x475a0
callq 0x3030
andq $0x0, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x3030
movq %rbx, %rdi
popq %rbx
jmp 0x3030
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_function.c
// Function: cleanSGContactItem
void cleanSGContactItem(struct __sg_contact_item *contact_item)
{
    if (contact_item) {
        SAFE_FREE(contact_item->title);
        SAFE_FREE(contact_item->first_name);
        SAFE_FREE(contact_item->last_name);
        SAFE_FREE(contact_item->phone_home);
        SAFE_FREE(contact_item->phone_work);
        SAFE_FREE(contact_item->phone_mobile);
        SAFE_FREE(contact_item->phone_other);
        SAFE_FREE(contact_item->phone_fax);
		SAFE_FREE(contact_item->description);
    }
    SAFE_FREE(contact_item);
}

// Assembly:
testq %rdi, %rdi
je 0x476b1
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x4761a
callq 0x3030
andq $0x0, (%rbx)
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x4762d
callq 0x3030
andq $0x0, 0x8(%rbx)
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x47640
callq 0x3030
andq $0x0, 0x10(%rbx)
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x47653
callq 0x3030
andq $0x0, 0x18(%rbx)
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x47666
callq 0x3030
andq $0x0, 0x28(%rbx)
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x47679
callq 0x3030
andq $0x0, 0x20(%rbx)
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x4768c
callq 0x3030
andq $0x0, 0x30(%rbx)
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x4769f
callq 0x3030
andq $0x0, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x3030
movq %rbx, %rdi
popq %rbx
jmp 0x3030
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_function.c
// Function: cleanSGAccountItem
void cleanSGAccountItem(struct __sg_account_item *account_item)
{
	if (account_item) {
        SAFE_FREE(account_item->name);
        SAFE_FREE(account_item->phone_office);
        SAFE_FREE(account_item->phone_alternate);
        SAFE_FREE(account_item->phone_fax);
		SAFE_FREE(account_item->description);
    }
    SAFE_FREE(account_item);
}

// Assembly:
testq %rdi, %rdi
je 0x47722
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x476d7
callq 0x3030
andq $0x0, (%rbx)
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x476ea
callq 0x3030
andq $0x0, 0x8(%rbx)
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x476fd
callq 0x3030
andq $0x0, 0x10(%rbx)
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x47710
callq 0x3030
andq $0x0, 0x18(%rbx)
movq 0x20(%rbx), %rdi
callq 0x3030
movq %rbx, %rdi
popq %rbx
jmp 0x3030
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_function.c
// Function: cleanSGLeadItem
void cleanSGLeadItem(struct __sg_lead_item *lead_item)
{
	if (lead_item) {
        SAFE_FREE(lead_item->title);
        SAFE_FREE(lead_item->first_name);
        SAFE_FREE(lead_item->last_name);
        SAFE_FREE(lead_item->phone_home);
        SAFE_FREE(lead_item->phone_work);
        SAFE_FREE(lead_item->phone_mobile);
        SAFE_FREE(lead_item->phone_other);
        SAFE_FREE(lead_item->phone_fax);
		SAFE_FREE(lead_item->description);
    }
    SAFE_FREE(lead_item);
}

// Assembly:
testq %rdi, %rdi
je 0x477e3
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x4774c
callq 0x3030
andq $0x0, (%rbx)
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x4775f
callq 0x3030
andq $0x0, 0x8(%rbx)
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x47772
callq 0x3030
andq $0x0, 0x10(%rbx)
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x47785
callq 0x3030
andq $0x0, 0x18(%rbx)
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x47798
callq 0x3030
andq $0x0, 0x28(%rbx)
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x477ab
callq 0x3030
andq $0x0, 0x20(%rbx)
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x477be
callq 0x3030
andq $0x0, 0x30(%rbx)
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x477d1
callq 0x3030
andq $0x0, 0x38(%rbx)
movq 0x40(%rbx), %rdi
callq 0x3030
movq %rbx, %rdi
popq %rbx
jmp 0x3030
retq
// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_function.c
// Function: initSGCallsItem
struct __sg_calls_item *initSGCallsItem(struct __sg_calls_item *calls_item)
{
	calls_item = (struct __sg_calls_item *)malloc(sizeof(struct __sg_calls_item));
	calls_item->call_id = NULL;
	calls_item->call_item = initSGCallItem(calls_item->call_item);
	calls_item->next = NULL;
	return calls_item;
}

// Assembly:
pushq %rbx
pushq $0x18
popq %rdi
callq 0x3290
movq %rax, %rbx
andq $0x0, (%rax)
pushq $0x48
popq %rdi
callq 0x3290
movq %rax, 0x8(%rbx)
andq $0x0, 0x10(%rbx)
movq %rbx, %rax
popq %rbx
retq