#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 maxNorm(double *v1, double *v2, int size) {
  double mymax = 0.;
#pragma omp parallel for reduction(max : mymax)
  for (int ii = 0; ii < size; ++ii) {
    if (fabs(*v1 - *v2) > mymax) {
      mymax = fabs(*v1 - *v2);
    }
    ++v1;
    ++v2;
  }
  return mymax;
}


x86 assembly (clang, -O0):
<maxNorm>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1196 <maxNorm+0x96>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movaps 0xebf(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1170 <maxNorm+0x70>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movaps 0xe99(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    111e <maxNorm+0x1e>
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxNorm>:
test   %edx,%edx
jle    1114 <maxNorm+0x14>
cmp    $0x1,%edx
jne    1118 <maxNorm+0x18>
xorpd  %xmm0,%xmm0
test   $0x1,%dl
jne    116e <maxNorm+0x6e>
jmp    1186 <maxNorm+0x86>
xorps  %xmm0,%xmm0
ret
mov    %edx,%r8d
and    $0xfffffffe,%r8d
xorpd  %xmm0,%xmm0
xor    %ecx,%ecx
movapd 0xed3(%rip),%xmm1
xor    %eax,%eax
nop
movsd  (%rdi,%rcx,8),%xmm2
subsd  (%rsi,%rcx,8),%xmm2
andpd  %xmm1,%xmm2
maxsd  %xmm0,%xmm2
movsd  0x8(%rdi,%rcx,8),%xmm0
subsd  0x8(%rsi,%rcx,8),%xmm0
andpd  %xmm1,%xmm0
maxsd  %xmm2,%xmm0
add    $0xfffffffffffffff0,%rax
add    $0x2,%rcx
cmp    %ecx,%r8d
jne    1130 <maxNorm+0x30>
sub    %rax,%rdi
sub    %rax,%rsi
test   $0x1,%dl
je     1186 <maxNorm+0x86>
movsd  (%rdi),%xmm1
subsd  (%rsi),%xmm1
andpd  0xe82(%rip),%xmm1
maxsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @maxNorm(double* nocapture %0, double* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %23
5: ; preds = %3
%6 = and i32 %2, 1
%7 = icmp eq i32 %2, 1
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = and i32 %2, -2
br label %25
10: ; preds = %25, %5
%11 = phi double [ undef, %5 ], [ %43, %25 ]
%12 = phi double [ 0.000000e+00, %5 ], [ %43, %25 ]
%13 = phi double* [ %0, %5 ], [ %44, %25 ]
%14 = phi double* [ %1, %5 ], [ %45, %25 ]
%15 = icmp eq i32 %6, 0
br i1 %15, label %23, label %16
16: ; preds = %10
%17 = load double, double* %13
%18 = load double, double* %14
%19 = fsub double %17, %18
%20 = tail call double @llvm.fabs.f64(double %19)
%21 = fcmp ogt double %20, %12
%22 = select i1 %21, double %20, double %12
br label %23
23: ; preds = %16, %10, %3
%24 = phi double [ 0.000000e+00, %3 ], [ %11, %10 ], [ %22, %16 ]
ret double %24
25: ; preds = %25, %8
%26 = phi double [ 0.000000e+00, %8 ], [ %43, %25 ]
%27 = phi double* [ %0, %8 ], [ %44, %25 ]
%28 = phi double* [ %1, %8 ], [ %45, %25 ]
%29 = phi i32 [ 0, %8 ], [ %46, %25 ]
%30 = load double, double* %27
%31 = load double, double* %28
%32 = fsub double %30, %31
%33 = tail call double @llvm.fabs.f64(double %32)
%34 = fcmp ogt double %33, %26
%35 = select i1 %34, double %33, double %26
%36 = getelementptr inbounds double, double* %27, i64 1
%37 = getelementptr inbounds double, double* %28, i64 1
%38 = load double, double* %36
%39 = load double, double* %37
%40 = fsub double %38, %39
%41 = tail call double @llvm.fabs.f64(double %40)
%42 = fcmp ogt double %41, %35
%43 = select i1 %42, double %41, double %35
%44 = getelementptr inbounds double, double* %27, i64 2
%45 = getelementptr inbounds double, double* %28, i64 2
%46 = add i32 %29, 2
%47 = icmp eq i32 %46, %9
br i1 %47, label %10, label %25
}