; LLVM IR from jermp/2i_bench :: external/CRoaring/tests (toplevel_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.2 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.30 = 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 void @roaring_bitmap_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

declare ptr @roaring_bitmap_create() #1

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

declare zeroext i1 @roaring_bitmap_is_empty(ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare void @roaring_bitmap_set_copy_on_write(ptr noundef, i1 noundef zeroext) #2

declare void @roaring_bitmap_add(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @leaks_with_empty(i1 noundef zeroext %0) #3 {
  %2 = alloca i8, align 1
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = zext i1 %0 to i8
  store i8 %10, ptr %2, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %11 = call ptr @roaring_bitmap_create()
  store ptr %11, ptr %3, align 8, !tbaa !9
  %12 = load ptr, ptr %3, align 8, !tbaa !9
  %13 = load i8, ptr %2, align 1, !tbaa !5, !range !11, !noundef !12
  %14 = trunc i8 %13 to i1
  call void @roaring_bitmap_set_copy_on_write(ptr noundef %12, i1 noundef zeroext %14)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %15 = call ptr @roaring_bitmap_create()
  store ptr %15, ptr %4, align 8, !tbaa !9
  %16 = load ptr, ptr %4, align 8, !tbaa !9
  %17 = load i8, ptr %2, align 1, !tbaa !5, !range !11, !noundef !12
  %18 = trunc i8 %17 to i1
  call void @roaring_bitmap_set_copy_on_write(ptr noundef %16, i1 noundef zeroext %18)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 100, ptr %5, align 4, !tbaa !13
  br label %19

19:                                               ; preds = %26, %1
  %20 = load i32, ptr %5, align 4, !tbaa !13
  %21 = icmp ult i32 %20, 70000
  br i1 %21, label %23, label %22

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

23:                                               ; preds = %19
  %24 = load ptr, ptr %4, align 8, !tbaa !9
  %25 = load i32, ptr %5, align 4, !tbaa !13
  call void @roaring_bitmap_add(ptr noundef %24, i32 noundef %25)
  br label %26

26:                                               ; preds = %23
  %27 = load i32, ptr %5, align 4, !tbaa !13
  %28 = add i32 %27, 3
  store i32 %28, ptr %5, align 4, !tbaa !13
  br label %19, !llvm.loop !15

29:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %30 = load ptr, ptr %4, align 8, !tbaa !9
  %31 = load ptr, ptr %3, align 8, !tbaa !9
  %32 = call ptr @roaring_bitmap_or(ptr noundef %30, ptr noundef %31)
  store ptr %32, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %33 = load ptr, ptr %4, align 8, !tbaa !9
  %34 = load ptr, ptr %3, align 8, !tbaa !9
  %35 = call ptr @roaring_bitmap_xor(ptr noundef %33, ptr noundef %34)
  store ptr %35, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %36 = load ptr, ptr %4, align 8, !tbaa !9
  %37 = load ptr, ptr %3, align 8, !tbaa !9
  %38 = call ptr @roaring_bitmap_and(ptr noundef %36, ptr noundef %37)
  store ptr %38, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %39 = load ptr, ptr %4, align 8, !tbaa !9
  %40 = load ptr, ptr %3, align 8, !tbaa !9
  %41 = call ptr @roaring_bitmap_andnot(ptr noundef %39, ptr noundef %40)
  store ptr %41, ptr %9, align 8, !tbaa !9
  %42 = load ptr, ptr %3, align 8, !tbaa !9
  call void @roaring_bitmap_free(ptr noundef %42)
  %43 = load ptr, ptr %6, align 8, !tbaa !9
  %44 = load ptr, ptr %4, align 8, !tbaa !9
  %45 = call zeroext i1 @roaring_bitmap_equals(ptr noundef %43, ptr noundef %44)
  %46 = zext i1 %45 to i64
  call void @_assert_true(i64 noundef %46, ptr noundef @.str.27, ptr noundef @.str.2, i32 noundef 314)
  %47 = load ptr, ptr %6, align 8, !tbaa !9
  call void @roaring_bitmap_free(ptr noundef %47)
  %48 = load ptr, ptr %7, align 8, !tbaa !9
  %49 = load ptr, ptr %4, align 8, !tbaa !9
  %50 = call zeroext i1 @roaring_bitmap_equals(ptr noundef %48, ptr noundef %49)
  %51 = zext i1 %50 to i64
  call void @_assert_true(i64 noundef %51, ptr noundef @.str.28, ptr noundef @.str.2, i32 noundef 316)
  %52 = load ptr, ptr %7, align 8, !tbaa !9
  call void @roaring_bitmap_free(ptr noundef %52)
  %53 = load ptr, ptr %9, align 8, !tbaa !9
  %54 = load ptr, ptr %4, align 8, !tbaa !9
  %55 = call zeroext i1 @roaring_bitmap_equals(ptr noundef %53, ptr noundef %54)
  %56 = zext i1 %55 to i64
  call void @_assert_true(i64 noundef %56, ptr noundef @.str.29, ptr noundef @.str.2, i32 noundef 318)
  %57 = load ptr, ptr %9, align 8, !tbaa !9
  call void @roaring_bitmap_free(ptr noundef %57)
  %58 = load ptr, ptr %4, align 8, !tbaa !9
  call void @roaring_bitmap_free(ptr noundef %58)
  %59 = load ptr, ptr %8, align 8, !tbaa !9
  %60 = call zeroext i1 @roaring_bitmap_is_empty(ptr noundef %59)
  %61 = zext i1 %60 to i64
  call void @_assert_true(i64 noundef %61, ptr noundef @.str.30, ptr noundef @.str.2, i32 noundef 321)
  %62 = load ptr, ptr %8, align 8, !tbaa !9
  call void @roaring_bitmap_free(ptr noundef %62)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret void
}

declare ptr @roaring_bitmap_or(ptr noundef, ptr noundef) #1

declare ptr @roaring_bitmap_xor(ptr noundef, ptr noundef) #1

declare ptr @roaring_bitmap_and(ptr noundef, ptr noundef) #1

declare ptr @roaring_bitmap_andnot(ptr noundef, ptr noundef) #1

declare zeroext i1 @roaring_bitmap_equals(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 = !{!"_Bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; 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.2 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [30 x i8], align 1

declare void @roaring_bitmap_free(ptr noundef) local_unnamed_addr #0

declare ptr @roaring_bitmap_create() local_unnamed_addr #0

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

declare zeroext i1 @roaring_bitmap_is_empty(ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare void @roaring_bitmap_set_copy_on_write(ptr noundef, i1 noundef zeroext) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @leaks_with_empty(i1 noundef zeroext %0) local_unnamed_addr #2 {
  %2 = tail call ptr @roaring_bitmap_create() #3
  tail call void @roaring_bitmap_set_copy_on_write(ptr noundef %2, i1 noundef zeroext %0)
  %3 = tail call ptr @roaring_bitmap_create() #3
  tail call void @roaring_bitmap_set_copy_on_write(ptr noundef %3, i1 noundef zeroext %0)
  br label %17

4:                                                ; preds = %17
  %5 = tail call ptr @roaring_bitmap_or(ptr noundef %3, ptr noundef %2) #3
  %6 = tail call ptr @roaring_bitmap_xor(ptr noundef %3, ptr noundef %2) #3
  %7 = tail call ptr @roaring_bitmap_and(ptr noundef %3, ptr noundef %2) #3
  %8 = tail call ptr @roaring_bitmap_andnot(ptr noundef %3, ptr noundef %2) #3
  tail call void @roaring_bitmap_free(ptr noundef %2) #3
  %9 = tail call zeroext i1 @roaring_bitmap_equals(ptr noundef %5, ptr noundef %3) #3
  %10 = zext i1 %9 to i64
  tail call void @_assert_true(i64 noundef %10, ptr noundef nonnull @.str.27, ptr noundef nonnull @.str.2, i32 noundef 314) #3
  tail call void @roaring_bitmap_free(ptr noundef %5) #3
  %11 = tail call zeroext i1 @roaring_bitmap_equals(ptr noundef %6, ptr noundef %3) #3
  %12 = zext i1 %11 to i64
  tail call void @_assert_true(i64 noundef %12, ptr noundef nonnull @.str.28, ptr noundef nonnull @.str.2, i32 noundef 316) #3
  tail call void @roaring_bitmap_free(ptr noundef %6) #3
  %13 = tail call zeroext i1 @roaring_bitmap_equals(ptr noundef %8, ptr noundef %3) #3
  %14 = zext i1 %13 to i64
  tail call void @_assert_true(i64 noundef %14, ptr noundef nonnull @.str.29, ptr noundef nonnull @.str.2, i32 noundef 318) #3
  tail call void @roaring_bitmap_free(ptr noundef %8) #3
  tail call void @roaring_bitmap_free(ptr noundef %3) #3
  %15 = tail call zeroext i1 @roaring_bitmap_is_empty(ptr noundef %7) #3
  %16 = zext i1 %15 to i64
  tail call void @_assert_true(i64 noundef %16, ptr noundef nonnull @.str.30, ptr noundef nonnull @.str.2, i32 noundef 321) #3
  tail call void @roaring_bitmap_free(ptr noundef %7) #3
  ret void

17:                                               ; preds = %1, %17
  %.028 = phi i32 [ 100, %1 ], [ %18, %17 ]
  tail call void @roaring_bitmap_add(ptr noundef %3, i32 noundef %.028) #3
  %18 = add nuw nsw i32 %.028, 3
  %19 = icmp ult i32 %.028, 69997
  br i1 %19, label %17, label %4, !llvm.loop !5
}

declare ptr @roaring_bitmap_or(ptr noundef, ptr noundef) local_unnamed_addr #0

declare ptr @roaring_bitmap_xor(ptr noundef, ptr noundef) local_unnamed_addr #0

declare ptr @roaring_bitmap_and(ptr noundef, ptr noundef) local_unnamed_addr #0

declare ptr @roaring_bitmap_andnot(ptr noundef, ptr noundef) local_unnamed_addr #0

declare zeroext i1 @roaring_bitmap_equals(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"}


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