// File: /workspace/github_c_makefile_star2_O3/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 0x995d(%rip), %rsi      # 0xc054
movq %r12, %rdi
callq 0xb62b
testq %rax, %rax
je 0x2875
leaq 0x9b8e(%rip), %rsi      # 0xc29d
movq %r12, %rdi
callq 0xb7c4
leaq 0xa3a2(%rip), %rsi      # 0xcac0
movq %rax, %rdi
callq 0x2270
testl %eax, %eax
je 0x2875
leaq 0x991f(%rip), %rsi      # 0xc054
movq %r12, %rdi
callq 0xb62b
movq %rax, %rdi
callq 0xb6d4
movq %rax, %r13
leaq 0x9a69(%rip), %rsi      # 0xc1b8
movq %r12, %rdi
callq 0xb7c4
leaq 0x98fb(%rip), %rdi      # 0xc059
movq %rax, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x2030
movq %r14, %rdi
callq 0xae64
movq %rax, %r15
leaq 0x98fa(%rip), %rsi      # 0xc077
movq %rax, %rdi
callq 0xb38a
movq %r12, %rdi
callq 0xb60d
testq %rax, %rax
je 0x279f
movq %r12, %rdi
callq 0xb60d
movq %rax, %rsi
jmp 0x27a6
leaq 0x98d9(%rip), %rsi      # 0xc07f
movq %r15, %rdi
callq 0xb7b5
leaq 0x9a03(%rip), %rsi      # 0xc1b8
movq %r12, %rdi
callq 0xb7c4
leaq 0x986c(%rip), %rsi      # 0xc030
movq %r15, %rdi
movq %rax, %rdx
callq 0xb474
movq %r14, %rdi
callq 0xae64
movq %rax, %r12
leaq 0x9873(%rip), %rsi      # 0xc054
movq %rax, %rdi
callq 0xb38a
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 0xae64
movq %rax, %r14
movq %rax, %rdi
movq %rbp, %rsi
callq 0xb51c
movq %r12, %rdi
movq %r14, %rsi
callq 0xb4f0
movq %r15, %rdi
movq %r12, %rsi
callq 0xb4f0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4b9d
movq %r15, %rdi
callq 0xb000
movq %rbp, %rdi
callq 0x20c0
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq