// File: /workspace/github_c_makefile_star2_O0/S01den[P]Lost_CavernRL/map.c
// Function: generMap
int generMap(Map map[LONGUEUR][LARGEUR],WINDOW *win) 
// Based on a cellular automata (from http://www.roguebasin.com/index.php?title=Cellular_Automata_Method_for_Generating_Random_Cave-Like_Levels a bit modified)
{
	initMap(map,win);
	srand(time(NULL));
	
	int i = 0;
	int j = 0;
	int x = 0;
	int y = 0;
	int n = 0;
	int stairsAreSet = 0;
	int data = 0;
	int ret = 1;
	int posRandX = 0;
	int posRandY = 0;

	posRandX = rand()%LARGEUR;
	posRandY = rand()%LONGUEUR;
	if(posRandX == 0)
		posRandX++;
	if(posRandX == LARGEUR)
		posRandX--;

	Map map2[LONGUEUR][LARGEUR];

	for(i = 0; i < LARGEUR; i++)
	{
		for(j = 0; j < LONGUEUR; j++)
		{
			if(i == 0 || j == 0 || i == LARGEUR-1 || j == LONGUEUR-1)
			{
				map[j][i].content = WALL;
				map2[j][i].content = WALL;
			}
			else if(i == 1 || j == 1 || i == LARGEUR-2 || j == LONGUEUR-2)
			{
				map[j][i].content = FLOOR;
				map2[j][i].content = FLOOR;
			}	
			else
			{
				data = rand()%3;
				map[j][i].content = data;
				map2[j][i].content = data;
			}
		}
	}

	for(n = 0; n < 5; n++)
	{
		for(i = 1; i < LARGEUR-2; i++)
		{
			for(j = 2; j < LONGUEUR-1; j++)
			{
				int count = 1;
				for(x = i-1; x < i+2; x++)
				{
					for(y = j-2; y < j+1; y++)
					{
						if(map[y][x].content == 2)
						{
							count++;
						}
					}
				}
				if(count >= 5)
				{
					map2[j][i].content = 2;
				}
				else if(map2[j][i].content != 3)
				{
					map2[j][i].content = 1;
				}
			}
		}

		for(i = 0; i < LARGEUR; i++)
		{
			for(j = 0; j < LONGUEUR; j++)
			{
				map[j][i].content = map2[j][i].content;
				

					if(map[j][i].content == WALL)
					{
						map[j][i].resistance = rand()%30+1;
						
						if(n == 4 && rand()%300 == 0 && map[j+1][i].content == WALL && map[j-1][i].content == WALL && map[j+1][i+1].content == WALL && map[j][i-1].content == WALL && map[j][i+1].content == WALL && map[j-1][i-1].content == WALL && map[j-1][i+1].content == WALL && map[j+1][i-1].content == WALL)
						{
							map[j][i].content = FLOOR;
							map[j][i].effect = 3; // set lava
						}
						else if(n == 4 && rand()%(LONGUEUR*LARGEUR/16) == 0)
						{
							map[j][i].effect = 4; // set a gem
						}
					}
					else
					{
						map[j][i].resistance = 0;
						if(rand()%(LONGUEUR*LARGEUR/16) == 0)
						{
							int trapType = rand()%NBR_TYPES_TRAPS;

							switch(trapType)
							{
								case 0: // electric mine
									map[j][i].content = MINES;
									map[j][i].trap = 1;
									break;
								case 1: // paralysant trap
									map[j][i].content = MINES;
									map[j][i].trap = 2;
									break;
								case 2:
									map[j][i].content = MINES;
									map[j][i].trap = 3;
									break;
								default:
									map[j][i].content = FLOOR;
									map[j][i].trap = 0;
									break;
							}
						}
					}
				}
		}	
	}

	while(stairsAreSet < 5)
	{
		posRandX = rand()%LARGEUR;
		posRandY = rand()%LONGUEUR;

		if(posRandX == 0)
			posRandX++;
		if(posRandX == LARGEUR)
			posRandX--;

		stairsAreSet++;
		map[posRandY][posRandX].content = STAIRS;
	}

	int nbrRadZones = rand()%3+4;
	j = 0;
	i = 0;
	int angle = 0;
	int c = 0;
	float ox = 0;
	float oy = 0;

	for(n = 0; n < nbrRadZones; n++)
	{
		int tailleRad = rand()%5+5;
		int xRadioactiveSeed = rand()%LONGUEUR;
		int yRadioactiveSeed = rand()%LARGEUR;

		if(xRadioactiveSeed+tailleRad >= LONGUEUR)
			xRadioactiveSeed -= tailleRad;
		else if(yRadioactiveSeed+tailleRad >= LARGEUR)
			yRadioactiveSeed -= tailleRad;
	
		for(angle = 0; angle < 360; angle++)
		{
			if(oy >= 0 && oy <= LARGEUR && ox <= LONGUEUR && ox >= 0)
			{
				float angleI = cos((float)angle*0.01745f); // 1° = 0.01745 rad because 360° = 2pi rad
				float angleJ = sin((float)angle*0.01745f);
				ox = (float)xRadioactiveSeed+0.5f;
				oy = (float)yRadioactiveSeed+0.5f;

				for(c = 0; c < tailleRad; c++)
				{
					map[(int)ox][(int)oy].effect = 2;

					ox+=angleI;
					oy+=angleJ;		
				}
			}
		}
	 }

	 for(n = 0; n < LARGEUR; n++)
	 {
	 	map[0][n].content = WALL;
	 	map[0][n].trap = 0;
	 	map[0][n].resistance = 2000000000;
	 	map[LONGUEUR-1][n].content = WALL;
	 	map[LONGUEUR-1][n].trap = 0;
	 	map[LONGUEUR-1][n].resistance = 2000000000;
	 }
	 for(n = 0; n < LONGUEUR; n++)
	 {
	 	map[n][LARGEUR-1].content = WALL;
	 	map[n][LARGEUR-1].trap = 0;
	 	map[n][LARGEUR-1].resistance = 2000000000;
	 	map[n][0].content = WALL;
	 	map[n][0].trap = 0;
	 	map[n][0].resistance = 2000000000;
	 }

	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x22b00, %rsp          # imm = 0x22B00
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xf5e0
xorl %eax, %eax
movl %eax, %edi
callq 0x2220
movl %eax, %edi
callq 0x2180
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x1, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
callq 0x21e0
movl $0x82, %ecx
cltd
idivl %ecx
movl %edx, -0x34(%rbp)
callq 0x21e0
movl $0x27, %ecx
cltd
idivl %ecx
movl %edx, -0x38(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0xe9b5
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
cmpl $0x82, -0x34(%rbp)
jne 0xe9c7
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x82, -0x14(%rbp)
jge 0xeb34
movl $0x0, -0x18(%rbp)
cmpl $0x27, -0x18(%rbp)
jge 0xeb24
cmpl $0x0, -0x14(%rbp)
je 0xea07
cmpl $0x0, -0x18(%rbp)
je 0xea07
cmpl $0x81, -0x14(%rbp)
je 0xea07
cmpl $0x26, -0x18(%rbp)
jne 0xea55
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x2, (%rax)
movslq -0x18(%rbp), %rcx
leaq -0x22ac0(%rbp), %rax
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x2, (%rax)
jmp 0xeb14
cmpl $0x1, -0x14(%rbp)
je 0xea70
cmpl $0x1, -0x18(%rbp)
je 0xea70
cmpl $0x80, -0x14(%rbp)
je 0xea70
cmpl $0x25, -0x18(%rbp)
jne 0xeabb
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x1, (%rax)
movslq -0x18(%rbp), %rcx
leaq -0x22ac0(%rbp), %rax
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x1, (%rax)
jmp 0xeb12
callq 0x21e0
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, -0x2c(%rbp)
movl -0x2c(%rbp), %ecx
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rdx
imulq $0xe38, %rdx, %rdx      # imm = 0xE38
addq %rdx, %rax
movslq -0x14(%rbp), %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl -0x2c(%rbp), %ecx
movslq -0x18(%rbp), %rdx
leaq -0x22ac0(%rbp), %rax
imulq $0xe38, %rdx, %rdx      # imm = 0xE38
addq %rdx, %rax
movslq -0x14(%rbp), %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
jmp 0xeb14
jmp 0xeb16
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xe9e2
jmp 0xeb26
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xe9ce
movl $0x0, -0x24(%rbp)
cmpl $0x5, -0x24(%rbp)
jge 0xf147
movl $0x1, -0x14(%rbp)
cmpl $0x80, -0x14(%rbp)
jge 0xec89
movl $0x2, -0x18(%rbp)
cmpl $0x26, -0x18(%rbp)
jge 0xec79
movl $0x1, -0x22ac4(%rbp)
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl -0x14(%rbp), %ecx
addl $0x2, %ecx
cmpl %ecx, %eax
jge 0xebeb
movl -0x18(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0xebde
movq -0x8(%rbp), %rax
movslq -0x20(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x1c(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x2, (%rax)
jne 0xebd1
movl -0x22ac4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x22ac4(%rbp)
jmp 0xebd3
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xeb93
jmp 0xebe0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xeb7d
cmpl $0x5, -0x22ac4(%rbp)
jl 0xec1c
movslq -0x18(%rbp), %rcx
leaq -0x22ac0(%rbp), %rax
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x2, (%rax)
jmp 0xec69
movslq -0x18(%rbp), %rcx
leaq -0x22ac0(%rbp), %rax
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x3, (%rax)
je 0xec67
movslq -0x18(%rbp), %rcx
leaq -0x22ac0(%rbp), %rax
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x1, (%rax)
jmp 0xec69
jmp 0xec6b
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xeb60
jmp 0xec7b
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xeb4c
movl $0x0, -0x14(%rbp)
cmpl $0x82, -0x14(%rbp)
jge 0xf137
movl $0x0, -0x18(%rbp)
cmpl $0x27, -0x18(%rbp)
jge 0xf127
movslq -0x18(%rbp), %rcx
leaq -0x22ac0(%rbp), %rax
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %ecx
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rdx
imulq $0xe38, %rdx, %rdx      # imm = 0xE38
addq %rdx, %rax
movslq -0x14(%rbp), %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x2, (%rax)
jne 0xef55
callq 0x21e0
movl $0x1e, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl %edx, 0x14(%rax)
cmpl $0x4, -0x24(%rbp)
jne 0xef12
callq 0x21e0
movl $0x12c, %ecx            # imm = 0x12C
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0xef12
movq -0x8(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x2, (%rax)
jne 0xef12
movq -0x8(%rbp), %rax
movl -0x18(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x2, (%rax)
jne 0xef12
movq -0x8(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x2, (%rax)
jne 0xef12
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x2, (%rax)
jne 0xef12
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x2, (%rax)
jne 0xef12
movq -0x8(%rbp), %rax
movl -0x18(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x2, (%rax)
jne 0xef12
movq -0x8(%rbp), %rax
movl -0x18(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x2, (%rax)
jne 0xef12
movq -0x8(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x2, (%rax)
jne 0xef12
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x1, (%rax)
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x3, 0x4(%rax)
jmp 0xef50
cmpl $0x4, -0x24(%rbp)
jne 0xef4e
callq 0x21e0
movl $0x13c, %ecx            # imm = 0x13C
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0xef4e
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x4, 0x4(%rax)
jmp 0xef50
jmp 0xf117
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x14(%rax)
callq 0x21e0
movl $0x13c, %ecx            # imm = 0x13C
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0xf115
callq 0x21e0
movslq %eax, %rcx
imulq $0x55555556, %rcx, %rdx # imm = 0x55555556
movq %rdx, %rcx
shrq $0x3f, %rcx
shrq $0x20, %rdx
addl %ecx, %edx
movl %edx, %ecx
leal (%rcx,%rcx,2), %ecx
subl %ecx, %eax
movl %eax, -0x22ac8(%rbp)
movl -0x22ac8(%rbp), %eax
movl %eax, -0x22af4(%rbp)
testl %eax, %eax
je 0xefeb
jmp 0xefca
movl -0x22af4(%rbp), %eax
subl $0x1, %eax
je 0xf037
jmp 0xefd7
movl -0x22af4(%rbp), %eax
subl $0x2, %eax
je 0xf083
jmp 0xf0cc
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x4, (%rax)
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x1, 0x18(%rax)
jmp 0xf113
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x4, (%rax)
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x2, 0x18(%rax)
jmp 0xf113
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x4, (%rax)
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x3, 0x18(%rax)
jmp 0xf113
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x1, (%rax)
movq -0x8(%rbp), %rax
movslq -0x18(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x18(%rax)
jmp 0xf115
jmp 0xf117
jmp 0xf119
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xeca4
jmp 0xf129
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xec90
jmp 0xf139
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xeb3b
jmp 0xf149
cmpl $0x5, -0x28(%rbp)
jge 0xf1be
callq 0x21e0
movl $0x82, %ecx
cltd
idivl %ecx
movl %edx, -0x34(%rbp)
callq 0x21e0
movl $0x27, %ecx
cltd
idivl %ecx
movl %edx, -0x38(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0xf17e
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
cmpl $0x82, -0x34(%rbp)
jne 0xf190
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x34(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x3, (%rax)
jmp 0xf149
callq 0x21e0
movl $0x3, %ecx
cltd
idivl %ecx
addl $0x4, %edx
movl %edx, -0x22acc(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x22ad0(%rbp)
movl $0x0, -0x22ad4(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x22ad8(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x22adc(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x22acc(%rbp), %eax
jge 0xf45a
callq 0x21e0
movl $0x5, %ecx
cltd
idivl %ecx
addl $0x5, %edx
movl %edx, -0x22ae0(%rbp)
callq 0x21e0
movl $0x27, %ecx
cltd
idivl %ecx
movl %edx, -0x22ae4(%rbp)
callq 0x21e0
movl $0x82, %ecx
cltd
idivl %ecx
movl %edx, -0x22ae8(%rbp)
movl -0x22ae4(%rbp), %eax
addl -0x22ae0(%rbp), %eax
cmpl $0x27, %eax
jl 0xf285
movl -0x22ae0(%rbp), %ecx
movl -0x22ae4(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x22ae4(%rbp)
jmp 0xf2ae
movl -0x22ae8(%rbp), %eax
addl -0x22ae0(%rbp), %eax
cmpl $0x82, %eax
jl 0xf2ac
movl -0x22ae0(%rbp), %ecx
movl -0x22ae8(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x22ae8(%rbp)
jmp 0xf2ae
movl $0x0, -0x22ad0(%rbp)
cmpl $0x168, -0x22ad0(%rbp)  # imm = 0x168
jge 0xf44a
movss -0x22adc(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0xf434
movss 0x9af4(%rip), %xmm0     # 0x18dd8
ucomiss -0x22adc(%rbp), %xmm0
jb 0xf434
movss 0x9ae3(%rip), %xmm0     # 0x18ddc
ucomiss -0x22ad8(%rbp), %xmm0
jb 0xf434
movss -0x22ad8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0xf434
cvtsi2ssl -0x22ad0(%rbp), %xmm0
movss 0x9aba(%rip), %xmm1     # 0x18de4
mulss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x20c0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x22aec(%rbp)
cvtsi2ssl -0x22ad0(%rbp), %xmm0
movss 0x9a91(%rip), %xmm1     # 0x18de4
mulss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
callq 0x2210
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x22af0(%rbp)
cvtsi2ssl -0x22ae4(%rbp), %xmm0
movss 0x9a64(%rip), %xmm1     # 0x18de0
addss %xmm1, %xmm0
movss %xmm0, -0x22ad8(%rbp)
cvtsi2ssl -0x22ae8(%rbp), %xmm0
movss 0x9a48(%rip), %xmm1     # 0x18de0
addss %xmm1, %xmm0
movss %xmm0, -0x22adc(%rbp)
movl $0x0, -0x22ad4(%rbp)
movl -0x22ad4(%rbp), %eax
cmpl -0x22ae0(%rbp), %eax
jge 0xf432
movq -0x8(%rbp), %rax
cvttss2si -0x22ad8(%rbp), %ecx
movslq %ecx, %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
cvttss2si -0x22adc(%rbp), %ecx
movslq %ecx, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x2, 0x4(%rax)
movss -0x22aec(%rbp), %xmm0
addss -0x22ad8(%rbp), %xmm0
movss %xmm0, -0x22ad8(%rbp)
movss -0x22af0(%rbp), %xmm0
addss -0x22adc(%rbp), %xmm0
movss %xmm0, -0x22adc(%rbp)
movl -0x22ad4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x22ad4(%rbp)
jmp 0xf3ae
jmp 0xf434
jmp 0xf436
movl -0x22ad0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x22ad0(%rbp)
jmp 0xf2b8
jmp 0xf44c
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xf213
movl $0x0, -0x24(%rbp)
cmpl $0x82, -0x24(%rbp)
jge 0xf510
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x2, (%rax)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x18(%rax)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x77359400, 0x14(%rax) # imm = 0x77359400
movq -0x8(%rbp), %rax
addq $0x21c50, %rax          # imm = 0x21C50
movslq -0x24(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x2, (%rax)
movq -0x8(%rbp), %rax
addq $0x21c50, %rax          # imm = 0x21C50
movslq -0x24(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x18(%rax)
movq -0x8(%rbp), %rax
addq $0x21c50, %rax          # imm = 0x21C50
movslq -0x24(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x77359400, 0x14(%rax) # imm = 0x77359400
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xf461
movl $0x0, -0x24(%rbp)
cmpl $0x27, -0x24(%rbp)
jge 0xf5cd
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movl $0x2, 0xe1c(%rax)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movl $0x0, 0xe34(%rax)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movl $0x77359400, 0xe30(%rax) # imm = 0x77359400
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movl $0x2, (%rax)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movl $0x0, 0x18(%rax)
movq -0x8(%rbp), %rax
movslq -0x24(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movl $0x77359400, 0x14(%rax) # imm = 0x77359400
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xf517
movl -0x30(%rbp), %eax
addq $0x22b00, %rsp          # imm = 0x22B00
popq %rbp
retq
nopl (%rax)