#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 scalar_t__ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, size_t, scalar_t__ const, scalar_t__ const);
void assert_buffers_eq_len(const void *buf1, const void *buf2, size_t len) {
  const uint8_t *u8_1 = (const uint8_t *)buf1;
  const uint8_t *u8_2 = (const uint8_t *)buf2;
  size_t i;
  for (i = 0; i < len; ++i) {
    if (u8_1[i] != u8_2[i])
      printf("offset %zu: %02x != %02x\n", i, u8_1[i], u8_2[i]);
  }
}


x86 assembly (clang, -O0):
<assert_buffers_eq_len>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11a6 <assert_buffers_eq_len+0x96>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%rdx
cmp    (%rcx,%rdx,8),%rax
je     1190 <assert_buffers_eq_len+0x80>
mov    -0x30(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
jmp    1195 <assert_buffers_eq_len+0x85>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    113c <assert_buffers_eq_len+0x2c>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_buffers_eq_len>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %rdx,%rdx
je     1163 <assert_buffers_eq_len+0x53>
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
lea    0xed0(%rip),%r13
jmp    1149 <assert_buffers_eq_len+0x39>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    %rbx,%r12
je     1163 <assert_buffers_eq_len+0x53>
mov    (%r15,%rbx,8),%rdx
mov    (%r14,%rbx,8),%rcx
cmp    %rcx,%rdx
je     1140 <assert_buffers_eq_len+0x30>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
jmp    1140 <assert_buffers_eq_len+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"offset %zu: %02x != %02x\0A\00"
define void @assert_buffers_eq_len(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64*
%8 = alloca i64*
%9 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i64*
store i64* %11, i64** %7
%12 = load i8*, i8** %5
%13 = bitcast i8* %12 to i64*
store i64* %13, i64** %8
store i64 0, i64* %9
br label %14
14: ; preds = %40, %3
%15 = load i64, i64* %9
%16 = load i64, i64* %6
%17 = icmp ult i64 %15, %16
br i1 %17, label %18, label %43
18: ; preds = %14
%19 = load i64*, i64** %7
%20 = load i64, i64* %9
%21 = getelementptr inbounds i64, i64* %19, i64 %20
%22 = load i64, i64* %21
%23 = load i64*, i64** %8
%24 = load i64, i64* %9
%25 = getelementptr inbounds i64, i64* %23, i64 %24
%26 = load i64, i64* %25
%27 = icmp ne i64 %22, %26
br i1 %27, label %28, label %39
28: ; preds = %18
%29 = load i64, i64* %9
%30 = load i64*, i64** %7
%31 = load i64, i64* %9
%32 = getelementptr inbounds i64, i64* %30, i64 %31
%33 = load i64, i64* %32
%34 = load i64*, i64** %8
%35 = load i64, i64* %9
%36 = getelementptr inbounds i64, i64* %34, i64 %35
%37 = load i64, i64* %36
%38 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i64 %29, i64 %33, i64 %37)
br label %39
39: ; preds = %28, %18
br label %40
40: ; preds = %39
%41 = load i64, i64* %9
%42 = add i64 %41, 1
store i64 %42, i64* %9
br label %14
43: ; preds = %14
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"offset %zu: %02x != %02x\0A\00"
define void @assert_buffers_eq_len(i8* nocapture %0, i8* nocapture %1, i64 %2) {
%4 = bitcast i8* %0 to i64*
%5 = bitcast i8* %1 to i64*
%6 = icmp eq i64 %2, 0
br i1 %6, label %19, label %7
7: ; preds = %3, %16
%8 = phi i64 [ %17, %16 ], [ 0, %3 ]
%9 = getelementptr inbounds i64, i64* %4, i64 %8
%10 = load i64, i64* %9
%11 = getelementptr inbounds i64, i64* %5, i64 %8
%12 = load i64, i64* %11
%13 = icmp eq i64 %10, %12
br i1 %13, label %16, label %14
14: ; preds = %7
%15 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i64 %8, i64 %10, i64 %12)
br label %16
16: ; preds = %7, %14
%17 = add nuw i64 %8, 1
%18 = icmp eq i64 %17, %2
br i1 %18, label %19, label %7
19: ; preds = %16, %3
ret void
}