#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 */
struct corpus_intset {
  int dummy;
};

/* Variables and functions */
scalar_t__ corpus_intset_find(struct corpus_intset const *, int, int *);
int corpus_intset_has(const struct corpus_intset *set, int item, int *idptr) {
  int id, found;
  if (corpus_intset_find(set, item, &id)) {
    found = 1;
  } else {
    found = 0;
    id = -1;
  }
  if (idptr) {
    *idptr = id;
  }
  return found;
}


x86 assembly (clang, -O0):
<corpus_intset_has>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x1c(%rbp),%rdx
call   1030 <corpus_intset_find@plt>
cmp    $0x0,%rax
je     1149 <corpus_intset_has+0x39>
movl   $0x1,-0x20(%rbp)
jmp    1157 <corpus_intset_has+0x47>
movl   $0x0,-0x20(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     116b <corpus_intset_has+0x5b>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<corpus_intset_has>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
lea    0xc(%rsp),%rdx
call   1030 <corpus_intset_find@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1140 <corpus_intset_has+0x30>
test   %rbx,%rbx
je     113a <corpus_intset_has+0x2a>
mov    0xc(%rsp),%ecx
mov    %ecx,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret
movl   $0xffffffff,0xc(%rsp)
ff
xor    %eax,%eax
test   %rbx,%rbx
jne    1134 <corpus_intset_has+0x24>
jmp    113a <corpus_intset_has+0x2a>

LLVM IR (-O0):
%struct.corpus_intset = type { i32 }
define i32 @corpus_intset_has(%struct.corpus_intset* %0, i32 %1, i32* %2) {
%4 = alloca %struct.corpus_intset*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store %struct.corpus_intset* %0, %struct.corpus_intset** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%9 = load %struct.corpus_intset*, %struct.corpus_intset** %4
%10 = load i32, i32* %5
%11 = call i64 @corpus_intset_find(%struct.corpus_intset* %9, i32 %10, i32* %7)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 1, i32* %8
br label %15
14: ; preds = %3
store i32 0, i32* %8
store i32 -1, i32* %7
br label %15
15: ; preds = %14, %13
%16 = load i32*, i32** %6
%17 = icmp ne i32* %16, null
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %7
%20 = load i32*, i32** %6
store i32 %19, i32* %20
br label %21
21: ; preds = %18, %15
%22 = load i32, i32* %8
ret i32 %22
}

LLVM IR (-O2):
%struct.corpus_intset = type { i32 }
define i32 @corpus_intset_has(%struct.corpus_intset* %0, i32 %1, i32* writeonly %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = call i64 @corpus_intset_find(%struct.corpus_intset* %0, i32 %1, i32* %4)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %3
store i32 -1, i32* %4
br label %9
9: ; preds = %3, %8
%10 = phi i32 [ 0, %8 ], [ 1, %3 ]
%11 = icmp eq i32* %2, null
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = load i32, i32* %4
store i32 %13, i32* %2
br label %14
14: ; preds = %12, %9
ret i32 %10
}