void reverse_it(double *input, double *output, int n) {
  int i, len;
  len = n / 2;
  if (len >= 4) {
    for (i = 0; i < (len % 4); ++i) {
      output[i] = input[n - 1 - i];
      output[n - 1 - i] = input[i];
    }
    for (; i < len; i += 4) {
      output[i] = input[n - i - 1];
      output[i + 1] = input[n - i - 2];
      output[i + 2] = input[n - i - 3];
      output[i + 3] = input[n - i - 4];
      output[n - i - 1] = input[i];
      output[n - i - 2] = input[i + 1];
      output[n - i - 3] = input[i + 2];
      output[n - i - 4] = input[i + 3];
    }
  } else if (len == 2) {
    output[0] = input[n - 1];
    output[1] = input[n - 2];
    output[n - 1] = input[0];
    output[n - 2] = input[1];
  } else if (len == 3) {
    output[0] = input[n - 1];
    output[1] = input[n - 2];
    output[2] = input[n - 3];
    output[n - 1] = input[0];
    output[n - 2] = input[1];
    output[n - 3] = input[2];
  } else {
    output[0] = input[n - 1];
    output[n - 1] = input[0];
  }
}


x86 assembly (clang, -O0):
<reverse_it>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jl     12ee <reverse_it+0x1ee>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%eax
cmp    %edx,%eax
jge    119c <reverse_it+0x9c>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
sub    -0x18(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
sub    -0x18(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112e <reverse_it+0x2e>
jmp    11a1 <reverse_it+0xa1>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12e9 <reverse_it+0x1e9>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    -0x18(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    -0x18(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    -0x18(%rbp),%ecx
sub    $0x4,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    -0x18(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    -0x18(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    -0x18(%rbp),%ecx
sub    $0x4,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x18(%rbp)
jmp    11a1 <reverse_it+0xa1>
jmp    1454 <reverse_it+0x354>
cmpl   $0x2,-0x1c(%rbp)
jne    1367 <reverse_it+0x267>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    144f <reverse_it+0x34f>
cmpl   $0x3,-0x1c(%rbp)
jne    1416 <reverse_it+0x316>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    144a <reverse_it+0x34a>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    144f <reverse_it+0x34f>
jmp    1454 <reverse_it+0x354>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse_it>:
cmp    $0x8,%edx
jl     118a <reverse_it+0x8a>
mov    %edx,%eax
shr    $0x1f,%eax
add    %edx,%eax
sar    %eax
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
mov    %eax,%r8d
sub    %ecx,%r8d
test   %r8d,%r8d
jle    11cc <reverse_it+0xcc>
lea    -0x1(%rdx),%ecx
movslq %ecx,%rcx
movsd  (%rdi,%rcx,8),%xmm0
movsd  %xmm0,(%rsi)
movsd  (%rdi),%xmm0
movsd  %xmm0,(%rsi,%rcx,8)
cmp    $0x1,%r8d
je     11cf <reverse_it+0xcf>
lea    -0x2(%rdx),%ecx
movslq %ecx,%rcx
movsd  (%rdi,%rcx,8),%xmm0
movsd  %xmm0,0x8(%rsi)
movsd  0x8(%rdi),%xmm0
movsd  %xmm0,(%rsi,%rcx,8)
cmp    $0x2,%r8d
je     11cf <reverse_it+0xcf>
lea    -0x3(%rdx),%ecx
movslq %ecx,%rcx
movsd  (%rdi,%rcx,8),%xmm0
movsd  %xmm0,0x10(%rsi)
movsd  0x10(%rdi),%xmm0
movsd  %xmm0,(%rsi,%rcx,8)
jmp    11cf <reverse_it+0xcf>
mov    %edx,%eax
and    $0xfffffffe,%eax
cmp    $0x6,%eax
je     125a <reverse_it+0x15a>
cmp    $0x4,%eax
jne    1299 <reverse_it+0x199>
lea    -0x1(%rdx),%eax
movsd  (%rdi,%rax,8),%xmm0
movsd  %xmm0,(%rsi)
add    $0xfffffffe,%edx
movsd  (%rdi,%rdx,8),%xmm0
movsd  %xmm0,0x8(%rsi)
movsd  (%rdi),%xmm0
movsd  %xmm0,(%rsi,%rax,8)
add    $0x8,%rdi
jmp    12aa <reverse_it+0x1aa>
xor    %r8d,%r8d
cmp    %eax,%r8d
jge    1259 <reverse_it+0x159>
mov    %r8d,%ecx
movslq %edx,%rdx
cltq
sub    %rcx,%rdx
add    $0xfffffffffffffffc,%rdx
nopw   0x0(%rax,%rax,1)
movsd  0x18(%rdi,%rdx,8),%xmm0
movsd  %xmm0,(%rsi,%rcx,8)
movsd  0x10(%rdi,%rdx,8),%xmm0
movsd  %xmm0,0x8(%rsi,%rcx,8)
movsd  0x8(%rdi,%rdx,8),%xmm0
movsd  %xmm0,0x10(%rsi,%rcx,8)
movsd  (%rdi,%rdx,8),%xmm0
movsd  %xmm0,0x18(%rsi,%rcx,8)
movsd  (%rdi,%rcx,8),%xmm0
movsd  %xmm0,0x18(%rsi,%rdx,8)
movsd  0x8(%rdi,%rcx,8),%xmm0
movsd  %xmm0,0x10(%rsi,%rdx,8)
movsd  0x10(%rdi,%rcx,8),%xmm0
movsd  %xmm0,0x8(%rsi,%rdx,8)
movsd  0x18(%rdi,%rcx,8),%xmm0
movsd  %xmm0,(%rsi,%rdx,8)
add    $0x4,%rcx
add    $0xfffffffffffffffc,%rdx
cmp    %rax,%rcx
jl     11f0 <reverse_it+0xf0>
ret
lea    -0x1(%rdx),%eax
movsd  (%rdi,%rax,8),%xmm0
movsd  %xmm0,(%rsi)
lea    -0x2(%rdx),%ecx
movsd  (%rdi,%rcx,8),%xmm0
movsd  %xmm0,0x8(%rsi)
add    $0xfffffffd,%edx
movsd  (%rdi,%rdx,8),%xmm0
movsd  %xmm0,0x10(%rsi)
movsd  (%rdi),%xmm0
movsd  %xmm0,(%rsi,%rax,8)
movsd  0x8(%rdi),%xmm0
movsd  %xmm0,(%rsi,%rcx,8)
add    $0x10,%rdi
jmp    12aa <reverse_it+0x1aa>
movslq %edx,%rdx
movsd  -0x8(%rdi,%rdx,8),%xmm0
add    $0xffffffffffffffff,%rdx
movsd  %xmm0,(%rsi)
movsd  (%rdi),%xmm0
movsd  %xmm0,(%rsi,%rdx,8)
ret

LLVM IR (-O0):
define void @reverse_it(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = sdiv i32 %9, 2
store i32 %10, i32* %8
%11 = load i32, i32* %8
%12 = icmp sge i32 %11, 4
br i1 %12, label %13, label %159
13: ; preds = %3
store i32 0, i32* %7
br label %14
14: ; preds = %44, %13
%15 = load i32, i32* %7
%16 = load i32, i32* %8
%17 = srem i32 %16, 4
%18 = icmp slt i32 %15, %17
br i1 %18, label %19, label %47
19: ; preds = %14
%20 = load double*, double** %4
%21 = load i32, i32* %6
%22 = sub nsw i32 %21, 1
%23 = load i32, i32* %7
%24 = sub nsw i32 %22, %23
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %20, i64 %25
%27 = load double, double* %26
%28 = load double*, double** %5
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %28, i64 %30
store double %27, double* %31
%32 = load double*, double** %4
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %32, i64 %34
%36 = load double, double* %35
%37 = load double*, double** %5
%38 = load i32, i32* %6
%39 = sub nsw i32 %38, 1
%40 = load i32, i32* %7
%41 = sub nsw i32 %39, %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %37, i64 %42
store double %36, double* %43
br label %44
44: ; preds = %19
%45 = load i32, i32* %7
%46 = add nsw i32 %45, 1
store i32 %46, i32* %7
br label %14
47: ; preds = %14
br label %48
48: ; preds = %155, %47
%49 = load i32, i32* %7
%50 = load i32, i32* %8
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %158
52: ; preds = %48
%53 = load double*, double** %4
%54 = load i32, i32* %6
%55 = load i32, i32* %7
%56 = sub nsw i32 %54, %55
%57 = sub nsw i32 %56, 1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %53, i64 %58
%60 = load double, double* %59
%61 = load double*, double** %5
%62 = load i32, i32* %7
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %61, i64 %63
store double %60, double* %64
%65 = load double*, double** %4
%66 = load i32, i32* %6
%67 = load i32, i32* %7
%68 = sub nsw i32 %66, %67
%69 = sub nsw i32 %68, 2
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double, double* %65, i64 %70
%72 = load double, double* %71
%73 = load double*, double** %5
%74 = load i32, i32* %7
%75 = add nsw i32 %74, 1
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds double, double* %73, i64 %76
store double %72, double* %77
%78 = load double*, double** %4
%79 = load i32, i32* %6
%80 = load i32, i32* %7
%81 = sub nsw i32 %79, %80
%82 = sub nsw i32 %81, 3
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %78, i64 %83
%85 = load double, double* %84
%86 = load double*, double** %5
%87 = load i32, i32* %7
%88 = add nsw i32 %87, 2
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds double, double* %86, i64 %89
store double %85, double* %90
%91 = load double*, double** %4
%92 = load i32, i32* %6
%93 = load i32, i32* %7
%94 = sub nsw i32 %92, %93
%95 = sub nsw i32 %94, 4
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double, double* %91, i64 %96
%98 = load double, double* %97
%99 = load double*, double** %5
%100 = load i32, i32* %7
%101 = add nsw i32 %100, 3
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds double, double* %99, i64 %102
store double %98, double* %103
%104 = load double*, double** %4
%105 = load i32, i32* %7
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %104, i64 %106
%108 = load double, double* %107
%109 = load double*, double** %5
%110 = load i32, i32* %6
%111 = load i32, i32* %7
%112 = sub nsw i32 %110, %111
%113 = sub nsw i32 %112, 1
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds double, double* %109, i64 %114
store double %108, double* %115
%116 = load double*, double** %4
%117 = load i32, i32* %7
%118 = add nsw i32 %117, 1
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds double, double* %116, i64 %119
%121 = load double, double* %120
%122 = load double*, double** %5
%123 = load i32, i32* %6
%124 = load i32, i32* %7
%125 = sub nsw i32 %123, %124
%126 = sub nsw i32 %125, 2
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds double, double* %122, i64 %127
store double %121, double* %128
%129 = load double*, double** %4
%130 = load i32, i32* %7
%131 = add nsw i32 %130, 2
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds double, double* %129, i64 %132
%134 = load double, double* %133
%135 = load double*, double** %5
%136 = load i32, i32* %6
%137 = load i32, i32* %7
%138 = sub nsw i32 %136, %137
%139 = sub nsw i32 %138, 3
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds double, double* %135, i64 %140
store double %134, double* %141
%142 = load double*, double** %4
%143 = load i32, i32* %7
%144 = add nsw i32 %143, 3
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds double, double* %142, i64 %145
%147 = load double, double* %146
%148 = load double*, double** %5
%149 = load i32, i32* %6
%150 = load i32, i32* %7
%151 = sub nsw i32 %149, %150
%152 = sub nsw i32 %151, 4
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds double, double* %148, i64 %153
store double %147, double* %154
br label %155
155: ; preds = %52
%156 = load i32, i32* %7
%157 = add nsw i32 %156, 4
store i32 %157, i32* %7
br label %48
158: ; preds = %48
br label %266
159: ; preds = %3
%160 = load i32, i32* %8
%161 = icmp eq i32 %160, 2
br i1 %161, label %162, label %195
162: ; preds = %159
%163 = load double*, double** %4
%164 = load i32, i32* %6
%165 = sub nsw i32 %164, 1
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds double, double* %163, i64 %166
%168 = load double, double* %167
%169 = load double*, double** %5
%170 = getelementptr inbounds double, double* %169, i64 0
store double %168, double* %170
%171 = load double*, double** %4
%172 = load i32, i32* %6
%173 = sub nsw i32 %172, 2
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double, double* %171, i64 %174
%176 = load double, double* %175
%177 = load double*, double** %5
%178 = getelementptr inbounds double, double* %177, i64 1
store double %176, double* %178
%179 = load double*, double** %4
%180 = getelementptr inbounds double, double* %179, i64 0
%181 = load double, double* %180
%182 = load double*, double** %5
%183 = load i32, i32* %6
%184 = sub nsw i32 %183, 1
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds double, double* %182, i64 %185
store double %181, double* %186
%187 = load double*, double** %4
%188 = getelementptr inbounds double, double* %187, i64 1
%189 = load double, double* %188
%190 = load double*, double** %5
%191 = load i32, i32* %6
%192 = sub nsw i32 %191, 2
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds double, double* %190, i64 %193
store double %189, double* %194
br label %265
195: ; preds = %159
%196 = load i32, i32* %8
%197 = icmp eq i32 %196, 3
br i1 %197, label %198, label %247
198: ; preds = %195
%199 = load double*, double** %4
%200 = load i32, i32* %6
%201 = sub nsw i32 %200, 1
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds double, double* %199, i64 %202
%204 = load double, double* %203
%205 = load double*, double** %5
%206 = getelementptr inbounds double, double* %205, i64 0
store double %204, double* %206
%207 = load double*, double** %4
%208 = load i32, i32* %6
%209 = sub nsw i32 %208, 2
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds double, double* %207, i64 %210
%212 = load double, double* %211
%213 = load double*, double** %5
%214 = getelementptr inbounds double, double* %213, i64 1
store double %212, double* %214
%215 = load double*, double** %4
%216 = load i32, i32* %6
%217 = sub nsw i32 %216, 3
%218 = sext i32 %217 to i64
%219 = getelementptr inbounds double, double* %215, i64 %218
%220 = load double, double* %219
%221 = load double*, double** %5
%222 = getelementptr inbounds double, double* %221, i64 2
store double %220, double* %222
%223 = load double*, double** %4
%224 = getelementptr inbounds double, double* %223, i64 0
%225 = load double, double* %224
%226 = load double*, double** %5
%227 = load i32, i32* %6
%228 = sub nsw i32 %227, 1
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds double, double* %226, i64 %229
store double %225, double* %230
%231 = load double*, double** %4
%232 = getelementptr inbounds double, double* %231, i64 1
%233 = load double, double* %232
%234 = load double*, double** %5
%235 = load i32, i32* %6
%236 = sub nsw i32 %235, 2
%237 = sext i32 %236 to i64
%238 = getelementptr inbounds double, double* %234, i64 %237
store double %233, double* %238
%239 = load double*, double** %4
%240 = getelementptr inbounds double, double* %239, i64 2
%241 = load double, double* %240
%242 = load double*, double** %5
%243 = load i32, i32* %6
%244 = sub nsw i32 %243, 3
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds double, double* %242, i64 %245
store double %241, double* %246
br label %264
247: ; preds = %195
%248 = load double*, double** %4
%249 = load i32, i32* %6
%250 = sub nsw i32 %249, 1
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds double, double* %248, i64 %251
%253 = load double, double* %252
%254 = load double*, double** %5
%255 = getelementptr inbounds double, double* %254, i64 0
store double %253, double* %255
%256 = load double*, double** %4
%257 = getelementptr inbounds double, double* %256, i64 0
%258 = load double, double* %257
%259 = load double*, double** %5
%260 = load i32, i32* %6
%261 = sub nsw i32 %260, 1
%262 = sext i32 %261 to i64
%263 = getelementptr inbounds double, double* %259, i64 %262
store double %258, double* %263
br label %264
264: ; preds = %247, %198
br label %265
265: ; preds = %264, %162
br label %266
266: ; preds = %265, %158
ret void
}

LLVM IR (-O2):
define void @reverse_it(double* %0, double* writeonly %1, i32 %2) {
%4 = sdiv i32 %2, 2
%5 = icmp sgt i32 %2, 7
br i1 %5, label %6, label %79
6: ; preds = %3
%7 = srem i32 %4, 4
%8 = icmp sgt i32 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %16, %24, %34, %6
%10 = phi i32 [ 0, %6 ], [ %7, %34 ], [ %7, %24 ], [ %7, %16 ]
%11 = icmp slt i32 %10, %4
br i1 %11, label %12, label %125
12: ; preds = %9
%13 = zext i32 %10 to i64
%14 = sext i32 %2 to i64
%15 = sext i32 %4 to i64
br label %43
16: ; preds = %6
%17 = add i32 %2, -1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %0, i64 %18
%20 = load double, double* %19
store double %20, double* %1
%21 = load double, double* %0
%22 = getelementptr inbounds double, double* %1, i64 %18
store double %21, double* %22
%23 = icmp eq i32 %7, 1
br i1 %23, label %9, label %24
24: ; preds = %16
%25 = add i32 %2, -2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %0, i64 %26
%28 = load double, double* %27
%29 = getelementptr inbounds double, double* %1, i64 1
store double %28, double* %29
%30 = getelementptr inbounds double, double* %0, i64 1
%31 = load double, double* %30
%32 = getelementptr inbounds double, double* %1, i64 %26
store double %31, double* %32
%33 = icmp eq i32 %7, 2
br i1 %33, label %9, label %34
34: ; preds = %24
%35 = add i32 %2, -3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %0, i64 %36
%38 = load double, double* %37
%39 = getelementptr inbounds double, double* %1, i64 2
store double %38, double* %39
%40 = getelementptr inbounds double, double* %0, i64 2
%41 = load double, double* %40
%42 = getelementptr inbounds double, double* %1, i64 %36
store double %41, double* %42
br label %9
43: ; preds = %12, %43
%44 = phi i64 [ %13, %12 ], [ %77, %43 ]
%45 = sub nsw i64 %14, %44
%46 = add nsw i64 %45, -1
%47 = getelementptr inbounds double, double* %0, i64 %46
%48 = load double, double* %47
%49 = getelementptr inbounds double, double* %1, i64 %44
store double %48, double* %49
%50 = add nsw i64 %45, -2
%51 = getelementptr inbounds double, double* %0, i64 %50
%52 = load double, double* %51
%53 = add nuw nsw i64 %44, 1
%54 = getelementptr inbounds double, double* %1, i64 %53
store double %52, double* %54
%55 = add nsw i64 %45, -3
%56 = getelementptr inbounds double, double* %0, i64 %55
%57 = load double, double* %56
%58 = add nuw nsw i64 %44, 2
%59 = getelementptr inbounds double, double* %1, i64 %58
store double %57, double* %59
%60 = add nsw i64 %45, -4
%61 = getelementptr inbounds double, double* %0, i64 %60
%62 = load double, double* %61
%63 = add nuw nsw i64 %44, 3
%64 = getelementptr inbounds double, double* %1, i64 %63
store double %62, double* %64
%65 = getelementptr inbounds double, double* %0, i64 %44
%66 = load double, double* %65
%67 = getelementptr inbounds double, double* %1, i64 %46
store double %66, double* %67
%68 = getelementptr inbounds double, double* %0, i64 %53
%69 = load double, double* %68
%70 = getelementptr inbounds double, double* %1, i64 %50
store double %69, double* %70
%71 = getelementptr inbounds double, double* %0, i64 %58
%72 = load double, double* %71
%73 = getelementptr inbounds double, double* %1, i64 %55
store double %72, double* %73
%74 = getelementptr inbounds double, double* %0, i64 %63
%75 = load double, double* %74
%76 = getelementptr inbounds double, double* %1, i64 %60
store double %75, double* %76
%77 = add nuw nsw i64 %44, 4
%78 = icmp slt i64 %77, %15
br i1 %78, label %43, label %125
79: ; preds = %3
%80 = and i32 %2, -2
switch i32 %80, label %115 [
i32 4, label %81
i32 6, label %94
]
81: ; preds = %79
%82 = add nsw i32 %2, -1
%83 = zext i32 %82 to i64
%84 = getelementptr inbounds double, double* %0, i64 %83
%85 = load double, double* %84
store double %85, double* %1
%86 = add nsw i32 %2, -2
%87 = zext i32 %86 to i64
%88 = getelementptr inbounds double, double* %0, i64 %87
%89 = load double, double* %88
%90 = getelementptr inbounds double, double* %1, i64 1
store double %89, double* %90
%91 = load double, double* %0
%92 = getelementptr inbounds double, double* %1, i64 %83
store double %91, double* %92
%93 = getelementptr inbounds double, double* %0, i64 1
br label %120
94: ; preds = %79
%95 = add nsw i32 %2, -1
%96 = zext i32 %95 to i64
%97 = getelementptr inbounds double, double* %0, i64 %96
%98 = load double, double* %97
store double %98, double* %1
%99 = add nsw i32 %2, -2
%100 = zext i32 %99 to i64
%101 = getelementptr inbounds double, double* %0, i64 %100
%102 = load double, double* %101
%103 = getelementptr inbounds double, double* %1, i64 1
store double %102, double* %103
%104 = add nsw i32 %2, -3
%105 = zext i32 %104 to i64
%106 = getelementptr inbounds double, double* %0, i64 %105
%107 = load double, double* %106
%108 = getelementptr inbounds double, double* %1, i64 2
store double %107, double* %108
%109 = load double, double* %0
%110 = getelementptr inbounds double, double* %1, i64 %96
store double %109, double* %110
%111 = getelementptr inbounds double, double* %0, i64 1
%112 = load double, double* %111
%113 = getelementptr inbounds double, double* %1, i64 %100
store double %112, double* %113
%114 = getelementptr inbounds double, double* %0, i64 2
br label %120
115: ; preds = %79
%116 = add nsw i32 %2, -1
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds double, double* %0, i64 %117
%119 = load double, double* %118
store double %119, double* %1
br label %120
120: ; preds = %94, %115, %81
%121 = phi double* [ %93, %81 ], [ %0, %115 ], [ %114, %94 ]
%122 = phi i64 [ %87, %81 ], [ %117, %115 ], [ %105, %94 ]
%123 = load double, double* %121
%124 = getelementptr inbounds double, double* %1, i64 %122
store double %123, double* %124
br label %125
125: ; preds = %43, %120, %9
ret void
}