#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ XYZ2Lab(double *, double *);
double fabs(double);
double maxxyzdiff(double i1[3], double i2[3]) {
  int i;
  double tt, rv = 0.0;
  double in1[3], in2[3];
  XYZ2Lab(in1, i1);
  XYZ2Lab(in2, i2);
  for (i = 0; i < 3; i++) {
    tt = fabs(in1[i] - in2[i]);
    if (((tt) != (tt)))
      return tt;
    if (tt > rv)
      rv = tt;
  }
  return rv;
}


x86 assembly (clang, -O0):
<maxxyzdiff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <XYZ2Lab@plt>
lea    -0x70(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <XYZ2Lab@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    11ce <maxxyzdiff+0xbe>
movslq -0x1c(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
movslq -0x1c(%rbp),%rax
subsd  -0x70(%rbp,%rax,8),%xmm0
movaps 0xe92(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jne    1192 <maxxyzdiff+0x82>
jp     1192 <maxxyzdiff+0x82>
jmp    11a1 <maxxyzdiff+0x91>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d8 <maxxyzdiff+0xc8>
movsd  -0x28(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    11bb <maxxyzdiff+0xab>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    11c0 <maxxyzdiff+0xb0>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1149 <maxxyzdiff+0x39>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxxyzdiff>:
push   %rbx
sub    $0x40,%rsp
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0x20(%rsp),%rdi
call   1030 <XYZ2Lab@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1030 <XYZ2Lab@plt>
movsd  0x20(%rsp),%xmm1
subsd  (%rsp),%xmm1
movapd 0xebd(%rip),%xmm0
andpd  %xmm1,%xmm0
ucomisd %xmm1,%xmm1
jp     119d <maxxyzdiff+0x8d>
movsd  0x28(%rsp),%xmm2
subsd  0x8(%rsp),%xmm2
movapd 0xe9f(%rip),%xmm1
andpd  %xmm2,%xmm1
ucomisd %xmm2,%xmm2
jp     11a3 <maxxyzdiff+0x93>
movsd  0x30(%rsp),%xmm3
subsd  0x10(%rsp),%xmm3
movapd 0xe81(%rip),%xmm2
andpd  %xmm3,%xmm2
ucomisd %xmm3,%xmm3
jp     1199 <maxxyzdiff+0x89>
xorpd  %xmm3,%xmm3
maxsd  %xmm3,%xmm0
maxsd  %xmm0,%xmm1
maxsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
add    $0x40,%rsp
pop    %rbx
ret
movapd %xmm1,%xmm0
jmp    119d <maxxyzdiff+0x8d>

LLVM IR (-O0):
define double @maxxyzdiff(double* %0, double* %1) {
%3 = alloca double
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca [3 x double]
%10 = alloca [3 x double]
store double* %0, double** %4
store double* %1, double** %5
store double 0.000000e+00, double* %8
%11 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%12 = load double*, double** %4
%13 = call i32 @XYZ2Lab(double* %11, double* %12)
%14 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
%15 = load double*, double** %5
%16 = call i32 @XYZ2Lab(double* %14, double* %15)
store i32 0, i32* %6
br label %17
17: ; preds = %43, %2
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 3
br i1 %19, label %20, label %46
20: ; preds = %17
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 %22
%24 = load double, double* %23
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 %26
%28 = load double, double* %27
%29 = fsub double %24, %28
%30 = call double @llvm.fabs.f64(double %29)
store double %30, double* %7
%31 = load double, double* %7
%32 = load double, double* %7
%33 = fcmp une double %31, %32
br i1 %33, label %34, label %36
34: ; preds = %20
%35 = load double, double* %7
store double %35, double* %3
br label %48
36: ; preds = %20
%37 = load double, double* %7
%38 = load double, double* %8
%39 = fcmp ogt double %37, %38
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = load double, double* %7
store double %41, double* %8
br label %42
42: ; preds = %40, %36
br label %43
43: ; preds = %42
%44 = load i32, i32* %6
%45 = add nsw i32 %44, 1
store i32 %45, i32* %6
br label %17
46: ; preds = %17
%47 = load double, double* %8
store double %47, double* %3
br label %48
48: ; preds = %46, %34
%49 = load double, double* %3
ret double %49
}

LLVM IR (-O2):
define double @maxxyzdiff(double* %0, double* %1) {
%3 = alloca [3 x double]
%4 = alloca [3 x double]
%5 = bitcast [3 x double]* %3 to i8*
%6 = bitcast [3 x double]* %4 to i8*
%7 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%8 = call i32 @XYZ2Lab(double* %7, double* %0)
%9 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%10 = call i32 @XYZ2Lab(double* %9, double* %1)
%11 = load double, double* %7
%12 = load double, double* %9
%13 = fsub double %11, %12
%14 = call double @llvm.fabs.f64(double %13)
%15 = fcmp uno double %13, 0.000000e+00
br i1 %15, label %39, label %16
16: ; preds = %2
%17 = fcmp ogt double %14, 0.000000e+00
%18 = select i1 %17, double %14, double 0.000000e+00
%19 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 1
%20 = load double, double* %19
%21 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 1
%22 = load double, double* %21
%23 = fsub double %20, %22
%24 = call double @llvm.fabs.f64(double %23)
%25 = fcmp uno double %23, 0.000000e+00
br i1 %25, label %39, label %26
26: ; preds = %16
%27 = fcmp ogt double %24, %18
%28 = select i1 %27, double %24, double %18
%29 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 2
%30 = load double, double* %29
%31 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 2
%32 = load double, double* %31
%33 = fsub double %30, %32
%34 = call double @llvm.fabs.f64(double %33)
%35 = fcmp uno double %33, 0.000000e+00
br i1 %35, label %39, label %36
36: ; preds = %26
%37 = fcmp ogt double %34, %28
%38 = select i1 %37, double %34, double %28
br label %39
39: ; preds = %36, %26, %16, %2
%40 = phi double [ %14, %2 ], [ %24, %16 ], [ %34, %26 ], [ %38, %36 ]
ret double %40
}