#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 int32_t;

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


x86 assembly (clang, -O0):
<f_double_32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1162 <f_double_32+0x62>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  0xec6(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
imul   -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    111c <f_double_32+0x1c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_double_32>:
push   %r14
push   %rbx
test   %rcx,%rcx
je     12bc <f_double_32+0x1bc>
xor    %r9d,%r9d
cmp    $0x4,%rcx
jb     11f3 <f_double_32+0xf3>
cmp    $0x1,%rdx
jne    11f3 <f_double_32+0xf3>
mov    %rcx,%r9
and    $0xfffffffffffffffc,%r9
lea    -0x4(%r9),%rax
mov    %rax,%r8
shr    $0x2,%r8
add    $0x1,%r8
test   %rax,%rax
je     12c0 <f_double_32+0x1c0>
mov    %r8,%r10
and    $0xfffffffffffffffe,%r10
mov    %rdx,%r11
shl    $0x5,%r11
lea    0x10(%rdi),%rbx
mov    %rdx,%r14
shl    $0x6,%r14
xor    %eax,%eax
movapd 0xe9b(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nop
movupd (%rsi,%rax,8),%xmm1
movupd 0x10(%rsi,%rax,8),%xmm2
addpd  %xmm0,%xmm1
addpd  %xmm0,%xmm2
movupd %xmm1,-0x10(%rbx)
movupd %xmm2,(%rbx)
movupd 0x20(%rsi,%rax,8),%xmm1
movupd 0x30(%rsi,%rax,8),%xmm2
addpd  %xmm0,%xmm1
addpd  %xmm0,%xmm2
movupd %xmm1,-0x10(%rbx,%r11,1)
movupd %xmm2,(%rbx,%r11,1)
add    $0x8,%rax
add    %r14,%rbx
add    $0xfffffffffffffffe,%r10
jne    1170 <f_double_32+0x70>
test   $0x1,%r8b
je     11ea <f_double_32+0xea>
movupd (%rsi,%rax,8),%xmm0
movupd 0x10(%rsi,%rax,8),%xmm1
movapd 0xe2d(%rip),%xmm2
addpd  %xmm2,%xmm0
addpd  %xmm2,%xmm1
imul   %rdx,%rax
movupd %xmm0,(%rdi,%rax,8)
movupd %xmm1,0x10(%rdi,%rax,8)
cmp    %rcx,%r9
je     12bc <f_double_32+0x1bc>
mov    %r9,%r8
not    %r8
add    %rcx,%r8
mov    %rcx,%rbx
and    $0x3,%rbx
je     123b <f_double_32+0x13b>
mov    %r9,%rax
imul   %rdx,%rax
lea    (%rdi,%rax,8),%rax
lea    0x0(,%rdx,8),%r10
movsd  0xdf0(%rip),%xmm0
movsd  (%rsi,%r9,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rax)
add    $0x1,%r9
add    %r10,%rax
add    $0xffffffffffffffff,%rbx
jne    1220 <f_double_32+0x120>
cmp    $0x3,%r8
jb     12bc <f_double_32+0x1bc>
lea    0x3(%r9),%r8
imul   %rdx,%r8
mov    %rdx,%r10
shl    $0x5,%r10
lea    0x2(%r9),%rbx
imul   %rdx,%rbx
lea    0x1(%r9),%rax
imul   %rdx,%rax
imul   %r9,%rdx
movsd  0xda4(%rip),%xmm0
nopl   0x0(%rax)
movsd  (%rsi,%r9,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rdi,%rdx,8)
movsd  0x8(%rsi,%r9,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rdi,%rax,8)
movsd  0x10(%rsi,%r9,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rdi,%rbx,8)
movsd  0x18(%rsi,%r9,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rdi,%r8,8)
add    $0x4,%r9
add    %r10,%rdi
cmp    %r9,%rcx
jne    1270 <f_double_32+0x170>
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
test   $0x1,%r8b
jne    11c0 <f_double_32+0xc0>
jmp    11ea <f_double_32+0xea>

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

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