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


x86 assembly (clang, -O0):
<test1>:
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 <test1+0x40>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
lea    0xe5f(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1060 <bitvector_set@plt>
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
call   1060 <bitvector_set@plt>
mov    -0x8(%rbp),%rax
cmpl   $0xc,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
call   1070 <bitvector_unset@plt>
mov    -0x8(%rbp),%rax
cmpl   $0x4,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1050 <bitvector_delete@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
push   %rbx
mov    $0xd,%edi
call   1090 <bitvector_new@plt>
test   %rax,%rax
je     11cf <test1+0x5f>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x2,%esi
call   1060 <bitvector_set@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1060 <bitvector_set@plt>
xor    %edi,%edi
cmpl   $0xc,(%rbx)
sete   %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1070 <bitvector_unset@plt>
xor    %edi,%edi
cmpl   $0x4,(%rbx)
sete   %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <bitvector_delete@plt>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
lea    0xe21(%rip),%rsi
call   1040 <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 @test1() {
%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 2)
%12 = load i8*, i8** %1
%13 = call i32 @bitvector_set(i8* %12, i32 3)
%14 = load i8*, i8** %1
%15 = bitcast i8* %14 to i32*
%16 = load i32, i32* %15
%17 = icmp eq i32 %16, 12
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load i8*, i8** %1
%21 = call i32 @bitvector_unset(i8* %20, i32 3)
%22 = load i8*, i8** %1
%23 = bitcast i8* %22 to i32*
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, 4
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = load i8*, i8** %1
%29 = call i32 @bitvector_delete(i8* %28)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [13 x i8] c"vec is NULL\0A\00"
define void @test1() {
%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 2)
%9 = tail call i32 @bitvector_set(i8* %1, i32 3)
%10 = bitcast i8* %1 to i32*
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 12
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = tail call i32 @bitvector_unset(i8* %1, i32 3)
%16 = load i32, i32* %10
%17 = icmp eq i32 %16, 4
%18 = zext i1 %17 to i32
%19 = tail call i32 @assert(i32 %18)
%20 = tail call i32 @bitvector_delete(i8* %1)
ret void
}