// File: /workspace/github_c_makefile_star2_O0/S01den[P]Lost_CavernRL/item.c
// Function: setObjects
void setObjects(Map map[LONGUEUR][LARGEUR], Weapons listWeapons[], Weapons weponsOnFloor[], int nbrMaxWeapons, int *nbrWeapons, Armor armorList[], Armor armorOnFloor[], int nbrMaxArmor, int *nbrArmors)
{
	srand(time(NULL));

	int i = 0;
	int indice = 0;

	*nbrWeapons = rand()%nbrMaxWeapons+1;
	*nbrArmors = rand()%nbrMaxArmor+1;

	for(i = 0; i < *nbrWeapons; i++)
	{
		int rarity = rand()%100+1;
		if(rarity < 70)
		{
			indice = rand()%7;
			if(indice == 3)
				indice = 11;
			if(indice == 4)
				indice = 12;
			if(indice == 6)
				indice = 13;
		}
		else if(rarity >= 70 && rarity < 95)
		{
			indice = rand()%4+4;
			if(indice == 5)
				indice = 8;
			if(indice == 7)
				indice = 9;
		}
		else
		{
			indice = rand()%3+7;
			if(indice == 8)
				indice = 10;
			if(indice == 9)
				indice = 14;
		}

		indice = rand()%NBR_WEAPONS;
		weponsOnFloor[i].indice = indice;
		weponsOnFloor[i].name = listWeapons[indice].name;
		weponsOnFloor[i].rarity = listWeapons[indice].rarity;
		weponsOnFloor[i].degat = listWeapons[indice].degat;
		weponsOnFloor[i].efficiency = listWeapons[indice].efficiency;
		weponsOnFloor[i].strengthRequired = listWeapons[indice].strengthRequired;
		weponsOnFloor[i].state = listWeapons[indice].state;
		weponsOnFloor[i].range = listWeapons[indice].range;
		weponsOnFloor[i].type = listWeapons[indice].type;
		weponsOnFloor[i].cost = listWeapons[indice].cost;

		int posX = rand()%LONGUEUR;
		int posY = rand()%LARGEUR;
		if(posX == 0)
			posX++;
		if(posX == LONGUEUR-1)
			posX--;
		if(posY == 0)
			posY++;
		if(posY == LARGEUR || posY == LARGEUR-1)
			posY-=2;
		weponsOnFloor[i].x = posX;
		weponsOnFloor[i].y = posY;

		if(listWeapons[indice].type == 0)
			map[posX][posY].content = CONTACT_WEAPON;
		else
			map[posX][posY].content = DIST_WEAPON;
	}

	for(i = 0; i < *nbrArmors; i++)
	{
		int rarity = rand()%100+1;
		if(rarity < 70)
		{
			indice = rand()%4;
			if(indice == 1)
				indice = 4;
		}
		else if(rarity >= 70 && rarity < 95)
		{
			indice = rand()%3+4;
			if(indice == 4)
				indice = 1;
		}
		else
		{
			indice = rand()%2+7;
		}

		armorOnFloor[i].indice = indice;
		armorOnFloor[i].name = armorList[indice].name;
		armorOnFloor[i].rarity = armorList[indice].rarity;
		armorOnFloor[i].resistance = armorList[indice].resistance;
		armorOnFloor[i].strengthRequired = armorList[indice].strengthRequired;
		armorOnFloor[i].state = armorList[indice].state;

		int posX = rand()%LONGUEUR;
		int posY = rand()%LARGEUR;
		if(posX == 0)
			posX++;
		if(posX == LONGUEUR)
			posX--;
		if(posY == 0)
			posY++;
		if(posY == LARGEUR)
			posY--;

		armorOnFloor[i].x = posX;
		armorOnFloor[i].y = posY;
		map[posX][posY].content = ARMOR;
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq 0x20(%rbp), %rax
movl 0x18(%rbp), %eax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x2220
movl %eax, %edi
callq 0x2180
movl $0x0, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
callq 0x21e0
cltd
idivl -0x1c(%rbp)
addl $0x1, %edx
movq -0x28(%rbp), %rax
movl %edx, (%rax)
callq 0x21e0
cltd
idivl 0x18(%rbp)
addl $0x1, %edx
movq 0x20(%rbp), %rax
movl %edx, (%rax)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xd9a8
callq 0x21e0
movl $0x64, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movl %edx, -0x3c(%rbp)
cmpl $0x46, -0x3c(%rbp)
jge 0xd6d4
callq 0x21e0
movl $0x7, %ecx
cltd
idivl %ecx
movl %edx, -0x38(%rbp)
cmpl $0x3, -0x38(%rbp)
jne 0xd6b8
movl $0xb, -0x38(%rbp)
cmpl $0x4, -0x38(%rbp)
jne 0xd6c5
movl $0xc, -0x38(%rbp)
cmpl $0x6, -0x38(%rbp)
jne 0xd6d2
movl $0xd, -0x38(%rbp)
jmp 0xd740
cmpl $0x46, -0x3c(%rbp)
jl 0xd70f
cmpl $0x5f, -0x3c(%rbp)
jge 0xd70f
callq 0x21e0
movl $0x4, %ecx
cltd
idivl %ecx
addl $0x4, %edx
movl %edx, -0x38(%rbp)
cmpl $0x5, -0x38(%rbp)
jne 0xd700
movl $0x8, -0x38(%rbp)
cmpl $0x7, -0x38(%rbp)
jne 0xd70d
movl $0x9, -0x38(%rbp)
jmp 0xd73e
callq 0x21e0
movl $0x3, %ecx
cltd
idivl %ecx
addl $0x7, %edx
movl %edx, -0x38(%rbp)
cmpl $0x8, -0x38(%rbp)
jne 0xd72f
movl $0xa, -0x38(%rbp)
cmpl $0x9, -0x38(%rbp)
jne 0xd73c
movl $0xe, -0x38(%rbp)
jmp 0xd73e
jmp 0xd740
callq 0x21e0
movl $0xf, %ecx
cltd
idivl %ecx
movl %edx, -0x38(%rbp)
movl -0x38(%rbp), %ecx
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rdx
shlq $0x6, %rdx
addq %rdx, %rax
movl %ecx, 0x2c(%rax)
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rdx
shlq $0x6, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x30(%rax), %ecx
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rdx
shlq $0x6, %rdx
addq %rdx, %rax
movl %ecx, 0x30(%rax)
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rdx
shlq $0x6, %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x14(%rax), %ecx
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rdx
shlq $0x6, %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rdx
shlq $0x6, %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %ecx
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rdx
shlq $0x6, %rdx
addq %rdx, %rax
movl %ecx, 0x1c(%rax)
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x20(%rax), %ecx
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rdx
shlq $0x6, %rdx
addq %rdx, %rax
movl %ecx, 0x20(%rax)
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x24(%rax), %ecx
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rdx
shlq $0x6, %rdx
addq %rdx, %rax
movl %ecx, 0x24(%rax)
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movl 0x28(%rax), %ecx
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rdx
shlq $0x6, %rdx
addq %rdx, %rax
movl %ecx, 0x28(%rax)
callq 0x21e0
movl $0x27, %ecx
cltd
idivl %ecx
movl %edx, -0x40(%rbp)
callq 0x21e0
movl $0x82, %ecx
cltd
idivl %ecx
movl %edx, -0x44(%rbp)
cmpl $0x0, -0x40(%rbp)
jne 0xd8d8
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
cmpl $0x26, -0x40(%rbp)
jne 0xd8e7
movl -0x40(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x44(%rbp)
jne 0xd8f6
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
cmpl $0x82, -0x44(%rbp)
je 0xd908
cmpl $0x81, -0x44(%rbp)
jne 0xd911
movl -0x44(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x44(%rbp)
movl -0x40(%rbp), %ecx
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rdx
shlq $0x6, %rdx
addq %rdx, %rax
movl %ecx, 0x34(%rax)
movl -0x44(%rbp), %ecx
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rdx
shlq $0x6, %rdx
addq %rdx, %rax
movl %ecx, 0x38(%rax)
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
cmpl $0x0, 0x24(%rax)
jne 0xd975
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x44(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x8, (%rax)
jmp 0xd998
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x44(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x9, (%rax)
jmp 0xd99a
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xd673
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq 0x20(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xdbbc
callq 0x21e0
movl $0x64, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movl %edx, -0x48(%rbp)
cmpl $0x46, -0x48(%rbp)
jge 0xd9f6
callq 0x21e0
movl $0x4, %ecx
cltd
idivl %ecx
movl %edx, -0x38(%rbp)
cmpl $0x1, -0x38(%rbp)
jne 0xd9f4
movl $0x4, -0x38(%rbp)
jmp 0xda39
cmpl $0x46, -0x48(%rbp)
jl 0xda24
cmpl $0x5f, -0x48(%rbp)
jge 0xda24
callq 0x21e0
movl $0x3, %ecx
cltd
idivl %ecx
addl $0x4, %edx
movl %edx, -0x38(%rbp)
cmpl $0x4, -0x38(%rbp)
jne 0xda22
movl $0x1, -0x38(%rbp)
jmp 0xda37
callq 0x21e0
movl $0x2, %ecx
cltd
idivl %ecx
addl $0x7, %edx
movl %edx, -0x38(%rbp)
jmp 0xda39
movl -0x38(%rbp), %ecx
movq 0x10(%rbp), %rax
movslq -0x34(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x20(%rax)
movq -0x30(%rbp), %rax
movslq -0x38(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq 0x10(%rbp), %rax
movslq -0x34(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movslq -0x38(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x24(%rax), %ecx
movq 0x10(%rbp), %rax
movslq -0x34(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x24(%rax)
movq -0x30(%rbp), %rax
movslq -0x38(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %ecx
movq 0x10(%rbp), %rax
movslq -0x34(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
movq -0x30(%rbp), %rax
movslq -0x38(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %ecx
movq 0x10(%rbp), %rax
movslq -0x34(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x1c(%rax)
movq -0x30(%rbp), %rax
movslq -0x38(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
movq 0x10(%rbp), %rax
movslq -0x34(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x18(%rax)
callq 0x21e0
movl $0x27, %ecx
cltd
idivl %ecx
movl %edx, -0x4c(%rbp)
callq 0x21e0
movl $0x82, %ecx
cltd
idivl %ecx
movl %edx, -0x50(%rbp)
cmpl $0x0, -0x4c(%rbp)
jne 0xdb31
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
cmpl $0x27, -0x4c(%rbp)
jne 0xdb40
movl -0x4c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x50(%rbp)
jne 0xdb4f
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
cmpl $0x82, -0x50(%rbp)
jne 0xdb61
movl -0x50(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x50(%rbp)
movl -0x4c(%rbp), %ecx
movq 0x10(%rbp), %rax
movslq -0x34(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x28(%rax)
movl -0x50(%rbp), %ecx
movq 0x10(%rbp), %rax
movslq -0x34(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x2c(%rax)
movq -0x8(%rbp), %rax
movslq -0x4c(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x50(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x7, (%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xd9af
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)