#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 */
scalar_t__ bitGetBit(void const *, int);
int bitTestEquality_Array(const void *bits, const void *bitarray,
                          int array_start, int nbits) {
  int i;
  for (i = 0; i < nbits; i++)
    if (bitGetBit(bits, i) != bitGetBit(bitarray, array_start + i))
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<bitTestEquality_Array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1187 <bitTestEquality_Array+0x77>
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1030 <bitGetBit@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
add    -0x24(%rbp),%esi
call   1030 <bitGetBit@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
je     1174 <bitTestEquality_Array+0x64>
movl   $0x0,-0x4(%rbp)
jmp    118e <bitTestEquality_Array+0x7e>
jmp    1179 <bitTestEquality_Array+0x69>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112d <bitTestEquality_Array+0x1d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitTestEquality_Array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x1,%eax
test   %ecx,%ecx
jle    116e <bitTestEquality_Array+0x5e>
mov    %ecx,%ebp
mov    %edx,%r15d
mov    %rsi,%r12
mov    %rdi,%r13
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %ebx,%esi
call   1030 <bitGetBit@plt>
mov    %rax,%r14
lea    (%r15,%rbx,1),%esi
mov    %r12,%rdi
call   1030 <bitGetBit@plt>
cmp    %rax,%r14
jne    116c <bitTestEquality_Array+0x5c>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1140 <bitTestEquality_Array+0x30>
mov    $0x1,%eax
jmp    116e <bitTestEquality_Array+0x5e>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @bitTestEquality_Array(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 0, i32* %10
br label %11
11: ; preds = %27, %4
%12 = load i32, i32* %10
%13 = load i32, i32* %9
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %30
15: ; preds = %11
%16 = load i8*, i8** %6
%17 = load i32, i32* %10
%18 = call i64 @bitGetBit(i8* %16, i32 %17)
%19 = load i8*, i8** %7
%20 = load i32, i32* %8
%21 = load i32, i32* %10
%22 = add nsw i32 %20, %21
%23 = call i64 @bitGetBit(i8* %19, i32 %22)
%24 = icmp ne i64 %18, %23
br i1 %24, label %25, label %26
25: ; preds = %15
store i32 0, i32* %5
br label %31
26: ; preds = %15
br label %27
27: ; preds = %26
%28 = load i32, i32* %10
%29 = add nsw i32 %28, 1
store i32 %29, i32* %10
br label %11
30: ; preds = %11
store i32 1, i32* %5
br label %31
31: ; preds = %30, %25
%32 = load i32, i32* %5
ret i32 %32
}

LLVM IR (-O2):
define i32 @bitTestEquality_Array(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %3, 0
br i1 %5, label %8, label %15
6: ; preds = %8
%7 = icmp eq i32 %14, %3
br i1 %7, label %15, label %8
8: ; preds = %4, %6
%9 = phi i32 [ %14, %6 ], [ 0, %4 ]
%10 = tail call i64 @bitGetBit(i8* %0, i32 %9)
%11 = add nsw i32 %9, %2
%12 = tail call i64 @bitGetBit(i8* %1, i32 %11)
%13 = icmp eq i64 %10, %12
%14 = add nuw nsw i32 %9, 1
br i1 %13, label %6, label %15
15: ; preds = %8, %6, %4
%16 = phi i32 [ 1, %4 ], [ 1, %6 ], [ 0, %8 ]
ret i32 %16
}