#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 f_double_double(double *restrict dest, double *restrict src,
                     double *restrict cmp1, double *restrict cmp2,
                     int64_t *restrict indices, int n) {
  for (int i = 0; i < n; ++i)
    if (cmp1[i] == cmp2[i])
      dest[indices[i]] = src[i] + 1;
}


x86 assembly (clang, -O0):
<f_double_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1192 <f_double_double+0x92>
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x30(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jne    117f <f_double_double+0x7f>
jp     117f <f_double_double+0x7f>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  0xe9b(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq -0x30(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1184 <f_double_double+0x84>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1123 <f_double_double+0x23>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_double_double>:
test   %r9d,%r9d
jle    113e <f_double_double+0x3e>
mov    %r9d,%r10d
cmp    $0x1,%r9d
jne    113f <f_double_double+0x3f>
xor    %r11d,%r11d
test   $0x1,%r10b
je     113e <f_double_double+0x3e>
movsd  (%rdx,%r11,8),%xmm0
ucomisd (%rcx,%r11,8),%xmm0
jne    113e <f_double_double+0x3e>
jp     113e <f_double_double+0x3e>
movsd  (%rsi,%r11,8),%xmm0
addsd  0xecb(%rip),%xmm0
mov    (%r8,%r11,8),%rax
movsd  %xmm0,(%rdi,%rax,8)
ret
mov    %r10d,%r9d
and    $0xfffffffe,%r9d
xor    %r11d,%r11d
movsd  0xeaf(%rip),%xmm0
jmp    1169 <f_double_double+0x69>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x2,%r11
cmp    %r11,%r9
je     1111 <f_double_double+0x11>
movsd  (%rdx,%r11,8),%xmm1
ucomisd (%rcx,%r11,8),%xmm1
jne    118c <f_double_double+0x8c>
jp     118c <f_double_double+0x8c>
movsd  (%rsi,%r11,8),%xmm1
addsd  %xmm0,%xmm1
mov    (%r8,%r11,8),%rax
movsd  %xmm1,(%rdi,%rax,8)
movsd  0x8(%rdx,%r11,8),%xmm1
ucomisd 0x8(%rcx,%r11,8),%xmm1
jne    1160 <f_double_double+0x60>
jp     1160 <f_double_double+0x60>
movsd  0x8(%rsi,%r11,8),%xmm1
addsd  %xmm0,%xmm1
mov    0x8(%r8,%r11,8),%rax
movsd  %xmm1,(%rdi,%rax,8)
jmp    1160 <f_double_double+0x60>

LLVM IR (-O0):
define void @f_double_double(double* noalias %0, double* noalias %1, double* noalias %2, double* noalias %3, i64* noalias %4, i32 %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i64*
%12 = alloca i32
%13 = alloca i32
store double* %0, double** %7
store double* %1, double** %8
store double* %2, double** %9
store double* %3, double** %10
store i64* %4, i64** %11
store i32 %5, i32* %12
store i32 0, i32* %13
br label %14
14: ; preds = %45, %6
%15 = load i32, i32* %13
%16 = load i32, i32* %12
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %48
18: ; preds = %14
%19 = load double*, double** %9
%20 = load i32, i32* %13
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %19, i64 %21
%23 = load double, double* %22
%24 = load double*, double** %10
%25 = load i32, i32* %13
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
%28 = load double, double* %27
%29 = fcmp oeq double %23, %28
br i1 %29, label %30, label %44
30: ; preds = %18
%31 = load double*, double** %8
%32 = load i32, i32* %13
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %31, i64 %33
%35 = load double, double* %34
%36 = fadd double %35, 1.000000e+00
%37 = load double*, double** %7
%38 = load i64*, i64** %11
%39 = load i32, i32* %13
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i64, i64* %38, i64 %40
%42 = load i64, i64* %41
%43 = getelementptr inbounds double, double* %37, i64 %42
store double %36, double* %43
br label %44
44: ; preds = %30, %18
br label %45
45: ; preds = %44
%46 = load i32, i32* %13
%47 = add nsw i32 %46, 1
store i32 %47, i32* %13
br label %14
48: ; preds = %14
ret void
}

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