; LLVM IR from tangjz/acm-icpc :: codeforces/gym/102012F.ll (Z7getRunsPFiiiiiE)

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

%class.HashTable = type { [200001 x i32], [200001 x i32], [200001 x i32], [200001 x i32], %"class.std::unordered_map", i32, [200001 x i32] }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%struct.Event = type { i32, i32, i32, i32 }

@n = external dso_local global i32, align 4
@ht = external dso_local global %class.HashTable, align 8
@etot = external dso_local global i32, align 4
@eve = external dso_local global [800005 x %struct.Event], align 16
@_ZZ7getRunsPFiiiiiEE4stot = external hidden global i32, align 4
@_ZZ7getRunsPFiiiiiEE3stk = external hidden global [200001 x i32], align 16

; 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: mustprogress uwtable
define dso_local void @_Z7getRunsPFiiiiiE(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %struct.Event, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %struct.Event, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %19 = load i32, ptr @n, align 4, !tbaa !9
  store i32 0, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !9
  store i32 %19, ptr @_ZZ7getRunsPFiiiiiEE3stk, align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %20 = load i32, ptr @n, align 4, !tbaa !9
  %21 = sub nsw i32 %20, 1
  store i32 %21, ptr %3, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %207, %1
  %23 = load i32, ptr %3, align 4, !tbaa !9
  %24 = icmp sge i32 %23, 0
  br i1 %24, label %26, label %25

25:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %210

26:                                               ; preds = %22
  br label %27

27:                                               ; preds = %51, %26
  %28 = load i32, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !9
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %48

30:                                               ; preds = %27
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = load i32, ptr %3, align 4, !tbaa !9
  %33 = load i32, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [200001 x i32], ptr @_ZZ7getRunsPFiiiiiEE3stk, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !9
  %37 = load i32, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [200001 x i32], ptr @_ZZ7getRunsPFiiiiiEE3stk, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !9
  %41 = load i32, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !9
  %42 = sub nsw i32 %41, 1
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [200001 x i32], ptr @_ZZ7getRunsPFiiiiiEE3stk, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !9
  %46 = call noundef i32 %31(i32 noundef %32, i32 noundef %36, i32 noundef %40, i32 noundef %45)
  %47 = icmp slt i32 %46, 0
  br label %48

48:                                               ; preds = %30, %27
  %49 = phi i1 [ false, %27 ], [ %47, %30 ]
  br i1 %49, label %50, label %54

50:                                               ; preds = %48
  br label %51

51:                                               ; preds = %50
  %52 = load i32, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !9
  %53 = add nsw i32 %52, -1
  store i32 %53, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !9
  br label %27, !llvm.loop !11

54:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %55 = load i32, ptr %3, align 4, !tbaa !9
  %56 = load i32, ptr %3, align 4, !tbaa !9
  %57 = sub nsw i32 %56, 1
  %58 = load i32, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [200001 x i32], ptr @_ZZ7getRunsPFiiiiiEE3stk, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !9
  %62 = sub nsw i32 %61, 1
  %63 = call noundef i32 @_Z3lcsii(i32 noundef %57, i32 noundef %62)
  %64 = sub nsw i32 %55, %63
  store i32 %64, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %65 = load i32, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [200001 x i32], ptr @_ZZ7getRunsPFiiiiiEE3stk, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !9
  %69 = load i32, ptr %3, align 4, !tbaa !9
  %70 = load i32, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [200001 x i32], ptr @_ZZ7getRunsPFiiiiiEE3stk, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !9
  %74 = call noundef i32 @_Z3lcpii(i32 noundef %69, i32 noundef %73)
  %75 = add nsw i32 %68, %74
  store i32 %75, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %76 = load i32, ptr %5, align 4, !tbaa !9
  %77 = load i32, ptr %4, align 4, !tbaa !9
  %78 = sub nsw i32 %76, %77
  store i32 %78, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %79 = load i32, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [200001 x i32], ptr @_ZZ7getRunsPFiiiiiEE3stk, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !9
  %83 = load i32, ptr %3, align 4, !tbaa !9
  %84 = sub nsw i32 %82, %83
  store i32 %84, ptr %7, align 4, !tbaa !9
  %85 = load i32, ptr %7, align 4, !tbaa !9
  %86 = load i32, ptr %7, align 4, !tbaa !9
  %87 = add nsw i32 %85, %86
  %88 = load i32, ptr %6, align 4, !tbaa !9
  %89 = icmp sle i32 %87, %88
  br i1 %89, label %90, label %201

90:                                               ; preds = %54
  %91 = load i32, ptr %4, align 4, !tbaa !9
  %92 = load i32, ptr %3, align 4, !tbaa !9
  %93 = icmp slt i32 %91, %92
  br i1 %93, label %94, label %201

94:                                               ; preds = %90
  %95 = load i32, ptr %3, align 4, !tbaa !9
  %96 = load i32, ptr %4, align 4, !tbaa !9
  %97 = load i32, ptr %7, align 4, !tbaa !9
  %98 = add nsw i32 %96, %97
  %99 = icmp sle i32 %95, %98
  br i1 %99, label %100, label %201

100:                                              ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %101 = load i32, ptr %6, align 4, !tbaa !9
  %102 = load i32, ptr %7, align 4, !tbaa !9
  %103 = sdiv i32 %101, %102
  store i32 %103, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %104 = load i32, ptr %6, align 4, !tbaa !9
  %105 = load i32, ptr %7, align 4, !tbaa !9
  %106 = srem i32 %104, %105
  store i32 %106, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %107 = load i32, ptr %4, align 4, !tbaa !9
  %108 = load i32, ptr %4, align 4, !tbaa !9
  %109 = load i32, ptr %7, align 4, !tbaa !9
  %110 = add nsw i32 %108, %109
  %111 = call noundef i32 @_Z3lsrii(i32 noundef %107, i32 noundef %110)
  store i32 %111, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %112 = load i32, ptr %10, align 4, !tbaa !9
  %113 = load i32, ptr %4, align 4, !tbaa !9
  %114 = sub nsw i32 %112, %113
  store i32 %114, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %115 = load i32, ptr %10, align 4, !tbaa !9
  %116 = load i32, ptr %10, align 4, !tbaa !9
  %117 = load i32, ptr %7, align 4, !tbaa !9
  %118 = add nsw i32 %116, %117
  %119 = call noundef i32 @_ZN9HashTable5queryEii(ptr noundef nonnull align 8 dereferenceable(4000080) @ht, i32 noundef %115, i32 noundef %118)
  store i32 %119, ptr %12, align 4, !tbaa !9
  %120 = load i32, ptr %8, align 4, !tbaa !9
  %121 = icmp sgt i32 %120, 1
  br i1 %121, label %122, label %162

122:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %123 = load i32, ptr %7, align 4, !tbaa !9
  %124 = load i32, ptr %11, align 4, !tbaa !9
  %125 = sub nsw i32 %123, %124
  store i32 %125, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %126 = load i32, ptr %9, align 4, !tbaa !9
  %127 = load i32, ptr %11, align 4, !tbaa !9
  %128 = sub nsw i32 %126, %127
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %14, align 4, !tbaa !9
  %130 = load i32, ptr %13, align 4, !tbaa !9
  %131 = load i32, ptr %7, align 4, !tbaa !9
  %132 = icmp sge i32 %130, %131
  br i1 %132, label %133, label %138

133:                                              ; preds = %122
  %134 = load i32, ptr %7, align 4, !tbaa !9
  %135 = load i32, ptr %13, align 4, !tbaa !9
  %136 = sub nsw i32 %135, %134
  store i32 %136, ptr %13, align 4, !tbaa !9
  %137 = icmp ne i32 %136, 0
  br label %138

138:                                              ; preds = %133, %122
  %139 = phi i1 [ false, %122 ], [ %137, %133 ]
  %140 = load i32, ptr %14, align 4, !tbaa !9
  %141 = icmp sle i32 %140, 0
  br i1 %141, label %142, label %147

142:                                              ; preds = %138
  %143 = load i32, ptr %7, align 4, !tbaa !9
  %144 = load i32, ptr %14, align 4, !tbaa !9
  %145 = add nsw i32 %144, %143
  store i32 %145, ptr %14, align 4, !tbaa !9
  %146 = icmp ne i32 %145, 0
  br label %147

147:                                              ; preds = %142, %138
  %148 = phi i1 [ false, %138 ], [ %146, %142 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #4
  %149 = getelementptr inbounds %struct.Event, ptr %15, i32 0, i32 0
  %150 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %150, ptr %149, align 4, !tbaa !13
  %151 = getelementptr inbounds %struct.Event, ptr %15, i32 0, i32 1
  %152 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %152, ptr %151, align 4, !tbaa !15
  %153 = getelementptr inbounds %struct.Event, ptr %15, i32 0, i32 2
  %154 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %154, ptr %153, align 4, !tbaa !16
  %155 = getelementptr inbounds %struct.Event, ptr %15, i32 0, i32 3
  %156 = load i32, ptr %8, align 4, !tbaa !9
  %157 = sub nsw i32 %156, 1
  store i32 %157, ptr %155, align 4, !tbaa !17
  %158 = load i32, ptr @etot, align 4, !tbaa !9
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr @etot, align 4, !tbaa !9
  %160 = sext i32 %158 to i64
  %161 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %160
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %161, ptr align 4 %15, i64 16, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %162

162:                                              ; preds = %147, %100
  %163 = load i32, ptr %8, align 4, !tbaa !9
  %164 = icmp sgt i32 %163, 2
  br i1 %164, label %165, label %200

165:                                              ; preds = %162
  %166 = load i32, ptr %9, align 4, !tbaa !9
  %167 = add nsw i32 %166, 1
  %168 = load i32, ptr %7, align 4, !tbaa !9
  %169 = icmp slt i32 %167, %168
  br i1 %169, label %170, label %200

170:                                              ; preds = %165
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %171 = load i32, ptr %9, align 4, !tbaa !9
  %172 = load i32, ptr %11, align 4, !tbaa !9
  %173 = sub nsw i32 %171, %172
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %175 = load i32, ptr %7, align 4, !tbaa !9
  %176 = load i32, ptr %11, align 4, !tbaa !9
  %177 = sub nsw i32 %175, %176
  store i32 %177, ptr %17, align 4, !tbaa !9
  %178 = load i32, ptr %16, align 4, !tbaa !9
  %179 = icmp slt i32 %178, 0
  br i1 %179, label %180, label %185

180:                                              ; preds = %170
  %181 = load i32, ptr %7, align 4, !tbaa !9
  %182 = load i32, ptr %16, align 4, !tbaa !9
  %183 = add nsw i32 %182, %181
  store i32 %183, ptr %16, align 4, !tbaa !9
  %184 = icmp ne i32 %183, 0
  br label %185

185:                                              ; preds = %180, %170
  %186 = phi i1 [ false, %170 ], [ %184, %180 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #4
  %187 = getelementptr inbounds %struct.Event, ptr %18, i32 0, i32 0
  %188 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %188, ptr %187, align 4, !tbaa !13
  %189 = getelementptr inbounds %struct.Event, ptr %18, i32 0, i32 1
  %190 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %190, ptr %189, align 4, !tbaa !15
  %191 = getelementptr inbounds %struct.Event, ptr %18, i32 0, i32 2
  %192 = load i32, ptr %17, align 4, !tbaa !9
  store i32 %192, ptr %191, align 4, !tbaa !16
  %193 = getelementptr inbounds %struct.Event, ptr %18, i32 0, i32 3
  %194 = load i32, ptr %8, align 4, !tbaa !9
  %195 = sub nsw i32 %194, 2
  store i32 %195, ptr %193, align 4, !tbaa !17
  %196 = load i32, ptr @etot, align 4, !tbaa !9
  %197 = add nsw i32 %196, 1
  store i32 %197, ptr @etot, align 4, !tbaa !9
  %198 = sext i32 %196 to i64
  %199 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %198
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %199, ptr align 4 %18, i64 16, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %200

200:                                              ; preds = %185, %165, %162
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %201

201:                                              ; preds = %200, %94, %90, %54
  %202 = load i32, ptr %3, align 4, !tbaa !9
  %203 = load i32, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !9
  %204 = add nsw i32 %203, 1
  store i32 %204, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !9
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds [200001 x i32], ptr @_ZZ7getRunsPFiiiiiEE3stk, i64 0, i64 %205
  store i32 %202, ptr %206, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  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
  br label %207

207:                                              ; preds = %201
  %208 = load i32, ptr %3, align 4, !tbaa !9
  %209 = add nsw i32 %208, -1
  store i32 %209, ptr %3, align 4, !tbaa !9
  br label %22, !llvm.loop !19

210:                                              ; preds = %25
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z3lcsii(i32 noundef, i32 noundef) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z3lcpii(i32 noundef, i32 noundef) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z3lsrii(i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN9HashTable5queryEii(ptr noundef nonnull align 8 dereferenceable(4000080), i32 noundef, i32 noundef) #1 align 2

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

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

%class.HashTable = type { [200001 x i32], [200001 x i32], [200001 x i32], [200001 x i32], %"class.std::unordered_map", i32, [200001 x i32] }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%struct.Event = type { i32, i32, i32, i32 }

@n = external dso_local local_unnamed_addr global i32, align 4
@ht = external dso_local global %class.HashTable, align 8
@etot = external dso_local local_unnamed_addr global i32, align 4
@eve = external dso_local local_unnamed_addr global [800005 x %struct.Event], align 16
@_ZZ7getRunsPFiiiiiEE4stot = external hidden local_unnamed_addr global i32, align 4
@_ZZ7getRunsPFiiiiiEE3stk = external hidden local_unnamed_addr global [200001 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7getRunsPFiiiiiE(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = load i32, ptr @n, align 4, !tbaa !5
  store i32 0, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !5
  store i32 %2, ptr @_ZZ7getRunsPFiiiiiEE3stk, align 16, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %thread-pre-split, label %._crit_edge

._crit_edge:                                      ; preds = %.thread, %1
  ret void

thread-pre-split:                                 ; preds = %1, %.thread
  %.pr = phi i32 [ %70, %.thread ], [ 0, %1 ]
  %.0.in90 = phi i32 [ %.091, %.thread ], [ %2, %1 ]
  %.091 = add nsw i32 %.0.in90, -1
  %.not87 = icmp eq i32 %.pr, 0
  br i1 %.not87, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %thread-pre-split, %14
  %4 = phi i32 [ %15, %14 ], [ %.pr, %thread-pre-split ]
  %5 = sext i32 %4 to i64
  %6 = getelementptr inbounds [200001 x i32], ptr @_ZZ7getRunsPFiiiiiEE3stk, i64 0, i64 %5
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = add nsw i32 %4, -1
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds [200001 x i32], ptr @_ZZ7getRunsPFiiiiiEE3stk, i64 0, i64 %9
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %12 = tail call noundef i32 %0(i32 noundef %.091, i32 noundef %7, i32 noundef %7, i32 noundef %11)
  %13 = icmp slt i32 %12, 0
  %.pre.pre = load i32, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !5
  br i1 %13, label %14, label %.critedge

14:                                               ; preds = %.lr.ph
  %15 = add nsw i32 %.pre.pre, -1
  store i32 %15, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !5
  %.not = icmp eq i32 %15, 0
  br i1 %.not, label %.critedge, label %.lr.ph, !llvm.loop !9

.critedge:                                        ; preds = %.lr.ph, %14, %thread-pre-split
  %16 = phi i32 [ 0, %thread-pre-split ], [ %.pre.pre, %.lr.ph ], [ 0, %14 ]
  %17 = add nsw i32 %.0.in90, -2
  %18 = sext i32 %16 to i64
  %19 = getelementptr inbounds [200001 x i32], ptr @_ZZ7getRunsPFiiiiiEE3stk, i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = add nsw i32 %20, -1
  %22 = tail call noundef i32 @_Z3lcsii(i32 noundef %17, i32 noundef %21)
  %23 = sub nsw i32 %.091, %22
  %24 = load i32, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [200001 x i32], ptr @_ZZ7getRunsPFiiiiiEE3stk, i64 0, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = tail call noundef i32 @_Z3lcpii(i32 noundef %.091, i32 noundef %27)
  %29 = sub i32 %27, %23
  %30 = add i32 %29, %28
  %31 = load i32, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [200001 x i32], ptr @_ZZ7getRunsPFiiiiiEE3stk, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = sub nsw i32 %34, %.091
  %36 = shl nsw i32 %35, 1
  %.not80 = icmp sle i32 %36, %30
  %37 = icmp sgt i32 %22, 0
  %or.cond = and i1 %37, %.not80
  br i1 %or.cond, label %38, label %.thread

38:                                               ; preds = %.critedge
  %39 = add nsw i32 %35, %23
  %.not81 = icmp sgt i32 %.091, %39
  br i1 %.not81, label %.thread, label %40

40:                                               ; preds = %38
  %41 = sdiv i32 %30, %35
  %42 = srem i32 %30, %35
  %43 = tail call noundef i32 @_Z3lsrii(i32 noundef %23, i32 noundef %39)
  %44 = sub nsw i32 %43, %23
  %45 = add nsw i32 %43, %35
  %46 = tail call noundef i32 @_ZN9HashTable5queryEii(ptr noundef nonnull align 8 dereferenceable(4000080) @ht, i32 noundef %43, i32 noundef %45)
  %47 = icmp sgt i32 %41, 1
  br i1 %47, label %48, label %.thread

48:                                               ; preds = %40
  %49 = sub nsw i32 %42, %44
  %50 = add nsw i32 %49, 1
  %.not82 = icmp sgt i32 %44, 0
  %spec.select = select i1 %.not82, i32 %35, i32 0
  %.064 = sub i32 %spec.select, %44
  %51 = icmp slt i32 %49, 0
  %52 = select i1 %51, i32 %35, i32 0
  %.065 = add nsw i32 %50, %52
  %53 = add nsw i32 %41, -1
  %54 = load i32, ptr @etot, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr @etot, align 4, !tbaa !5
  %56 = sext i32 %54 to i64
  %57 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %56
  store i32 %46, ptr %57, align 16, !tbaa !5
  %.sroa.45.0..sroa_idx = getelementptr inbounds i8, ptr %57, i64 4
  store i32 %.064, ptr %.sroa.45.0..sroa_idx, align 4, !tbaa !5
  %.sroa.56.0..sroa_idx = getelementptr inbounds i8, ptr %57, i64 8
  store i32 %.065, ptr %.sroa.56.0..sroa_idx, align 8, !tbaa !5
  %.sroa.67.0..sroa_idx = getelementptr inbounds i8, ptr %57, i64 12
  store i32 %53, ptr %.sroa.67.0..sroa_idx, align 4, !tbaa !5
  %58 = icmp ne i32 %41, 2
  %59 = add nsw i32 %42, 1
  %60 = icmp slt i32 %59, %35
  %or.cond84 = select i1 %58, i1 %60, i1 false
  br i1 %or.cond84, label %61, label %.thread

61:                                               ; preds = %48
  %62 = sub nsw i32 %35, %44
  %63 = icmp slt i32 %49, -1
  %64 = select i1 %63, i32 %35, i32 0
  %spec.select85 = add nsw i32 %50, %64
  %65 = add nsw i32 %41, -2
  %66 = add nsw i32 %54, 2
  store i32 %66, ptr @etot, align 4, !tbaa !5
  %67 = sext i32 %55 to i64
  %68 = getelementptr inbounds [800005 x %struct.Event], ptr @eve, i64 0, i64 %67
  store i32 %46, ptr %68, align 16, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %68, i64 4
  store i32 %spec.select85, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %68, i64 8
  store i32 %62, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !5
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %68, i64 12
  store i32 %65, ptr %.sroa.6.0..sroa_idx, align 4, !tbaa !5
  br label %.thread

.thread:                                          ; preds = %40, %48, %61, %38, %.critedge
  %69 = load i32, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr @_ZZ7getRunsPFiiiiiEE4stot, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [200001 x i32], ptr @_ZZ7getRunsPFiiiiiEE3stk, i64 0, i64 %71
  store i32 %.091, ptr %72, align 4, !tbaa !5
  %73 = icmp sgt i32 %.0.in90, 1
  br i1 %73, label %thread-pre-split, label %._crit_edge, !llvm.loop !11
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z3lcsii(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z3lcpii(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z3lsrii(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN9HashTable5queryEii(ptr noundef nonnull align 8 dereferenceable(4000080), i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

attributes #0 = { mustprogress 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 = { inlinehint mustprogress 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" }

!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++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,DivRemPairsPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass