; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/310 Division 2/Problem C (C)

; 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.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@cnt = external dso_local global i32, align 4
@sz = external dso_local global [100100 x i32], align 16
@s = external dso_local global [100100 x i32], align 16
@pos = external dso_local global [100100 x i32], align 16
@last = external dso_local global [100100 x i32], align 16
@open = external dso_local global [100100 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @k)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %45, %0
  %8 = load i32, ptr %2, align 4, !tbaa !5
  %9 = load i32, ptr @k, align 4, !tbaa !5
  %10 = icmp sle i32 %8, %9
  br i1 %10, label %12, label %11

11:                                               ; preds = %7
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %48

12:                                               ; preds = %7
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @m)
  %14 = load i32, ptr @m, align 4, !tbaa !5
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [100100 x i32], ptr @sz, i64 0, i64 %16
  store i32 %14, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %41, %12
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = load i32, ptr @m, align 4, !tbaa !5
  %21 = icmp sle i32 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %44

23:                                               ; preds = %18
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @x)
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = load i32, ptr @x, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [100100 x i32], ptr @s, i64 0, i64 %27
  store i32 %25, ptr %28, align 4, !tbaa !5
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = load i32, ptr @x, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [100100 x i32], ptr @pos, i64 0, i64 %31
  store i32 %29, ptr %32, align 4, !tbaa !5
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = load i32, ptr @m, align 4, !tbaa !5
  %35 = icmp eq i32 %33, %34
  br i1 %35, label %36, label %40

36:                                               ; preds = %23
  %37 = load i32, ptr @x, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [100100 x i32], ptr @last, i64 0, i64 %38
  store i32 1, ptr %39, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %36, %23
  br label %41

41:                                               ; preds = %40
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %4, align 4, !tbaa !5
  br label %18, !llvm.loop !9

44:                                               ; preds = %22
  br label %45

45:                                               ; preds = %44
  %46 = load i32, ptr %2, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %2, align 4, !tbaa !5
  br label %7, !llvm.loop !11

48:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %194, %48
  %50 = load i32, ptr %5, align 4, !tbaa !5
  %51 = load i32, ptr @n, align 4, !tbaa !5
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %54, label %53

53:                                               ; preds = %49
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %197

54:                                               ; preds = %49
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [100100 x i32], ptr @s, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [100100 x i32], ptr @s, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = icmp eq i32 %59, %63
  br i1 %64, label %65, label %78

65:                                               ; preds = %54
  %66 = load i32, ptr %5, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [100100 x i32], ptr @s, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [100100 x i32], ptr @open, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = icmp eq i32 %72, 1
  br i1 %73, label %74, label %77

74:                                               ; preds = %65
  %75 = load i32, ptr @cnt, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr @cnt, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %74, %65
  br label %194

78:                                               ; preds = %54
  %79 = load i32, ptr %5, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [100100 x i32], ptr @last, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = icmp eq i32 %82, 1
  br i1 %83, label %93, label %84

84:                                               ; preds = %78
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [100100 x i32], ptr @s, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100100 x i32], ptr @open, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = icmp eq i32 %91, 1
  br i1 %92, label %93, label %133

93:                                               ; preds = %84, %78
  %94 = load i32, ptr %5, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [100100 x i32], ptr @s, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [100100 x i32], ptr @open, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = icmp sgt i32 %101, 0
  br i1 %102, label %103, label %106

103:                                              ; preds = %93
  %104 = load i32, ptr @cnt, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr @cnt, align 4, !tbaa !5
  br label %132

106:                                              ; preds = %93
  %107 = load i32, ptr %5, align 4, !tbaa !5
  %108 = add nsw i32 %107, 1
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [100100 x i32], ptr @s, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [100100 x i32], ptr @open, i64 0, i64 %112
  store i32 1, ptr %113, align 4, !tbaa !5
  %114 = load i32, ptr %5, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [100100 x i32], ptr @s, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [100100 x i32], ptr @sz, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = load i32, ptr %5, align 4, !tbaa !5
  %123 = add nsw i32 %122, 1
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [100100 x i32], ptr @pos, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = sub nsw i32 %121, %126
  %128 = load i32, ptr @cnt, align 4, !tbaa !5
  %129 = add nsw i32 %128, %127
  store i32 %129, ptr @cnt, align 4, !tbaa !5
  %130 = load i32, ptr @cnt, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr @cnt, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %106, %103
  br label %193

133:                                              ; preds = %84
  %134 = load i32, ptr %5, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [100100 x i32], ptr @s, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [100100 x i32], ptr @open, i64 0, i64 %138
  store i32 1, ptr %139, align 4, !tbaa !5
  %140 = load i32, ptr %5, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [100100 x i32], ptr @s, i64 0, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [100100 x i32], ptr @sz, i64 0, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = load i32, ptr %5, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [100100 x i32], ptr @pos, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = sub nsw i32 %146, %150
  %152 = load i32, ptr @cnt, align 4, !tbaa !5
  %153 = add nsw i32 %152, %151
  store i32 %153, ptr @cnt, align 4, !tbaa !5
  %154 = load i32, ptr %5, align 4, !tbaa !5
  %155 = add nsw i32 %154, 1
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [100100 x i32], ptr @s, i64 0, i64 %156
  %158 = load i32, ptr %157, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [100100 x i32], ptr @open, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = icmp sgt i32 %161, 0
  br i1 %162, label %163, label %166

163:                                              ; preds = %133
  %164 = load i32, ptr @cnt, align 4, !tbaa !5
  %165 = add nsw i32 %164, 1
  store i32 %165, ptr @cnt, align 4, !tbaa !5
  br label %192

166:                                              ; preds = %133
  %167 = load i32, ptr %5, align 4, !tbaa !5
  %168 = add nsw i32 %167, 1
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [100100 x i32], ptr @s, i64 0, i64 %169
  %171 = load i32, ptr %170, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [100100 x i32], ptr @open, i64 0, i64 %172
  store i32 1, ptr %173, align 4, !tbaa !5
  %174 = load i32, ptr %5, align 4, !tbaa !5
  %175 = add nsw i32 %174, 1
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [100100 x i32], ptr @s, i64 0, i64 %176
  %178 = load i32, ptr %177, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [100100 x i32], ptr @sz, i64 0, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !5
  %182 = load i32, ptr %5, align 4, !tbaa !5
  %183 = add nsw i32 %182, 1
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [100100 x i32], ptr @pos, i64 0, i64 %184
  %186 = load i32, ptr %185, align 4, !tbaa !5
  %187 = sub nsw i32 %181, %186
  %188 = load i32, ptr @cnt, align 4, !tbaa !5
  %189 = add nsw i32 %188, %187
  store i32 %189, ptr @cnt, align 4, !tbaa !5
  %190 = load i32, ptr @cnt, align 4, !tbaa !5
  %191 = add nsw i32 %190, 1
  store i32 %191, ptr @cnt, align 4, !tbaa !5
  br label %192

192:                                              ; preds = %166, %163
  br label %193

193:                                              ; preds = %192, %132
  br label %194

194:                                              ; preds = %193, %77
  %195 = load i32, ptr %5, align 4, !tbaa !5
  %196 = add nsw i32 %195, 1
  store i32 %196, ptr %5, align 4, !tbaa !5
  br label %49, !llvm.loop !12

197:                                              ; preds = %53
  %198 = load i32, ptr @cnt, align 4, !tbaa !5
  %199 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %198)
  %200 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %199, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #1

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

attributes #0 = { mustprogress norecurse 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { 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++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}


; 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.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@cnt = external dso_local local_unnamed_addr global i32, align 4
@sz = external dso_local local_unnamed_addr global [100100 x i32], align 16
@s = external dso_local local_unnamed_addr global [100100 x i32], align 16
@pos = external dso_local local_unnamed_addr global [100100 x i32], align 16
@last = external dso_local local_unnamed_addr global [100100 x i32], align 16
@open = external dso_local local_unnamed_addr global [100100 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @k)
  %2 = load i32, ptr @k, align 4, !tbaa !5
  %.not33 = icmp slt i32 %2, 1
  br i1 %.not33, label %.preheader, label %.lr.ph36

.preheader:                                       ; preds = %._crit_edge, %0
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %cnt.promoted = load i32, ptr @cnt, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 1
  br i1 %4, label %.lr.ph38.preheader, label %._crit_edge39

.lr.ph38.preheader:                               ; preds = %.preheader
  %wide.trip.count = zext nneg i32 %3 to i64
  %.pre = load i32, ptr getelementptr inbounds (i8, ptr @s, i64 4), align 4, !tbaa !5
  br label %.lr.ph38

.lr.ph36:                                         ; preds = %0, %._crit_edge
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge ], [ 1, %0 ]
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @m)
  %6 = load i32, ptr @m, align 4, !tbaa !5
  %7 = getelementptr inbounds [100100 x i32], ptr @sz, i64 0, i64 %indvars.iv
  store i32 %6, ptr %7, align 4, !tbaa !5
  %.not2931 = icmp slt i32 %6, 1
  br i1 %.not2931, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.lr.ph36
  %8 = trunc nuw nsw i64 %indvars.iv to i32
  br label %.lr.ph

._crit_edge:                                      ; preds = %20, %.lr.ph36
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %9 = load i32, ptr @k, align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  %.not.not = icmp slt i64 %indvars.iv, %10
  br i1 %.not.not, label %.lr.ph36, label %.preheader, !llvm.loop !9

.lr.ph:                                           ; preds = %.lr.ph.preheader, %20
  %.02632 = phi i32 [ %21, %20 ], [ 1, %.lr.ph.preheader ]
  %11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @x)
  %12 = load i32, ptr @x, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [100100 x i32], ptr @s, i64 0, i64 %13
  store i32 %8, ptr %14, align 4, !tbaa !5
  %15 = getelementptr inbounds [100100 x i32], ptr @pos, i64 0, i64 %13
  store i32 %.02632, ptr %15, align 4, !tbaa !5
  %16 = load i32, ptr @m, align 4, !tbaa !5
  %17 = icmp eq i32 %.02632, %16
  br i1 %17, label %18, label %20

18:                                               ; preds = %.lr.ph
  %19 = getelementptr inbounds [100100 x i32], ptr @last, i64 0, i64 %13
  store i32 1, ptr %19, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %.lr.ph, %18
  %21 = add nuw nsw i32 %.02632, 1
  %.not29.not = icmp slt i32 %.02632, %16
  br i1 %.not29.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge39:                                    ; preds = %82, %.preheader
  %22 = phi i32 [ %cnt.promoted, %.preheader ], [ %83, %82 ]
  %23 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %22)
  %24 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

.lr.ph38:                                         ; preds = %.lr.ph38.preheader, %82
  %25 = phi i32 [ %.pre, %.lr.ph38.preheader ], [ %28, %82 ]
  %indvars.iv41 = phi i64 [ 1, %.lr.ph38.preheader ], [ %indvars.iv.next42, %82 ]
  %26 = phi i32 [ %cnt.promoted, %.lr.ph38.preheader ], [ %83, %82 ]
  %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
  %27 = getelementptr inbounds [100100 x i32], ptr @s, i64 0, i64 %indvars.iv.next42
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = icmp eq i32 %28, %25
  br i1 %29, label %30, label %37

30:                                               ; preds = %.lr.ph38
  %31 = sext i32 %25 to i64
  %32 = getelementptr inbounds [100100 x i32], ptr @open, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = icmp eq i32 %33, 1
  br i1 %34, label %35, label %82

35:                                               ; preds = %30
  %36 = add nsw i32 %26, 1
  br label %.sink.split

37:                                               ; preds = %.lr.ph38
  %38 = getelementptr inbounds [100100 x i32], ptr @last, i64 0, i64 %indvars.iv41
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = icmp eq i32 %39, 1
  br i1 %40, label %46, label %41

41:                                               ; preds = %37
  %42 = sext i32 %25 to i64
  %43 = getelementptr inbounds [100100 x i32], ptr @open, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = icmp eq i32 %44, 1
  br i1 %45, label %46, label %61

46:                                               ; preds = %41, %37
  %47 = sext i32 %28 to i64
  %48 = getelementptr inbounds [100100 x i32], ptr @open, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = icmp sgt i32 %49, 0
  br i1 %50, label %51, label %53

51:                                               ; preds = %46
  %52 = add nsw i32 %26, 1
  br label %.sink.split

53:                                               ; preds = %46
  store i32 1, ptr %48, align 4, !tbaa !5
  %54 = getelementptr inbounds [100100 x i32], ptr @sz, i64 0, i64 %47
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = getelementptr inbounds [100100 x i32], ptr @pos, i64 0, i64 %indvars.iv.next42
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = add i32 %55, 1
  %59 = sub i32 %58, %57
  %60 = add i32 %59, %26
  br label %.sink.split

61:                                               ; preds = %41
  store i32 1, ptr %43, align 4, !tbaa !5
  %62 = getelementptr inbounds [100100 x i32], ptr @sz, i64 0, i64 %42
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = getelementptr inbounds [100100 x i32], ptr @pos, i64 0, i64 %indvars.iv41
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = sub nsw i32 %63, %65
  %67 = add nsw i32 %26, %66
  %68 = sext i32 %28 to i64
  %69 = getelementptr inbounds [100100 x i32], ptr @open, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = icmp sgt i32 %70, 0
  br i1 %71, label %72, label %74

72:                                               ; preds = %61
  %73 = add nsw i32 %67, 1
  br label %.sink.split

74:                                               ; preds = %61
  store i32 1, ptr %69, align 4, !tbaa !5
  %75 = getelementptr inbounds [100100 x i32], ptr @sz, i64 0, i64 %68
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = getelementptr inbounds [100100 x i32], ptr @pos, i64 0, i64 %indvars.iv.next42
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = add i32 %67, 1
  %80 = add i32 %79, %76
  %81 = sub i32 %80, %78
  br label %.sink.split

.sink.split:                                      ; preds = %35, %72, %74, %51, %53
  %.sink = phi i32 [ %60, %53 ], [ %52, %51 ], [ %81, %74 ], [ %73, %72 ], [ %36, %35 ]
  store i32 %.sink, ptr @cnt, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %.sink.split, %30
  %83 = phi i32 [ %26, %30 ], [ %.sink, %.sink.split ]
  %exitcond.not = icmp eq i64 %indvars.iv.next42, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge39, label %.lr.ph38, !llvm.loop !12
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

attributes #0 = { mustprogress norecurse 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 = { nofree nounwind "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 = { 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 #4 = { 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}
!12 = distinct !{!12, !10}


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