#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*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_xor_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ assert(int);
int region_xor_sse(void *dst, void *src, int len) {
  int k;
  int len128 = len / 16;
  assert(len % 16 == 0);
  __m128i *_buf1 = (__m128i *)src;
  __m128i *_buf2 = (__m128i *)dst;
  for (k = 0; k < len128; k++) {
    _buf2[k] = _mm_xor_si128(_buf1[k], _buf2[k]);
  }
  return 1;
}


x86 assembly (clang, -O0):
<region_xor_sse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11b5 <region_xor_sse+0x95>
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1040 <_mm_xor_si128@plt>
mov    %eax,%edx
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1173 <region_xor_sse+0x53>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<region_xor_sse>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%r12
xor    %edi,%edi
test   $0xf,%r15b
sete   %dil
call   1030 <assert@plt>
cmp    $0x10,%r15d
jl     116a <region_xor_sse+0x4a>
shr    $0x4,%r15d
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r14,%rbx,4),%edi
mov    (%r12,%rbx,4),%esi
call   1040 <_mm_xor_si128@plt>
mov    %eax,(%r12,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1150 <region_xor_sse+0x30>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @region_xor_sse(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%11 = load i32, i32* %6
%12 = sdiv i32 %11, 16
store i32 %12, i32* %8
%13 = load i32, i32* %6
%14 = srem i32 %13, 16
%15 = icmp eq i32 %14, 0
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i8*, i8** %5
%19 = bitcast i8* %18 to i32*
store i32* %19, i32** %9
%20 = load i8*, i8** %4
%21 = bitcast i8* %20 to i32*
store i32* %21, i32** %10
store i32 0, i32* %7
br label %22
22: ; preds = %42, %3
%23 = load i32, i32* %7
%24 = load i32, i32* %8
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %45
26: ; preds = %22
%27 = load i32*, i32** %9
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
%31 = load i32, i32* %30
%32 = load i32*, i32** %10
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %32, i64 %34
%36 = load i32, i32* %35
%37 = call i32 @_mm_xor_si128(i32 %31, i32 %36)
%38 = load i32*, i32** %10
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i32, i32* %38, i64 %40
store i32 %37, i32* %41
br label %42
42: ; preds = %26
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
store i32 %44, i32* %7
br label %22
45: ; preds = %22
ret i32 1
}

LLVM IR (-O2):
define i32 @region_xor_sse(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = and i32 %2, 15
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = bitcast i8* %1 to i32*
%9 = bitcast i8* %0 to i32*
%10 = icmp sgt i32 %2, 15
br i1 %10, label %11, label %23
11: ; preds = %3
%12 = lshr i32 %2, 4
%13 = zext i32 %12 to i64
br label %14
14: ; preds = %11, %14
%15 = phi i64 [ 0, %11 ], [ %21, %14 ]
%16 = getelementptr inbounds i32, i32* %8, i64 %15
%17 = load i32, i32* %16
%18 = getelementptr inbounds i32, i32* %9, i64 %15
%19 = load i32, i32* %18
%20 = tail call i32 @_mm_xor_si128(i32 %17, i32 %19)
store i32 %20, i32* %18
%21 = add nuw nsw i64 %15, 1
%22 = icmp eq i64 %21, %13
br i1 %22, label %23, label %14
23: ; preds = %14, %3
ret i32 1
}