#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 */
void dbl_reverse(double *array, size_t n) {
  double *end = array + n;
  double t;
  while (--end > array) {
    t = *end;
    *end = *array;
    *array++ = t;
  }
}


x86 assembly (clang, -O0):
<dbl_reverse>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x18(%rbp)
cmp    -0x8(%rbp),%rax
jbe    116f <dbl_reverse+0x6f>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
movsd  %xmm0,(%rax)
jmp    111f <dbl_reverse+0x1f>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbl_reverse>:
lea    (%rdi,%rsi,8),%rax
add    $0xfffffffffffffff8,%rax
cmp    %rdi,%rax
jbe    1142 <dbl_reverse+0x42>
add    $0x8,%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rax),%xmm0
movsd  -0x8(%rdi),%xmm1
movsd  %xmm1,(%rax)
movsd  %xmm0,-0x8(%rdi)
add    $0xfffffffffffffff8,%rax
lea    0x8(%rdi),%rcx
cmp    %rdi,%rax
mov    %rcx,%rdi
ja     1120 <dbl_reverse+0x20>
ret

LLVM IR (-O0):
define void @dbl_reverse(double* %0, i64 %1) {
%3 = alloca double*
%4 = alloca i64
%5 = alloca double*
%6 = alloca double
store double* %0, double** %3
store i64 %1, i64* %4
%7 = load double*, double** %3
%8 = load i64, i64* %4
%9 = getelementptr inbounds double, double* %7, i64 %8
store double* %9, double** %5
br label %10
10: ; preds = %15, %2
%11 = load double*, double** %5
%12 = getelementptr inbounds double, double* %11, i32 -1
store double* %12, double** %5
%13 = load double*, double** %3
%14 = icmp ugt double* %12, %13
br i1 %14, label %15, label %24
15: ; preds = %10
%16 = load double*, double** %5
%17 = load double, double* %16
store double %17, double* %6
%18 = load double*, double** %3
%19 = load double, double* %18
%20 = load double*, double** %5
store double %19, double* %20
%21 = load double, double* %6
%22 = load double*, double** %3
%23 = getelementptr inbounds double, double* %22, i32 1
store double* %23, double** %3
store double %21, double* %22
br label %10
24: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @dbl_reverse(double* %0, i64 %1) {
%3 = getelementptr inbounds double, double* %0, i64 %1
%4 = getelementptr inbounds double, double* %3, i64 -1
%5 = icmp ugt double* %4, %0
br i1 %5, label %6, label %14
6: ; preds = %2, %6
%7 = phi double* [ %12, %6 ], [ %4, %2 ]
%8 = phi double* [ %11, %6 ], [ %0, %2 ]
%9 = load double, double* %7
%10 = load double, double* %8
store double %10, double* %7
%11 = getelementptr inbounds double, double* %8, i64 1
store double %9, double* %8
%12 = getelementptr inbounds double, double* %7, i64 -1
%13 = icmp ugt double* %12, %11
br i1 %13, label %6, label %14
14: ; preds = %6, %2
ret void
}