; LLVM IR from jermp/2i_bench :: external/CRoaring/tests (container_comparison_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 [100 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [58 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: inlinehint nounwind uwtable
declare hidden ptr @container_create(i8 noundef zeroext) #1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @container_checked_add(ptr noundef, i16 noundef zeroext, i8 noundef zeroext) #1

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

declare void @container_free(ptr noundef, i8 noundef zeroext) #2

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

20:                                               ; preds = %41, %2
  %21 = load i32, ptr %7, align 4, !tbaa !10
  %22 = icmp slt i32 %21, 100
  br i1 %22, label %24, label %23

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

24:                                               ; preds = %20
  %25 = load ptr, ptr %5, align 8, !tbaa !8
  %26 = load i32, ptr %7, align 4, !tbaa !10
  %27 = mul nsw i32 %26, 11
  %28 = trunc i32 %27 to i16
  %29 = load i8, ptr %3, align 1, !tbaa !5
  call void @container_checked_add(ptr noundef %25, i16 noundef zeroext %28, i8 noundef zeroext %29)
  %30 = load ptr, ptr %6, align 8, !tbaa !8
  %31 = load i32, ptr %7, align 4, !tbaa !10
  %32 = mul nsw i32 %31, 11
  %33 = trunc i32 %32 to i16
  %34 = load i8, ptr %4, align 1, !tbaa !5
  call void @container_checked_add(ptr noundef %30, i16 noundef zeroext %33, i8 noundef zeroext %34)
  %35 = load ptr, ptr %5, align 8, !tbaa !8
  %36 = load i8, ptr %3, align 1, !tbaa !5
  %37 = load ptr, ptr %6, align 8, !tbaa !8
  %38 = load i8, ptr %4, align 1, !tbaa !5
  %39 = call zeroext i1 @container_is_subset(ptr noundef %35, i8 noundef zeroext %36, ptr noundef %37, i8 noundef zeroext %38)
  %40 = zext i1 %39 to i64
  call void @_assert_true(i64 noundef %40, ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 162)
  br label %41

41:                                               ; preds = %24
  %42 = load i32, ptr %7, align 4, !tbaa !10
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %7, align 4, !tbaa !10
  br label %20, !llvm.loop !12

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

45:                                               ; preds = %61, %44
  %46 = load i32, ptr %8, align 4, !tbaa !10
  %47 = icmp slt i32 %46, 100
  br i1 %47, label %49, label %48

48:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %64

49:                                               ; preds = %45
  %50 = load ptr, ptr %6, align 8, !tbaa !8
  %51 = load i32, ptr %8, align 4, !tbaa !10
  %52 = mul nsw i32 %51, 7
  %53 = trunc i32 %52 to i16
  %54 = load i8, ptr %4, align 1, !tbaa !5
  call void @container_checked_add(ptr noundef %50, i16 noundef zeroext %53, i8 noundef zeroext %54)
  %55 = load ptr, ptr %5, align 8, !tbaa !8
  %56 = load i8, ptr %3, align 1, !tbaa !5
  %57 = load ptr, ptr %6, align 8, !tbaa !8
  %58 = load i8, ptr %4, align 1, !tbaa !5
  %59 = call zeroext i1 @container_is_subset(ptr noundef %55, i8 noundef zeroext %56, ptr noundef %57, i8 noundef zeroext %58)
  %60 = zext i1 %59 to i64
  call void @_assert_true(i64 noundef %60, ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 166)
  br label %61

61:                                               ; preds = %49
  %62 = load i32, ptr %8, align 4, !tbaa !10
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %8, align 4, !tbaa !10
  br label %45, !llvm.loop !14

64:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !10
  br label %65

65:                                               ; preds = %103, %64
  %66 = load i32, ptr %9, align 4, !tbaa !10
  %67 = icmp slt i32 %66, 100
  br i1 %67, label %69, label %68

68:                                               ; preds = %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %106

69:                                               ; preds = %65
  %70 = load i32, ptr %9, align 4, !tbaa !10
  %71 = srem i32 %70, 7
  %72 = icmp eq i32 %71, 0
  br i1 %72, label %77, label %73

73:                                               ; preds = %69
  %74 = load i32, ptr %9, align 4, !tbaa !10
  %75 = srem i32 %74, 11
  %76 = icmp eq i32 %75, 0
  br i1 %76, label %77, label %78

77:                                               ; preds = %73, %69
  br label %103

78:                                               ; preds = %73
  %79 = load ptr, ptr %5, align 8, !tbaa !8
  %80 = load i32, ptr %9, align 4, !tbaa !10
  %81 = mul nsw i32 %80, 5
  %82 = trunc i32 %81 to i16
  %83 = load i8, ptr %3, align 1, !tbaa !5
  call void @container_checked_add(ptr noundef %79, i16 noundef zeroext %82, i8 noundef zeroext %83)
  %84 = load ptr, ptr %5, align 8, !tbaa !8
  %85 = load i8, ptr %3, align 1, !tbaa !5
  %86 = load ptr, ptr %6, align 8, !tbaa !8
  %87 = load i8, ptr %4, align 1, !tbaa !5
  %88 = call zeroext i1 @container_is_subset(ptr noundef %84, i8 noundef zeroext %85, ptr noundef %86, i8 noundef zeroext %87)
  %89 = xor i1 %88, true
  %90 = zext i1 %89 to i32
  %91 = sext i32 %90 to i64
  call void @_assert_true(i64 noundef %91, ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 171)
  %92 = load ptr, ptr %6, align 8, !tbaa !8
  %93 = load i32, ptr %9, align 4, !tbaa !10
  %94 = mul nsw i32 %93, 5
  %95 = trunc i32 %94 to i16
  %96 = load i8, ptr %4, align 1, !tbaa !5
  call void @container_checked_add(ptr noundef %92, i16 noundef zeroext %95, i8 noundef zeroext %96)
  %97 = load ptr, ptr %5, align 8, !tbaa !8
  %98 = load i8, ptr %3, align 1, !tbaa !5
  %99 = load ptr, ptr %6, align 8, !tbaa !8
  %100 = load i8, ptr %4, align 1, !tbaa !5
  %101 = call zeroext i1 @container_is_subset(ptr noundef %97, i8 noundef zeroext %98, ptr noundef %99, i8 noundef zeroext %100)
  %102 = zext i1 %101 to i64
  call void @_assert_true(i64 noundef %102, ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 173)
  br label %103

103:                                              ; preds = %78, %77
  %104 = load i32, ptr %9, align 4, !tbaa !10
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %9, align 4, !tbaa !10
  br label %65, !llvm.loop !15

106:                                              ; preds = %68
  %107 = load ptr, ptr %5, align 8, !tbaa !8
  %108 = load i8, ptr %3, align 1, !tbaa !5
  call void @container_free(ptr noundef %107, i8 noundef zeroext %108)
  %109 = load ptr, ptr %6, align 8, !tbaa !8
  %110 = load i8, ptr %4, align 1, !tbaa !5
  call void @container_free(ptr noundef %109, i8 noundef zeroext %110)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret void
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @container_is_subset(ptr noundef, i8 noundef zeroext, ptr noundef, i8 noundef zeroext) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}


; 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 [100 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [58 x i8], align 1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @container_create(i8 noundef zeroext) local_unnamed_addr #0

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @container_checked_add(ptr noundef, i16 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #0

declare void @container_free(ptr noundef, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @generic_subset_test(i8 noundef zeroext %0, i8 noundef zeroext %1) local_unnamed_addr #2 {
  %3 = tail call ptr @container_create(i8 noundef zeroext %0)
  %4 = tail call ptr @container_create(i8 noundef zeroext %1)
  %5 = tail call zeroext i1 @container_is_subset(ptr noundef %3, i8 noundef zeroext %0, ptr noundef %4, i8 noundef zeroext %1)
  %6 = zext i1 %5 to i64
  tail call void @_assert_true(i64 noundef %6, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 158) #3
  br label %7

7:                                                ; preds = %2, %7
  %.04954 = phi i32 [ 0, %2 ], [ %12, %7 ]
  %8 = trunc nuw i32 %.04954 to i16
  %9 = mul nuw nsw i16 %8, 11
  tail call void @container_checked_add(ptr noundef %3, i16 noundef zeroext %9, i8 noundef zeroext %0)
  tail call void @container_checked_add(ptr noundef %4, i16 noundef zeroext %9, i8 noundef zeroext %1)
  %10 = tail call zeroext i1 @container_is_subset(ptr noundef %3, i8 noundef zeroext %0, ptr noundef %4, i8 noundef zeroext %1)
  %11 = zext i1 %10 to i64
  tail call void @_assert_true(i64 noundef %11, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 162) #3
  %12 = add nuw nsw i32 %.04954, 1
  %exitcond.not = icmp eq i32 %12, 100
  br i1 %exitcond.not, label %.preheader53, label %7, !llvm.loop !5

.preheader53:                                     ; preds = %7, %.preheader53
  %.04855 = phi i32 [ %17, %.preheader53 ], [ 0, %7 ]
  %13 = trunc nuw i32 %.04855 to i16
  %14 = mul nuw nsw i16 %13, 7
  tail call void @container_checked_add(ptr noundef %4, i16 noundef zeroext %14, i8 noundef zeroext %1)
  %15 = tail call zeroext i1 @container_is_subset(ptr noundef %3, i8 noundef zeroext %0, ptr noundef %4, i8 noundef zeroext %1)
  %16 = zext i1 %15 to i64
  tail call void @_assert_true(i64 noundef %16, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 166) #3
  %17 = add nuw nsw i32 %.04855, 1
  %exitcond57.not = icmp eq i32 %17, 100
  br i1 %exitcond57.not, label %.preheader, label %.preheader53, !llvm.loop !7

18:                                               ; preds = %31
  tail call void @container_free(ptr noundef %3, i8 noundef zeroext %0) #3
  tail call void @container_free(ptr noundef %4, i8 noundef zeroext %1) #3
  ret void

.preheader:                                       ; preds = %.preheader53, %31
  %.056 = phi i32 [ %32, %31 ], [ 0, %.preheader53 ]
  %.lhs.trunc = trunc nuw i32 %.056 to i8
  %19 = urem i8 %.lhs.trunc, 7
  %20 = icmp eq i8 %19, 0
  %21 = urem i8 %.lhs.trunc, 11
  %22 = icmp eq i8 %21, 0
  %or.cond = or i1 %20, %22
  br i1 %or.cond, label %31, label %23

23:                                               ; preds = %.preheader
  %24 = trunc nuw i32 %.056 to i16
  %25 = mul nuw nsw i16 %24, 5
  tail call void @container_checked_add(ptr noundef %3, i16 noundef zeroext %25, i8 noundef zeroext %0)
  %26 = tail call zeroext i1 @container_is_subset(ptr noundef %3, i8 noundef zeroext %0, ptr noundef %4, i8 noundef zeroext %1)
  %27 = xor i1 %26, true
  %28 = zext i1 %27 to i64
  tail call void @_assert_true(i64 noundef %28, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 171) #3
  tail call void @container_checked_add(ptr noundef %4, i16 noundef zeroext %25, i8 noundef zeroext %1)
  %29 = tail call zeroext i1 @container_is_subset(ptr noundef %3, i8 noundef zeroext %0, ptr noundef %4, i8 noundef zeroext %1)
  %30 = zext i1 %29 to i64
  tail call void @_assert_true(i64 noundef %30, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 173) #3
  br label %31

31:                                               ; preds = %.preheader, %23
  %32 = add nuw nsw i32 %.056, 1
  %exitcond58.not = icmp eq i32 %32, 100
  br i1 %exitcond58.not, label %18, label %.preheader, !llvm.loop !8
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @container_is_subset(ptr noundef, i8 noundef zeroext, ptr noundef, i8 noundef zeroext) local_unnamed_addr #0

attributes #0 = { 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 #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 = { 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: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass