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

/* Variables and functions */
scalar_t__ ewf_crc(void *, size_t, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, scalar_t__, scalar_t__);
int /*<<< orphan*/ libewf_dump_data(int /*<<< orphan*/ *, size_t);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ stderr;
void libewf_dump_section_data(uint8_t *data, size_t size) {
  uint32_t calculated_crc = ewf_crc((void *)data, (size - sizeof(uint32_t)), 1);
  uint32_t stored_crc = 0;
  libewf_dump_data(data, size);
  memcpy((uint8_t *)&stored_crc, (uint8_t *)(data + size - sizeof(uint32_t)),
         sizeof(uint32_t));
  fprintf(stderr,
          "libewf_dump_section_data: possible crc (in file: %"
          "u"
          ", calculated: %"
          "u"
          ")\n",
          stored_crc, calculated_crc);
}


x86 assembly (clang, -O0):
<libewf_dump_section_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
sub    $0x8,%rsi
mov    $0x1,%edx
call   1060 <ewf_crc@plt>
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <libewf_dump_data@plt>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
add    $0xffffffffffffffe0,%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe48(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libewf_dump_section_data>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0xfffffffffffffff8,%rsi
mov    $0x1,%edx
call   1060 <ewf_crc@plt>
mov    %rax,%r15
movq   $0x0,0x8(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <libewf_dump_data@plt>
lea    (%rbx,%r14,4),%rsi
add    $0xffffffffffffffe0,%rsi
lea    0x8(%rsp),%rdi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rdx
lea    0xe60(%rip),%rsi
mov    %r15,%rcx
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [70 x i8] c"libewf_dump_section_data: possible crc (in file: %u, calculated: %u)\0A\00"
define void @libewf_dump_section_data(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
%7 = load i32*, i32** %3
%8 = bitcast i32* %7 to i8*
%9 = load i64, i64* %4
%10 = sub i64 %9, 8
%11 = call i64 @ewf_crc(i8* %8, i64 %10, i32 1)
store i64 %11, i64* %5
store i64 0, i64* %6
%12 = load i32*, i32** %3
%13 = load i64, i64* %4
%14 = call i32 @libewf_dump_data(i32* %12, i64 %13)
%15 = bitcast i64* %6 to i32*
%16 = load i32*, i32** %3
%17 = load i64, i64* %4
%18 = getelementptr inbounds i32, i32* %16, i64 %17
%19 = getelementptr inbounds i32, i32* %18, i64 -8
%20 = call i32 @memcpy(i32* %15, i32* %19, i32 8)
%21 = load i32, i32* @stderr
%22 = load i64, i64* %6
%23 = load i64, i64* %5
%24 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i64 %22, i64 %23)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [70 x i8] c"libewf_dump_section_data: possible crc (in file: %u, calculated: %u)\0A\00"
define void @libewf_dump_section_data(i32* %0, i64 %1) {
%3 = alloca i64
%4 = bitcast i32* %0 to i8*
%5 = add i64 %1, -8
%6 = tail call i64 @ewf_crc(i8* %4, i64 %5, i32 1)
%7 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%8 = tail call i32 @libewf_dump_data(i32* %0, i64 %1)
%9 = bitcast i64* %3 to i32*
%10 = getelementptr inbounds i32, i32* %0, i64 %1
%11 = getelementptr inbounds i32, i32* %10, i64 -8
%12 = call i32 @memcpy(i32* %9, i32* %11, i32 8)
%13 = load i32, i32* @stderr
%14 = load i64, i64* %3
%15 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i64 %14, i64 %6)
ret void
}