void netd_dbl_absmax_op(void *x, void *y, int nelem) {
  double *a = (double *)x;
  double *b = (double *)y;
  while (nelem--) {
    *a = ((((((*a) > 0) ? (*a) : (-(*a)))) > ((((*b) > 0) ? (*b) : (-(*b)))))
              ? ((((*a) > 0) ? (*a) : (-(*a))))
              : ((((*b) > 0) ? (*b) : (-(*b)))));
    a++;
    b++;
  }
}


x86 assembly (clang, -O0):
<netd_dbl_absmax_op>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     12c0 <netd_dbl_absmax_op+0x1c0>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    115a <netd_dbl_absmax_op+0x5a>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    117e <netd_dbl_absmax_op+0x7e>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11af <netd_dbl_absmax_op+0xaf>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    11d3 <netd_dbl_absmax_op+0xd3>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1241 <netd_dbl_absmax_op+0x141>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    120e <netd_dbl_absmax_op+0x10e>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1232 <netd_dbl_absmax_op+0x132>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1296 <netd_dbl_absmax_op+0x196>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1268 <netd_dbl_absmax_op+0x168>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    128c <netd_dbl_absmax_op+0x18c>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x28(%rbp)
jmp    111f <netd_dbl_absmax_op+0x1f>
pop    %rbp
ret

x86 assembly (clang, -O2):
<netd_dbl_absmax_op>:
test   %edx,%edx
je     11a4 <netd_dbl_absmax_op+0xa4>
mov    %edx,%eax
xor    %ecx,%ecx
movapd 0xeec(%rip),%xmm0
xorpd  %xmm8,%xmm8
jmp    112d <netd_dbl_absmax_op+0x2d>
nopl   0x0(%rax,%rax,1)
movsd  %xmm2,(%rdi,%rcx,8)
add    $0x1,%rcx
cmp    %ecx,%eax
je     11a4 <netd_dbl_absmax_op+0xa4>
movsd  (%rdi,%rcx,8),%xmm2
movapd %xmm2,%xmm3
xorpd  %xmm0,%xmm3
xorpd  %xmm6,%xmm6
cmpltsd %xmm2,%xmm6
movapd %xmm6,%xmm4
andpd  %xmm2,%xmm4
andnpd %xmm3,%xmm6
orpd   %xmm4,%xmm6
movsd  (%rsi,%rcx,8),%xmm5
movapd %xmm5,%xmm4
xorpd  %xmm0,%xmm4
xorpd  %xmm7,%xmm7
cmpltsd %xmm5,%xmm7
movapd %xmm7,%xmm1
andpd  %xmm5,%xmm1
andnpd %xmm4,%xmm7
orpd   %xmm1,%xmm7
ucomisd %xmm7,%xmm6
jbe    1190 <netd_dbl_absmax_op+0x90>
ucomisd %xmm8,%xmm2
ja     1120 <netd_dbl_absmax_op+0x20>
movapd %xmm3,%xmm2
jmp    1120 <netd_dbl_absmax_op+0x20>
nopl   0x0(%rax)
ucomisd %xmm8,%xmm5
movapd %xmm5,%xmm2
ja     1120 <netd_dbl_absmax_op+0x20>
movapd %xmm4,%xmm2
jmp    1120 <netd_dbl_absmax_op+0x20>
ret

LLVM IR (-O0):
define void @netd_dbl_absmax_op(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to double*
store double* %10, double** %7
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to double*
store double* %12, double** %8
br label %13
13: ; preds = %69, %3
%14 = load i32, i32* %6
%15 = add nsw i32 %14, -1
store i32 %15, i32* %6
%16 = icmp ne i32 %14, 0
br i1 %16, label %17, label %76
17: ; preds = %13
%18 = load double*, double** %7
%19 = load double, double* %18
%20 = fcmp ogt double %19, 0.000000e+00
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load double*, double** %7
%23 = load double, double* %22
br label %28
24: ; preds = %17
%25 = load double*, double** %7
%26 = load double, double* %25
%27 = fneg double %26
br label %28
28: ; preds = %24, %21
%29 = phi double [ %23, %21 ], [ %27, %24 ]
%30 = load double*, double** %8
%31 = load double, double* %30
%32 = fcmp ogt double %31, 0.000000e+00
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = load double*, double** %8
%35 = load double, double* %34
br label %40
36: ; preds = %28
%37 = load double*, double** %8
%38 = load double, double* %37
%39 = fneg double %38
br label %40
40: ; preds = %36, %33
%41 = phi double [ %35, %33 ], [ %39, %36 ]
%42 = fcmp ogt double %29, %41
br i1 %42, label %43, label %56
43: ; preds = %40
%44 = load double*, double** %7
%45 = load double, double* %44
%46 = fcmp ogt double %45, 0.000000e+00
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = load double*, double** %7
%49 = load double, double* %48
br label %54
50: ; preds = %43
%51 = load double*, double** %7
%52 = load double, double* %51
%53 = fneg double %52
br label %54
54: ; preds = %50, %47
%55 = phi double [ %49, %47 ], [ %53, %50 ]
br label %69
56: ; preds = %40
%57 = load double*, double** %8
%58 = load double, double* %57
%59 = fcmp ogt double %58, 0.000000e+00
br i1 %59, label %60, label %63
60: ; preds = %56
%61 = load double*, double** %8
%62 = load double, double* %61
br label %67
63: ; preds = %56
%64 = load double*, double** %8
%65 = load double, double* %64
%66 = fneg double %65
br label %67
67: ; preds = %63, %60
%68 = phi double [ %62, %60 ], [ %66, %63 ]
br label %69
69: ; preds = %67, %54
%70 = phi double [ %55, %54 ], [ %68, %67 ]
%71 = load double*, double** %7
store double %70, double* %71
%72 = load double*, double** %7
%73 = getelementptr inbounds double, double* %72, i32 1
store double* %73, double** %7
%74 = load double*, double** %8
%75 = getelementptr inbounds double, double* %74, i32 1
store double* %75, double** %8
br label %13
76: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @netd_dbl_absmax_op(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %31, label %5
5: ; preds = %3
%6 = bitcast i8* %1 to double*
%7 = bitcast i8* %0 to double*
br label %8
8: ; preds = %5, %26
%9 = phi i32 [ %12, %26 ], [ %2, %5 ]
%10 = phi double* [ %29, %26 ], [ %6, %5 ]
%11 = phi double* [ %28, %26 ], [ %7, %5 ]
%12 = add nsw i32 %9, -1
%13 = load double, double* %11
%14 = fcmp ogt double %13, 0.000000e+00
%15 = fneg double %13
%16 = select i1 %14, double %13, double %15
%17 = load double, double* %10
%18 = fcmp ogt double %17, 0.000000e+00
%19 = fneg double %17
%20 = select i1 %18, double %17, double %19
%21 = fcmp ogt double %16, %20
br i1 %21, label %22, label %24
22: ; preds = %8
br i1 %14, label %26, label %23
23: ; preds = %22
br label %26
24: ; preds = %8
br i1 %18, label %26, label %25
25: ; preds = %24
br label %26
26: ; preds = %24, %22, %25, %23
%27 = phi double [ %15, %23 ], [ %19, %25 ], [ %13, %22 ], [ %17, %24 ]
store double %27, double* %11
%28 = getelementptr inbounds double, double* %11, i64 1
%29 = getelementptr inbounds double, double* %10, i64 1
%30 = icmp eq i32 %12, 0
br i1 %30, label %31, label %8
31: ; preds = %26, %3
ret void
}