#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*/ assert(int);
int /*<<< orphan*/ bitvector_delete(void *);
void *bitvector_new(int);
int /*<<< orphan*/ bitvector_set(void *, int);
int bitvector_test(void *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void test3(void) {
  void *vec;
  vec = bitvector_new(13);
  if (!vec) {
    fprintf(stderr, "vec is NULL\n");
    exit(1);
  }
  bitvector_set(vec, 7);
  assert(bitvector_test(vec, 7));
  assert(!bitvector_test(vec, 8));
  bitvector_delete(vec);
}


x86 assembly (clang, -O0):
<test3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xd,%edi
call   1090 <bitvector_new@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11b0 <test3+0x40>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
lea    0xe5f(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x8(%rbp),%rdi
mov    $0x7,%esi
call   1070 <bitvector_set@plt>
mov    -0x8(%rbp),%rdi
mov    $0x7,%esi
call   1030 <bitvector_test@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1030 <bitvector_test@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1060 <bitvector_delete@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test3>:
push   %rbx
mov    $0xd,%edi
call   1090 <bitvector_new@plt>
test   %rax,%rax
je     11c7 <test3+0x57>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x7,%esi
call   1070 <bitvector_set@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <bitvector_test@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <bitvector_test@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1060 <bitvector_delete@plt>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
lea    0xe29(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [13 x i8] c"vec is NULL\0A\00"
define void @test3() {
%1 = alloca i8*
%2 = call i8* @bitvector_new(i32 13)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp ne i8* %3, null
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %0
%10 = load i8*, i8** %1
%11 = call i32 @bitvector_set(i8* %10, i32 7)
%12 = load i8*, i8** %1
%13 = call i32 @bitvector_test(i8* %12, i32 7)
%14 = call i32 @assert(i32 %13)
%15 = load i8*, i8** %1
%16 = call i32 @bitvector_test(i8* %15, i32 8)
%17 = icmp ne i32 %16, 0
%18 = xor i1 %17, true
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load i8*, i8** %1
%22 = call i32 @bitvector_delete(i8* %21)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [13 x i8] c"vec is NULL\0A\00"
define void @test3() {
%1 = tail call i8* @bitvector_new(i32 13)
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %0
%8 = tail call i32 @bitvector_set(i8* %1, i32 7)
%9 = tail call i32 @bitvector_test(i8* %1, i32 7)
%10 = tail call i32 @assert(i32 %9)
%11 = tail call i32 @bitvector_test(i8* %1, i32 8)
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = tail call i32 @bitvector_delete(i8* %1)
ret void
}