#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 int /*<<< orphan*/ int32_t;

/* Variables and functions */
void __attribute__((no, noclone))
test_i32_i32_f64_2(int32_t *__restrict dest, int32_t *__restrict src,
                   double *__restrict cond, int n) {
  for (int i = 0; i < n; ++i)
    if (cond[i])
      dest[i] = src[i * 2];
}


x86 assembly (clang, -O0):
<test_i32_i32_f64_2>:
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    1179 <test_i32_i32_f64_2+0x79>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    114b <test_i32_i32_f64_2+0x4b>
jp     114b <test_i32_i32_f64_2+0x4b>
jmp    1166 <test_i32_i32_f64_2+0x66>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    116b <test_i32_i32_f64_2+0x6b>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    111a <test_i32_i32_f64_2+0x1a>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_i32_i32_f64_2>:
test   %ecx,%ecx
jle    112b <test_i32_i32_f64_2+0x2b>
mov    %ecx,%r8d
cmp    $0x1,%ecx
jne    112c <test_i32_i32_f64_2+0x2c>
xor    %eax,%eax
test   $0x1,%r8b
je     112b <test_i32_i32_f64_2+0x2b>
movsd  (%rdx,%rax,8),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1125 <test_i32_i32_f64_2+0x25>
jnp    112b <test_i32_i32_f64_2+0x2b>
mov    (%rsi,%rax,8),%ecx
mov    %ecx,(%rdi,%rax,4)
ret
mov    %r8d,%r9d
and    $0xfffffffe,%r9d
xor    %eax,%eax
xorpd  %xmm0,%xmm0
jmp    1149 <test_i32_i32_f64_2+0x49>
nopl   0x0(%rax,%rax,1)
add    $0x2,%rax
cmp    %rax,%r9
je     110e <test_i32_i32_f64_2+0xe>
movsd  (%rdx,%rax,8),%xmm1
ucomisd %xmm0,%xmm1
jne    1156 <test_i32_i32_f64_2+0x56>
jnp    115c <test_i32_i32_f64_2+0x5c>
mov    (%rsi,%rax,8),%ecx
mov    %ecx,(%rdi,%rax,4)
movsd  0x8(%rdx,%rax,8),%xmm1
ucomisd %xmm0,%xmm1
jne    116a <test_i32_i32_f64_2+0x6a>
jnp    1140 <test_i32_i32_f64_2+0x40>
mov    0x8(%rsi,%rax,8),%ecx
mov    %ecx,0x4(%rdi,%rax,4)
jmp    1140 <test_i32_i32_f64_2+0x40>

LLVM IR (-O0):
define void @test_i32_i32_f64_2(i32* noalias %0, i32* noalias %1, double* noalias %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store double* %2, double** %7
store i32 %3, i32* %8
store i32 0, i32* %9
br label %10
10: ; preds = %33, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %8
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %36
14: ; preds = %10
%15 = load double*, double** %7
%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 = fcmp une double %19, 0.000000e+00
br i1 %20, label %21, label %32
21: ; preds = %14
%22 = load i32*, i32** %6
%23 = load i32, i32* %9
%24 = mul nsw i32 %23, 2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %22, i64 %25
%27 = load i32, i32* %26
%28 = load i32*, i32** %5
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
store i32 %27, i32* %31
br label %32
32: ; preds = %21, %14
br label %33
33: ; preds = %32
%34 = load i32, i32* %9
%35 = add nsw i32 %34, 1
store i32 %35, i32* %9
br label %10
36: ; preds = %10
ret void
}

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