// File: /workspace/github_c_makefile_star2_O2/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 0x155f8(%rip), %rsi     # 0x4e855
movq %r15, %rdi
callq 0x3507f
testl %eax, %eax
je 0x39381
leaq 0x14633(%rip), %rsi     # 0x4d8a7
movq %r15, %rdi
callq 0x3507f
testl %eax, %eax
je 0x393b2
leaq 0x14895(%rip), %rsi     # 0x4db20
movq %r15, %rdi
callq 0x3507f
testl %eax, %eax
je 0x394a6
leaq 0x155e7(%rip), %rsi     # 0x4e889
movq %r15, %rdi
callq 0x3507f
testl %eax, %eax
je 0x394bf
leaq 0x14617(%rip), %rsi     # 0x4d8d0
movq %r15, %rdi
callq 0x3507f
testl %eax, %eax
je 0x3950c
leaq 0x1485f(%rip), %rsi     # 0x4db2f
movq %r15, %rdi
callq 0x3507f
testl %eax, %eax
je 0x39539
leaq 0x15690(%rip), %rsi     # 0x4e977
movq %r15, %rdi
callq 0x3507f
testl %eax, %eax
je 0x39574
leaq 0x155b1(%rip), %rsi     # 0x4e8af
movq %r15, %rdi
callq 0x3507f
testl %eax, %eax
je 0x395fc
leaq 0x155b1(%rip), %rsi     # 0x4e8c6
movq %r15, %rdi
callq 0x3507f
testl %eax, %eax
je 0x3962f
leaq 0x155c4(%rip), %rsi     # 0x4e8f0
movq %r15, %rdi
callq 0x3507f
testl %eax, %eax
je 0x39653
leaq 0x14547(%rip), %rsi     # 0x4d88a
movq %r15, %rdi
callq 0x3507f
testl %eax, %eax
je 0x39667
leaq 0x155a1(%rip), %rsi     # 0x4e8fb
movq %r15, %rdi
callq 0x3507f
testl %eax, %eax
jne 0x39642
movq %rbx, %rdi
movq %r14, %rsi
callq 0x37284
movq %rax, 0x19208(%rbx)
jmp 0x39642
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 0x39642
movq %rbx, %rdi
movq %r14, %rsi
callq 0x37284
movq %rax, 0x30(%rbx)
leaq 0x14580(%rip), %rdx     # 0x4d948
movq %rbx, %rdi
movq %r14, %rsi
callq 0x43766
movl $0x80, %ecx
testq %rax, %rax
jne 0x39458
leaq 0x15476(%rip), %rdx     # 0x4e85a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x43766
testq %rax, %rax
jne 0x3940b
leaq 0x15471(%rip), %rdx     # 0x4e86c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x43766
testq %rax, %rax
je 0x3945b
leaq 0x1546e(%rip), %rdx     # 0x4e880
movq %rbx, %rdi
movq %r14, %rsi
callq 0x43766
movq %rbx, %rdi
movq %rax, %rsi
callq 0x37284
movq %rax, 0x19288(%rbx)
leaq 0x15c5e(%rip), %rdx     # 0x4f094
movq %rbx, %rdi
movq %r14, %rsi
callq 0x43766
movq %rbx, %rdi
movq %rax, %rsi
callq 0x37284
movq %rax, 0x19290(%rbx)
movl $0x100, %ecx            # imm = 0x100
orl %ecx, 0x8(%rbx)
leaq 0x132c6(%rip), %rdx     # 0x4c728
movq %rbx, %rdi
movq %r14, %rsi
callq 0x43766
testq %rax, %rax
je 0x39642
cmpb $0x22, (%rax)
jne 0x394f5
incq %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x37284
movq %rax, %r14
movq %rax, 0x191a8(%rbx)
movq %rax, %rdi
callq 0x3110
movb $0x0, -0x1(%r14,%rax)
jmp 0x39642
pushq $0xa
popq %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x3350
movq %rax, 0x6118(%rbx)
jmp 0x39642
leaq 0x153d4(%rip), %rsi     # 0x4e89a
movq %r14, %rdi
callq 0x3507f
pushq $0x1f
popq %rbp
testl %eax, %eax
je 0x39644
leaq 0x153c2(%rip), %rsi     # 0x4e8a2
movq %r14, %rdi
callq 0x3507f
testl %eax, %eax
jne 0x39642
jmp 0x39644
movq %rbx, %rdi
movq %rax, %rsi
callq 0x37284
movq %rax, 0x191a8(%rbx)
jmp 0x39642
movl 0x8(%rbx), %ebp
movl %ebp, %eax
andl $-0x4, %eax
movl %eax, 0x8(%rbx)
leaq 0x145fa(%rip), %rsi     # 0x4db18
movq %r14, %rdi
callq 0x3507f
testl %eax, %eax
jne 0x39642
orl $0x3, %ebp
movl %ebp, 0x8(%rbx)
jmp 0x39642
leaq 0x145fa(%rip), %rsi     # 0x4db3a
movq %r14, %rdi
callq 0x3507f
testl %eax, %eax
je 0x39626
leaq 0x145ee(%rip), %rsi     # 0x4db45
movq %r14, %rdi
callq 0x3507f
testl %eax, %eax
jne 0x39642
andw $0x0, 0x191cc(%rbx)
jmp 0x39642
leaq 0x1532c(%rip), %rsi     # 0x4e8a7
movq %r14, %rdi
callq 0x3507f
testl %eax, %eax
jne 0x39642
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 0x44ec3
movslq (%r12), %rax
movb $0x0, 0x16538(%rbx,%rax)
pushq $0x3a
popq %rsi
movq %r15, %rdi
callq 0x3130
testq %rax, %rax
je 0x39642
movq %rax, %r14
movb $0x0, (%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x37284
movq %rax, 0x5f58(%rbx)
incq %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x37284
movq %rax, 0x5f60(%rbx)
jmp 0x39642
addq $0x6, %r14
leaq 0x152b9(%rip), %rdx     # 0x4e8c0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x43766
movq %rbx, %rdi
movq %rax, %rsi
callq 0x37284
movq %rax, 0x191b0(%rbx)
jmp 0x39642
negw 0x191cc(%rbx)
jmp 0x39642
leaq 0x15297(%rip), %rsi     # 0x4e8cd
movq %r14, %rdi
callq 0x3507f
testl %eax, %eax
je 0x39680
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x22, (%r14)
jne 0x396b7
incq %r14
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x39484
leaq 0x185a8(%rbx), %rdi
movl $0x400, %edx            # imm = 0x400
movq %r14, %rsi
callq 0x3070
jmp 0x393a6
leaq 0x15253(%rip), %rsi     # 0x4e8da
movq %rbx, %rdi
xorl %edx, %edx
callq *0x5f98(%rbx)
movl %eax, 0x19214(%rbx)
testl %eax, %eax
jne 0x396b3
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq *0x5f98(%rbx)
movl %eax, 0x19214(%rbx)
testl %eax, %eax
je 0x39642
movl %eax, %ebp
jmp 0x39644
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x394fb