// File: /workspace/github_c_makefile_star2_O0/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_putmime
SOAP_FMAC2
soap_putmime(struct soap *soap)
{ struct soap_multipart *content;
  if (!(soap->mode & SOAP_ENC_MIME) || !soap->mime.boundary)
    return SOAP_OK;
  DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Sending MIME attachments\n"));
  for (content = soap->mime.first; content; content = content->next)
  { void *handle;
    if (soap->fmimereadopen && ((handle = soap->fmimereadopen(soap, (void*)content->ptr, content->id, content->type, content->description)) || soap->error))
    { size_t size = content->size;
      if (!handle)
      { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fmimereadopen failed\n"));
        return soap->error;
      }
      if (soap_putmimehdr(soap, content))
        return soap->error;
      if (!size)
      { if ((soap->mode & SOAP_ENC_XML) || (soap->mode & SOAP_IO) == SOAP_IO_CHUNK || (soap->mode & SOAP_IO) == SOAP_IO_STORE)
        { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Chunked streaming MIME\n"));
          do 
          { size = soap->fmimeread(soap, handle, soap->tmpbuf, sizeof(soap->tmpbuf));
            DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fmimeread returned %lu bytes\n", (unsigned long)size));
            if (soap_send_raw(soap, soap->tmpbuf, size))
              break;
          } while (size); 
        }
        else
        { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error: cannot chunk streaming MIME (no HTTP chunking)\n"));
        }
      }
      else
      { do
        { size_t bufsize;
          if (size < sizeof(soap->tmpbuf))
            bufsize = size;
          else
            bufsize = sizeof(soap->tmpbuf);
          if (!(bufsize = soap->fmimeread(soap, handle, soap->tmpbuf, bufsize)))
          { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fmimeread failed: insufficient data (%lu bytes remaining from %lu bytes)\n", (unsigned long)size, (unsigned long)content->size));
            soap->error = SOAP_EOF;
            break;
          }
          if (soap_send_raw(soap, soap->tmpbuf, bufsize))
            break;
          size -= bufsize;
        } while (size);
      }
      if (soap->fmimereadclose)
        soap->fmimereadclose(soap, handle);
    }
    else
    { if (soap_putmimehdr(soap, content)
       || soap_send_raw(soap, content->ptr, content->size))
        return soap->error;
    }
  }
  return soap_send3(soap, "\r\n--", soap->mime.boundary, "--");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x5d5cb
movq -0x10(%rbp), %rax
cmpq $0x0, 0x19288(%rax)
jne 0x5d5d7
movl $0x0, -0x4(%rbp)
jmp 0x5d860
movq -0x10(%rbp), %rax
movq 0x192a0(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x5d83b
movq -0x10(%rbp), %rax
cmpq $0x0, 0x60a0(%rax)
je 0x5d7e8
movq -0x10(%rbp), %rax
movq 0x60a0(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rsi
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rdx
movq -0x18(%rbp), %rcx
movq 0x20(%rcx), %rcx
movq -0x18(%rbp), %r8
movq 0x40(%r8), %r8
callq *%rax
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x5d64f
movq -0x10(%rbp), %rax
cmpl $0x0, 0x19214(%rax)
je 0x5d7e8
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x5d674
movq -0x10(%rbp), %rax
movl 0x19214(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x5d860
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x6a1a0
cmpl $0x0, %eax
je 0x5d698
movq -0x10(%rbp), %rax
movl 0x19214(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x5d860
cmpq $0x0, -0x28(%rbp)
jne 0x5d72c
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0x5d6d0
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x3, %eax
cmpl $0x3, %eax
je 0x5d6d0
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x3, %eax
cmpl $0x2, %eax
jne 0x5d725
jmp 0x5d6d2
movq -0x10(%rbp), %rax
movq 0x60c0(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
addq $0x16538, %rdx          # imm = 0x16538
movl $0x400, %ecx            # imm = 0x400
callq *%rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x16538, %rsi          # imm = 0x16538
movq -0x28(%rbp), %rdx
callq 0x4eeb0
cmpl $0x0, %eax
je 0x5d71a
jmp 0x5d723
jmp 0x5d71c
cmpq $0x0, -0x28(%rbp)
jne 0x5d6d2
jmp 0x5d727
jmp 0x5d727
jmp 0x5d7c3
jmp 0x5d72e
cmpq $0x400, -0x28(%rbp)     # imm = 0x400
jae 0x5d742
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x5d74a
movq $0x400, -0x30(%rbp)     # imm = 0x400
movq -0x10(%rbp), %rax
movq 0x60c0(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
addq $0x16538, %rdx          # imm = 0x16538
movq -0x30(%rbp), %rcx
callq *%rax
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x5d788
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x19214(%rax) # imm = 0xFFFFFFFF
jmp 0x5d7c1
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x16538, %rsi          # imm = 0x16538
movq -0x30(%rbp), %rdx
callq 0x4eeb0
cmpl $0x0, %eax
je 0x5d7a7
jmp 0x5d7c1
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x5d72e
jmp 0x5d7c3
movq -0x10(%rbp), %rax
cmpq $0x0, 0x60b0(%rax)
je 0x5d7e6
movq -0x10(%rbp), %rax
movq 0x60b0(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq *%rax
jmp 0x5d829
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x6a1a0
cmpl $0x0, %eax
jne 0x5d818
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdx
callq 0x4eeb0
cmpl $0x0, %eax
je 0x5d827
movq -0x10(%rbp), %rax
movl 0x19214(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x5d860
jmp 0x5d829
jmp 0x5d82b
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x5d5e6
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x19288(%rax), %rdx
leaq 0x1d438(%rip), %rsi     # 0x7ac89
leaq 0x1d433(%rip), %rcx     # 0x7ac8b
callq 0x4f3c0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)