LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/richarddurbin[P]hash10x/moshmap.c
// Function: usage
void usage (void)
{ fprintf (stderr, "Usage: moshmap <commands>\n") ;
  fprintf (stderr, "Commands are executed in order - set parameters before using them!\n") ;
  fprintf (stderr, "  -K | --kmer <kmer size> [%d]\n", params.k) ;
  fprintf (stderr, "  -W | --window <window> [%d]\n", params.w) ;
  fprintf (stderr, "  -S | --seed <random number seed> [%d]\n", params.s) ;
  fprintf (stderr, "  -B | --tableBits <hash index table bitcount> [%d]\n", params.B) ;
  fprintf (stderr, "  -v | --verbose : toggle verbose mode\n") ;
  fprintf (stderr, "  -t | --threads <number of threads for parallel ops> [%d]\n", numThreads) ;
  fprintf (stderr, "  -o | --output <output filename> : '-' for stdout\n") ;
  fprintf (stderr, "  -f | --referenceFasta <reference fasta file>\n") ;
  fprintf (stderr, "  -w | --referenceWrite <file stem> : writes reference hash files\n") ;
  fprintf (stderr, "  -r | --referenceRead <file stem> : read reference hash files\n") ;
  fprintf (stderr, "  -q | --query <query fasta file>\n") ;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x7c2b(%rip), %r14      # 0x9ff8
movq (%r14), %rcx
leaq 0x3fd3(%rip), %rdi      # 0x63aa
pushq $0x1a
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x11f0
movq (%r14), %rcx
leaq 0x3fd6(%rip), %rdi      # 0x63c5
pushq $0x43
popq %rsi
movq %rbx, %rdx
callq 0x11f0
movq (%r14), %rdi
movl 0x8f4d(%rip), %edx      # 0xb350
leaq 0x3fff(%rip), %rsi      # 0x6409
xorl %eax, %eax
callq 0x1120
movq (%r14), %rdi
movl 0x8f3a(%rip), %edx      # 0xb354
leaq 0x4008(%rip), %rsi      # 0x6429
xorl %eax, %eax
callq 0x1120
movq (%r14), %rdi
movl 0x8f27(%rip), %edx      # 0xb358
leaq 0x4010(%rip), %rsi      # 0x6448
xorl %eax, %eax
callq 0x1120
movq (%r14), %rdi
movl 0x8f14(%rip), %edx      # 0xb35c
leaq 0x4022(%rip), %rsi      # 0x6471
xorl %eax, %eax
callq 0x1120
movq (%r14), %rcx
leaq 0x4046(%rip), %rdi      # 0x64a6
pushq $0x27
popq %rsi
movq %rbx, %rdx
callq 0x11f0
movq (%r14), %rdi
movl 0x7cac(%rip), %edx      # 0xa120
leaq 0x4053(%rip), %rsi      # 0x64ce
xorl %eax, %eax
callq 0x1120
movq (%r14), %rcx
leaq 0x407e(%rip), %rdi      # 0x650a
pushq $0x33
popq %rsi
movq %rbx, %rdx
callq 0x11f0
movq (%r14), %rcx
leaq 0x409d(%rip), %rdi      # 0x653e
pushq $0x2f
popq %rsi
movq %rbx, %rdx
callq 0x11f0
movq (%r14), %rcx
leaq 0x40b8(%rip), %rdi      # 0x656e
pushq $0x42
popq %rsi
movq %rbx, %rdx
callq 0x11f0
movq (%r14), %rcx
leaq 0x40e6(%rip), %rdi      # 0x65b1
pushq $0x3f
popq %rsi
movq %rbx, %rdx
callq 0x11f0
movq (%r14), %rcx
leaq 0x4111(%rip), %rdi      # 0x65f1
pushq $0x22
popq %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x11f0
// File: /workspace/github_c_makefile_star2_O2/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 0x12c9
movl %edi, %eax
imulq $0x48, %rax, %rcx
leaq 0x6ec2(%rip), %rdx      # 0x8180
xorl %eax, %eax
cmpl $0x2, 0xc(%rcx,%rdx)
setae %al
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x2d7d(%rip), %rdi      # 0x4051
leaq 0x2d39(%rip), %rsi      # 0x4014
leaq 0x2d3b(%rip), %rcx      # 0x401d
pushq $0x4a
popq %rdx
callq 0x1090
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/server.c
// Function: user_quit_battle
void user_quit_battle(uint32_t bid, uint32_t uid) {
	assert(bid < USER_CNT && uid < USER_CNT);

	log("user %s quit from battle %d(%d users)\n", sessions[uid].user_name, bid, battles[bid].nr_users);
	battles[bid].nr_users --;
	battles[bid].users[uid].battle_state = BATTLE_STATE_UNJOINED;
	sessions[uid].state = USER_STATE_LOGIN;

	if(battles[bid].nr_users == 0) {
		// disband battle
		log("disband battle %d\n", bid);
		battles[bid].is_alloced = false;
	}else{
		server_message_t sm;
		sm.message = SERVER_MESSAGE_USER_QUIT_BATTLE;
		strncpy(sm.friend_name, sessions[uid].user_name, USERNAME_SIZE - 1);

		for(int i = 0; i < USER_CNT; i++) {
			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 $0x1b8, %rsp            # imm = 0x1B8
cmpl $0x4, %edi
ja 0x141e
cmpl $0x5, %esi
jae 0x141e
movl %edi, %ebx
movq 0x6cd7(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
movl %esi, %r12d
imulq $0x48, %r12, %r13
leaq 0x6e56(%rip), %rax      # 0x8180
leaq (%rax,%r13), %r8
movl %ebx, %eax
imulq $0xb08, %rax, %r14      # imm = 0xB08
leaq 0x6fb2(%rip), %rax      # 0x82f0
leaq (%rax,%r14), %r15
movq 0x8(%r14,%rax), %rax
movq %rax, (%rsp)
leaq 0x2d38(%rip), %rsi      # 0x408a
leaq 0x2d70(%rip), %rdx      # 0x40c9
pushq $0x57
popq %rcx
movq %r8, -0x30(%rbp)
movl %ebx, %r9d
xorl %eax, %eax
callq 0x10d0
imulq $0x14, %r12, %rax
leaq 0x6f7b(%rip), %rcx      # 0x82f0
decq 0x8(%r14,%rcx)
setne %cl
andl $0x0, 0x10(%rax,%r15)
leaq 0x6df6(%rip), %rax      # 0x8180
movl $0x2, 0xc(%r13,%rax)
testb %cl, %cl
je 0x13e3
leaq -0x1d2(%rbp), %rdi
movb $0x1c, -0x1(%rdi)
pushq $0x6
popq %rdx
movq -0x30(%rbp), %rsi
callq 0x1040
pushq $0x10
popq %r14
leaq 0x6dcf(%rip), %r12      # 0x8188
leaq -0x1d3(%rbp), %rbx
cmpq $0x74, %r14
je 0x140c
cmpl $0x0, (%r15,%r14)
je 0x13d9
movl (%r12), %edi
movq %rbx, %rsi
callq 0x143b
addq $0x14, %r14
addq $0x48, %r12
jmp 0x13c0
movq 0x6c06(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
leaq 0x2ce6(%rip), %rsi      # 0x40da
leaq 0x2cce(%rip), %rdx      # 0x40c9
pushq $0x5e
popq %rcx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x10d0
andl $0x0, (%r15)
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2c1a(%rip), %rdi      # 0x403f
leaq 0x2be8(%rip), %rsi      # 0x4014
leaq 0x2c2d(%rip), %rcx      # 0x4060
pushq $0x55
popq %rdx
callq 0x1090
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %r14d
xorl %r15d, %r15d
cmpq $0x1a2, %r15            # imm = 0x1A2
ja 0x1478
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
jmp 0x144e
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/server.c
// Function: user_join_battle_common_part
void user_join_battle_common_part(uint32_t bid, uint32_t uid, uint32_t joined_state) {
	assert(bid < USER_CNT && uid < USER_CNT);

	log("user %s join in battle %d(%d users)\n", sessions[uid].user_name, bid, battles[bid].nr_users);

	if(joined_state == USER_STATE_BATTLE) {
		battles[bid].nr_users ++;
		battles[bid].users[uid].battle_state = BATTLE_STATE_LIVE;
	}else if(joined_state == USER_STATE_WAIT_TO_BATTLE) {
		battles[bid].users[uid].battle_state = BATTLE_STATE_UNJOINED;
	}else{
		loge("check here, other joined_state:%d\n", joined_state);
	}

	battles[bid].users[uid].life = INIT_LIFE;
	battles[bid].users[uid].nr_bullets = INIT_BULLETS;

	sessions[uid].state = joined_state;
	sessions[uid].bid = bid;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x4, %edi
ja 0x157a
cmpl $0x5, %esi
jae 0x157a
movl %edx, %ebx
movl %edi, %r14d
movq 0x6b41(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
movl %esi, %r12d
imulq $0x48, %r12, %rax
leaq 0x6cc0(%rip), %r15      # 0x8180
addq %rax, %r15
movl %r14d, %eax
imulq $0xb08, %rax, %rax      # imm = 0xB08
leaq 0x6e1c(%rip), %rcx      # 0x82f0
leaq (%rcx,%rax), %r13
movq 0x8(%rax,%rcx), %rax
movq %rax, (%rsp)
leaq 0x2c5d(%rip), %rsi      # 0x4145
leaq 0x2c93(%rip), %rdx      # 0x4182
pushq $0x71
popq %rcx
movq %r15, %r8
movl %r14d, %r9d
xorl %eax, %eax
callq 0x10d0
cmpl $0x4, %ebx
je 0x151c
cmpl $0x3, %ebx
jne 0x1553
incq 0x8(%r13)
imulq $0x14, %r12, %rax
movl $0x1, 0x10(%r13,%rax)
jmp 0x1526
imulq $0x14, %r12, %rax
andl $0x0, 0x10(%r13,%rax)
imulq $0x14, %r12, %rax
movl $0x5, 0x1c(%r13,%rax)
movl $0xc, 0x14(%r13,%rax)
movl %ebx, 0xc(%r15)
movl %r14d, 0x10(%r15)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x6a96(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
leaq 0x2c3b(%rip), %rsi      # 0x419f
leaq 0x2c17(%rip), %rdx      # 0x4182
pushq $0x79
popq %rcx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x10d0
jmp 0x1526
leaq 0x2abe(%rip), %rdi      # 0x403f
leaq 0x2a8c(%rip), %rsi      # 0x4014
leaq 0x2b76(%rip), %rcx      # 0x4105
pushq $0x6f
popq %rdx
callq 0x1090
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/server.c
// Function: user_join_battle
void user_join_battle(uint32_t bid, uint32_t uid) {
	int ux = (rand() & 0x7FFF) % BATTLE_W;
	int uy = (rand() & 0x7FFF) % BATTLE_H;
	battles[bid].users[uid].pos.x = ux;
	battles[bid].users[uid].pos.y = uy;
	log("alloc position (%hhu, %hhu) for launcher #%d@%s\n",
			ux, uy, uid, sessions[uid].user_name);

	sessions[uid].state = USER_STATE_BATTLE;

	if(battles[bid].users[uid].battle_state == BATTLE_STATE_UNJOINED) {
		user_join_battle_common_part(bid, uid, USER_STATE_BATTLE);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %r14d
callq 0x1180
andl $0x7fff, %eax           # imm = 0x7FFF
movw $0x3c, %cx
xorl %edx, %edx
divw %cx
movzwl %dx, %r15d
callq 0x1180
andl $0xf, %eax
movl %r14d, -0x2c(%rbp)
movl %r14d, %ecx
movl %ebx, %edx
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
leaq 0x6d10(%rip), %r12      # 0x82f0
addq %rcx, %r12
imulq $0x14, %rdx, %r13
movb %r15b, 0x20(%r13,%r12)
movb %al, 0x21(%r13,%r12)
movq 0x69f8(%rip), %rcx      # 0x7ff0
movq (%rcx), %rdi
imulq $0x48, %rdx, %r14
leaq 0x6b7a(%rip), %rcx      # 0x8180
leaq (%rcx,%r14), %r10
leaq 0x2bcb(%rip), %rsi      # 0x41dc
leaq 0x2c0d(%rip), %rdx      # 0x4225
movl $0x89, %ecx
movl %r15d, %r8d
movl %eax, %r9d
xorl %eax, %eax
pushq %r10
pushq %rbx
callq 0x10d0
popq %rcx
popq %rdx
leaq 0x6b4a(%rip), %rax      # 0x8180
movl $0x3, 0xc(%r14,%rax)
cmpl $0x0, 0x10(%r13,%r12)
je 0x1656
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x3
popq %rdx
movl -0x2c(%rbp), %edi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1483
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %r14d
movl %esi, %eax
imulq $0x48, %rax, %rax
leaq 0x6af3(%rip), %r15      # 0x8180
cmpl $0x4, 0xc(%rax,%r15)
jne 0x16a1
addq %rax, %r15
movl 0x10(%r15), %eax
cmpl %r14d, %eax
jne 0x16b8
pushq $0x4
popq %rdx
movl %r14d, %edi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1483
movq 0x6931(%rip), %rcx      # 0x7ff0
movq (%rcx), %rdi
movl %eax, (%rsp)
leaq 0x2b6a(%rip), %rsi      # 0x4236
leaq 0x2bc3(%rip), %rdx      # 0x4296
movl $0x95, %ecx
movl %ebx, %r8d
movq %r15, %r9
xorl %eax, %eax
callq 0x10d0
movl 0x14(%r15), %edi
pushq $0x17
popq %rsi
movq %r15, %rdx
callq 0x16f6
jmp 0x16a1
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdx, %rbx
movl %esi, %r14d
movslq %edi, %rax
imulq $0x48, %rax, %rax
leaq 0x6a64(%rip), %rcx      # 0x8180
movl 0x8(%rax,%rcx), %r15d
leaq -0x1bc(%rbp), %r12
movl $0x19c, %edx            # imm = 0x19C
movq %r12, %rdi
xorl %esi, %esi
callq 0x10a0
movb %r14b, -0x7(%r12)
leaq -0x1c2(%rbp), %rdi
pushq $0x6
popq %rdx
movq %rbx, %rsi
callq 0x1040
leaq -0x1c3(%rbp), %rsi
movl %r15d, %edi
callq 0x143b
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/server.c
// Function: find_uid_by_user_name
int find_uid_by_user_name(const char *user_name) {
	int ret_uid = -1;
	log("find user '%s'\n", user_name);
	for(int i = 0; i < USER_CNT; i++) {
		if(query_session_built(i)) {
			if(strncmp(user_name, sessions[i].user_name, USERNAME_SIZE - 1) == 0) {
				ret_uid = i;
				break;
			}
		}
	}

	if(ret_uid == -1) {
		logi("fail\n");
	}else{
		logi("found: %d@%s\n", ret_uid, sessions[ret_uid].user_name);
	}

	return ret_uid;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x686b(%rip), %r13      # 0x7ff0
movq (%r13), %rdi
leaq 0x2b22(%rip), %rsi      # 0x42b2
leaq 0x2b43(%rip), %rdx      # 0x42da
xorl %ebx, %ebx
movl $0x9f, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x10d0
leaq 0x69d1(%rip), %r15      # 0x8180
pushq $0x6
popq %r12
cmpq $0x5, %rbx
je 0x17df
movl %ebx, %edi
callq 0x12ac
testl %eax, %eax
je 0x17d6
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1050
testl %eax, %eax
je 0x1802
incq %rbx
addq $0x48, %r15
jmp 0x17b3
movq (%r13), %rdi
leaq 0x2b06(%rip), %rsi      # 0x42f0
leaq 0x2ae9(%rip), %rdx      # 0x42da
movl $0xaa, %ecx
xorl %eax, %eax
callq 0x10d0
pushq $-0x1
popq %rbx
jmp 0x1826
movq (%r13), %rdi
leaq 0x2b05(%rip), %rsi      # 0x4312
leaq 0x2ac6(%rip), %rdx      # 0x42da
movl $0xac, %ecx
movl %ebx, %r8d
movq %r15, %r9
xorl %eax, %eax
callq 0x10d0
movl %ebx, %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/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 %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x6908(%rip), %rdi      # 0x8150
callq 0x1170
leaq 0x6a9c(%rip), %r14      # 0x82f0
xorl %r15d, %r15d
pushq $-0x1
popq %rbx
cmpq $0x5, %r15
je 0x188b
cmpl $0x0, (%r14)
je 0x1872
incq %r15
addq $0xb08, %r14            # imm = 0xB08
jmp 0x185a
movl $0xb08, %edx            # imm = 0xB08
movq %r14, %rdi
xorl %esi, %esi
callq 0x10a0
movl $0x1, (%r14)
movl %r15d, %ebx
leaq 0x68be(%rip), %rdi      # 0x8150
callq 0x1100
movq 0x6752(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
cmpl $-0x1, %ebx
jne 0x18c2
leaq 0x2a8f(%rip), %rsi      # 0x433c
leaq 0x2ad3(%rip), %rdx      # 0x4387
movl $0xbf, %ecx
xorl %eax, %eax
callq 0x10d0
jmp 0x18df
leaq 0x2ad3(%rip), %rsi      # 0x439c
leaq 0x2ab7(%rip), %rdx      # 0x4387
movl $0xc1, %ecx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x10d0
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x682f(%rip), %rdi      # 0x8128
callq 0x1170
leaq 0x6887(%rip), %rcx      # 0x818c
xorl %eax, %eax
pushq $-0x1
popq %rbx
cmpq $0x5, %rax
je 0x1946
cmpl $0x0, (%rcx)
je 0x191e
incq %rax
addq $0x48, %rcx
jmp 0x190a
xorps %xmm0, %xmm0
movups %xmm0, -0xc(%rcx)
movups %xmm0, 0x24(%rcx)
movups %xmm0, 0x14(%rcx)
andq $0x0, 0x34(%rcx)
movups %xmm0, 0x4(%rcx)
movabsq $0x1ffffffff, %rdx      # imm = 0x1FFFFFFFF
movq %rdx, -0x4(%rcx)
movl %eax, %ebx
leaq 0x67db(%rip), %rdi      # 0x8128
callq 0x1100
movq 0x6697(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
cmpl $-0x1, %ebx
jne 0x197d
leaq 0x2a6b(%rip), %rsi      # 0x43d3
leaq 0x2a96(%rip), %rdx      # 0x4405
movl $0xd4, %ecx
xorl %eax, %eax
callq 0x10d0
jmp 0x199a
leaq 0x2a94(%rip), %rsi      # 0x4418
leaq 0x2a7a(%rip), %rdx      # 0x4405
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_O2/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 $0x1a8, %rsp            # imm = 0x1A8
movl %esi, %r12d
movslq %edi, %r14
imulq $0x48, %r14, %rax
leaq 0x67b8(%rip), %rbx      # 0x8180
addq %rax, %rbx
leaq -0x1ca(%rbp), %r13
xorl %r15d, %r15d
movl $0x1a2, %edx            # imm = 0x1A2
movq %r13, %rdi
xorl %esi, %esi
callq 0x10a0
movb %r12b, -0x1(%r13)
movl %r14d, %r14d
leaq 0x6796(%rip), %r12      # 0x8188
leaq -0x1cb(%rbp), %r13
cmpq $0x5, %r15
je 0x1a37
cmpq %r15, %r14
je 0x1a2e
movl %r15d, %edi
callq 0x12ac
testl %eax, %eax
je 0x1a2e
leaq -0x1ca(%rbp), %rdi
movq %rbx, %rsi
pushq $0x6
popq %rdx
callq 0x1040
movl (%r12), %edi
movq %r13, %rsi
callq 0x143b
incq %r15
addq $0x48, %r12
jmp 0x19f9
addq $0x1a8, %rsp            # imm = 0x1A8
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/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
imulq $0x28, %r14, %rax
leaq 0x9fc2(%rip), %rbx      # 0xba20
addq %rax, %rbx
movq %rbx, %rdi
callq 0x1170
imulq $0xb08, %r14, %rax      # imm = 0xB08
leaq 0x6879(%rip), %rcx      # 0x82f0
addq %rax, %rcx
addq $0x78, %rcx
xorl %eax, %eax
pushq $-0x1
popq %r14
cmpq $0x87, %rax
je 0x1aa3
cmpl $0x0, (%rcx)
je 0x1a9a
incq %rax
addq $0x14, %rcx
jmp 0x1a84
movl $0x1, (%rcx)
movl %eax, %r14d
movq %rbx, %rdi
callq 0x1100
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
movl %edi, %ebx
callq 0x1180
movl $0xc8, %ecx
cltd
idivl %ecx
cmpl $0x9, %edx
jne 0x1af7
movslq %ebx, %rax
imulq $0xb08, %rax, %r14      # imm = 0xB08
leaq 0x680d(%rip), %r15      # 0x82f0
cmpl $0xe, 0x74(%r14,%r15)
jg 0x1af7
movl %ebx, %edi
callq 0x1a49
cmpl $-0x1, %eax
jne 0x1b00
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %ebx
addq %r14, %r15
callq 0x1180
pushq $0x4
popq %rcx
cltd
idivl %ecx
movl %edx, %r14d
incl %r14d
movslq %ebx, %rax
imulq $0x14, %rax, %r12
movl %r14d, 0x84(%r15,%r12)
callq 0x1180
andl $0x7fff, %eax           # imm = 0x7FFF
movw $0x3c, %cx
xorl %edx, %edx
divw %cx
movb %dl, 0x88(%r15,%r12)
callq 0x1180
movl %eax, %r10d
andb $0xf, %al
movb %al, 0x89(%r15,%r12)
movq 0x6497(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
movl 0x84(%r15,%r12), %r9d
movzbl 0x88(%r15,%r12), %r11d
andl $0xf, %r10d
leaq 0x28d5(%rip), %rsi      # 0x444d
leaq 0x28ff(%rip), %rdx      # 0x447e
movl $0x106, %ecx            # imm = 0x106
movl %ebx, %r8d
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x10d0
popq %rcx
popq %rdx
cmpl $0x2, %r14d
jne 0x1af7
leaq (%r15,%r12), %rax
addq $0x78, %rax
movl $0x8, 0x8(%rax)
jmp 0x1af7
// File: /workspace/github_c_makefile_star2_O2/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 0x671f(%rip), %rcx      # 0x82f0
leaq (%rax,%rcx), %r12
addq $0x89, %r12
leaq 0x28b1(%rip), %rbx      # 0x4494
leaq 0x28d3(%rip), %r14      # 0x44bd
leaq 0x2413(%rip), %r13      # 0x4004
xorl %r15d, %r15d
cmpq $0x87, %r15
je 0x1c87
cmpl $0x0, -0x11(%r12)
je 0x1c57
cmpl $0x6, -0x5(%r12)
jne 0x1c57
movl -0xd(%r12), %eax
cmpq $0x3, %rax
ja 0x1c47
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movb $-0x1, %al
jmp 0x1c43
movb -0x1(%r12), %al
decb %al
jmp 0x1c3a
movb -0x1(%r12), %al
incb %al
movb %al, -0x1(%r12)
jmp 0x1c4c
movb $0x1, %al
addb %al, (%r12)
movb -0x1(%r12), %al
cmpb $0x3b, %al
ja 0x1c60
cmpb $0x10, (%r12)
jae 0x1c60
incq %r15
addq $0x14, %r12
jmp 0x1bf4
movq 0x6389(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
movq %rbx, %rsi
movq %r14, %rdx
movl $0x11e, %ecx            # imm = 0x11E
movl %r15d, %r8d
xorl %eax, %eax
callq 0x10d0
andl $0x0, -0x11(%r12)
jmp 0x1c57
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/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 %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movslq %edi, %rax
imulq $0xb08, %rax, %rax      # imm = 0xB08
leaq 0x6638(%rip), %rcx      # 0x82f0
leaq (%rcx,%rax), %r11
leaq (%rax,%rcx), %r10
addq $0x78, %r10
leaq 0x21(%rax,%rcx), %rdi
leaq 0x64b0(%rip), %r8       # 0x8180
movq 0x6319(%rip), %r9       # 0x7ff0
leaq 0x27ec(%rip), %rsi      # 0x44ca
leaq 0x2818(%rip), %rdx      # 0x44fd
xorl %ebx, %ebx
cmpq $0x87, %rbx
je 0x1df6
imulq $0x14, %rbx, %r12
cmpl $0x0, (%r10,%r12)
je 0x1dba
addq %r10, %r12
cmpl $0x4, 0xc(%r12)
jne 0x1dba
movb 0x10(%r12), %al
movb 0x11(%r12), %cl
movq %rdi, %r14
movq %r8, %r15
xorl %r13d, %r13d
cmpq $0x5, %r13
je 0x1dba
cmpl $0x1, -0x11(%r14)
jne 0x1d41
cmpb -0x1(%r14), %al
jne 0x1d41
cmpb (%r14), %cl
je 0x1d4e
incq %r13
addq $0x48, %r15
addq $0x14, %r14
jmp 0x1d25
movq %rdi, -0x30(%rbp)
movq %r10, -0x38(%rbp)
movq %r11, -0x40(%rbp)
addl $0x3, -0x5(%r14)
movq (%r9), %rdi
movl $0x135, %ecx            # imm = 0x135
movl %r13d, %r8d
movq %r15, %r9
xorl %eax, %eax
callq 0x10d0
cmpl $0x15, -0x5(%r14)
jge 0x1dc2
andl $0x0, (%r12)
movq -0x40(%rbp), %r14
decl 0x74(%r14)
movl %r13d, %edi
pushq $0x22
popq %rsi
callq 0x1e05
movq %r14, %r11
movq -0x38(%rbp), %r10
movq -0x30(%rbp), %rdi
leaq 0x63db(%rip), %r8       # 0x8180
movq 0x6244(%rip), %r9       # 0x7ff0
leaq 0x2717(%rip), %rsi      # 0x44ca
leaq 0x2743(%rip), %rdx      # 0x44fd
incq %rbx
jmp 0x1ce7
movq 0x6227(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
leaq 0x2743(%rip), %rsi      # 0x4516
leaq 0x2723(%rip), %rdx      # 0x44fd
movl $0x137, %ecx            # imm = 0x137
movl %r13d, %r8d
movq %r15, %r9
xorl %eax, %eax
callq 0x10d0
movl $0x14, -0x5(%r14)
jmp 0x1d7b
addq $0x18, %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/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 %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movl %esi, %ebx
movslq %edi, %rax
imulq $0x48, %rax, %rax
leaq 0x635b(%rip), %rcx      # 0x8180
movl 0x8(%rax,%rcx), %r14d
leaq -0x1ba(%rbp), %r15
movl $0x1a2, %edx            # imm = 0x1A2
movq %r15, %rdi
xorl %esi, %esi
callq 0x10a0
movb %bl, -0x1(%r15)
leaq -0x1bb(%rbp), %rsi
movl %r14d, %edi
callq 0x143b
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x6470(%rip), %rcx      # 0x82f0
leaq (%rcx,%rax), %r10
leaq (%rax,%rcx), %r14
addq $0x78, %r14
leaq 0x21(%rax,%rcx), %r15
leaq 0x62e8(%rip), %rdi      # 0x8180
movq 0x6151(%rip), %r8       # 0x7ff0
leaq 0x26ab(%rip), %rsi      # 0x4551
leaq 0x26dc(%rip), %rdx      # 0x4589
xorl %r13d, %r13d
cmpq $0x87, %r13
je 0x1fa5
imulq $0x14, %r13, %rbx
cmpl $0x0, (%r14,%rbx)
je 0x1f5b
addq %r14, %rbx
cmpl $0x2, 0xc(%rbx)
jne 0x1f5b
movb 0x10(%rbx), %al
movb 0x11(%rbx), %cl
movq %r15, %r11
movq %rdi, %r9
xorl %r12d, %r12d
cmpq $0x5, %r12
je 0x1f5b
cmpl $0x1, -0x11(%r11)
jne 0x1f00
cmpb -0x1(%r11), %al
jne 0x1f00
cmpb (%r11), %cl
je 0x1f0d
incq %r12
addq $0x48, %r9
addq $0x14, %r11
jmp 0x1ee8
decl -0x5(%r11)
decl 0x8(%rbx)
movq (%r8), %rdi
movq %r10, -0x30(%rbp)
movl $0x156, %ecx            # imm = 0x156
movl %r12d, %r8d
xorl %eax, %eax
callq 0x10d0
movl %r12d, %edi
pushq $0x21
popq %rsi
callq 0x1e05
leaq 0x264d(%rip), %rdx      # 0x4589
leaq 0x260e(%rip), %rsi      # 0x4551
movq 0x60a6(%rip), %r8       # 0x7ff0
leaq 0x622f(%rip), %rdi      # 0x8180
movq -0x30(%rbp), %r10
cmpl $0x0, 0x8(%rbx)
jle 0x1f63
incq %r13
jmp 0x1eb0
movq (%r8), %rdi
leaq 0x2636(%rip), %rsi      # 0x45a3
movl $0x159, %ecx            # imm = 0x159
movl %r13d, %r8d
xorl %eax, %eax
callq 0x10d0
leaq 0x2606(%rip), %rdx      # 0x4589
leaq 0x25c7(%rip), %rsi      # 0x4551
movq 0x605f(%rip), %r8       # 0x7ff0
leaq 0x61e8(%rip), %rdi      # 0x8180
movq -0x30(%rbp), %r10
andl $0x0, (%rbx)
decl 0x74(%r10)
jmp 0x1f5b
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/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 %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movslq %edi, %rax
imulq $0xb08, %rax, %rax      # imm = 0xB08
leaq 0x631a(%rip), %rcx      # 0x82f0
leaq (%rax,%rcx), %r10
addq $0x78, %r10
leaq 0x21(%rax,%rcx), %r9
leaq 0x6196(%rip), %rdi      # 0x8180
movq 0x5fff(%rip), %r8       # 0x7ff0
leaq 0x25da(%rip), %rsi      # 0x45d2
leaq 0x2607(%rip), %rdx      # 0x4606
xorl %r12d, %r12d
cmpq $0x87, %r12
je 0x20f4
imulq $0x14, %r12, %r14
cmpl $0x0, (%r10,%r14)
je 0x20b9
addq %r10, %r14
cmpl $0x1, 0xc(%r14)
jne 0x20b9
movb 0x10(%r14), %al
movb 0x11(%r14), %cl
movq %r9, %rbx
movq %rdi, %r15
xorl %r13d, %r13d
cmpq $0x5, %r13
je 0x20b9
cmpl $0x1, -0x11(%rbx)
jne 0x2052
cmpb -0x1(%rbx), %al
jne 0x2052
cmpb (%rbx), %cl
je 0x205f
incq %r13
addq $0x48, %r15
addq $0x14, %rbx
jmp 0x203d
movq %r9, -0x30(%rbp)
movq %r10, -0x38(%rbp)
addl $0x5, -0xd(%rbx)
movq (%r8), %rdi
movl $0x174, %ecx            # imm = 0x174
movl %r13d, %r8d
movq %r15, %r9
xorl %eax, %eax
callq 0x10d0
cmpl $0x19, -0xd(%rbx)
jge 0x20c1
movl %r13d, %edi
pushq $0x23
popq %rsi
callq 0x1e05
andl $0x0, (%r14)
movq -0x38(%rbp), %r10
movq -0x30(%rbp), %r9
leaq 0x60dc(%rip), %rdi      # 0x8180
movq 0x5f45(%rip), %r8       # 0x7ff0
leaq 0x2520(%rip), %rsi      # 0x45d2
leaq 0x254d(%rip), %rdx      # 0x4606
incq %r12
jmp 0x2002
movq 0x5f28(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
leaq 0x254a(%rip), %rsi      # 0x461c
leaq 0x252d(%rip), %rdx      # 0x4606
movl $0x176, %ecx            # imm = 0x176
movl %r13d, %r8d
movq %r15, %r9
xorl %eax, %eax
callq 0x10d0
movl $0x18, -0xd(%rbx)
jmp 0x2086
addq $0x18, %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/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movslq %edi, %rax
imulq $0xb08, %rax, %rax      # imm = 0xB08
leaq 0x61ce(%rip), %rcx      # 0x82f0
leaq (%rax,%rcx), %r13
addq $0x78, %r13
leaq 0x21(%rax,%rcx), %rbx
leaq 0x604a(%rip), %rdi      # 0x8180
movq 0x5eb3(%rip), %r8       # 0x7ff0
leaq 0x2518(%rip), %rsi      # 0x465c
leaq 0x2540(%rip), %rdx      # 0x468b
xorl %r15d, %r15d
cmpq $0x87, %r15
je 0x2201
imulq $0x14, %r15, %r14
cmpl $0x0, (%r13,%r14)
je 0x21f9
addq %r13, %r14
cmpl $0x6, 0xc(%r14)
jne 0x21f9
movb 0x10(%r14), %al
movb 0x11(%r14), %cl
movq %rbx, %r11
movq %rdi, %r9
xorl %r12d, %r12d
cmpq $0x5, %r12
je 0x21f9
cmpl $0x1, -0x11(%r11)
jne 0x21ab
cmpb -0x1(%r11), %al
jne 0x21ab
cmpb (%r11), %cl
jne 0x21ab
movl 0x8(%r14), %r10d
cmpq %r10, %r12
jne 0x21b8
incq %r12
addq $0x48, %r9
addq $0x14, %r11
jmp 0x218a
decl -0x5(%r11)
movq (%r8), %rdi
movl $0x194, %ecx            # imm = 0x194
movl %r12d, %r8d
xorl %eax, %eax
callq 0x10d0
movl %r12d, %edi
pushq $0x20
popq %rsi
callq 0x1e05
leaq 0x24ab(%rip), %rdx      # 0x468b
leaq 0x2475(%rip), %rsi      # 0x465c
movq 0x5e02(%rip), %r8       # 0x7ff0
leaq 0x5f8b(%rip), %rdi      # 0x8180
andl $0x0, (%r14)
incq %r15
jmp 0x214e
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/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq %edi, %rax
imulq $0xb08, %rax, %rax      # imm = 0xB08
leaq 0x60c1(%rip), %rcx      # 0x82f0
leaq (%rax,%rcx), %r12
addq $0x10, %r12
leaq 0x5f42(%rip), %rbx      # 0x8180
leaq 0x245b(%rip), %r13      # 0x46a0
xorl %r14d, %r14d
cmpq $0x5, %r14
je 0x22e8
movl (%r12), %eax
cmpl $0x3, %eax
je 0x22d0
cmpl $0x1, %eax
jne 0x22d8
cmpl $0x0, 0xc(%r12)
jg 0x22d8
movq 0x5d81(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
movq %r13, %rsi
leaq 0x2450(%rip), %r15      # 0x46cc
movq %r15, %rdx
movl $0x1a1, %ecx            # imm = 0x1A1
movl %r14d, %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0x10d0
movl $0x3, (%r12)
movq 0x5d50(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
leaq 0x2434(%rip), %rsi      # 0x46de
movq %r15, %rdx
pushq $0x1f
popq %r15
movl $0x1a3, %ecx            # imm = 0x1A3
movl %r14d, %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0x10d0
movl %r14d, %edi
movl %r15d, %esi
callq 0x1e05
jmp 0x22d8
movl $0x2, (%r12)
incq %r14
addq $0x48, %rbx
addq $0x14, %r12
jmp 0x2248
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/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 %r12
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movb $0x1e, -0x1c3(%rbp)
movslq %edi, %rax
imulq $0xb08, %rax, %rax      # imm = 0xB08
leaq 0x5fcf(%rip), %rcx      # 0x82f0
leaq (%rax,%rcx), %rdx
addq $0x21, %rdx
pushq $0x2
popq %rsi
cmpq $0x7, %rsi
je 0x2365
cmpl $0x1, -0x11(%rdx)
jne 0x2349
movb -0x1(%rdx), %dil
movb %dil, -0x1c3(%rbp,%rsi,2)
movb (%rdx), %dil
jmp 0x2354
movb $-0x1, -0x1c3(%rbp,%rsi,2)
movb $-0x1, %dil
movb %dil, -0x1c2(%rbp,%rsi,2)
incq %rsi
addq $0x14, %rdx
jmp 0x232c
leaq (%rax,%rcx), %rdx
addq $0x89, %rdx
pushq $0x4b
popq %rsi
cmpq $0xd2, %rsi
je 0x23b8
cmpl $0x0, -0x11(%rdx)
je 0x23a7
movb -0x5(%rdx), %dil
movb %dil, -0x200(%rbp,%rsi)
movb -0x1(%rdx), %dil
movb %dil, -0x1c4(%rbp,%rsi,2)
movb (%rdx), %dil
movb %dil, -0x1c3(%rbp,%rsi,2)
jmp 0x23af
movb $0x0, -0x200(%rbp,%rsi)
incq %rsi
addq $0x14, %rdx
jmp 0x2373
leaq (%rax,%rcx), %r14
addq $0x1c, %r14
leaq 0x5dc1(%rip), %r15      # 0x8188
xorl %r12d, %r12d
leaq -0x1c3(%rbp), %rbx
cmpq $0x5, %r12
je 0x2410
movb %r12b, -0x1c1(%rbp)
movb (%r14), %al
movb %al, -0x1c2(%rbp)
movb -0x8(%r14), %al
movb %al, -0x1c0(%rbp)
cmpl $0x0, -0xc(%r14)
je 0x2403
movl (%r15), %edi
movq %rbx, %rsi
callq 0x143b
incq %r12
addq $0x14, %r14
addq $0x48, %r15
jmp 0x23d1
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/server.c
// Function: battle_ruler
void *battle_ruler(void *args) {
	int bid = (int)(uintptr_t)args;
	log("battle ruler for battle #%d\n", bid);
	// FIXME: battle re-alloced before exiting loop 
	while(battles[bid].is_alloced) {
		move_bullets(bid);
		check_who_get_blood_vial(bid);
		check_who_traped_in_magma(bid);
		check_who_got_charger(bid);
		check_who_is_shooted(bid);
		check_who_is_dead(bid);
		
		random_generate_items(bid);

		inform_all_user_battle_state(bid);

		usleep(50000);
	}
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x5bbf(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
leaq 0x22d9(%rip), %rsi      # 0x4714
leaq 0x2307(%rip), %rdx      # 0x4749
movl $0x1ce, %ecx            # imm = 0x1CE
movl %ebx, %r8d
xorl %eax, %eax
callq 0x10d0
movslq %ebx, %rax
imulq $0xb08, %rax, %rax      # imm = 0xB08
leaq 0x5e8e(%rip), %r14      # 0x82f0
addq %rax, %r14
cmpl $0x0, (%r14)
je 0x24af
movl %ebx, %edi
callq 0x1bb2
movl %ebx, %edi
callq 0x1c96
movl %ebx, %edi
callq 0x1e61
movl %ebx, %edi
callq 0x1fb4
movl %ebx, %edi
callq 0x2103
movl %ebx, %edi
callq 0x2210
movl %ebx, %edi
callq 0x1ab3
movl %ebx, %edi
callq 0x22f7
movl $0xc350, %edi           # imm = 0xC350
callq 0x1190
jmp 0x2465
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x961f(%rip), %rsi      # 0xbaf0
xorl %r12d, %r12d
pushq $0x6
popq %r15
addq $-0xe, %r12
cmpq $-0x9a, %r12
je 0x252a
leaq 0xe(%rsi), %r13
movq %rbx, %rdi
movq %r15, %rdx
callq 0x1050
movq %r13, %rsi
testl %eax, %eax
jne 0x24d8
leaq 0x95ee(%rip), %rsi      # 0xbaf0
subq %r12, %rsi
addq $-0x7, %rsi
pushq $0x6
popq %rdx
movq %r14, %rdi
callq 0x1050
testl %eax, %eax
jne 0x2555
pushq $0x4
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x5abf(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
leaq 0x2271(%rip), %rsi      # 0x47ac
leaq 0x2254(%rip), %rdx      # 0x4796
movl $0x1ee, %ecx            # imm = 0x1EE
movq %rbx, %r8
xorl %eax, %eax
callq 0x10d0
pushq $0x7
jmp 0x251a
movq 0x5a94(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
leaq 0x21f0(%rip), %rsi      # 0x4756
leaq 0x2229(%rip), %rdx      # 0x4796
movl $0x1e7, %ecx            # imm = 0x1E7
movq %rbx, %r8
xorl %eax, %eax
callq 0x10d0
pushq $0x8
jmp 0x251a
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/server.c
// Function: launch_battle
void launch_battle(int bid) {
	pthread_t thread;

	log("try to create battle_ruler thread\n");
	if(pthread_create(&thread, NULL, battle_ruler, (void *)(uintptr_t)bid) == -1) {
		eprintf("fail to launch battle\n");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
movq 0x5a5c(%rip), %r14      # 0x7ff0
movq (%r14), %rdi
leaq 0x2251(%rip), %rsi      # 0x47ef
leaq 0x2895(%rip), %rdx      # 0x4e3a
movl $0x1f5, %ecx            # imm = 0x1F5
xorl %eax, %eax
callq 0x10d0
movslq %ebx, %rcx
leaq -0x19b(%rip), %rdx      # 0x2420
leaq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x1130
cmpl $-0x1, %eax
je 0x25d4
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq (%r14), %rdi
leaq 0x224c(%rip), %rsi      # 0x482a
leaq 0x2855(%rip), %rdx      # 0x4e3a
movl $0x1f7, %ecx            # imm = 0x1F7
xorl %eax, %eax
callq 0x10d0
xorl %edi, %edi
callq 0x1150
// File: /workspace/github_c_makefile_star2_O2/wierton[P]socket-based-naive-game/server.c
// Function: client_command_user_logout
int client_command_user_logout(int uid) {
	if(sessions[uid].state == USER_STATE_BATTLE
	|| sessions[uid].state == USER_STATE_WAIT_TO_BATTLE) {
		log("user %d@%s tries to logout was in battle\n", uid, sessions[uid].user_name);
		user_quit_battle(sessions[uid].bid, uid);
	}

	log("user %d@%s logout\n", uid, sessions[uid].user_name);
	sessions[uid].state = USER_STATE_NOT_LOGIN;
	inform_friends(uid, SERVER_MESSAGE_FRIEND_LOGOUT);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edi, %ebx
movslq %edi, %rax
imulq $0x48, %rax, %rax
leaq 0x57cd(%rip), %rcx      # 0x8180
leaq (%rcx,%rax), %r14
movl 0xc(%rax,%rcx), %eax
addl $-0x3, %eax
cmpl $0x1, %eax
ja 0x29f8
movq 0x5626(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
leaq 0x212f(%rip), %rsi      # 0x4b03
leaq 0x216a(%rip), %rdx      # 0x4b45
movl $0x24d, %ecx            # imm = 0x24D
movl %ebx, %r8d
movq %r14, %r9
xorl %eax, %eax
callq 0x10d0
movl 0x10(%r14), %edi
movl %ebx, %esi
callq 0x12ea
movq 0x55f1(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
leaq 0x2157(%rip), %rsi      # 0x4b60
leaq 0x2135(%rip), %rdx      # 0x4b45
movl $0x251, %ecx            # imm = 0x251
movl %ebx, %r8d
movq %r14, %r9
xorl %eax, %eax
callq 0x10d0
movl $0x1, 0xc(%r14)
pushq $0x15
popq %rsi
movl %ebx, %edi
callq 0x19a3
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x1
popq %r13
leaq 0x5729(%rip), %r14      # 0x8180
leaq 0x2158(%rip), %r12      # 0x4bb6
xorl %r15d, %r15d
cmpq $0x5, %r15
je 0x2adb
movl %r15d, %edi
callq 0x12ac
testl %eax, %eax
jne 0x2a80
incq %r15
addq $0x8, %r13
addq $0x48, %r14
jmp 0x2a61
cmpl $0x3, 0xc(%r14)
movq 0x5564(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
leaq 0x2c2a(%rip), %rax      # 0x56c0
leaq 0x2128(%rip), %rcx      # 0x4bc5
cmoveq %rcx, %rax
movq %rax, (%rsp)
leaq 0x20df(%rip), %rsi      # 0x4b8b
movq %r12, %rdx
movl $0x25b, %ecx            # imm = 0x25B
movq %r12, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0x10d0
movb 0xc(%r14), %al
leaq (%rbx,%r13), %rdi
movb %al, 0x8(%rbx,%r15,8)
movq %r14, %rsi
pushq $0x6
popq %rdx
callq 0x1040
jmp 0x2a73
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/server.c
// Function: client_command_fetch_all_users
int client_command_fetch_all_users(int uid) {
	char *user_name = sessions[uid].user_name;
	log("user %d@'%s' tries to fetch all users' info\n", uid, user_name);

	if(!query_session_built(uid)) {
		logi("user %d@'%s' who tries to list users hasn't login\n", uid, user_name);
		send_to_client(uid, SERVER_RESPONSE_YOU_HAVE_NOT_LOGIN);
		return 0;
	}

	server_message_t sm;
	memset(&sm, 0, sizeof(server_message_t));
	list_all_users(&sm);
	sm.response = SERVER_RESPONSE_ALL_USERS_INFO;

	wrap_send(sessions[uid].conn, &sm);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movl %edi, %r14d
movslq %edi, %r15
imulq $0x48, %r15, %rax
leaq 0x5673(%rip), %rbx      # 0x8180
addq %rax, %rbx
movq 0x54d9(%rip), %r12      # 0x7ff0
movq (%r12), %rdi
leaq 0x20ad(%rip), %rsi      # 0x4bcf
leaq 0x20eb(%rip), %rdx      # 0x4c14
movl $0x264, %ecx            # imm = 0x264
movl %r15d, %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0x10d0
movl %r15d, %edi
callq 0x12ac
testl %eax, %eax
je 0x2b86
leaq -0x1c3(%rbp), %r14
movl $0x1a3, %edx            # imm = 0x1A3
movq %r14, %rdi
xorl %esi, %esi
callq 0x10a0
movq %r14, %rdi
callq 0x2a3b
movb $0xb, (%r14)
movl 0x8(%rbx), %edi
movq %r14, %rsi
callq 0x143b
xorl %eax, %eax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq (%r12), %rdi
leaq 0x20a2(%rip), %rsi      # 0x4c33
leaq 0x207c(%rip), %rdx      # 0x4c14
movl $0x267, %ecx            # imm = 0x267
movl %r14d, %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0x10d0
pushq $0x6
popq %rsi
movl %r14d, %edi
callq 0x1e05
jmp 0x2b74