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

/* Variables and functions */
int /*<<< orphan*/ CrcUpdateByte(unsigned int *, unsigned char);
void CrcUpdateUInt64(unsigned int *crc, unsigned long long int v) {
  int i;
  for (i = 0; i < 8; i++) {
    CrcUpdateByte(crc, (unsigned char)(v));
    v >>= 8;
  }
}


x86 assembly (clang, -O0):
<CrcUpdateUInt64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    115b <CrcUpdateUInt64+0x4b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movzbl %al,%esi
call   1030 <CrcUpdateByte@plt>
mov    -0x10(%rbp),%rax
shr    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <CrcUpdateUInt64+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CrcUpdateUInt64>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movzbl %bl,%esi
call   1030 <CrcUpdateByte@plt>
movzbl %bh,%esi
mov    %r14,%rdi
call   1030 <CrcUpdateByte@plt>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%esi
mov    %r14,%rdi
call   1030 <CrcUpdateByte@plt>
mov    %ebx,%eax
shr    $0x18,%eax
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <CrcUpdateByte@plt>
mov    %rbx,%rax
shr    $0x20,%rax
movzbl %al,%esi
mov    %r14,%rdi
call   1030 <CrcUpdateByte@plt>
mov    %rbx,%rax
shr    $0x28,%rax
movzbl %al,%esi
mov    %r14,%rdi
call   1030 <CrcUpdateByte@plt>
mov    %rbx,%rax
shr    $0x30,%rax
movzbl %al,%esi
mov    %r14,%rdi
call   1030 <CrcUpdateByte@plt>
shr    $0x38,%rbx
mov    %r14,%rdi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <CrcUpdateByte@plt>

LLVM IR (-O0):
define void @CrcUpdateUInt64(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i32
store i32* %0, i32** %3
store i64 %1, i64* %4
store i32 0, i32* %5
br label %6
6: ; preds = %16, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 8
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load i32*, i32** %3
%11 = load i64, i64* %4
%12 = trunc i64 %11 to i8
%13 = call i32 @CrcUpdateByte(i32* %10, i8 zeroext %12)
%14 = load i64, i64* %4
%15 = lshr i64 %14, 8
store i64 %15, i64* %4
br label %16
16: ; preds = %9
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
br label %6
19: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @CrcUpdateUInt64(i32* %0, i64 %1) {
%3 = trunc i64 %1 to i8
%4 = tail call i32 @CrcUpdateByte(i32* %0, i8 zeroext %3)
%5 = lshr i64 %1, 8
%6 = trunc i64 %5 to i8
%7 = tail call i32 @CrcUpdateByte(i32* %0, i8 zeroext %6)
%8 = lshr i64 %1, 16
%9 = trunc i64 %8 to i8
%10 = tail call i32 @CrcUpdateByte(i32* %0, i8 zeroext %9)
%11 = lshr i64 %1, 24
%12 = trunc i64 %11 to i8
%13 = tail call i32 @CrcUpdateByte(i32* %0, i8 zeroext %12)
%14 = lshr i64 %1, 32
%15 = trunc i64 %14 to i8
%16 = tail call i32 @CrcUpdateByte(i32* %0, i8 zeroext %15)
%17 = lshr i64 %1, 40
%18 = trunc i64 %17 to i8
%19 = tail call i32 @CrcUpdateByte(i32* %0, i8 zeroext %18)
%20 = lshr i64 %1, 48
%21 = trunc i64 %20 to i8
%22 = tail call i32 @CrcUpdateByte(i32* %0, i8 zeroext %21)
%23 = lshr i64 %1, 56
%24 = trunc i64 %23 to i8
%25 = tail call i32 @CrcUpdateByte(i32* %0, i8 zeroext %24)
ret void
}