; LLVM IR from seppo0010/rlite :: src (type_set)

; 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"

; Function Attrs: nounwind uwtable
declare dso_local i32 @rl_set_get_objects(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) #0

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

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

declare i32 @sha1(ptr noundef, i64 noundef, ptr noundef) #2

declare i32 @rl_btree_find_score(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_srem(ptr noundef %0, ptr noundef %1, i64 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) #0 {
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i64, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i32, align 4
  %23 = alloca [20 x i8], align 16
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store i64 %2, ptr %10, align 8, !tbaa !9
  store i32 %3, ptr %11, align 4, !tbaa !11
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  store ptr %6, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  store i64 0, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  store i32 0, ptr %22, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 20, ptr %23) #3
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  %26 = load i64, ptr %10, align 8, !tbaa !9
  %27 = call i32 @rl_set_get_objects(ptr noundef %24, ptr noundef %25, i64 noundef %26, ptr noundef %16, ptr noundef %17, i32 noundef 1, i32 noundef 0)
  store i32 %27, ptr %15, align 4, !tbaa !11
  %28 = load i32, ptr %15, align 4, !tbaa !11
  %29 = icmp ne i32 0, %28
  br i1 %29, label %30, label %31

30:                                               ; preds = %7
  br label %105

31:                                               ; preds = %7
  store i64 0, ptr %20, align 8, !tbaa !9
  br label %32

32:                                               ; preds = %83, %31
  %33 = load i64, ptr %20, align 8, !tbaa !9
  %34 = load i32, ptr %11, align 4, !tbaa !11
  %35 = sext i32 %34 to i64
  %36 = icmp slt i64 %33, %35
  br i1 %36, label %37, label %86

37:                                               ; preds = %32
  %38 = load ptr, ptr %12, align 8, !tbaa !5
  %39 = load i64, ptr %20, align 8, !tbaa !9
  %40 = getelementptr inbounds ptr, ptr %38, i64 %39
  %41 = load ptr, ptr %40, align 8, !tbaa !5
  %42 = load ptr, ptr %13, align 8, !tbaa !5
  %43 = load i64, ptr %20, align 8, !tbaa !9
  %44 = getelementptr inbounds i64, ptr %42, i64 %43
  %45 = load i64, ptr %44, align 8, !tbaa !9
  %46 = getelementptr inbounds [20 x i8], ptr %23, i64 0, i64 0
  %47 = call i32 @sha1(ptr noundef %41, i64 noundef %45, ptr noundef %46)
  store i32 %47, ptr %15, align 4, !tbaa !11
  %48 = load i32, ptr %15, align 4, !tbaa !11
  %49 = icmp ne i32 0, %48
  br i1 %49, label %50, label %51

50:                                               ; preds = %37
  br label %105

51:                                               ; preds = %37
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = load ptr, ptr %17, align 8, !tbaa !5
  %54 = getelementptr inbounds [20 x i8], ptr %23, i64 0, i64 0
  %55 = call i32 @rl_btree_find_score(ptr noundef %52, ptr noundef %53, ptr noundef %54, ptr noundef %19, ptr noundef null, ptr noundef null)
  store i32 %55, ptr %15, align 4, !tbaa !11
  %56 = load i32, ptr %15, align 4, !tbaa !11
  %57 = icmp eq i32 %56, 2
  br i1 %57, label %58, label %82

58:                                               ; preds = %51
  %59 = load i64, ptr %21, align 8, !tbaa !9
  %60 = add nsw i64 %59, 1
  store i64 %60, ptr %21, align 8, !tbaa !9
  %61 = load ptr, ptr %19, align 8, !tbaa !5
  %62 = load i64, ptr %61, align 8, !tbaa !9
  store i64 %62, ptr %18, align 8, !tbaa !9
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = load i64, ptr %18, align 8, !tbaa !9
  %65 = call i32 @rl_multi_string_delete(ptr noundef %63, i64 noundef %64)
  %66 = load ptr, ptr %8, align 8, !tbaa !5
  %67 = load ptr, ptr %17, align 8, !tbaa !5
  %68 = load i64, ptr %16, align 8, !tbaa !9
  %69 = getelementptr inbounds [20 x i8], ptr %23, i64 0, i64 0
  %70 = call i32 @rl_btree_remove_element(ptr noundef %66, ptr noundef %67, i64 noundef %68, ptr noundef %69)
  store i32 %70, ptr %15, align 4, !tbaa !11
  %71 = load i32, ptr %15, align 4, !tbaa !11
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %77

73:                                               ; preds = %58
  %74 = load i32, ptr %15, align 4, !tbaa !11
  %75 = icmp ne i32 %74, 10
  br i1 %75, label %76, label %77

76:                                               ; preds = %73
  br label %105

77:                                               ; preds = %73, %58
  %78 = load i32, ptr %15, align 4, !tbaa !11
  %79 = icmp eq i32 %78, 10
  br i1 %79, label %80, label %81

80:                                               ; preds = %77
  store i32 1, ptr %22, align 4, !tbaa !11
  br label %86

81:                                               ; preds = %77
  br label %82

82:                                               ; preds = %81, %51
  br label %83

83:                                               ; preds = %82
  %84 = load i64, ptr %20, align 8, !tbaa !9
  %85 = add nsw i64 %84, 1
  store i64 %85, ptr %20, align 8, !tbaa !9
  br label %32, !llvm.loop !13

86:                                               ; preds = %80, %32
  %87 = load ptr, ptr %14, align 8, !tbaa !5
  %88 = icmp ne ptr %87, null
  br i1 %88, label %89, label %92

89:                                               ; preds = %86
  %90 = load i64, ptr %21, align 8, !tbaa !9
  %91 = load ptr, ptr %14, align 8, !tbaa !5
  store i64 %90, ptr %91, align 8, !tbaa !9
  br label %92

92:                                               ; preds = %89, %86
  %93 = load i32, ptr %22, align 4, !tbaa !11
  %94 = icmp ne i32 %93, 0
  br i1 %94, label %95, label %104

95:                                               ; preds = %92
  %96 = load ptr, ptr %8, align 8, !tbaa !5
  %97 = load ptr, ptr %9, align 8, !tbaa !5
  %98 = load i64, ptr %10, align 8, !tbaa !9
  %99 = call i32 @rl_key_delete(ptr noundef %96, ptr noundef %97, i64 noundef %98)
  store i32 %99, ptr %15, align 4, !tbaa !11
  %100 = load i32, ptr %15, align 4, !tbaa !11
  %101 = icmp ne i32 0, %100
  br i1 %101, label %102, label %103

102:                                              ; preds = %95
  br label %105

103:                                              ; preds = %95
  br label %104

104:                                              ; preds = %103, %92
  store i32 0, ptr %15, align 4, !tbaa !11
  br label %105

105:                                              ; preds = %104, %102, %76, %50, %30
  %106 = load i32, ptr %15, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 20, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  ret i32 %106
}

declare i32 @rl_multi_string_delete(ptr noundef, i64 noundef) #2

declare i32 @rl_btree_remove_element(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #2

declare i32 @rl_key_delete(ptr noundef, ptr noundef, i64 noundef) #2

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 }

!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 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

; Function Attrs: nounwind uwtable
declare dso_local i32 @rl_set_get_objects(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

declare i32 @sha1(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

declare i32 @rl_btree_find_score(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_srem(ptr noundef %0, ptr noundef %1, i64 noundef %2, i32 noundef %3, ptr nocapture noundef readonly %4, ptr nocapture noundef readonly %5, ptr noundef writeonly %6) local_unnamed_addr #0 {
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca [20 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #3
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %11) #3
  %12 = call i32 @rl_set_get_objects(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef nonnull %8, ptr noundef nonnull %9, i32 noundef 1, i32 noundef 0)
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %7
  %13 = sext i32 %3 to i64
  %.not4144 = icmp sgt i32 %3, 0
  br i1 %.not4144, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader, %31
  %.not4147 = phi i1 [ %.not41, %31 ], [ true, %.preheader ]
  %.03046 = phi i64 [ %.1, %31 ], [ 0, %.preheader ]
  %.03145 = phi i64 [ %32, %31 ], [ 0, %.preheader ]
  %14 = getelementptr inbounds ptr, ptr %4, i64 %.03145
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  %16 = getelementptr inbounds i64, ptr %5, i64 %.03145
  %17 = load i64, ptr %16, align 8, !tbaa !9
  %18 = call i32 @sha1(ptr noundef %15, i64 noundef %17, ptr noundef nonnull %11) #3
  %.not38 = icmp eq i32 %18, 0
  br i1 %.not38, label %19, label %.loopexit

19:                                               ; preds = %.lr.ph
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  %21 = call i32 @rl_btree_find_score(ptr noundef %0, ptr noundef %20, ptr noundef nonnull %11, ptr noundef nonnull %10, ptr noundef null, ptr noundef null) #3
  %22 = icmp eq i32 %21, 2
  br i1 %22, label %23, label %31

23:                                               ; preds = %19
  %24 = add nsw i64 %.03046, 1
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  %26 = load i64, ptr %25, align 8, !tbaa !9
  %27 = call i32 @rl_multi_string_delete(ptr noundef %0, i64 noundef %26) #3
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = load i64, ptr %8, align 8, !tbaa !9
  %30 = call i32 @rl_btree_remove_element(ptr noundef %0, ptr noundef %28, i64 noundef %29, ptr noundef nonnull %11) #3
  switch i32 %30, label %.loopexit [
    i32 10, label %._crit_edge
    i32 0, label %31
  ]

31:                                               ; preds = %23, %19
  %.1 = phi i64 [ %.03046, %19 ], [ %24, %23 ]
  %32 = add nuw nsw i64 %.03145, 1
  %.not41 = icmp slt i64 %32, %13
  %exitcond.not = icmp eq i64 %32, %13
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

._crit_edge:                                      ; preds = %31, %23, %.preheader
  %.not41.lcssa = phi i1 [ false, %.preheader ], [ %.not4147, %23 ], [ %.not41, %31 ]
  %.2 = phi i64 [ 0, %.preheader ], [ %24, %23 ], [ %.1, %31 ]
  %.not39 = icmp eq ptr %6, null
  br i1 %.not39, label %34, label %33

33:                                               ; preds = %._crit_edge
  store i64 %.2, ptr %6, align 8, !tbaa !9
  br label %34

34:                                               ; preds = %33, %._crit_edge
  br i1 %.not41.lcssa, label %35, label %37

35:                                               ; preds = %34
  %36 = call i32 @rl_key_delete(ptr noundef %0, ptr noundef %1, i64 noundef %2) #3
  %.not42 = icmp eq i32 %36, 0
  br i1 %.not42, label %37, label %.loopexit

37:                                               ; preds = %35, %34
  br label %.loopexit

.loopexit:                                        ; preds = %23, %.lr.ph, %35, %7, %37
  %.032 = phi i32 [ %12, %7 ], [ %36, %35 ], [ 0, %37 ], [ %30, %23 ], [ %18, %.lr.ph ]
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  ret i32 %.032
}

declare i32 @rl_multi_string_delete(ptr noundef, i64 noundef) local_unnamed_addr #2

declare i32 @rl_btree_remove_element(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

declare i32 @rl_key_delete(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

attributes #0 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 }

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass