// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorl %r12d, %r12d
movq 0x8906(%rip), %rbp      # 0x14fd0
leaq 0x4c1c(%rip), %r15      # 0x112ed
cmpl 0xc(%r14), %r12d
jge 0xc894
xorl %r13d, %r13d
movl 0x8(%r14), %eax
cmpl %eax, %r13d
jge 0xc88c
movq 0x18(%r14), %rcx
imull %r12d, %eax
addl %r13d, %eax
imull 0x10(%r14), %eax
cltq
movzbl (%rcx,%rax), %edx
cvtsi2sd %edx, %xmm0
movsd %xmm0, 0x8(%rsp)
movzbl 0x1(%rcx,%rax), %edx
cvtsi2sd %edx, %xmm1
movsd %xmm1, 0x10(%rsp)
movzbl 0x2(%rcx,%rax), %eax
cvtsi2sd %eax, %xmm2
movsd %xmm2, 0x18(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x5a6d
movq %rbp, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x2240
movq %rax, %rdi
movq %r15, %rsi
callq 0x2170
movq %rax, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x2240
movq %rax, %rdi
movq %r15, %rsi
callq 0x2170
movq %rax, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x2240
movq %rax, %rdi
callq 0x20c0
movsd 0x30(%rsp), %xmm0
movsd 0x3d1d(%rip), %xmm1     # 0x104b0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movq 0x18(%rbx), %rcx
movl 0x8(%rbx), %edx
imull %r12d, %edx
addl %r13d, %edx
imull 0x10(%rbx), %edx
movslq %edx, %rdx
movb %al, (%rcx,%rdx)
movsd 0x28(%rsp), %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movq 0x18(%rbx), %rcx
movl 0x8(%rbx), %edx
imull %r12d, %edx
addl %r13d, %edx
imull 0x10(%rbx), %edx
movslq %edx, %rdx
movb %al, 0x1(%rcx,%rdx)
movsd 0x20(%rsp), %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movq 0x18(%rbx), %rcx
movl 0x8(%rbx), %edx
imull %r12d, %edx
addl %r13d, %edx
imull 0x10(%rbx), %edx
movslq %edx, %rdx
movb %al, 0x2(%rcx,%rdx)
movq 0x18(%rbx), %rax
movl 0x8(%rbx), %ecx
imull %r12d, %ecx
addl %r13d, %ecx
imull 0x10(%rbx), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %esi
movq %rbp, %rdi
callq 0x2270
movq %rax, %rdi
movq %r15, %rsi
callq 0x2170
movq 0x18(%rbx), %rcx
movl 0x8(%rbx), %edx
imull %r12d, %edx
addl %r13d, %edx
imull 0x10(%rbx), %edx
movslq %edx, %rdx
movzbl 0x1(%rcx,%rdx), %esi
movq %rax, %rdi
callq 0x2270
movq %rax, %rdi
movq %r15, %rsi
callq 0x2170
movq 0x18(%rbx), %rcx
movl 0x8(%rbx), %edx
imull %r12d, %edx
addl %r13d, %edx
imull 0x10(%rbx), %edx
movslq %edx, %rdx
movzbl 0x2(%rcx,%rdx), %esi
movq %rax, %rdi
callq 0x2270
movq %rax, %rdi
callq 0x20c0
incl %r13d
jmp 0xc6de
incl %r12d
jmp 0xc6d1
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop