; LLVM IR from jermp/2i_bench :: external/CRoaring/tests (run_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 [93 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
@.str.11 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [30 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

declare ptr @run_container_create() #1

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

declare zeroext i1 @run_container_add(ptr noundef, i16 noundef zeroext) #1

declare void @run_container_free(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @and_or_test() #2 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  %9 = call ptr @run_container_create()
  store ptr %9, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %10 = call ptr @run_container_create()
  store ptr %10, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %11 = call ptr @run_container_create()
  store ptr %11, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %12 = call ptr @run_container_create()
  store ptr %12, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %13 = call ptr @run_container_create()
  store ptr %13, ptr %5, 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 88)
  %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 89)
  %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 90)
  %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 91)
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = ptrtoint ptr %22 to i64
  call void @_assert_true(i64 noundef %23, ptr noundef @.str.11, ptr noundef @.str.1, i32 noundef 92)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %24

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

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

28:                                               ; preds = %24
  %29 = load ptr, ptr %1, align 8, !tbaa !5
  %30 = load i64, ptr %6, align 8, !tbaa !9
  %31 = trunc i64 %30 to i16
  %32 = call zeroext i1 @run_container_add(ptr noundef %29, i16 noundef zeroext %31)
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = load i64, ptr %6, align 8, !tbaa !9
  %35 = trunc i64 %34 to i16
  %36 = call zeroext i1 @run_container_add(ptr noundef %33, i16 noundef zeroext %35)
  br label %37

37:                                               ; preds = %28
  %38 = load i64, ptr %6, align 8, !tbaa !9
  %39 = add i64 %38, 3
  store i64 %39, ptr %6, align 8, !tbaa !9
  br label %24, !llvm.loop !11

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

41:                                               ; preds = %54, %40
  %42 = load i64, ptr %7, align 8, !tbaa !9
  %43 = icmp ult i64 %42, 65536
  br i1 %43, label %45, label %44

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

45:                                               ; preds = %41
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = load i64, ptr %7, align 8, !tbaa !9
  %48 = trunc i64 %47 to i16
  %49 = call zeroext i1 @run_container_add(ptr noundef %46, i16 noundef zeroext %48)
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = load i64, ptr %7, align 8, !tbaa !9
  %52 = trunc i64 %51 to i16
  %53 = call zeroext i1 @run_container_add(ptr noundef %50, i16 noundef zeroext %52)
  br label %54

54:                                               ; preds = %45
  %55 = load i64, ptr %7, align 8, !tbaa !9
  %56 = add i64 %55, 62
  store i64 %56, ptr %7, align 8, !tbaa !9
  br label %41, !llvm.loop !13

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

58:                                               ; preds = %67, %57
  %59 = load i64, ptr %8, align 8, !tbaa !9
  %60 = icmp ult i64 %59, 65536
  br i1 %60, label %62, label %61

61:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %70

62:                                               ; preds = %58
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = load i64, ptr %8, align 8, !tbaa !9
  %65 = trunc i64 %64 to i16
  %66 = call zeroext i1 @run_container_add(ptr noundef %63, i16 noundef zeroext %65)
  br label %67

67:                                               ; preds = %62
  %68 = load i64, ptr %8, align 8, !tbaa !9
  %69 = add i64 %68, 186
  store i64 %69, ptr %8, align 8, !tbaa !9
  br label %58, !llvm.loop !14

70:                                               ; preds = %61
  %71 = load ptr, ptr %1, align 8, !tbaa !5
  %72 = load ptr, ptr %2, align 8, !tbaa !5
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  call void @run_container_intersection(ptr noundef %71, ptr noundef %72, ptr noundef %73)
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = call zeroext i1 @run_container_equals(ptr noundef %74, ptr noundef %75)
  %77 = zext i1 %76 to i64
  call void @_assert_true(i64 noundef %77, ptr noundef @.str.12, ptr noundef @.str.1, i32 noundef 110)
  %78 = load ptr, ptr %1, align 8, !tbaa !5
  %79 = load ptr, ptr %2, align 8, !tbaa !5
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  call void @run_container_union(ptr noundef %78, ptr noundef %79, ptr noundef %80)
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = call zeroext i1 @run_container_equals(ptr noundef %81, ptr noundef %82)
  %84 = zext i1 %83 to i64
  call void @_assert_true(i64 noundef %84, ptr noundef @.str.13, ptr noundef @.str.1, i32 noundef 113)
  %85 = load ptr, ptr %1, align 8, !tbaa !5
  call void @run_container_free(ptr noundef %85)
  %86 = load ptr, ptr %2, align 8, !tbaa !5
  call void @run_container_free(ptr noundef %86)
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  call void @run_container_free(ptr noundef %87)
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  call void @run_container_free(ptr noundef %88)
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  call void @run_container_free(ptr noundef %89)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #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 void @run_container_intersection(ptr noundef, ptr noundef, ptr noundef) #1

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

declare void @run_container_union(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 = { 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 = { 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 }

!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}


; 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 [93 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
@.str.11 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [30 x i8], align 1

declare ptr @run_container_create() local_unnamed_addr #0

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

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

declare void @run_container_free(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @and_or_test() local_unnamed_addr #1 {
  %1 = tail call ptr @run_container_create() #3
  %2 = tail call ptr @run_container_create() #3
  %3 = tail call ptr @run_container_create() #3
  %4 = tail call ptr @run_container_create() #3
  %5 = tail call ptr @run_container_create() #3
  %6 = ptrtoint ptr %1 to i64
  tail call void @_assert_true(i64 noundef %6, ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 88) #3
  %7 = ptrtoint ptr %2 to i64
  tail call void @_assert_true(i64 noundef %7, ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.1, i32 noundef 89) #3
  %8 = ptrtoint ptr %3 to i64
  tail call void @_assert_true(i64 noundef %8, ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.1, i32 noundef 90) #3
  %9 = ptrtoint ptr %4 to i64
  tail call void @_assert_true(i64 noundef %9, ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.1, i32 noundef 91) #3
  %10 = ptrtoint ptr %5 to i64
  tail call void @_assert_true(i64 noundef %10, ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.1, i32 noundef 92) #3
  br label %11

11:                                               ; preds = %0, %11
  %.03638 = phi i64 [ 0, %0 ], [ %15, %11 ]
  %12 = trunc nuw i64 %.03638 to i16
  %13 = tail call zeroext i1 @run_container_add(ptr noundef %1, i16 noundef zeroext %12) #3
  %14 = tail call zeroext i1 @run_container_add(ptr noundef %3, i16 noundef zeroext %12) #3
  %15 = add nuw nsw i64 %.03638, 3
  %16 = icmp ult i64 %.03638, 65533
  br i1 %16, label %11, label %.preheader37, !llvm.loop !5

.preheader37:                                     ; preds = %11, %.preheader37
  %.03539 = phi i64 [ %20, %.preheader37 ], [ 0, %11 ]
  %17 = trunc nuw i64 %.03539 to i16
  %18 = tail call zeroext i1 @run_container_add(ptr noundef %2, i16 noundef zeroext %17) #3
  %19 = tail call zeroext i1 @run_container_add(ptr noundef %3, i16 noundef zeroext %17) #3
  %20 = add nuw nsw i64 %.03539, 62
  %21 = icmp ult i64 %.03539, 65474
  br i1 %21, label %.preheader37, label %.preheader, !llvm.loop !7

22:                                               ; preds = %.preheader
  tail call void @run_container_intersection(ptr noundef %1, ptr noundef %2, ptr noundef %5) #3
  %23 = tail call zeroext i1 @run_container_equals(ptr noundef %4, ptr noundef %5)
  %24 = zext i1 %23 to i64
  tail call void @_assert_true(i64 noundef %24, ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.1, i32 noundef 110) #3
  tail call void @run_container_union(ptr noundef %1, ptr noundef %2, ptr noundef %5) #3
  %25 = tail call zeroext i1 @run_container_equals(ptr noundef %3, ptr noundef %5)
  %26 = zext i1 %25 to i64
  tail call void @_assert_true(i64 noundef %26, ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.1, i32 noundef 113) #3
  tail call void @run_container_free(ptr noundef %1) #3
  tail call void @run_container_free(ptr noundef %2) #3
  tail call void @run_container_free(ptr noundef %4) #3
  tail call void @run_container_free(ptr noundef %3) #3
  tail call void @run_container_free(ptr noundef %5) #3
  ret void

.preheader:                                       ; preds = %.preheader37, %.preheader
  %.040 = phi i64 [ %29, %.preheader ], [ 0, %.preheader37 ]
  %27 = trunc nuw i64 %.040 to i16
  %28 = tail call zeroext i1 @run_container_add(ptr noundef %4, i16 noundef zeroext %27) #3
  %29 = add nuw nsw i64 %.040, 186
  %30 = icmp ult i64 %.040, 65350
  br i1 %30, label %.preheader, label %22, !llvm.loop !8
}

declare void @run_container_intersection(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

declare void @run_container_union(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 = { 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 = { 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 }

!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