 
 __global__ void _gpu_md5_bruteforce (uint * words, int * res)
 {
-	int idx = blockIdx.x * blockDim.x + threadIdx.x;
+	uint idx = blockIdx.x * blockDim.x + threadIdx.x;
 	uint a, b, c, d, in[16];
-	int i;
-	
+	
+	/*
 	for (i = 0; i < 16; i++)
 		in[i] = words[idx * 16 + i];
+	*/
+	
+	/* Разворачиваем цикл, описанный выше */
+	
+	const uint tmp = idx * 16;
+	
+	in[0] = words[tmp];
+	in[1] = words[tmp + 1];
+	in[2] = words[tmp + 2];
+	in[3] = words[tmp + 3];
+	in[4] = words[tmp + 4];
+	in[5] = words[tmp + 5];
+	in[6] = words[tmp + 6];
+	in[7] = words[tmp + 7];
+	in[8] = words[tmp + 8];
+	in[9] = words[tmp + 9];
+	in[10] = words[tmp + 10];
+	in[11] = words[tmp + 11];
+	in[12] = words[tmp + 12];
+	in[13] = words[tmp + 13];
+	in[14] = words[tmp + 14];
+	in[15] = words[tmp + 15];
 	
 	md5(in, a, b, c, d);
 	

	return (x << c) | (x >> (32-c));
}

__device__ inline void step (const uint i, const uint f, const uint g, uint &a, uint &b, uint &c, uint &d, const uint *w)
{
	uint temp = d;
	d = c;

		step(i, f, g, a, b, c, d, w);
	}
	
	/*
	f = (b & c) | ((~b) & d);
	g = 0;
	step(0, f, g, a, b, c, d, w);
	
	f = (b & c) | ((~b) & d);
	g = 1;
	step(1, f, g, a, b, c, d, w);
	
	f = (b & c) | ((~b) & d);
	g = 2;
	step(2, f, g, a, b, c, d, w);
	
	f = (b & c) | ((~b) & d);
	g = 3;
	step(3, f, g, a, b, c, d, w);
	
	f = (b & c) | ((~b) & d);
	g = 4;
	step(4, f, g, a, b, c, d, w);
	
	f = (b & c) | ((~b) & d);
	g = 5;
	step(5, f, g, a, b, c, d, w);
	
	f = (b & c) | ((~b) & d);
	g = 6;
	step(6, f, g, a, b, c, d, w);
	
	f = (b & c) | ((~b) & d);
	g = 7;
	step(7, f, g, a, b, c, d, w);
	
	f = (b & c) | ((~b) & d);
	g = 8;
	step(8, f, g, a, b, c, d, w);
	
	f = (b & c) | ((~b) & d);
	g = 9;
	step(9, f, g, a, b, c, d, w);
	
	f = (b & c) | ((~b) & d);
	g = 10;
	step(10, f, g, a, b, c, d, w);
	
	f = (b & c) | ((~b) & d);
	g = 11;
	step(11, f, g, a, b, c, d, w);
	
	f = (b & c) | ((~b) & d);
	g = 12;
	step(12, f, g, a, b, c, d, w);
	
	f = (b & c) | ((~b) & d);
	g = 13;
	step(13, f, g, a, b, c, d, w);
	
	f = (b & c) | ((~b) & d);
	g = 14;
	step(14, f, g, a, b, c, d, w);
	
	f = (b & c) | ((~b) & d);
	g = 15;
	step(15, f, g, a, b, c, d, w);
	*/
	
	for(; i != 32; i++)
	{
		f = (d & b) | ((~d) & c);
