// File: /workspace/github_c_makefile_star2_O0/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
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
callq 0x11a0
movl $0xc8, %ecx
cltd
idivl %ecx
cmpl $0x9, %edx
je 0x1f62
jmp 0x2125
movslq -0x4(%rbp), %rcx
leaq 0x8423(%rip), %rax      # 0xa390
imulq $0xb08, %rcx, %rcx      # imm = 0xB08
addq %rcx, %rax
cmpl $0xf, 0x74(%rax)
jl 0x1f82
jmp 0x2125
movl -0x4(%rbp), %edi
callq 0x1e70
movl %eax, -0x8(%rbp)
cmpl $-0x1, -0x8(%rbp)
jne 0x1f98
jmp 0x2125
callq 0x11a0
movl $0x4, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movl %edx, -0xc(%rbp)
movl -0xc(%rbp), %ecx
movslq -0x4(%rbp), %rdx
leaq 0x83d7(%rip), %rax      # 0xa390
imulq $0xb08, %rdx, %rdx      # imm = 0xB08
addq %rdx, %rax
addq $0x78, %rax
movslq -0x8(%rbp), %rdx
imulq $0x14, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
callq 0x11a0
andl $0x7fff, %eax           # imm = 0x7FFF
movl $0x3c, %ecx
cltd
idivl %ecx
movb %dl, %cl
movslq -0x4(%rbp), %rdx
leaq 0x839c(%rip), %rax      # 0xa390
imulq $0xb08, %rdx, %rdx      # imm = 0xB08
addq %rdx, %rax
addq $0x78, %rax
movslq -0x8(%rbp), %rdx
imulq $0x14, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x10(%rax)
callq 0x11a0
andl $0x7fff, %eax           # imm = 0x7FFF
movl $0x10, %ecx
cltd
idivl %ecx
movb %dl, %cl
movslq -0x4(%rbp), %rdx
leaq 0x8361(%rip), %rax      # 0xa390
imulq $0xb08, %rdx, %rdx      # imm = 0xB08
addq %rdx, %rax
addq $0x78, %rax
movslq -0x8(%rbp), %rdx
imulq $0x14, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0x11(%rax)
movq 0x7fa6(%rip), %rax      # 0x9ff8
movq (%rax), %rdi
movl -0x8(%rbp), %r8d
movslq -0x4(%rbp), %rcx
leaq 0x832c(%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 0xc(%rax), %r9d
movslq -0x4(%rbp), %rcx
leaq 0x8304(%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), %r10d
movslq -0x4(%rbp), %rcx
leaq 0x82db(%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
leaq 0x4374(%rip), %rsi      # 0x644d
leaq 0x439e(%rip), %rdx      # 0x647e
movl $0x106, %ecx            # imm = 0x106
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x10f0
cmpl $0x2, -0xc(%rbp)
jne 0x2125
movslq -0x4(%rbp), %rcx
leaq 0x828b(%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 $0x8, 0x8(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)