// File: /workspace/github_c_makefile_star2_O0/liuhaotian[P]xmppsh/libstrophe/src/auth.c
// Function: handle_bind
static int _handle_bind(xmpp_conn_t * const conn,
			xmpp_stanza_t * const stanza,
			void * const userdata)
{
    char *type;
    xmpp_stanza_t *iq, *session;

    /* delete missing bind handler */
    xmpp_timed_handler_delete(conn, _handle_missing_bind);

    /* server has replied to bind request */
    type = xmpp_stanza_get_type(stanza);
    if (type && strcmp(type, "error") == 0) {
	xmpp_error(conn->ctx, "xmpp", "Binding failed.");
	xmpp_disconnect(conn);
    } else if (type && strcmp(type, "result") == 0) {
        xmpp_stanza_t *binding = xmpp_stanza_get_child_by_name(stanza, "bind");
	xmpp_debug(conn->ctx, "xmpp", "Bind successful.");

        if (binding) {
            xmpp_stanza_t *jid_stanza = xmpp_stanza_get_child_by_name(binding,
                                                                      "jid");
            if (jid_stanza) {
                conn->bound_jid = xmpp_stanza_get_text(jid_stanza);
            }
        }

	/* establish a session if required */
	if (conn->session_required) {
	    /* setup response handlers */
	    handler_add_id(conn, _handle_session, "_xmpp_session1", NULL);
	    handler_add_timed(conn, _handle_missing_session, 
			      SESSION_TIMEOUT, NULL);

	    /* send session request */
	    iq = xmpp_stanza_new(conn->ctx);
	    if (!iq) {
		disconnect_mem_error(conn);
		return 0;
	    }

	    xmpp_stanza_set_name(iq, "iq");
	    xmpp_stanza_set_type(iq, "set");
	    xmpp_stanza_set_id(iq, "_xmpp_session1");

	    session = xmpp_stanza_new(conn->ctx);
	    if (!session) {
		xmpp_stanza_release(iq);
		disconnect_mem_error(conn);
	    }

	    xmpp_stanza_set_name(session, "session");
	    xmpp_stanza_set_ns(session, XMPP_NS_SESSION);

	    xmpp_stanza_add_child(iq, session);
	    xmpp_stanza_release(session);

	    /* send session establishment request */
	    xmpp_send(conn, iq);
	    xmpp_stanza_release(iq);
	} else {
	    conn->authenticated = 1;
	   
	    /* call connection handler */
	    conn->conn_handler(conn, XMPP_CONN_CONNECT, 0, NULL, 
			       conn->userdata);
	}
    } else {
	xmpp_error(conn->ctx, "xmpp", "Server sent malformed bind reply.");
	xmpp_disconnect(conn);
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x271(%rip), %rsi       # 0x4dd0
callq 0x7c20
movq -0x18(%rbp), %rdi
callq 0x12ae0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x4bb8
movq -0x28(%rbp), %rdi
leaq 0x100a2(%rip), %rsi     # 0x14c25
callq 0x22e0
cmpl $0x0, %eax
jne 0x4bb8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xf4ad(%rip), %rsi      # 0x14049
leaq 0xfb07(%rip), %rdx      # 0x146aa
movb $0x0, %al
callq 0x68a0
movq -0x10(%rbp), %rdi
callq 0x5f10
jmp 0x4db9
cmpq $0x0, -0x28(%rbp)
je 0x4d91
movq -0x28(%rbp), %rdi
leaq 0xf45b(%rip), %rsi      # 0x14029
callq 0x22e0
cmpl $0x0, %eax
jne 0x4d91
movq -0x18(%rbp), %rdi
leaq 0xfa60(%rip), %rsi      # 0x14647
callq 0x12b40
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xf44a(%rip), %rsi      # 0x14049
leaq 0xfab4(%rip), %rdx      # 0x146ba
movb $0x0, %al
callq 0x6a80
cmpq $0x0, -0x40(%rbp)
je 0x4c48
movq -0x40(%rbp), %rdi
leaq 0xfaac(%rip), %rsi      # 0x146cb
callq 0x12b40
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x4c46
movq -0x48(%rbp), %rdi
callq 0x12c60
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x88(%rax)
jmp 0x4c48
movq -0x10(%rbp), %rax
cmpl $0x0, 0x54(%rax)
je 0x4d5f
movq -0x10(%rbp), %rdi
leaq 0x1af(%rip), %rsi       # 0x4e10
leaq 0xfa67(%rip), %rdx      # 0x146cf
xorl %eax, %eax
movl %eax, %ecx
callq 0x82a0
movq -0x10(%rbp), %rdi
leaq 0x2b4(%rip), %rsi       # 0x4f30
movl $0x3a98, %edx           # imm = 0x3A98
xorl %eax, %eax
movl %eax, %ecx
callq 0x80c0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x11cb0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x4cb7
movq -0x10(%rbp), %rdi
callq 0x13650
movl $0x0, -0x4(%rbp)
jmp 0x4dc0
movq -0x30(%rbp), %rdi
leaq 0xf364(%rip), %rsi      # 0x14026
callq 0x12550
movq -0x30(%rbp), %rdi
leaq 0x10158(%rip), %rsi     # 0x14e2a
callq 0x12e20
movq -0x30(%rbp), %rdi
leaq 0xf9ed(%rip), %rsi      # 0x146cf
callq 0x12df0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x11cb0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x4d11
movq -0x30(%rbp), %rdi
callq 0x11f80
movq -0x10(%rbp), %rdi
callq 0x13650
movq -0x38(%rbp), %rdi
leaq 0xf94c(%rip), %rsi      # 0x14668
callq 0x12550
movq -0x38(%rbp), %rdi
leaq 0xf920(%rip), %rsi      # 0x1464c
callq 0x12820
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x12850
movq -0x38(%rbp), %rdi
callq 0x11f80
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x6290
movq -0x30(%rbp), %rdi
callq 0x11f80
jmp 0x4d8f
movq -0x10(%rbp), %rax
movl $0x1, 0xd8(%rax)
movq -0x10(%rbp), %rax
movq 0xe0(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq 0xe8(%rcx), %r8
xorl %edx, %edx
xorl %ecx, %ecx
movl %edx, %esi
callq *%rax
jmp 0x4db7
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xf2a9(%rip), %rsi      # 0x14049
leaq 0xf937(%rip), %rdx      # 0x146de
movb $0x0, %al
callq 0x68a0
movq -0x10(%rbp), %rdi
callq 0x5f10
jmp 0x4db9
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)