#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*/ assert(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, unsigned char,
                           unsigned char);
int /*<<< orphan*/ stderr;
void AssertBytesEqual(unsigned char *expected, unsigned char *actual, int len) {
  int i;
  for (i = 0; i < len; i++) {
    if (expected[i] != actual[i]) {
      fprintf(stderr,
              "Byte sequence differs in position %d: expected 0x%x != "
              "actual 0x%x\n",
              i, expected[i], actual[i]);
      assert(expected[i] == actual[i]);
    }
  }
}


x86 assembly (clang, -O0):
<AssertBytesEqual>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d3 <AssertBytesEqual+0xb3>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
movslq -0x18(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     11c0 <AssertBytesEqual+0xa0>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%r8
lea    0xe74(%rip),%rsi
movzbl %cl,%ecx
movzbl (%rax,%r8,1),%r8d
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
movslq -0x18(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
jmp    11c5 <AssertBytesEqual+0xa5>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113a <AssertBytesEqual+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AssertBytesEqual>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
jle    1191 <AssertBytesEqual+0x71>
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%r13d
xor    %ebx,%ebx
mov    0x2e9f(%rip),%rbp
lea    0xeb8(%rip),%r12
jmp    1159 <AssertBytesEqual+0x39>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%r13
je     1191 <AssertBytesEqual+0x71>
movzbl (%r15,%rbx,1),%eax
movzbl (%r14,%rbx,1),%edx
cmp    %dl,%al
je     1150 <AssertBytesEqual+0x30>
mov    0x0(%rbp),%edi
movzbl %al,%ecx
movzbl %dl,%r8d
mov    %r12,%rsi
mov    %ebx,%edx
call   1040 <fprintf@plt>
movzbl (%r15,%rbx,1),%eax
xor    %edi,%edi
cmp    (%r14,%rbx,1),%al
sete   %dil
call   1030 <assert@plt>
jmp    1150 <AssertBytesEqual+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [68 x i8] c"Byte sequence differs in position %d: expected 0x%x != actual 0x%x\0A\00"
define void @AssertBytesEqual(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %56, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %59
12: ; preds = %8
%13 = load i8*, i8** %4
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = load i8*, i8** %5
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = icmp ne i32 %18, %24
br i1 %25, label %26, label %55
26: ; preds = %12
%27 = load i32, i32* @stderr
%28 = load i32, i32* %7
%29 = load i8*, i8** %4
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i8, i8* %32
%34 = load i8*, i8** %5
%35 = load i32, i32* %7
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %34, i64 %36
%38 = load i8, i8* %37
%39 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i32 %28, i8 zeroext %33, i8 zeroext %38)
%40 = load i8*, i8** %4
%41 = load i32, i32* %7
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %40, i64 %42
%44 = load i8, i8* %43
%45 = zext i8 %44 to i32
%46 = load i8*, i8** %5
%47 = load i32, i32* %7
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
%50 = load i8, i8* %49
%51 = zext i8 %50 to i32
%52 = icmp eq i32 %45, %51
%53 = zext i1 %52 to i32
%54 = call i32 @assert(i32 %53)
br label %55
55: ; preds = %26, %12
br label %56
56: ; preds = %55
%57 = load i32, i32* %7
%58 = add nsw i32 %57, 1
store i32 %58, i32* %7
br label %8
59: ; preds = %8
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [68 x i8] c"Byte sequence differs in position %d: expected 0x%x != actual 0x%x\0A\00"
define void @AssertBytesEqual(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %26
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %23
%8 = phi i64 [ 0, %5 ], [ %24, %23 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = getelementptr inbounds i8, i8* %1, i64 %8
%12 = load i8, i8* %11
%13 = icmp eq i8 %10, %12
br i1 %13, label %23, label %14
14: ; preds = %7
%15 = load i32, i32* @stderr
%16 = trunc i64 %8 to i32
%17 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i32 %16, i8 zeroext %10, i8 zeroext %12)
%18 = load i8, i8* %9
%19 = load i8, i8* %11
%20 = icmp eq i8 %18, %19
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
br label %23
23: ; preds = %7, %14
%24 = add nuw nsw i64 %8, 1
%25 = icmp eq i64 %24, %6
br i1 %25, label %26, label %7
26: ; preds = %23, %3
ret void
}