// File: /workspace/github_c_makefile_star2_O0/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
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movl $0x0, -0x8(%rbp)
cmpl $0x87, -0x8(%rbp)
jge 0x2be9
movslq -0x4(%rbp), %rcx
leaq 0x7a46(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
addq $0x78, %rax
movslq -0x8(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, (%rax)
je 0x2992
movslq -0x4(%rbp), %rcx
leaq 0x7a1d(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
addq $0x78, %rax
movslq -0x8(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
cmpl $0x1, 0xc(%rax)
je 0x2997
jmp 0x2bdb
movslq -0x4(%rbp), %rcx
leaq 0x79ee(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
addq $0x78, %rax
movslq -0x8(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movzbl 0x10(%rax), %eax
movl %eax, -0xc(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x79c3(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
addq $0x78, %rax
movslq -0x8(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movzbl 0x11(%rax), %eax
movl %eax, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x5, -0x14(%rbp)
jge 0x2bd9
movslq -0x4(%rbp), %rcx
leaq 0x7987(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
addq $0x10, %rax
movslq -0x14(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
cmpl $0x1, (%rax)
je 0x2a2c
jmp 0x2bcb
movslq -0x4(%rbp), %rcx
leaq 0x7959(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
addq $0x10, %rax
movslq -0x14(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movzbl 0x10(%rax), %eax
movl %eax, -0x18(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x792e(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
addq $0x10, %rax
movslq -0x14(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movzbl 0x11(%rax), %eax
movl %eax, -0x1c(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x18(%rbp), %eax
jne 0x2bc9
movl -0x10(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0x2bc9
movslq -0x4(%rbp), %rcx
leaq 0x78eb(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
addq $0x10, %rax
movslq -0x14(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
addl $0x5, %ecx
movl %ecx, 0x4(%rax)
movq 0x752a(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
movl -0x14(%rbp), %r8d
movslq -0x14(%rbp), %rax
leaq 0x7740(%rip), %r9       # 0xa220
imulq $0x48, %rax, %rax
addq %rax, %r9
leaq 0x3ae4(%rip), %rsi      # 0x65d2
leaq 0x3b11(%rip), %rdx      # 0x6606
movl $0x174, %ecx            # imm = 0x174
movb $0x0, %al
callq 0x10f0
movslq -0x4(%rbp), %rcx
leaq 0x7884(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
addq $0x10, %rax
movslq -0x14(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
cmpl $0x18, 0x4(%rax)
jle 0x2b90
movq 0x74c6(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
movl -0x14(%rbp), %r8d
movslq -0x14(%rbp), %rax
leaq 0x76dc(%rip), %r9       # 0xa220
imulq $0x48, %rax, %rax
addq %rax, %r9
leaq 0x3aca(%rip), %rsi      # 0x661c
leaq 0x3aad(%rip), %rdx      # 0x6606
movl $0x176, %ecx            # imm = 0x176
movb $0x0, %al
callq 0x10f0
movslq -0x4(%rbp), %rcx
leaq 0x7820(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
addq $0x10, %rax
movslq -0x14(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movl $0x18, 0x4(%rax)
movl -0x14(%rbp), %edi
movl $0x23, %esi
callq 0x25e0
movslq -0x4(%rbp), %rcx
leaq 0x77e8(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
addq $0x78, %rax
movslq -0x8(%rbp), %rcx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movl $0x0, (%rax)
jmp 0x2bd9
jmp 0x2bcb
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x29f4
jmp 0x2bdb
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x2932
addq $0x20, %rsp
popq %rbp
retq
nop