#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 */
struct running_checksum {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ murmur3_add_to_running_checksum(struct running_checksum *,
                                                   int, unsigned char *);
int /*<<< orphan*/ murmur3_finish_running_checksum(struct running_checksum *,
                                                   unsigned char *);
struct running_checksum *murmur3_start_running_checksum();
void murmur3_checksum_block(char *buf, int len, unsigned char *digest) {
  struct running_checksum *csum = murmur3_start_running_checksum();
  murmur3_add_to_running_checksum(csum, len, (unsigned char *)buf);
  murmur3_finish_running_checksum(csum, digest);
}


x86 assembly (clang, -O0):
<murmur3_checksum_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1040 <murmur3_start_running_checksum@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rdx
call   1050 <murmur3_add_to_running_checksum@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <murmur3_finish_running_checksum@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<murmur3_checksum_block>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%r15
xor    %eax,%eax
call   1040 <murmur3_start_running_checksum@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %ebp,%esi
mov    %r15,%rdx
call   1050 <murmur3_add_to_running_checksum@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <murmur3_finish_running_checksum@plt>

LLVM IR (-O0):
%struct.running_checksum = type { i32 }
define void @murmur3_checksum_block(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca %struct.running_checksum*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = call %struct.running_checksum* (...) @murmur3_start_running_checksum()
store %struct.running_checksum* %8, %struct.running_checksum** %7
%9 = load %struct.running_checksum*, %struct.running_checksum** %7
%10 = load i32, i32* %5
%11 = load i8*, i8** %4
%12 = call i32 @murmur3_add_to_running_checksum(%struct.running_checksum* %9, i32 %10, i8* %11)
%13 = load %struct.running_checksum*, %struct.running_checksum** %7
%14 = load i8*, i8** %6
%15 = call i32 @murmur3_finish_running_checksum(%struct.running_checksum* %13, i8* %14)
ret void
}

LLVM IR (-O2):
%struct.running_checksum = type { i32 }
define void @murmur3_checksum_block(i8* %0, i32 %1, i8* %2) {
%4 = tail call %struct.running_checksum* (...) @murmur3_start_running_checksum()
%5 = tail call i32 @murmur3_add_to_running_checksum(%struct.running_checksum* %4, i32 %1, i8* %0)
%6 = tail call i32 @murmur3_finish_running_checksum(%struct.running_checksum* %4, i8* %2)
ret void
}