// File: /workspace/github_cpp_makefile_star2_O3/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, 0x4c(%rsp)
leaq 0x120(%rsp), %rbx
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
callq 0x4230
leaq 0xa0(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rbx, %rdi
callq 0x41e0
leaq (%rsp,%rax), %rdx
addq $0x120, %rdx            # imm = 0x120
leaq 0x90(%rsp), %rdi
movq %rbx, %rsi
callq 0x5ad12
leaq 0x860fa(%rip), %rsi     # 0x8f150
leaq 0x90(%rsp), %rdi
callq 0x4a50
leaq 0x38(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x908a
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x9090
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x30(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x90c2
callq 0x44f0
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movq $0x0, 0x80(%rsp)
movq 0x28(%rsp), %rdi
callq 0x4800
testq %rax, %rax
je 0x9376
movq %rax, %rbx
leaq 0x60(%rsp), %r15
leaq 0x90(%rsp), %r14
leaq 0x50(%rsp), %r12
movq %rbx, %rdi
callq 0x4810
movq %rax, %r13
testq %rax, %rax
je 0x922e
leaq 0x13(%r13), %rbp
leaq 0xa0(%rsp), %rax
movq %rax, 0x90(%rsp)
movq %rbp, %rdi
callq 0x41e0
leaq (%rax,%r13), %rdx
addq $0x13, %rdx
movq %r14, %rdi
movq %rbp, %rsi
callq 0x5ad12
movl $0x4, %ecx
movq %r14, %rdi
leaq 0x66a4b(%rip), %rsi     # 0x6fb9b
xorl %edx, %edx
callq 0x4950
cmpq $-0x1, %rax
je 0x920b
movq %r15, 0x50(%rsp)
movq %rbp, %rdi
callq 0x41e0
leaq (%rax,%rbp), %rdx
movq %r12, %rdi
movq %rbp, %rsi
callq 0x5ad12
movl $0xd, %r8d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x85fc0(%rip), %rcx     # 0x8f151
callq 0x45a0
leaq 0x18(%rsp), %r13
movq %r13, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x91be
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x91c6
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x91ed
callq 0x44f0
leaq 0x70(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3754a
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x920b
callq 0x44f0
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x90fe
callq 0x44f0
jmp 0x90fe
movq %rbx, %rdi
callq 0x48a0
movq 0x70(%rsp), %rbx
movq 0x78(%rsp), %r14
cmpq %r14, %rbx
je 0x93c1
movq %r14, %rax
subq %rbx, %rax
sarq $0x5, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x377d1
movq %rbx, %rdi
movq %r14, %rsi
callq 0x378a5
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rcx
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
cmpq %rax, %rcx
je 0x93d2
leaq 0x110(%rsp), %rbp
movl $0x8, %ebx
xorl %r14d, %r14d
leaq 0x100(%rsp), %r15
leaq 0x90(%rsp), %r12
leaq 0x50(%rsp), %r13
movq %rbp, 0x100(%rsp)
movq -0x8(%rax,%rbx), %rsi
movq (%rax,%rbx), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x374b4
movq %r12, %rdi
movq %r15, %rsi
callq 0x974e
movq 0x100(%rsp), %rdi
cmpq %rbp, %rdi
je 0x92f8
callq 0x44f0
movq %r13, %rdi
movq %r12, %rsi
callq 0x9990
leaq 0xe8(%rsp), %rdi
callq 0xa038
cmpb $0x0, 0xd8(%rsp)
jne 0x932c
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x932c
callq 0x4690
leaq 0xb0(%rsp), %rdi
callq 0xa038
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x9353
callq 0x44f0
incq %r14
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
addq $0x20, %rbx
cmpq %r14, %rcx
ja 0x92bf
jmp 0x93d2
movq 0x9ec3b(%rip), %rbx     # 0xa7fb8
leaq 0x85ddb(%rip), %rsi     # 0x8f15f
movl $0x1b, %edx
movq %rbx, %rdi
callq 0x45b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x4530
movsbl %al, %esi
movq 0x9ec09(%rip), %rdi     # 0xa7fb8
callq 0x4050
movq %rax, %rdi
callq 0x4380
jmp 0x95bf
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
leaq 0xb0(%rsp), %r14
xorl %ebx, %ebx
leaq 0x90(%rsp), %r13
movq 0x9ebcd(%rip), %rbp     # 0xa7fb8
movq %r14, %r12
xorl %edi, %edi
callq 0x44d0
movl %eax, %edi
callq 0x4520
callq 0x40f0
cltq
imulq $0x66666667, %rax, %rcx # imm = 0x66666667
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x22, %rcx
addl %edx, %ecx
addl %ecx, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %eax
cltq
addq %rbx, %rax
movq 0x50(%rsp), %r15
imulq $0x70, %rax, %r14
leaq 0xa0(%rsp), %rax
movq %rax, 0x90(%rsp)
movq (%r15,%r14), %rsi
movq 0x8(%r15,%r14), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x374b4
addq %r14, %r15
leaq 0x20(%r15), %rsi
movq %r12, %r14
movq %r12, %rdi
callq 0xa3da
leaq 0x38(%r15), %rsi
leaq 0xc8(%rsp), %rdi
callq 0x8a36
addq $0x58, %r15
leaq 0xe8(%rsp), %rdi
movq %r15, %rsi
callq 0xa3da
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x4530
movsbl %al, %esi
movq %rbp, %rdi
callq 0x4050
movq %rax, %rdi
callq 0x4380
movl $0xe, %edx
movq %rbp, %rdi
leaq 0x85cbd(%rip), %rsi     # 0x8f17b
callq 0x45b0
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x374b4
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbp, %rdi
callq 0x45b0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4530
movsbl %al, %esi
movq %r15, %rdi
callq 0x4050
movq %rax, %rdi
callq 0x4380
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x953a
callq 0x44f0
cmpb $0x0, 0x4c(%rsp)
je 0x9550
movq %r13, %rdi
leaq 0x50(%rsp), %rsi
callq 0x9cf6
jmp 0x955d
movq %r13, %rdi
leaq 0x50(%rsp), %rsi
callq 0x99f8
leaq 0xe8(%rsp), %rdi
callq 0xa038
cmpb $0x0, 0xd8(%rsp)
jne 0x9586
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x9586
callq 0x4690
movq %r14, %rdi
callq 0xa038
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x95a8
callq 0x44f0
addq $0xa, %rbx
cmpl $0x64, %ebx
jne 0x93eb
leaq 0x50(%rsp), %rdi
callq 0x9cce
leaq 0x70(%rsp), %rdi
callq 0x37588
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x95dd
callq 0x44f0
addq $0x528, %rsp            # imm = 0x528
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
jne 0x9740
jmp 0x9745
movq %rax, %rbx
jmp 0x9745
jmp 0x96ea
jmp 0x9691
movq %rax, %rbx
movq 0x100(%rsp), %rdi
cmpq %rbp, %rdi
jne 0x96dc
jmp 0x96e1
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x99ba
jmp 0x96e1
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
jne 0x966e
jmp 0x9673
movq %rax, %rbx
jmp 0x9673
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x9673
callq 0x44f0
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x96ed
callq 0x44f0
jmp 0x96ed
jmp 0x96ea
movq %rax, %rbx
jmp 0x96e1
movq %rax, %rbx
jmp 0x96c7
movq %rax, %rbx
jmp 0x96bf
movq %rax, %rbx
cmpb $0x0, 0xd8(%rsp)
jne 0x96bf
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x96bf
callq 0x4690
movq %r12, %rdi
callq 0xa038
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x96e1
callq 0x44f0
leaq 0x38(%rsp), %r14
jmp 0x9722
jmp 0x970d
movq %rax, %rbx
leaq 0x38(%rsp), %r14
jmp 0x972c
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x9710
callq 0x44f0
jmp 0x9710
movq %rax, %rbx
leaq 0x38(%rsp), %r14
leaq 0x90(%rsp), %rdi
callq 0x99ba
leaq 0x50(%rsp), %rdi
callq 0x9cce
leaq 0x70(%rsp), %rdi
callq 0x37588
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x9745
callq 0x44f0
movq %rbx, %rdi
callq 0x4960
nop