#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 crc32(int /*<<< orphan*/, char *, size_t);
void DML_checksum_accum(uint32_t *checksuma, uint32_t *checksumb,
                        const uint32_t rank, char *buf, size_t size) {
  const uint32_t rank29 = rank % 29;
  const uint32_t rank31 = rank % 31;
  const uint32_t work = crc32(0, buf, size);
  *checksuma ^= work << rank29 | work >> (32 - rank29);
  *checksumb ^= work << rank31 | work >> (32 - rank31);
  return;
}


x86 assembly (clang, -O0):
<DML_checksum_accum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x1d,%ecx
cltd
idiv   %ecx
mov    %edx,-0x2c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x1f,%ecx
cltd
idiv   %ecx
mov    %edx,-0x30(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
xor    %edi,%edi
call   1030 <crc32@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x2c(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%eax
mov    $0x20,%ecx
sub    -0x2c(%rbp),%ecx
sar    %cl,%eax
mov    -0x3c(%rbp),%ecx
or     %eax,%ecx
mov    -0x8(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x34(%rbp),%eax
mov    -0x30(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
mov    $0x20,%ecx
sub    -0x30(%rbp),%ecx
sar    %cl,%eax
mov    -0x38(%rbp),%ecx
or     %eax,%ecx
mov    -0x10(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DML_checksum_accum>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
movslq %edx,%rax
imul   $0xffffffff8d3dcb09,%rax,%rdx
shr    $0x20,%rdx
add    %eax,%edx
mov    %edx,%esi
shr    $0x1f,%esi
shr    $0x4,%edx
add    %esi,%edx
lea    (%rdx,%rdx,8),%esi
lea    (%rsi,%rsi,2),%esi
add    %edx,%esi
add    %edx,%esi
imul   $0xffffffff84210843,%rax,%rbx
shr    $0x20,%rbx
add    %eax,%ebx
mov    %ebx,%edx
shr    $0x1f,%edx
shr    $0x4,%ebx
add    %edx,%ebx
mov    %ebx,%edx
shl    $0x5,%edx
sub    %edx,%ebx
add    %eax,%ebx
mov    %eax,%ebp
sub    %esi,%ebp
xor    %edi,%edi
mov    %rcx,%rsi
mov    %r8,%rdx
call   1030 <crc32@plt>
mov    %eax,%edx
mov    %ebp,%ecx
shl    %cl,%edx
neg    %bpl
mov    %eax,%esi
mov    %ebp,%ecx
sar    %cl,%esi
or     %edx,%esi
xor    %esi,(%r15)
mov    %eax,%edx
mov    %ebx,%ecx
shl    %cl,%edx
neg    %bl
mov    %ebx,%ecx
sar    %cl,%eax
or     %edx,%eax
xor    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @DML_checksum_accum(i32* %0, i32* %1, i32 %2, i8* %3, i64 %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i64 %4, i64* %10
%14 = load i32, i32* %8
%15 = srem i32 %14, 29
store i32 %15, i32* %11
%16 = load i32, i32* %8
%17 = srem i32 %16, 31
store i32 %17, i32* %12
%18 = load i8*, i8** %9
%19 = load i64, i64* %10
%20 = call i32 @crc32(i32 0, i8* %18, i64 %19)
store i32 %20, i32* %13
%21 = load i32, i32* %13
%22 = load i32, i32* %11
%23 = shl i32 %21, %22
%24 = load i32, i32* %13
%25 = load i32, i32* %11
%26 = sub nsw i32 32, %25
%27 = ashr i32 %24, %26
%28 = or i32 %23, %27
%29 = load i32*, i32** %6
%30 = load i32, i32* %29
%31 = xor i32 %30, %28
store i32 %31, i32* %29
%32 = load i32, i32* %13
%33 = load i32, i32* %12
%34 = shl i32 %32, %33
%35 = load i32, i32* %13
%36 = load i32, i32* %12
%37 = sub nsw i32 32, %36
%38 = ashr i32 %35, %37
%39 = or i32 %34, %38
%40 = load i32*, i32** %7
%41 = load i32, i32* %40
%42 = xor i32 %41, %39
store i32 %42, i32* %40
ret void
}

LLVM IR (-O2):
define void @DML_checksum_accum(i32* nocapture %0, i32* nocapture %1, i32 %2, i8* %3, i64 %4) {
%6 = srem i32 %2, 29
%7 = srem i32 %2, 31
%8 = tail call i32 @crc32(i32 0, i8* %3, i64 %4)
%9 = shl i32 %8, %6
%10 = sub nsw i32 32, %6
%11 = ashr i32 %8, %10
%12 = or i32 %9, %11
%13 = load i32, i32* %0
%14 = xor i32 %12, %13
store i32 %14, i32* %0
%15 = shl i32 %8, %7
%16 = sub nsw i32 32, %7
%17 = ashr i32 %8, %16
%18 = or i32 %15, %17
%19 = load i32, i32* %1
%20 = xor i32 %19, %18
store i32 %20, i32* %1
ret void
}