// File: /workspace/github_c_makefile_star2_O2/liuhaotian[P]xmppsh/libstrophe/examples/bot.c
// Function: message_handler
int message_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata)
{
	xmpp_stanza_t *reply, *body, *text;
	char *intext, *replytext;
	xmpp_ctx_t *ctx = (xmpp_ctx_t*)userdata;
	
	if(!xmpp_stanza_get_child_by_name(stanza, "body")) return 1;
	if(!strcmp(xmpp_stanza_get_attribute(stanza, "type"), "error")) return 1;
	
	intext = xmpp_stanza_get_text(xmpp_stanza_get_child_by_name(stanza, "body"));
	
	printf("Incoming message from %s: %s\n", xmpp_stanza_get_attribute(stanza, "from"), intext);
	
	reply = xmpp_stanza_new(ctx);
	xmpp_stanza_set_name(reply, "message");
	xmpp_stanza_set_type(reply, xmpp_stanza_get_type(stanza)?xmpp_stanza_get_type(stanza):"chat");
	xmpp_stanza_set_attribute(reply, "to", xmpp_stanza_get_attribute(stanza, "from"));
	
	body = xmpp_stanza_new(ctx);
	xmpp_stanza_set_name(body, "body");
	
	replytext = malloc(strlen(" to you too!") + strlen(intext) + 1);
	strcpy(replytext, intext);
	strcat(replytext, " to you too!");
	
	text = xmpp_stanza_new(ctx);
	xmpp_stanza_set_text(text, replytext);
	xmpp_stanza_add_child(body, text);
	xmpp_stanza_add_child(reply, body);
	
	xmpp_send(conn, reply);
	xmpp_stanza_release(reply);
	free(replytext);
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x9a3f(%rip), %rsi      # 0xc054
movq %r12, %rdi
callq 0xb27c
testq %rax, %rax
je 0x2793
leaq 0x9c70(%rip), %rsi      # 0xc29d
movq %r12, %rdi
callq 0xb404
leaq 0xa484(%rip), %rsi      # 0xcac0
movq %rax, %rdi
callq 0x2270
testl %eax, %eax
je 0x2793
leaq 0x9a01(%rip), %rsi      # 0xc054
movq %r12, %rdi
callq 0xb27c
movq %rax, %rdi
callq 0xb30e
movq %rax, %r13
leaq 0x9b4b(%rip), %rsi      # 0xc1b8
movq %r12, %rdi
callq 0xb404
leaq 0x99dd(%rip), %rdi      # 0xc059
movq %rax, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x2030
movq %r14, %rdi
callq 0xab14
movq %rax, %r15
leaq 0x99dc(%rip), %rsi      # 0xc077
movq %rax, %rdi
callq 0xafdd
movq %r12, %rdi
callq 0xb25e
testq %rax, %rax
je 0x26bd
movq %r12, %rdi
callq 0xb25e
movq %rax, %rsi
jmp 0x26c4
leaq 0x99bb(%rip), %rsi      # 0xc07f
movq %r15, %rdi
callq 0xb3f5
leaq 0x9ae5(%rip), %rsi      # 0xc1b8
movq %r12, %rdi
callq 0xb404
leaq 0x994e(%rip), %rsi      # 0xc030
movq %r15, %rdi
movq %rax, %rdx
callq 0xb0c6
movq %r14, %rdi
callq 0xab14
movq %rax, %r12
leaq 0x9955(%rip), %rsi      # 0xc054
movq %rax, %rdi
callq 0xafdd
movq %r13, %rdi
callq 0x2160
leaq 0xd(%rax), %rdi
callq 0x2280
movq %rax, %rbp
movq %rax, %rdi
movq %r13, %rsi
callq 0x2170
movq %rbp, %rdi
callq 0x2160
movabsq $0x20756f79206f7420, %rcx # imm = 0x20756F79206F7420
movq %rcx, (%rbp,%rax)
movabsq $0x216f6f7420756f, %rcx # imm = 0x216F6F7420756F
movq %rcx, 0x5(%rbp,%rax)
movq %r14, %rdi
callq 0xab14
movq %rax, %r14
movq %rax, %rdi
movq %rbp, %rsi
callq 0xb171
movq %r12, %rdi
movq %r14, %rsi
callq 0xb145
movq %r15, %rdi
movq %r12, %rsi
callq 0xb145
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4ae4
movq %r15, %rdi
callq 0xac80
movq %rbp, %rdi
callq 0x20c0
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq