// File: /workspace/github_c_makefile_star2_O0/liuhaotian[P]xmppsh/libstrophe/src/sasl.c
// Function: add_key
static char *_add_key(xmpp_ctx_t *ctx, hash_t *table, const char *key, 
		      char *buf, int *len, int quote)
{
    int olen,nlen;
    int keylen, valuelen;
    const char *value, *qvalue;
    char *c;

    /* allocate a zero-length string if necessary */
    if (buf == NULL) {
	buf = xmpp_alloc(ctx, 1);
	buf[0] = '\0';
    }
    if (buf == NULL) return NULL;

    /* get current string length */
    olen = strlen(buf);
    value = hash_get(table, key);
    if (value == NULL) {
	xmpp_error(ctx, "SASL", "couldn't retrieve value for '%s'", key);
	value = "";
    }
    if (quote) {
	qvalue = _make_quoted(ctx, value);
    } else {
	qvalue = value;
    }
    /* added length is key + '=' + value */
    /*   (+ ',' if we're not the first entry   */
    keylen = strlen(key);
    valuelen = strlen(qvalue);
    nlen = (olen ? 1 : 0) + keylen + 1 + valuelen + 1;
    buf = xmpp_realloc(ctx, buf, olen+nlen);

    if (buf != NULL) {
	c = buf + olen;
	if (olen) *c++ = ',';
	memcpy(c, key, keylen); c += keylen;
	*c++ = '=';
	memcpy(c, qvalue, valuelen); c += valuelen;
	*c++ = '\0';
    }

    if (quote) xmpp_free(ctx, (char *)qvalue);

    return buf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xbac0
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x6680
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movb $0x0, (%rax)
cmpq $0x0, -0x28(%rbp)
jne 0xbad4
movq $0x0, -0x8(%rbp)
jmp 0xbc47
movq -0x28(%rbp), %rdi
callq 0x2180
movl %eax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x8a80
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0xbb20
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rcx
leaq 0x928f(%rip), %rsi      # 0x14d96
leaq 0x9342(%rip), %rdx      # 0x14e50
movb $0x0, %al
callq 0x68a0
leaq 0x856f(%rip), %rax      # 0x1408b
movq %rax, -0x50(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0xbb39
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0xc230
movq %rax, -0x58(%rbp)
jmp 0xbb41
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2180
movl %eax, -0x40(%rbp)
movq -0x58(%rbp), %rdi
callq 0x2180
movl %eax, -0x44(%rbp)
movl -0x38(%rbp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
addl -0x40(%rbp), %eax
addl $0x1, %eax
addl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x38(%rbp), %eax
addl -0x3c(%rbp), %eax
movslq %eax, %rdx
callq 0x6700
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xbc2c
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
cmpl $0x0, -0x38(%rbp)
je 0xbbc4
movq -0x60(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x60(%rbp)
movb $0x2c, (%rax)
movq -0x60(%rbp), %rdi
movq -0x20(%rbp), %rsi
movslq -0x40(%rbp), %rdx
callq 0x2050
movl -0x40(%rbp), %ecx
movq -0x60(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x60(%rbp)
movb $0x3d, (%rax)
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movslq -0x44(%rbp), %rdx
callq 0x2050
movl -0x44(%rbp), %ecx
movq -0x60(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x60(%rbp)
movb $0x0, (%rax)
cmpl $0x0, -0x34(%rbp)
je 0xbc3f
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x66c0
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)