// File: rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::cielab2rgb(Image&, Image&)
void ImageProc::cielab2rgb(Image &img_orig, Image &img_modified)
{
	double L,A,B,r,g,b;
	for(int i = 0; i < img_orig.rows; i++)
		for(int j = 0; j < img_orig.cols; j++)
		{
			L = (double)(img_orig.getvalue(i,j,0));
			A = (double)(img_orig.getvalue(i,j,1));
			B = (double)(img_orig.getvalue(i,j,2));
			Lab2Rgb(&r,&g,&b,L,A,B);
			std::cout << L << " " << A << " " << B <<std::endl;
			img_modified.setvalue(i,j,0,(unsigned char)(r*255));
			img_modified.setvalue(i,j,1,(unsigned char)(g*255));
			img_modified.setvalue(i,j,2,(unsigned char)(b*255));
			std::cout << img_modified.getvalue(i,j,0) << " " << img_modified.getvalue(i,j,1) << " " << img_modified.getvalue(i,j,2)<<std::endl;
		}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x17283
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x17273
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x48(%rbp), %edx
xorl %ecx, %ecx
movl %ecx, -0x68(%rbp)
callq 0x83b0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x48(%rbp), %edx
movl $0x1, %ecx
movl %ecx, -0x64(%rbp)
callq 0x83b0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x48(%rbp), %edx
movl $0x2, %ecx
callq 0x83b0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x18(%rbp), %xmm0
movsd -0x20(%rbp), %xmm1
movsd -0x28(%rbp), %xmm2
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0xaf00
movsd -0x18(%rbp), %xmm0
movq 0x9ec4(%rip), %rdi      # 0x20fc8
callq 0x23b0
movq %rax, %rdi
leaq 0x60fa(%rip), %rsi      # 0x1d20d
movq %rsi, -0x70(%rbp)
callq 0x21c0
movq %rax, %rdi
movsd -0x20(%rbp), %xmm0
callq 0x23b0
movq -0x70(%rbp), %rsi
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
movsd -0x28(%rbp), %xmm0
callq 0x23b0
movq %rax, %rdi
movq 0x9e6c(%rip), %rsi      # 0x20fb8
callq 0x21e0
movl -0x68(%rbp), %ecx
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x48(%rbp), %edx
movsd -0x30(%rbp), %xmm0
movsd 0x535d(%rip), %xmm1     # 0x1c4c8
movsd %xmm1, -0x60(%rbp)
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movzbl %al, %r8d
callq 0x83f0
movl -0x64(%rbp), %ecx
movsd -0x60(%rbp), %xmm1
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x48(%rbp), %edx
movsd -0x38(%rbp), %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movzbl %al, %r8d
callq 0x83f0
movsd -0x60(%rbp), %xmm1
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x48(%rbp), %edx
movsd -0x40(%rbp), %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movzbl %al, %r8d
movl $0x2, %ecx
callq 0x83f0
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x48(%rbp), %edx
xorl %ecx, %ecx
callq 0x83b0
movl %eax, %esi
movq 0x9ddb(%rip), %rdi      # 0x20fc8
callq 0x2340
movq %rax, %rdi
leaq 0x6011(%rip), %rsi      # 0x1d20d
callq 0x21c0
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x48(%rbp), %edx
movl $0x1, %ecx
callq 0x83b0
movq -0x58(%rbp), %rdi
movl %eax, %esi
callq 0x2340
movq %rax, %rdi
leaq 0x5fdf(%rip), %rsi      # 0x1d20d
callq 0x21c0
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x48(%rbp), %edx
movl $0x2, %ecx
callq 0x83b0
movq -0x50(%rbp), %rdi
movl %eax, %esi
callq 0x2340
movq %rax, %rdi
movq 0x9d58(%rip), %rsi      # 0x20fb8
callq 0x21e0
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x1706e
jmp 0x17275
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x17057
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)