#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_int64_t_double(int64_t *restrict dest, int64_t *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_int64_t_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    118c <f_int64_t_double+0x8c>
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    1179 <f_int64_t_double+0x79>
jp     1179 <f_int64_t_double+0x79>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
add    $0x1,%rdx
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq -0x30(%rbp),%rsi
mov    (%rcx,%rsi,8),%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    117e <f_int64_t_double+0x7e>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1123 <f_int64_t_double+0x23>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_int64_t_double>:
push   %rbx
test   %r9d,%r9d
jle    1135 <f_int64_t_double+0x35>
mov    %r9d,%r10d
cmp    $0x1,%r9d
jne    1137 <f_int64_t_double+0x37>
xor    %eax,%eax
test   $0x1,%r10b
je     1135 <f_int64_t_double+0x35>
movsd  (%rdx,%rax,8),%xmm0
ucomisd (%rcx,%rax,8),%xmm0
jne    1135 <f_int64_t_double+0x35>
jp     1135 <f_int64_t_double+0x35>
mov    (%rsi,%rax,8),%rcx
add    $0x1,%rcx
mov    (%r8,%rax,8),%rax
mov    %rcx,(%rdi,%rax,8)
pop    %rbx
ret
mov    %r10d,%r9d
and    $0xfffffffe,%r9d
xor    %eax,%eax
jmp    1159 <f_int64_t_double+0x59>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x2,%rax
cmp    %rax,%r9
je     1111 <f_int64_t_double+0x11>
movsd  (%rdx,%rax,8),%xmm0
ucomisd (%rcx,%rax,8),%xmm0
jne    1177 <f_int64_t_double+0x77>
jp     1177 <f_int64_t_double+0x77>
mov    (%rsi,%rax,8),%r11
add    $0x1,%r11
mov    (%r8,%rax,8),%rbx
mov    %r11,(%rdi,%rbx,8)
movsd  0x8(%rdx,%rax,8),%xmm0
ucomisd 0x8(%rcx,%rax,8),%xmm0
jne    1150 <f_int64_t_double+0x50>
jp     1150 <f_int64_t_double+0x50>
mov    0x8(%rsi,%rax,8),%r11
add    $0x1,%r11
mov    0x8(%r8,%rax,8),%rbx
mov    %r11,(%rdi,%rbx,8)
jmp    1150 <f_int64_t_double+0x50>

LLVM IR (-O0):
define void @f_int64_t_double(i64* noalias %0, i64* noalias %1, double* noalias %2, double* noalias %3, i64* noalias %4, i32 %5) {
%7 = alloca i64*
%8 = alloca i64*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i64*
%12 = alloca i32
%13 = alloca i32
store i64* %0, i64** %7
store i64* %1, i64** %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 i64*, i64** %8
%32 = load i32, i32* %13
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i64, i64* %31, i64 %33
%35 = load i64, i64* %34
%36 = add i64 %35, 1
%37 = load i64*, i64** %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 i64, i64* %37, i64 %42
store i64 %36, i64* %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_int64_t_double(i64* noalias nocapture writeonly %0, i64* 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 i64, i64* %1, i64 %15
%25 = load i64, i64* %24
%26 = add i64 %25, 1
%27 = getelementptr inbounds i64, i64* %4, i64 %15
%28 = load i64, i64* %27
%29 = getelementptr inbounds i64, i64* %0, i64 %28
store i64 %26, i64* %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 i64, i64* %1, i64 %32
%41 = load i64, i64* %40
%42 = add i64 %41, 1
%43 = getelementptr inbounds i64, i64* %4, i64 %32
%44 = load i64, i64* %43
%45 = getelementptr inbounds i64, i64* %0, i64 %44
store i64 %42, i64* %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 i64, i64* %1, i64 %47
%55 = load i64, i64* %54
%56 = add i64 %55, 1
%57 = getelementptr inbounds i64, i64* %4, i64 %47
%58 = load i64, i64* %57
%59 = getelementptr inbounds i64, i64* %0, i64 %58
store i64 %56, i64* %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
}