; LLVM IR from jermp/2i_bench :: external/CRoaring/tests (array_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 [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [57 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

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

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

declare void @array_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

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

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

12:                                               ; preds = %24, %0
  %13 = load i16, ptr %3, align 2, !tbaa !9
  %14 = zext i16 %13 to i32
  %15 = load i16, ptr %2, align 2, !tbaa !9
  %16 = zext i16 %15 to i32
  %17 = add nsw i32 %16, 200
  %18 = icmp slt i32 %14, %17
  br i1 %18, label %20, label %19

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

20:                                               ; preds = %12
  %21 = load ptr, ptr %1, align 8, !tbaa !5
  %22 = load i16, ptr %3, align 2, !tbaa !9
  %23 = call zeroext i1 @array_container_add(ptr noundef %21, i16 noundef zeroext %22)
  br label %24

24:                                               ; preds = %20
  %25 = load i16, ptr %3, align 2, !tbaa !9
  %26 = zext i16 %25 to i32
  %27 = add nsw i32 %26, 5
  %28 = trunc i32 %27 to i16
  store i16 %28, ptr %3, align 2, !tbaa !9
  br label %12, !llvm.loop !11

29:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %7) #4
  %30 = load i16, ptr %2, align 2, !tbaa !9
  store i16 %30, ptr %7, align 2, !tbaa !9
  br label %31

31:                                               ; preds = %51, %29
  %32 = load i16, ptr %7, align 2, !tbaa !9
  %33 = zext i16 %32 to i32
  %34 = load i16, ptr %2, align 2, !tbaa !9
  %35 = zext i16 %34 to i32
  %36 = add nsw i32 %35, 200
  %37 = icmp slt i32 %33, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 2, ptr %7) #4
  br label %56

39:                                               ; preds = %31
  store i32 12, ptr %6, align 4, !tbaa !13
  %40 = load ptr, ptr %1, align 8, !tbaa !5
  %41 = load i32, ptr %4, align 4, !tbaa !13
  %42 = add i32 %41, 12
  %43 = call zeroext i1 @array_container_select(ptr noundef %40, ptr noundef %6, i32 noundef %42, ptr noundef %5)
  %44 = zext i1 %43 to i64
  call void @_assert_true(i64 noundef %44, ptr noundef @.str.17, ptr noundef @.str.1, i32 noundef 167)
  %45 = load i32, ptr %5, align 4, !tbaa !13
  %46 = zext i32 %45 to i64
  %47 = load i16, ptr %7, align 2, !tbaa !9
  %48 = zext i16 %47 to i64
  call void @_assert_int_equal(i64 noundef %46, i64 noundef %48, ptr noundef @.str.1, i32 noundef 168)
  %49 = load i32, ptr %4, align 4, !tbaa !13
  %50 = add i32 %49, 1
  store i32 %50, ptr %4, align 4, !tbaa !13
  br label %51

51:                                               ; preds = %39
  %52 = load i16, ptr %7, align 2, !tbaa !9
  %53 = zext i16 %52 to i32
  %54 = add nsw i32 %53, 5
  %55 = trunc i32 %54 to i16
  store i16 %55, ptr %7, align 2, !tbaa !9
  br label %31, !llvm.loop !15

56:                                               ; preds = %38
  store i32 12, ptr %6, align 4, !tbaa !13
  %57 = load ptr, ptr %1, align 8, !tbaa !5
  %58 = load i32, ptr %4, align 4, !tbaa !13
  %59 = add i32 %58, 12
  %60 = call zeroext i1 @array_container_select(ptr noundef %57, ptr noundef %6, i32 noundef %59, ptr noundef %5)
  %61 = xor i1 %60, true
  %62 = zext i1 %61 to i32
  %63 = sext i32 %62 to i64
  call void @_assert_true(i64 noundef %63, ptr noundef @.str.17, ptr noundef @.str.1, i32 noundef 172)
  %64 = load i32, ptr %6, align 4, !tbaa !13
  %65 = zext i32 %64 to i64
  %66 = load i32, ptr %4, align 4, !tbaa !13
  %67 = add i32 %66, 12
  %68 = zext i32 %67 to i64
  call void @_assert_int_equal(i64 noundef %65, i64 noundef %68, ptr noundef @.str.1, i32 noundef 173)
  %69 = load ptr, ptr %1, align 8, !tbaa !5
  call void @array_container_free(ptr noundef %69)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret void
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @array_container_select(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #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 = { 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 = !{!"short", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!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 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [57 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

declare void @_assert_true(i64 noundef, ptr noundef, ptr noundef, i32 noundef) 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

declare void @array_container_free(ptr noundef) local_unnamed_addr #1

; 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

; Function Attrs: nounwind uwtable
define dso_local void @select_test() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call ptr @array_container_create() #4
  %4 = ptrtoint ptr %3 to i64
  tail call void @_assert_true(i64 noundef %4, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 157) #4
  %5 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 27)
  %6 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 32)
  %7 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 37)
  %8 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 42)
  %9 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 47)
  %10 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 52)
  %11 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 57)
  %12 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 62)
  %13 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 67)
  %14 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 72)
  %15 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 77)
  %16 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 82)
  %17 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 87)
  %18 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 92)
  %19 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 97)
  %20 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 102)
  %21 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 107)
  %22 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 112)
  %23 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 117)
  %24 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 122)
  %25 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 127)
  %26 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 132)
  %27 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 137)
  %28 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 142)
  %29 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 147)
  %30 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 152)
  %31 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 157)
  %32 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 162)
  %33 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 167)
  %34 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 172)
  %35 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 177)
  %36 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 182)
  %37 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 187)
  %38 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 192)
  %39 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 197)
  %40 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 202)
  %41 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 207)
  %42 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 212)
  %43 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 217)
  %44 = tail call zeroext i1 @array_container_add(ptr noundef %3, i16 noundef zeroext 222)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  br label %51

45:                                               ; preds = %51
  store i32 12, ptr %2, align 4, !tbaa !5
  %46 = call zeroext i1 @array_container_select(ptr noundef %3, ptr noundef nonnull %2, i32 noundef 52, ptr noundef nonnull %1)
  %47 = xor i1 %46, true
  %48 = zext i1 %47 to i64
  call void @_assert_true(i64 noundef %48, ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.1, i32 noundef 172) #4
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = zext i32 %49 to i64
  call void @_assert_int_equal(i64 noundef %50, i64 noundef 52, ptr noundef nonnull @.str.1, i32 noundef 173) #4
  call void @array_container_free(ptr noundef %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  ret void

51:                                               ; preds = %0, %51
  %indvars.iv = phi i64 [ 27, %0 ], [ %indvars.iv.next, %51 ]
  %.01824 = phi i32 [ 0, %0 ], [ %57, %51 ]
  store i32 12, ptr %2, align 4, !tbaa !5
  %52 = add nuw nsw i32 %.01824, 12
  %53 = call zeroext i1 @array_container_select(ptr noundef %3, ptr noundef nonnull %2, i32 noundef %52, ptr noundef nonnull %1)
  %54 = zext i1 %53 to i64
  call void @_assert_true(i64 noundef %54, ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.1, i32 noundef 167) #4
  %55 = load i32, ptr %1, align 4, !tbaa !5
  %56 = zext i32 %55 to i64
  call void @_assert_int_equal(i64 noundef %56, i64 noundef %indvars.iv, ptr noundef nonnull @.str.1, i32 noundef 168) #4
  %57 = add nuw nsw i32 %.01824, 1
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 5
  %exitcond.not = icmp eq i32 %57, 40
  br i1 %exitcond.not, label %45, label %51, !llvm.loop !9
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @array_container_select(ptr noundef, ptr noundef, i32 noundef, ptr noundef) 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"}


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