// File: /workspace/github_c_makefile_star2_O0/liuhaotian[P]xmppsh/libstrophe/src/sasl.c
// Function: parse_digest_challenge
static hash_t *_parse_digest_challenge(xmpp_ctx_t *ctx, const char *msg)
{
    hash_t *result;
    unsigned char *text;
    char *key, *value;
    unsigned char *s, *t;

    text = base64_decode(ctx, msg, strlen(msg));
    if (text == NULL) {
	xmpp_error(ctx, "SASL", "couldn't Base64 decode challenge!");
	return NULL;
    }

    result = hash_new(ctx, 10, xmpp_free);
    if (result != NULL) {
	s = text;
	while (*s != '\0') {
	    /* skip any leading commas and spaces */
	    while ((*s == ',') || (*s == ' ')) s++;
	    /* accumulate a key ending at '=' */
	    t = s;
	    while ((*t != '=') && (*t != '\0')) t++;
	    if (*t == '\0') break; /* bad string */
	    key = _make_string(ctx, (char *)s, (t-s));
	    if (key == NULL) break;
            /* advance our start pointer past the key */
	    s = t + 1;
	    t = s;
	    /* if we see quotes, grab the string in between */
	    if ((*s == '\'') || (*s == '"')) {
		t++;
		while ((*t != *s) && (*t != '\0'))
		    t++;
		value = _make_string(ctx, (char *)s+1, (t-s-1));
		if (*t == *s) {
		    s = t + 1;
		} else {
		    s = t;
		}
	    /* otherwise, accumulate a value ending in ',' or '\0' */
	    } else {
		while ((*t != ',') && (*t != '\0')) t++;
		value = _make_string(ctx, (char *)s, (t-s));
		s = t;
	    }
	    if (value == NULL) {
		xmpp_free(ctx, key);
		break;
	    }
	    /* TODO: check for collisions per spec */
	    hash_add(result, key, value);
	    /* hash table now owns the value, free the key */
	    xmpp_free(ctx, key);
	}
    }
    xmpp_free(ctx, text);

    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
callq 0x2180
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
movl %eax, %edx
callq 0xbd60
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xb769
movq -0x10(%rbp), %rdi
leaq 0x9648(%rip), %rsi      # 0x14d96
leaq 0x96d9(%rip), %rdx      # 0x14e2e
movb $0x0, %al
callq 0x68a0
movq $0x0, -0x8(%rbp)
jmp 0xb9d4
movq -0x10(%rbp), %rdi
movl $0xa, %esi
leaq -0x50b9(%rip), %rdx     # 0x66c0
callq 0x85f0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xb9bf
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0xb9bd
jmp 0xb7a7
movq -0x40(%rbp), %rax
movzbl (%rax), %ecx
movb $0x1, %al
cmpl $0x2c, %ecx
movb %al, -0x59(%rbp)
je 0xb7c8
movq -0x40(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x20, %eax
sete %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
testb $0x1, %al
jne 0xb7d1
jmp 0xb7df
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0xb7a7
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x3d, %ecx
movb %al, -0x5a(%rbp)
je 0xb808
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x5a(%rbp)
movb -0x5a(%rbp), %al
testb $0x1, %al
jne 0xb811
jmp 0xb81f
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0xb7e7
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0xb830
jmp 0xb9bd
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rcx, %rax
movl %eax, %edx
callq 0xc1d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xb85a
jmp 0xb9bd
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x27, %eax
je 0xb88a
movq -0x40(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x22, %eax
jne 0xb924
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movzbl (%rax), %ecx
movq -0x40(%rbp), %rax
movzbl (%rax), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x5b(%rbp)
je 0xb8bd
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x5b(%rbp)
movb -0x5b(%rbp), %al
testb $0x1, %al
jne 0xb8c6
jmp 0xb8d4
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0xb896
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq $0x1, %rsi
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rcx, %rax
subq $0x1, %rax
movl %eax, %edx
callq 0xc1d0
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
movq -0x40(%rbp), %rcx
movzbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0xb91a
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0xb922
movq -0x48(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0xb984
jmp 0xb926
movq -0x48(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x2c, %ecx
movb %al, -0x5c(%rbp)
je 0xb947
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x5c(%rbp)
movb -0x5c(%rbp), %al
testb $0x1, %al
jne 0xb950
jmp 0xb95e
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0xb926
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rcx, %rax
movl %eax, %edx
callq 0xc1d0
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xb99a
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x66c0
jmp 0xb9bd
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x87e0
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x66c0
jmp 0xb795
jmp 0xb9bf
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x66c0
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nop