// File: /workspace/github_c_makefile_star2_O0/wierton[P]socket-based-naive-game/server.c
// Function: client_command_send_message
int client_command_send_message(int uid) 
{
	client_message_t *pcm = &sessions[uid].cm;
	server_message_t sm;
	memset(&sm,0,sizeof(server_message_t));
	sm.message=SERVER_MESSAGE_FRIEND_MESSAGE;
	strncpy(sm.from_user,sessions[uid].user_name,USERNAME_SIZE);
	strncpy(sm.msg,pcm->message,MSG_SIZE);
	if(pcm->user_name[0]=='\0')
	{
		logi("user %d:%s yells at all users: %s\n", uid, sessions[uid].user_name, pcm->message);
		int i;
		for(i=0;i<USER_CNT;i++)
		{
			if(uid==i)continue;
			wrap_send(sessions[i].conn,&sm);
		}
	}
	else
	{
		int friend_id=find_uid_by_user_name(pcm->user_name);
		if(friend_id==-1||friend_id==uid)
		{
			logi("user %d:%s fails to speak to '%s':\"%s\"\n",uid,sessions[uid].user_name,pcm->user_name,pcm->message);
		}
		else
		{
			logi("uiser %d:%s speaks to %d:%s : \"%s\"\n",uid,sessions[uid].user_name,friend_id,pcm->user_name,pcm->message);
			wrap_send(sessions[friend_id].conn,&sm);
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movl %edi, -0x4(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x5e17(%rip), %rax      # 0xa220
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
addq $0x18, %rax
movq %rax, -0x10(%rbp)
leaq -0x1b3(%rbp), %rdi
xorl %esi, %esi
movl $0x1a3, %edx            # imm = 0x1A3
callq 0x10c0
movb $0x1b, -0x1b3(%rbp)
leaq -0x1b3(%rbp), %rdi
addq $0x1, %rdi
movslq -0x4(%rbp), %rax
leaq 0x5dd8(%rip), %rsi      # 0xa220
imulq $0x48, %rax, %rax
addq %rax, %rsi
movl $0x7, %edx
callq 0x1040
leaq -0x1b3(%rbp), %rdi
addq $0x1, %rdi
addq $0x7, %rdi
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
movl $0x28, %edx
callq 0x1040
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
jne 0x452b
movq 0x5b66(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
movl -0x4(%rbp), %r8d
movslq -0x4(%rbp), %rax
leaq 0x5d7c(%rip), %r9       # 0xa220
imulq $0x48, %rax, %rax
addq %rax, %r9
movq -0x10(%rbp), %rax
addq $0x8, %rax
leaq 0x2c17(%rip), %rsi      # 0x70d1
leaq 0x2c4f(%rip), %rdx      # 0x7110
movl $0x2eb, %ecx            # imm = 0x2EB
movq %rax, (%rsp)
movb $0x0, %al
callq 0x10f0
movl $0x0, -0x1b8(%rbp)
cmpl $0x5, -0x1b8(%rbp)
jge 0x4526
movl -0x4(%rbp), %eax
cmpl -0x1b8(%rbp), %eax
jne 0x44f1
jmp 0x4515
movslq -0x1b8(%rbp), %rcx
leaq 0x5d21(%rip), %rax      # 0xa220
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edi
leaq -0x1b3(%rbp), %rsi
callq 0x1560
movl -0x1b8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b8(%rbp)
jmp 0x44db
jmp 0x462f
movq -0x10(%rbp), %rdi
addq $0x1, %rdi
callq 0x1a80
movl %eax, -0x1bc(%rbp)
cmpl $-0x1, -0x1bc(%rbp)
je 0x4552
movl -0x1bc(%rbp), %eax
cmpl -0x4(%rbp), %eax
jne 0x45aa
movq 0x5a9f(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
movl -0x4(%rbp), %r8d
movslq -0x4(%rbp), %rax
leaq 0x5cb5(%rip), %r9       # 0xa220
imulq $0x48, %rax, %rax
addq %rax, %r9
movq -0x10(%rbp), %r10
addq $0x1, %r10
movq -0x10(%rbp), %rax
addq $0x8, %rax
leaq 0x2ba3(%rip), %rsi      # 0x712c
leaq 0x2b80(%rip), %rdx      # 0x7110
movl $0x2f8, %ecx            # imm = 0x2F8
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x10f0
jmp 0x462d
movq 0x5a47(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
movl -0x4(%rbp), %r8d
movslq -0x4(%rbp), %rax
leaq 0x5c5d(%rip), %r9       # 0xa220
imulq $0x48, %rax, %rax
addq %rax, %r9
movl -0x1bc(%rbp), %r11d
movq -0x10(%rbp), %r10
addq $0x1, %r10
movq -0x10(%rbp), %rax
addq $0x8, %rax
leaq 0x2b88(%rip), %rsi      # 0x7170
leaq 0x2b21(%rip), %rdx      # 0x7110
movl $0x2fc, %ecx            # imm = 0x2FC
movl %r11d, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x0, %al
callq 0x10f0
movslq -0x1bc(%rbp), %rcx
leaq 0x5c09(%rip), %rax      # 0xa220
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edi
leaq -0x1b3(%rbp), %rsi
callq 0x1560
jmp 0x462f
xorl %eax, %eax
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
nopw (%rax,%rax)