#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*/ uint8_t;
typedef scalar_t__ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ crc8PushByte(int /*<<< orphan*/ *, int /*<<< orphan*/);
uint8_t crc8PushBlock(uint8_t *pcrc, uint8_t *block, uint16_t count) {
  uint8_t crc = pcrc ? *pcrc : 0;
  for (; count > 0; --count, block++) {
    crc8PushByte(&crc, *block);
  }
  if (pcrc)
    *pcrc = crc;
  return crc;
}


x86 assembly (clang, -O0):
<crc8PushBlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113d <crc8PushBlock+0x2d>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
jmp    1147 <crc8PushBlock+0x37>
xor    %eax,%eax
mov    %eax,-0x20(%rbp)
jmp    1147 <crc8PushBlock+0x37>
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
jle    1184 <crc8PushBlock+0x74>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    -0x1c(%rbp),%rdi
call   1030 <crc8PushByte@plt>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
jmp    114d <crc8PushBlock+0x3d>
cmpq   $0x0,-0x8(%rbp)
je     1198 <crc8PushBlock+0x88>
mov    -0x1c(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crc8PushBlock>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
test   %rdi,%rdi
je     112b <crc8PushBlock+0x1b>
mov    (%r14),%eax
jmp    112d <crc8PushBlock+0x1d>
xor    %eax,%eax
mov    %eax,0x4(%rsp)
test   %rbx,%rbx
jle    1159 <crc8PushBlock+0x49>
add    $0x1,%rbx
lea    0x4(%rsp),%r12
nop
mov    (%r15),%esi
mov    %r12,%rdi
call   1030 <crc8PushByte@plt>
add    $0x4,%r15
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1140 <crc8PushBlock+0x30>
mov    0x4(%rsp),%eax
test   %r14,%r14
je     1165 <crc8PushBlock+0x55>
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @crc8PushBlock(i32* %0, i32* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
%8 = load i32*, i32** %4
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
br label %14
13: ; preds = %3
br label %14
14: ; preds = %13, %10
%15 = phi i32 [ %12, %10 ], [ 0, %13 ]
store i32 %15, i32* %7
br label %16
16: ; preds = %23, %14
%17 = load i64, i64* %6
%18 = icmp sgt i64 %17, 0
br i1 %18, label %19, label %28
19: ; preds = %16
%20 = load i32*, i32** %5
%21 = load i32, i32* %20
%22 = call i32 @crc8PushByte(i32* %7, i32 %21)
br label %23
23: ; preds = %19
%24 = load i64, i64* %6
%25 = add nsw i64 %24, -1
store i64 %25, i64* %6
%26 = load i32*, i32** %5
%27 = getelementptr inbounds i32, i32* %26, i32 1
store i32* %27, i32** %5
br label %16
28: ; preds = %16
%29 = load i32*, i32** %4
%30 = icmp ne i32* %29, null
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = load i32, i32* %7
%33 = load i32*, i32** %4
store i32 %32, i32* %33
br label %34
34: ; preds = %31, %28
%35 = load i32, i32* %7
ret i32 %35
}

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