; LLVM IR from jermp/2i_bench :: external/CRoaring/tests (mixed_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 = external hidden unnamed_addr constant [95 x i8], align 1
@__const.run_array_andnot_bug_test.runcontents = external hidden unnamed_addr constant [95 x i32], align 16
@__const.run_array_andnot_bug_test.arraycontents = external hidden unnamed_addr constant [4 x i32], align 16
@.str.46 = external hidden unnamed_addr constant [49 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 @array_container_create() #1

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

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

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

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

declare void @array_container_free(ptr noundef) #1

declare ptr @run_container_create() #1

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

declare void @run_container_free(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @run_array_andnot_bug_test() #3 {
  %1 = alloca [95 x i32], align 16
  %2 = alloca [4 x i32], align 16
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 380, ptr %1) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %1, ptr align 16 @__const.run_array_andnot_bug_test.runcontents, i64 380, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %2) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %2, ptr align 16 @__const.run_array_andnot_bug_test.arraycontents, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %9 = call ptr @run_container_create()
  store ptr %9, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %10 = call ptr @array_container_create()
  store ptr %10, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %11 = getelementptr inbounds [95 x i32], ptr %1, i64 0, i64 0
  store ptr %11, ptr %5, align 8, !tbaa !5
  br label %12

12:                                               ; preds = %24, %0
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = load i32, ptr %13, align 4, !tbaa !9
  %15 = icmp ne i32 %14, -1
  br i1 %15, label %17, label %16

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

17:                                               ; preds = %12
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = load i32, ptr %19, align 4, !tbaa !9
  %21 = srem i32 %20, 65536
  %22 = trunc i32 %21 to i16
  %23 = call zeroext i1 @run_container_add(ptr noundef %18, i16 noundef zeroext %22)
  br label %24

24:                                               ; preds = %17
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds i32, ptr %25, i32 1
  store ptr %26, ptr %5, align 8, !tbaa !5
  br label %12, !llvm.loop !11

27:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %28 = getelementptr inbounds [4 x i32], ptr %2, i64 0, i64 0
  store ptr %28, ptr %6, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %41, %27
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = load i32, ptr %30, align 4, !tbaa !9
  %32 = icmp ne i32 %31, -1
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %44

34:                                               ; preds = %29
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = load i32, ptr %36, align 4, !tbaa !9
  %38 = srem i32 %37, 65536
  %39 = trunc i32 %38 to i16
  %40 = call zeroext i1 @array_container_add(ptr noundef %35, i16 noundef zeroext %39)
  br label %41

41:                                               ; preds = %34
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds i32, ptr %42, i32 1
  store ptr %43, ptr %6, align 8, !tbaa !5
  br label %29, !llvm.loop !13

44:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store ptr null, ptr %8, align 8, !tbaa !5
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = call i32 @run_array_container_andnot(ptr noundef %45, ptr noundef %46, ptr noundef %8)
  store i32 %47, ptr %7, align 4, !tbaa !9
  %48 = load i32, ptr %7, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  call void @_assert_int_equal(i64 noundef 2, i64 noundef %49, ptr noundef @.str, i32 noundef 1359)
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = call zeroext i1 @array_container_contains(ptr noundef %50, i16 noundef zeroext 114)
  %52 = xor i1 %51, true
  %53 = zext i1 %52 to i32
  %54 = sext i32 %53 to i64
  call void @_assert_true(i64 noundef %54, ptr noundef @.str.46, ptr noundef @.str, i32 noundef 1360)
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  call void @run_container_free(ptr noundef %55)
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  call void @array_container_free(ptr noundef %56)
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  call void @array_container_free(ptr noundef %57)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 380, ptr %1) #5
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !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 = external hidden unnamed_addr constant [95 x i8], align 1
@__const.run_array_andnot_bug_test.runcontents = external hidden unnamed_addr constant [95 x i32], align 16
@__const.run_array_andnot_bug_test.arraycontents = external hidden unnamed_addr constant [4 x i32], align 16
@.str.46 = external hidden unnamed_addr constant [49 x i8], align 1

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

declare ptr @array_container_create() local_unnamed_addr #1

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

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

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

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

declare void @array_container_free(ptr noundef) local_unnamed_addr #1

declare ptr @run_container_create() local_unnamed_addr #1

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

declare void @run_container_free(ptr noundef) local_unnamed_addr #1

declare i32 @run_array_container_andnot(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @run_array_andnot_bug_test() local_unnamed_addr #3 {
  %1 = alloca ptr, align 8
  %2 = tail call ptr @run_container_create() #4
  %3 = tail call ptr @array_container_create() #4
  %4 = load i32, ptr @__const.run_array_andnot_bug_test.runcontents, align 16, !tbaa !5
  %.not16 = icmp eq i32 %4, -1
  br i1 %.not16, label %.preheader, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph, %0
  %5 = load i32, ptr @__const.run_array_andnot_bug_test.arraycontents, align 16, !tbaa !5
  %.not1518 = icmp eq i32 %5, -1
  br i1 %.not1518, label %._crit_edge, label %.lr.ph20

.lr.ph:                                           ; preds = %0, %.lr.ph
  %6 = phi i32 [ %10, %.lr.ph ], [ %4, %0 ]
  %.017 = phi ptr [ %9, %.lr.ph ], [ @__const.run_array_andnot_bug_test.runcontents, %0 ]
  %7 = trunc i32 %6 to i16
  %8 = tail call zeroext i1 @run_container_add(ptr noundef %2, i16 noundef zeroext %7) #4
  %9 = getelementptr inbounds i8, ptr %.017, i64 4
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %.not = icmp eq i32 %10, -1
  br i1 %.not, label %.preheader, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph20, %.preheader
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  store ptr null, ptr %1, align 8, !tbaa !11
  %11 = call i32 @run_array_container_andnot(ptr noundef %2, ptr noundef %3, ptr noundef nonnull %1) #4
  %12 = sext i32 %11 to i64
  call void @_assert_int_equal(i64 noundef 2, i64 noundef %12, ptr noundef nonnull @.str, i32 noundef 1359) #4
  %13 = load ptr, ptr %1, align 8, !tbaa !11
  %14 = call zeroext i1 @array_container_contains(ptr noundef %13, i16 noundef zeroext 114)
  %15 = xor i1 %14, true
  %16 = zext i1 %15 to i64
  call void @_assert_true(i64 noundef %16, ptr noundef nonnull @.str.46, ptr noundef nonnull @.str, i32 noundef 1360) #4
  call void @run_container_free(ptr noundef %2) #4
  call void @array_container_free(ptr noundef %3) #4
  %17 = load ptr, ptr %1, align 8, !tbaa !11
  call void @array_container_free(ptr noundef %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret void

.lr.ph20:                                         ; preds = %.preheader, %.lr.ph20
  %18 = phi i32 [ %22, %.lr.ph20 ], [ %5, %.preheader ]
  %.01219 = phi ptr [ %21, %.lr.ph20 ], [ @__const.run_array_andnot_bug_test.arraycontents, %.preheader ]
  %19 = trunc i32 %18 to i16
  %20 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext %19)
  %21 = getelementptr inbounds i8, ptr %.01219, i64 4
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %.not15 = icmp eq i32 %22, -1
  br i1 %.not15, label %._crit_edge, label %.lr.ph20, !llvm.loop !13
}

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

attributes #0 = { mustprogress 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !10}


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