// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_element_start_end_out
SOAP_FMAC2
soap_element_start_end_out(struct soap *soap, const char *tag)
{ register struct soap_attribute *tp;
#ifndef WITH_LEAN
  if (soap->mode & SOAP_XML_CANONICAL)
  { struct soap_nlist *np;
    for (tp = soap->attributes; tp; tp = tp->next)
    { if (tp->visible && tp->name)
      { const char *s = strchr(tp->name, ':');
        if (s)
          soap_utilize_ns(soap, tp->name, s - tp->name);
      }
    }
    for (np = soap->nlist; np; np = np->next)
    { if (np->index == 1 && np->ns)
      { sprintf(soap->tmpbuf, "xmlns:%s", np->id);
        DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Enabling utilized binding (level=%u) %s='%s'\n", np->level, soap->tmpbuf, np->ns));
        soap_set_attr(soap, soap->tmpbuf, np->ns);
        np->index = 2;
      }
    }
  }
#endif
#ifdef WITH_DOM
  if ((soap->mode & SOAP_XML_DOM) && soap->dom)
  { register struct soap_dom_attribute **att;
    att = &soap->dom->atts;
    for (tp = soap->attributes; tp; tp = tp->next)
    { if (tp->visible)
      { *att = (struct soap_dom_attribute*)soap_malloc(soap, sizeof(struct soap_dom_attribute));
        if (!*att)
          return soap->error;
        (*att)->next = NULL;
        (*att)->nstr = NULL;
        (*att)->name = soap_strdup(soap, tp->name);
        (*att)->data = soap_strdup(soap, tp->value);
        (*att)->wide = NULL;
        (*att)->soap = soap;
        att = &(*att)->next;
        tp->visible = 0;
      }
    }
    return SOAP_OK;
  }
#endif
  for (tp = soap->attributes; tp; tp = tp->next)
  { if (tp->visible)
    { const char *s;
#ifndef WITH_LEAN
      if ((soap->mode & SOAP_XML_DEFAULTNS) && (s = strchr(tp->name, ':')))
      { size_t n = s - tp->name;
        if (soap->nlist && !strncmp(soap->nlist->id, tp->name, n) && !soap->nlist->id[n])
          s++;
        else
          s = tp->name;
        if (soap_send(soap, " ") || soap_send(soap, s))
          return soap->error;
      }
      else
#endif
      if (soap_send(soap, " ") || soap_send(soap, tp->name))
        return soap->error;
      if (tp->visible == 2 && tp->value)
        if (soap_send_raw(soap, "=\"", 2)
         || soap_string_out(soap, tp->value, 1)
         || soap_send_raw(soap, "\"", 1))
          return soap->error;
      tp->visible = 0;
    }
  }
  if (tag)
  { 
#ifndef WITH_LEAN
    if (soap->mode & SOAP_XML_CANONICAL)
    { if (soap_send_raw(soap, ">", 1)
       || soap_element_end_out(soap, tag))
        return soap->error;
      return SOAP_OK;
    }
#endif
    soap->level--;	/* decrement level just before /> */
    if (soap_send_raw(soap, "/>", 2))
      return soap->error;
    return SOAP_OK;
  }
  return soap_send_raw(soap, ">", 1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, (%rsp)
movq %rdi, %rbx
testb $0x1, 0x6(%rdi)
jne 0x3e072
leaq 0x18580(%rbx), %r15
leaq 0xf9c8(%rip), %r14      # 0x4d91d
pushq $0x3a
popq %r13
movq (%r15), %r15
testq %r15, %r15
je 0x3e111
cmpw $0x0, 0x20(%r15)
je 0x3df59
testb $-0x80, 0x5(%rbx)
je 0x3dfe6
leaq 0x22(%r15), %r12
movq %r12, %rdi
movl %r13d, %esi
callq 0x3130
testq %rax, %rax
je 0x3dfe6
movq 0x88(%rbx), %r13
testq %r13, %r13
je 0x3dfc7
movq %rax, %rbp
movq %rax, %r14
subq %r12, %r14
addq $0x18, %r13
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x3080
testl %eax, %eax
jne 0x3dfc0
cmpb $0x0, (%r13,%r14)
jne 0x3dfc0
incq %rbp
movq %rbp, %r12
leaq 0xf956(%rip), %r14      # 0x4d91d
pushq $0x3a
popq %r13
movq %rbx, %rdi
movq %r14, %rsi
callq 0x34a3f
testl %eax, %eax
jne 0x3e17f
movq %rbx, %rdi
movq %r12, %rsi
jmp 0x3e000
movq %rbx, %rdi
movq %r14, %rsi
callq 0x34a3f
testl %eax, %eax
jne 0x3e17f
leaq 0x22(%r15), %rsi
movq %rbx, %rdi
callq 0x34a3f
testl %eax, %eax
jne 0x3e17f
cmpw $0x2, 0x20(%r15)
jne 0x3e067
cmpq $0x0, 0x8(%r15)
je 0x3e067
movq %rbx, %rdi
leaq 0xfad5(%rip), %rsi      # 0x4dafb
pushq $0x2
popq %rdx
callq 0x347c4
testl %eax, %eax
jne 0x3e17f
movq 0x8(%r15), %rsi
movq %rbx, %rdi
pushq $0x1
popq %rdx
callq 0x3e651
testl %eax, %eax
jne 0x3e17f
movq %rbx, %rdi
leaq 0xf797(%rip), %rsi      # 0x4d7ee
pushq $0x1
popq %rdx
callq 0x347c4
testl %eax, %eax
jne 0x3e17f
andw $0x0, 0x20(%r15)
jmp 0x3df59
leaq 0x18580(%rbx), %r15
pushq $0x3a
popq %rbp
movq (%r15), %r15
testq %r15, %r15
je 0x3e0b2
cmpw $0x0, 0x20(%r15)
je 0x3e07c
leaq 0x22(%r15), %r14
movq %r14, %rdi
movl %ebp, %esi
callq 0x3130
testq %rax, %rax
je 0x3e07c
subq %r14, %rax
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x3de9d
jmp 0x3e07c
leaq 0x88(%rbx), %r12
leaq 0x16538(%rbx), %r14
leaq 0xf4ae(%rip), %r15      # 0x4d575
movq (%r12), %r12
testq %r12, %r12
je 0x3df47
cmpw $0x1, 0xc(%r12)
jne 0x3e0c7
cmpq $0x0, 0x10(%r12)
je 0x3e0c7
leaq 0x18(%r12), %rdx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x3370
movq 0x10(%r12), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3e2d0
movw $0x2, 0xc(%r12)
jmp 0x3e0c7
movq (%rsp), %r14
testq %r14, %r14
je 0x3e13a
testb $0x1, 0x6(%rbx)
jne 0x3e15a
decl 0x6108(%rbx)
leaq 0xf500(%rip), %rsi      # 0x4d62d
pushq $0x2
popq %rdx
movq %rbx, %rdi
callq 0x347c4
jmp 0x3e17b
leaq 0xf4ed(%rip), %rsi      # 0x4d62e
pushq $0x1
popq %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x347c4
leaq 0xf4cd(%rip), %rsi      # 0x4d62e
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x347c4
testl %eax, %eax
jne 0x3e17f
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3ba46
testl %eax, %eax
je 0x3e194
movl 0x19214(%rbx), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x3e185