#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 uint64_t;
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
scalar_t__ llabs(int /*<<< orphan*/);
int bimageHashDiff(uint64_t a, uint64_t b) {
  int i, n = 0;
  for (i = 0; i < 64; i++) {
    n += llabs((int64_t)(((a >> i) & 1) - ((b >> i) & 1)));
  }
  return n;
}


x86 assembly (clang, -O0):
<bimageHashDiff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x40,-0xc(%rbp)
jge    116e <bimageHashDiff+0x5e>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%ecx
sar    %cl,%edi
and    $0x1,%edi
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
sub    %eax,%edi
call   1030 <llabs@plt>
mov    %rax,%rcx
movslq -0x10(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112c <bimageHashDiff+0x1c>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bimageHashDiff>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %edi,%r15d
xor    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15d,%edi
mov    %ebx,%ecx
shr    %cl,%edi
mov    %r14d,%eax
shr    %cl,%eax
and    $0x1,%edi
and    $0x1,%eax
sub    %eax,%edi
call   1030 <llabs@plt>
lea    0x1(%rbx),%ecx
mov    %r15d,%edi
shr    %cl,%edi
mov    %rax,%r12
mov    %r14d,%eax
shr    %cl,%eax
add    %ebp,%r12d
and    $0x1,%edi
and    $0x1,%eax
sub    %eax,%edi
call   1030 <llabs@plt>
mov    %rax,%rbp
add    %r12d,%ebp
add    $0x2,%ebx
cmp    $0x40,%ebx
jne    1130 <bimageHashDiff+0x20>
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @bimageHashDiff(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %6
store i32 0, i32* %5
br label %7
7: ; preds = %25, %2
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 64
br i1 %9, label %10, label %28
10: ; preds = %7
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = ashr i32 %11, %12
%14 = and i32 %13, 1
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = ashr i32 %15, %16
%18 = and i32 %17, 1
%19 = sub nsw i32 %14, %18
%20 = call i64 @llabs(i32 %19)
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = add nsw i64 %22, %20
%24 = trunc i64 %23 to i32
store i32 %24, i32* %6
br label %25
25: ; preds = %10
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %7
28: ; preds = %7
%29 = load i32, i32* %6
ret i32 %29
}

LLVM IR (-O2):
define i32 @bimageHashDiff(i32 %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ 0, %2 ], [ %22, %3 ]
%5 = phi i32 [ 0, %2 ], [ %23, %3 ]
%6 = lshr i32 %0, %5
%7 = and i32 %6, 1
%8 = lshr i32 %1, %5
%9 = and i32 %8, 1
%10 = sub nsw i32 %7, %9
%11 = tail call i64 @llabs(i32 %10)
%12 = trunc i64 %11 to i32
%13 = add i32 %4, %12
%14 = or i32 %5, 1
%15 = lshr i32 %0, %14
%16 = and i32 %15, 1
%17 = lshr i32 %1, %14
%18 = and i32 %17, 1
%19 = sub nsw i32 %16, %18
%20 = tail call i64 @llabs(i32 %19)
%21 = trunc i64 %20 to i32
%22 = add i32 %13, %21
%23 = add nuw nsw i32 %5, 2
%24 = icmp eq i32 %23, 64
br i1 %24, label %25, label %3
25: ; preds = %3
ret i32 %22
}