; LLVM IR from jermp/2i_bench :: external/CRoaring/src/containers (mixed_negation)

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

%struct.rle16_s = type { i16, i16 }
%struct.run_container_s = type { i32, i32, ptr }

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @run_container_negation_range(ptr noundef, i32 noundef, i32 noundef, ptr noundef) #1

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

25:                                               ; preds = %4
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %26, ptr %27, align 8, !tbaa !5
  store i32 3, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %186

28:                                               ; preds = %4
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.run_container_s, ptr %29, i32 0, i32 1
  %31 = load i32, ptr %30, align 4, !tbaa !11
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.run_container_s, ptr %32, i32 0, i32 0
  %34 = load i32, ptr %33, align 8, !tbaa !13
  %35 = icmp eq i32 %31, %34
  br i1 %35, label %36, label %95

36:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #6
  store i8 0, ptr %12, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #6
  store i8 0, ptr %13, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #6
  store i8 0, ptr %14, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #6
  store i8 0, ptr %15, align 1, !tbaa !14
  %37 = load i32, ptr %7, align 4, !tbaa !9
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %39, label %46

39:                                               ; preds = %36
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = load i32, ptr %7, align 4, !tbaa !9
  %42 = sub nsw i32 %41, 1
  %43 = trunc i32 %42 to i16
  %44 = call zeroext i1 @run_container_contains(ptr noundef %40, i16 noundef zeroext %43)
  %45 = zext i1 %44 to i8
  store i8 %45, ptr %12, align 1, !tbaa !14
  br label %46

46:                                               ; preds = %39, %36
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = load i32, ptr %7, align 4, !tbaa !9
  %49 = trunc i32 %48 to i16
  %50 = call zeroext i1 @run_container_contains(ptr noundef %47, i16 noundef zeroext %49)
  %51 = zext i1 %50 to i8
  store i8 %51, ptr %13, align 1, !tbaa !14
  %52 = load i8, ptr %12, align 1, !tbaa !14, !range !16, !noundef !17
  %53 = trunc i8 %52 to i1
  %54 = zext i1 %53 to i32
  %55 = load i8, ptr %13, align 1, !tbaa !14, !range !16, !noundef !17
  %56 = trunc i8 %55 to i1
  %57 = zext i1 %56 to i32
  %58 = icmp eq i32 %54, %57
  br i1 %58, label %59, label %91

59:                                               ; preds = %46
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = load i32, ptr %8, align 4, !tbaa !9
  %62 = sub nsw i32 %61, 1
  %63 = trunc i32 %62 to i16
  %64 = call zeroext i1 @run_container_contains(ptr noundef %60, i16 noundef zeroext %63)
  %65 = zext i1 %64 to i8
  store i8 %65, ptr %14, align 1, !tbaa !14
  %66 = load i32, ptr %8, align 4, !tbaa !9
  %67 = icmp ne i32 %66, 65536
  br i1 %67, label %68, label %74

68:                                               ; preds = %59
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = load i32, ptr %8, align 4, !tbaa !9
  %71 = trunc i32 %70 to i16
  %72 = call zeroext i1 @run_container_contains(ptr noundef %69, i16 noundef zeroext %71)
  %73 = zext i1 %72 to i8
  store i8 %73, ptr %15, align 1, !tbaa !14
  br label %74

74:                                               ; preds = %68, %59
  %75 = load i8, ptr %14, align 1, !tbaa !14, !range !16, !noundef !17
  %76 = trunc i8 %75 to i1
  %77 = zext i1 %76 to i32
  %78 = load i8, ptr %15, align 1, !tbaa !14, !range !16, !noundef !17
  %79 = trunc i8 %78 to i1
  %80 = zext i1 %79 to i32
  %81 = icmp eq i32 %77, %80
  br i1 %81, label %82, label %90

82:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = load i32, ptr %7, align 4, !tbaa !9
  %85 = load i32, ptr %8, align 4, !tbaa !9
  %86 = load ptr, ptr %9, align 8, !tbaa !5
  %87 = call i32 @run_container_negation_range(ptr noundef %83, i32 noundef %84, i32 noundef %85, ptr noundef %86)
  store i32 %87, ptr %16, align 4, !tbaa !9
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  call void @run_container_free(ptr noundef %88)
  %89 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %89, ptr %5, align 4
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %92

90:                                               ; preds = %74
  br label %91

91:                                               ; preds = %90, %46
  store i32 0, ptr %11, align 4
  br label %92

92:                                               ; preds = %91, %82
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #6
  %93 = load i32, ptr %11, align 4
  switch i32 %93, label %186 [
    i32 0, label %94
  ]

94:                                               ; preds = %92
  br label %95

95:                                               ; preds = %94, %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %96, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.run_container_s, ptr %97, i32 0, i32 0
  %99 = load i32, ptr %98, align 8, !tbaa !13
  store i32 %99, ptr %18, align 4, !tbaa !9
  %100 = load ptr, ptr %17, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.run_container_s, ptr %100, i32 0, i32 0
  store i32 0, ptr %101, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %102

102:                                              ; preds = %125, %95
  %103 = load i32, ptr %19, align 4, !tbaa !9
  %104 = load i32, ptr %18, align 4, !tbaa !9
  %105 = icmp slt i32 %103, %104
  br i1 %105, label %106, label %118

106:                                              ; preds = %102
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.run_container_s, ptr %107, i32 0, i32 2
  %109 = load ptr, ptr %108, align 8, !tbaa !18
  %110 = load i32, ptr %19, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds %struct.rle16_s, ptr %109, i64 %111
  %113 = getelementptr inbounds %struct.rle16_s, ptr %112, i32 0, i32 0
  %114 = load i16, ptr %113, align 2, !tbaa !19
  %115 = zext i16 %114 to i32
  %116 = load i32, ptr %7, align 4, !tbaa !9
  %117 = icmp slt i32 %115, %116
  br label %118

118:                                              ; preds = %106, %102
  %119 = phi i1 [ false, %102 ], [ %117, %106 ]
  br i1 %119, label %120, label %128

120:                                              ; preds = %118
  %121 = load ptr, ptr %17, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.run_container_s, ptr %121, i32 0, i32 0
  %123 = load i32, ptr %122, align 8, !tbaa !13
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %122, align 8, !tbaa !13
  br label %125

125:                                              ; preds = %120
  %126 = load i32, ptr %19, align 4, !tbaa !9
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %19, align 4, !tbaa !9
  br label %102, !llvm.loop !22

128:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  call void @llvm.memset.p0.i64(ptr align 2 %20, i8 0, i64 4, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %21, ptr align 2 %20, i64 4, i1 false), !tbaa.struct !24
  %129 = load i32, ptr %19, align 4, !tbaa !9
  %130 = load i32, ptr %18, align 4, !tbaa !9
  %131 = icmp slt i32 %129, %130
  br i1 %131, label %132, label %139

132:                                              ; preds = %128
  %133 = load ptr, ptr %6, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.run_container_s, ptr %133, i32 0, i32 2
  %135 = load ptr, ptr %134, align 8, !tbaa !18
  %136 = load i32, ptr %19, align 4, !tbaa !9
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds %struct.rle16_s, ptr %135, i64 %137
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %20, ptr align 2 %138, i64 4, i1 false), !tbaa.struct !24
  br label %139

139:                                              ; preds = %132, %128
  %140 = load ptr, ptr %17, align 8, !tbaa !5
  %141 = load i32, ptr %7, align 4, !tbaa !9
  %142 = trunc i32 %141 to i16
  %143 = load i32, ptr %8, align 4, !tbaa !9
  %144 = load i32, ptr %7, align 4, !tbaa !9
  %145 = sub nsw i32 %143, %144
  %146 = sub nsw i32 %145, 1
  %147 = trunc i32 %146 to i16
  call void @run_container_smart_append_exclusive(ptr noundef %140, i16 noundef zeroext %142, i16 noundef zeroext %147)
  br label %148

148:                                              ; preds = %171, %139
  %149 = load i32, ptr %19, align 4, !tbaa !9
  %150 = load i32, ptr %18, align 4, !tbaa !9
  %151 = icmp slt i32 %149, %150
  br i1 %151, label %152, label %174

152:                                              ; preds = %148
  %153 = load i32, ptr %19, align 4, !tbaa !9
  %154 = add nsw i32 %153, 1
  %155 = load i32, ptr %18, align 4, !tbaa !9
  %156 = icmp slt i32 %154, %155
  br i1 %156, label %157, label %165

157:                                              ; preds = %152
  %158 = load ptr, ptr %6, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.run_container_s, ptr %158, i32 0, i32 2
  %160 = load ptr, ptr %159, align 8, !tbaa !18
  %161 = load i32, ptr %19, align 4, !tbaa !9
  %162 = add nsw i32 %161, 1
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds %struct.rle16_s, ptr %160, i64 %163
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %21, ptr align 2 %164, i64 4, i1 false), !tbaa.struct !24
  br label %165

165:                                              ; preds = %157, %152
  %166 = load ptr, ptr %17, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.rle16_s, ptr %20, i32 0, i32 0
  %168 = load i16, ptr %167, align 2, !tbaa !19
  %169 = getelementptr inbounds %struct.rle16_s, ptr %20, i32 0, i32 1
  %170 = load i16, ptr %169, align 2, !tbaa !26
  call void @run_container_smart_append_exclusive(ptr noundef %166, i16 noundef zeroext %168, i16 noundef zeroext %170)
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %20, ptr align 2 %21, i64 4, i1 false), !tbaa.struct !24
  br label %171

171:                                              ; preds = %165
  %172 = load i32, ptr %19, align 4, !tbaa !9
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %19, align 4, !tbaa !9
  br label %148, !llvm.loop !27

174:                                              ; preds = %148
  %175 = load ptr, ptr %17, align 8, !tbaa !5
  %176 = call ptr @convert_run_to_efficient_container(ptr noundef %175, ptr noundef %10)
  %177 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %176, ptr %177, align 8, !tbaa !5
  %178 = load i8, ptr %10, align 1, !tbaa !28
  %179 = zext i8 %178 to i32
  %180 = icmp ne i32 %179, 3
  br i1 %180, label %181, label %183

181:                                              ; preds = %174
  %182 = load ptr, ptr %17, align 8, !tbaa !5
  call void @run_container_free(ptr noundef %182)
  br label %183

183:                                              ; preds = %181, %174
  %184 = load i8, ptr %10, align 1, !tbaa !28
  %185 = zext i8 %184 to i32
  store i32 %185, ptr %5, align 4
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %186

186:                                              ; preds = %183, %92, %25
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #6
  %187 = load i32, ptr %5, align 4
  ret i32 %187
}

; 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) #2

declare void @run_container_smart_append_exclusive(ptr noundef, i16 noundef zeroext, i16 noundef zeroext) #3

declare ptr @convert_run_to_efficient_container(ptr noundef, ptr noundef) #3

declare void @run_container_free(ptr noundef) #3

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 = !{!12, !10, i64 4}
!12 = !{!"run_container_s", !10, i64 0, !10, i64 4, !6, i64 8}
!13 = !{!12, !10, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!12, !6, i64 8}
!19 = !{!20, !21, i64 0}
!20 = !{!"rle16_s", !21, i64 0, !21, i64 2}
!21 = !{!"short", !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{i64 0, i64 2, !25, i64 2, i64 2, !25}
!25 = !{!21, !21, i64 0}
!26 = !{!20, !21, i64 2}
!27 = distinct !{!27, !23}
!28 = !{!7, !7, i64 0}


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

%struct.rle16_s = type { i16, i16 }

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @run_container_negation_range(ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @run_container_negation_range_inplace(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) local_unnamed_addr #1 {
  %5 = alloca i8, align 1
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #4
  %.not = icmp sgt i32 %2, %1
  br i1 %.not, label %7, label %6

6:                                                ; preds = %4
  store ptr %0, ptr %3, align 8, !tbaa !5
  br label %64

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %0, i64 4
  %9 = load i32, ptr %8, align 4, !tbaa !9
  %10 = load i32, ptr %0, align 8, !tbaa !12
  %11 = icmp eq i32 %9, %10
  br i1 %11, label %12, label %.thread

12:                                               ; preds = %7
  %13 = icmp sgt i32 %1, 0
  %14 = trunc i32 %1 to i16
  br i1 %13, label %15, label %._crit_edge98

15:                                               ; preds = %12
  %16 = add i16 %14, -1
  %17 = tail call zeroext i1 @run_container_contains(ptr noundef nonnull %0, i16 noundef zeroext %16)
  %18 = zext i1 %17 to i32
  br label %._crit_edge98

._crit_edge98:                                    ; preds = %12, %15
  %.067 = phi i32 [ %18, %15 ], [ 0, %12 ]
  %19 = tail call zeroext i1 @run_container_contains(ptr noundef nonnull %0, i16 noundef zeroext %14)
  %20 = zext i1 %19 to i32
  %21 = icmp eq i32 %.067, %20
  br i1 %21, label %22, label %.threadthread-pre-split

22:                                               ; preds = %._crit_edge98
  %23 = trunc i32 %2 to i16
  %24 = add i16 %23, -1
  %25 = tail call zeroext i1 @run_container_contains(ptr noundef nonnull %0, i16 noundef zeroext %24)
  %.not73 = icmp eq i32 %2, 65536
  br i1 %.not73, label %29, label %26

26:                                               ; preds = %22
  %27 = tail call zeroext i1 @run_container_contains(ptr noundef nonnull %0, i16 noundef zeroext %23)
  %28 = zext i1 %27 to i32
  br label %29

29:                                               ; preds = %26, %22
  %.068 = phi i32 [ %28, %26 ], [ 0, %22 ]
  %30 = zext i1 %25 to i32
  %31 = icmp eq i32 %.068, %30
  br i1 %31, label %32, label %.threadthread-pre-split

32:                                               ; preds = %29
  %33 = tail call i32 @run_container_negation_range(ptr noundef nonnull %0, i32 noundef %1, i32 noundef %2, ptr noundef %3)
  tail call void @run_container_free(ptr noundef nonnull %0) #4
  br label %64

.threadthread-pre-split:                          ; preds = %29, %._crit_edge98
  %.pr = load i32, ptr %0, align 8, !tbaa !12
  br label %.thread

.thread:                                          ; preds = %.threadthread-pre-split, %7
  %34 = phi i32 [ %.pr, %.threadthread-pre-split ], [ %10, %7 ]
  store i32 0, ptr %0, align 8, !tbaa !12
  %35 = icmp sgt i32 %34, 0
  br i1 %35, label %.lr.ph, label %.critedge75

.lr.ph:                                           ; preds = %.thread
  %36 = getelementptr inbounds i8, ptr %0, i64 8
  %37 = load ptr, ptr %36, align 8, !tbaa !13
  %wide.trip.count = zext nneg i32 %34 to i64
  br label %38

38:                                               ; preds = %.lr.ph, %44
  %39 = phi i32 [ 0, %.lr.ph ], [ %45, %44 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %44 ]
  %40 = getelementptr inbounds %struct.rle16_s, ptr %37, i64 %indvars.iv
  %41 = load i16, ptr %40, align 2, !tbaa !14
  %42 = zext i16 %41 to i32
  %43 = icmp slt i32 %42, %1
  br i1 %43, label %44, label %.critedge

44:                                               ; preds = %38
  %45 = add nuw nsw i32 %39, 1
  store i32 %45, ptr %0, align 8, !tbaa !12
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.critedge75, label %38, !llvm.loop !16

.critedge:                                        ; preds = %38
  %46 = trunc nuw nsw i64 %indvars.iv to i32
  %.sroa.7.0..sroa_idx3 = getelementptr inbounds %struct.rle16_s, ptr %37, i64 %indvars.iv, i32 1
  %.sroa.7.0.copyload4 = load i16, ptr %.sroa.7.0..sroa_idx3, align 2, !tbaa !14
  br label %.critedge75

.critedge75:                                      ; preds = %44, %.thread, %.critedge
  %.079 = phi i32 [ %46, %.critedge ], [ 0, %.thread ], [ %34, %44 ]
  %.sroa.0.0 = phi i16 [ %41, %.critedge ], [ 0, %.thread ], [ 0, %44 ]
  %.sroa.7.0 = phi i16 [ %.sroa.7.0.copyload4, %.critedge ], [ 0, %.thread ], [ 0, %44 ]
  %47 = trunc i32 %1 to i16
  %48 = xor i32 %1, -1
  %49 = add i32 %48, %2
  %50 = trunc i32 %49 to i16
  tail call void @run_container_smart_append_exclusive(ptr noundef nonnull %0, i16 noundef zeroext %47, i16 noundef zeroext %50) #4
  %51 = icmp slt i32 %.079, %34
  br i1 %51, label %.lr.ph89, label %._crit_edge

.lr.ph89:                                         ; preds = %.critedge75
  %52 = getelementptr inbounds i8, ptr %0, i64 8
  %53 = zext i32 %.079 to i64
  %indvars.iv.next97107 = add nuw nsw i64 %53, 1
  %54 = trunc nuw i64 %indvars.iv.next97107 to i32
  %55 = icmp sgt i32 %34, %54
  br i1 %55, label %.lr.ph111, label %._crit_edge.loopexit

.lr.ph111:                                        ; preds = %.lr.ph89, %.lr.ph111
  %indvars.iv.next97110 = phi i64 [ %indvars.iv.next97, %.lr.ph111 ], [ %indvars.iv.next97107, %.lr.ph89 ]
  %.sroa.0.187109 = phi i16 [ %.sroa.08.0.copyload, %.lr.ph111 ], [ %.sroa.0.0, %.lr.ph89 ]
  %.sroa.7.188108 = phi i16 [ %.sroa.5.0.copyload, %.lr.ph111 ], [ %.sroa.7.0, %.lr.ph89 ]
  %56 = load ptr, ptr %52, align 8, !tbaa !13
  %57 = getelementptr inbounds %struct.rle16_s, ptr %56, i64 %indvars.iv.next97110
  %.sroa.08.0.copyload = load i16, ptr %57, align 2, !tbaa !14
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %57, i64 2
  %.sroa.5.0.copyload = load i16, ptr %.sroa.5.0..sroa_idx, align 2, !tbaa !14
  tail call void @run_container_smart_append_exclusive(ptr noundef nonnull %0, i16 noundef zeroext %.sroa.0.187109, i16 noundef zeroext %.sroa.7.188108) #4
  %indvars.iv.next97 = add nuw nsw i64 %indvars.iv.next97110, 1
  %58 = trunc nuw i64 %indvars.iv.next97 to i32
  %59 = icmp sgt i32 %34, %58
  br i1 %59, label %.lr.ph111, label %._crit_edge.loopexit

._crit_edge.loopexit:                             ; preds = %.lr.ph111, %.lr.ph89
  %.sroa.7.188.lcssa = phi i16 [ %.sroa.7.0, %.lr.ph89 ], [ %.sroa.5.0.copyload, %.lr.ph111 ]
  %.sroa.0.187.lcssa = phi i16 [ %.sroa.0.0, %.lr.ph89 ], [ %.sroa.08.0.copyload, %.lr.ph111 ]
  tail call void @run_container_smart_append_exclusive(ptr noundef nonnull %0, i16 noundef zeroext %.sroa.0.187.lcssa, i16 noundef zeroext %.sroa.7.188.lcssa) #4
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.critedge75
  %60 = call ptr @convert_run_to_efficient_container(ptr noundef nonnull %0, ptr noundef nonnull %5) #4
  store ptr %60, ptr %3, align 8, !tbaa !5
  %61 = load i8, ptr %5, align 1, !tbaa !18
  %.not74 = icmp eq i8 %61, 3
  br i1 %.not74, label %64, label %62

62:                                               ; preds = %._crit_edge
  call void @run_container_free(ptr noundef nonnull %0) #4
  %.pre = load i8, ptr %5, align 1, !tbaa !18
  %63 = zext i8 %.pre to i32
  br label %64

64:                                               ; preds = %._crit_edge, %62, %32, %6
  %.165 = phi i32 [ 3, %6 ], [ %33, %32 ], [ %63, %62 ], [ 3, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #4
  ret i32 %.165
}

declare void @run_container_smart_append_exclusive(ptr noundef, i16 noundef zeroext, i16 noundef zeroext) local_unnamed_addr #2

declare ptr @convert_run_to_efficient_container(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @run_container_free(ptr noundef) local_unnamed_addr #2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 #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, !11, i64 4}
!10 = !{!"run_container_s", !11, i64 0, !11, i64 4, !6, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = !{!10, !6, i64 8}
!14 = !{!15, !15, i64 0}
!15 = !{!"short", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!7, !7, i64 0}


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