LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: button_invite_user
int button_invite_user() {
	wlog("call button handler %s\n", __func__);
	/* send invitation */
	wlogi("ask friend's name\n");
	char *name = accept_input("invite who to your battle: ");
	wlogi("friend name '%s'\n", name);
	client_message_t cm;
	memset(&cm, 0, sizeof(client_message_t));
	cm.command = CLIENT_COMMAND_LAUNCH_BATTLE;
	strncpy(cm.user_name, name, USERNAME_SIZE - 1);
	wlogi("send `launch battle` and invitation to server\n");
	global_serv_message=-1;
	wrap_send(&cm);
	/* wait for server reply */
	do {
		if(global_serv_message == SERVER_RESPONSE_LAUNCH_BATTLE_SUCCESS
		|| global_serv_message == SERVER_RESPONSE_LAUNCH_BATTLE_FAIL)
			break;
	} while(1);
	wlog("wait until message=%s\n", server_message_s[global_serv_message]);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x38, %rsp
movq 0x6715(%rip), %rsi      # 0x9160
leaq 0x2646(%rip), %rdi      # 0x5098
leaq 0x281a(%rip), %rcx      # 0x5273
movl $0x104, %edx            # imm = 0x104
xorl %eax, %eax
callq 0x261e
movq 0x66f4(%rip), %rsi      # 0x9160
leaq 0x2813(%rip), %rdi      # 0x5286
movl $0x106, %edx            # imm = 0x106
xorl %eax, %eax
callq 0x261e
leaq 0x281e(%rip), %rdi      # 0x52a4
callq 0x26cd
movq %rax, %rbx
movq 0x66cb(%rip), %rsi      # 0x9160
leaq 0x2824(%rip), %rdi      # 0x52c0
movl $0x108, %edx            # imm = 0x108
movq %rax, %rcx
xorl %eax, %eax
callq 0x261e
xorps %xmm0, %xmm0
leaq -0x37(%rbp), %rdi
movups %xmm0, 0x1f(%rdi)
movups %xmm0, 0x16(%rdi)
movups %xmm0, 0x6(%rdi)
movb $0x6, -0x1(%rdi)
pushq $0x6
popq %rdx
movq %rbx, %rsi
callq 0x2050
movq 0x668c(%rip), %rsi      # 0x9160
leaq 0x2802(%rip), %rdi      # 0x52dd
movl $0x10d, %edx            # imm = 0x10D
xorl %eax, %eax
callq 0x261e
orl $-0x1, 0x667a(%rip)     # 0x9168
leaq -0x38(%rbp), %rdi
callq 0x23e8
movl 0x666b(%rip), %eax      # 0x9168
leal -0xd(%rax), %ecx
cmpl $0x2, %ecx
jae 0x2b33
movq 0x6654(%rip), %rsi      # 0x9160
leaq 0x5fed(%rip), %rcx      # 0x8b00
movq (%rcx,%rax,8), %rcx
leaq 0x265b(%rip), %rdi      # 0x5179
movl $0x116, %edx            # imm = 0x116
xorl %eax, %eax
callq 0x261e
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
jmp 0x2b33
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: button_join_battle
int button_join_battle() {
	wlog("call button handler %s\n", __func__);
	send_command(CLIENT_COMMAND_ACCEPT_BATTLE);
	user_state = USER_STATE_BATTLE;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x6620(%rip), %rsi      # 0x9160
leaq 0x2551(%rip), %rdi      # 0x5098
leaq 0x27c9(%rip), %rcx      # 0x5317
movl $0x11b, %edx            # imm = 0x11B
xorl %eax, %eax
callq 0x261e
pushq $0x8
popq %rdi
callq 0x246b
movl $0x3, 0x6600(%rip)      # 0x916c
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: button_logout
int button_logout() {
	wlog("call button handler %s\n", __func__);
	user_name = "<unknown>";
	user_state = USER_STATE_NOT_LOGIN;
	send_command(CLIENT_COMMAND_USER_LOGOUT);
	bottom_bar_output(0, "logout");
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x65e5(%rip), %rsi      # 0x9160
leaq 0x2516(%rip), %rdi      # 0x5098
leaq 0x27a1(%rip), %rcx      # 0x532a
movl $0x122, %edx            # imm = 0x122
xorl %eax, %eax
callq 0x261e
leaq 0x279c(%rip), %rax      # 0x5338
movq %rax, 0x65bd(%rip)      # 0x9160
movl $0x1, 0x65bf(%rip)      # 0x916c
pushq $0x3
popq %rdi
callq 0x246b
leaq 0x329e(%rip), %rsi      # 0x5e5a
xorl %edi, %edi
xorl %eax, %eax
callq 0x2702
pushq $-0x1
popq %rax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: disable_buffer
void disable_buffer() {
	struct termio tbuf;
	wrap_get_term_attr(&tbuf);

	tbuf.c_lflag &= ~ICANON;
	tbuf.c_cc[VMIN] = raw_termio.c_cc[VMIN];

	wrap_set_term_attr(&tbuf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
leaq -0x1a(%rbp), %rbx
movq %rbx, %rdi
callq 0x2bca
andb $-0x3, 0x6(%rbx)
movb 0x65f0(%rip), %al       # 0x9267
movb %al, 0xf(%rbx)
movq %rbx, %rdi
callq 0x2c11
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: enable_buffer
void enable_buffer() {
	struct termio tbuf;
	wrap_get_term_attr(&tbuf);

	tbuf.c_lflag |= ICANON;
	tbuf.c_cc[VMIN] = 60;

	wrap_set_term_attr(&tbuf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
leaq -0x1a(%rbp), %rbx
movq %rbx, %rdi
callq 0x2bca
orb $0x2, 0x6(%rbx)
movb $0x3c, 0xf(%rbx)
movq %rbx, %rdi
callq 0x2c11
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: echo_off
void echo_off() {
	struct termio tbuf;
	wrap_get_term_attr(&tbuf);

	tbuf.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL);

	wrap_set_term_attr(&tbuf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
leaq -0x1a(%rbp), %rbx
movq %rbx, %rdi
callq 0x2bca
andb $-0x79, 0x6(%rbx)
movq %rbx, %rdi
callq 0x2c11
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: echo_on
void echo_on() {
	struct termio tbuf;
	wrap_get_term_attr(&tbuf);

	tbuf.c_lflag |= (ECHO|ECHOE|ECHOK|ECHONL);

	wrap_set_term_attr(&tbuf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
leaq -0x1a(%rbp), %rbx
movq %rbx, %rdi
callq 0x2bca
orb $0x78, 0x6(%rbx)
movq %rbx, %rdi
callq 0x2c11
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: readline
char *readline() {
	char ch;
	int line_ptr = 0;
	char line[LINE_MAX_LEN];
	memset(line, 0, sizeof(line));
	lock_cursor();
	echo_off();
	disable_buffer();
	while((ch = fgetc(stdin)) != '\n') {
		switch(ch) {
			case '\033':{
				ch = fgetc(stdin);
				ch = fgetc(stdin);
				assert('A' <= ch && ch <= 'D');
				break;
			}
			case 0x7f: //handle backspace(sends delete)
				if(line_ptr==0)break;
				line[--line_ptr]='\0';
				fputc(ch,stdout);
				fflush(stdout);
				break;
			default: {
				if(line_ptr < sizeof(line) - 1
				&& 0x20 <= ch && ch < 0x80) {
					line[line_ptr ++] = ch;
					fputc(ch, stdout);
					fflush(stdout);
				}
			}
		}
	}
	line[line_ptr] = 0;
	unlock_cursor();
	return strdup(line);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
andl $0x0, -0x30(%rbp)
callq 0x2d71
callq 0x2cb5
callq 0x2c58
xorl %r13d, %r13d
movq 0x61dc(%rip), %rbx      # 0x8fd0
pushq $0x7f
popq %r14
movq 0x61c9(%rip), %r15      # 0x8fc8
movl %r13d, %r12d
movq (%rbx), %rdi
callq 0x20e0
movl %eax, %ecx
shll $0x18, %ecx
cmpl $0xa000000, %ecx        # imm = 0xA000000
je 0x2e91
movsbl %al, %edi
cmpl $0x1b, %edi
je 0x2e3a
cmpl $0x7f, %edi
je 0x2e57
cmpl $0x13, %r12d
setb %cl
cmpl $0x20, %edi
setge %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x2e02
jmp 0x2e6f
movq (%rbx), %rdi
callq 0x20e0
movq (%rbx), %rdi
callq 0x20e0
movsbl %al, %eax
addl $-0x41, %eax
cmpl $0x4, %eax
jb 0x2e02
jmp 0x2eb6
movl $0x0, %r13d
testl %r12d, %r12d
je 0x2dff
decl %r12d
movslq %r12d, %rcx
xorl %eax, %eax
movl %r14d, %edi
jmp 0x2e75
movl %r12d, %ecx
incl %r12d
movl %r12d, %r13d
movb %al, -0x40(%rbp,%rcx)
movq (%r15), %rsi
callq 0x2100
movq (%r15), %rdi
callq 0x2160
jmp 0x2dff
movslq %r12d, %rax
movb $0x0, -0x40(%rbp,%rax)
callq 0x2d82
leaq -0x40(%rbp), %rdi
callq 0x21f0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x258b(%rip), %rdi      # 0x5448
leaq 0x259b(%rip), %rsi      # 0x545f
leaq 0x259d(%rip), %rcx      # 0x5468
movl $0x1b1, %edx            # imm = 0x1B1
callq 0x20c0
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: sformat
char *sformat(const char *format, ...) {
	static char text[100];

	va_list ap;
	va_start(ap, format);
	int len = vsprintf(text, format, ap);
	va_end(ap);

	if(len >= sizeof(text))
		eprintf("buffer overflow\n");

	return text;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, %r10
leaq -0xd0(%rbp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x2f28
movaps %xmm0, -0xa0(%rbp)
movaps %xmm1, -0x90(%rbp)
movaps %xmm2, -0x80(%rbp)
movaps %xmm3, -0x70(%rbp)
movaps %xmm4, -0x60(%rbp)
movaps %xmm5, -0x50(%rbp)
movaps %xmm6, -0x40(%rbp)
movaps %xmm7, -0x30(%rbp)
leaq -0x20(%rbp), %rdx
movq %rdi, 0x10(%rdx)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rdx)
leaq 0x6324(%rip), %rdi      # 0x9270
movq %r10, %rsi
callq 0x2180
cmpl $0x64, %eax
jae 0x2f69
leaq 0x6310(%rip), %rax      # 0x9270
addq $0xd0, %rsp
popq %rbp
retq
movq 0x6080(%rip), %rax      # 0x8ff0
movq (%rax), %rdi
leaq 0x24ff(%rip), %rsi      # 0x5479
leaq 0x2523(%rip), %rdx      # 0x54a4
movl $0x1d2, %ecx            # imm = 0x1D2
xorl %eax, %eax
callq 0x2130
xorl %edi, %edi
callq 0x21d0
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: accept_yesno
int accept_yesno(const char *prompt) {
	while(1) {
		char *input = accept_input(prompt);
		strlwr(input);
		if(strcmp(input, "y") == 0
		|| strcmp(input, "yes") == 0) {
			return true;
		}else if(strcmp(input, "n") == 0
		|| strcmp(input, "no") == 0) {
			return false;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x1
popq %r12
leaq 0x2514(%rip), %r14      # 0x555e
movq %rbx, %rdi
callq 0x26cd
movq %rax, %r15
movq %rax, %rdi
callq 0x231c
movb (%r15), %r13b
cmpb $0x79, %r13b
jne 0x306d
cmpb $0x0, 0x1(%r15)
je 0x309b
movq %r15, %rdi
movq %r14, %rsi
callq 0x2120
testl %eax, %eax
je 0x309b
cmpb $0x6e, %r13b
jne 0x304a
xorl %eax, %eax
cmpb $0x0, 0x1(%r15)
je 0x309e
cmpb $0x6f, 0x1(%r15)
jne 0x304a
cmpb $0x0, 0x2(%r15)
jne 0x304a
jmp 0x309e
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: cmd_ulist
int cmd_ulist(char *args) {
	if(user_state==USER_STATE_NOT_LOGIN)
		bottom_bar_output(0,"Please login first!");
	else
		send_command(CLIENT_COMMAND_FETCH_ALL_USERS);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x1, 0x60a9(%rip)      # 0x916c
jne 0x30d7
leaq 0x24cd(%rip), %rsi      # 0x5599
xorl %edi, %edi
xorl %eax, %eax
callq 0x2702
jmp 0x30df
pushq $0x4
popq %rdi
callq 0x246b
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: cmd_invite
int cmd_invite(char *args) {
	if(user_state==USER_STATE_NOT_LOGIN)
	{
		bottom_bar_output(0,"Please login first!");
		return 0;
	}
	client_message_t cm;
	cm.command = CLIENT_COMMAND_INVITE_USER;
	strncpy(cm.user_name, args, USERNAME_SIZE - 1);
	wrap_send(&cm);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
cmpl $0x1, 0x607a(%rip)      # 0x916c
jne 0x3106
leaq 0x249e(%rip), %rsi      # 0x5599
xorl %edi, %edi
xorl %eax, %eax
callq 0x2702
jmp 0x3122
movq %rdi, %rsi
leaq -0x2f(%rbp), %rdi
movb $0xa, -0x1(%rdi)
pushq $0x6
popq %rdx
callq 0x2050
leaq -0x30(%rbp), %rdi
callq 0x23e8
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: cmd_yell
int cmd_yell(char *args)
{
	if(user_state==USER_STATE_NOT_LOGIN)
	{
		bottom_bar_output(0,"Please login first!");
		return 0;
	}
	char *msg=accept_input("Yell at all users: ");
	client_message_t cm;
	cm.command = CLIENT_COMMAND_SEND_MESSAGE;
	cm.user_name[0]='\0';
	strncpy(cm.message, msg, MSG_SIZE - 1);
	wrap_send(&cm);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
cmpl $0x1, 0x6033(%rip)      # 0x916c
jne 0x314d
leaq 0x2457(%rip), %rsi      # 0x5599
xorl %edi, %edi
xorl %eax, %eax
callq 0x2702
jmp 0x3177
leaq 0x2459(%rip), %rdi      # 0x55ad
callq 0x26cd
leaq -0x28(%rbp), %rdi
movw $0xb, -0x8(%rdi)
pushq $0x27
popq %rdx
movq %rax, %rsi
callq 0x2050
leaq -0x30(%rbp), %rdi
callq 0x23e8
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: cmd_tell
int cmd_tell(char *args)
{
	if(user_state==USER_STATE_NOT_LOGIN)
	{
		bottom_bar_output(0,"Please login first!");
		return 0;
	}
	if(!args)
	{
		bottom_bar_output(0, "Input a friend, or try \"yell\"");
		return 0;
	}
	char *msg=accept_input(sformat("Speak to %s: ",args));
	client_message_t cm;
	cm.command = CLIENT_COMMAND_SEND_MESSAGE;
	strncpy(cm.user_name, args, USERNAME_SIZE - 1);
	strncpy(cm.message, msg, MSG_SIZE - 1);
	wrap_send(&cm);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
cmpl $0x1, 0x5fdb(%rip)      # 0x916c
jne 0x319c
leaq 0x23ff(%rip), %rsi      # 0x5599
jmp 0x31f8
movq %rdi, %rbx
testq %rdi, %rdi
je 0x31f1
leaq 0x2434(%rip), %rdi      # 0x55df
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2ed5
leaq 0x60b4(%rip), %rdi      # 0x9270
callq 0x26cd
movq %rax, %r14
leaq -0x3f(%rbp), %rdi
movb $0xb, -0x1(%rdi)
pushq $0x6
popq %rdx
movq %rbx, %rsi
callq 0x2050
leaq -0x38(%rbp), %rdi
pushq $0x27
popq %rdx
movq %r14, %rsi
callq 0x2050
leaq -0x40(%rbp), %rdi
callq 0x23e8
jmp 0x3201
leaq 0x23c9(%rip), %rsi      # 0x55c1
xorl %edi, %edi
xorl %eax, %eax
callq 0x2702
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: cmd_help
int cmd_help(char *args) {
	if(args) {
		if(strcmp(args, "--list") == 0) {
			bottom_bar_output(0, "quit, help, ulist, invite, yell, tell");
		}else if(strcmp(args, "quit") == 0) {
			bottom_bar_output(0, "quit the game and return terminal");
		}else if(strcmp(args, "ulist") == 0) {
			bottom_bar_output(0, "list all online friends");
		}else if(strcmp(args, "invite") == 0) {
			bottom_bar_output(0, "invite friend to your battle(need args)");
		}else if(strcmp(args, "yell") == 0) {
			bottom_bar_output(0, "send message to all friends");
		}else if(strcmp(args, "tell") == 0) {
			bottom_bar_output(0, "send message to one friend(need args)");
		}else{
			bottom_bar_output(0, "no help for '%s'", args);
		}
	}else{
		bottom_bar_output(0, "usage: help [--list|command]");
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x32a2
movq %rdi, %rbx
leaq 0x23c8(%rip), %rsi      # 0x55ed
callq 0x2120
testl %eax, %eax
je 0x32ab
leaq 0x23e5(%rip), %rsi      # 0x561a
movq %rbx, %rdi
callq 0x2120
testl %eax, %eax
je 0x32b4
leaq 0x23f9(%rip), %rsi      # 0x5641
movq %rbx, %rdi
callq 0x2120
testl %eax, %eax
je 0x32bd
leaq 0x2404(%rip), %rsi      # 0x565f
movq %rbx, %rdi
callq 0x2120
testl %eax, %eax
je 0x32c6
leaq 0x2420(%rip), %rsi      # 0x568e
movq %rbx, %rdi
callq 0x2120
testl %eax, %eax
je 0x32cf
leaq 0x2394(%rip), %rsi      # 0x5615
movq %rbx, %rdi
callq 0x2120
testl %eax, %eax
je 0x32d8
leaq 0x2441(%rip), %rsi      # 0x56d5
xorl %edi, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2702
jmp 0x32e8
leaq 0x243d(%rip), %rsi      # 0x56e6
jmp 0x32df
leaq 0x2342(%rip), %rsi      # 0x55f4
jmp 0x32df
leaq 0x2364(%rip), %rsi      # 0x561f
jmp 0x32df
leaq 0x2383(%rip), %rsi      # 0x5647
jmp 0x32df
leaq 0x2399(%rip), %rsi      # 0x5666
jmp 0x32df
leaq 0x23bd(%rip), %rsi      # 0x5693
jmp 0x32df
leaq 0x23d0(%rip), %rsi      # 0x56af
xorl %edi, %edi
xorl %eax, %eax
callq 0x2702
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: read_and_execute_command
void read_and_execute_command() {
	char *command = accept_input("command: ");
	wlog("accept command: '%s'\n", command);
	strtok(command, " \t");
	char *args = strtok(NULL, " \t");

	for(int i = 0; i < NR_HANDLER; i++) {
		if(strcmp(command, command_handler[i].cmd) == 0) {
			command_handler[i].func(args);
			return;
		}
	}

	if(strlen(command) > 0) {
		bottom_bar_output(0, "invalid command '%s'", command);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x2400(%rip), %rdi      # 0x5703
callq 0x26cd
movq %rax, %rbx
movq 0x5e4e(%rip), %rsi      # 0x9160
leaq 0x23f4(%rip), %rdi      # 0x570d
xorl %r15d, %r15d
movl $0x291, %edx            # imm = 0x291
movq %rax, %rcx
xorl %eax, %eax
callq 0x261e
leaq 0x23f8(%rip), %r14      # 0x572a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x21a0
xorl %edi, %edi
movq %r14, %rsi
callq 0x21a0
movq %rax, %r14
leaq 0x58ff(%rip), %r12      # 0x8c50
leaq 0x10(%r15), %rcx
cmpq $0x70, %rcx
je 0x3383
movq (%r15,%r12), %rsi
movq %rbx, %rdi
movq %rcx, %r15
callq 0x2120
testl %eax, %eax
jne 0x3351
movq %r15, %rcx
movq %r14, %rdi
movq %r12, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmpq *-0x8(%rcx,%rax)
cmpb $0x0, (%rbx)
je 0x33a3
leaq 0x239e(%rip), %rsi      # 0x572d
xorl %edi, %edi
movq %rbx, %rdx
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2702
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: flip_screen
void flip_screen() {
	lock_cursor();
	set_cursor(0, SCR_H);
	printf("\033[2J");
	unlock_cursor();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
callq 0x2d71
pushq $0x12
popq %rsi
xorl %edi, %edi
callq 0x2d05
leaq 0x237c(%rip), %rdi      # 0x5742
xorl %eax, %eax
callq 0x20b0
popq %rbp
jmp 0x2d82
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: draw_button
void draw_button(uint32_t button_id) {
	int x = buttons[button_id].pos.x;
	int y = buttons[button_id].pos.y;
	const char *s = buttons[button_id].s;
	int len = strlen(s);
	lock_cursor();
	set_cursor(x, y);
	printf("┌");
	for(int i = 0; i < len; i++)
		printf("─");
	printf("┐");
	set_cursor(x, y + 1);
	printf("│");
	printf("%s", s);
	printf("│");
	set_cursor(x, y + 2);
	printf("└");
	for(int i = 0; i < len; i++)
		printf("─");
	printf("┘");
	unlock_cursor();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %eax
imulq $0x18, %rax, %rax
leaq 0x5d82(%rip), %rcx      # 0x9170
movzbl (%rax,%rcx), %ebx
movzbl 0x1(%rax,%rcx), %r14d
movq 0x8(%rax,%rcx), %rdi
movq %rdi, -0x30(%rbp)
callq 0x2080
movq %rax, %r12
callq 0x2d71
movl %ebx, %edi
movl %r14d, %esi
callq 0x2d05
leaq 0x2328(%rip), %rdi      # 0x5747
xorl %eax, %eax
callq 0x20b0
testl %r12d, %r12d
movl $0x0, %r15d
cmovgl %r12d, %r15d
leaq 0x2311(%rip), %r12      # 0x574b
movl %r15d, %r13d
subl $0x1, %r13d
jb 0x344f
movq %r12, %rdi
xorl %eax, %eax
callq 0x20b0
jmp 0x343d
leaq 0x22f9(%rip), %rdi      # 0x574f
xorl %eax, %eax
callq 0x20b0
leal 0x1(%r14), %esi
movl %ebx, %edi
callq 0x2d05
leaq 0x22e4(%rip), %r12      # 0x5753
movq %r12, %rdi
xorl %eax, %eax
callq 0x20b0
leaq 0x2886(%rip), %rdi      # 0x5d06
movq -0x30(%rbp), %rsi
xorl %eax, %eax
callq 0x20b0
movq %r12, %rdi
xorl %eax, %eax
callq 0x20b0
addl $0x2, %r14d
movl %ebx, %edi
movl %r14d, %esi
callq 0x2d05
leaq 0x22ad(%rip), %rdi      # 0x5757
xorl %eax, %eax
callq 0x20b0
leaq 0x2293(%rip), %rbx      # 0x574b
subl $0x1, %r15d
jb 0x34ca
movq %rbx, %rdi
xorl %eax, %eax
callq 0x20b0
jmp 0x34b8
leaq 0x228a(%rip), %rdi      # 0x575b
xorl %eax, %eax
callq 0x20b0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2d82
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: draw_selected_button
void draw_selected_button(uint32_t button_id) {
	int x = buttons[button_id].pos.x;
	int y = buttons[button_id].pos.y;
	const char *s = buttons[button_id].s;
	int len = strlen(s);
	lock_cursor();
	set_cursor(x, y);
	printf("\033[1m");
	printf("┏");
	for(int i = 0; i < len; i++)
		printf("━");
	printf("┓");
	set_cursor(x, y + 1);
	printf("┃");
	printf("%s", s);
	printf("┃");
	set_cursor(x, y + 2);
	printf("┗");
	for(int i = 0; i < len; i++)
		printf("━");
	printf("┛");
	printf("\033[0m");
	unlock_cursor();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %eax
imulq $0x18, %rax, %rax
leaq 0x5c6a(%rip), %rcx      # 0x9170
movzbl (%rax,%rcx), %ebx
movzbl 0x1(%rax,%rcx), %r14d
movq 0x8(%rax,%rcx), %rdi
movq %rdi, -0x30(%rbp)
callq 0x2080
movq %rax, %r12
callq 0x2d71
movl %ebx, %edi
movl %r14d, %esi
callq 0x2d05
leaq 0x2228(%rip), %rdi      # 0x575f
xorl %eax, %eax
callq 0x20b0
leaq 0x221f(%rip), %rdi      # 0x5764
xorl %eax, %eax
callq 0x20b0
testl %r12d, %r12d
movl $0x0, %r15d
cmovgl %r12d, %r15d
leaq 0x2208(%rip), %r12      # 0x5768
movl %r15d, %r13d
subl $0x1, %r13d
jb 0x3575
movq %r12, %rdi
xorl %eax, %eax
callq 0x20b0
jmp 0x3563
leaq 0x21f0(%rip), %rdi      # 0x576c
xorl %eax, %eax
callq 0x20b0
leal 0x1(%r14), %esi
movl %ebx, %edi
callq 0x2d05
leaq 0x21db(%rip), %r12      # 0x5770
movq %r12, %rdi
xorl %eax, %eax
callq 0x20b0
leaq 0x2760(%rip), %rdi      # 0x5d06
movq -0x30(%rbp), %rsi
xorl %eax, %eax
callq 0x20b0
movq %r12, %rdi
xorl %eax, %eax
callq 0x20b0
addl $0x2, %r14d
movl %ebx, %edi
movl %r14d, %esi
callq 0x2d05
leaq 0x21a4(%rip), %rdi      # 0x5774
xorl %eax, %eax
callq 0x20b0
leaq 0x218a(%rip), %rbx      # 0x5768
subl $0x1, %r15d
jb 0x35f0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x20b0
jmp 0x35de
leaq 0x2181(%rip), %rdi      # 0x5778
xorl %eax, %eax
callq 0x20b0
leaq 0x2177(%rip), %rdi      # 0x577c
xorl %eax, %eax
callq 0x20b0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2d82
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: run_battle
void run_battle() {
	wlog("run battle\n");
	flip_screen();
	bottom_bar_output(0,"type <TAB> to enter command mode and invite more friends\n");
	echo_off();
	disable_buffer();
	while(user_state == USER_STATE_BATTLE) {
		int ch = fgetc(stdin);
		if(ch == 'q') {
			wlog("type q and quit battle\n");
			user_state = USER_STATE_LOGIN;
			send_command(CLIENT_COMMAND_QUIT_BATTLE);
			send_command(CLIENT_COMMAND_FETCH_ALL_FRIENDS);
			break;
		}else if(ch == '\t') {
			wlog("type <TAB> and enter command mode\n");
			read_and_execute_command();
		}

		switch(ch) {
			case 'w':send_command(CLIENT_COMMAND_MOVE_UP);break;
			case 's':send_command(CLIENT_COMMAND_MOVE_DOWN);break;
			case 'a':send_command(CLIENT_COMMAND_MOVE_LEFT);break;
			case 'd':send_command(CLIENT_COMMAND_MOVE_RIGHT);break;
			case ' ':send_command(CLIENT_COMMAND_FIRE);break;
		}
	}

	flip_screen();
	wlog("exit run_battle\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x58b1(%rip), %rsi      # 0x9160
leaq 0x1ed6(%rip), %rdi      # 0x578c
movl $0x311, %edx            # imm = 0x311
xorl %eax, %eax
callq 0x261e
callq 0x33ac
leaq 0x1ed1(%rip), %rsi      # 0x579f
xorl %edi, %edi
xorl %eax, %eax
callq 0x2702
callq 0x2cb5
callq 0x2c58
cmpl $0x3, 0x5884(%rip)      # 0x916c
jne 0x39ac
movq 0x56db(%rip), %r14      # 0x8fd0
pushq $0xe
popq %r15
pushq $0xf
popq %r12
pushq $0xd
popq %r13
pushq $0xc
popq %rbx
movq (%r14), %rdi
callq 0x20e0
cmpl $0x9, %eax
je 0x3957
cmpl $0x20, %eax
je 0x3944
cmpl $0x61, %eax
je 0x3931
cmpl $0x64, %eax
je 0x393b
cmpl $0x73, %eax
je 0x3936
cmpl $0x77, %eax
je 0x3940
cmpl $0x71, %eax
jne 0x394c
jmp 0x3978
movl %r15d, %edi
jmp 0x3947
movl %r13d, %edi
jmp 0x3947
movl %r12d, %edi
jmp 0x3947
movl %ebx, %edi
jmp 0x3947
pushq $0x10
popq %rdi
callq 0x246b
cmpl $0x3, 0x5819(%rip)      # 0x916c
je 0x3904
jmp 0x39ac
movq 0x5802(%rip), %rsi      # 0x9160
leaq 0x1e93(%rip), %rdi      # 0x57f8
movl $0x31f, %edx            # imm = 0x31F
xorl %eax, %eax
callq 0x261e
callq 0x32f1
jmp 0x394c
movq 0x57e1(%rip), %rsi      # 0x9160
leaq 0x1e53(%rip), %rdi      # 0x57d9
movl $0x319, %edx            # imm = 0x319
xorl %eax, %eax
callq 0x261e
movl $0x2, 0x57d0(%rip)      # 0x916c
pushq $0x7
popq %rdi
callq 0x246b
pushq $0x5
popq %rdi
callq 0x246b
callq 0x33ac
movq 0x57a8(%rip), %rsi      # 0x9160
leaq 0x1e63(%rip), %rdi      # 0x5822
movl $0x32d, %edx            # imm = 0x32D
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x261e
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: switch_selected_button_respond_to_key
int switch_selected_button_respond_to_key(int st, int ed) {
	int sel = st - 1;
	int old_sel = sel;

	if(st >= ed) return st;

	echo_off();
	disable_buffer();
	wlog("enter select button, [%d, %d)\n", st, ed);
	while(1) {
		int ch = fgetc(stdin);
		wlog("capture key '%c' in button ui\n", ch);
		switch(ch) {
			case 'a':
			case 'w':
				sel --;
				if(sel < st) sel = ed - 1;
				break;
			case 's':
			case 'd':
				sel ++;
				if(sel >= ed) sel = st;
				break;
			case '\t':
				wlog("sel_menu enter command mode\n");
				read_and_execute_command();
				sel = st;
				break;
		}

		if(ch == '\n') {
			if(st <= sel && sel < ed) {
				break;
			}else{
				sel = st;
			}
		}

		if(st <= old_sel && old_sel < ed) {
			draw_button(old_sel);
		}

		if(st <= sel && sel < ed)
			draw_selected_button(sel);
		old_sel = sel;
	}

	echo_on();
	wlogi("return sel: %d\n", sel);
	return sel;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
cmpl %esi, %edi
jge 0x3b08
movl %esi, %r13d
leal -0x1(%rbx), %r15d
callq 0x2cb5
callq 0x2c58
movq 0x5757(%rip), %rsi      # 0x9160
leaq 0x1e2a(%rip), %rdi      # 0x583a
movl $0x338, %edx            # imm = 0x338
movl %ebx, %ecx
movl %r13d, %r8d
xorl %eax, %eax
callq 0x261e
movq 0x55a8(%rip), %rax      # 0x8fd0
movq (%rax), %rdi
callq 0x20e0
movl %eax, %r12d
movq 0x5726(%rip), %rsi      # 0x9160
leaq 0x1e1f(%rip), %rdi      # 0x5860
movl $0x33b, %edx            # imm = 0x33B
movl %eax, %ecx
xorl %eax, %eax
callq 0x261e
cmpl $0x9, %r12d
je 0x3aa7
cmpl $0xa, %r12d
je 0x3a92
cmpl $0x77, %r12d
je 0x3a76
cmpl $0x64, %r12d
je 0x3a85
cmpl $0x73, %r12d
je 0x3a85
movl %r15d, %r14d
cmpl $0x61, %r12d
jne 0x3ac9
cmpl %ebx, %r15d
movl %r13d, %r14d
cmovgl %r15d, %r14d
decl %r14d
jmp 0x3ac9
leal 0x1(%r15), %r14d
cmpl %r13d, %r14d
cmovgel %ebx, %r14d
jmp 0x3ac9
cmpl %ebx, %r15d
setge %al
cmpl %r13d, %r15d
setl %cl
movl %ebx, %r14d
testb %cl, %al
je 0x3ac9
jmp 0x3b0d
movq 0x56b2(%rip), %rsi      # 0x9160
leaq 0x1dd1(%rip), %rdi      # 0x5886
movl $0x348, %edx            # imm = 0x348
xorl %eax, %eax
callq 0x261e
callq 0x32f1
movl %ebx, %r14d
cmpl %ebx, %r15d
setl %al
cmpl %r13d, %r15d
setge %cl
orb %al, %cl
jne 0x3ae1
movl %r15d, %edi
callq 0x33d3
cmpl %ebx, %r14d
setl %al
cmpl %r13d, %r14d
setge %cl
orb %al, %cl
movl %r14d, %r15d
jne 0x3a21
movl %r14d, %edi
callq 0x34eb
movl %r14d, %r15d
jmp 0x3a21
movl %ebx, %r15d
jmp 0x3b2f
callq 0x2cdd
movq 0x5647(%rip), %rsi      # 0x9160
leaq 0x1d8a(%rip), %rdi      # 0x58aa
movl $0x360, %edx            # imm = 0x360
movl %r15d, %ecx
xorl %eax, %eax
callq 0x261e
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: draw_button_in_main_ui
void draw_button_in_main_ui() {
	draw_button(buttonLaunchBattle);
	draw_button(buttonInviteUser);
	draw_button(buttonJoinBattle);
	draw_button(buttonLogout);
	draw_catalog(&friend_list);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq $0x3
popq %rdi
callq 0x33d3
pushq $0x4
popq %rdi
callq 0x33d3
pushq $0x5
popq %rdi
callq 0x33d3
pushq $0x6
popq %rdi
callq 0x33d3
leaq 0x55b4(%rip), %rdi      # 0x9120
popq %rbp
jmp 0x361f
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: main_ui
void main_ui() {
	flip_screen();
	while(1) {
		draw_button_in_main_ui();
		display_user_state();
		int sel = switch_selected_button_respond_to_key(3, 7);
		wlog("user select %d\n", sel);

		int ret_code = buttons[sel].button_func();
		wlog("button handler return %d\n", ret_code);

		if(ret_code < 0 || user_state == USER_STATE_NOT_LOGIN) {
			flip_screen();
			wlog("quit main ui with user_state:%d\n", user_state);
			break;
		}

		if(user_state == USER_STATE_BATTLE) {
			wlog("enter battle mode\n");
			run_battle();
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x33ac
pushq $0x7
popq %r14
leaq 0x1d35(%rip), %r15      # 0x58c5
leaq 0x55d9(%rip), %rbx      # 0x9170
leaq 0x1d3e(%rip), %r12      # 0x58dc
callq 0x3b41
callq 0x2f94
pushq $0x3
popq %rdi
movl %r14d, %esi
callq 0x39d9
movl %eax, %r13d
movq 0x55a3(%rip), %rsi      # 0x9160
movq %r15, %rdi
movl $0x372, %edx            # imm = 0x372
movl %eax, %ecx
xorl %eax, %eax
callq 0x261e
movslq %r13d, %rax
imulq $0x18, %rax, %rcx
xorl %eax, %eax
callq *0x10(%rcx,%rbx)
movl %eax, %r13d
movq 0x557b(%rip), %rsi      # 0x9160
movq %r12, %rdi
movl $0x375, %edx            # imm = 0x375
movl %eax, %ecx
xorl %eax, %eax
callq 0x261e
testl %r13d, %r13d
js 0x3c2f
movl 0x556b(%rip), %eax      # 0x916c
cmpl $0x1, %eax
je 0x3c2f
cmpl $0x3, %eax
jne 0x3b9e
movq 0x554e(%rip), %rsi      # 0x9160
leaq 0x1d0c(%rip), %rdi      # 0x5925
movl $0x37e, %edx            # imm = 0x37E
xorl %eax, %eax
callq 0x261e
callq 0x389a
jmp 0x3b9e
callq 0x33ac
movq 0x5525(%rip), %rsi      # 0x9160
movl 0x552b(%rip), %ecx      # 0x916c
leaq 0x1cb5(%rip), %rdi      # 0x58fd
movl $0x379, %edx            # imm = 0x379
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x261e
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: start_ui
void start_ui() {
	wlog("enter start ui\n");
	bottom_bar_output(0, "type w s a d to switch button, type <TAB> to enter command");
	while(1) {
		draw_button_in_start_ui();
		display_user_state();
		int sel = switch_selected_button_respond_to_key(0, 3);
		wlog("user select %d@%s\n", sel, buttons[sel].s);
		buttons[sel].button_func();

		if(user_state == USER_STATE_LOGIN) {
			wlog("user state changed into LOGIN\n");
			wlog("enter main ui\n");
			main_ui();
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x54cd(%rip), %rsi      # 0x9160
leaq 0x1ca5(%rip), %rdi      # 0x593f
movl $0x38b, %edx            # imm = 0x38B
xorl %eax, %eax
callq 0x261e
leaq 0x1ca9(%rip), %rsi      # 0x5956
xorl %edi, %edi
xorl %eax, %eax
callq 0x2702
pushq $0x3
popq %rbx
leaq 0x54b0(%rip), %r13      # 0x9170
leaq 0x1cca(%rip), %r14      # 0x5991
leaq 0x1d03(%rip), %r12      # 0x59d1
callq 0x3c62
callq 0x2f94
xorl %edi, %edi
movl %ebx, %esi
callq 0x39d9
movq 0x5478(%rip), %rsi      # 0x9160
movslq %eax, %rcx
imulq $0x18, %rcx, %r15
movq 0x8(%r15,%r13), %r8
movq %r14, %rdi
movl $0x391, %edx            # imm = 0x391
xorl %eax, %eax
callq 0x261e
xorl %eax, %eax
callq *0x10(%r15,%r13)
cmpl $0x2, 0x545b(%rip)      # 0x916c
jne 0x3cce
movq 0x5446(%rip), %rsi      # 0x9160
leaq 0x1c8a(%rip), %rdi      # 0x59ab
movl $0x395, %edx            # imm = 0x395
xorl %eax, %eax
callq 0x261e
movq 0x542c(%rip), %rsi      # 0x9160
movq %r12, %rdi
movl $0x396, %edx            # imm = 0x396
xorl %eax, %eax
callq 0x261e
callq 0x3b72
jmp 0x3cce
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: serv_response_login_success
int serv_response_login_success(server_message_t *psm) {
	wlog("call message handler %s\n", __func__);
	wlog("==> try server_say\n");
	server_say("welcome to simple net-based game");
	wlog("==> change user_state from %s into %s\n", user_state_s[user_state], user_state_s[USER_STATE_LOGIN]);
	user_state = USER_STATE_LOGIN;
	wlog("==> update user state to screen\n");
	display_user_state();
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x5337(%rip), %rsi      # 0x9160
leaq 0x1bb7(%rip), %rdi      # 0x59e7
leaq 0x1ca0(%rip), %rcx      # 0x5ad7
movl $0x3b6, %edx            # imm = 0x3B6
xorl %eax, %eax
callq 0x261e
movq 0x5316(%rip), %rsi      # 0x9160
leaq 0x1ca2(%rip), %rdi      # 0x5af3
movl $0x3b7, %edx            # imm = 0x3B7
xorl %eax, %eax
callq 0x261e
leaq 0x1caa(%rip), %rdi      # 0x5b0e
callq 0x2fd1
movq 0x52f0(%rip), %rsi      # 0x9160
movl 0x52f6(%rip), %eax      # 0x916c
leaq 0x4db3(%rip), %rcx      # 0x8c30
movq (%rcx,%rax,8), %rcx
leaq 0x1ca7(%rip), %rdi      # 0x5b2f
leaq 0x20a1(%rip), %r8       # 0x5f30
movl $0x3b9, %edx            # imm = 0x3B9
xorl %eax, %eax
callq 0x261e
movl $0x2, 0x52c7(%rip)      # 0x916c
movq 0x52b4(%rip), %rsi      # 0x9160
leaq 0x1caa(%rip), %rdi      # 0x5b5d
movl $0x3bb, %edx            # imm = 0x3BB
xorl %eax, %eax
callq 0x261e
callq 0x2f94
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: serv_response_login_fail_unregistered_userid
int serv_response_login_fail_unregistered_userid(server_message_t *psm) {
	wlog("call message handler %s\n", __func__);
	server_say("your name hasn't been registered!");
	display_user_state();
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x528d(%rip), %rsi      # 0x9160
leaq 0x1b0d(%rip), %rdi      # 0x59e7
leaq 0x1ca4(%rip), %rcx      # 0x5b85
movl $0x3c1, %edx            # imm = 0x3C1
xorl %eax, %eax
callq 0x261e
leaq 0x1cbe(%rip), %rdi      # 0x5bb2
callq 0x2fd1
callq 0x2f94
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: serv_response_login_fail_error_password
int serv_response_login_fail_error_password(server_message_t *psm) {
	wlog("call message handler %s\n", __func__);
	server_say("error password!");
	display_user_state();
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x5253(%rip), %rsi      # 0x9160
leaq 0x1ad3(%rip), %rdi      # 0x59e7
leaq 0x1cb9(%rip), %rcx      # 0x5bd4
movl $0x3c8, %edx            # imm = 0x3C8
xorl %eax, %eax
callq 0x261e
leaq 0x1cce(%rip), %rdi      # 0x5bfc
callq 0x2fd1
callq 0x2f94
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: serv_response_login_fail_dup_userid
int serv_response_login_fail_dup_userid(server_message_t *psm) {
	wlog("call message handler %s\n", __func__);
	server_say("you have logined in another place!");
	display_user_state();
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x5219(%rip), %rsi      # 0x9160
leaq 0x1a99(%rip), %rdi      # 0x59e7
leaq 0x1cb7(%rip), %rcx      # 0x5c0c
movl $0x3cf, %edx            # imm = 0x3CF
xorl %eax, %eax
callq 0x261e
leaq 0x1cc8(%rip), %rdi      # 0x5c30
callq 0x2fd1
callq 0x2f94
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: serv_response_login_fail_server_limits
int serv_response_login_fail_server_limits(server_message_t *psm) {
	wlog("call message handler %s\n", __func__);
	server_say("server fail");
	display_user_state();
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x51df(%rip), %rsi      # 0x9160
leaq 0x1a5f(%rip), %rdi      # 0x59e7
leaq 0x1cc4(%rip), %rcx      # 0x5c53
movl $0x3d6, %edx            # imm = 0x3D6
xorl %eax, %eax
callq 0x261e
leaq 0x1cd8(%rip), %rdi      # 0x5c7a
callq 0x2fd1
callq 0x2f94
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: serv_response_all_users_info
int serv_response_all_users_info(server_message_t *psm) {
	int len = 0;
	static char users[USERNAME_SIZE * USER_CNT];
	wlog("call message handler %s\n", __func__);
	for(int i = 0; i < USER_CNT; i++) {
		int state = psm->all_users[i].user_state;
		if(state != USER_STATE_UNUSED
		&& state != USER_STATE_NOT_LOGIN) {
			len += sprintf(users + len, "%s, ", psm->all_users[i].user_name);
		}
	}
	if(len > sizeof(users) - 1)
		eprintf("buffer overflow\n");

	users[len - 2] = 0;
	wlog("server response user list: %s\n", users);
	bottom_bar_output(0, "online: %s", users);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x5163(%rip), %rsi      # 0x9160
leaq 0x19e3(%rip), %rdi      # 0x59e7
leaq 0x1cab(%rip), %rcx      # 0x5cb6
movl $0x3e5, %edx            # imm = 0x3E5
xorl %eax, %eax
callq 0x261e
leaq 0x1(%r14), %r12
leaq 0x1cb1(%rip), %r15      # 0x5cd3
xorl %ebx, %ebx
xorl %r13d, %r13d
movslq %r13d, %rdi
cmpq $0x28, %rbx
je 0x4059
cmpb $0x2, 0x8(%r14,%rbx)
jb 0x4053
leaq (%r12,%rbx), %rdx
leaq 0x529d(%rip), %rax      # 0x92e0
addq %rax, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x21c0
addl %eax, %r13d
addq $0x8, %rbx
jmp 0x4027
cmpl $0x22, %r13d
ja 0x40ac
leaq 0x527a(%rip), %rbx      # 0x92e0
movb $0x0, -0x2(%rdi,%rbx)
movq 0x50ee(%rip), %rsi      # 0x9160
leaq 0x1c5f(%rip), %rdi      # 0x5cd8
movl $0x3f1, %edx            # imm = 0x3F1
movq %rbx, %rcx
xorl %eax, %eax
callq 0x261e
leaq 0x1c6f(%rip), %rsi      # 0x5cfe
xorl %edi, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2702
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4f3d(%rip), %rax      # 0x8ff0
movq (%rax), %rdi
leaq 0x13bc(%rip), %rsi      # 0x5479
leaq 0x1bf2(%rip), %rdx      # 0x5cb6
movl $0x3ee, %ecx            # imm = 0x3EE
xorl %eax, %eax
callq 0x2130
xorl %edi, %edi
callq 0x21d0
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: serv_response_all_friends_info
int serv_response_all_friends_info(server_message_t *psm) {
	int j = 0;
	wlog("call message handler %s\n", __func__);
	for(int i = 0; i < USER_CNT; i++) {
		int state = psm->all_users[i].user_state;
		if(state != USER_STATE_UNUSED
		&& state != USER_STATE_NOT_LOGIN) {
			strncpy(friend_list.records[j ++],
					psm->all_users[i].user_name,
					USERNAME_SIZE - 1);
		}
	}
	wlog("draw catalogs of friends\n");
	draw_catalog(&friend_list);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x5071(%rip), %rsi      # 0x9160
leaq 0x18f1(%rip), %rdi      # 0x59e7
leaq 0x1c0c(%rip), %rcx      # 0x5d09
xorl %r15d, %r15d
movl $0x3f8, %edx            # imm = 0x3F8
xorl %eax, %eax
callq 0x261e
leaq 0x1(%rbx), %r12
pushq $0x6
popq %r14
xorl %r13d, %r13d
cmpq $0x28, %r15
je 0x4150
cmpb $0x2, 0x8(%rbx,%r15)
jb 0x414a
leaq (%r12,%r15), %rsi
movslq %r13d, %rax
incl %r13d
imulq $0x7, %rax, %rax
leaq 0x4fe6(%rip), %rcx      # 0x9120
leaq (%rax,%rcx), %rdi
addq $0x10, %rdi
movq %r14, %rdx
callq 0x2050
addq $0x8, %r15
jmp 0x4117
movq 0x5009(%rip), %rsi      # 0x9160
leaq 0x1bca(%rip), %rdi      # 0x5d28
movl $0x402, %edx            # imm = 0x402
xorl %eax, %eax
callq 0x261e
leaq 0x4faf(%rip), %rdi      # 0x9120
callq 0x361f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: serv_response_launch_battle_success
int serv_response_launch_battle_success(server_message_t *psm) {
	wlog("call message handler %s\n", __func__);
	server_say("launch battle success");
	user_state = USER_STATE_BATTLE;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x4f99(%rip), %rsi      # 0x9160
leaq 0x1819(%rip), %rdi      # 0x59e7
leaq 0x1baa(%rip), %rcx      # 0x5d7f
movl $0x40e, %edx            # imm = 0x40E
xorl %eax, %eax
callq 0x261e
leaq 0x1bbb(%rip), %rdi      # 0x5da3
callq 0x2fd1
movl $0x3, 0x4f75(%rip)      # 0x916c
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: serv_response_nobody_invite_you
int serv_response_nobody_invite_you(server_message_t *psm) {
	wlog("call message handler %s\n", __func__);
	server_say("no body invite you");
	user_state = USER_STATE_LOGIN;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x4f5a(%rip), %rsi      # 0x9160
leaq 0x17da(%rip), %rdi      # 0x59e7
leaq 0x1ba5(%rip), %rcx      # 0x5db9
movl $0x415, %edx            # imm = 0x415
xorl %eax, %eax
callq 0x261e
leaq 0x1bb2(%rip), %rdi      # 0x5dd9
callq 0x2fd1
movl $0x2, 0x4f36(%rip)      # 0x916c
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: serv_msg_friend_login
int serv_msg_friend_login(server_message_t *psm) {
	wlog("call message handler %s\n", __func__);
	for(int i = 0; i < USER_CNT; i++) {
		if(friend_list.records[i][0] == 0) {
			strncpy(friend_list.records[i], psm->friend_name, USERNAME_SIZE - 1);
			break;
		}
	}
	if(user_state == USER_STATE_LOGIN)
		draw_catalog(&friend_list);
	server_say(sformat("friend %s login\n", psm->friend_name));
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x4ee1(%rip), %rsi      # 0x9160
leaq 0x1761(%rip), %rdi      # 0x59e7
leaq 0x1b96(%rip), %rcx      # 0x5e23
movl $0x422, %edx            # imm = 0x422
xorl %eax, %eax
callq 0x261e
pushq $0x6
popq %rax
leaq 0x4e86(%rip), %rcx      # 0x9129
decq %rax
je 0x42c1
leaq 0x7(%rcx), %rdi
cmpb $0x0, 0x7(%rcx)
movq %rdi, %rcx
jne 0x42a3
leaq 0x1(%rbx), %rsi
pushq $0x6
popq %rdx
callq 0x2050
cmpl $0x2, 0x4ea4(%rip)      # 0x916c
jne 0x42d6
leaq 0x4e4f(%rip), %rdi      # 0x9120
callq 0x361f
incq %rbx
leaq 0x1b59(%rip), %rdi      # 0x5e39
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2ed5
leaq 0x4f7f(%rip), %rdi      # 0x9270
callq 0x2fd1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: serv_msg_friend_logout
int serv_msg_friend_logout(server_message_t *psm) {
	wlog("call message handler %s\n", __func__);
	for(int i = 0; i < USER_CNT; i++) {
		if(strncmp(friend_list.records[i], psm->friend_name, USERNAME_SIZE - 1) == 0) {
			friend_list.records[i][0] = 0;
			break;
		}
	}
	if(user_state == USER_STATE_LOGIN)
		draw_catalog(&friend_list);
	server_say(sformat("friend %s logout\n", psm->friend_name));
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x4e4c(%rip), %rsi      # 0x9160
leaq 0x16cc(%rip), %rdi      # 0x59e7
leaq 0x1b28(%rip), %rcx      # 0x5e4a
movl $0x430, %edx            # imm = 0x430
xorl %eax, %eax
callq 0x261e
incq %rbx
pushq $0x6
popq %r14
leaq 0x4df4(%rip), %rdi      # 0x9130
movq %r14, %r15
decq %r15
je 0x4360
leaq 0x7(%rdi), %r12
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2060
movq %r12, %rdi
testl %eax, %eax
jne 0x433f
movb $0x0, -0x7(%r12)
cmpl $0x2, 0x4e05(%rip)      # 0x916c
jne 0x4375
leaq 0x4db0(%rip), %rdi      # 0x9120
callq 0x361f
leaq 0x1ae5(%rip), %rdi      # 0x5e61
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2ed5
leaq 0x4ee3(%rip), %rdi      # 0x9270
callq 0x2fd1
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: serv_msg_reject_battle
int serv_msg_reject_battle(server_message_t *psm) {
	wlog("call message handler %s\n", __func__);
	wlog("friend '%s' reject battle\n", psm->friend_name);
	server_say(sformat("friend %s reject your invitation", psm->friend_name));
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x4d60(%rip), %rsi      # 0x9160
leaq 0x15e0(%rip), %rdi      # 0x59e7
leaq 0x1a9d(%rip), %rcx      # 0x5eab
movl $0x444, %edx            # imm = 0x444
xorl %eax, %eax
callq 0x261e
movq 0x4d3f(%rip), %rsi      # 0x9160
incq %rbx
leaq 0x1a97(%rip), %rdi      # 0x5ec2
movl $0x445, %edx            # imm = 0x445
movq %rbx, %rcx
xorl %eax, %eax
callq 0x261e
leaq 0x1aa3(%rip), %rdi      # 0x5ee4
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2ed5
leaq 0x4e1e(%rip), %rdi      # 0x9270
callq 0x2fd1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: serv_msg_you_are_invited
int serv_msg_you_are_invited(server_message_t *psm) {
	// FIXME:
	wlog("call message handler %s\n", __func__);
	server_say(sformat("friend %s invite you to his battle [press button to join]", psm->friend_name));
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x4c4a(%rip), %rsi      # 0x9160
leaq 0x14ca(%rip), %rdi      # 0x59e7
leaq 0x1a56(%rip), %rcx      # 0x5f7a
movl $0x458, %edx            # imm = 0x458
xorl %eax, %eax
callq 0x261e
incq %rbx
leaq 0x1a59(%rip), %rdi      # 0x5f93
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2ed5
leaq 0x4d25(%rip), %rdi      # 0x9270
callq 0x2fd1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: flip_old_items
void flip_old_items(server_message_t *psm) {
	static server_message_t sm = {0};
	wlog("call flip old items\n");
	lock_cursor();
	for(int i = 0; i < USER_CNT; i++) {
		if(sm.user_pos[i].x >= BATTLE_W
		|| sm.user_pos[i].y >= BATTLE_H)
			continue;

		wlog("clear user %d@(%d, %d)\n", i, sm.user_pos[i].x, sm.user_pos[i].y);
		set_cursor(sm.user_pos[i].x, sm.user_pos[i].y);
		printf(" ");
	}

	for(int i = 0; i < MAX_ITEM; i++) {
		if(sm.item_kind[i] != ITEM_BULLET)
			continue;

		set_cursor(sm.item_pos[i].x, sm.item_pos[i].y);
		printf(" ");
	}

	fflush(stdout);

	unlock_cursor();
	memcpy(&sm, psm, sizeof(server_message_t));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x4b0f(%rip), %rsi      # 0x9160
leaq 0x19f0(%rip), %rdi      # 0x6048
movl $0x472, %edx            # imm = 0x472
xorl %eax, %eax
callq 0x261e
callq 0x2d71
leaq 0x4c93(%rip), %r13      # 0x9303
leaq 0x19ed(%rip), %r14      # 0x6064
pushq $0x20
popq %r15
xorl %r12d, %r12d
cmpq $0x5, %r12
je 0x46d3
movzbl 0x4(%r13,%r12,2), %r8d
cmpl $0x3b, %r8d
ja 0x46ce
movzbl 0x5(%r13,%r12,2), %r9d
cmpl $0xf, %r9d
ja 0x46ce
movq 0x4abd(%rip), %rsi      # 0x9160
movq %r14, %rdi
movl $0x479, %edx            # imm = 0x479
movl %r12d, %ecx
xorl %eax, %eax
callq 0x261e
movzbl 0x4(%r13,%r12,2), %edi
movzbl 0x5(%r13,%r12,2), %esi
callq 0x2d05
movl %r15d, %edi
callq 0x2040
incq %r12
jmp 0x467e
pushq $0x4b
popq %r15
pushq $0x20
popq %r14
cmpq $0xd2, %r15
je 0x470a
cmpb $0x6, -0x3d(%r15,%r13)
jne 0x4705
movzbl -0x1(%r13,%r15,2), %edi
movzbl (%r13,%r15,2), %esi
callq 0x2d05
movl %r14d, %edi
callq 0x2040
incq %r15
jmp 0x46db
movq 0x48b7(%rip), %rax      # 0x8fc8
movq (%rax), %rdi
callq 0x2160
callq 0x2d82
leaq 0x4bde(%rip), %rdi      # 0x9303
movl $0x1a3, %edx            # imm = 0x1A3
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2140
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/client.c
// Function: draw_users
void draw_users(server_message_t *psm) {
	lock_cursor();
	for(int i = 0; i < USER_CNT; i++) {
		if(psm->user_pos[i].x >= BATTLE_W
		|| psm->user_pos[i].y >= BATTLE_H)
			continue;

		set_cursor(psm->user_pos[i].x, psm->user_pos[i].y);
		if(i == psm->index)
			printf("Y");
		else
			printf("A");
	}

	fflush(stdout);
	unlock_cursor();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
callq 0x2d71
xorl %r14d, %r14d
pushq $0x59
popq %r15
pushq $0x41
popq %r12
cmpq $0x5, %r14
je 0x4797
movzbl 0x4(%rbx,%r14,2), %edi
cmpl $0x3b, %edi
ja 0x4792
movzbl 0x5(%rbx,%r14,2), %esi
cmpl $0xf, %esi
ja 0x4792
callq 0x2d05
movzbl 0x2(%rbx), %eax
cmpq %rax, %r14
movl %r12d, %edi
cmovel %r15d, %edi
callq 0x2040
incq %r14
jmp 0x475e
movq 0x482a(%rip), %rax      # 0x8fc8
movq (%rax), %rdi
callq 0x2160
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2d82