// File: /workspace/github_c_makefile_star2_O3/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_puthttphdr
SOAP_FMAC2
soap_puthttphdr(struct soap *soap, int status, size_t count)
{ if (soap->status != SOAP_GET)
  { register const char *s = "text/xml; charset=utf-8";
    register int err = SOAP_OK;
#ifndef WITH_LEANER
    register const char *r = NULL;
#endif
    if ((status == SOAP_FILE || soap->status == SOAP_POST_FILE) && soap->http_content)
      s = soap->http_content;
    else if (status == SOAP_HTML)
      s = "text/html; charset=utf-8";
    else if (count || ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK))
    { if (soap->version == 2)
        s = "application/soap+xml; charset=utf-8";
    }
#ifndef WITH_LEANER
    if (soap->mode & (SOAP_ENC_DIME | SOAP_ENC_MTOM))
    { if (soap->mode & SOAP_ENC_MTOM)
      { if (soap->version == 2)
          r = "application/soap+xml";
	else
          r = "text/xml";
        s = "application/xop+xml";
      }
      else
        s = "application/dime";
    }
    if ((soap->mode & SOAP_ENC_MIME) && soap->mime.boundary && strlen(soap->mime.boundary) + strlen(soap->mime.start ? soap->mime.start : SOAP_STR_EOS) < sizeof(soap->tmpbuf) - 80)
    { register const char *t = strchr(s, ';');
      sprintf(soap->tmpbuf, "multipart/related; charset=utf-8; boundary=\"%s\"; type=\"", soap->mime.boundary);
      if (t)
      { strncat(soap->tmpbuf, s, t - s);
        soap->tmpbuf[sizeof(soap->tmpbuf)-1] = '\0';
      }
      else
        strcat(soap->tmpbuf, s);
      if (soap->mime.start)
      { strcat(soap->tmpbuf, "\"; start=\"");
        strcat(soap->tmpbuf, soap->mime.start);
      }
      strcat(soap->tmpbuf, "\"");
      if (r)
      { strcat(soap->tmpbuf, "; start-info=\"");
        strcat(soap->tmpbuf, r);
        strcat(soap->tmpbuf, "\"");
      }
      s = soap->tmpbuf;
    }
#endif
    if (s && (err = soap->fposthdr(soap, "Content-Type", s)))
      return err;
#ifdef WITH_ZLIB
    if ((soap->omode & SOAP_ENC_ZLIB))
    { 
#ifdef WITH_GZIP
      err = soap->fposthdr(soap, "Content-Encoding", soap->zlib_out == SOAP_ZLIB_DEFLATE ? "deflate" : "gzip");
#else
      err = soap->fposthdr(soap, "Content-Encoding", "deflate");
#endif
      if (err)
        return err;
    }
#endif
#ifndef WITH_LEANER
    if ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK)
      err = soap->fposthdr(soap, "Transfer-Encoding", "chunked");
    else
#endif
    if (s)
    { sprintf(soap->tmpbuf, "%lu", (unsigned long)count);
      err = soap->fposthdr(soap, "Content-Length", soap->tmpbuf);
    }
    if (err)
      return err;
  }
  return soap->fposthdr(soap, "Connection", soap->keep_alive ? "keep-alive" : "close");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x19210(%rdi), %eax
cmpl $0x7d2, %eax            # imm = 0x7D2
jne 0x49b03
movq 0x5f98(%rbx), %rax
cmpw $0x0, 0x191cc(%rbx)
leaq 0x9067(%rip), %rcx      # 0x52b45
leaq 0x9055(%rip), %rdx      # 0x52b3a
cmoveq %rcx, %rdx
leaq 0x903f(%rip), %rsi      # 0x52b2f
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq %rdx, %r14
cmpl $0x3eb, %esi            # imm = 0x3EB
setne %cl
cmpl $0x7d1, %eax            # imm = 0x7D1
setne %al
testb %al, %cl
jne 0x49b24
movq 0x30(%rbx), %r12
testq %r12, %r12
jne 0x49b5a
cmpl $0x3ea, %esi            # imm = 0x3EA
jne 0x49b35
leaq 0x8f48(%rip), %r12      # 0x52a7b
jmp 0x49b5a
leaq 0x8eb9(%rip), %r12      # 0x529f5
testq %r14, %r14
jne 0x49b4a
movl 0xc(%rbx), %eax
notl %eax
testb $0x3, %al
jne 0x49b5a
cmpw $0x2, 0x2(%rbx)
leaq 0x8e47(%rip), %rax      # 0x5299d
cmoveq %rax, %r12
movl 0x4(%rbx), %eax
testl $0x280, %eax            # imm = 0x280
je 0x49b71
btl $0x9, %eax
jb 0x49b76
leaq 0x8dd7(%rip), %r12      # 0x52948
xorl %r15d, %r15d
jmp 0x49b94
cmpw $0x2, 0x2(%rbx)
leaq 0x8f12(%rip), %rcx      # 0x52a94
leaq 0x8f20(%rip), %r15      # 0x52aa9
cmoveq %rcx, %r15
leaq 0x8f1e(%rip), %r12      # 0x52ab2
btl $0x8, %eax
jae 0x49c37
movq 0x19288(%rbx), %rbp
testq %rbp, %rbp
je 0x49c37
movq %r14, (%rsp)
movq %rbp, %rdi
callq 0x3110
movq %rax, %r14
movq 0x19290(%rbx), %rax
testq %rax, %rax
leaq 0x8593(%rip), %rdi      # 0x52161
cmovneq %rax, %rdi
callq 0x3110
addq %r14, %rax
cmpq $0x3af, %rax            # imm = 0x3AF
ja 0x49cb2
movq %r12, %rdi
movl $0x3b, %esi
callq 0x3130
movq %rax, %r14
leaq 0x16538(%rbx), %r13
leaq 0x8ec2(%rip), %rsi      # 0x52ac6
movq %r13, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x3360
testq %r14, %r14
je 0x49cbe
subq %r12, %r14
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x31a0
movb $0x0, 0x16937(%rbx)
jmp 0x49cc9
movq %r12, %r13
leaq 0x8c66(%rip), %rsi      # 0x528a7
movq %rbx, %rdi
movq %r13, %rdx
callq *0x5f98(%rbx)
testl %eax, %eax
jne 0x49ca3
movl 0xc(%rbx), %eax
notl %eax
testb $0x3, %al
jne 0x49c6d
leaq 0x8c6f(%rip), %rsi      # 0x528d0
leaq 0x8eb0(%rip), %rdx      # 0x52b18
movq %rbx, %rdi
jmp 0x49c95
movq %r14, %rdx
leaq 0x16538(%rbx), %r14
leaq 0x8b58(%rip), %rsi      # 0x527d6
movq %r14, %rdi
xorl %eax, %eax
callq 0x3360
leaq 0x8e91(%rip), %rsi      # 0x52b20
movq %rbx, %rdi
movq %r14, %rdx
callq *0x5f98(%rbx)
testl %eax, %eax
je 0x49ac8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %r13
movq (%rsp), %r14
jmp 0x49c3a
movq %r13, %rdi
movq %r12, %rsi
callq 0x3350
cmpq $0x0, 0x19290(%rbx)
movq (%rsp), %r14
je 0x49d06
movq %r13, %rdi
callq 0x3110
movabsq $0x7472617473203b22, %rcx # imm = 0x7472617473203B22
movq %rcx, (%r13,%rax)
movl $0x223d74, 0x7(%r13,%rax) # imm = 0x223D74
movq 0x19290(%rbx), %rsi
movq %r13, %rdi
callq 0x3350
movq %r13, %rdi
callq 0x3110
movw $0x22, (%r13,%rax)
testq %r15, %r15
je 0x49c3a
movq %r13, %rdi
callq 0x3110
movabsq $0x2d7472617473203b, %rcx # imm = 0x2D7472617473203B
movq %rcx, (%r13,%rax)
movabsq $0x223d6f666e692d, %rcx # imm = 0x223D6F666E692D
movq %rcx, 0x7(%r13,%rax)
movq %r13, %rdi
movq %r15, %rsi
callq 0x3350
movq %r13, %rdi
callq 0x3110
movw $0x22, (%r13,%rax)
jmp 0x49c3a