#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 */
double fabs(double);
double maxdiff(double in1[3], double in2[3]) {
  int i;
  double tt, rv = 0.0;
  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):
<maxdiff>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    11a6 <maxdiff+0xa6>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movaps 0xeba(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jne    116a <maxdiff+0x6a>
jp     116a <maxdiff+0x6a>
jmp    1179 <maxdiff+0x79>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11b0 <maxdiff+0xb0>
movsd  -0x28(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    1193 <maxdiff+0x93>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1198 <maxdiff+0x98>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    111b <maxdiff+0x1b>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxdiff>:
movsd  (%rdi),%xmm1
subsd  (%rsi),%xmm1
movapd 0xef0(%rip),%xmm0
andpd  %xmm1,%xmm0
ucomisd %xmm1,%xmm1
jp     1166 <maxdiff+0x66>
movsd  0x8(%rdi),%xmm2
subsd  0x8(%rsi),%xmm2
movapd 0xed4(%rip),%xmm1
andpd  %xmm2,%xmm1
ucomisd %xmm2,%xmm2
jp     1167 <maxdiff+0x67>
movsd  0x10(%rdi),%xmm3
subsd  0x10(%rsi),%xmm3
movapd 0xeb8(%rip),%xmm2
andpd  %xmm3,%xmm2
ucomisd %xmm3,%xmm3
jp     1162 <maxdiff+0x62>
xorpd  %xmm3,%xmm3
maxsd  %xmm3,%xmm0
maxsd  %xmm0,%xmm1
maxsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
ret
movapd %xmm1,%xmm0
ret

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

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