// File: /workspace/github_c_makefile_star2_O0/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_try_connect_command
static int
soap_try_connect_command(struct soap *soap, int http_command, const char *endpoint, const char *action)
{ char host[sizeof(soap->host)];
  int port;
  size_t count;
  soap->error = SOAP_OK;
  strcpy(host, soap->host); /* save previous host name: if != then reconnect */
  port = soap->port; /* save previous port to compare */
  soap->status = http_command;
  soap_set_endpoint(soap, endpoint);
#ifndef WITH_LEANER
  if (soap->fconnect)
  { if ((soap->error = soap->fconnect(soap, endpoint, soap->host, soap->port)))
      return soap->error;
  }
  else
#endif
  if (soap->fopen && *soap->host)
  { if (!soap->keep_alive || !soap_valid_socket(soap->socket) || strcmp(soap->host, host) || soap->port != port || !soap->fpoll || soap->fpoll(soap))
    { soap->keep_alive = 0; /* to force close */
      soap->omode &= ~SOAP_IO_UDP; /* to force close */
      soap_closesock(soap);
      DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Connect/reconnect to host='%s' path='%s' port=%d\n", soap->host, soap->path, soap->port));
#ifndef WITH_LEAN
      if (!strncmp(endpoint, "soap.udp:", 9))
        soap->omode |= SOAP_IO_UDP;
#endif
      soap->socket = soap->fopen(soap, endpoint, soap->host, soap->port);
      if (soap->error)
        return soap->error;
      soap->keep_alive = ((soap->omode & SOAP_IO_KEEPALIVE) != 0);
    }
  }
  count = soap_count_attachments(soap);
  if (soap_begin_send(soap))
    return soap->error;
  if (http_command == SOAP_GET)
  { soap->mode &= ~SOAP_IO;
    soap->mode |= SOAP_IO_BUFFER;
  }
#ifndef WITH_NOHTTP
  soap->action = soap_strdup(soap, action);
  if ((soap->mode & SOAP_IO) != SOAP_IO_STORE && !(soap->mode & SOAP_ENC_XML) && endpoint)
  { unsigned int k = soap->mode;
    soap->mode &= ~(SOAP_IO | SOAP_ENC_ZLIB);
    if ((k & SOAP_IO) != SOAP_IO_FLUSH)
      soap->mode |= SOAP_IO_BUFFER;
    if ((soap->error = soap->fpost(soap, endpoint, soap->host, soap->port, soap->path, action, count)))
      return soap->error;
#ifndef WITH_LEANER
    if ((k & SOAP_IO) == SOAP_IO_CHUNK)
    { if (soap_flush(soap))
        return soap->error;
    }
#endif
    soap->mode = k;
  }
  if (http_command == SOAP_GET)
    return soap_end_send(soap);
#endif
  return SOAP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x450, %rsp            # imm = 0x450
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl $0x0, 0x19214(%rax)
leaq -0x430(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x18da8, %rsi          # imm = 0x18DA8
callq 0x3090
movq -0x10(%rbp), %rax
movl 0x191c8(%rax), %eax
movl %eax, -0x434(%rbp)
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x19210(%rax)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x6b770
movq -0x10(%rbp), %rax
cmpq $0x0, 0x5fc8(%rax)
je 0x6bbd7
movq -0x10(%rbp), %rax
movq 0x5fc8(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
addq $0x18da8, %rdx          # imm = 0x18DA8
movq -0x10(%rbp), %rcx
movl 0x191c8(%rcx), %ecx
callq *%rax
movq -0x10(%rbp), %rcx
movl %eax, 0x19214(%rcx)
cmpl $0x0, %eax
je 0x6bbd2
movq -0x10(%rbp), %rax
movl 0x19214(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x6bec5
jmp 0x6bd34
movq -0x10(%rbp), %rax
cmpq $0x0, 0x5fe8(%rax)
je 0x6bd32
movq -0x10(%rbp), %rax
movsbl 0x18da8(%rax), %eax
cmpl $0x0, %eax
je 0x6bd32
movq -0x10(%rbp), %rax
cmpw $0x0, 0x191cc(%rax)
je 0x6bc6e
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x60d4(%rax)
je 0x6bc6e
movq -0x10(%rbp), %rdi
addq $0x18da8, %rdi          # imm = 0x18DA8
leaq -0x430(%rbp), %rsi
callq 0x3210
cmpl $0x0, %eax
jne 0x6bc6e
movq -0x10(%rbp), %rax
movl 0x191c8(%rax), %eax
cmpl -0x434(%rbp), %eax
jne 0x6bc6e
movq -0x10(%rbp), %rax
cmpq $0x0, 0x6010(%rax)
je 0x6bc6e
movq -0x10(%rbp), %rax
movq 0x6010(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
cmpl $0x0, %eax
je 0x6bd30
movq -0x10(%rbp), %rax
movw $0x0, 0x191cc(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
andl $-0x5, %ecx
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rdi
callq 0x55cf0
movq -0x20(%rbp), %rdi
leaq 0x10044(%rip), %rsi     # 0x7bce0
movl $0x9, %edx
callq 0x3080
cmpl $0x0, %eax
jne 0x6bcb8
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
orl $0x4, %ecx
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rax
movq 0x5fe8(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
addq $0x18da8, %rdx          # imm = 0x18DA8
movq -0x10(%rbp), %rcx
movl 0x191c8(%rcx), %ecx
callq *%rax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x60d4(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x19214(%rax)
je 0x6bd0d
movq -0x10(%rbp), %rax
movl 0x19214(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x6bec5
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x191cc(%rax)
jmp 0x6bd32
jmp 0x6bd34
movq -0x10(%rbp), %rdi
callq 0x6cc10
movq %rax, -0x440(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5b0d0
cmpl $0x0, %eax
je 0x6bd64
movq -0x10(%rbp), %rax
movl 0x19214(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x6bec5
cmpl $0x7d2, -0x14(%rbp)     # imm = 0x7D2
jne 0x6bd87
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
andl $-0x4, %ecx
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
orl $0x1, %ecx
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x538b0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x191a8(%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x3, %eax
cmpl $0x2, %eax
je 0x6bea7
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0x6bea7
cmpq $0x0, -0x20(%rbp)
je 0x6bea7
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x444(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
andl $0xfffffbfc, %ecx       # imm = 0xFFFFFBFC
movl %ecx, 0x4(%rax)
movl -0x444(%rbp), %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x6be0b
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
orl $0x1, %ecx
movl %ecx, 0x4(%rax)
movq -0x10(%rbp), %rax
movq 0x5f68(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
addq $0x18da8, %rdx          # imm = 0x18DA8
movq -0x10(%rbp), %rcx
movl 0x191c8(%rcx), %ecx
movq -0x10(%rbp), %r8
addq $0x189a8, %r8           # imm = 0x189A8
movq -0x28(%rbp), %r9
movq -0x440(%rbp), %r10
movq %r10, (%rsp)
callq *%rax
movq -0x10(%rbp), %rcx
movl %eax, 0x19214(%rcx)
cmpl $0x0, %eax
je 0x6be6d
movq -0x10(%rbp), %rax
movl 0x19214(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x6bec5
movl -0x444(%rbp), %eax
andl $0x3, %eax
cmpl $0x3, %eax
jne 0x6be9a
movq -0x10(%rbp), %rdi
callq 0x4f060
cmpl $0x0, %eax
je 0x6be98
movq -0x10(%rbp), %rax
movl 0x19214(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x6bec5
jmp 0x6be9a
movl -0x444(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
cmpl $0x7d2, -0x14(%rbp)     # imm = 0x7D2
jne 0x6bebe
movq -0x10(%rbp), %rdi
callq 0x5cde0
movl %eax, -0x4(%rbp)
jmp 0x6bec5
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x450, %rsp            # imm = 0x450
popq %rbp
retq
nopw %cs:(%rax,%rax)