#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*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigsafe_printf(char *, int, unsigned long, unsigned long);
void davecmp(void *_a, void *_b, int len) {
  int i;
  unsigned long *a = _a;
  unsigned long *b = _b;
  for (i = 0; i < len / sizeof(*a); i++) {
    if (a[i] == b[i]) {
      continue;
    }
    do {
      if (3 <= 0)
        sigsafe_printf("[%3d]: a: %016lx b: %016lx\n", i, a[i], b[i]);
      fflush(NULL);
    } while (0);
  }
}


x86 assembly (clang, -O0):
<davecmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x18(%rbp)
movslq -0x18(%rbp),%rax
movslq -0x14(%rbp),%rcx
shr    $0x3,%rcx
cmp    %rcx,%rax
jae    1193 <davecmp+0x83>
mov    -0x20(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x28(%rbp),%rcx
movslq -0x18(%rbp),%rdx
cmp    (%rcx,%rdx,8),%rax
jne    1172 <davecmp+0x62>
jmp    1185 <davecmp+0x75>
jmp    1177 <davecmp+0x67>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <fflush@plt>
jmp    1185 <davecmp+0x75>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113a <davecmp+0x2a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<davecmp>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x8,%edx
jae    1129 <davecmp+0x19>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    %rsi,%r14
mov    %rdi,%r15
movslq %edx,%rax
shr    $0x3,%rax
cmp    $0x2,%rax
mov    $0x1,%r12d
cmovae %rax,%r12
xor    %ebx,%ebx
jmp    1159 <davecmp+0x49>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%r12
je     111d <davecmp+0xd>
mov    (%r15,%rbx,8),%rax
cmp    (%r14,%rbx,8),%rax
je     1150 <davecmp+0x40>
xor    %edi,%edi
call   1030 <fflush@plt>
jmp    1150 <davecmp+0x40>

LLVM IR (-O0):
define void @davecmp(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64*
%9 = alloca i64*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i64*
store i64* %11, i64** %8
%12 = load i8*, i8** %5
%13 = bitcast i8* %12 to i64*
store i64* %13, i64** %9
store i32 0, i32* %7
br label %14
14: ; preds = %38, %3
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = udiv i64 %18, 8
%20 = icmp ult i64 %16, %19
br i1 %20, label %21, label %41
21: ; preds = %14
%22 = load i64*, i64** %8
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i64, i64* %22, i64 %24
%26 = load i64, i64* %25
%27 = load i64*, i64** %9
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i64, i64* %27, i64 %29
%31 = load i64, i64* %30
%32 = icmp eq i64 %26, %31
br i1 %32, label %33, label %34
33: ; preds = %21
br label %38
34: ; preds = %21
br label %35
35: ; preds = %34
%36 = call i32 @fflush(i32* null)
br label %37
37: ; preds = %35
br label %38
38: ; preds = %37, %33
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %14
41: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @davecmp(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = bitcast i8* %0 to i64*
%5 = bitcast i8* %1 to i64*
%6 = icmp ult i32 %2, 8
br i1 %6, label %23, label %7
7: ; preds = %3
%8 = sext i32 %2 to i64
%9 = lshr i64 %8, 3
%10 = call i64 @llvm.umax.i64(i64 %9, i64 1)
br label %11
11: ; preds = %7, %20
%12 = phi i64 [ 0, %7 ], [ %21, %20 ]
%13 = getelementptr inbounds i64, i64* %4, i64 %12
%14 = load i64, i64* %13
%15 = getelementptr inbounds i64, i64* %5, i64 %12
%16 = load i64, i64* %15
%17 = icmp eq i64 %14, %16
br i1 %17, label %20, label %18
18: ; preds = %11
%19 = tail call i32 @fflush(i32* null)
br label %20
20: ; preds = %11, %18
%21 = add nuw nsw i64 %12, 1
%22 = icmp eq i64 %21, %10
br i1 %22, label %23, label %11
23: ; preds = %20, %3
ret void
}