#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_clmulepi64_si128(int /*<<< orphan*/, int /*<<< orphan*/,
                                        int);
int /*<<< orphan*/ _mm_setzero_si128();
int /*<<< orphan*/ _mm_xor_si128(int /*<<< orphan*/, int /*<<< orphan*/);
void clnh_full_block(__m128i *k, __m128i *m, __m128i *sum1, __m128i *sum2) {
  *sum1 = _mm_setzero_si128();
  *sum2 = _mm_setzero_si128();
  size_t len = 1024;
  do {
    __m128i tmp1, tmp2, tmp3, tmp4;
    while (len >= 32) {
      tmp1 = _mm_xor_si128(*m, *k);
      tmp2 = _mm_xor_si128(*m, *(k + 1));
      tmp3 = _mm_xor_si128(*(m + 1), *(k + 1));
      tmp4 = _mm_xor_si128(*(m + 1), *(k + 2));
      tmp1 = _mm_clmulepi64_si128(tmp1, tmp1, 0x01);
      tmp2 = _mm_clmulepi64_si128(tmp2, tmp2, 0x01);
      tmp3 = _mm_clmulepi64_si128(tmp3, tmp3, 0x01);
      tmp4 = _mm_clmulepi64_si128(tmp4, tmp4, 0x01);
      *sum1 = _mm_xor_si128(*sum1, _mm_xor_si128(tmp1, tmp3));
      *sum2 = _mm_xor_si128(*sum2, _mm_xor_si128(tmp2, tmp4));
      len -= 32;
      m += 2;
      k += 2;
    }
  } while (0);
}


x86 assembly (clang, -O0):
<clnh_full_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0x0,%al
call   1040 <_mm_setzero_si128@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1040 <_mm_setzero_si128@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movq   $0x400,-0x28(%rbp)
jmp    1173 <clnh_full_block+0x43>
cmpq   $0x20,-0x28(%rbp)
jb     1294 <clnh_full_block+0x164>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
call   1050 <_mm_xor_si128@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%esi
call   1050 <_mm_xor_si128@plt>
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%esi
call   1050 <_mm_xor_si128@plt>
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%esi
call   1050 <_mm_xor_si128@plt>
mov    %eax,-0x38(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    $0x1,%edx
call   1030 <_mm_clmulepi64_si128@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    $0x1,%edx
call   1030 <_mm_clmulepi64_si128@plt>
mov    %eax,-0x30(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    $0x1,%edx
call   1030 <_mm_clmulepi64_si128@plt>
mov    %eax,-0x34(%rbp)
mov    -0x38(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    $0x1,%edx
call   1030 <_mm_clmulepi64_si128@plt>
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x34(%rbp),%esi
call   1050 <_mm_xor_si128@plt>
mov    -0x40(%rbp),%edi
mov    %eax,%esi
call   1050 <_mm_xor_si128@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x30(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1050 <_mm_xor_si128@plt>
mov    -0x3c(%rbp),%edi
mov    %eax,%esi
call   1050 <_mm_xor_si128@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
sub    $0x20,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1173 <clnh_full_block+0x43>
jmp    1299 <clnh_full_block+0x169>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clnh_full_block>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rcx,%rbx
mov    %rdx,%rbp
mov    %rsi,0x18(%rsp)
mov    %rdi,0x10(%rsp)
xor    %r13d,%r13d
xor    %eax,%eax
call   1040 <_mm_setzero_si128@plt>
mov    %rbp,0x20(%rsp)
mov    %eax,0x0(%rbp)
xor    %eax,%eax
call   1040 <_mm_setzero_si128@plt>
mov    %rbx,0x28(%rsp)
mov    %eax,(%rbx)
mov    $0xfffffffffffffc00,%rax
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rax,0x30(%rsp)
mov    0x18(%rsp),%rbp
mov    0x0(%rbp,%r13,1),%edi
mov    0x10(%rsp),%rbx
mov    (%rbx,%r13,1),%esi
call   1050 <_mm_xor_si128@plt>
mov    %eax,0x8(%rsp)
mov    0x0(%rbp,%r13,1),%edi
mov    0x4(%rbx,%r13,1),%esi
call   1050 <_mm_xor_si128@plt>
mov    %eax,%r12d
mov    0x4(%rbp,%r13,1),%edi
mov    0x4(%rbx,%r13,1),%esi
call   1050 <_mm_xor_si128@plt>
mov    %eax,%r14d
mov    0x4(%rbp,%r13,1),%edi
mov    0x8(%rbx,%r13,1),%esi
call   1050 <_mm_xor_si128@plt>
mov    %eax,%r15d
mov    0x8(%rsp),%edi
mov    %edi,%esi
mov    $0x1,%edx
call   1030 <_mm_clmulepi64_si128@plt>
mov    %eax,0xc(%rsp)
mov    %r12d,%edi
mov    %r12d,%esi
mov    $0x1,%edx
call   1030 <_mm_clmulepi64_si128@plt>
mov    %eax,0x8(%rsp)
mov    %r14d,%edi
mov    %r14d,%esi
mov    $0x1,%edx
call   1030 <_mm_clmulepi64_si128@plt>
mov    %eax,%r12d
mov    %r15d,%edi
mov    %r15d,%esi
mov    $0x1,%edx
call   1030 <_mm_clmulepi64_si128@plt>
mov    %eax,%r14d
mov    0x20(%rsp),%rbx
mov    (%rbx),%ebp
mov    0xc(%rsp),%edi
mov    %r12d,%esi
call   1050 <_mm_xor_si128@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <_mm_xor_si128@plt>
mov    %eax,(%rbx)
mov    0x28(%rsp),%rbp
mov    0x0(%rbp),%ebx
mov    0x8(%rsp),%edi
mov    %r14d,%esi
call   1050 <_mm_xor_si128@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1050 <_mm_xor_si128@plt>
mov    %eax,0x0(%rbp)
mov    0x30(%rsp),%rax
add    $0x8,%r13
add    $0x20,%rax
jne    1180 <clnh_full_block+0x50>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @clnh_full_block(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%14 = call i32 (...) @_mm_setzero_si128()
%15 = load i32*, i32** %7
store i32 %14, i32* %15
%16 = call i32 (...) @_mm_setzero_si128()
%17 = load i32*, i32** %8
store i32 %16, i32* %17
store i64 1024, i64* %9
br label %18
18: ; preds = %4
br label %19
19: ; preds = %22, %18
%20 = load i64, i64* %9
%21 = icmp uge i64 %20, 32
br i1 %21, label %22, label %80
22: ; preds = %19
%23 = load i32*, i32** %6
%24 = load i32, i32* %23
%25 = load i32*, i32** %5
%26 = load i32, i32* %25
%27 = call i32 @_mm_xor_si128(i32 %24, i32 %26)
store i32 %27, i32* %10
%28 = load i32*, i32** %6
%29 = load i32, i32* %28
%30 = load i32*, i32** %5
%31 = getelementptr inbounds i32, i32* %30, i64 1
%32 = load i32, i32* %31
%33 = call i32 @_mm_xor_si128(i32 %29, i32 %32)
store i32 %33, i32* %11
%34 = load i32*, i32** %6
%35 = getelementptr inbounds i32, i32* %34, i64 1
%36 = load i32, i32* %35
%37 = load i32*, i32** %5
%38 = getelementptr inbounds i32, i32* %37, i64 1
%39 = load i32, i32* %38
%40 = call i32 @_mm_xor_si128(i32 %36, i32 %39)
store i32 %40, i32* %12
%41 = load i32*, i32** %6
%42 = getelementptr inbounds i32, i32* %41, i64 1
%43 = load i32, i32* %42
%44 = load i32*, i32** %5
%45 = getelementptr inbounds i32, i32* %44, i64 2
%46 = load i32, i32* %45
%47 = call i32 @_mm_xor_si128(i32 %43, i32 %46)
store i32 %47, i32* %13
%48 = load i32, i32* %10
%49 = load i32, i32* %10
%50 = call i32 @_mm_clmulepi64_si128(i32 %48, i32 %49, i32 1)
store i32 %50, i32* %10
%51 = load i32, i32* %11
%52 = load i32, i32* %11
%53 = call i32 @_mm_clmulepi64_si128(i32 %51, i32 %52, i32 1)
store i32 %53, i32* %11
%54 = load i32, i32* %12
%55 = load i32, i32* %12
%56 = call i32 @_mm_clmulepi64_si128(i32 %54, i32 %55, i32 1)
store i32 %56, i32* %12
%57 = load i32, i32* %13
%58 = load i32, i32* %13
%59 = call i32 @_mm_clmulepi64_si128(i32 %57, i32 %58, i32 1)
store i32 %59, i32* %13
%60 = load i32*, i32** %7
%61 = load i32, i32* %60
%62 = load i32, i32* %10
%63 = load i32, i32* %12
%64 = call i32 @_mm_xor_si128(i32 %62, i32 %63)
%65 = call i32 @_mm_xor_si128(i32 %61, i32 %64)
%66 = load i32*, i32** %7
store i32 %65, i32* %66
%67 = load i32*, i32** %8
%68 = load i32, i32* %67
%69 = load i32, i32* %11
%70 = load i32, i32* %13
%71 = call i32 @_mm_xor_si128(i32 %69, i32 %70)
%72 = call i32 @_mm_xor_si128(i32 %68, i32 %71)
%73 = load i32*, i32** %8
store i32 %72, i32* %73
%74 = load i64, i64* %9
%75 = sub i64 %74, 32
store i64 %75, i64* %9
%76 = load i32*, i32** %6
%77 = getelementptr inbounds i32, i32* %76, i64 2
store i32* %77, i32** %6
%78 = load i32*, i32** %5
%79 = getelementptr inbounds i32, i32* %78, i64 2
store i32* %79, i32** %5
br label %19
80: ; preds = %19
br label %81
81: ; preds = %80
ret void
}

LLVM IR (-O2):
define void @clnh_full_block(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture %3) {
%5 = tail call i32 (...) @_mm_setzero_si128()
store i32 %5, i32* %2
%6 = tail call i32 (...) @_mm_setzero_si128()
store i32 %6, i32* %3
br label %7
7: ; preds = %4, %7
%8 = phi i32* [ %0, %4 ], [ %23, %7 ]
%9 = phi i32* [ %1, %4 ], [ %37, %7 ]
%10 = phi i64 [ 1024, %4 ], [ %36, %7 ]
%11 = load i32, i32* %9
%12 = load i32, i32* %8
%13 = tail call i32 @_mm_xor_si128(i32 %11, i32 %12)
%14 = load i32, i32* %9
%15 = getelementptr inbounds i32, i32* %8, i64 1
%16 = load i32, i32* %15
%17 = tail call i32 @_mm_xor_si128(i32 %14, i32 %16)
%18 = getelementptr inbounds i32, i32* %9, i64 1
%19 = load i32, i32* %18
%20 = load i32, i32* %15
%21 = tail call i32 @_mm_xor_si128(i32 %19, i32 %20)
%22 = load i32, i32* %18
%23 = getelementptr inbounds i32, i32* %8, i64 2
%24 = load i32, i32* %23
%25 = tail call i32 @_mm_xor_si128(i32 %22, i32 %24)
%26 = tail call i32 @_mm_clmulepi64_si128(i32 %13, i32 %13, i32 1)
%27 = tail call i32 @_mm_clmulepi64_si128(i32 %17, i32 %17, i32 1)
%28 = tail call i32 @_mm_clmulepi64_si128(i32 %21, i32 %21, i32 1)
%29 = tail call i32 @_mm_clmulepi64_si128(i32 %25, i32 %25, i32 1)
%30 = load i32, i32* %2
%31 = tail call i32 @_mm_xor_si128(i32 %26, i32 %28)
%32 = tail call i32 @_mm_xor_si128(i32 %30, i32 %31)
store i32 %32, i32* %2
%33 = load i32, i32* %3
%34 = tail call i32 @_mm_xor_si128(i32 %27, i32 %29)
%35 = tail call i32 @_mm_xor_si128(i32 %33, i32 %34)
store i32 %35, i32* %3
%36 = add nsw i64 %10, -32
%37 = getelementptr inbounds i32, i32* %9, i64 2
%38 = icmp eq i64 %36, 0
br i1 %38, label %39, label %7
39: ; preds = %7
ret void
}