#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 */
typedef size_t int64_t;

/* Variables and functions */
void __attribute__((no, noclone))
f_double(double *restrict dest, double *restrict src, int64_t *indices, int n) {
  for (int i = 0; i < n; ++i)
    dest[indices[i]] = src[i] + 1;
}


x86 assembly (clang, -O0):
<f_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    115e <f_double+0x5e>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  0xeca(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    111a <f_double+0x1a>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_double>:
test   %ecx,%ecx
jle    11bb <f_double+0xbb>
mov    %ecx,%r9d
lea    -0x1(%r9),%rax
mov    %r9d,%r8d
and    $0x3,%r8d
cmp    $0x3,%rax
jae    1120 <f_double+0x20>
xor    %eax,%eax
jmp    1187 <f_double+0x87>
and    $0xfffffffc,%r9d
xor    %eax,%eax
movsd  0xed2(%rip),%xmm0
xchg   %ax,%ax
movsd  (%rsi,%rax,8),%xmm1
addsd  %xmm0,%xmm1
mov    (%rdx,%rax,8),%rcx
movsd  %xmm1,(%rdi,%rcx,8)
movsd  0x8(%rsi,%rax,8),%xmm1
addsd  %xmm0,%xmm1
mov    0x8(%rdx,%rax,8),%rcx
movsd  %xmm1,(%rdi,%rcx,8)
movsd  0x10(%rsi,%rax,8),%xmm1
addsd  %xmm0,%xmm1
mov    0x10(%rdx,%rax,8),%rcx
movsd  %xmm1,(%rdi,%rcx,8)
movsd  0x18(%rsi,%rax,8),%xmm1
addsd  %xmm0,%xmm1
mov    0x18(%rdx,%rax,8),%rcx
movsd  %xmm1,(%rdi,%rcx,8)
add    $0x4,%rax
cmp    %rax,%r9
jne    1130 <f_double+0x30>
test   %r8,%r8
je     11bb <f_double+0xbb>
lea    (%rdx,%rax,8),%rcx
lea    (%rsi,%rax,8),%rax
xor    %edx,%edx
movsd  0xe62(%rip),%xmm0
xchg   %ax,%ax
movsd  (%rax,%rdx,8),%xmm1
addsd  %xmm0,%xmm1
mov    (%rcx,%rdx,8),%rsi
movsd  %xmm1,(%rdi,%rsi,8)
add    $0x1,%rdx
cmp    %rdx,%r8
jne    11a0 <f_double+0xa0>
ret

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

LLVM IR (-O2):
define void @f_double(double* noalias nocapture writeonly %0, double* noalias nocapture %1, i64* nocapture %2, i32 %3) {
%5 = icmp sgt i32 %3, 0
br i1 %5, label %6, label %28
6: ; preds = %4
%7 = zext i32 %3 to i64
%8 = add nsw i64 %7, -1
%9 = and i64 %7, 3
%10 = icmp ult i64 %8, 3
br i1 %10, label %13, label %11
11: ; preds = %6
%12 = and i64 %7, 4294967292
br label %29
13: ; preds = %29, %6
%14 = phi i64 [ 0, %6 ], [ %59, %29 ]
%15 = icmp eq i64 %9, 0
br i1 %15, label %28, label %16
16: ; preds = %13, %16
%17 = phi i64 [ %25, %16 ], [ %14, %13 ]
%18 = phi i64 [ %26, %16 ], [ 0, %13 ]
%19 = getelementptr inbounds double, double* %1, i64 %17
%20 = load double, double* %19
%21 = fadd double %20, 1.000000e+00
%22 = getelementptr inbounds i64, i64* %2, i64 %17
%23 = load i64, i64* %22
%24 = getelementptr inbounds double, double* %0, i64 %23
store double %21, double* %24
%25 = add nuw nsw i64 %17, 1
%26 = add i64 %18, 1
%27 = icmp eq i64 %26, %9
br i1 %27, label %28, label %16
28: ; preds = %13, %16, %4
ret void
29: ; preds = %29, %11
%30 = phi i64 [ 0, %11 ], [ %59, %29 ]
%31 = phi i64 [ 0, %11 ], [ %60, %29 ]
%32 = getelementptr inbounds double, double* %1, i64 %30
%33 = load double, double* %32
%34 = fadd double %33, 1.000000e+00
%35 = getelementptr inbounds i64, i64* %2, i64 %30
%36 = load i64, i64* %35
%37 = getelementptr inbounds double, double* %0, i64 %36
store double %34, double* %37
%38 = or i64 %30, 1
%39 = getelementptr inbounds double, double* %1, i64 %38
%40 = load double, double* %39
%41 = fadd double %40, 1.000000e+00
%42 = getelementptr inbounds i64, i64* %2, i64 %38
%43 = load i64, i64* %42
%44 = getelementptr inbounds double, double* %0, i64 %43
store double %41, double* %44
%45 = or i64 %30, 2
%46 = getelementptr inbounds double, double* %1, i64 %45
%47 = load double, double* %46
%48 = fadd double %47, 1.000000e+00
%49 = getelementptr inbounds i64, i64* %2, i64 %45
%50 = load i64, i64* %49
%51 = getelementptr inbounds double, double* %0, i64 %50
store double %48, double* %51
%52 = or i64 %30, 3
%53 = getelementptr inbounds double, double* %1, i64 %52
%54 = load double, double* %53
%55 = fadd double %54, 1.000000e+00
%56 = getelementptr inbounds i64, i64* %2, i64 %52
%57 = load i64, i64* %56
%58 = getelementptr inbounds double, double* %0, i64 %57
store double %55, double* %58
%59 = add nuw nsw i64 %30, 4
%60 = add i64 %31, 4
%61 = icmp eq i64 %60, %12
br i1 %61, label %13, label %29
}