// File: /workspace/github_c_makefile_star2_O1/loversmile[P]sugarcrm/sugar_stdsoap2.c
// Function: soap_set_attr
SOAP_FMAC2
soap_set_attr(struct soap *soap, const char *name, const char *value)
{ register struct soap_attribute *tp;
  if (*name == '-')
    return SOAP_OK;
  DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set attribute %s='%s'\n", name, value?value:SOAP_STR_EOS));
  for (tp = soap->attributes; tp; tp = tp->next)
  { if (!strcmp(tp->name, name))
      break;
  }
  if (!tp)
  { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Allocate attribute %s\n", name));
    if (!(tp = (struct soap_attribute*)SOAP_MALLOC(soap, sizeof(struct soap_attribute) + strlen(name))))
      return soap->error = SOAP_EOM;
    tp->ns = NULL;
#ifndef WITH_LEAN
    if (soap->mode & SOAP_XML_CANONICAL)
    { struct soap_attribute **tpp = &soap->attributes;
      const char *s = strchr(name, ':');
      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Inserting attribute %s for c14n\n", name))
      if (!strncmp(name, "xmlns", 5))
      { for (; *tpp; tpp = &(*tpp)->next)
          if (strncmp((*tpp)->name, "xmlns", 5) || strcmp((*tpp)->name + 5, name + 5) > 0)
            break;
      }
      else if (!s)
      { for (; *tpp; tpp = &(*tpp)->next)
          if (strncmp((*tpp)->name, "xmlns", 5) && ((*tpp)->ns || strcmp((*tpp)->name, name) > 0))
            break;
      }
      else
      { int k;
        for (; *tpp; tpp = &(*tpp)->next)
        { if (!strncmp((*tpp)->name, "xmlns:", 6) && !strncmp((*tpp)->name + 6, name, s - name) && !(*tpp)->name[6 + s - name])
          { if (!tp->ns)
            { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Canonicalization: prefix %s=%p (%s)\n", name, (*tpp)->ns, (*tpp)->ns));
              tp->ns = (*tpp)->ns;
            }
          }
          else if (strncmp((*tpp)->name, "xmlns", 5) && (*tpp)->ns && tp->ns && ((k = strcmp((*tpp)->ns, tp->ns)) > 0 || (!k && strcmp((*tpp)->name, name) > 0)))
            break;
        }
      }
      tp->next = *tpp;
      *tpp = tp;
    }
    else
#endif
    { tp->next = soap->attributes;
      soap->attributes = tp;
    }
    strcpy(tp->name, name);
    tp->value = NULL;
  }
  else if (tp->visible)
  { return SOAP_OK;
  }
  else if (value && tp->value && tp->size <= strlen(value))
  { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free attribute value of %s (free %p)\n", name, tp->value));
    SOAP_FREE(soap, tp->value);
    tp->value = NULL;
    tp->ns = NULL;
  }
  if (value)
  { if (!tp->value)
    { tp->size = strlen(value) + 1;
      if (!(tp->value = (char*)SOAP_MALLOC(soap, tp->size)))
        return soap->error = SOAP_EOM;
      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Allocate attribute value for %s (%p)\n", tp->name, tp->value));
    }
    strcpy(tp->value, value);
    if (!strncmp(tp->name, "xmlns:", 6))
      tp->ns = tp->value;
    tp->visible = 2;
#ifndef WITH_LEAN
    if (!strcmp(name, "wsu:Id"))
    { soap->part = SOAP_BEGIN_SECURITY;
      strncpy(soap->id, value, sizeof(soap->id));
      soap->id[sizeof(soap->id)-1] = '\0';
    }
#endif
  }
  else
    tp->visible = 1;
  return SOAP_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
xorl %r15d, %r15d
cmpb $0x2d, (%rsi)
je 0x4279d
movq %rdx, %rbp
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x18580(%rdi), %r14
movq %r14, %r13
movq (%r13), %r13
testq %r13, %r13
je 0x4267e
leaq 0x22(%r13), %rdi
movq %r12, %rsi
callq 0x3200
testl %eax, %eax
jne 0x42621
cmpw $0x0, 0x20(%r13)
jne 0x4279d
testq %rbp, %rbp
je 0x426e9
movq %rbp, (%rsp)
movq 0x8(%r13), %rbp
testq %rbp, %rbp
je 0x426e5
movq %rbx, %r14
movq 0x10(%r13), %rbx
movq (%rsp), %rdi
callq 0x3110
cmpq %rax, %rbx
jbe 0x42952
movq %r14, %rbx
jmp 0x426e5
movq %r12, %rdi
callq 0x3110
leaq 0x28(%rax), %rdi
callq 0x3280
testq %rax, %rax
je 0x42784
movq %rax, %r13
movq %rbp, (%rsp)
movq $0x0, 0x18(%rax)
testb $0x1, 0x6(%rbx)
movq %rbx, 0x10(%rsp)
jne 0x427af
movq %r14, %r15
movq (%r15), %rax
movq %rax, (%r13)
movq %r13, (%r15)
leaq 0x22(%r13), %rdi
movq %r12, %rsi
callq 0x3090
movq %r13, %rax
addq $0x8, %rax
xorl %r15d, %r15d
movq 0x10(%rsp), %rbx
movq $0x0, (%rax)
movq (%rsp), %rbp
testq %rbp, %rbp
je 0x42796
cmpq $0x0, 0x8(%r13)
jne 0x42717
movq %rbp, %rdi
callq 0x3110
leaq 0x1(%rax), %rdi
movq %rdi, 0x10(%r13)
callq 0x3280
movq %rax, 0x8(%r13)
testq %rax, %rax
je 0x42784
movq 0x8(%r13), %rdi
movq %rbp, %rsi
callq 0x3090
leaq 0x22(%r13), %rdi
leaq 0xff3e(%rip), %rsi      # 0x5266c
movl $0x6, %edx
callq 0x3080
testl %eax, %eax
jne 0x42744
movq 0x8(%r13), %rax
movq %rax, 0x18(%r13)
movw $0x2, 0x20(%r13)
leaq 0xff21(%rip), %rsi      # 0x52673
movq %r12, %rdi
callq 0x3200
testl %eax, %eax
jne 0x4279d
movw $0xa, 0x18590(%rbx)
leaq 0x16d38(%rbx), %rdi
movl $0x400, %edx            # imm = 0x400
movq %rbp, %rsi
callq 0x3070
movb $0x0, 0x17137(%rbx)
jmp 0x4279d
movl $0x14, 0x19214(%rbx)
movl $0x14, %r15d
jmp 0x4279d
movw $0x1, 0x20(%r13)
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
movl $0x3a, %esi
callq 0x3130
movq %rax, %r15
leaq 0xfda9(%rip), %rsi      # 0x5256f
movl $0x5, %edx
movq %r12, %rdi
callq 0x3080
testl %eax, %eax
je 0x428b0
movq (%r14), %rbx
testq %r15, %r15
je 0x428f9
testq %rbx, %rbx
je 0x426b6
movq %r15, %rax
subq %r12, %rax
leaq 0x6(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq %r14, %r15
movq %rax, %r14
leaq 0x22(%rbx), %rbp
movl $0x6, %edx
movq %rbp, %rdi
leaq 0xfe54(%rip), %rsi      # 0x5266c
callq 0x3080
testl %eax, %eax
jne 0x42840
leaq 0x28(%rbx), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x3080
testl %eax, %eax
jne 0x42840
movq 0x8(%rsp), %rax
cmpb $0x0, (%rbp,%rax)
je 0x4288d
movl $0x5, %edx
movq %rbp, %rdi
leaq 0xfd20(%rip), %rsi      # 0x5256f
callq 0x3080
testl %eax, %eax
je 0x4289c
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x4289c
movq 0x18(%r13), %rsi
testq %rsi, %rsi
je 0x4289c
callq 0x3200
testl %eax, %eax
jg 0x426b9
jne 0x4289c
movq %rbp, %rdi
movq %r12, %rsi
callq 0x3200
testl %eax, %eax
jle 0x4289c
jmp 0x426b9
cmpq $0x0, 0x18(%r13)
jne 0x4289c
movq 0x18(%rbx), %rax
movq %rax, 0x18(%r13)
movq (%r15), %r15
movq (%r15), %rbx
testq %rbx, %rbx
jne 0x42805
jmp 0x426b9
leaq 0x5(%r12), %rbp
leaq 0xfcb3(%rip), %rbx      # 0x5256f
movq %r14, %r15
movq (%r14), %r14
testq %r14, %r14
je 0x426b9
leaq 0x22(%r14), %rdi
movl $0x5, %edx
movq %rbx, %rsi
callq 0x3080
testl %eax, %eax
jne 0x426b9
leaq 0x27(%r14), %rdi
movq %rbp, %rsi
callq 0x3200
testl %eax, %eax
jle 0x428bc
jmp 0x426b9
testq %rbx, %rbx
je 0x426b6
movq %r14, %r15
movq %rbx, %r14
leaq 0x22(%rbx), %rbp
movl $0x5, %edx
movq %rbp, %rdi
leaq 0xfc54(%rip), %rsi      # 0x5256f
callq 0x3080
testl %eax, %eax
je 0x42942
cmpq $0x0, 0x18(%r14)
jne 0x426b9
movq %rbp, %rdi
movq %r12, %rsi
callq 0x3200
testl %eax, %eax
jg 0x426b9
movq (%r14), %rbx
movq %r14, %r15
testq %rbx, %rbx
jne 0x42905
jmp 0x426b9
movq %rbp, %rdi
callq 0x3030
movq $0x0, 0x8(%r13)
leaq 0x18(%r13), %rax
movq %r14, %rbx
jmp 0x426de