// File: manikandan5[P]Image-Matching-Stitching-Warping/./SiftHelpers.h
// Function: Image::DrawImage(Image const&, Image const&, std::vector<std::pair<SiftDescriptor, SiftDescriptor>, std::allocator<std::pair<SiftDescriptor, SiftDescriptor>>>&, bool)
static void DrawImage(const Image& queryImage,const Image& image,SiftDescriptorMap& mapping,bool reduced = false)
	{
		CImg<double> queryImageData = queryImage.getImageData();
		int queryHeight = queryImageData.height();
		int queryWidth = queryImageData.width();
		queryImageData.append(image.getImageData());
		
		SiftDescriptorMap::iterator mStart = mapping.begin();
		SiftDescriptorMap::iterator mEnd = mapping.end();
		
		
		const double yellow[] = {255.0,255.0,0.0};
		while(mStart != mEnd)
		{
			const int y0 = mStart->first.row;
			const int x0 = mStart->first.col;
			const int y1 = mStart->second.row;
			const int x1 = queryWidth + mStart->second.col;
			
			for(int j=0; j<5; j++)
				for(int k=0; k<5; k++)
					if(j==2 || k==2)
						if(x0+k < queryImageData.width() && x1+k < queryImageData.width() && y0+j < queryImageData.height() && y1+j < queryImageData.height())
						{	
							queryImageData(x0+k, y0+j, 0, 0)=queryImageData(x1+k, y1+j, 0, 1)=255;
							queryImageData(x0+k, y0+j, 0, 1)= queryImageData(x0+k, y0+j, 0, 2) =queryImageData(x1+k, y1+j, 0, 0)=queryImageData(x1+k, y1+j, 0, 2)= 0;
						}
						
			queryImageData.draw_line(x0,y0,x1,y1,yellow);
			++mStart;
	
		}
		if(!reduced)
			queryImageData.get_normalize(0,255).save("sift.png");
		else
			queryImageData.get_normalize(0,255).save("newsift.png");
	}

// Assembly:
subq $0x178, %rsp            # imm = 0x178
movb %cl, %al
movq %rdi, 0x170(%rsp)
movq %rsi, 0x168(%rsp)
movq %rdx, 0x160(%rsp)
andb $0x1, %al
movb %al, 0x15f(%rsp)
movq 0x170(%rsp), %rsi
leaq 0x138(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x8990
movq 0x68(%rsp), %rdi
callq 0x89d0
movl %eax, 0x74(%rsp)
jmp 0xceb4
movl 0x74(%rsp), %eax
movl %eax, 0x134(%rsp)
leaq 0x138(%rsp), %rdi
callq 0x89c0
movl %eax, 0x64(%rsp)
jmp 0xced2
movl 0x64(%rsp), %eax
movl %eax, 0x120(%rsp)
movq 0x168(%rsp), %rsi
leaq 0x100(%rsp), %rdi
callq 0x8990
jmp 0xcef4
leaq 0x138(%rsp), %rdi
leaq 0x100(%rsp), %rsi
movl $0x78, %edx
xorps %xmm0, %xmm0
callq 0xf2c0
jmp 0xcf13
leaq 0x100(%rsp), %rdi
callq 0xa540
movq 0x160(%rsp), %rdi
callq 0xa980
movq %rax, 0xf8(%rsp)
movq 0x160(%rsp), %rdi
callq 0xa9b0
movq %rax, 0xf0(%rsp)
movq 0xbb78f(%rip), %rax     # 0xc86e0
movq %rax, 0xd0(%rsp)
movq 0xbb788(%rip), %rax     # 0xc86e8
movq %rax, 0xd8(%rsp)
movq 0xbb781(%rip), %rax     # 0xc86f0
movq %rax, 0xe0(%rsp)
leaq 0xf8(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0xa9e0
testb $0x1, %al
jne 0xcf95
jmp 0xd3c0
leaq 0xf8(%rsp), %rdi
callq 0xaa20
cvttss2si (%rax), %eax
movl %eax, 0xcc(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0xaa20
cvttss2si 0x4(%rax), %eax
movl %eax, 0xc8(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0xaa20
cvttss2si 0x28(%rax), %eax
movl %eax, 0xc4(%rsp)
cvtsi2ssl 0x120(%rsp), %xmm0
movss %xmm0, 0x60(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0xaa20
movss 0x60(%rsp), %xmm0
addss 0x2c(%rax), %xmm0
cvttss2si %xmm0, %eax
movl %eax, 0xc0(%rsp)
movl $0x0, 0xbc(%rsp)
cmpl $0x5, 0xbc(%rsp)
jge 0xd362
movl $0x0, 0xb8(%rsp)
cmpl $0x5, 0xb8(%rsp)
jge 0xd34a
cmpl $0x2, 0xbc(%rsp)
je 0xd05b
cmpl $0x2, 0xb8(%rsp)
jne 0xd332
movl 0xc8(%rsp), %eax
movl 0xb8(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0x58(%rsp)
leaq 0x138(%rsp), %rdi
callq 0x89c0
movl %eax, 0x5c(%rsp)
jmp 0xd082
movl 0x58(%rsp), %eax
movl 0x5c(%rsp), %ecx
cmpl %ecx, %eax
jge 0xd330
movl 0xc0(%rsp), %eax
movl 0xb8(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0x50(%rsp)
leaq 0x138(%rsp), %rdi
callq 0x89c0
movl %eax, 0x54(%rsp)
jmp 0xd0b9
movl 0x50(%rsp), %eax
movl 0x54(%rsp), %ecx
cmpl %ecx, %eax
jge 0xd330
movl 0xcc(%rsp), %eax
movl 0xbc(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0x48(%rsp)
leaq 0x138(%rsp), %rdi
callq 0x89d0
movl %eax, 0x4c(%rsp)
jmp 0xd0f0
movl 0x48(%rsp), %eax
movl 0x4c(%rsp), %ecx
cmpl %ecx, %eax
jge 0xd330
movl 0xc4(%rsp), %eax
movl 0xbc(%rsp), %ecx
addl %ecx, %eax
movl %eax, 0x40(%rsp)
leaq 0x138(%rsp), %rdi
callq 0x89d0
movl %eax, 0x44(%rsp)
jmp 0xd127
movl 0x40(%rsp), %eax
movl 0x44(%rsp), %ecx
cmpl %ecx, %eax
jge 0xd330
movl 0xc0(%rsp), %esi
movl 0xb8(%rsp), %eax
addl %eax, %esi
movl 0xc4(%rsp), %edx
movl 0xbc(%rsp), %eax
addl %eax, %edx
leaq 0x138(%rsp), %rdi
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x9880
movq %rax, 0x38(%rsp)
jmp 0xd173
movq 0x38(%rsp), %rax
movabsq $0x406fe00000000000, %rcx # imm = 0x406FE00000000000
movq %rcx, (%rax)
movl 0xc8(%rsp), %esi
movl 0xb8(%rsp), %eax
addl %eax, %esi
movl 0xcc(%rsp), %edx
movl 0xbc(%rsp), %eax
addl %eax, %edx
leaq 0x138(%rsp), %rdi
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x9880
movq %rax, 0x30(%rsp)
jmp 0xd1bf
movq 0x30(%rsp), %rax
movabsq $0x406fe00000000000, %rcx # imm = 0x406FE00000000000
movq %rcx, (%rax)
movl 0xc0(%rsp), %esi
movl 0xb8(%rsp), %eax
addl %eax, %esi
movl 0xc4(%rsp), %edx
movl 0xbc(%rsp), %eax
addl %eax, %edx
leaq 0x138(%rsp), %rdi
xorl %ecx, %ecx
movl $0x2, %r8d
callq 0x9880
movq %rax, 0x28(%rsp)
jmp 0xd20d
movq 0x28(%rsp), %rax
movq $0x0, (%rax)
movl 0xc0(%rsp), %esi
movl 0xb8(%rsp), %eax
addl %eax, %esi
movl 0xc4(%rsp), %edx
movl 0xbc(%rsp), %eax
addl %eax, %edx
leaq 0x138(%rsp), %rdi
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x9880
movq %rax, 0x20(%rsp)
jmp 0xd253
movq 0x20(%rsp), %rax
movq $0x0, (%rax)
movl 0xc8(%rsp), %esi
movl 0xb8(%rsp), %eax
addl %eax, %esi
movl 0xcc(%rsp), %edx
movl 0xbc(%rsp), %eax
addl %eax, %edx
leaq 0x138(%rsp), %rdi
xorl %ecx, %ecx
movl $0x2, %r8d
callq 0x9880
movq %rax, 0x18(%rsp)
jmp 0xd29b
movq 0x18(%rsp), %rax
movq $0x0, (%rax)
movl 0xc8(%rsp), %esi
movl 0xb8(%rsp), %eax
addl %eax, %esi
movl 0xcc(%rsp), %edx
movl 0xbc(%rsp), %eax
addl %eax, %edx
leaq 0x138(%rsp), %rdi
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x9880
movq %rax, 0x10(%rsp)
jmp 0xd2e3
movq 0x10(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
jmp 0xd330
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x128(%rsp)
movl %eax, 0x124(%rsp)
jmp 0xd4be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x128(%rsp)
movl %eax, 0x124(%rsp)
leaq 0x100(%rsp), %rdi
callq 0xa540
jmp 0xd4be
jmp 0xd332
jmp 0xd334
movl 0xb8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xb8(%rsp)
jmp 0xd035
jmp 0xd34c
movl 0xbc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xbc(%rsp)
jmp 0xd01c
movl 0xc8(%rsp), %esi
movl 0xcc(%rsp), %edx
movl 0xc0(%rsp), %ecx
movl 0xc4(%rsp), %r8d
movq %rsp, %rax
movl $0x1, 0x8(%rax)
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
leaq 0x138(%rsp), %rdi
leaq 0xd0(%rsp), %r9
movss 0xbad79(%rip), %xmm0    # 0xc8120
callq 0xf3e0
jmp 0xd3ae
leaq 0xf8(%rsp), %rdi
callq 0xaa30
jmp 0xcf77
testb $0x1, 0x15f(%rsp)
jne 0xd441
leaq 0x98(%rsp), %rdi
leaq 0x138(%rsp), %rsi
xorps %xmm0, %xmm0
movsd 0xbac23(%rip), %xmm1    # 0xc8008
callq 0x9940
jmp 0xd3ec
leaq 0xbc67f(%rip), %rsi     # 0xc9a72
leaq 0x98(%rsp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x6, %ecx
callq 0x99f0
jmp 0xd40c
leaq 0x98(%rsp), %rdi
callq 0xa540
jmp 0xd4a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x128(%rsp)
movl %eax, 0x124(%rsp)
leaq 0x98(%rsp), %rdi
callq 0xa540
jmp 0xd4be
leaq 0x78(%rsp), %rdi
leaq 0x138(%rsp), %rsi
xorps %xmm0, %xmm0
movsd 0xbabaf(%rip), %xmm1    # 0xc8008
callq 0x9940
jmp 0xd460
leaq 0xbc608(%rip), %rsi     # 0xc9a6f
leaq 0x78(%rsp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x6, %ecx
callq 0x99f0
jmp 0xd47d
leaq 0x78(%rsp), %rdi
callq 0xa540
jmp 0xd4a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x128(%rsp)
movl %eax, 0x124(%rsp)
leaq 0x78(%rsp), %rdi
callq 0xa540
jmp 0xd4be
leaq 0x138(%rsp), %rdi
callq 0xa540
addq $0x178, %rsp            # imm = 0x178
retq
leaq 0x138(%rsp), %rdi
callq 0xa540
movq 0x128(%rsp), %rdi
callq 0x5970
nopl (%rax,%rax)