// File: rishabh-battulwar[P]imageprocessing/./include/colorspace.h
// Function: Xyz2Rgb(double*, double*, double*, double, double, double)
void Xyz2Rgb(num *R, num *G, num *B, num X, num Y, num Z)
{	
	num R1, B1, G1, Min;
	
	
	R1 = (num)( 3.2406*X - 1.5372*Y - 0.4986*Z);
	G1 = (num)(-0.9689*X + 1.8758*Y + 0.0415*Z);
	B1 = (num)( 0.0557*X - 0.2040*Y + 1.0570*Z);
	
	Min = MIN3(R1, G1, B1);
	
	/* Force nonnegative values so that gamma correction is well-defined. */
	if(Min < 0)
	{
		R1 -= Min;
		G1 -= Min;
		B1 -= Min;
	}

	/* Transform from RGB to R'G'B' */
	*R = GAMMACORRECTION(R1);
	*G = GAMMACORRECTION(G1);
	*B = GAMMACORRECTION(B1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movsd %xmm0, -0x20(%rbp)
movsd %xmm1, -0x28(%rbp)
movsd %xmm2, -0x30(%rbp)
movsd -0x20(%rbp), %xmm1
movsd 0x121d5(%rip), %xmm0    # 0x1c358
mulsd -0x28(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x121a9(%rip), %xmm2    # 0x1c350
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x30(%rbp), %xmm0
movsd 0x1218c(%rip), %xmm2    # 0x1c348
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x20(%rbp), %xmm1
movsd 0x1216a(%rip), %xmm0    # 0x1c340
mulsd -0x28(%rbp), %xmm0
movsd 0x12155(%rip), %xmm2    # 0x1c338
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x30(%rbp), %xmm0
movsd 0x12138(%rip), %xmm2    # 0x1c330
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x20(%rbp), %xmm1
movsd 0x12116(%rip), %xmm0    # 0x1c328
mulsd -0x28(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x120ea(%rip), %xmm2    # 0x1c320
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x30(%rbp), %xmm0
movsd 0x120cd(%rip), %xmm2    # 0x1c318
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x38(%rbp), %xmm1
movsd -0x48(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0xa29a
movsd -0x38(%rbp), %xmm1
movsd -0x40(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0xa284
movsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
jmp 0xa28e
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
jmp 0xa2ca
movsd -0x48(%rbp), %xmm1
movsd -0x40(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0xa2b6
movsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
jmp 0xa2c0
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x50(%rbp), %xmm0
jbe 0xa317
movsd -0x50(%rbp), %xmm1
movsd -0x38(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x50(%rbp), %xmm1
movsd -0x48(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x50(%rbp), %xmm1
movsd -0x40(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd 0x12041(%rip), %xmm0    # 0x1c360
ucomisd -0x38(%rbp), %xmm0
jb 0xa33a
movsd 0x11f9a(%rip), %xmm0    # 0x1c2c8
mulsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
jmp 0xa369
movsd -0x38(%rbp), %xmm0
movsd 0x12029(%rip), %xmm1    # 0x1c370
callq 0x2350
movsd 0x11f64(%rip), %xmm1    # 0x1c2b8
mulsd %xmm1, %xmm0
movsd 0x12008(%rip), %xmm1    # 0x1c368
addsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movsd -0x70(%rbp), %xmm0
movq -0x8(%rbp), %rax
movsd %xmm0, (%rax)
movsd 0x11fe2(%rip), %xmm0    # 0x1c360
ucomisd -0x48(%rbp), %xmm0
jb 0xa399
movsd 0x11f3b(%rip), %xmm0    # 0x1c2c8
mulsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
jmp 0xa3c8
movsd -0x48(%rbp), %xmm0
movsd 0x11fca(%rip), %xmm1    # 0x1c370
callq 0x2350
movsd 0x11f05(%rip), %xmm1    # 0x1c2b8
mulsd %xmm1, %xmm0
movsd 0x11fa9(%rip), %xmm1    # 0x1c368
addsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x78(%rbp), %xmm0
movq -0x10(%rbp), %rax
movsd %xmm0, (%rax)
movsd 0x11f83(%rip), %xmm0    # 0x1c360
ucomisd -0x40(%rbp), %xmm0
jb 0xa3f8
movsd 0x11edc(%rip), %xmm0    # 0x1c2c8
mulsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
jmp 0xa427
movsd -0x40(%rbp), %xmm0
movsd 0x11f6b(%rip), %xmm1    # 0x1c370
callq 0x2350
movsd 0x11ea6(%rip), %xmm1    # 0x1c2b8
mulsd %xmm1, %xmm0
movsd 0x11f4a(%rip), %xmm1    # 0x1c368
addsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x80(%rbp), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, (%rax)
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)