LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: client_command_accept_battle
int client_command_accept_battle(int uid) {
	log("user %s accept battle #%d\n", sessions[uid].user_name, sessions[uid].bid);

	if(sessions[uid].state == USER_STATE_BATTLE) {
		logi("already in battle\n");
		send_to_client(uid, SERVER_RESPONSE_YOURE_ALREADY_IN_BATTLE);
	}else if(sessions[uid].state == USER_STATE_WAIT_TO_BATTLE) {
		int inviter_id = sessions[uid].inviter_id;
		int bid = sessions[uid].bid;

		if(battles[bid].is_alloced) {
			send_to_client_with_username(inviter_id, SERVER_MESSAGE_FRIEND_ACCEPT_BATTLE, sessions[inviter_id].user_name);
			user_join_battle(bid, uid);
			logi("accept success\n");
		}else{
			logi("user %s accept battle which didn't exist\n", sessions[uid].user_name);
			send_to_client(uid, SERVER_RESPONSE_YOURE_ALREADY_IN_BATTLE);
		}

	}else{
		logi("hasn't been invited\n");
		send_to_client(uid, SERVER_RESPONSE_NOBODY_INVITE_YOU);
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
movq 0x71be(%rip), %r13      # 0x8ff0
movq (%r13), %rdi
movslq %ebx, %rax
imulq $0x48, %rax, %r12
leaq 0x733c(%rip), %r15      # 0x9180
leaq (%r15,%r12), %r14
movl 0x10(%r12,%r15), %r9d
leaq 0x435c(%rip), %rsi      # 0x61b0
leaq 0x4388(%rip), %rdx      # 0x61e3
movl $0x304, %ecx            # imm = 0x304
movq %r14, %r8
xorl %eax, %eax
callq 0x10d0
movl 0xc(%r12,%r15), %eax
cmpl $0x4, %eax
je 0x1e99
cmpl $0x3, %eax
jne 0x1ed6
movq (%r13), %rdi
leaq 0x437c(%rip), %rsi      # 0x6200
leaq 0x4358(%rip), %rdx      # 0x61e3
movl $0x307, %ecx            # imm = 0x307
xorl %eax, %eax
callq 0x10d0
jmp 0x1ed2
movslq 0x10(%r14), %r12
imulq $0xb08, %r12, %rax      # imm = 0xB08
leaq 0x7445(%rip), %rcx      # 0x92f0
cmpl $0x0, (%rax,%rcx)
jne 0x1f0f
movq (%r13), %rdi
leaq 0x439f(%rip), %rsi      # 0x625b
leaq 0x4320(%rip), %rdx      # 0x61e3
movl $0x312, %ecx            # imm = 0x312
movq %r14, %r8
xorl %eax, %eax
callq 0x10d0
pushq $0x10
jmp 0x1ef6
movq (%r13), %rdi
leaq 0x43c0(%rip), %rsi      # 0x62a1
leaq 0x42fb(%rip), %rdx      # 0x61e3
movl $0x317, %ecx            # imm = 0x317
xorl %eax, %eax
callq 0x10d0
pushq $0x12
popq %rsi
movl %ebx, %edi
callq 0x357d
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movslq 0x14(%r14), %rdi
imulq $0x48, %rdi, %rax
addq %rax, %r15
pushq $0x16
popq %rsi
movq %r15, %rdx
callq 0x304f
movl %r12d, %edi
movl %ebx, %esi
callq 0x11c0
movq (%r13), %rdi
leaq 0x42f5(%rip), %rsi      # 0x622f
leaq 0x42a2(%rip), %rdx      # 0x61e3
movl $0x310, %ecx            # imm = 0x310
xorl %eax, %eax
callq 0x10d0
jmp 0x1efe
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: client_command_reject_battle
int client_command_reject_battle(int uid) {
	log("user %s reject battle #%d\n", sessions[uid].user_name, sessions[uid].bid);
	if(sessions[uid].state == USER_STATE_BATTLE) {
		logi("user already in battle\n");
		send_to_client(uid, SERVER_RESPONSE_YOURE_ALREADY_IN_BATTLE);
	}else if(sessions[uid].state == USER_STATE_WAIT_TO_BATTLE) {
		logi("reject success\n");
		int bid = sessions[uid].bid;
		send_to_client(sessions[uid].inviter_id, SERVER_MESSAGE_FRIEND_REJECT_BATTLE);
		sessions[uid].state = USER_STATE_LOGIN;
		battles[bid].users[uid].battle_state = BATTLE_STATE_UNJOINED;
	}else{
		logi("hasn't been invited\n");
		send_to_client(uid, SERVER_RESPONSE_NOBODY_INVITE_YOU);
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
movq 0x708a(%rip), %r12      # 0x8ff0
movq (%r12), %rdi
movslq %ebx, %rax
movq %rax, -0x30(%rbp)
imulq $0x48, %rax, %r13
leaq 0x7204(%rip), %r15      # 0x9180
leaq (%r15,%r13), %r14
movl 0x10(%r13,%r15), %r9d
leaq 0x4346(%rip), %rsi      # 0x62d2
leaq 0x4372(%rip), %rdx      # 0x6305
movl $0x31f, %ecx            # imm = 0x31F
movq %r14, %r8
xorl %eax, %eax
callq 0x10d0
movl 0xc(%r13,%r15), %eax
movq (%r12), %rdi
cmpl $0x4, %eax
je 0x1fd3
cmpl $0x3, %eax
jne 0x2022
leaq 0x4366(%rip), %rsi      # 0x6322
leaq 0x4342(%rip), %rdx      # 0x6305
movl $0x321, %ecx            # imm = 0x321
xorl %eax, %eax
callq 0x10d0
pushq $0x10
jmp 0x203e
leaq 0x437c(%rip), %rsi      # 0x6356
leaq 0x4324(%rip), %rdx      # 0x6305
movl $0x324, %ecx            # imm = 0x324
xorl %eax, %eax
callq 0x10d0
movslq 0x10(%r14), %rbx
movl 0x14(%r14), %edi
pushq $0x17
popq %rsi
callq 0x357d
movl $0x2, 0xc(%r14)
imulq $0xb08, %rbx, %rax      # imm = 0xB08
leaq 0x72dd(%rip), %rcx      # 0x92f0
addq %rax, %rcx
imulq $0x14, -0x30(%rbp), %rax
andl $0x0, 0x10(%rax,%rcx)
jmp 0x2046
leaq 0x4278(%rip), %rsi      # 0x62a1
leaq 0x42d5(%rip), %rdx      # 0x6305
movl $0x32a, %ecx            # imm = 0x32A
xorl %eax, %eax
callq 0x10d0
pushq $0x12
popq %rsi
movl %ebx, %edi
callq 0x357d
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_O1/wierton[P]socket-based-naive-game/server.c
// Function: client_command_quit
int client_command_quit(int uid) {
	int conn = sessions[uid].conn;
	if(sessions[uid].state == USER_STATE_BATTLE
	|| sessions[uid].state == USER_STATE_WAIT_TO_BATTLE) {
		log("user %d@%s tries to quit client was in battle\n", uid, sessions[uid].user_name);
		user_quit_battle(sessions[uid].bid, uid);
	}

	sessions[uid].conn = -1;
	log("user %d@%s quit\n", uid, sessions[uid].user_name);
	sessions[uid].state = USER_STATE_UNUSED;
	close(conn);
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %r15d
movslq %edi, %rax
imulq $0x48, %rax, %rax
leaq 0x710e(%rip), %rcx      # 0x9180
leaq (%rcx,%rax), %r14
movl 0x8(%rax,%rcx), %ebx
movl 0xc(%rax,%rcx), %eax
addl $-0x3, %eax
cmpl $0x1, %eax
ja 0x20bc
movq 0x6f63(%rip), %rax      # 0x8ff0
movq (%rax), %rdi
leaq 0x42eb(%rip), %rsi      # 0x6382
leaq 0x432b(%rip), %rdx      # 0x63c9
movl $0x334, %ecx            # imm = 0x334
movl %r15d, %r8d
movq %r14, %r9
xorl %eax, %eax
callq 0x10d0
movl 0x10(%r14), %edi
movl %r15d, %esi
callq 0x2f4c
orl $-0x1, 0x8(%r14)
movq 0x6f28(%rip), %rax      # 0x8ff0
movq (%rax), %rdi
leaq 0x430b(%rip), %rsi      # 0x63dd
leaq 0x42f0(%rip), %rdx      # 0x63c9
movl $0x339, %ecx            # imm = 0x339
movl %r15d, %r8d
movq %r14, %r9
xorl %eax, %eax
callq 0x10d0
andl $0x0, 0xc(%r14)
movl %ebx, %edi
callq 0x10b0
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: client_command_move_up
int client_command_move_up(int uid) {
	log("user %s move up\n", sessions[uid].user_name);
	int bid = sessions[uid].bid;
	battles[bid].users[uid].dir = DIR_UP;
	if(battles[bid].users[uid].pos.y > 0) {
		battles[bid].users[uid].pos.y --;
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x6eda(%rip), %rax      # 0x8ff0
movq (%rax), %rax
movslq %edi, %rbx
imulq $0x48, %rbx, %r14
leaq 0x7059(%rip), %r15      # 0x9180
leaq (%r15,%r14), %r8
leaq 0x42d4(%rip), %rsi      # 0x6406
leaq 0x42f6(%rip), %rdx      # 0x642f
movq %rax, %rdi
movl $0x340, %ecx            # imm = 0x340
xorl %eax, %eax
callq 0x10d0
movslq 0x10(%r14,%r15), %rax
imulq $0xb08, %rax, %rcx      # imm = 0xB08
leaq 0x7195(%rip), %rax      # 0x92f0
addq %rcx, %rax
imulq $0x14, %rbx, %rdx
andl $0x0, 0x18(%rdx,%rax)
movb 0x21(%rdx,%rax), %cl
testb %cl, %cl
je 0x217b
addq %rdx, %rax
addq $0x10, %rax
decb %cl
movb %cl, 0x11(%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: client_command_move_down
int client_command_move_down(int uid) {
	log("user %s move down\n", sessions[uid].user_name);
	int bid = sessions[uid].bid;
	battles[bid].users[uid].dir = DIR_DOWN;
	if(battles[bid].users[uid].pos.y < BATTLE_H - 1) {
		battles[bid].users[uid].pos.y ++;
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x6e57(%rip), %rax      # 0x8ff0
movq (%rax), %rax
movslq %edi, %rbx
imulq $0x48, %rbx, %r14
leaq 0x6fd6(%rip), %r15      # 0x9180
leaq (%r15,%r14), %r8
leaq 0x4291(%rip), %rsi      # 0x6446
leaq 0x42b5(%rip), %rdx      # 0x6471
movq %rax, %rdi
movl $0x34a, %ecx            # imm = 0x34A
xorl %eax, %eax
callq 0x10d0
movslq 0x10(%r14,%r15), %rax
imulq $0xb08, %rax, %rcx      # imm = 0xB08
leaq 0x7112(%rip), %rax      # 0x92f0
addq %rcx, %rax
imulq $0x14, %rbx, %rdx
movl $0x1, 0x18(%rdx,%rax)
movb 0x21(%rdx,%rax), %cl
cmpb $0xe, %cl
ja 0x2202
addq %rdx, %rax
addq $0x10, %rax
incb %cl
movb %cl, 0x11(%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: client_command_move_left
int client_command_move_left(int uid) {
	log("user %s move left\n", sessions[uid].user_name);
	int bid = sessions[uid].bid;
	battles[bid].users[uid].dir = DIR_LEFT;
	if(battles[bid].users[uid].pos.x > 0) {
		battles[bid].users[uid].pos.x --;
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x6dd0(%rip), %rax      # 0x8ff0
movq (%rax), %rax
movslq %edi, %rbx
imulq $0x48, %rbx, %r14
leaq 0x6f4f(%rip), %r15      # 0x9180
leaq (%r15,%r14), %r8
leaq 0x424e(%rip), %rsi      # 0x648a
leaq 0x4272(%rip), %rdx      # 0x64b5
movq %rax, %rdi
movl $0x354, %ecx            # imm = 0x354
xorl %eax, %eax
callq 0x10d0
movslq 0x10(%r14,%r15), %rax
imulq $0xb08, %rax, %rcx      # imm = 0xB08
leaq 0x708b(%rip), %rax      # 0x92f0
addq %rcx, %rax
imulq $0x14, %rbx, %rdx
movl $0x2, 0x18(%rdx,%rax)
movb 0x20(%rdx,%rax), %cl
testb %cl, %cl
je 0x2288
addq %rdx, %rax
addq $0x10, %rax
decb %cl
movb %cl, 0x10(%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: client_command_move_right
int client_command_move_right(int uid) {
	log("user %s move right\n", sessions[uid].user_name);
	int bid = sessions[uid].bid;
	battles[bid].users[uid].dir = DIR_RIGHT;
	if(battles[bid].users[uid].pos.x < BATTLE_W - 1) {
		battles[bid].users[uid].pos.x ++;
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x6d4a(%rip), %rax      # 0x8ff0
movq (%rax), %rax
movslq %edi, %rbx
imulq $0x48, %rbx, %r14
leaq 0x6ec9(%rip), %r15      # 0x9180
leaq (%r15,%r14), %r8
leaq 0x420c(%rip), %rsi      # 0x64ce
leaq 0x4231(%rip), %rdx      # 0x64fa
movq %rax, %rdi
movl $0x35e, %ecx            # imm = 0x35E
xorl %eax, %eax
callq 0x10d0
movslq 0x10(%r14,%r15), %rax
imulq $0xb08, %rax, %rcx      # imm = 0xB08
leaq 0x7005(%rip), %rax      # 0x92f0
addq %rcx, %rax
imulq $0x14, %rbx, %rdx
movl $0x3, 0x18(%rdx,%rax)
movb 0x20(%rdx,%rax), %cl
cmpb $0x3a, %cl
ja 0x230f
addq %rdx, %rax
addq $0x10, %rax
incb %cl
movb %cl, 0x10(%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: client_command_fire
int client_command_fire(int uid) {
	log("user %s fire\n", sessions[uid].user_name);
	int bid = sessions[uid].bid;
	int item_id = get_unused_item(bid);
	log("alloc item %d for bullet\n", item_id);
	if(item_id == -1) return 0;

	if(battles[bid].users[uid].nr_bullets <= 0) {
		send_to_client(uid, SERVER_MESSAGE_YOUR_MAGAZINE_IS_EMPTY);
		return 0;
	}

	int dir = battles[bid].users[uid].dir;
	int x = battles[bid].users[uid].pos.x;
	int y = battles[bid].users[uid].pos.y;
	log("bullet, %s@(%d, %d), direct to %d\n",
			sessions[uid].user_name, x, y, dir);
	battles[bid].items[item_id].kind = ITEM_BULLET;
	battles[bid].items[item_id].dir = dir;
	battles[bid].items[item_id].owner = uid;
	battles[bid].items[item_id].pos.x = x;
	battles[bid].items[item_id].pos.y = y;

	battles[bid].users[uid].nr_bullets --;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edi, %eax
movq 0x6cba(%rip), %rbx      # 0x8ff0
movq (%rbx), %rdi
movl %eax, -0x2c(%rbp)
movslq %eax, %r14
imulq $0x48, %r14, %r15
leaq 0x6e36(%rip), %r12      # 0x9180
leaq (%r12,%r15), %r8
leaq 0x41bf(%rip), %rsi      # 0x6514
leaq 0x41de(%rip), %r13      # 0x653a
movq %r13, %rdx
movl $0x368, %ecx            # imm = 0x368
movq %r8, -0x38(%rbp)
xorl %eax, %eax
callq 0x10d0
movl 0x10(%r15,%r12), %r12d
movl %r12d, %edi
callq 0x3331
movl %eax, %r15d
movq (%rbx), %rdi
leaq 0x41c5(%rip), %rsi      # 0x654e
movq %r13, %rdx
movl $0x36b, %ecx            # imm = 0x36B
movl %eax, %r8d
xorl %eax, %eax
callq 0x10d0
cmpl $-0x1, %r15d
je 0x23cc
movslq %r12d, %rax
imulq $0xb08, %rax, %rax      # imm = 0xB08
leaq 0x6f3e(%rip), %r13      # 0x92f0
addq %rax, %r13
imulq $0x14, %r14, %rax
cmpl $0x0, 0x14(%rax,%r13)
jg 0x23dd
pushq $0x24
popq %rsi
movl -0x2c(%rbp), %edi
callq 0x357d
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq (%rax,%r13), %r14
addq $0x10, %r14
movl 0x8(%r14), %r12d
movzbl 0x10(%r14), %r9d
movl %r9d, -0x30(%rbp)
movzbl 0x11(%r14), %ebx
movq 0x6bf2(%rip), %rax      # 0x8ff0
movq (%rax), %rdi
leaq 0x4178(%rip), %rsi      # 0x6580
leaq 0x412b(%rip), %rdx      # 0x653a
movl $0x377, %ecx            # imm = 0x377
movq -0x38(%rbp), %r8
xorl %eax, %eax
pushq %r12
pushq %rbx
callq 0x10d0
popq %rcx
popq %rdx
movslq %r15d, %rax
imulq $0x14, %rax, %rax
movl $0x6, 0x84(%r13,%rax)
movl %r12d, 0x7c(%r13,%rax)
movl -0x2c(%rbp), %ecx
movl %ecx, 0x80(%r13,%rax)
movl -0x30(%rbp), %ecx
movb %cl, 0x88(%r13,%rax)
movb %bl, 0x89(%r13,%rax)
decl 0x4(%r14)
jmp 0x23cc
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: query_session_built
int query_session_built(uint32_t uid) {
	assert(uid < USER_CNT);

	if(sessions[uid].state == USER_STATE_UNUSED
	|| sessions[uid].state == USER_STATE_NOT_LOGIN) {
		return false;
	}else{
		return true;
	}
}

// Assembly:
cmpl $0x5, %edi
jae 0x2f29
movl %edi, %eax
leaq (%rax,%rax,8), %rcx
leaq 0x6262(%rip), %rdx      # 0x9180
xorl %eax, %eax
cmpl $0x2, 0xc(%rdx,%rcx,8)
setae %al
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x211d(%rip), %rdi      # 0x5051
leaq 0x20d9(%rip), %rsi      # 0x5014
leaq 0x20db(%rip), %rcx      # 0x501d
movl $0x4a, %edx
callq 0x1090
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: wrap_send
void wrap_send(int conn, server_message_t *psm) {
	size_t total_len = 0;
	while(total_len < sizeof(server_message_t)) {
		size_t len = send(conn, psm + total_len, sizeof(server_message_t) - total_len, 0);
		if(len < 0) {
			loge("broken pipe\n");
		}

		total_len += len;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movl %edi, %r14d
xorl %r15d, %r15d
movl $0x1a3, %r12d           # imm = 0x1A3
imulq $0x1a3, %r15, %rsi      # imm = 0x1A3
addq %rbx, %rsi
movl $0x1a3, %edx            # imm = 0x1A3
subq %r15, %rdx
movl %r14d, %edi
xorl %ecx, %ecx
callq 0x1070
addq %rax, %r15
cmpq %r12, %r15
jb 0x2fa0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: user_invited_to_join_battle
void user_invited_to_join_battle(uint32_t bid, uint32_t uid) {
	if(sessions[uid].state == USER_STATE_WAIT_TO_BATTLE
	&& bid != sessions[uid].bid) {
		log("user %d@%s rejects old battle #%d since he was invited to a new battle\n", uid, sessions[uid].user_name, sessions[uid].bid);

		send_to_client_with_username(sessions[uid].inviter_id, SERVER_MESSAGE_FRIEND_REJECT_BATTLE, sessions[uid].user_name);
	}

	user_join_battle_common_part(bid, uid, USER_STATE_WAIT_TO_BATTLE);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movl %edi, %r14d
movl %esi, %eax
leaq (%rax,%rax,8), %rax
leaq 0x6160(%rip), %rcx      # 0x9180
cmpl $0x4, 0xc(%rcx,%rax,8)
jne 0x3033
leaq (%rcx,%rax,8), %rsi
movl 0x10(%rsi), %edx
cmpl %r14d, %edx
jne 0x3046
movl %r14d, %edi
movl %ebx, %esi
movl $0x4, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x2fcd
movl %ebx, %edi
callq 0x26a5
jmp 0x3033
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: send_to_client_with_username
void send_to_client_with_username(int uid, int message, char *user_name) {
	int conn = sessions[uid].conn;
	server_message_t sm;
	memset(&sm, 0, sizeof(server_message_t));
	sm.response = message;
	strncpy(sm.friend_name, user_name, USERNAME_SIZE - 1);
	wrap_send(conn, &sm);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdx, -0x30(%rbp)
movl %esi, %r15d
movslq %edi, %rax
leaq (%rax,%rax,8), %rax
leaq 0x6108(%rip), %rcx      # 0x9180
movl 0x8(%rcx,%rax,8), %ebx
leaq -0x1d3(%rbp), %r12
xorl %r13d, %r13d
movl $0x1a3, %r14d           # imm = 0x1A3
movl $0x1a3, %edx            # imm = 0x1A3
movq %r12, %rdi
xorl %esi, %esi
callq 0x10a0
movb %r15b, (%r12)
leaq -0x1d2(%rbp), %rdi
movl $0x6, %edx
movq -0x30(%rbp), %rsi
callq 0x1040
imulq $0x1a3, %r13, %rax      # imm = 0x1A3
leaq (%rax,%rbp), %rsi
addq $-0x1d3, %rsi           # imm = 0xFE2D
movl $0x1a3, %edx            # imm = 0x1A3
subq %r13, %rdx
movl %ebx, %edi
xorl %ecx, %ecx
callq 0x1070
addq %rax, %r13
cmpq %r14, %r13
jb 0x30b4
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: get_unalloced_battle
int get_unalloced_battle() {
	int ret_bid = -1;
	pthread_mutex_lock(&battles_lock);
	for(int i = 0; i < USER_CNT; i++) {
		if(battles[i].is_alloced == false) {
			memset(&battles[i], 0, sizeof(struct battle_t));
			battles[i].is_alloced = true;
			ret_bid = i;
			break;
		}
	}
	pthread_mutex_unlock(&battles_lock);
	if(ret_bid == -1) {
		loge("check here, returned battle id should not be -1\n");
	}else{
		log("alloc unalloced battle id #%d\n", ret_bid);
	}
	return ret_bid;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x6051(%rip), %rdi      # 0x9150
callq 0x1170
leaq 0x61e5(%rip), %r14      # 0x92f0
xorl %ebx, %ebx
cmpl $0x0, (%r14)
je 0x312a
incq %rbx
addq $0xb08, %r14            # imm = 0xB08
cmpq $0x5, %rbx
jne 0x310d
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x3140
movl $0xb08, %edx            # imm = 0xB08
movq %r14, %rdi
xorl %esi, %esi
callq 0x10a0
movl $0x1, (%r14)
leaq 0x6009(%rip), %rdi      # 0x9150
callq 0x1100
movq 0x5e9d(%rip), %rax      # 0x8ff0
movq (%rax), %rdi
cmpl $-0x1, %ebx
jne 0x3177
leaq 0x21da(%rip), %rsi      # 0x533c
leaq 0x221e(%rip), %rdx      # 0x5387
movl $0xbf, %ecx
xorl %eax, %eax
callq 0x10d0
jmp 0x3194
leaq 0x221e(%rip), %rsi      # 0x539c
leaq 0x2202(%rip), %rdx      # 0x5387
movl $0xc1, %ecx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x10d0
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: get_unused_session
int get_unused_session() {
	int ret_uid = -1;
	pthread_mutex_lock(&sessions_lock);
	for(int i = 0; i < USER_CNT; i++) {
		if(sessions[i].state == USER_STATE_UNUSED) {
			memset(&sessions[i], 0, sizeof(struct session_t));
			sessions[i].conn = -1;
			sessions[i].state = USER_STATE_NOT_LOGIN;
			ret_uid = i;
			break;
		}
	}
	pthread_mutex_unlock(&sessions_lock);
	if(ret_uid == -1) {
		log("fail to alloc session id\n");
	}else{
		log("alloc unused session id #%d\n", ret_uid);
	}
	return ret_uid;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x5f80(%rip), %rdi      # 0x9128
callq 0x1170
leaq 0x5fd8(%rip), %rax      # 0x918c
xorl %ebx, %ebx
cmpl $0x0, (%rax)
je 0x31cf
incq %rbx
addq $0x48, %rax
cmpq $0x5, %rbx
jne 0x31b6
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x31f8
xorps %xmm0, %xmm0
movups %xmm0, -0xc(%rax)
movups %xmm0, 0x24(%rax)
movups %xmm0, 0x14(%rax)
movups %xmm0, 0x4(%rax)
movq $0x0, 0x34(%rax)
movabsq $0x1ffffffff, %rcx      # imm = 0x1FFFFFFFF
movq %rcx, -0x4(%rax)
leaq 0x5f29(%rip), %rdi      # 0x9128
callq 0x1100
movq 0x5de5(%rip), %rax      # 0x8ff0
movq (%rax), %rdi
cmpl $-0x1, %ebx
jne 0x322f
leaq 0x21b9(%rip), %rsi      # 0x53d3
leaq 0x21e4(%rip), %rdx      # 0x5405
movl $0xd4, %ecx
xorl %eax, %eax
callq 0x10d0
jmp 0x324c
leaq 0x21e2(%rip), %rsi      # 0x5418
leaq 0x21c8(%rip), %rdx      # 0x5405
movl $0xd6, %ecx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x10d0
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: inform_friends
void inform_friends(int uid, int message) {
	server_message_t sm;
	char *user_name = sessions[uid].user_name;
	memset(&sm, 0, sizeof(server_message_t));
	sm.message = message;
	for(int i = 0; i < USER_CNT; i++) {
		if(i == uid || !query_session_built(i))
			continue;
		strncpy(sm.friend_name, user_name, USERNAME_SIZE - 1);
		wrap_send(sessions[i].conn, &sm);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movl %esi, %r15d
movslq %edi, %rbx
leaq (%rbx,%rbx,8), %rax
leaq 0x5f06(%rip), %rcx      # 0x9180
leaq (%rcx,%rax,8), %rax
movq %rax, -0x30(%rbp)
leaq -0x1d3(%rbp), %r12
xorl %r13d, %r13d
movl $0x1a3, %r14d           # imm = 0x1A3
movl $0x1a3, %edx            # imm = 0x1A3
movq %r12, %rdi
xorl %esi, %esi
callq 0x10a0
movb %r15b, (%r12)
movl %ebx, %ebx
cmpq %rbx, %r13
je 0x3316
leaq (,%r13,8), %r15
addq %r13, %r15
leaq 0x5ec2(%rip), %rax      # 0x9180
cmpl $0x2, 0xc(%rax,%r15,8)
jb 0x3316
movl $0x6, %edx
leaq -0x1d2(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x1040
leaq 0x5e9e(%rip), %rax      # 0x9180
movl 0x8(%rax,%r15,8), %r15d
xorl %r12d, %r12d
imulq $0x1a3, %r12, %rax      # imm = 0x1A3
leaq (%rax,%rbp), %rsi
addq $-0x1d3, %rsi           # imm = 0xFE2D
movl $0x1a3, %edx            # imm = 0x1A3
subq %r12, %rdx
movl %r15d, %edi
xorl %ecx, %ecx
callq 0x1070
addq %rax, %r12
cmpq %r14, %r12
jb 0x32ea
incq %r13
cmpq $0x5, %r13
jne 0x32a7
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: get_unused_item
int get_unused_item(int bid) {
	int ret_item_id = -1;
	pthread_mutex_lock(&items_lock[bid]);
	for(int i = 0; i < MAX_ITEM; i++) {
		if(!(battles[bid].items[i].is_used)) {
			ret_item_id = i;
			battles[bid].items[i].is_used = true;
			break;
		}
	}
	pthread_mutex_unlock(&items_lock[bid]);
	return ret_item_id;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movslq %edi, %r14
leaq (%r14,%r14,4), %rax
leaq 0x96da(%rip), %rcx      # 0xca20
leaq (%rcx,%rax,8), %rbx
movq %rbx, %rdi
callq 0x1170
imulq $0xb08, %r14, %rax      # imm = 0xB08
leaq 0x5f90(%rip), %rcx      # 0x92f0
addq %rcx, %rax
addq $0x78, %rax
xorl %r14d, %r14d
cmpl $0x0, (%rax)
je 0x3387
incq %r14
addq $0x14, %rax
cmpq $0x87, %r14
jne 0x336a
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x338d
movl $0x1, (%rax)
movq %rbx, %rdi
callq 0x1100
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: random_generate_items
void random_generate_items(int bid) {
	if(rand() % 200 != 9) return;

	if(battles[bid].num_of_other >= MAX_OTHER) return;

	int item_id = get_unused_item(bid);
	if(item_id == -1) return;

	int random_kind = rand() % (ITEM_END - 1) + 1;

	battles[bid].items[item_id].kind = random_kind;
	battles[bid].items[item_id].pos.x = (rand() & 0x7FFF) % BATTLE_W;
	battles[bid].items[item_id].pos.y = (rand() & 0x7FFF) % BATTLE_H;
	log("new item: #%dk%d(%d,%d)\n", item_id,
			battles[bid].items[item_id].kind,
			battles[bid].items[item_id].pos.x,
			battles[bid].items[item_id].pos.y);
	if(random_kind == ITEM_MAGMA) {
		battles[bid].items[item_id].times = MAGMA_INIT_TIMES;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
callq 0x1180
cltq
imulq $0x51eb851f, %rax, %rcx # imm = 0x51EB851F
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x26, %rcx
addl %edx, %ecx
imull $0xc8, %ecx, %ecx
subl %ecx, %eax
cmpl $0x9, %eax
jne 0x33f6
movslq %ebx, %rax
imulq $0xb08, %rax, %r15      # imm = 0xB08
leaq 0x5f0e(%rip), %r14      # 0x92f0
cmpl $0xe, 0x74(%r15,%r14)
jg 0x33f6
movl %ebx, %edi
callq 0x3331
cmpl $-0x1, %eax
jne 0x3401
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
addq %r15, %r14
movq %r14, %rdi
movl %eax, %esi
callq 0x26ef
jmp 0x33f6
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: move_bullets
void move_bullets(int bid) {
	for(int i = 0; i < MAX_ITEM; i++) {
		if(battles[bid].items[i].is_used == false
		|| battles[bid].items[i].kind != ITEM_BULLET)
			continue;
		uint8_t *px = &(battles[bid].items[i].pos.x);
		uint8_t *py = &(battles[bid].items[i].pos.y);

		// log("try to move bullet %d with dir %d\n", i, battles[bid].items[i].dir);

		switch(battles[bid].items[i].dir) {
			case DIR_UP:	(*py)--;break;
			case DIR_DOWN:	(*py)++;break;
			case DIR_LEFT:	(*px)--;break;
			case DIR_RIGHT:	(*px)++;break;
		}

		if(*px >= BATTLE_W || *py >= BATTLE_H) {
			log("free bullet #%d\n", i);
			battles[bid].items[i].is_used = false;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq %edi, %rax
imulq $0xb08, %rax, %rax      # imm = 0xB08
leaq 0x5ec1(%rip), %rcx      # 0x92f0
leaq (%rax,%rcx), %r12
addq $0x89, %r12
leaq 0x2053(%rip), %rbx      # 0x5494
leaq 0x2075(%rip), %r14      # 0x54bd
leaq 0x1bb5(%rip), %r13      # 0x5004
xorl %r15d, %r15d
cmpl $0x0, -0x11(%r12)
je 0x349e
cmpl $0x6, -0x5(%r12)
jne 0x349e
movl -0xd(%r12), %eax
cmpq $0x3, %rax
ja 0x348f
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
decb (%r12)
jmp 0x348f
decb -0x1(%r12)
jmp 0x348f
incb -0x1(%r12)
jmp 0x348f
incb (%r12)
cmpb $0x3b, -0x1(%r12)
ja 0x34b0
cmpb $0x10, (%r12)
jae 0x34b0
incq %r15
addq $0x14, %r12
cmpq $0x87, %r15
jne 0x3452
jmp 0x34da
movq 0x5b39(%rip), %rax      # 0x8ff0
movq (%rax), %rdi
movq %rbx, %rsi
movq %r14, %rdx
movl $0x11e, %ecx            # imm = 0x11E
movl %r15d, %r8d
xorl %eax, %eax
callq 0x10d0
movl $0x0, -0x11(%r12)
jmp 0x349e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: check_who_get_blood_vial
void check_who_get_blood_vial(int bid) {
	for(int i = 0; i < MAX_ITEM; i++) {
		if(battles[bid].items[i].is_used == false
		|| battles[bid].items[i].kind != ITEM_BLOOD_VIAL)
			continue;

		int ix = battles[bid].items[i].pos.x;
		int iy = battles[bid].items[i].pos.y;

		for(int j = 0; j < USER_CNT; j++) {
			if(battles[bid].users[j].battle_state != BATTLE_STATE_LIVE)
				continue;
			int ux = battles[bid].users[j].pos.x;
			int uy = battles[bid].users[j].pos.y;

			if(ix == ux && iy == uy) {
				battles[bid].users[j].life += LIFE_PER_VIAL;
				log("user %d@%s got blood vial\n", j, sessions[j].user_name);
				if(battles[bid].users[j].life > MAX_LIFE) {
					log("user %d@%s life exceeds max value\n", j, sessions[j].user_name);
					battles[bid].users[j].life = MAX_LIFE;
				}

				battles[bid].items[i].is_used = false;
				battles[bid].num_of_other --;
				send_to_client(j, SERVER_MESSAGE_YOU_GOT_BLOOD_VIAL);
				break;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movslq %edi, %rax
imulq $0xb08, %rax, %rax      # imm = 0xB08
leaq 0x5deb(%rip), %rcx      # 0x92f0
leaq (%rax,%rcx), %r14
addq $0x78, %r14
leaq (%rax,%rcx), %r15
addq $0x10, %r15
leaq (%rax,%rcx), %rbx
addq $0x74, %rbx
xorl %r12d, %r12d
leaq (%r12,%r12,4), %rax
cmpl $0x0, (%r14,%rax,4)
je 0x355c
leaq (%r14,%rax,4), %rdx
cmpl $0x4, 0xc(%rdx)
jne 0x355c
movb 0x10(%rdx), %al
movb 0x11(%rdx), %cl
movq %r15, %rsi
xorl %edi, %edi
cmpl $0x1, (%rsi)
jne 0x354f
cmpb 0x10(%rsi), %al
jne 0x354f
cmpb 0x11(%rsi), %cl
je 0x356a
incq %rdi
addq $0x14, %rsi
cmpq $0x5, %rdi
jne 0x3540
incq %r12
cmpq $0x87, %r12
jne 0x3520
jmp 0x3574
movq %rbx, %rcx
callq 0x27ab
jmp 0x355c
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: send_to_client
void send_to_client(int uid, int message) {
	int conn = sessions[uid].conn;
	server_message_t sm;
	memset(&sm, 0, sizeof(server_message_t));
	sm.response = message;
	wrap_send(conn, &sm);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movl %esi, %r14d
movslq %edi, %rax
leaq (%rax,%rax,8), %rax
leaq 0x5bde(%rip), %rcx      # 0x9180
movl 0x8(%rcx,%rax,8), %ebx
leaq -0x1cb(%rbp), %r15
xorl %r12d, %r12d
movl $0x1a3, %r13d           # imm = 0x1A3
movl $0x1a3, %edx            # imm = 0x1A3
movq %r15, %rdi
xorl %esi, %esi
callq 0x10a0
movb %r14b, (%r15)
imulq $0x1a3, %r12, %rax      # imm = 0x1A3
leaq (%rax,%rbp), %rsi
addq $-0x1cb, %rsi           # imm = 0xFE35
movl $0x1a3, %edx            # imm = 0x1A3
subq %r12, %rdx
movl %ebx, %edi
xorl %ecx, %ecx
callq 0x1070
addq %rax, %r12
cmpq %r13, %r12
jb 0x35c8
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: check_who_traped_in_magma
void check_who_traped_in_magma(int bid) {
	for(int i = 0; i < MAX_ITEM; i++) {
		if(battles[bid].items[i].is_used == false
		|| battles[bid].items[i].kind != ITEM_MAGMA)
			continue;

		int ix = battles[bid].items[i].pos.x;
		int iy = battles[bid].items[i].pos.y;

		for(int j = 0; j < USER_CNT; j++) {
			if(battles[bid].users[j].battle_state != BATTLE_STATE_LIVE)
				continue;
			int ux = battles[bid].users[j].pos.x;
			int uy = battles[bid].users[j].pos.y;

			if(ix == ux && iy == uy) {
				battles[bid].users[j].life --;
				battles[bid].items[i].times --;
				log("user %d@%s is trapped in magma\n", j, sessions[j].user_name);
				send_to_client(j, SERVER_MESSAGE_YOU_ARE_TRAPPED_IN_MAGMA);
				if(battles[bid].items[i].times <= 0) {
					log("magma %d is exhausted\n", i);
					battles[bid].items[i].is_used = false;
					battles[bid].num_of_other --;
				}
				break;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq %edi, %rax
imulq $0xb08, %rax, %rax      # imm = 0xB08
leaq 0x5ccc(%rip), %rcx      # 0x92f0
leaq (%rax,%rcx), %r15
addq $0x78, %r15
leaq 0x74(%rax,%rcx), %r8
leaq 0x21(%rax,%rcx), %rbx
leaq 0x5b43(%rip), %rsi      # 0x9180
leaq 0x1f0d(%rip), %r10      # 0x5551
leaq 0x1f3e(%rip), %rdx      # 0x5589
xorl %r12d, %r12d
leaq (%r12,%r12,4), %rax
cmpl $0x0, (%r15,%rax,4)
je 0x3695
leaq (%r15,%rax,4), %r13
cmpl $0x2, 0xc(%r13)
jne 0x3695
movb 0x10(%r13), %al
movb 0x11(%r13), %cl
movq %rbx, %rdi
movq %rsi, %r9
xorl %r14d, %r14d
cmpl $0x1, -0x11(%rdi)
jne 0x3684
cmpb -0x1(%rdi), %al
jne 0x3684
cmpb (%rdi), %cl
je 0x36a6
incq %r14
addq $0x48, %r9
addq $0x14, %rdi
cmpq $0x5, %r14
jne 0x3675
incq %r12
cmpq $0x87, %r12
jne 0x364e
jmp 0x3726
decl -0x5(%rdi)
decl 0x8(%r13)
movq 0x593c(%rip), %rax      # 0x8ff0
movq (%rax), %rdi
movq %r10, %rsi
movl $0x156, %ecx            # imm = 0x156
movq %r8, -0x30(%rbp)
movl %r14d, %r8d
xorl %eax, %eax
callq 0x10d0
movl %r14d, %edi
movl $0x21, %esi
callq 0x357d
leaq 0x1ea8(%rip), %rdx      # 0x5589
leaq 0x1e69(%rip), %r10      # 0x5551
leaq 0x5a91(%rip), %rsi      # 0x9180
movq -0x30(%rbp), %r8
cmpl $0x0, 0x8(%r13)
jg 0x3695
movq %r12, %rdi
movq %r13, %rsi
movq %r8, %rdx
callq 0x285d
leaq 0x1e7a(%rip), %rdx      # 0x5589
leaq 0x1e3b(%rip), %r10      # 0x5551
leaq 0x5a63(%rip), %rsi      # 0x9180
movq -0x30(%rbp), %r8
jmp 0x3695
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: check_who_got_charger
void check_who_got_charger(int bid) {
	for(int i = 0; i < MAX_ITEM; i++) {
		if(battles[bid].items[i].is_used == false
		|| battles[bid].items[i].kind != ITEM_MAGAZINE)
			continue;

		int ix = battles[bid].items[i].pos.x;
		int iy = battles[bid].items[i].pos.y;

		for(int j = 0; j < USER_CNT; j++) {
			if(battles[bid].users[j].battle_state != BATTLE_STATE_LIVE)
				continue;
			int ux = battles[bid].users[j].pos.x;
			int uy = battles[bid].users[j].pos.y;

			if(ix == ux && iy == uy) {
				battles[bid].users[j].nr_bullets += BULLETS_PER_MAGAZINE;
				log("user %d@%s is got magazine\n", j, sessions[j].user_name);
				if(battles[bid].users[j].nr_bullets > MAX_BULLETS) {
					log("user %d@%s's bullets exceeds max value\n", j, sessions[j].user_name);
					battles[bid].users[j].nr_bullets = MAX_BULLETS;
				}

				send_to_client(j, SERVER_MESSAGE_YOU_GOT_MAGAZINE);
				battles[bid].items[i].is_used = false;
				break;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movslq %edi, %rax
imulq $0xb08, %rax, %rax      # imm = 0xB08
leaq 0x5ba0(%rip), %rcx      # 0x92f0
leaq (%rax,%rcx), %rbx
addq $0x78, %rbx
leaq (%rax,%rcx), %r14
addq $0x10, %r14
xorl %r15d, %r15d
leaq (%r15,%r15,4), %rax
cmpl $0x0, (%rbx,%rax,4)
je 0x379e
leaq (%rbx,%rax,4), %rdx
cmpl $0x1, 0xc(%rdx)
jne 0x379e
movb 0x10(%rdx), %al
movb 0x11(%rdx), %cl
movq %r14, %rsi
xorl %edi, %edi
cmpl $0x1, (%rsi)
jne 0x3791
cmpb 0x10(%rsi), %al
jne 0x3791
cmpb 0x11(%rsi), %cl
je 0x37ac
incq %rdi
addq $0x14, %rsi
cmpq $0x5, %rdi
jne 0x3782
incq %r15
cmpq $0x87, %r15
jne 0x3763
jmp 0x37b3
callq 0x289c
jmp 0x379e
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: check_who_is_shooted
void check_who_is_shooted(int bid) {
	for(int i = 0; i < MAX_ITEM; i++) {
		if(battles[bid].items[i].is_used == false
		|| battles[bid].items[i].kind != ITEM_BULLET)
			continue;

		int ix = battles[bid].items[i].pos.x;
		int iy = battles[bid].items[i].pos.y;

		for(int j = 0; j < USER_CNT; j++) {
			if(battles[bid].users[j].battle_state != BATTLE_STATE_LIVE)
				continue;
			int ux = battles[bid].users[j].pos.x;
			int uy = battles[bid].users[j].pos.y;

			if(ix == ux && iy == uy
			&& battles[bid].items[i].owner != j) {
				battles[bid].users[j].life --;
				log("user %d@%s is shooted\n", j, sessions[j].user_name);
				send_to_client(j, SERVER_MESSAGE_YOU_ARE_SHOOTED);
				battles[bid].items[i].is_used = false;
				break;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movslq %edi, %rax
imulq $0xb08, %rax, %rax      # imm = 0xB08
leaq 0x5b17(%rip), %rcx      # 0x92f0
leaq (%rax,%rcx), %rbx
addq $0x78, %rbx
leaq (%rax,%rcx), %r14
addq $0x10, %r14
xorl %r15d, %r15d
leaq (%r15,%r15,4), %rax
cmpl $0x0, (%rbx,%rax,4)
je 0x3830
leaq (%rbx,%rax,4), %rdx
cmpl $0x6, 0xc(%rdx)
jne 0x3830
movb 0x10(%rdx), %al
movb 0x11(%rdx), %cl
movq %r14, %rsi
xorl %edi, %edi
cmpl $0x1, (%rsi)
jne 0x3823
cmpb 0x10(%rsi), %al
jne 0x3823
cmpb 0x11(%rsi), %cl
jne 0x3823
movl 0x8(%rdx), %r8d
cmpq %r8, %rdi
jne 0x383e
incq %rdi
addq $0x14, %rsi
cmpq $0x5, %rdi
jne 0x380b
incq %r15
cmpq $0x87, %r15
jne 0x37ec
jmp 0x3845
callq 0x2942
jmp 0x3830
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: check_who_is_dead
void check_who_is_dead(int bid) {
	for(int i = 0; i < USER_CNT; i++) {
		if(battles[bid].users[i].battle_state == BATTLE_STATE_LIVE
		&& battles[bid].users[i].life <= 0) {
			log("user %d@%s is dead\n", i, sessions[i].user_name);
			battles[bid].users[i].battle_state = BATTLE_STATE_DEAD;
			log("send dead info to user %d@%s\n", i, sessions[i].user_name);
			send_to_client(i, SERVER_MESSAGE_YOU_ARE_DEAD);
		}else if(battles[bid].users[i].battle_state == BATTLE_STATE_DEAD){
			battles[bid].users[i].battle_state = BATTLE_STATE_WITNESS;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movslq %edi, %rax
imulq $0xb08, %rax, %rax      # imm = 0xB08
leaq 0x5a88(%rip), %rcx      # 0x92f0
leaq (%rax,%rcx), %rbx
addq $0x10, %rbx
xorl %r14d, %r14d
movl (%rbx), %eax
cmpl $0x3, %eax
je 0x388a
cmpl $0x1, %eax
jne 0x3890
cmpl $0x0, 0xc(%rbx)
jle 0x389f
cmpl $0x3, %eax
jne 0x3890
movl $0x2, (%rbx)
incq %r14
addq $0x14, %rbx
cmpq $0x5, %r14
jne 0x3873
jmp 0x38ac
movq %r14, %rdi
movq %rbx, %rsi
callq 0x299a
jmp 0x3890
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: inform_all_user_battle_state
void inform_all_user_battle_state(int bid) {
	server_message_t sm;
	sm.message = SERVER_MESSAGE_BATTLE_INFORMATION;
	for(int i = 0; i < USER_CNT; i++) {
		if(battles[bid].users[i].battle_state == BATTLE_STATE_LIVE) {
			sm.user_pos[i].x = battles[bid].users[i].pos.x;
			sm.user_pos[i].y = battles[bid].users[i].pos.y;
		}else{
			sm.user_pos[i].x = -1;
			sm.user_pos[i].y = -1;
		}
	}

	for(int i = 0; i < MAX_ITEM; i++) {
		if(battles[bid].items[i].is_used) {
			sm.item_kind[i] = battles[bid].items[i].kind;
			sm.item_pos[i].x = battles[bid].items[i].pos.x;
			sm.item_pos[i].y = battles[bid].items[i].pos.y;
		}else{
			sm.item_kind[i] = ITEM_NONE;
		}
	}

	for(int i = 0; i < USER_CNT; i++) {
		sm.index = i;
		sm.life = battles[bid].users[i].life;
		sm.bullets_num = battles[bid].users[i].nr_bullets;
		if(battles[bid].users[i].battle_state != BATTLE_STATE_UNJOINED) {
			wrap_send(sessions[i].conn, &sm);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movb $0x1e, -0x1cb(%rbp)
movslq %edi, %rax
imulq $0xb08, %rax, %rax      # imm = 0xB08
leaq 0x5a13(%rip), %r14      # 0x92f0
leaq (%rax,%r14), %rcx
addq $0x21, %rcx
movl $0x2, %edx
cmpl $0x1, -0x11(%rcx)
jne 0x3901
movb -0x1(%rcx), %sil
movb %sil, -0x1cb(%rbp,%rdx,2)
movb (%rcx), %sil
jmp 0x390c
movb $-0x1, -0x1cb(%rbp,%rdx,2)
movb $-0x1, %sil
movb %sil, -0x1ca(%rbp,%rdx,2)
incq %rdx
addq $0x14, %rcx
cmpq $0x7, %rdx
jne 0x38ea
leaq (%rax,%r14), %rcx
addq $0x89, %rcx
movl $0x4b, %edx
cmpl $0x0, -0x11(%rcx)
je 0x395c
movb -0x5(%rcx), %sil
movb %sil, -0x208(%rbp,%rdx)
movb -0x1(%rcx), %sil
movb %sil, -0x1cc(%rbp,%rdx,2)
movb (%rcx), %sil
movb %sil, -0x1cb(%rbp,%rdx,2)
jmp 0x3964
movb $0x0, -0x208(%rbp,%rdx)
incq %rdx
addq $0x14, %rcx
cmpq $0xd2, %rdx
jne 0x3931
xorl %r15d, %r15d
addq %rax, %r14
movl $0x1a3, %r13d           # imm = 0x1A3
movb %r15b, -0x1c9(%rbp)
leaq (%r15,%r15,4), %rax
movb 0x1c(%r14,%rax,4), %cl
movb %cl, -0x1ca(%rbp)
movb 0x14(%r14,%rax,4), %cl
movb %cl, -0x1c8(%rbp)
cmpl $0x0, 0x10(%r14,%rax,4)
je 0x39e6
leaq (%r15,%r15,8), %rax
leaq 0x57cc(%rip), %rcx      # 0x9180
movl 0x8(%rcx,%rax,8), %ebx
xorl %r12d, %r12d
imulq $0x1a3, %r12, %rax      # imm = 0x1A3
leaq (%rax,%rbp), %rsi
addq $-0x1cb, %rsi           # imm = 0xFE35
movl $0x1a3, %edx            # imm = 0x1A3
subq %r12, %rdx
movl %ebx, %edi
xorl %ecx, %ecx
callq 0x1070
addq %rax, %r12
cmpq %r13, %r12
jb 0x39bb
incq %r15
cmpq $0x5, %r15
jne 0x3980
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: check_user_registered
int check_user_registered(char *user_name, char *password) {
	for(int i = 0; i < REGISTERED_USER_LIST_SIZE; i++) {
		if(strncmp(user_name, registered_user_list[i].user_name, USERNAME_SIZE - 1) != 0)
			continue;

		if(strncmp(password, registered_user_list[i].password, PASSWORD_SIZE - 1) != 0) {
			logi("user name '%s' sent error password\n", user_name);
			return SERVER_RESPONSE_LOGIN_FAIL_ERROR_PASSWORD;
		}else{
			return SERVER_RESPONSE_LOGIN_SUCCESS;
		}
	}

	logi("user name '%s' hasn't been registered\n", user_name);
	return SERVER_RESPONSE_LOGIN_FAIL_UNREGISTERED_USERID;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x90d7(%rip), %r15      # 0xcaf0
movl $0x6, %edx
movq %r15, %rsi
callq 0x1050
testl %eax, %eax
je 0x3a63
movq $-0x1, %r12
leaq 0x90b8(%rip), %r15      # 0xcaf0
cmpq $0x8, %r12
je 0x3ab3
addq $0xe, %r15
movl $0x6, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1050
incq %r12
testl %eax, %eax
jne 0x3a38
cmpq $0x9, %r12
setae %r12b
jmp 0x3a66
xorl %r12d, %r12d
addq $0x7, %r15
movl $0x6, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x1050
movl %eax, %ecx
movl $0x4, %eax
testl %ecx, %ecx
je 0x3abe
movq 0x5564(%rip), %rax      # 0x8ff0
movq (%rax), %rdi
leaq 0x1cc0(%rip), %rsi      # 0x5756
leaq 0x1cf9(%rip), %rdx      # 0x5796
movl $0x1e7, %ecx            # imm = 0x1E7
movq %rbx, %r8
xorl %eax, %eax
callq 0x10d0
movl $0x8, %eax
jmp 0x3abe
incq %r12
cmpq $0x9, %r12
setae %r12b
testb %r12b, %r12b
jne 0x3acc
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x551d(%rip), %rax      # 0x8ff0
movq (%rax), %rdi
leaq 0x1ccf(%rip), %rsi      # 0x57ac
leaq 0x1cb2(%rip), %rdx      # 0x5796
movl $0x1ee, %ecx            # imm = 0x1EE
movq %rbx, %r8
xorl %eax, %eax
callq 0x10d0
movl $0x7, %eax
jmp 0x3ac3
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: list_all_users
void list_all_users(server_message_t *psm) {
	for(int i = 0; i < USER_CNT; i++) {
		if(query_session_built(i)) {
			log("%s: found '%s' %s\n", __func__, sessions[i].user_name,
					sessions[i].state == USER_STATE_BATTLE ? "in battle" : "");
			psm->all_users[i].user_state = sessions[i].state;
			strncpy(psm->all_users[i].user_name, sessions[i].user_name, USERNAME_SIZE - 1);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
incq %rbx
leaq 0x567b(%rip), %r15      # 0x918c
xorl %r14d, %r14d
cmpl $0x2, (%r15)
jae 0x3b29
incq %r14
addq $0x48, %r15
cmpq $0x5, %r14
jne 0x3b14
jmp 0x3b36
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2a29
jmp 0x3b1a
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: client_command_launch_battle
int client_command_launch_battle(int uid) {
	if(sessions[uid].state == USER_STATE_BATTLE) {
		log("user '%s' who tries to launch battle has been in battle\n", sessions[uid].user_name);
		send_to_client(uid, SERVER_RESPONSE_YOURE_ALREADY_IN_BATTLE);
		return 0;
	}else{
		log("user '%s' tries to launch battle\n", sessions[uid].user_name);
	}

	int bid = get_unalloced_battle();
	client_message_t *pcm = &sessions[uid].cm;

	log("%s launch battle with %s\n", sessions[uid].user_name, pcm->user_name);

	if(bid == -1) {
		loge("fail to create battle for %s and %s\n", sessions[uid].user_name, pcm->user_name);
		send_to_client(uid, SERVER_RESPONSE_LAUNCH_BATTLE_FAIL);
		return 0;
	}else{
		logi("launch battle %d for %s, invite %s\n", bid, sessions[uid].user_name, pcm->user_name);
		user_join_battle(bid, uid);
		invite_friend_to_battle(bid, uid, pcm->user_name);
		launch_battle(bid);
		send_to_client(uid, SERVER_RESPONSE_LAUNCH_BATTLE_SUCCESS);
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
movslq %edi, %rax
leaq (%rax,%rax,8), %rax
leaq 0x5624(%rip), %rcx      # 0x9180
leaq (%rcx,%rax,8), %r8
cmpl $0x3, 0xc(%r8)
movq 0x5484(%rip), %rax      # 0x8ff0
movq (%rax), %rdi
jne 0x3b92
leaq 0x2262(%rip), %rsi      # 0x5dda
leaq 0x22ac(%rip), %rdx      # 0x5e2b
movl $0x2aa, %ecx            # imm = 0x2AA
xorl %eax, %eax
callq 0x10d0
movl $0x10, %esi
jmp 0x3ba6
leaq -0x14(%rbp), %r14
movq %r8, %rsi
movl %ebx, %edx
movq %r14, %rcx
callq 0x2ab7
movl (%r14), %esi
movl %ebx, %edi
callq 0x357d
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movl %edi, %ebx
movslq %edi, %rax
leaq (%rax,%rax,8), %r12
leaq 0x55a4(%rip), %r13      # 0x9180
leaq (%r13,%r12,8), %r14
leaq -0x1cb(%rbp), %r15
movl $0x1a3, %edx            # imm = 0x1A3
movq %r15, %rdi
xorl %esi, %esi
callq 0x10a0
movb $0x1b, (%r15)
leaq -0x1ca(%rbp), %rdi
movl $0x7, %edx
movq %r14, %rsi
callq 0x1040
leaq -0x1c3(%rbp), %rdi
leaq 0x20(,%r12,8), %r15
addq %r13, %r15
movl $0x28, %edx
movq %r15, %rsi
callq 0x1040
cmpb $0x0, -0x7(%r15)
jne 0x3c4e
leaq -0x1cb(%rbp), %rcx
movl %ebx, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2baf
jmp 0x3d1f
leaq 0x19(,%r12,8), %r12
addq %r13, %r12
movq %r12, %rdi
callq 0x1297
movl %eax, %r13d
cmpl $-0x1, %eax
setne %al
cmpl %ebx, %r13d
setne %cl
movq 0x5379(%rip), %rdx      # 0x8ff0
movq (%rdx), %rdi
testb %cl, %al
jne 0x3ca8
leaq 0x24a7(%rip), %rsi      # 0x612c
leaq 0x2484(%rip), %rdx      # 0x6110
movl $0x2f8, %ecx            # imm = 0x2F8
movl %ebx, %r8d
movq %r14, %r9
xorl %eax, %eax
pushq %r15
pushq %r12
callq 0x10d0
addq $0x10, %rsp
jmp 0x3d1f
subq $0x8, %rsp
leaq 0x24bd(%rip), %rsi      # 0x6170
leaq 0x2456(%rip), %rdx      # 0x6110
movq %r12, %r10
xorl %r12d, %r12d
movl $0x2fc, %ecx            # imm = 0x2FC
movl %ebx, %r8d
movq %r14, %r9
xorl %eax, %eax
pushq %r15
pushq %r10
pushq %r13
callq 0x10d0
addq $0x20, %rsp
movslq %r13d, %rax
leaq (%rax,%rax,8), %rax
leaq 0x5496(%rip), %rcx      # 0x9180
movl 0x8(%rcx,%rax,8), %ebx
movl $0x1a3, %r14d           # imm = 0x1A3
imulq $0x1a3, %r12, %rax      # imm = 0x1A3
leaq (%rax,%rbp), %rsi
addq $-0x1cb, %rsi           # imm = 0xFE35
movl $0x1a3, %edx            # imm = 0x1A3
subq %r12, %rdx
movl %ebx, %edi
xorl %ecx, %ecx
callq 0x1070
addq %rax, %r12
cmpq %r14, %r12
jb 0x3cf4
xorl %eax, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/wierton[P]socket-based-naive-game/server.c
// Function: wrap_recv
void wrap_recv(int conn, client_message_t *pcm) {
	size_t total_len = 0;
	while(total_len < sizeof(client_message_t)) {
		size_t len = recv(conn, pcm + total_len, sizeof(client_message_t) - total_len, 0);
		if(len < 0) {
			loge("broken pipe\n");
		}

		total_len += len;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %r14d
xorl %r15d, %r15d
leaq (%r15,%r15,2), %rsi
shlq $0x4, %rsi
addq %rbx, %rsi
movl $0x30, %edx
subq %r15, %rdx
movl %r14d, %edi
xorl %ecx, %ecx
callq 0x1030
addq %rax, %r15
cmpq $0x30, %r15
jb 0x3d46
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq