// File: /workspace/github_c_makefile_star2_O1/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
je 0x4a323
movq %rdx, %r14
cmpl $0x3eb, %esi            # imm = 0x3EB
setne %cl
cmpl $0x7d1, %eax            # imm = 0x7D1
setne %al
testb %al, %cl
jne 0x4a19f
movq 0x30(%rbx), %r12
testq %r12, %r12
jne 0x4a1d5
cmpl $0x3ea, %esi            # imm = 0x3EA
jne 0x4a1b0
leaq 0x88cd(%rip), %r12      # 0x52a7b
jmp 0x4a1d5
leaq 0x883e(%rip), %r12      # 0x529f5
testq %r14, %r14
jne 0x4a1c5
movl 0xc(%rbx), %eax
notl %eax
testb $0x3, %al
jne 0x4a1d5
cmpw $0x2, 0x2(%rbx)
leaq 0x87cc(%rip), %rax      # 0x5299d
cmoveq %rax, %r12
movl 0x4(%rbx), %eax
testl $0x280, %eax            # imm = 0x280
je 0x4a1ec
btl $0x9, %eax
jb 0x4a1f1
leaq 0x875c(%rip), %r12      # 0x52948
xorl %r15d, %r15d
jmp 0x4a20f
cmpw $0x2, 0x2(%rbx)
leaq 0x8897(%rip), %rcx      # 0x52a94
leaq 0x88a5(%rip), %r15      # 0x52aa9
cmoveq %rcx, %r15
leaq 0x88a3(%rip), %r12      # 0x52ab2
btl $0x8, %eax
jae 0x4a2b2
movq 0x19288(%rbx), %rbp
testq %rbp, %rbp
je 0x4a2b2
movq %r14, (%rsp)
movq %rbp, %rdi
callq 0x3110
movq %rax, %r14
movq 0x19290(%rbx), %rax
testq %rax, %rax
leaq 0x7f18(%rip), %rdi      # 0x52161
cmovneq %rax, %rdi
callq 0x3110
addq %r14, %rax
cmpq $0x3af, %rax            # imm = 0x3AF
ja 0x4a36d
movq %r12, %rdi
movl $0x3b, %esi
callq 0x3130
movq %rax, %r14
leaq 0x16538(%rbx), %r13
leaq 0x8847(%rip), %rsi      # 0x52ac6
movq %r13, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x3350
testq %r14, %r14
je 0x4a379
subq %r12, %r14
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x31a0
movb $0x0, 0x16937(%rbx)
jmp 0x4a384
movq %r12, %r13
leaq 0x85eb(%rip), %rsi      # 0x528a7
movq %rbx, %rdi
movq %r13, %rdx
callq *0x5f98(%rbx)
testl %eax, %eax
je 0x4a2d0
xorl %ecx, %ecx
jmp 0x4a31f
movl 0xc(%rbx), %eax
notl %eax
testb $0x3, %al
jne 0x4a2ec
leaq 0x85f0(%rip), %rsi      # 0x528d0
leaq 0x8831(%rip), %rdx      # 0x52b18
movq %rbx, %rdi
jmp 0x4a314
movq %r14, %rdx
leaq 0x16538(%rbx), %r14
leaq 0x84d9(%rip), %rsi      # 0x527d6
movq %r14, %rdi
xorl %eax, %eax
callq 0x3350
leaq 0x8812(%rip), %rsi      # 0x52b20
movq %rbx, %rdi
movq %r14, %rdx
callq *0x5f98(%rbx)
testl %eax, %eax
sete %cl
testb %cl, %cl
je 0x4a35e
movq 0x5f98(%rbx), %rax
cmpw $0x0, 0x191cc(%rbx)
leaq 0x880c(%rip), %rcx      # 0x52b45
leaq 0x87fa(%rip), %rdx      # 0x52b3a
cmoveq %rcx, %rdx
leaq 0x87e4(%rip), %rsi      # 0x52b2f
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %r13
movq (%rsp), %r14
jmp 0x4a2b5
movq %r13, %rdi
movq %r12, %rsi
callq 0x3340
movq (%rsp), %r14
cmpq $0x0, 0x19290(%rbx)
je 0x4a3c1
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 0x3340
movq %r13, %rdi
callq 0x3110
movw $0x22, (%r13,%rax)
testq %r15, %r15
je 0x4a2b5
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 0x3340
movq %r13, %rdi
callq 0x3110
movw $0x22, (%r13,%rax)
jmp 0x4a2b5