#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 uint64_t;
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_and_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_andnot_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_or_si128(int /*<<< orphan*/, int /*<<< orphan*/);
extern __attribute__((__gnu___, __always___, __artificial__)) __m128i
_MM_INSERT_EPI64_32(__m128i vec, int p, const int LANE) {
  __attribute__((aligned(16))) uint64_t pvec[2] = {0, 0};
  __attribute__((aligned(16)))
  uint64_t mask[2] = {0xffffffffffffffff, 0xffffffffffffffff};
  __m128i vec_masked, p_masked;
  pvec[LANE] = p;
  mask[LANE] = 0x0;
  vec_masked = _mm_and_si128(*(__m128i *)mask, vec);
  p_masked = _mm_andnot_si128(*(__m128i *)mask, *(__m128i *)pvec);
  return _mm_or_si128(vec_masked, p_masked);
}


x86 assembly (clang, -O0):
<_MM_INSERT_EPI64_32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
mov    0xe98(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%ecx
movslq -0xc(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
movslq -0xc(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x30(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1060 <_mm_and_si128@plt>
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1050 <_mm_andnot_si128@plt>
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1040 <_mm_or_si128@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_MM_INSERT_EPI64_32>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %edi,%eax
movq   $0x0,0x10(%rsp)
movq   $0xffffffffffffffff,(%rsp)
ff
movslq %edx,%rcx
mov    %esi,0x10(%rsp,%rcx,4)
movl   $0x0,(%rsp,%rcx,4)
mov    (%rsp),%ebx
mov    %ebx,%edi
mov    %eax,%esi
call   1050 <_mm_and_si128@plt>
mov    %eax,%ebp
mov    0x10(%rsp),%esi
mov    %ebx,%edi
call   1040 <_mm_andnot_si128@plt>
mov    %ebp,%edi
mov    %eax,%esi
add    $0x18,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <_mm_or_si128@plt>

LLVM IR (-O0):
@__const._MM_INSERT_EPI64_32.mask = [2 x i32] [i32 -1, i32 -1]
define i32 @_MM_INSERT_EPI64_32(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [2 x i32]
%8 = alloca [2 x i32]
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = bitcast [2 x i32]* %7 to i8*
%12 = bitcast [2 x i32]* %8 to i8*
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 %15
store i32 %13, i32* %16
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 %18
store i32 0, i32* %19
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%21 = load i32, i32* %20
%22 = load i32, i32* %4
%23 = call i32 @_mm_and_si128(i32 %21, i32 %22)
store i32 %23, i32* %9
%24 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%25 = load i32, i32* %24
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%27 = load i32, i32* %26
%28 = call i32 @_mm_andnot_si128(i32 %25, i32 %27)
store i32 %28, i32* %10
%29 = load i32, i32* %9
%30 = load i32, i32* %10
%31 = call i32 @_mm_or_si128(i32 %29, i32 %30)
ret i32 %31
}

LLVM IR (-O2):
define i32 @_MM_INSERT_EPI64_32(i32 %0, i32 %1, i32 %2) {
%4 = alloca i64
%5 = bitcast i64* %4 to [2 x i32]*
%6 = alloca i64
%7 = bitcast i64* %6 to [2 x i32]*
%8 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%9 = bitcast i64* %6 to i8*
store i64 -1, i64* %6
%10 = sext i32 %2 to i64
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 %10
store i32 %1, i32* %11
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 %10
store i32 0, i32* %12
%13 = bitcast i64* %6 to i32*
%14 = load i32, i32* %13
%15 = tail call i32 @_mm_and_si128(i32 %14, i32 %0)
%16 = bitcast i64* %4 to i32*
%17 = load i32, i32* %16
%18 = tail call i32 @_mm_andnot_si128(i32 %14, i32 %17)
%19 = tail call i32 @_mm_or_si128(i32 %15, i32 %18)
ret i32 %19
}