void maxArray(double *x, double *y) {
  for (int i = 0; i < 65536; i++) {
    if (y[i] > x[i])
      x[i] = y[i];
  }
}


x86 assembly (clang, -O0):
<maxArray>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x10000,-0x14(%rbp)
jge    116d <maxArray+0x6d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    115a <maxArray+0x5a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    115f <maxArray+0x5f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <maxArray+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxArray>:
xor    %eax,%eax
jmp    111c <maxArray+0x1c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x2,%rax
cmp    $0x10000,%rax
je     1143 <maxArray+0x43>
movsd  (%rsi,%rax,8),%xmm0
ucomisd (%rdi,%rax,8),%xmm0
jbe    112d <maxArray+0x2d>
movsd  %xmm0,(%rdi,%rax,8)
movsd  0x8(%rsi,%rax,8),%xmm0
ucomisd 0x8(%rdi,%rax,8),%xmm0
jbe    1110 <maxArray+0x10>
movsd  %xmm0,0x8(%rdi,%rax,8)
jmp    1110 <maxArray+0x10>
ret

LLVM IR (-O0):
define void @maxArray(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca i32
store double* %0, double** %3
store double* %1, double** %4
store i32 0, i32* %5
br label %6
6: ; preds = %32, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 65536
br i1 %8, label %9, label %35
9: ; preds = %6
%10 = load double*, double** %4
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds double, double* %10, i64 %12
%14 = load double, double* %13
%15 = load double*, double** %3
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double, double* %15, i64 %17
%19 = load double, double* %18
%20 = fcmp ogt double %14, %19
br i1 %20, label %21, label %31
21: ; preds = %9
%22 = load double*, double** %4
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %22, i64 %24
%26 = load double, double* %25
%27 = load double*, double** %3
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
store double %26, double* %30
br label %31
31: ; preds = %21, %9
br label %32
32: ; preds = %31
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %6
35: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @maxArray(double* nocapture %0, double* nocapture %1) {
br label %4
3: ; preds = %20
ret void
4: ; preds = %20, %2
%5 = phi i64 [ 0, %2 ], [ %21, %20 ]
%6 = getelementptr inbounds double, double* %1, i64 %5
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %0, i64 %5
%9 = load double, double* %8
%10 = fcmp ogt double %7, %9
br i1 %10, label %11, label %12
11: ; preds = %4
store double %7, double* %8
br label %12
12: ; preds = %4, %11
%13 = or i64 %5, 1
%14 = getelementptr inbounds double, double* %1, i64 %13
%15 = load double, double* %14
%16 = getelementptr inbounds double, double* %0, i64 %13
%17 = load double, double* %16
%18 = fcmp ogt double %15, %17
br i1 %18, label %19, label %20
19: ; preds = %12
store double %15, double* %16
br label %20
20: ; preds = %19, %12
%21 = add nuw nsw i64 %5, 2
%22 = icmp eq i64 %21, 65536
br i1 %22, label %3, label %4
}