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

/* Variables and functions */
int /*<<< orphan*/ gf2_matrix_square(int *, int *);
void crc32c_zeros_op(uint32_t *even, size_t len) {
  uint32_t odd[32];
  uint32_t row;
  int n;
  odd[0] = 0x82f63b78;
  row = 1;
  for (n = 1; n < 32; n++) {
    odd[n] = row;
    row <<= 1;
  }
  gf2_matrix_square(even, odd);
  gf2_matrix_square(odd, even);
  do {
    gf2_matrix_square(even, odd);
    len >>= 1;
    if (len == 0)
      return;
    gf2_matrix_square(odd, even);
    len >>= 1;
  } while (len);
  for (n = 0; n < 32; n++)
    even[n] = odd[n];
}


x86 assembly (clang, -O0):
<crc32c_zeros_op>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x82f63b78,-0x90(%rbp)
3b f6 82
movl   $0x1,-0x94(%rbp)
movl   $0x1,-0x98(%rbp)
cmpl   $0x20,-0x98(%rbp)
jge    1185 <crc32c_zeros_op+0x75>
mov    -0x94(%rbp),%ecx
movslq -0x98(%rbp),%rax
mov    %ecx,-0x90(%rbp,%rax,4)
mov    -0x94(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x94(%rbp)
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    1141 <crc32c_zeros_op+0x31>
mov    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1030 <gf2_matrix_square@plt>
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <gf2_matrix_square@plt>
mov    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1030 <gf2_matrix_square@plt>
mov    -0x10(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11d1 <crc32c_zeros_op+0xc1>
jmp    123f <crc32c_zeros_op+0x12f>
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <gf2_matrix_square@plt>
mov    -0x10(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11a5 <crc32c_zeros_op+0x95>
movl   $0x0,-0x98(%rbp)
cmpl   $0x20,-0x98(%rbp)
jge    123f <crc32c_zeros_op+0x12f>
movslq -0x98(%rbp),%rax
mov    -0x90(%rbp,%rax,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x98(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    1202 <crc32c_zeros_op+0xf2>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crc32c_zeros_op>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%r12
mov    %rdi,%r14
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xede(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xee2(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xee6(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xeea(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xeee(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xef2(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
mov    %rsp,%r15
mov    %r15,%rsi
call   1030 <gf2_matrix_square@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <gf2_matrix_square@plt>
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <gf2_matrix_square@plt>
cmp    $0x2,%r12
jb     121a <crc32c_zeros_op+0x10a>
mov    %r12,%rbx
shr    $0x2,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <gf2_matrix_square@plt>
cmp    $0x3,%r12
mov    %rbx,%r12
ja     11a0 <crc32c_zeros_op+0x90>
movaps 0x70(%rsp),%xmm0
movups %xmm0,0x70(%r14)
movaps 0x60(%rsp),%xmm0
movups %xmm0,0x60(%r14)
movaps 0x50(%rsp),%xmm0
movups %xmm0,0x50(%r14)
movaps 0x40(%rsp),%xmm0
movups %xmm0,0x40(%r14)
movaps (%rsp),%xmm0
movaps 0x10(%rsp),%xmm1
movaps 0x20(%rsp),%xmm2
movaps 0x30(%rsp),%xmm3
movups %xmm3,0x30(%r14)
movups %xmm2,0x20(%r14)
movups %xmm1,0x10(%r14)
movups %xmm0,(%r14)
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @crc32c_zeros_op(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca [32 x i32]
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i64 %1, i64* %4
%8 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 0
store i32 -2097792136, i32* %8
store i32 1, i32* %6
store i32 1, i32* %7
br label %9
9: ; preds = %19, %2
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 32
br i1 %11, label %12, label %22
12: ; preds = %9
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 %15
store i32 %13, i32* %16
%17 = load i32, i32* %6
%18 = shl i32 %17, 1
store i32 %18, i32* %6
br label %19
19: ; preds = %12
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 1
store i32 %21, i32* %7
br label %9
22: ; preds = %9
%23 = load i32*, i32** %3
%24 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 0
%25 = call i32 @gf2_matrix_square(i32* %23, i32* %24)
%26 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 0
%27 = load i32*, i32** %3
%28 = call i32 @gf2_matrix_square(i32* %26, i32* %27)
br label %29
29: ; preds = %44, %22
%30 = load i32*, i32** %3
%31 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 0
%32 = call i32 @gf2_matrix_square(i32* %30, i32* %31)
%33 = load i64, i64* %4
%34 = lshr i64 %33, 1
store i64 %34, i64* %4
%35 = load i64, i64* %4
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %29
br label %63
38: ; preds = %29
%39 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 0
%40 = load i32*, i32** %3
%41 = call i32 @gf2_matrix_square(i32* %39, i32* %40)
%42 = load i64, i64* %4
%43 = lshr i64 %42, 1
store i64 %43, i64* %4
br label %44
44: ; preds = %38
%45 = load i64, i64* %4
%46 = icmp ne i64 %45, 0
br i1 %46, label %29, label %47
47: ; preds = %44
store i32 0, i32* %7
br label %48
48: ; preds = %60, %47
%49 = load i32, i32* %7
%50 = icmp slt i32 %49, 32
br i1 %50, label %51, label %63
51: ; preds = %48
%52 = load i32, i32* %7
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 %53
%55 = load i32, i32* %54
%56 = load i32*, i32** %3
%57 = load i32, i32* %7
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i32, i32* %56, i64 %58
store i32 %55, i32* %59
br label %60
60: ; preds = %51
%61 = load i32, i32* %7
%62 = add nsw i32 %61, 1
store i32 %62, i32* %7
br label %48
63: ; preds = %37, %48
ret void
}

LLVM IR (-O2):
define void @crc32c_zeros_op(i32* %0, i64 %1) {
%3 = bitcast i32* %0 to i8*
%4 = alloca [32 x i32]
%5 = bitcast [32 x i32]* %4 to i8*
%6 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 0
%7 = bitcast [32 x i32]* %4 to <4 x i32>*
store <4 x i32> <i32 -2097792136, i32 1, i32 2, i32 4>, <4 x i32>* %7
%8 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 4
%9 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> <i32 8, i32 16, i32 32, i32 64>, <4 x i32>* %9
%10 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 8
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 128, i32 256, i32 512, i32 1024>, <4 x i32>* %11
%12 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 12
%13 = bitcast i32* %12 to <4 x i32>*
store <4 x i32> <i32 2048, i32 4096, i32 8192, i32 16384>, <4 x i32>* %13
%14 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 16
%15 = bitcast i32* %14 to <4 x i32>*
store <4 x i32> <i32 32768, i32 65536, i32 131072, i32 262144>, <4 x i32>* %15
%16 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 20
%17 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> <i32 524288, i32 1048576, i32 2097152, i32 4194304>, <4 x i32>* %17
%18 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 24
%19 = bitcast i32* %18 to <4 x i32>*
store <4 x i32> <i32 8388608, i32 16777216, i32 33554432, i32 67108864>, <4 x i32>* %19
%20 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 28
%21 = bitcast i32* %20 to <4 x i32>*
store <4 x i32> <i32 134217728, i32 268435456, i32 536870912, i32 1073741824>, <4 x i32>* %21
%22 = call i32 @gf2_matrix_square(i32* %0, i32* %6)
%23 = call i32 @gf2_matrix_square(i32* %6, i32* %0)
br label %24
24: ; preds = %28, %2
%25 = phi i64 [ %1, %2 ], [ %29, %28 ]
%26 = call i32 @gf2_matrix_square(i32* %0, i32* %6)
%27 = icmp ult i64 %25, 2
br i1 %27, label %33, label %28
28: ; preds = %24
%29 = lshr i64 %25, 2
%30 = call i32 @gf2_matrix_square(i32* %6, i32* %0)
%31 = icmp ult i64 %25, 4
br i1 %31, label %32, label %24
32: ; preds = %28
br label %33
33: ; preds = %24, %32
ret void
}