#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*/ CTEST_ERR(char *, char const *, int, unsigned char const,
                             int, ...);
void assert_data(const unsigned char *exp, int expsize,
                 const unsigned char *real, int realsize, const char *caller,
                 int line) {
  int i;
  if (expsize != realsize) {
    CTEST_ERR("%s:%d  expected %d bytes, got %d", caller, line, expsize,
              realsize);
  }
  for (i = 0; i < expsize; i++) {
    if (exp[i] != real[i]) {
      CTEST_ERR("%s:%d expected 0x%02x at offset %d got 0x%02x", caller, line,
                exp[i], i, real[i]);
    }
  }
}


x86 assembly (clang, -O0):
<assert_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     1159 <assert_data+0x49>
mov    -0x28(%rbp),%rsi
mov    -0x2c(%rbp),%edx
mov    -0xc(%rbp),%eax
mov    -0x1c(%rbp),%r8d
lea    0xeb1(%rip),%rdi
movzbl %al,%ecx
mov    $0x0,%al
call   1030 <CTEST_ERR@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d3 <assert_data+0xc3>
mov    -0x8(%rbp),%rax
movslq -0x30(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x30(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     11c0 <assert_data+0xb0>
mov    -0x28(%rbp),%rsi
mov    -0x2c(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x30(%rbp),%r8d
mov    -0x18(%rbp),%rcx
movslq -0x30(%rbp),%rdi
movzbl (%rcx,%rdi,1),%r9d
lea    0xe6b(%rip),%rdi
movzbl %al,%ecx
mov    $0x0,%al
call   1030 <CTEST_ERR@plt>
jmp    11c5 <assert_data+0xb5>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1160 <assert_data+0x50>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_data>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8,%r15
mov    %rdx,%r13
mov    %esi,%ebp
mov    %rdi,%rbx
cmp    %ecx,%esi
je     1148 <assert_data+0x38>
mov    %ecx,%r8d
movzbl %bpl,%ecx
lea    0xec5(%rip),%rdi
mov    %r15,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <CTEST_ERR@plt>
test   %ebp,%ebp
jle    1194 <assert_data+0x84>
mov    %ebp,%r12d
xor    %ebp,%ebp
jmp    1169 <assert_data+0x59>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbp
cmp    %rbp,%r12
je     1194 <assert_data+0x84>
movzbl (%rbx,%rbp,1),%eax
movzbl 0x0(%r13,%rbp,1),%r9d
cmp    %r9b,%al
je     1160 <assert_data+0x50>
movzbl %al,%ecx
lea    0xe9f(%rip),%rdi
mov    %r15,%rsi
mov    %r14d,%edx
mov    %ebp,%r8d
xor    %eax,%eax
call   1030 <CTEST_ERR@plt>
jmp    1160 <assert_data+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"%s:%d expected %d bytes, got %d\00"
@.str.1 = [46 x i8] c"%s:%d expected 0x%02x at offset %d got 0x%02x\00"
define void @assert_data(i8* %0, i32 %1, i8* %2, i32 %3, i8* %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i32 %5, i32* %12
%14 = load i32, i32* %8
%15 = load i32, i32* %10
%16 = icmp ne i32 %14, %15
br i1 %16, label %17, label %24
17: ; preds = %6
%18 = load i8*, i8** %11
%19 = load i32, i32* %12
%20 = load i32, i32* %8
%21 = trunc i32 %20 to i8
%22 = load i32, i32* %10
%23 = call i32 (i8*, i8*, i32, i8, i32, ...) @CTEST_ERR(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %18, i32 %19, i8 zeroext %21, i32 %22)
br label %24
24: ; preds = %17, %6
store i32 0, i32* %13
br label %25
25: ; preds = %60, %24
%26 = load i32, i32* %13
%27 = load i32, i32* %8
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %63
29: ; preds = %25
%30 = load i8*, i8** %7
%31 = load i32, i32* %13
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = load i8*, i8** %9
%37 = load i32, i32* %13
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
%40 = load i8, i8* %39
%41 = zext i8 %40 to i32
%42 = icmp ne i32 %35, %41
br i1 %42, label %43, label %59
43: ; preds = %29
%44 = load i8*, i8** %11
%45 = load i32, i32* %12
%46 = load i8*, i8** %7
%47 = load i32, i32* %13
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
%50 = load i8, i8* %49
%51 = load i32, i32* %13
%52 = load i8*, i8** %9
%53 = load i32, i32* %13
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* %52, i64 %54
%56 = load i8, i8* %55
%57 = zext i8 %56 to i32
%58 = call i32 (i8*, i8*, i32, i8, i32, ...) @CTEST_ERR(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i8* %44, i32 %45, i8 zeroext %50, i32 %51, i32 %57)
br label %59
59: ; preds = %43, %29
br label %60
60: ; preds = %59
%61 = load i32, i32* %13
%62 = add nsw i32 %61, 1
store i32 %62, i32* %13
br label %25
63: ; preds = %25
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"%s:%d expected %d bytes, got %d\00"
@.str.1 = [46 x i8] c"%s:%d expected 0x%02x at offset %d got 0x%02x\00"
define void @assert_data(i8* nocapture %0, i32 %1, i8* nocapture %2, i32 %3, i8* %4, i32 %5) {
%7 = icmp eq i32 %1, %3
br i1 %7, label %11, label %8
8: ; preds = %6
%9 = trunc i32 %1 to i8
%10 = tail call i32 (i8*, i8*, i32, i8, i32, ...) @CTEST_ERR(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %5, i8 zeroext %9, i32 %3)
br label %11
11: ; preds = %8, %6
%12 = icmp sgt i32 %1, 0
br i1 %12, label %13, label %29
13: ; preds = %11
%14 = zext i32 %1 to i64
br label %15
15: ; preds = %13, %26
%16 = phi i64 [ 0, %13 ], [ %27, %26 ]
%17 = getelementptr inbounds i8, i8* %0, i64 %16
%18 = load i8, i8* %17
%19 = getelementptr inbounds i8, i8* %2, i64 %16
%20 = load i8, i8* %19
%21 = icmp eq i8 %18, %20
br i1 %21, label %26, label %22
22: ; preds = %15
%23 = zext i8 %20 to i32
%24 = trunc i64 %16 to i32
%25 = tail call i32 (i8*, i8*, i32, i8, i32, ...) @CTEST_ERR(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 %5, i8 zeroext %18, i32 %24, i32 %23)
br label %26
26: ; preds = %15, %22
%27 = add nuw nsw i64 %16, 1
%28 = icmp eq i64 %27, %14
br i1 %28, label %29, label %15
29: ; preds = %26, %11
ret void
}