#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 */
int /*<<< orphan*/ c_drev(int, double *, int);
int /*<<< orphan*/ printf(char *, int, double);
int main() {
  double x[] = {1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0};
  int N = 8;
  int strideX = 1;
  c_drev(N, x, strideX);
  for (int i = 0; i < 8; i++) {
    printf("x[ %i ] = %lf\n", i, x[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x40,%edx
call   1050 <memcpy@plt>
movl   $0x8,-0x54(%rbp)
movl   $0x1,-0x58(%rbp)
mov    -0x54(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%edx
call   1030 <c_drev@plt>
movl   $0x0,-0x5c(%rbp)
cmpl   $0x8,-0x5c(%rbp)
jge    11a9 <main+0x79>
mov    -0x5c(%rbp),%esi
movslq -0x5c(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1178 <main+0x48>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movaps 0xf04(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xee8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb0(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x8,%edi
mov    $0x1,%edx
call   1030 <c_drev@plt>
movsd  (%rsp),%xmm0
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <printf@plt>
movsd  0x20(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
movsd  0x28(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <printf@plt>
movsd  0x30(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x6,%esi
call   1040 <printf@plt>
movsd  0x38(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x7,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.x = [8 x double] [double 1.000000e+00, double -2.000000e+00, double 3.000000e+00, double -4.000000e+00, double 5.000000e+00, double -6.000000e+00, double 7.000000e+00, double -8.000000e+00]
@.str = [15 x i8] c"x[ %i ] = %lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x double]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [8 x double]* %2 to i8*
store i32 8, i32* %3
store i32 1, i32* %4
%7 = load i32, i32* %3
%8 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 0
%9 = load i32, i32* %4
%10 = call i32 @c_drev(i32 %7, double* %8, i32 %9)
store i32 0, i32* %5
br label %11
11: ; preds = %21, %0
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 8
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = load i32, i32* %5
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 %17
%19 = load double, double* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %15, double %19)
br label %21
21: ; preds = %14
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %11
24: ; preds = %11
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@__const.main.x = [8 x double] [double 1.000000e+00, double -2.000000e+00, double 3.000000e+00, double -4.000000e+00, double 5.000000e+00, double -6.000000e+00, double 7.000000e+00, double -8.000000e+00]
@.str = [15 x i8] c"x[ %i ] = %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = bitcast [8 x double]* %1 to i8*
%3 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%4 = call i32 @c_drev(i32 8, double* %3, i32 1)
%5 = load double, double* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 0, double %5)
%7 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 1
%8 = load double, double* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 1, double %8)
%10 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 2
%11 = load double, double* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 2, double %11)
%13 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 3
%14 = load double, double* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 3, double %14)
%16 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 4
%17 = load double, double* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 4, double %17)
%19 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 5
%20 = load double, double* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 5, double %20)
%22 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 6
%23 = load double, double* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 6, double %23)
%25 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 7
%26 = load double, double* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 7, double %26)
ret i32 0
}