; LLVM IR from jermp/2i_bench :: external/CRoaring/tests (bitset_container_unit)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str.1 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [33 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare ptr @bitset_container_create() #1

declare i32 @bitset_container_compute_cardinality(ptr noundef) #1

declare void @bitset_container_free(ptr noundef) #1

declare void @_assert_true(i64 noundef, ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @bitset_container_set(ptr noundef, i16 noundef zeroext) #2

declare void @_assert_int_equal(i64 noundef, i64 noundef, ptr noundef, i32 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @bitset_container_unset(ptr noundef, i16 noundef zeroext) #2

declare zeroext i1 @bitset_container_equals(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @andnot_test() #3 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  %8 = call ptr @bitset_container_create()
  store ptr %8, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %9 = call ptr @bitset_container_create()
  store ptr %9, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %10 = call ptr @bitset_container_create()
  store ptr %10, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %11 = call ptr @bitset_container_create()
  store ptr %11, ptr %4, align 8, !tbaa !5
  %12 = load ptr, ptr %1, align 8, !tbaa !5
  %13 = ptrtoint ptr %12 to i64
  call void @_assert_true(i64 noundef %13, ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 170)
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = ptrtoint ptr %14 to i64
  call void @_assert_true(i64 noundef %15, ptr noundef @.str.8, ptr noundef @.str.1, i32 noundef 171)
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = ptrtoint ptr %16 to i64
  call void @_assert_true(i64 noundef %17, ptr noundef @.str.9, ptr noundef @.str.1, i32 noundef 172)
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = ptrtoint ptr %18 to i64
  call void @_assert_true(i64 noundef %19, ptr noundef @.str.11, ptr noundef @.str.1, i32 noundef 173)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 0, ptr %5, align 8, !tbaa !9
  br label %20

20:                                               ; preds = %31, %0
  %21 = load i64, ptr %5, align 8, !tbaa !9
  %22 = icmp ult i64 %21, 65536
  br i1 %22, label %24, label %23

23:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %34

24:                                               ; preds = %20
  %25 = load ptr, ptr %1, align 8, !tbaa !5
  %26 = load i64, ptr %5, align 8, !tbaa !9
  %27 = trunc i64 %26 to i16
  call void @bitset_container_set(ptr noundef %25, i16 noundef zeroext %27)
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = load i64, ptr %5, align 8, !tbaa !9
  %30 = trunc i64 %29 to i16
  call void @bitset_container_set(ptr noundef %28, i16 noundef zeroext %30)
  br label %31

31:                                               ; preds = %24
  %32 = load i64, ptr %5, align 8, !tbaa !9
  %33 = add i64 %32, 3
  store i64 %33, ptr %5, align 8, !tbaa !9
  br label %20, !llvm.loop !11

34:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %35

35:                                               ; preds = %46, %34
  %36 = load i64, ptr %6, align 8, !tbaa !9
  %37 = icmp ult i64 %36, 65536
  br i1 %37, label %39, label %38

38:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %49

39:                                               ; preds = %35
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = load i64, ptr %6, align 8, !tbaa !9
  %42 = trunc i64 %41 to i16
  call void @bitset_container_set(ptr noundef %40, i16 noundef zeroext %42)
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = load i64, ptr %6, align 8, !tbaa !9
  %45 = trunc i64 %44 to i16
  call void @bitset_container_unset(ptr noundef %43, i16 noundef zeroext %45)
  br label %46

46:                                               ; preds = %39
  %47 = load i64, ptr %6, align 8, !tbaa !9
  %48 = add i64 %47, 62
  store i64 %48, ptr %6, align 8, !tbaa !9
  br label %35, !llvm.loop !13

49:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = call i32 @bitset_container_compute_cardinality(ptr noundef %50)
  store i32 %51, ptr %7, align 4, !tbaa !14
  %52 = load ptr, ptr %1, align 8, !tbaa !5
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = call i32 @bitset_container_andnot_nocard(ptr noundef %52, ptr noundef %53, ptr noundef %54)
  %56 = load i32, ptr %7, align 4, !tbaa !14
  %57 = sext i32 %56 to i64
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = call i32 @bitset_container_compute_cardinality(ptr noundef %58)
  %60 = sext i32 %59 to i64
  call void @_assert_int_equal(i64 noundef %57, i64 noundef %60, ptr noundef @.str.1, i32 noundef 190)
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = call zeroext i1 @bitset_container_equals(ptr noundef %61, ptr noundef %62)
  %64 = zext i1 %63 to i64
  call void @_assert_true(i64 noundef %64, ptr noundef @.str.13, ptr noundef @.str.1, i32 noundef 191)
  %65 = load i32, ptr %7, align 4, !tbaa !14
  %66 = sext i32 %65 to i64
  %67 = load ptr, ptr %1, align 8, !tbaa !5
  %68 = load ptr, ptr %2, align 8, !tbaa !5
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = call i32 @bitset_container_andnot(ptr noundef %67, ptr noundef %68, ptr noundef %69)
  %71 = sext i32 %70 to i64
  call void @_assert_int_equal(i64 noundef %66, i64 noundef %71, ptr noundef @.str.1, i32 noundef 193)
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = call zeroext i1 @bitset_container_equals(ptr noundef %72, ptr noundef %73)
  %75 = zext i1 %74 to i64
  call void @_assert_true(i64 noundef %75, ptr noundef @.str.13, ptr noundef @.str.1, i32 noundef 194)
  %76 = load ptr, ptr %1, align 8, !tbaa !5
  call void @bitset_container_free(ptr noundef %76)
  %77 = load ptr, ptr %2, align 8, !tbaa !5
  call void @bitset_container_free(ptr noundef %77)
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  call void @bitset_container_free(ptr noundef %78)
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  call void @bitset_container_free(ptr noundef %79)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret void
}

declare i32 @bitset_container_andnot_nocard(ptr noundef, ptr noundef, ptr noundef) #1

declare i32 @bitset_container_andnot(ptr noundef, ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str.1 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [33 x i8], align 1

declare ptr @bitset_container_create() local_unnamed_addr #0

declare i32 @bitset_container_compute_cardinality(ptr noundef) local_unnamed_addr #0

declare void @bitset_container_free(ptr noundef) local_unnamed_addr #0

declare void @_assert_true(i64 noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @bitset_container_set(ptr noundef, i16 noundef zeroext) local_unnamed_addr #1

declare void @_assert_int_equal(i64 noundef, i64 noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @bitset_container_unset(ptr noundef, i16 noundef zeroext) local_unnamed_addr #1

declare zeroext i1 @bitset_container_equals(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @andnot_test() local_unnamed_addr #2 {
  %1 = tail call ptr @bitset_container_create() #3
  %2 = tail call ptr @bitset_container_create() #3
  %3 = tail call ptr @bitset_container_create() #3
  %4 = tail call ptr @bitset_container_create() #3
  %5 = ptrtoint ptr %1 to i64
  tail call void @_assert_true(i64 noundef %5, ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 170) #3
  %6 = ptrtoint ptr %2 to i64
  tail call void @_assert_true(i64 noundef %6, ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.1, i32 noundef 171) #3
  %7 = ptrtoint ptr %3 to i64
  tail call void @_assert_true(i64 noundef %7, ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.1, i32 noundef 172) #3
  %8 = ptrtoint ptr %4 to i64
  tail call void @_assert_true(i64 noundef %8, ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.1, i32 noundef 173) #3
  br label %9

9:                                                ; preds = %0, %9
  %.034 = phi i64 [ 0, %0 ], [ %11, %9 ]
  %10 = trunc nuw i64 %.034 to i16
  tail call void @bitset_container_set(ptr noundef %1, i16 noundef zeroext %10)
  tail call void @bitset_container_set(ptr noundef %3, i16 noundef zeroext %10)
  %11 = add nuw nsw i64 %.034, 3
  %12 = icmp ult i64 %.034, 65533
  br i1 %12, label %9, label %.preheader, !llvm.loop !5

13:                                               ; preds = %.preheader
  %14 = tail call i32 @bitset_container_compute_cardinality(ptr noundef %3) #3
  %15 = tail call i32 @bitset_container_andnot_nocard(ptr noundef %1, ptr noundef %2, ptr noundef %4) #3
  %16 = sext i32 %14 to i64
  %17 = tail call i32 @bitset_container_compute_cardinality(ptr noundef %4) #3
  %18 = sext i32 %17 to i64
  tail call void @_assert_int_equal(i64 noundef %16, i64 noundef %18, ptr noundef nonnull @.str.1, i32 noundef 190) #3
  %19 = tail call zeroext i1 @bitset_container_equals(ptr noundef %3, ptr noundef %4) #3
  %20 = zext i1 %19 to i64
  tail call void @_assert_true(i64 noundef %20, ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.1, i32 noundef 191) #3
  %21 = tail call i32 @bitset_container_andnot(ptr noundef %1, ptr noundef %2, ptr noundef %4) #3
  %22 = sext i32 %21 to i64
  tail call void @_assert_int_equal(i64 noundef %16, i64 noundef %22, ptr noundef nonnull @.str.1, i32 noundef 193) #3
  %23 = tail call zeroext i1 @bitset_container_equals(ptr noundef %3, ptr noundef %4) #3
  %24 = zext i1 %23 to i64
  tail call void @_assert_true(i64 noundef %24, ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.1, i32 noundef 194) #3
  tail call void @bitset_container_free(ptr noundef %1) #3
  tail call void @bitset_container_free(ptr noundef %2) #3
  tail call void @bitset_container_free(ptr noundef %3) #3
  tail call void @bitset_container_free(ptr noundef %4) #3
  ret void

.preheader:                                       ; preds = %9, %.preheader
  %.03335 = phi i64 [ %26, %.preheader ], [ 0, %9 ]
  %25 = trunc nuw i64 %.03335 to i16
  tail call void @bitset_container_set(ptr noundef %2, i16 noundef zeroext %25)
  tail call void @bitset_container_unset(ptr noundef %3, i16 noundef zeroext %25)
  %26 = add nuw nsw i64 %.03335, 62
  %27 = icmp ult i64 %.03335, 65474
  br i1 %27, label %.preheader, label %13, !llvm.loop !7
}

declare i32 @bitset_container_andnot_nocard(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare i32 @bitset_container_andnot(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass