// File: /workspace/github_c_makefile_star2_O1/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 0x170df(%rip), %rsi     # 0x53855
movq %r15, %rdi
callq 0x3806c
testl %eax, %eax
je 0x3c89a
leaq 0x1611a(%rip), %rsi     # 0x528a7
movq %r15, %rdi
callq 0x3806c
testl %eax, %eax
je 0x3c8cb
leaq 0x1637c(%rip), %rsi     # 0x52b20
movq %r15, %rdi
callq 0x3806c
testl %eax, %eax
je 0x3c9bf
leaq 0x170ce(%rip), %rsi     # 0x53889
movq %r15, %rdi
callq 0x3806c
testl %eax, %eax
je 0x3c9da
leaq 0x160fe(%rip), %rsi     # 0x528d0
movq %r15, %rdi
callq 0x3806c
testl %eax, %eax
je 0x3ca29
leaq 0x16346(%rip), %rsi     # 0x52b2f
movq %r15, %rdi
callq 0x3806c
testl %eax, %eax
je 0x3ca56
leaq 0x17177(%rip), %rsi     # 0x53977
movq %r15, %rdi
callq 0x3806c
testl %eax, %eax
je 0x3ca92
leaq 0x17098(%rip), %rsi     # 0x538af
movq %r15, %rdi
callq 0x3806c
testl %eax, %eax
je 0x3cb1c
leaq 0x17098(%rip), %rsi     # 0x538c6
movq %r15, %rdi
callq 0x3806c
testl %eax, %eax
je 0x3cb4f
leaq 0x170ab(%rip), %rsi     # 0x538f0
movq %r15, %rdi
callq 0x3806c
testl %eax, %eax
je 0x3cb73
leaq 0x1602e(%rip), %rsi     # 0x5288a
movq %r15, %rdi
callq 0x3806c
testl %eax, %eax
je 0x3cb87
leaq 0x17088(%rip), %rsi     # 0x538fb
movq %r15, %rdi
callq 0x3806c
testl %eax, %eax
jne 0x3cb62
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3a567
movq %rax, 0x19208(%rbx)
jmp 0x3cb62
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 0x3cb62
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3a567
movq %rax, 0x30(%rbx)
leaq 0x16067(%rip), %rdx     # 0x52948
movq %rbx, %rdi
movq %r14, %rsi
callq 0x484f8
movl $0x80, %ecx
testq %rax, %rax
jne 0x3c971
leaq 0x16f5d(%rip), %rdx     # 0x5385a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x484f8
testq %rax, %rax
jne 0x3c924
leaq 0x16f58(%rip), %rdx     # 0x5386c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x484f8
testq %rax, %rax
je 0x3c974
leaq 0x16f55(%rip), %rdx     # 0x53880
movq %rbx, %rdi
movq %r14, %rsi
callq 0x484f8
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3a567
movq %rax, 0x19288(%rbx)
leaq 0x17745(%rip), %rdx     # 0x54094
movq %rbx, %rdi
movq %r14, %rsi
callq 0x484f8
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3a567
movq %rax, 0x19290(%rbx)
movl $0x100, %ecx            # imm = 0x100
orl %ecx, 0x8(%rbx)
leaq 0x14dad(%rip), %rdx     # 0x51728
movq %rbx, %rdi
movq %r14, %rsi
callq 0x484f8
testq %rax, %rax
je 0x3cb62
cmpb $0x22, (%rax)
jne 0x3ca12
incq %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3a567
movq %rax, %r14
movq %rax, 0x191a8(%rbx)
movq %rax, %rdi
callq 0x3110
movb $0x0, -0x1(%r14,%rax)
jmp 0x3cb62
movq %r14, %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x3330
movq %rax, 0x6118(%rbx)
jmp 0x3cb62
leaq 0x16eb9(%rip), %rsi     # 0x5389a
movq %r14, %rdi
callq 0x3806c
movl $0x1f, %ebx
testl %eax, %eax
je 0x3cb64
leaq 0x16ea5(%rip), %rsi     # 0x538a2
movq %r14, %rdi
callq 0x3806c
testl %eax, %eax
jne 0x3cb62
jmp 0x3cb64
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3a567
movq %rax, 0x191a8(%rbx)
jmp 0x3cb62
movl 0x8(%rbx), %ebp
movl %ebp, %eax
andl $-0x4, %eax
movl %eax, 0x8(%rbx)
leaq 0x160dd(%rip), %rsi     # 0x52b18
movq %r14, %rdi
callq 0x3806c
testl %eax, %eax
jne 0x3cb62
orl $0x3, %ebp
movl %ebp, 0x8(%rbx)
jmp 0x3cb62
leaq 0x160dd(%rip), %rsi     # 0x52b3a
movq %r14, %rdi
callq 0x3806c
testl %eax, %eax
je 0x3cb46
leaq 0x160d1(%rip), %rsi     # 0x52b45
movq %r14, %rdi
callq 0x3806c
testl %eax, %eax
jne 0x3cb62
movw $0x0, 0x191cc(%rbx)
jmp 0x3cb62
leaq 0x16e0e(%rip), %rsi     # 0x538a7
movq %r14, %rdi
callq 0x3806c
testl %eax, %eax
jne 0x3cb62
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 0x49e2a
movslq (%r12), %rax
movb $0x0, 0x16538(%rbx,%rax)
movq %r15, %rdi
movl $0x3a, %esi
callq 0x3130
testq %rax, %rax
je 0x3cb62
movq %rax, %r14
movb $0x0, (%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3a567
movq %rax, 0x5f58(%rbx)
incq %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3a567
movq %rax, 0x5f60(%rbx)
jmp 0x3cb62
addq $0x6, %r14
leaq 0x16d99(%rip), %rdx     # 0x538c0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x484f8
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3a567
movq %rax, 0x191b0(%rbx)
jmp 0x3cb62
negw 0x191cc(%rbx)
jmp 0x3cb62
leaq 0x16d77(%rip), %rsi     # 0x538cd
movq %r14, %rdi
callq 0x3806c
testl %eax, %eax
je 0x3cba0
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x22, (%r14)
jne 0x3cbdb
incq %r14
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x3c99d
leaq 0x185a8(%rbx), %rdi
movl $0x400, %edx            # imm = 0x400
movq %r14, %rsi
callq 0x3070
jmp 0x3c8bf
leaq 0x16d33(%rip), %rsi     # 0x538da
movq %rbx, %rdi
xorl %edx, %edx
callq *0x5f98(%rbx)
movl %eax, 0x19214(%rbx)
testl %eax, %eax
jne 0x3cbd3
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq *0x5f98(%rbx)
movl %eax, 0x19214(%rbx)
testl %eax, %eax
je 0x3cb62
movl 0x19214(%rbx), %ebx
jmp 0x3cb64
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x3ca18