// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x294ef
movl $0x0, -0x4(%rbp)
jmp 0x29a09
movq -0x10(%rbp), %rax
movq 0x1e5e0(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x2952c
movq -0x30(%rbp), %rdi
addq $0x2a, %rdi
movq -0x18(%rbp), %rsi
callq 0x3200
cmpl $0x0, %eax
jne 0x2951d
jmp 0x2952c
jmp 0x2951f
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x294fe
cmpq $0x0, -0x30(%rbp)
jne 0x29871
movq -0x18(%rbp), %rdi
callq 0x3100
movq %rax, %rdi
addq $0x30, %rdi
callq 0x3250
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x29570
movq -0x10(%rbp), %rax
movl $0x14, 0x1f274(%rax)
movl $0x14, -0x4(%rbp)
jmp 0x29a09
movq -0x30(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x10000, %eax          # imm = 0x10000
cmpl $0x0, %eax
je 0x29831
movq -0x10(%rbp), %rax
addq $0x1e5e0, %rax          # imm = 0x1E5E0
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movl $0x3a, %esi
callq 0x3130
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x10288(%rip), %rsi     # 0x39844
movl $0x5, %edx
callq 0x3070
cmpl $0x0, %eax
jne 0x2962f
jmp 0x295cd
movq -0x38(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2962a
movq -0x38(%rbp), %rax
movq (%rax), %rdi
addq $0x2a, %rdi
leaq 0x1025b(%rip), %rsi     # 0x39844
movl $0x5, %edx
callq 0x3070
cmpl $0x0, %eax
jne 0x29619
movq -0x38(%rbp), %rax
movq (%rax), %rdi
addq $0x2a, %rdi
addq $0x5, %rdi
movq -0x18(%rbp), %rsi
addq $0x5, %rsi
callq 0x3200
cmpl $0x0, %eax
jle 0x2961b
jmp 0x2962a
jmp 0x2961d
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x295cd
jmp 0x29816
cmpq $0x0, -0x40(%rbp)
jne 0x296a0
jmp 0x29638
movq -0x38(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2969b
movq -0x38(%rbp), %rax
movq (%rax), %rdi
addq $0x2a, %rdi
leaq 0x101f0(%rip), %rsi     # 0x39844
movl $0x5, %edx
callq 0x3070
cmpl $0x0, %eax
je 0x2968c
movq -0x38(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0x20(%rax)
jne 0x2968a
movq -0x38(%rbp), %rax
movq (%rax), %rdi
addq $0x2a, %rdi
movq -0x18(%rbp), %rsi
callq 0x3200
cmpl $0x0, %eax
jle 0x2968c
jmp 0x2969b
jmp 0x2968e
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x29638
jmp 0x29814
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x18(%rbp), %rax
subq %rax, %rdx
callq 0x28690
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x296d8
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x29775
movq -0x10(%rbp), %rax
movq 0x1e5e0(%rax), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x29773
movq -0x50(%rbp), %rdi
addq $0x2a, %rdi
leaq 0x10254(%rip), %rsi     # 0x39955
movl $0x6, %edx
callq 0x3070
cmpl $0x0, %eax
jne 0x29761
movq -0x50(%rbp), %rdi
addq $0x2a, %rdi
addq $0x6, %rdi
movq -0x18(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x18(%rbp), %rax
subq %rax, %rdx
callq 0x3070
cmpl $0x0, %eax
jne 0x29761
movq -0x50(%rbp), %rax
movq -0x40(%rbp), %rcx
addq $0x6, %rcx
movq -0x18(%rbp), %rdx
subq %rdx, %rcx
cmpb $0x0, 0x2a(%rax,%rcx)
jne 0x29761
movq -0x50(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x29773
jmp 0x29763
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x296e7
jmp 0x29775
jmp 0x29777
movq -0x38(%rbp), %rax
cmpq $0x0, (%rax)
je 0x29812
movq -0x38(%rbp), %rax
movq (%rax), %rdi
addq $0x2a, %rdi
leaq 0x100ad(%rip), %rsi     # 0x39844
movl $0x5, %edx
callq 0x3070
cmpl $0x0, %eax
je 0x29800
movq -0x38(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0x20(%rax)
je 0x29800
movq -0x30(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x29800
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rdi
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x3200
movl %eax, -0x54(%rbp)
cmpl $0x0, %eax
jg 0x297fe
cmpl $0x0, -0x54(%rbp)
jne 0x29800
movq -0x38(%rbp), %rax
movq (%rax), %rdi
addq $0x2a, %rdi
movq -0x18(%rbp), %rsi
callq 0x3200
cmpl $0x0, %eax
jle 0x29800
jmp 0x29812
jmp 0x29802
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x29777
jmp 0x29814
jmp 0x29816
movq -0x38(%rbp), %rax
movq (%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
jmp 0x29852
movq -0x10(%rbp), %rax
movq 0x1e5e0(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x1e5e0(%rax)
movq -0x30(%rbp), %rdi
addq $0x2a, %rdi
movq -0x18(%rbp), %rsi
callq 0x3080
movq -0x30(%rbp), %rax
movq $0x0, 0x10(%rax)
jmp 0x298e4
movq -0x30(%rbp), %rax
cmpw $0x0, 0x28(%rax)
je 0x29888
movl $0x0, -0x4(%rbp)
jmp 0x29a09
cmpq $0x0, -0x20(%rbp)
je 0x298e0
movq -0x30(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x298e0
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rdi
callq 0x3100
movq %rax, %rcx
movq -0x60(%rbp), %rax
cmpq %rcx, %rax
ja 0x298e0
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x3030
movq -0x30(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x20(%rax)
jmp 0x298e2
jmp 0x298e4
cmpq $0x0, -0x20(%rbp)
je 0x299f8
movq -0x30(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x29949
movq -0x20(%rbp), %rdi
callq 0x3100
movq %rax, %rcx
addq $0x1, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x3250
movq -0x30(%rbp), %rcx
movq %rax, 0x10(%rcx)
cmpq $0x0, %rax
jne 0x29947
movq -0x10(%rbp), %rax
movl $0x14, 0x1f274(%rax)
movl $0x14, -0x4(%rbp)
jmp 0x29a09
jmp 0x29949
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x3080
movq -0x30(%rbp), %rdi
addq $0x2a, %rdi
leaq 0xffec(%rip), %rsi      # 0x39955
movl $0x6, %edx
callq 0x3070
cmpl $0x0, %eax
jne 0x29988
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x30(%rbp), %rax
movw $0x2, 0x28(%rax)
movl -0x24(%rbp), %eax
movw %ax, %cx
movq -0x30(%rbp), %rax
movw %cx, 0x8(%rax)
movq -0x10(%rbp), %rax
movswl 0x1e5f2(%rax), %eax
cmpl $0xb, %eax
je 0x299f6
movq -0x18(%rbp), %rdi
leaq 0xffa1(%rip), %rsi      # 0x3995c
callq 0x3200
cmpl $0x0, %eax
jne 0x299f6
movq -0x10(%rbp), %rax
movw $0xa, 0x1e5f2(%rax)
movq -0x10(%rbp), %rdi
addq $0x1cd98, %rdi          # imm = 0x1CD98
movq -0x20(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x3060
movq -0x10(%rbp), %rax
movb $0x0, 0x1d197(%rax)
jmp 0x29a02
movq -0x30(%rbp), %rax
movw $0x1, 0x28(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)