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

/* Variables and functions */
void vlogical_imm_and18_int32_t(int32_t *dst, int count) {
  for (int i = 0; i < count; i++)
    dst[i] = dst[i] & 18;
}


x86 assembly (clang, -O0):
<vlogical_imm_and18_int32_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1145 <vlogical_imm_and18_int32_t+0x45>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
and    $0x12,%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <vlogical_imm_and18_int32_t+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<vlogical_imm_and18_int32_t>:
test   %esi,%esi
jle    11cd <vlogical_imm_and18_int32_t+0xcd>
mov    %esi,%eax
cmp    $0x8,%esi
jae    1116 <vlogical_imm_and18_int32_t+0x16>
xor    %ecx,%ecx
jmp    11c0 <vlogical_imm_and18_int32_t+0xc0>
mov    %eax,%ecx
and    $0xfffffff8,%ecx
lea    -0x8(%rcx),%rdx
mov    %rdx,%r8
shr    $0x3,%r8
add    $0x1,%r8
test   %rdx,%rdx
je     11ce <vlogical_imm_and18_int32_t+0xce>
mov    %r8,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %edx,%edx
movaps 0xebd(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movups (%rdi,%rdx,4),%xmm1
movups 0x10(%rdi,%rdx,4),%xmm2
movups 0x20(%rdi,%rdx,4),%xmm3
movups 0x30(%rdi,%rdx,4),%xmm4
andps  %xmm0,%xmm1
andps  %xmm0,%xmm2
movups %xmm1,(%rdi,%rdx,4)
movups %xmm2,0x10(%rdi,%rdx,4)
andps  %xmm0,%xmm3
andps  %xmm0,%xmm4
movups %xmm3,0x20(%rdi,%rdx,4)
movups %xmm4,0x30(%rdi,%rdx,4)
add    $0x10,%rdx
add    $0xfffffffffffffffe,%rsi
jne    1150 <vlogical_imm_and18_int32_t+0x50>
test   $0x1,%r8b
je     11b1 <vlogical_imm_and18_int32_t+0xb1>
movups (%rdi,%rdx,4),%xmm0
movups 0x10(%rdi,%rdx,4),%xmm1
movaps 0xe5e(%rip),%xmm2
andps  %xmm2,%xmm0
andps  %xmm2,%xmm1
movups %xmm0,(%rdi,%rdx,4)
movups %xmm1,0x10(%rdi,%rdx,4)
cmp    %rax,%rcx
je     11cd <vlogical_imm_and18_int32_t+0xcd>
cs nopw 0x0(%rax,%rax,1)
andl   $0x12,(%rdi,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    11c0 <vlogical_imm_and18_int32_t+0xc0>
ret
xor    %edx,%edx
test   $0x1,%r8b
jne    1192 <vlogical_imm_and18_int32_t+0x92>
jmp    11b1 <vlogical_imm_and18_int32_t+0xb1>

LLVM IR (-O0):
define void @vlogical_imm_and18_int32_t(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %21, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %24
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = and i32 %15, 18
%17 = load i32*, i32** %3
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
store i32 %16, i32* %20
br label %21
21: ; preds = %10
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %6
24: ; preds = %6
ret void
}

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