// File: manikandan5[P]Image-Matching-Stitching-Warping/./SiftHelpers.h
// Function: Image::randomRanking(bool)
static void randomRanking(bool reduced = false)
	{
		char buf1[1024];
		
		getcwd(buf1, sizeof(buf1));
		
		string directory = string(buf1) + "/part1_images/";
		DIR *dir;
		struct dirent *ent;
		vector<string> imageNames;
		int count = 0;
		if((dir = opendir(directory.c_str())) != nullptr)
		{
			while ((ent = readdir (dir)) != NULL) 
			{
				string fileName = ent->d_name;
				if(	fileName.find(".jpg") != string::npos)
				{
					string name = "part1_images/" + string(ent->d_name);
					imageNames.push_back(name);
				}
			}
			
			closedir(dir);
		}
		else
		{
			cout<<" Error in current directory"<<endl;
			return;
		}
		
		//Sort images based on names
		sort(imageNames.begin(),imageNames.end());
		vector<Image> images;
		for(int i = 0;i < imageNames.size();++i)
		{
			Image I(imageNames[i]);
			images.push_back(I);	
		}
		
		for(int i = 0;i<10;++i)
		{
			srand(time(NULL));
			//Pick random images one from each bin of size 10.
			int randomNumber = (10*i) + rand() % 10;
			
			Image queryImage = images[randomNumber];
			cout<<endl;
			cout<<"Query Image = "<<queryImage.getName()<<endl;
			if(!reduced)
				descriptorMatching1(queryImage,images);
			else
				descriptorMatching2(queryImage,images);
		}
	}

// Assembly:
subq $0x6c8, %rsp            # imm = 0x6C8
movb %dil, %al
andb $0x1, %al
movb %al, 0x6c7(%rsp)
leaq 0x2c0(%rsp), %rdi
movq %rdi, 0x60(%rsp)
movl $0x400, %esi            # imm = 0x400
callq 0x5260
leaq 0x27f(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x5980
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
leaq 0x280(%rsp), %rdi
callq 0x56d0
jmp 0xb925
leaq 0xdd69d(%rip), %rdx     # 0xe8fc9
leaq 0x2a0(%rsp), %rdi
leaq 0x280(%rsp), %rsi
callq 0xb850
jmp 0xb943
leaq 0x280(%rsp), %rdi
callq 0x5ae8
leaq 0x27f(%rsp), %rdi
callq 0x5590
leaq 0x240(%rsp), %rdi
callq 0x5e430
movl $0x0, 0x23c(%rsp)
leaq 0x2a0(%rsp), %rdi
callq 0x51f0
movq %rax, %rdi
callq 0x5800
movq %rax, 0x58(%rsp)
jmp 0xb991
movq 0x58(%rsp), %rax
movq %rax, 0x260(%rsp)
cmpq $0x0, %rax
je 0xbc03
jmp 0xb9aa
movq 0x260(%rsp), %rdi
callq 0x5820
movq %rax, 0x50(%rsp)
jmp 0xb9be
movq 0x50(%rsp), %rax
movq %rax, 0x258(%rsp)
cmpq $0x0, %rax
je 0xbbf2
movq 0x258(%rsp), %rax
addq $0x13, %rax
movq %rax, 0x40(%rsp)
leaq 0x217(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x5980
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
leaq 0x218(%rsp), %rdi
callq 0x56d0
jmp 0xba11
leaq 0x217(%rsp), %rdi
callq 0x5590
leaq 0x218(%rsp), %rdi
leaq 0xbe00d(%rip), %rsi     # 0xc9a3a
xorl %eax, %eax
movl %eax, %edx
callq 0x5ac0
cmpq $-0x1, %rax
je 0xbbce
movq 0x258(%rsp), %rax
addq $0x13, %rax
movq %rax, 0x30(%rsp)
leaq 0x1cf(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x5980
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
leaq 0x1d0(%rsp), %rdi
callq 0x56d0
jmp 0xba7c
leaq 0xdd547(%rip), %rsi     # 0xe8fca
leaq 0x1f0(%rsp), %rdi
leaq 0x1d0(%rsp), %rdx
callq 0x5e440
jmp 0xba9a
leaq 0x1d0(%rsp), %rdi
callq 0x5ae8
leaq 0x1cf(%rsp), %rdi
callq 0x5590
leaq 0x240(%rsp), %rdi
leaq 0x1f0(%rsp), %rsi
callq 0x5e490
jmp 0xbacb
leaq 0x1f0(%rsp), %rdi
callq 0x5ae8
jmp 0xbbce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
jmp 0xbb14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
leaq 0x280(%rsp), %rdi
callq 0x5ae8
leaq 0x27f(%rsp), %rdi
callq 0x5590
jmp 0xbfc2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
jmp 0xbfa8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
leaq 0x217(%rsp), %rdi
callq 0x5590
jmp 0xbfa8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
jmp 0xbb9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x5ae8
leaq 0x1cf(%rsp), %rdi
callq 0x5590
jmp 0xbbe0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
leaq 0x1f0(%rsp), %rdi
callq 0x5ae8
jmp 0xbbe0
leaq 0x218(%rsp), %rdi
callq 0x5ae8
jmp 0xb9aa
leaq 0x218(%rsp), %rdi
callq 0x5ae8
jmp 0xbfa8
movq 0x260(%rsp), %rdi
callq 0x58a0
jmp 0xbc01
jmp 0xbc40
movq 0xf43be(%rip), %rdi     # 0xfffc8
leaq 0xdd3c7(%rip), %rsi     # 0xe8fd8
callq 0x5520
movq %rax, 0x28(%rsp)
jmp 0xbc1d
movq 0x28(%rsp), %rdi
movq 0xf4377(%rip), %rsi     # 0xfffa0
callq 0x5580
jmp 0xbc30
movl $0x1, 0x1c8(%rsp)
jmp 0xbf79
leaq 0x240(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x5e540
movq 0x20(%rsp), %rdi
movq %rax, 0x1c0(%rsp)
callq 0x5e570
movq %rax, 0x1b8(%rsp)
movq 0x1c0(%rsp), %rdi
movq 0x1b8(%rsp), %rsi
callq 0x5e500
jmp 0xbc83
leaq 0x1a0(%rsp), %rdi
callq 0xc220
movl $0x0, 0x19c(%rsp)
movslq 0x19c(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x240(%rsp), %rdi
callq 0x5e5a0
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0xbdb0
movslq 0x19c(%rsp), %rsi
leaq 0x240(%rsp), %rdi
callq 0x5e5c0
movq %rax, %rsi
leaq 0x108(%rsp), %rdi
callq 0x5200
jmp 0xbced
leaq 0x128(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0xbfd0
jmp 0xbd04
leaq 0x108(%rsp), %rdi
callq 0x5ae8
leaq 0x1a0(%rsp), %rdi
leaq 0x128(%rsp), %rsi
callq 0xc230
jmp 0xbd28
leaq 0x128(%rsp), %rdi
callq 0xc2a0
movl 0x19c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x19c(%rsp)
jmp 0xbc9b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
jmp 0xbf9b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
leaq 0x108(%rsp), %rdi
callq 0x5ae8
jmp 0xbf9b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
leaq 0x128(%rsp), %rdi
callq 0xc2a0
jmp 0xbf9b
movl $0x0, 0x104(%rsp)
cmpl $0xa, 0x104(%rsp)
jge 0xbf61
xorl %eax, %eax
movl %eax, %edi
callq 0x54c0
movl %eax, %edi
callq 0x5500
movl 0x104(%rsp), %ecx
movl %ecx, %eax
leal (%rax,%rax,4), %eax
movl %eax, 0x14(%rsp)
callq 0x5120
movl %eax, %edx
movl 0x14(%rsp), %eax
movslq %edx, %rcx
imulq $0x66666667, %rcx, %rsi # imm = 0x66666667
movq %rsi, %rcx
shrq $0x3f, %rcx
sarq $0x22, %rsi
addl %ecx, %esi
addl %esi, %esi
movl %esi, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %edx
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,2), %eax
movl %eax, 0x100(%rsp)
movslq 0x100(%rsp), %rsi
leaq 0x1a0(%rsp), %rdi
callq 0x5e5e0
movq %rax, %rsi
leaq 0x90(%rsp), %rdi
callq 0x5e600
jmp 0xbe49
movq 0xf4178(%rip), %rdi     # 0xfffc8
movq 0xf4149(%rip), %rsi     # 0xfffa0
callq 0x5580
jmp 0xbe5e
movq 0xf4163(%rip), %rdi     # 0xfffc8
leaq 0xdd188(%rip), %rsi     # 0xe8ff4
callq 0x5520
movq %rax, 0x8(%rsp)
jmp 0xbe78
leaq 0x70(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0xb7d0
jmp 0xbe8c
movq 0x8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x54b0
movq %rax, (%rsp)
jmp 0xbea1
movq (%rsp), %rdi
movq 0xf40f4(%rip), %rsi     # 0xfffa0
callq 0x5580
jmp 0xbeb3
leaq 0x70(%rsp), %rdi
callq 0x5ae8
testb $0x1, 0x6c7(%rsp)
jne 0xbf16
leaq 0x90(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0xc2f0
jmp 0xbede
jmp 0xbf2f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
jmp 0xbf52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x270(%rsp)
movl %eax, 0x26c(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x5ae8
jmp 0xbf52
leaq 0x90(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0xc6f0
jmp 0xbf2d
jmp 0xbf2f
leaq 0x90(%rsp), %rdi
callq 0xc2a0
movl 0x104(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x104(%rsp)
jmp 0xbdbb
leaq 0x90(%rsp), %rdi
callq 0xc2a0
jmp 0xbf9b
leaq 0x1a0(%rsp), %rdi
callq 0xc690
movl $0x0, 0x1c8(%rsp)
leaq 0x240(%rsp), %rdi
callq 0x5e6e0
leaq 0x2a0(%rsp), %rdi
callq 0x5ae8
addq $0x6c8, %rsp            # imm = 0x6C8
retq
leaq 0x1a0(%rsp), %rdi
callq 0xc690
leaq 0x240(%rsp), %rdi
callq 0x5e6e0
leaq 0x2a0(%rsp), %rdi
callq 0x5ae8
movq 0x270(%rsp), %rdi
callq 0x5970
nop