// File: /workspace/github_c_makefile_star2_O2/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 0x45224
movq 0x5f98(%rbx), %rax
cmpw $0x0, 0x191cc(%rbx)
leaq 0x8946(%rip), %rcx      # 0x4db45
leaq 0x8934(%rip), %rdx      # 0x4db3a
cmoveq %rcx, %rdx
leaq 0x891e(%rip), %rsi      # 0x4db2f
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 0x45245
movq 0x30(%rbx), %r12
testq %r12, %r12
jne 0x4527b
cmpl $0x3ea, %esi            # imm = 0x3EA
jne 0x45256
leaq 0x8827(%rip), %r12      # 0x4da7b
jmp 0x4527b
leaq 0x8798(%rip), %r12      # 0x4d9f5
testq %r14, %r14
jne 0x4526b
movl 0xc(%rbx), %eax
notl %eax
testb $0x3, %al
jne 0x4527b
cmpw $0x2, 0x2(%rbx)
leaq 0x8726(%rip), %rax      # 0x4d99d
cmoveq %rax, %r12
movl 0x4(%rbx), %eax
testw $0x280, %ax             # imm = 0x280
je 0x45291
btl $0x9, %eax
jb 0x45296
leaq 0x86b7(%rip), %r12      # 0x4d948
xorl %r15d, %r15d
jmp 0x452b4
cmpw $0x2, 0x2(%rbx)
leaq 0x87f2(%rip), %rcx      # 0x4da94
leaq 0x8800(%rip), %r15      # 0x4daa9
cmoveq %rcx, %r15
leaq 0x87fe(%rip), %r12      # 0x4dab2
btl $0x8, %eax
jae 0x45355
movq 0x19288(%rbx), %rbp
testq %rbp, %rbp
je 0x45355
movq %r14, (%rsp)
movq %rbp, %rdi
callq 0x3110
movq %rax, %r14
movq 0x19290(%rbx), %rax
testq %rax, %rax
leaq 0x7e73(%rip), %rdi      # 0x4d161
cmovneq %rax, %rdi
callq 0x3110
addq %r14, %rax
cmpq $0x3af, %rax            # imm = 0x3AF
ja 0x453d0
pushq $0x3b
popq %rsi
movq %r12, %rdi
callq 0x3130
movq %rax, %r14
leaq 0x16538(%rbx), %r13
leaq 0x87a4(%rip), %rsi      # 0x4dac6
movq %r13, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x3370
testq %r14, %r14
je 0x453dc
subq %r12, %r14
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x31a0
movb $0x0, 0x16937(%rbx)
jmp 0x453e7
movq %r12, %r13
leaq 0x8548(%rip), %rsi      # 0x4d8a7
movq %rbx, %rdi
movq %r13, %rdx
callq *0x5f98(%rbx)
testl %eax, %eax
jne 0x453c1
movl 0xc(%rbx), %eax
notl %eax
testb $0x3, %al
jne 0x4538b
leaq 0x8551(%rip), %rsi      # 0x4d8d0
leaq 0x8792(%rip), %rdx      # 0x4db18
movq %rbx, %rdi
jmp 0x453b3
movq %r14, %rdx
leaq 0x16538(%rbx), %r14
leaq 0x843a(%rip), %rsi      # 0x4d7d6
movq %r14, %rdi
xorl %eax, %eax
callq 0x3370
leaq 0x8773(%rip), %rsi      # 0x4db20
movq %rbx, %rdi
movq %r14, %rdx
callq *0x5f98(%rbx)
testl %eax, %eax
je 0x451e9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %r13
movq (%rsp), %r14
jmp 0x45358
movq %r13, %rdi
movq %r12, %rsi
callq 0x3360
cmpq $0x0, 0x19290(%rbx)
movq (%rsp), %r14
je 0x45424
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 0x3360
movq %r13, %rdi
callq 0x3110
movw $0x22, (%r13,%rax)
testq %r15, %r15
je 0x45358
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 0x3360
movq %r13, %rdi
callq 0x3110
movw $0x22, (%r13,%rax)
jmp 0x45358