// File: /workspace/github_c_makefile_star2_O3/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: http_parse_header
static int
http_parse_header(struct soap *soap, const char *key, const char *val)
{ if (!soap_tag_cmp(key, "Host"))
  { 
#ifdef WITH_OPENSSL
    if (soap->imode & SOAP_ENC_SSL)
      strcpy(soap->endpoint, "https://");
    else
#endif
      strcpy(soap->endpoint, "http://");
    strncat(soap->endpoint, val, sizeof(soap->endpoint) - 8);
    soap->endpoint[sizeof(soap->endpoint) - 1] = '\0';
  }
#ifndef WITH_LEANER
  else if (!soap_tag_cmp(key, "Content-Type"))
  { const char *action;
    soap->http_content = soap_strdup(soap, val);
    if (soap_get_header_attribute(soap, val, "application/dime"))
      soap->imode |= SOAP_ENC_DIME;
    else if (soap_get_header_attribute(soap, val, "multipart/related")
          || soap_get_header_attribute(soap, val, "multipart/form-data"))
    { soap->mime.boundary = soap_strdup(soap, soap_get_header_attribute(soap, val, "boundary"));
      soap->mime.start = soap_strdup(soap, soap_get_header_attribute(soap, val, "start"));
      soap->imode |= SOAP_ENC_MIME;
    }
    action = soap_get_header_attribute(soap, val, "action");
    if (action)
    { if (*action == '"')
      { soap->action = soap_strdup(soap, action + 1);
        soap->action[strlen(soap->action) - 1] = '\0';
      }
      else
        soap->action = soap_strdup(soap, action);
    }
  }
#endif
  else if (!soap_tag_cmp(key, "Content-Length"))
  { soap->length = soap_strtoul(val, NULL, 10);
  }
  else if (!soap_tag_cmp(key, "Content-Encoding"))
  { if (!soap_tag_cmp(val, "deflate"))
#ifdef WITH_ZLIB
      soap->zlib_in = SOAP_ZLIB_DEFLATE;
#else
      return SOAP_ZLIB_ERROR;
#endif
    else if (!soap_tag_cmp(val, "gzip"))
#ifdef WITH_GZIP
      soap->zlib_in = SOAP_ZLIB_GZIP;
#else
      return SOAP_ZLIB_ERROR;
#endif
  }
#ifdef WITH_ZLIB
  else if (!soap_tag_cmp(key, "Accept-Encoding"))
  {
#ifdef WITH_GZIP
    if (strchr(val, '*') || soap_get_header_attribute(soap, val, "gzip"))
      soap->zlib_out = SOAP_ZLIB_GZIP;
    else
#endif
    if (strchr(val, '*') || soap_get_header_attribute(soap, val, "deflate"))
      soap->zlib_out = SOAP_ZLIB_DEFLATE;
    else
      soap->zlib_out = SOAP_ZLIB_NONE;
  }
#endif
  else if (!soap_tag_cmp(key, "Transfer-Encoding"))
  { soap->imode &= ~SOAP_IO;
    if (!soap_tag_cmp(val, "chunked"))
      soap->imode |= SOAP_IO_CHUNK;
  }
  else if (!soap_tag_cmp(key, "Connection"))
  { if (!soap_tag_cmp(val, "keep-alive"))
      soap->keep_alive = -soap->keep_alive;
    else if (!soap_tag_cmp(val, "close"))
      soap->keep_alive = 0;
  }
#ifndef WITH_LEAN
  else if (!soap_tag_cmp(key, "Authorization"))
  { if (!soap_tag_cmp(val, "Basic *"))
    { int n;
      char *s;
      soap_base642s(soap, val + 6, soap->tmpbuf, sizeof(soap->tmpbuf) - 1, &n);
      soap->tmpbuf[n] = '\0';
      if ((s = strchr(soap->tmpbuf, ':')))
      { *s = '\0';
        soap->userid = soap_strdup(soap, soap->tmpbuf);
        soap->passwd = soap_strdup(soap, s + 1);
      }
    }
  }
  else if (!soap_tag_cmp(key, "WWW-Authenticate"))
  { soap->authrealm = soap_strdup(soap, soap_get_header_attribute(soap, val + 6, "realm"));
  }
  else if (!soap_tag_cmp(key, "Expect"))
  { if (!soap_tag_cmp(val, "100-continue"))
    { if ((soap->error = soap->fposthdr(soap, "HTTP/1.1 100 Continue", NULL))
       || (soap->error = soap->fposthdr(soap, NULL, NULL)))
        return soap->error;
    }
  }
#endif
  else if (!soap_tag_cmp(key, "SOAPAction"))
  { if (*val == '"')
    { soap->action = soap_strdup(soap, val + 1);
      soap->action[strlen(soap->action) - 1] = '\0';
    }
    else
      soap->action = soap_strdup(soap, val);
  }
  else if (!soap_tag_cmp(key, "Location"))
  { strncpy(soap->endpoint, val, sizeof(soap->endpoint));
    soap->endpoint[sizeof(soap->endpoint) - 1] = '\0';
  }
  else if (!soap_tag_cmp(key, "X-Forwarded-For"))
  { soap->proxy_from = soap_strdup(soap, val);
  }
#ifdef WITH_COOKIES
  else if (!soap_tag_cmp(key, "Cookie")
   || !soap_tag_cmp(key, "Cookie2")
   || !soap_tag_cmp(key, "Set-Cookie")
   || !soap_tag_cmp(key, "Set-Cookie2"))
  { soap_getcookies(soap, val);
  }
#endif
  return SOAP_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x170cf(%rip), %rsi     # 0x53855
movq %r15, %rdi
callq 0x382f9
testl %eax, %eax
je 0x3c8aa
leaq 0x1610a(%rip), %rsi     # 0x528a7
movq %r15, %rdi
callq 0x382f9
testl %eax, %eax
je 0x3c8db
leaq 0x1636c(%rip), %rsi     # 0x52b20
movq %r15, %rdi
callq 0x382f9
testl %eax, %eax
je 0x3c9cf
leaq 0x170be(%rip), %rsi     # 0x53889
movq %r15, %rdi
callq 0x382f9
testl %eax, %eax
je 0x3c9ea
leaq 0x160ee(%rip), %rsi     # 0x528d0
movq %r15, %rdi
callq 0x382f9
testl %eax, %eax
je 0x3ca39
leaq 0x16336(%rip), %rsi     # 0x52b2f
movq %r15, %rdi
callq 0x382f9
testl %eax, %eax
je 0x3ca66
leaq 0x17167(%rip), %rsi     # 0x53977
movq %r15, %rdi
callq 0x382f9
testl %eax, %eax
je 0x3caa2
leaq 0x17088(%rip), %rsi     # 0x538af
movq %r15, %rdi
callq 0x382f9
testl %eax, %eax
je 0x3cb2c
leaq 0x17088(%rip), %rsi     # 0x538c6
movq %r15, %rdi
callq 0x382f9
testl %eax, %eax
je 0x3cb5f
leaq 0x1709b(%rip), %rsi     # 0x538f0
movq %r15, %rdi
callq 0x382f9
testl %eax, %eax
je 0x3cb83
leaq 0x1601e(%rip), %rsi     # 0x5288a
movq %r15, %rdi
callq 0x382f9
testl %eax, %eax
je 0x3cb97
leaq 0x17078(%rip), %rsi     # 0x538fb
movq %r15, %rdi
callq 0x382f9
testl %eax, %eax
jne 0x3cb72
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3a6c4
movq %rax, 0x19208(%rbx)
jmp 0x3cb72
leaq 0x185a8(%rbx), %rdi
movabsq $0x2f2f3a70747468, %rax # imm = 0x2F2F3A70747468
movq %rax, 0x185a8(%rbx)
movl $0x3f8, %edx            # imm = 0x3F8
movq %r14, %rsi
callq 0x31a0
movb $0x0, 0x189a7(%rbx)
jmp 0x3cb72
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3a6c4
movq %rax, 0x30(%rbx)
leaq 0x16057(%rip), %rdx     # 0x52948
movq %rbx, %rdi
movq %r14, %rsi
callq 0x47e4a
movl $0x80, %ecx
testq %rax, %rax
jne 0x3c981
leaq 0x16f4d(%rip), %rdx     # 0x5385a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x47e4a
testq %rax, %rax
jne 0x3c934
leaq 0x16f48(%rip), %rdx     # 0x5386c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x47e4a
testq %rax, %rax
je 0x3c984
leaq 0x16f45(%rip), %rdx     # 0x53880
movq %rbx, %rdi
movq %r14, %rsi
callq 0x47e4a
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3a6c4
movq %rax, 0x19288(%rbx)
leaq 0x17735(%rip), %rdx     # 0x54094
movq %rbx, %rdi
movq %r14, %rsi
callq 0x47e4a
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3a6c4
movq %rax, 0x19290(%rbx)
movl $0x100, %ecx            # imm = 0x100
orl %ecx, 0x8(%rbx)
leaq 0x14d9d(%rip), %rdx     # 0x51728
movq %rbx, %rdi
movq %r14, %rsi
callq 0x47e4a
testq %rax, %rax
je 0x3cb72
cmpb $0x22, (%rax)
jne 0x3ca22
incq %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3a6c4
movq %rax, %r14
movq %rax, 0x191a8(%rbx)
movq %rax, %rdi
callq 0x3110
movb $0x0, -0x1(%r14,%rax)
jmp 0x3cb72
movq %r14, %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x3340
movq %rax, 0x6118(%rbx)
jmp 0x3cb72
leaq 0x16ea9(%rip), %rsi     # 0x5389a
movq %r14, %rdi
callq 0x382f9
movl $0x1f, %ebp
testl %eax, %eax
je 0x3cb74
leaq 0x16e95(%rip), %rsi     # 0x538a2
movq %r14, %rdi
callq 0x382f9
testl %eax, %eax
jne 0x3cb72
jmp 0x3cb74
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3a6c4
movq %rax, 0x191a8(%rbx)
jmp 0x3cb72
movl 0x8(%rbx), %ebp
movl %ebp, %eax
andl $-0x4, %eax
movl %eax, 0x8(%rbx)
leaq 0x160cd(%rip), %rsi     # 0x52b18
movq %r14, %rdi
callq 0x382f9
testl %eax, %eax
jne 0x3cb72
orl $0x3, %ebp
movl %ebp, 0x8(%rbx)
jmp 0x3cb72
leaq 0x160cd(%rip), %rsi     # 0x52b3a
movq %r14, %rdi
callq 0x382f9
testl %eax, %eax
je 0x3cb56
leaq 0x160c1(%rip), %rsi     # 0x52b45
movq %r14, %rdi
callq 0x382f9
testl %eax, %eax
jne 0x3cb72
movw $0x0, 0x191cc(%rbx)
jmp 0x3cb72
leaq 0x16dfe(%rip), %rsi     # 0x538a7
movq %r14, %rdi
callq 0x382f9
testl %eax, %eax
jne 0x3cb72
addq $0x6, %r14
leaq 0x16538(%rbx), %r15
leaq 0xc(%rsp), %r12
movl $0x3ff, %ecx            # imm = 0x3FF
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r12, %r8
callq 0x49789
movslq (%r12), %rax
movb $0x0, 0x16538(%rbx,%rax)
movq %r15, %rdi
movl $0x3a, %esi
callq 0x3130
testq %rax, %rax
je 0x3cb72
movq %rax, %r14
movb $0x0, (%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3a6c4
movq %rax, 0x5f58(%rbx)
incq %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3a6c4
movq %rax, 0x5f60(%rbx)
jmp 0x3cb72
addq $0x6, %r14
leaq 0x16d89(%rip), %rdx     # 0x538c0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x47e4a
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3a6c4
movq %rax, 0x191b0(%rbx)
jmp 0x3cb72
negw 0x191cc(%rbx)
jmp 0x3cb72
leaq 0x16d67(%rip), %rsi     # 0x538cd
movq %r14, %rdi
callq 0x382f9
testl %eax, %eax
je 0x3cbb0
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x22, (%r14)
jne 0x3cbe7
incq %r14
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x3c9ad
leaq 0x185a8(%rbx), %rdi
movl $0x400, %edx            # imm = 0x400
movq %r14, %rsi
callq 0x3070
jmp 0x3c8cf
leaq 0x16d23(%rip), %rsi     # 0x538da
movq %rbx, %rdi
xorl %edx, %edx
callq *0x5f98(%rbx)
movl %eax, 0x19214(%rbx)
testl %eax, %eax
jne 0x3cbe3
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq *0x5f98(%rbx)
movl %eax, 0x19214(%rbx)
testl %eax, %eax
je 0x3cb72
movl %eax, %ebp
jmp 0x3cb74
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x3ca28