#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*/ get_hashv(char *, int /*<<< orphan*/, unsigned int *);
int /*<<< orphan*/ strlen(char *);
int bf_hit(char *bf, char *line) {
  unsigned i, hashv[2];
  get_hashv(line, strlen(line), hashv);
  for (i = 0; i < 2; i++) {
    if ((bf[hashv[i] / 8] & (1 << (hashv[i] % 8))) == 0)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<bf_hit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%esi
lea    -0x24(%rbp),%rdx
call   1040 <get_hashv@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jae    11b2 <bf_hit+0x92>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    -0x24(%rbp,%rcx,4),%ecx
shr    $0x3,%ecx
mov    %ecx,%ecx
movsbl (%rax,%rcx,1),%eax
mov    -0x1c(%rbp),%ecx
mov    -0x24(%rbp,%rcx,4),%ecx
and    $0x7,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
jne    119f <bf_hit+0x7f>
movl   $0x0,-0x4(%rbp)
jmp    11b9 <bf_hit+0x99>
jmp    11a4 <bf_hit+0x84>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1157 <bf_hit+0x37>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bf_hit>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <get_hashv@plt>
mov    (%rsp),%eax
mov    %rax,%rcx
shr    $0x3,%rcx
movzbl (%r14,%rcx,1),%ecx
and    $0x7,%al
movzbl %al,%eax
bt     %eax,%ecx
jae    1172 <bf_hit+0x52>
mov    0x4(%rsp),%ecx
mov    %rcx,%rax
shr    $0x3,%rax
movzbl (%r14,%rax,1),%eax
and    $0x7,%cl
shr    %cl,%eax
and    $0x1,%eax
jmp    1174 <bf_hit+0x54>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @bf_hit(i8* nocapture %0, i8* %1) {
%3 = alloca [2 x i32]
%4 = bitcast [2 x i32]* %3 to i8*
%5 = tail call i32 @strlen(i8* %1)
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%7 = call i32 @get_hashv(i8* %1, i32 %5, i32* %6)
%8 = load i32, i32* %6
%9 = lshr i32 %8, 3
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = and i32 %8, 7
%15 = shl nuw nsw i32 1, %14
%16 = and i32 %15, %13
%17 = icmp eq i32 %16, 0
br i1 %17, label %29, label %18
18: ; preds = %2
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%20 = load i32, i32* %19
%21 = lshr i32 %20, 3
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %0, i64 %22
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = and i32 %20, 7
%27 = lshr i32 %25, %26
%28 = and i32 %27, 1
br label %29
29: ; preds = %18, %2
%30 = phi i32 [ 0, %2 ], [ %28, %18 ]
ret i32 %30
}