// File: /workspace/github_c_makefile_star2_O1/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
subq $0x18, %rsp
movq %rsi, %r13
movq %rdi, %rbx
testb $0x1, 0x6(%rdi)
je 0x4226d
movq 0x18580(%rbx), %r15
testq %r15, %r15
je 0x42215
cmpw $0x0, 0x20(%r15)
je 0x42210
leaq 0x22(%r15), %r14
movq %r14, %rdi
movl $0x3a, %esi
callq 0x3130
testq %rax, %rax
je 0x42210
subq %r14, %rax
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x42126
movq (%r15), %r15
jmp 0x421dc
movq 0x88(%rbx), %r14
testq %r14, %r14
je 0x4226d
leaq 0x16538(%rbx), %r15
leaq 0x10346(%rip), %r12     # 0x52575
cmpw $0x1, 0xc(%r14)
jne 0x42265
cmpq $0x0, 0x10(%r14)
je 0x42265
leaq 0x18(%r14), %rdx
movq %r15, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x3350
movq 0x10(%r14), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x425f4
movw $0x2, 0xc(%r14)
movq (%r14), %r14
testq %r14, %r14
jne 0x4222f
movq %r13, 0x10(%rsp)
movq 0x18580(%rbx), %rbp
testq %rbp, %rbp
je 0x423f5
cmpw $0x0, 0x20(%rbp)
je 0x423d5
testb $-0x80, 0x5(%rbx)
je 0x4233b
leaq 0x22(%rbp), %r12
movq %r12, %rdi
movl $0x3a, %esi
callq 0x3130
testq %rax, %rax
je 0x4233b
movq 0x88(%rbx), %r14
testq %r14, %r14
je 0x422f3
movq %rax, %r13
movl %r15d, 0xc(%rsp)
movq %rax, %r15
subq %r12, %r15
addq $0x18, %r14
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x3080
testl %eax, %eax
jne 0x422ee
cmpb $0x0, (%r14,%r15)
jne 0x422ee
incq %r13
movq %r13, %r12
movl 0xc(%rsp), %r15d
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x1061b(%rip), %rsi     # 0x5291d
callq 0x376e8
testl %eax, %eax
jne 0x42329
movq %r12, %rdi
callq 0x3110
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x376e8
testl %eax, %eax
je 0x423ee
movl 0x19214(%rbx), %r15d
xorl %eax, %eax
testb %al, %al
jne 0x42371
jmp 0x423cb
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x105d3(%rip), %rsi     # 0x5291d
callq 0x376e8
testl %eax, %eax
jne 0x423c4
leaq 0x22(%rbp), %r14
movq %r14, %rdi
callq 0x3110
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x376e8
testl %eax, %eax
jne 0x423c4
cmpw $0x2, 0x20(%rbp)
jne 0x423e4
cmpq $0x0, 0x8(%rbp)
je 0x423e4
movl $0x2, %edx
movq %rbx, %rdi
leaq 0x1076d(%rip), %rsi     # 0x52afb
callq 0x376e8
testl %eax, %eax
jne 0x423c4
movq 0x8(%rbp), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x4296e
testl %eax, %eax
jne 0x423c4
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x10433(%rip), %rsi     # 0x527ee
callq 0x376e8
testl %eax, %eax
je 0x423e4
movl 0x19214(%rbx), %r15d
xorl %eax, %eax
testb %al, %al
je 0x42476
movq (%rbp), %rbp
testq %rbp, %rbp
jne 0x42282
jmp 0x423f5
movw $0x0, 0x20(%rbp)
movb $0x1, %al
jmp 0x423cd
movb $0x1, %al
jmp 0x42332
movq 0x10(%rsp), %r14
testq %r14, %r14
je 0x42421
testb $0x1, 0x6(%rbx)
jne 0x42443
decl 0x6108(%rbx)
leaq 0x1021b(%rip), %rsi     # 0x5262d
movl $0x2, %edx
movq %rbx, %rdi
callq 0x376e8
jmp 0x42466
leaq 0x10206(%rip), %rsi     # 0x5262e
movl $0x1, %edx
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x376e8
leaq 0x101e4(%rip), %rsi     # 0x5262e
movl $0x1, %edx
movq %rbx, %rdi
callq 0x376e8
testl %eax, %eax
jne 0x4246a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3f797
testl %eax, %eax
je 0x42473
movl 0x19214(%rbx), %r15d
jmp 0x42476
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq