// File: /workspace/github_c_makefile_star2_O0/liuhaotian[P]xmppsh/libstrophe/src/auth.c
// Function: handle_features
static int _handle_features(xmpp_conn_t * const conn,
			    xmpp_stanza_t * const stanza,
			    void * const userdata)
{
    xmpp_stanza_t *child, *mech;
    char *text;

    /* remove the handler that detects missing stream:features */
    xmpp_timed_handler_delete(conn, _handle_missing_features);

    /* check for TLS */
    if (!conn->secured) {
        child = xmpp_stanza_get_child_by_name(stanza, "starttls");
        if (child && (strcmp(xmpp_stanza_get_ns(child), XMPP_NS_TLS) == 0))
            conn->tls_support = 1;
    }

    /* check for SASL */
    child = xmpp_stanza_get_child_by_name(stanza, "mechanisms");
    if (child && (strcmp(xmpp_stanza_get_ns(child), XMPP_NS_SASL) == 0)) {
	for (mech = xmpp_stanza_get_children(child); mech; 
	     mech = xmpp_stanza_get_next(mech)) {
	    if (strcmp(xmpp_stanza_get_name(mech), "mechanism") == 0) {
		text = xmpp_stanza_get_text(mech);
		if (strcasecmp(text, "PLAIN") == 0)
		    conn->sasl_support |= SASL_MASK_PLAIN;
		else if (strcasecmp(text, "DIGEST-MD5") == 0)
		    conn->sasl_support |= SASL_MASK_DIGESTMD5;
		else if (strcasecmp(text, "ANONYMOUS") == 0)
		    conn->sasl_support |= SASL_MASK_ANONYMOUS;

		xmpp_free(conn->ctx, text);
	    }
	}
    }

    _auth(conn);
 
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x181(%rip), %rsi       # 0x3930
callq 0x7c20
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4c(%rax)
jne 0x3803
movq -0x10(%rbp), %rdi
leaq 0x10c84(%rip), %rsi     # 0x1444d
callq 0x12b40
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x3801
movq -0x20(%rbp), %rdi
callq 0x12a80
movq %rax, %rdi
leaq 0x10c6a(%rip), %rsi     # 0x14456
callq 0x22e0
cmpl $0x0, %eax
jne 0x3801
movq -0x8(%rbp), %rax
movl $0x1, 0x40(%rax)
jmp 0x3803
movq -0x10(%rbp), %rdi
leaq 0x10c68(%rip), %rsi     # 0x14476
callq 0x12b40
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x391e
movq -0x20(%rbp), %rdi
callq 0x12a80
movq %rax, %rdi
leaq 0x10c4c(%rip), %rsi     # 0x14481
callq 0x22e0
cmpl $0x0, %eax
jne 0x391e
movq -0x20(%rbp), %rdi
callq 0x12c20
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x391c
movq -0x28(%rbp), %rdi
callq 0x125d0
movq %rax, %rdi
leaq 0x10c34(%rip), %rsi     # 0x144a2
callq 0x22e0
cmpl $0x0, %eax
jne 0x3908
movq -0x28(%rbp), %rdi
callq 0x12c60
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x10c18(%rip), %rsi     # 0x144ac
callq 0x22d0
cmpl $0x0, %eax
jne 0x38ad
movq -0x8(%rbp), %rax
movl 0x48(%rax), %ecx
orl $0x1, %ecx
movl %ecx, 0x48(%rax)
jmp 0x38f7
movq -0x30(%rbp), %rdi
leaq 0x10bfa(%rip), %rsi     # 0x144b2
callq 0x22d0
cmpl $0x0, %eax
jne 0x38d1
movq -0x8(%rbp), %rax
movl 0x48(%rax), %ecx
orl $0x2, %ecx
movl %ecx, 0x48(%rax)
jmp 0x38f5
movq -0x30(%rbp), %rdi
leaq 0x10be1(%rip), %rsi     # 0x144bd
callq 0x22d0
cmpl $0x0, %eax
jne 0x38f3
movq -0x8(%rbp), %rax
movl 0x48(%rax), %ecx
orl $0x4, %ecx
movl %ecx, 0x48(%rax)
jmp 0x38f5
jmp 0x38f7
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x30(%rbp), %rsi
callq 0x66c0
jmp 0x390a
movq -0x28(%rbp), %rdi
callq 0x12c40
movq %rax, -0x28(%rbp)
jmp 0x3850
jmp 0x391e
movq -0x8(%rbp), %rdi
callq 0x3970
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
nop