; 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.10 = external hidden unnamed_addr constant [3 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

; Function Attrs: nounwind uwtable
define dso_local void @and_or_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 i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  %10 = call ptr @bitset_container_create()
  store ptr %10, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %11 = call ptr @bitset_container_create()
  store ptr %11, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %12 = call ptr @bitset_container_create()
  store ptr %12, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %13 = call ptr @bitset_container_create()
  store ptr %13, ptr %4, align 8, !tbaa !5
  %14 = load ptr, ptr %1, align 8, !tbaa !5
  %15 = ptrtoint ptr %14 to i64
  call void @_assert_true(i64 noundef %15, ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 92)
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = ptrtoint ptr %16 to i64
  call void @_assert_true(i64 noundef %17, ptr noundef @.str.8, ptr noundef @.str.1, i32 noundef 93)
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = ptrtoint ptr %18 to i64
  call void @_assert_true(i64 noundef %19, ptr noundef @.str.9, ptr noundef @.str.1, i32 noundef 94)
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = ptrtoint ptr %20 to i64
  call void @_assert_true(i64 noundef %21, ptr noundef @.str.10, ptr noundef @.str.1, i32 noundef 95)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 0, ptr %5, align 8, !tbaa !9
  br label %22

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

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

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

33:                                               ; preds = %26
  %34 = load i64, ptr %5, align 8, !tbaa !9
  %35 = add i64 %34, 3
  store i64 %35, ptr %5, align 8, !tbaa !9
  br label %22, !llvm.loop !11

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

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

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

41:                                               ; preds = %37
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = load i64, ptr %6, 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 %3, align 8, !tbaa !5
  %46 = load i64, ptr %6, align 8, !tbaa !9
  %47 = trunc i64 %46 to i16
  call void @bitset_container_set(ptr noundef %45, i16 noundef zeroext %47)
  br label %48

48:                                               ; preds = %41
  %49 = load i64, ptr %6, align 8, !tbaa !9
  %50 = add i64 %49, 62
  store i64 %50, ptr %6, align 8, !tbaa !9
  br label %37, !llvm.loop !13

51:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %52

52:                                               ; preds = %60, %51
  %53 = load i64, ptr %7, align 8, !tbaa !9
  %54 = icmp ult i64 %53, 65536
  br i1 %54, label %56, label %55

55:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %63

56:                                               ; preds = %52
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = load i64, ptr %7, align 8, !tbaa !9
  %59 = trunc i64 %58 to i16
  call void @bitset_container_set(ptr noundef %57, i16 noundef zeroext %59)
  br label %60

60:                                               ; preds = %56
  %61 = load i64, ptr %7, align 8, !tbaa !9
  %62 = add i64 %61, 186
  store i64 %62, ptr %7, align 8, !tbaa !9
  br label %52, !llvm.loop !14

63:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = call i32 @bitset_container_compute_cardinality(ptr noundef %64)
  store i32 %65, ptr %8, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = call i32 @bitset_container_compute_cardinality(ptr noundef %66)
  store i32 %67, ptr %9, align 4, !tbaa !15
  %68 = load ptr, ptr %1, align 8, !tbaa !5
  %69 = load ptr, ptr %2, align 8, !tbaa !5
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = call i32 @bitset_container_and_nocard(ptr noundef %68, ptr noundef %69, ptr noundef %70)
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = call i32 @bitset_container_compute_cardinality(ptr noundef %72)
  %74 = sext i32 %73 to i64
  %75 = load i32, ptr %8, align 4, !tbaa !15
  %76 = sext i32 %75 to i64
  call void @_assert_int_not_equal(i64 noundef %74, i64 noundef %76, ptr noundef @.str.1, i32 noundef 116)
  %77 = load ptr, ptr %1, align 8, !tbaa !5
  %78 = load ptr, ptr %2, align 8, !tbaa !5
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = call i32 @bitset_container_and(ptr noundef %77, ptr noundef %78, ptr noundef %79)
  %81 = sext i32 %80 to i64
  %82 = load i32, ptr %8, align 4, !tbaa !15
  %83 = sext i32 %82 to i64
  call void @_assert_int_not_equal(i64 noundef %81, i64 noundef %83, ptr noundef @.str.1, i32 noundef 117)
  %84 = load ptr, ptr %1, align 8, !tbaa !5
  %85 = load ptr, ptr %2, align 8, !tbaa !5
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = call i32 @bitset_container_or_nocard(ptr noundef %84, ptr noundef %85, ptr noundef %86)
  %88 = load ptr, ptr %4, align 8, !tbaa !5
  %89 = call i32 @bitset_container_compute_cardinality(ptr noundef %88)
  %90 = sext i32 %89 to i64
  %91 = load i32, ptr %9, align 4, !tbaa !15
  %92 = sext i32 %91 to i64
  call void @_assert_int_not_equal(i64 noundef %90, i64 noundef %92, ptr noundef @.str.1, i32 noundef 120)
  %93 = load ptr, ptr %1, align 8, !tbaa !5
  %94 = load ptr, ptr %2, align 8, !tbaa !5
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  %96 = call i32 @bitset_container_or(ptr noundef %93, ptr noundef %94, ptr noundef %95)
  %97 = sext i32 %96 to i64
  %98 = load i32, ptr %9, align 4, !tbaa !15
  %99 = sext i32 %98 to i64
  call void @_assert_int_not_equal(i64 noundef %97, i64 noundef %99, ptr noundef @.str.1, i32 noundef 121)
  %100 = load ptr, ptr %1, align 8, !tbaa !5
  call void @bitset_container_free(ptr noundef %100)
  %101 = load ptr, ptr %2, align 8, !tbaa !5
  call void @bitset_container_free(ptr noundef %101)
  %102 = load ptr, ptr %3, align 8, !tbaa !5
  call void @bitset_container_free(ptr noundef %102)
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  call void @bitset_container_free(ptr noundef %103)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #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_and_nocard(ptr noundef, ptr noundef, ptr noundef) #1

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

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

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

declare i32 @bitset_container_or(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 = distinct !{!14, !12}
!15 = !{!16, !16, i64 0}
!16 = !{!"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.10 = external hidden unnamed_addr constant [3 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

; Function Attrs: nounwind uwtable
define dso_local void @and_or_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 92) #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 93) #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 94) #3
  %8 = ptrtoint ptr %4 to i64
  tail call void @_assert_true(i64 noundef %8, ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.1, i32 noundef 95) #3
  br label %9

9:                                                ; preds = %0, %9
  %.046 = phi i64 [ 0, %0 ], [ %11, %9 ]
  %10 = trunc nuw i64 %.046 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 %.046, 3
  %12 = icmp ult i64 %.046, 65533
  br i1 %12, label %9, label %.preheader45, !llvm.loop !5

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

16:                                               ; preds = %.preheader
  %17 = tail call i32 @bitset_container_compute_cardinality(ptr noundef %3) #3
  %18 = tail call i32 @bitset_container_compute_cardinality(ptr noundef %4) #3
  %19 = tail call i32 @bitset_container_and_nocard(ptr noundef %1, ptr noundef %2, ptr noundef %3) #3
  %20 = tail call i32 @bitset_container_compute_cardinality(ptr noundef %3) #3
  %21 = sext i32 %20 to i64
  %22 = sext i32 %17 to i64
  tail call void @_assert_int_not_equal(i64 noundef %21, i64 noundef %22, ptr noundef nonnull @.str.1, i32 noundef 116) #3
  %23 = tail call i32 @bitset_container_and(ptr noundef %1, ptr noundef %2, ptr noundef %3) #3
  %24 = sext i32 %23 to i64
  tail call void @_assert_int_not_equal(i64 noundef %24, i64 noundef %22, ptr noundef nonnull @.str.1, i32 noundef 117) #3
  %25 = tail call i32 @bitset_container_or_nocard(ptr noundef %1, ptr noundef %2, ptr noundef %4) #3
  %26 = tail call i32 @bitset_container_compute_cardinality(ptr noundef %4) #3
  %27 = sext i32 %26 to i64
  %28 = sext i32 %18 to i64
  tail call void @_assert_int_not_equal(i64 noundef %27, i64 noundef %28, ptr noundef nonnull @.str.1, i32 noundef 120) #3
  %29 = tail call i32 @bitset_container_or(ptr noundef %1, ptr noundef %2, ptr noundef %4) #3
  %30 = sext i32 %29 to i64
  tail call void @_assert_int_not_equal(i64 noundef %30, i64 noundef %28, ptr noundef nonnull @.str.1, i32 noundef 121) #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 = %.preheader45, %.preheader
  %.04448 = phi i64 [ %32, %.preheader ], [ 0, %.preheader45 ]
  %31 = trunc nuw i64 %.04448 to i16
  tail call void @bitset_container_set(ptr noundef %4, i16 noundef zeroext %31)
  %32 = add nuw nsw i64 %.04448, 186
  %33 = icmp ult i64 %.04448, 65350
  br i1 %33, label %.preheader, label %16, !llvm.loop !8
}

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

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

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

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

declare i32 @bitset_container_or(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}
!8 = distinct !{!8, !6}


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