// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x528, %rsp            # imm = 0x528
movl %edi, 0xc(%rsp)
leaq 0x120(%rsp), %rbx
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
callq 0x4230
leaq 0x90(%rsp), %rdi
leaq 0x50(%rsp), %rdx
movq %rbx, %rsi
callq 0x41c0
leaq 0x6daee(%rip), %rdx     # 0x750a6
leaq 0x70(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x7546
leaq 0x90(%rsp), %rdi
callq 0x4aa8
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movq 0x70(%rsp), %rdi
callq 0x4800
testq %rax, %rax
je 0x77f1
movq %rax, %r14
leaq 0x90(%rsp), %r15
leaq 0x50(%rsp), %r12
leaq 0x4e50c(%rip), %r13     # 0x55b1b
leaq 0x30(%rsp), %rbp
movq %r14, %rdi
callq 0x4810
movq %rax, %rbx
testq %rax, %rax
je 0x7692
addq $0x13, %rbx
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x41c0
movq %r15, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x4a80
cmpq $-0x1, %rax
je 0x7688
movq %rbp, %rdi
movq %rbx, %rsi
leaq 0xb(%rsp), %rdx
callq 0x41c0
movq %r12, %rdi
leaq 0x6da44(%rip), %rsi     # 0x750a7
movq %rbp, %rdx
callq 0x2adee
movq %rbp, %rdi
callq 0x4aa8
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x2ae12
movq %r12, %rdi
callq 0x4aa8
movq %r15, %rdi
callq 0x4aa8
jmp 0x7614
movq %r14, %rdi
callq 0x48a0
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x2b0cb
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rbx
movaps %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
xorl %r12d, %r12d
leaq 0x100(%rsp), %r14
leaq 0x90(%rsp), %r15
xorl %r13d, %r13d
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %r13, %rax
jbe 0x771f
addq %r12, %rsi
movq %r14, %rdi
callq 0x4700
movq %r15, %rdi
movq %r14, %rsi
callq 0x78e0
movq %r14, %rdi
callq 0x4aa8
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7a1e
movq %r15, %rdi
callq 0x7a4a
incq %r13
addq $0x20, %r12
jmp 0x76cf
xorl %r12d, %r12d
leaq 0x90(%rsp), %r14
movq 0x8888f(%rip), %r15     # 0x8ffc0
leaq 0x50(%rsp), %r13
leaq 0x30(%rsp), %rbp
cmpl $0x64, %r12d
je 0x77e5
xorl %edi, %edi
callq 0x44b0
movl %eax, %edi
callq 0x4500
callq 0x4100
cltd
pushq $0xa
popq %rcx
idivl %ecx
movslq %edx, %rax
addq %r12, %rax
imulq $0x70, %rax, %rsi
addq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x2ae3e
movq %r15, %rdi
callq 0x4200
movq %r15, %rdi
leaq 0x6d94a(%rip), %rsi     # 0x750d1
callq 0x4520
movq %rax, %rbx
movq %r13, %rdi
movq %r14, %rsi
callq 0x4700
movq %rbx, %rdi
movq %r13, %rsi
callq 0x44a0
movq %rax, %rdi
callq 0x4200
movq %r13, %rdi
callq 0x4aa8
cmpb $0x0, 0xc(%rsp)
je 0x77c9
movq %r14, %rdi
movq %rbp, %rsi
callq 0x7cce
jmp 0x77d4
movq %r14, %rdi
movq %rbp, %rsi
callq 0x7a72
movq %r14, %rdi
callq 0x7a4a
addq $0xa, %r12
jmp 0x773b
leaq 0x30(%rsp), %rdi
callq 0x7cac
jmp 0x780c
movq 0x887c8(%rip), %rdi     # 0x8ffc0
leaq 0x6d8b6(%rip), %rsi     # 0x750b5
callq 0x4520
movq %rax, %rdi
callq 0x4200
leaq 0x10(%rsp), %rdi
callq 0x2aeba
leaq 0x70(%rsp), %rdi
callq 0x4aa8
addq $0x528, %rsp            # imm = 0x528
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
jmp 0x78d3
movq %rax, %rbx
jmp 0x78d8
jmp 0x7896
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
jmp 0x7863
movq %rax, %rbx
jmp 0x7868
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x4aa8
leaq 0x90(%rsp), %rdi
callq 0x4aa8
jmp 0x78c4
jmp 0x788f
jmp 0x78aa
jmp 0x78aa
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x4aa8
jmp 0x78ba
movq %rax, %rbx
jmp 0x78ba
jmp 0x7896
movq %rax, %rbx
jmp 0x78c4
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x4aa8
jmp 0x78ad
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x7a4a
leaq 0x30(%rsp), %rdi
callq 0x7cac
leaq 0x10(%rsp), %rdi
callq 0x2aeba
leaq 0x70(%rsp), %rdi
callq 0x4aa8
movq %rbx, %rdi
callq 0x4950