; 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.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [27 x i8], align 1
@__PRETTY_FUNCTION__.set_get_test = external hidden unnamed_addr constant [20 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; 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() #2

declare i32 @bitset_container_compute_cardinality(ptr noundef) #2

declare void @bitset_container_free(ptr noundef) #2

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

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

; Function Attrs: nounwind uwtable
define dso_local void @set_get_test() #4 {
  %1 = alloca ptr, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  %6 = call ptr @bitset_container_create()
  store ptr %6, ptr %1, align 8, !tbaa !5
  %7 = load ptr, ptr %1, align 8, !tbaa !5
  %8 = ptrtoint ptr %7 to i64
  call void @_assert_true(i64 noundef %8, ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 52)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  store i64 0, ptr %2, align 8, !tbaa !9
  br label %9

9:                                                ; preds = %21, %0
  %10 = load i64, ptr %2, align 8, !tbaa !9
  %11 = icmp ult i64 %10, 65536
  br i1 %11, label %13, label %12

12:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  br label %24

13:                                               ; preds = %9
  %14 = load ptr, ptr %1, align 8, !tbaa !5
  %15 = load i64, ptr %2, align 8, !tbaa !9
  %16 = trunc i64 %15 to i16
  %17 = call zeroext i1 @bitset_container_get(ptr noundef %14, i16 noundef zeroext %16)
  %18 = xor i1 %17, true
  %19 = zext i1 %18 to i32
  %20 = sext i32 %19 to i64
  call void @_assert_true(i64 noundef %20, ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 55)
  br label %21

21:                                               ; preds = %13
  %22 = load i64, ptr %2, align 8, !tbaa !9
  %23 = add i64 %22, 1
  store i64 %23, ptr %2, align 8, !tbaa !9
  br label %9, !llvm.loop !11

24:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  store i64 0, ptr %3, align 8, !tbaa !9
  br label %25

25:                                               ; preds = %58, %24
  %26 = load i64, ptr %3, align 8, !tbaa !9
  %27 = icmp ult i64 %26, 65536
  br i1 %27, label %29, label %28

28:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %61

29:                                               ; preds = %25
  %30 = load ptr, ptr %1, align 8, !tbaa !5
  %31 = call i32 @bitset_container_cardinality(ptr noundef %30)
  %32 = sext i32 %31 to i64
  %33 = load i64, ptr %3, align 8, !tbaa !9
  %34 = udiv i64 %33, 3
  call void @_assert_int_equal(i64 noundef %32, i64 noundef %34, ptr noundef @.str.1, i32 noundef 59)
  %35 = load ptr, ptr %1, align 8, !tbaa !5
  %36 = load i64, ptr %3, align 8, !tbaa !9
  %37 = trunc i64 %36 to i16
  %38 = call zeroext i1 @bitset_container_get(ptr noundef %35, i16 noundef zeroext %37)
  %39 = xor i1 %38, true
  %40 = zext i1 %39 to i32
  %41 = sext i32 %40 to i64
  call void @_assert_true(i64 noundef %41, ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 61)
  %42 = load ptr, ptr %1, align 8, !tbaa !5
  %43 = load i64, ptr %3, align 8, !tbaa !9
  %44 = trunc i64 %43 to i16
  call void @bitset_container_set(ptr noundef %42, i16 noundef zeroext %44)
  %45 = load ptr, ptr %1, align 8, !tbaa !5
  %46 = load i64, ptr %3, align 8, !tbaa !9
  %47 = trunc i64 %46 to i16
  %48 = call zeroext i1 @bitset_container_get(ptr noundef %45, i16 noundef zeroext %47)
  br i1 %48, label %49, label %50

49:                                               ; preds = %29
  br label %51

50:                                               ; preds = %29
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 63, ptr noundef @__PRETTY_FUNCTION__.set_get_test) #6
  unreachable

51:                                               ; preds = %49
  %52 = load ptr, ptr %1, align 8, !tbaa !5
  %53 = call i32 @bitset_container_cardinality(ptr noundef %52)
  %54 = sext i32 %53 to i64
  %55 = load i64, ptr %3, align 8, !tbaa !9
  %56 = udiv i64 %55, 3
  %57 = add i64 %56, 1
  call void @_assert_int_equal(i64 noundef %54, i64 noundef %57, ptr noundef @.str.1, i32 noundef 65)
  br label %58

58:                                               ; preds = %51
  %59 = load i64, ptr %3, align 8, !tbaa !9
  %60 = add i64 %59, 3
  store i64 %60, ptr %3, align 8, !tbaa !9
  br label %25, !llvm.loop !13

61:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  store i64 0, ptr %4, align 8, !tbaa !9
  br label %62

62:                                               ; preds = %79, %61
  %63 = load i64, ptr %4, align 8, !tbaa !9
  %64 = icmp ult i64 %63, 65536
  br i1 %64, label %66, label %65

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

66:                                               ; preds = %62
  %67 = load ptr, ptr %1, align 8, !tbaa !5
  %68 = load i64, ptr %4, align 8, !tbaa !9
  %69 = trunc i64 %68 to i16
  %70 = call zeroext i1 @bitset_container_get(ptr noundef %67, i16 noundef zeroext %69)
  %71 = zext i1 %70 to i64
  %72 = load i64, ptr %4, align 8, !tbaa !9
  %73 = udiv i64 %72, 3
  %74 = mul i64 %73, 3
  %75 = load i64, ptr %4, align 8, !tbaa !9
  %76 = icmp eq i64 %74, %75
  %77 = zext i1 %76 to i32
  %78 = sext i32 %77 to i64
  call void @_assert_int_equal(i64 noundef %71, i64 noundef %78, ptr noundef @.str.1, i32 noundef 69)
  br label %79

79:                                               ; preds = %66
  %80 = load i64, ptr %4, align 8, !tbaa !9
  %81 = add i64 %80, 1
  store i64 %81, ptr %4, align 8, !tbaa !9
  br label %62, !llvm.loop !14

82:                                               ; preds = %65
  %83 = load ptr, ptr %1, align 8, !tbaa !5
  %84 = call i32 @bitset_container_cardinality(ptr noundef %83)
  %85 = sext i32 %84 to i64
  call void @_assert_int_equal(i64 noundef %85, i64 noundef 21846, ptr noundef @.str.1, i32 noundef 72)
  %86 = load ptr, ptr %1, align 8, !tbaa !5
  %87 = call i32 @bitset_container_compute_cardinality(ptr noundef %86)
  %88 = sext i32 %87 to i64
  call void @_assert_int_equal(i64 noundef %88, i64 noundef 21846, ptr noundef @.str.1, i32 noundef 74)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store i64 0, ptr %5, align 8, !tbaa !9
  br label %89

89:                                               ; preds = %97, %82
  %90 = load i64, ptr %5, align 8, !tbaa !9
  %91 = icmp ult i64 %90, 65536
  br i1 %91, label %93, label %92

92:                                               ; preds = %89
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %100

93:                                               ; preds = %89
  %94 = load ptr, ptr %1, align 8, !tbaa !5
  %95 = load i64, ptr %5, align 8, !tbaa !9
  %96 = trunc i64 %95 to i16
  call void @bitset_container_unset(ptr noundef %94, i16 noundef zeroext %96)
  br label %97

97:                                               ; preds = %93
  %98 = load i64, ptr %5, align 8, !tbaa !9
  %99 = add i64 %98, 3
  store i64 %99, ptr %5, align 8, !tbaa !9
  br label %89, !llvm.loop !15

100:                                              ; preds = %92
  %101 = load ptr, ptr %1, align 8, !tbaa !5
  %102 = call i32 @bitset_container_cardinality(ptr noundef %101)
  %103 = sext i32 %102 to i64
  call void @_assert_int_equal(i64 noundef %103, i64 noundef 0, ptr noundef @.str.1, i32 noundef 80)
  %104 = load ptr, ptr %1, align 8, !tbaa !5
  %105 = call i32 @bitset_container_compute_cardinality(ptr noundef %104)
  %106 = sext i32 %105 to i64
  call void @_assert_int_equal(i64 noundef %106, i64 noundef 0, ptr noundef @.str.1, i32 noundef 81)
  %107 = load ptr, ptr %1, align 8, !tbaa !5
  call void @bitset_container_free(ptr noundef %107)
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  ret void
}

; Function Attrs: inlinehint nounwind uwtable
declare zeroext i1 @bitset_container_get(ptr noundef, i16 noundef zeroext) #3

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @bitset_container_cardinality(ptr noundef) #3

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn nounwind "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 = { "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 = { 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { noreturn 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 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


; 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.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [27 x i8], align 1
@__PRETTY_FUNCTION__.set_get_test = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

declare ptr @bitset_container_create() local_unnamed_addr #1

declare i32 @bitset_container_compute_cardinality(ptr noundef) local_unnamed_addr #1

declare void @bitset_container_free(ptr noundef) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
define dso_local void @set_get_test() local_unnamed_addr #3 {
  %1 = tail call ptr @bitset_container_create() #4
  %2 = ptrtoint ptr %1 to i64
  tail call void @_assert_true(i64 noundef %2, ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 52) #4
  br label %3

3:                                                ; preds = %0, %3
  %.03337 = phi i64 [ 0, %0 ], [ %8, %3 ]
  %4 = trunc nuw i64 %.03337 to i16
  %5 = tail call zeroext i1 @bitset_container_get(ptr noundef %1, i16 noundef zeroext %4)
  %6 = xor i1 %5, true
  %7 = zext i1 %6 to i64
  tail call void @_assert_true(i64 noundef %7, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 55) #4
  %8 = add nuw nsw i64 %.03337, 1
  %exitcond.not = icmp eq i64 %8, 65536
  br i1 %exitcond.not, label %.preheader36, label %3, !llvm.loop !5

.preheader36:                                     ; preds = %3, %17
  %.03238 = phi i64 [ %21, %17 ], [ 0, %3 ]
  %9 = tail call i32 @bitset_container_cardinality(ptr noundef %1)
  %10 = sext i32 %9 to i64
  %.lhs.trunc = trunc nuw i64 %.03238 to i16
  %11 = udiv i16 %.lhs.trunc, 3
  %.zext = zext nneg i16 %11 to i64
  tail call void @_assert_int_equal(i64 noundef %10, i64 noundef %.zext, ptr noundef nonnull @.str.1, i32 noundef 59) #4
  %12 = tail call zeroext i1 @bitset_container_get(ptr noundef %1, i16 noundef zeroext %.lhs.trunc)
  %13 = xor i1 %12, true
  %14 = zext i1 %13 to i64
  tail call void @_assert_true(i64 noundef %14, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 61) #4
  tail call void @bitset_container_set(ptr noundef %1, i16 noundef zeroext %.lhs.trunc)
  %15 = tail call zeroext i1 @bitset_container_get(ptr noundef %1, i16 noundef zeroext %.lhs.trunc)
  br i1 %15, label %17, label %16

16:                                               ; preds = %.preheader36
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 63, ptr noundef nonnull @__PRETTY_FUNCTION__.set_get_test) #5
  unreachable

17:                                               ; preds = %.preheader36
  %18 = tail call i32 @bitset_container_cardinality(ptr noundef %1)
  %19 = sext i32 %18 to i64
  %20 = add nuw nsw i64 %.zext, 1
  tail call void @_assert_int_equal(i64 noundef %19, i64 noundef %20, ptr noundef nonnull @.str.1, i32 noundef 65) #4
  %21 = add nuw nsw i64 %.03238, 3
  %22 = icmp ult i64 %.03238, 65533
  br i1 %22, label %.preheader36, label %.preheader, !llvm.loop !7

23:                                               ; preds = %.preheader
  %24 = tail call i32 @bitset_container_cardinality(ptr noundef %1)
  %25 = sext i32 %24 to i64
  tail call void @_assert_int_equal(i64 noundef %25, i64 noundef 21846, ptr noundef nonnull @.str.1, i32 noundef 72) #4
  %26 = tail call i32 @bitset_container_compute_cardinality(ptr noundef %1) #4
  %27 = sext i32 %26 to i64
  tail call void @_assert_int_equal(i64 noundef %27, i64 noundef 21846, ptr noundef nonnull @.str.1, i32 noundef 74) #4
  br label %40

.preheader:                                       ; preds = %17, %.preheader
  %.03139 = phi i64 [ %34, %.preheader ], [ 0, %17 ]
  %28 = trunc nuw i64 %.03139 to i16
  %29 = tail call zeroext i1 @bitset_container_get(ptr noundef %1, i16 noundef zeroext %28)
  %30 = zext i1 %29 to i64
  %31 = urem i16 %28, 3
  %32 = icmp eq i16 %31, 0
  %33 = zext i1 %32 to i64
  tail call void @_assert_int_equal(i64 noundef %30, i64 noundef %33, ptr noundef nonnull @.str.1, i32 noundef 69) #4
  %34 = add nuw nsw i64 %.03139, 1
  %exitcond41.not = icmp eq i64 %34, 65536
  br i1 %exitcond41.not, label %23, label %.preheader, !llvm.loop !8

35:                                               ; preds = %40
  %36 = tail call i32 @bitset_container_cardinality(ptr noundef %1)
  %37 = sext i32 %36 to i64
  tail call void @_assert_int_equal(i64 noundef %37, i64 noundef 0, ptr noundef nonnull @.str.1, i32 noundef 80) #4
  %38 = tail call i32 @bitset_container_compute_cardinality(ptr noundef %1) #4
  %39 = sext i32 %38 to i64
  tail call void @_assert_int_equal(i64 noundef %39, i64 noundef 0, ptr noundef nonnull @.str.1, i32 noundef 81) #4
  tail call void @bitset_container_free(ptr noundef %1) #4
  ret void

40:                                               ; preds = %23, %40
  %.040 = phi i64 [ 0, %23 ], [ %42, %40 ]
  %41 = trunc nuw i64 %.040 to i16
  tail call void @bitset_container_unset(ptr noundef %1, i16 noundef zeroext %41)
  %42 = add nuw nsw i64 %.040, 3
  %43 = icmp ult i64 %.040, 65533
  br i1 %43, label %40, label %35, !llvm.loop !9
}

; Function Attrs: inlinehint nounwind uwtable
declare zeroext i1 @bitset_container_get(ptr noundef, i16 noundef zeroext) local_unnamed_addr #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @bitset_container_cardinality(ptr noundef) local_unnamed_addr #2

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

attributes #0 = { noreturn nounwind "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 = { "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 }
attributes #5 = { noreturn 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}
!8 = distinct !{!8, !6}
!9 = distinct !{!9, !6}


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