// File: /workspace/github_c_makefile_star2_O1/hkshenSmart[P]ONVIF-discovery_cs/stdsoap2.c
// Function: soap_set_attr
SOAP_FMAC2
soap_set_attr(struct soap *soap, const char *name, const char *value, int flag)
{ 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
      { struct soap_nlist *np = soap_lookup_ns(soap, name, s - name);
        if (np)
          tp->ns = np->ns;
        else
        { struct soap_attribute *tq;
          for (tq = soap->attributes; tq; tq = tq->next)
          { if (!strncmp(tq->name, "xmlns:", 6) && !strncmp(tq->name + 6, name, s - name) && !tq->name[6 + s - name])
            { tp->ns = tq->ns;
              break;
            }
          }
        }
        for (; *tpp; tpp = &(*tpp)->next)
        { int k;
          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;
    tp->flag = flag;
#ifndef WITH_LEAN
    if (soap->event != SOAP_SEC_SIGN && !strcmp(name, "wsu:Id"))
    { soap->event = SOAP_SEC_BEGIN;
      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 $0x28, %rsp
xorl %ebp, %ebp
cmpb $0x2d, (%rsi)
je 0x1b952
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
movl %ecx, 0x14(%rsp)
leaq 0x1e5e0(%rdi), %rbx
movq %rbx, %r13
movq (%r13), %r13
testq %r13, %r13
je 0x1b817
leaq 0x2a(%r13), %rdi
movq %r12, %rsi
callq 0x31f0
testl %eax, %eax
jne 0x1b7ae
cmpw $0x0, 0x28(%r13)
jne 0x1b952
testq %r15, %r15
je 0x1b884
movq %r15, 0x8(%rsp)
movq 0x10(%r13), %r15
testq %r15, %r15
je 0x1b87f
movq 0x18(%r13), %rbx
movq 0x8(%rsp), %rdi
callq 0x3110
cmpq %rax, %rbx
ja 0x1b87f
movq %r15, %rdi
callq 0x3030
movq $0x0, 0x10(%r13)
leaq 0x20(%r13), %rax
jmp 0x1b878
movq %r12, %rdi
callq 0x3110
leaq 0x30(%rax), %rdi
callq 0x3240
testq %rax, %rax
je 0x1b939
movq %rax, %r13
movq %r15, 0x8(%rsp)
movq $0x0, 0x20(%rax)
testb $0x1, 0x6(%r14)
movq %r14, 0x20(%rsp)
jne 0x1b963
movq %rbx, %r14
movq (%r14), %rax
movq %rax, (%r13)
movq %r13, (%r14)
leaq 0x2a(%r13), %rdi
movq %r12, %rsi
callq 0x3080
movq %r13, %rax
addq $0x10, %rax
xorl %ebp, %ebp
movq 0x20(%rsp), %r14
movq $0x0, (%rax)
movq 0x8(%rsp), %r15
testq %r15, %r15
je 0x1b94b
cmpq $0x0, 0x10(%r13)
jne 0x1b8b6
movq %r15, %rdi
callq 0x3110
leaq 0x1(%rax), %rdi
movq %rdi, 0x18(%r13)
callq 0x3240
movq %rax, 0x10(%r13)
testq %rax, %rax
je 0x1b939
movq 0x10(%r13), %rdi
movq %r15, %rsi
callq 0x3080
leaq 0x2a(%r13), %rdi
leaq 0xac59(%rip), %rsi      # 0x26526
movl $0x6, %edx
callq 0x3070
testl %eax, %eax
jne 0x1b8e3
movq 0x10(%r13), %rax
movq %rax, 0x20(%r13)
movw $0x2, 0x28(%r13)
movl 0x14(%rsp), %eax
movw %ax, 0x8(%r13)
cmpw $0xb, 0x1e5f2(%r14)
je 0x1b952
leaq 0xac28(%rip), %rsi      # 0x2652d
movq %r12, %rdi
callq 0x31f0
testl %eax, %eax
jne 0x1b952
movw $0xa, 0x1e5f2(%r14)
leaq 0x1cd98(%r14), %rdi
movl $0x400, %edx            # imm = 0x400
movq %r15, %rsi
callq 0x3060
movb $0x0, 0x1d197(%r14)
jmp 0x1b952
movl $0x14, 0x1f274(%r14)
movl $0x14, %ebp
jmp 0x1b952
movw $0x1, 0x28(%r13)
movl %ebp, %eax
addq $0x28, %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 0xaa9b(%rip), %rsi      # 0x26415
movl $0x5, %edx
movq %r12, %rdi
callq 0x3070
testl %eax, %eax
je 0x1b9be
testq %r15, %r15
je 0x1ba07
subq %r12, %r15
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x1ae7b
testq %rax, %rax
je 0x1ba66
movq %rax, %rbp
addq $0x10, %rbp
movq (%rbp), %rax
movq %rax, 0x20(%r13)
jmp 0x1babe
leaq 0x5(%r12), %rbp
leaq 0xaa4b(%rip), %r15      # 0x26415
movq %rbx, %r14
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x1b854
leaq 0x2a(%rbx), %rdi
movl $0x5, %edx
movq %r15, %rsi
callq 0x3070
testl %eax, %eax
jne 0x1b854
leaq 0x2f(%rbx), %rdi
movq %rbp, %rsi
callq 0x31f0
testl %eax, %eax
jle 0x1b9ca
jmp 0x1b854
movq (%rbx), %rax
testq %rax, %rax
je 0x1b851
leaq 0xa9fb(%rip), %rbp      # 0x26415
movq %rbx, %r14
movq %rax, %rbx
leaq 0x2a(%rax), %r15
movl $0x5, %edx
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3070
testl %eax, %eax
je 0x1ba56
cmpq $0x0, 0x20(%rbx)
jne 0x1b854
movq %r15, %rdi
movq %r12, %rsi
callq 0x31f0
testl %eax, %eax
jg 0x1b854
movq (%rbx), %rax
movq %rbx, %r14
testq %rax, %rax
jne 0x1ba1d
jmp 0x1b854
movq (%rbx), %rbp
testq %rbp, %rbp
je 0x1babe
movq %r15, %r14
leaq 0x6(%r15), %rax
movq %rax, 0x18(%rsp)
leaq 0x2a(%rbp), %r15
movl $0x6, %edx
movq %r15, %rdi
leaq 0xaa99(%rip), %rsi      # 0x26526
callq 0x3070
testl %eax, %eax
jne 0x1bab5
leaq 0x30(%rbp), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x3070
testl %eax, %eax
jne 0x1bab5
movq 0x18(%rsp), %rax
cmpb $0x0, (%r15,%rax)
je 0x1bb33
movq (%rbp), %rbp
testq %rbp, %rbp
jne 0x1ba7a
movq (%rbx), %rax
testq %rax, %rax
je 0x1b851
leaq 0xa944(%rip), %r15      # 0x26415
movq %rbx, %r14
movq %rax, %rbx
leaq 0x2a(%rax), %rbp
movl $0x5, %edx
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3070
testl %eax, %eax
je 0x1bb23
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x1bb23
movq 0x20(%r13), %rsi
testq %rsi, %rsi
je 0x1bb23
callq 0x31f0
testl %eax, %eax
jg 0x1b854
jne 0x1bb23
movq %rbp, %rdi
movq %r12, %rsi
callq 0x31f0
testl %eax, %eax
jg 0x1b854
movq (%rbx), %rax
movq %rbx, %r14
testq %rax, %rax
jne 0x1bad1
jmp 0x1b854
addq $0x20, %rbp
jmp 0x1b9b1