// File: /workspace/github_c_makefile_star2_O0/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
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
cmpl $0x5, -0x4(%rbp)
jae 0x160f
cmpl $0x5, -0x8(%rbp)
jae 0x160f
jmp 0x162e
leaq 0x4a29(%rip), %rdi      # 0x603f
leaq 0x49f7(%rip), %rsi      # 0x6014
movl $0x6f, %edx
leaq 0x4adc(%rip), %rcx      # 0x6105
callq 0x10a0
movq 0x89c3(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
movl -0x8(%rbp), %eax
leaq 0x8bde(%rip), %r8       # 0xa220
imulq $0x48, %rax, %rax
addq %rax, %r8
movl -0x4(%rbp), %r9d
movl -0x4(%rbp), %eax
movl %eax, %ecx
leaq 0x8d37(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
movq 0x8(%rax), %rax
leaq 0x4ad7(%rip), %rsi      # 0x6145
leaq 0x4b0d(%rip), %rdx      # 0x6182
movl $0x71, %ecx
movq %rax, (%rsp)
movb $0x0, %al
callq 0x10f0
cmpl $0x3, -0xc(%rbp)
jne 0x16d9
movl -0x4(%rbp), %eax
movl %eax, %ecx
leaq 0x8cf9(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movl -0x4(%rbp), %eax
movl %eax, %ecx
leaq 0x8cd7(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
addq $0x10, %rax
movl -0x8(%rbp), %ecx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movl $0x1, (%rax)
jmp 0x1735
cmpl $0x4, -0xc(%rbp)
jne 0x170b
movl -0x4(%rbp), %eax
movl %eax, %ecx
leaq 0x8ca5(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
addq $0x10, %rax
movl -0x8(%rbp), %ecx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movl $0x0, (%rax)
jmp 0x1733
movq 0x88e6(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
movl -0xc(%rbp), %r8d
leaq 0x4a7f(%rip), %rsi      # 0x619f
leaq 0x4a5b(%rip), %rdx      # 0x6182
movl $0x79, %ecx
movb $0x0, %al
callq 0x10f0
jmp 0x1735
movl -0x4(%rbp), %eax
movl %eax, %ecx
leaq 0x8c4f(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
addq $0x10, %rax
movl -0x8(%rbp), %ecx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movl $0x5, 0xc(%rax)
movl -0x4(%rbp), %eax
movl %eax, %ecx
leaq 0x8c24(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
addq $0x10, %rax
movl -0x8(%rbp), %ecx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movl $0xc, 0x4(%rax)
movl -0xc(%rbp), %ecx
movl -0x8(%rbp), %eax
movl %eax, %edx
leaq 0x8a86(%rip), %rax      # 0xa220
imulq $0x48, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
movl -0x4(%rbp), %ecx
movl -0x8(%rbp), %eax
movl %eax, %edx
leaq 0x8a6d(%rip), %rax      # 0xa220
imulq $0x48, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)