; LLVM IR from eyangch/competitive-programming :: CSES/Additional_Problems (bit_inversions)

; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_istream" = type { ptr, i64, %"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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@sl = external dso_local global ptr, align 8
@sr = external dso_local global ptr, align 8
@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %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 i8, align 1
  %14 = alloca i8, align 1
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %19 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %20 = getelementptr i8, ptr %19, i64 -24
  %21 = load i64, ptr %20, align 8
  %22 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %21
  %23 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %22, ptr noundef null)
  %24 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11)
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 4 dereferenceable(4) @M)
  %27 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #8
  %28 = trunc i64 %27 to i32
  store i32 %28, ptr @N, align 4, !tbaa !8
  %29 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 40) #9
  %30 = load i32, ptr @N, align 4, !tbaa !8
  %31 = sub nsw i32 %30, 1
  invoke void @_ZN4segtC2Eii(ptr noundef nonnull align 8 dereferenceable(40) %29, i32 noundef 0, i32 noundef %31)
          to label %32 unwind label %42

32:                                               ; preds = %0
  store ptr %29, ptr @sl, align 8, !tbaa !11
  %33 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 40) #9
  %34 = load i32, ptr @N, align 4, !tbaa !8
  %35 = sub nsw i32 %34, 1
  invoke void @_ZN4segtC2Eii(ptr noundef nonnull align 8 dereferenceable(40) %33, i32 noundef 0, i32 noundef %35)
          to label %36 unwind label %46

36:                                               ; preds = %32
  store ptr %33, ptr @sr, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 0, ptr %4, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 0, ptr %5, align 4, !tbaa !8
  br label %37

37:                                               ; preds = %72, %36
  %38 = load i32, ptr %5, align 4, !tbaa !8
  %39 = load i32, ptr @N, align 4, !tbaa !8
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %50, label %41

41:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %75

42:                                               ; preds = %0
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %2, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %3, align 4
  call void @_ZdlPvm(ptr noundef %29, i64 noundef 40) #10
  br label %278

46:                                               ; preds = %32
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %2, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %3, align 4
  call void @_ZdlPvm(ptr noundef %33, i64 noundef 40) #10
  br label %278

50:                                               ; preds = %37
  %51 = load i32, ptr %5, align 4, !tbaa !8
  %52 = icmp sgt i32 %51, 0
  br i1 %52, label %53, label %68

53:                                               ; preds = %50
  %54 = load i32, ptr %5, align 4, !tbaa !8
  %55 = sext i32 %54 to i64
  %56 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %55)
  %57 = load i8, ptr %56, align 1, !tbaa !13
  %58 = sext i8 %57 to i32
  %59 = load i32, ptr %5, align 4, !tbaa !8
  %60 = sub nsw i32 %59, 1
  %61 = sext i32 %60 to i64
  %62 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %61)
  %63 = load i8, ptr %62, align 1, !tbaa !13
  %64 = sext i8 %63 to i32
  %65 = icmp ne i32 %58, %64
  br i1 %65, label %66, label %68

66:                                               ; preds = %53
  %67 = load i32, ptr %5, align 4, !tbaa !8
  store i32 %67, ptr %4, align 4, !tbaa !8
  br label %68

68:                                               ; preds = %66, %53, %50
  %69 = load ptr, ptr @sl, align 8, !tbaa !11
  %70 = load i32, ptr %4, align 4, !tbaa !8
  %71 = load i32, ptr %5, align 4, !tbaa !8
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %69, i32 noundef %70, i32 noundef %71, i32 noundef 1)
  br label %72

72:                                               ; preds = %68
  %73 = load i32, ptr %5, align 4, !tbaa !8
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %5, align 4, !tbaa !8
  br label %37, !llvm.loop !14

75:                                               ; preds = %41
  %76 = load i32, ptr @N, align 4, !tbaa !8
  %77 = sub nsw i32 %76, 1
  store i32 %77, ptr %4, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  %78 = load i32, ptr @N, align 4, !tbaa !8
  %79 = sub nsw i32 %78, 1
  store i32 %79, ptr %6, align 4, !tbaa !8
  br label %80

80:                                               ; preds = %108, %75
  %81 = load i32, ptr %6, align 4, !tbaa !8
  %82 = icmp sge i32 %81, 0
  br i1 %82, label %84, label %83

83:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %111

84:                                               ; preds = %80
  %85 = load i32, ptr %6, align 4, !tbaa !8
  %86 = load i32, ptr @N, align 4, !tbaa !8
  %87 = sub nsw i32 %86, 1
  %88 = icmp slt i32 %85, %87
  br i1 %88, label %89, label %104

89:                                               ; preds = %84
  %90 = load i32, ptr %6, align 4, !tbaa !8
  %91 = sext i32 %90 to i64
  %92 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %91)
  %93 = load i8, ptr %92, align 1, !tbaa !13
  %94 = sext i8 %93 to i32
  %95 = load i32, ptr %6, align 4, !tbaa !8
  %96 = add nsw i32 %95, 1
  %97 = sext i32 %96 to i64
  %98 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %97)
  %99 = load i8, ptr %98, align 1, !tbaa !13
  %100 = sext i8 %99 to i32
  %101 = icmp ne i32 %94, %100
  br i1 %101, label %102, label %104

102:                                              ; preds = %89
  %103 = load i32, ptr %6, align 4, !tbaa !8
  store i32 %103, ptr %4, align 4, !tbaa !8
  br label %104

104:                                              ; preds = %102, %89, %84
  %105 = load ptr, ptr @sr, align 8, !tbaa !11
  %106 = load i32, ptr %6, align 4, !tbaa !8
  %107 = load i32, ptr %4, align 4, !tbaa !8
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %105, i32 noundef %106, i32 noundef %107, i32 noundef 1)
  br label %108

108:                                              ; preds = %104
  %109 = load i32, ptr %6, align 4, !tbaa !8
  %110 = add nsw i32 %109, -1
  store i32 %110, ptr %6, align 4, !tbaa !8
  br label %80, !llvm.loop !16

111:                                              ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 0, ptr %7, align 4, !tbaa !8
  br label %112

112:                                              ; preds = %272, %111
  %113 = load i32, ptr %7, align 4, !tbaa !8
  %114 = load i32, ptr @M, align 4, !tbaa !8
  %115 = icmp slt i32 %113, %114
  br i1 %115, label %117, label %116

116:                                              ; preds = %112
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %275

117:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  %118 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %119 = load i32, ptr %8, align 4, !tbaa !8
  %120 = add nsw i32 %119, -1
  store i32 %120, ptr %8, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %121 = load ptr, ptr @sr, align 8, !tbaa !11
  %122 = load i32, ptr %8, align 4, !tbaa !8
  %123 = load i32, ptr %8, align 4, !tbaa !8
  %124 = call noundef i32 @_ZN4segt3qryEii(ptr noundef nonnull align 8 dereferenceable(40) %121, i32 noundef %122, i32 noundef %123)
  store i32 %124, ptr %9, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  %125 = load ptr, ptr @sl, align 8, !tbaa !11
  %126 = load i32, ptr %8, align 4, !tbaa !8
  %127 = load i32, ptr %8, align 4, !tbaa !8
  %128 = call noundef i32 @_ZN4segt3qryEii(ptr noundef nonnull align 8 dereferenceable(40) %125, i32 noundef %126, i32 noundef %127)
  store i32 %128, ptr %10, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %129 = load i32, ptr %8, align 4, !tbaa !8
  %130 = load i32, ptr %9, align 4, !tbaa !8
  %131 = sub nsw i32 %129, %130
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %11, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %133 = load i32, ptr %8, align 4, !tbaa !8
  %134 = load i32, ptr %10, align 4, !tbaa !8
  %135 = add nsw i32 %133, %134
  %136 = sub nsw i32 %135, 1
  store i32 %136, ptr %12, align 4, !tbaa !8
  %137 = load ptr, ptr @sl, align 8, !tbaa !11
  %138 = load i32, ptr %11, align 4, !tbaa !8
  %139 = load i32, ptr %8, align 4, !tbaa !8
  %140 = load i32, ptr %10, align 4, !tbaa !8
  %141 = sub nsw i32 0, %140
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %137, i32 noundef %138, i32 noundef %139, i32 noundef %141)
  %142 = load ptr, ptr @sr, align 8, !tbaa !11
  %143 = load i32, ptr %8, align 4, !tbaa !8
  %144 = load i32, ptr %12, align 4, !tbaa !8
  %145 = load i32, ptr %9, align 4, !tbaa !8
  %146 = sub nsw i32 0, %145
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %142, i32 noundef %143, i32 noundef %144, i32 noundef %146)
  %147 = load i32, ptr %8, align 4, !tbaa !8
  %148 = sext i32 %147 to i64
  %149 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %148)
  %150 = load i8, ptr %149, align 1, !tbaa !13
  %151 = sext i8 %150 to i32
  %152 = icmp eq i32 %151, 48
  %153 = zext i1 %152 to i64
  %154 = select i1 %152, i8 49, i8 48
  %155 = load i32, ptr %8, align 4, !tbaa !8
  %156 = sext i32 %155 to i64
  %157 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %156)
  store i8 %154, ptr %157, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #8
  store i8 0, ptr %13, align 1, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #8
  store i8 0, ptr %14, align 1, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 -1, ptr %15, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 -1, ptr %16, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  store i32 -1, ptr %17, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  store i32 -1, ptr %18, align 4, !tbaa !8
  %158 = load i32, ptr %8, align 4, !tbaa !8
  %159 = icmp sgt i32 %158, 0
  br i1 %159, label %160, label %185

160:                                              ; preds = %117
  %161 = load i32, ptr %8, align 4, !tbaa !8
  %162 = sext i32 %161 to i64
  %163 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %162)
  %164 = load i8, ptr %163, align 1, !tbaa !13
  %165 = sext i8 %164 to i32
  %166 = load i32, ptr %8, align 4, !tbaa !8
  %167 = sub nsw i32 %166, 1
  %168 = sext i32 %167 to i64
  %169 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %168)
  %170 = load i8, ptr %169, align 1, !tbaa !13
  %171 = sext i8 %170 to i32
  %172 = icmp eq i32 %165, %171
  br i1 %172, label %173, label %185

173:                                              ; preds = %160
  store i8 1, ptr %13, align 1, !tbaa !17
  %174 = load ptr, ptr @sr, align 8, !tbaa !11
  %175 = load i32, ptr %8, align 4, !tbaa !8
  %176 = sub nsw i32 %175, 1
  %177 = load i32, ptr %8, align 4, !tbaa !8
  %178 = sub nsw i32 %177, 1
  %179 = call noundef i32 @_ZN4segt3qryEii(ptr noundef nonnull align 8 dereferenceable(40) %174, i32 noundef %176, i32 noundef %178)
  store i32 %179, ptr %15, align 4, !tbaa !8
  %180 = load i32, ptr %8, align 4, !tbaa !8
  %181 = sub nsw i32 %180, 1
  %182 = load i32, ptr %15, align 4, !tbaa !8
  %183 = sub nsw i32 %181, %182
  %184 = add nsw i32 %183, 1
  store i32 %184, ptr %17, align 4, !tbaa !8
  br label %185

185:                                              ; preds = %173, %160, %117
  %186 = load i32, ptr %8, align 4, !tbaa !8
  %187 = load i32, ptr @N, align 4, !tbaa !8
  %188 = sub nsw i32 %187, 1
  %189 = icmp slt i32 %186, %188
  br i1 %189, label %190, label %215

190:                                              ; preds = %185
  %191 = load i32, ptr %8, align 4, !tbaa !8
  %192 = sext i32 %191 to i64
  %193 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %192)
  %194 = load i8, ptr %193, align 1, !tbaa !13
  %195 = sext i8 %194 to i32
  %196 = load i32, ptr %8, align 4, !tbaa !8
  %197 = add nsw i32 %196, 1
  %198 = sext i32 %197 to i64
  %199 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %198)
  %200 = load i8, ptr %199, align 1, !tbaa !13
  %201 = sext i8 %200 to i32
  %202 = icmp eq i32 %195, %201
  br i1 %202, label %203, label %215

203:                                              ; preds = %190
  store i8 1, ptr %14, align 1, !tbaa !17
  %204 = load ptr, ptr @sl, align 8, !tbaa !11
  %205 = load i32, ptr %8, align 4, !tbaa !8
  %206 = add nsw i32 %205, 1
  %207 = load i32, ptr %8, align 4, !tbaa !8
  %208 = add nsw i32 %207, 1
  %209 = call noundef i32 @_ZN4segt3qryEii(ptr noundef nonnull align 8 dereferenceable(40) %204, i32 noundef %206, i32 noundef %208)
  store i32 %209, ptr %16, align 4, !tbaa !8
  %210 = load i32, ptr %8, align 4, !tbaa !8
  %211 = add nsw i32 %210, 1
  %212 = load i32, ptr %16, align 4, !tbaa !8
  %213 = add nsw i32 %211, %212
  %214 = sub nsw i32 %213, 1
  store i32 %214, ptr %18, align 4, !tbaa !8
  br label %215

215:                                              ; preds = %203, %190, %185
  %216 = load i8, ptr %13, align 1, !tbaa !17, !range !19, !noundef !20
  %217 = trunc i8 %216 to i1
  br i1 %217, label %218, label %232

218:                                              ; preds = %215
  %219 = load i8, ptr %14, align 1, !tbaa !17, !range !19, !noundef !20
  %220 = trunc i8 %219 to i1
  br i1 %220, label %221, label %232

221:                                              ; preds = %218
  %222 = load ptr, ptr @sl, align 8, !tbaa !11
  %223 = load i32, ptr %17, align 4, !tbaa !8
  %224 = load i32, ptr %8, align 4, !tbaa !8
  %225 = load i32, ptr %16, align 4, !tbaa !8
  %226 = add nsw i32 %225, 1
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %222, i32 noundef %223, i32 noundef %224, i32 noundef %226)
  %227 = load ptr, ptr @sr, align 8, !tbaa !11
  %228 = load i32, ptr %8, align 4, !tbaa !8
  %229 = load i32, ptr %18, align 4, !tbaa !8
  %230 = load i32, ptr %15, align 4, !tbaa !8
  %231 = add nsw i32 %230, 1
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %227, i32 noundef %228, i32 noundef %229, i32 noundef %231)
  br label %265

232:                                              ; preds = %218, %215
  %233 = load i8, ptr %13, align 1, !tbaa !17, !range !19, !noundef !20
  %234 = trunc i8 %233 to i1
  br i1 %234, label %235, label %244

235:                                              ; preds = %232
  %236 = load ptr, ptr @sl, align 8, !tbaa !11
  %237 = load i32, ptr %17, align 4, !tbaa !8
  %238 = load i32, ptr %8, align 4, !tbaa !8
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %236, i32 noundef %237, i32 noundef %238, i32 noundef 1)
  %239 = load ptr, ptr @sr, align 8, !tbaa !11
  %240 = load i32, ptr %8, align 4, !tbaa !8
  %241 = load i32, ptr %8, align 4, !tbaa !8
  %242 = load i32, ptr %15, align 4, !tbaa !8
  %243 = add nsw i32 %242, 1
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %239, i32 noundef %240, i32 noundef %241, i32 noundef %243)
  br label %264

244:                                              ; preds = %232
  %245 = load i8, ptr %14, align 1, !tbaa !17, !range !19, !noundef !20
  %246 = trunc i8 %245 to i1
  br i1 %246, label %247, label %256

247:                                              ; preds = %244
  %248 = load ptr, ptr @sl, align 8, !tbaa !11
  %249 = load i32, ptr %8, align 4, !tbaa !8
  %250 = load i32, ptr %8, align 4, !tbaa !8
  %251 = load i32, ptr %16, align 4, !tbaa !8
  %252 = add nsw i32 %251, 1
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %248, i32 noundef %249, i32 noundef %250, i32 noundef %252)
  %253 = load ptr, ptr @sr, align 8, !tbaa !11
  %254 = load i32, ptr %8, align 4, !tbaa !8
  %255 = load i32, ptr %18, align 4, !tbaa !8
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %253, i32 noundef %254, i32 noundef %255, i32 noundef 1)
  br label %263

256:                                              ; preds = %244
  %257 = load ptr, ptr @sl, align 8, !tbaa !11
  %258 = load i32, ptr %8, align 4, !tbaa !8
  %259 = load i32, ptr %8, align 4, !tbaa !8
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %257, i32 noundef %258, i32 noundef %259, i32 noundef 1)
  %260 = load ptr, ptr @sr, align 8, !tbaa !11
  %261 = load i32, ptr %8, align 4, !tbaa !8
  %262 = load i32, ptr %8, align 4, !tbaa !8
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %260, i32 noundef %261, i32 noundef %262, i32 noundef 1)
  br label %263

263:                                              ; preds = %256, %247
  br label %264

264:                                              ; preds = %263, %235
  br label %265

265:                                              ; preds = %264, %221
  %266 = load ptr, ptr @sr, align 8, !tbaa !11
  %267 = load i32, ptr @N, align 4, !tbaa !8
  %268 = sub nsw i32 %267, 1
  %269 = call noundef i32 @_ZN4segt3qryEii(ptr noundef nonnull align 8 dereferenceable(40) %266, i32 noundef 0, i32 noundef %268)
  %270 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %269)
  %271 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %270, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %272

272:                                              ; preds = %265
  %273 = load i32, ptr %7, align 4, !tbaa !8
  %274 = add nsw i32 %273, 1
  store i32 %274, ptr %7, align 4, !tbaa !8
  br label %112, !llvm.loop !21

275:                                              ; preds = %116
  %276 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  %277 = load i32, ptr %1, align 4
  ret i32 %277

278:                                              ; preds = %46, %42
  %279 = load ptr, ptr %2, align 8
  %280 = load i32, ptr %3, align 4
  %281 = insertvalue { ptr, i32 } poison, ptr %279, 0
  %282 = insertvalue { ptr, i32 } %281, i32 %280, 1
  resume { ptr, i32 } %282
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4segtC2Eii(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef, i32 noundef) unnamed_addr #4 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #5

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef, i32 noundef, i32 noundef) #4 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4segt3qryEii(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef, i32 noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #7

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

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 = { mustprogress 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 = { nobuiltin allocsize(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 = { 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 = { nobuiltin 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 #6 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !10, i64 0}
!13 = !{!10, !10, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = !{!18, !18, i64 0}
!18 = !{!"bool", !10, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !15}


; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_istream" = type { ptr, i64, %"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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@sl = external dso_local local_unnamed_addr global ptr, align 8
@sr = external dso_local local_unnamed_addr global ptr, align 8
@N = external dso_local local_unnamed_addr global i32, align 4
@M = external dso_local global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %8 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11)
  %9 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(4) @M)
  %10 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #8
  %11 = trunc i64 %10 to i32
  store i32 %11, ptr @N, align 4, !tbaa !8
  %12 = tail call noalias noundef nonnull dereferenceable(40) ptr @_Znwm(i64 noundef 40) #9
  %13 = add nsw i32 %11, -1
  invoke void @_ZN4segtC2Eii(ptr noundef nonnull align 8 dereferenceable(40) %12, i32 noundef 0, i32 noundef %13)
          to label %14 unwind label %26

14:                                               ; preds = %0
  store ptr %12, ptr @sl, align 8, !tbaa !11
  %15 = tail call noalias noundef nonnull dereferenceable(40) ptr @_Znwm(i64 noundef 40) #9
  %16 = load i32, ptr @N, align 4, !tbaa !8
  %17 = add nsw i32 %16, -1
  invoke void @_ZN4segtC2Eii(ptr noundef nonnull align 8 dereferenceable(40) %15, i32 noundef 0, i32 noundef %17)
          to label %18 unwind label %28

18:                                               ; preds = %14
  store ptr %15, ptr @sr, align 8, !tbaa !11
  %19 = load i32, ptr @N, align 4, !tbaa !8
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph.preheader._crit_edge, label %.preheader

.lr.ph.preheader._crit_edge:                      ; preds = %18
  %.pre = load ptr, ptr @sl, align 8, !tbaa !11
  tail call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %.pre, i32 noundef 0, i32 noundef 0, i32 noundef 1)
  %21 = load i32, ptr @N, align 4, !tbaa !8
  %22 = icmp sgt i32 %21, 1
  br i1 %22, label %.lr.ph.peel.next, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.peel.next, %.lr.ph.preheader._crit_edge
  %.lcssa = phi i32 [ %21, %.lr.ph.preheader._crit_edge ], [ %37, %.lr.ph.peel.next ]
  %23 = icmp sgt i32 %.lcssa, 0
  br i1 %23, label %.lr.ph83.preheader, label %.preheader

.lr.ph83.preheader:                               ; preds = %._crit_edge
  %24 = add nsw i32 %.lcssa, -1
  %25 = zext nneg i32 %24 to i64
  br label %.lr.ph83

26:                                               ; preds = %0
  %27 = landingpad { ptr, i32 }
          cleanup
  br label %151

28:                                               ; preds = %14
  %29 = landingpad { ptr, i32 }
          cleanup
  br label %151

.lr.ph.peel.next:                                 ; preds = %.lr.ph.preheader._crit_edge, %.lr.ph.peel.next
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph.peel.next ], [ 1, %.lr.ph.preheader._crit_edge ]
  %.04779 = phi i32 [ %spec.select, %.lr.ph.peel.next ], [ 0, %.lr.ph.preheader._crit_edge ]
  %30 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %indvars.iv)
  %31 = load i8, ptr %30, align 1, !tbaa !13
  %32 = add nsw i64 %indvars.iv, -1
  %33 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %32)
  %34 = load i8, ptr %33, align 1, !tbaa !13
  %.not56 = icmp eq i8 %31, %34
  %35 = trunc nuw nsw i64 %indvars.iv to i32
  %spec.select = select i1 %.not56, i32 %.04779, i32 %35
  %36 = load ptr, ptr @sl, align 8, !tbaa !11
  tail call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %36, i32 noundef %spec.select, i32 noundef %35, i32 noundef 1)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %37 = load i32, ptr @N, align 4, !tbaa !8
  %38 = sext i32 %37 to i64
  %39 = icmp slt i64 %indvars.iv.next, %38
  br i1 %39, label %.lr.ph.peel.next, label %._crit_edge, !llvm.loop !14

.preheader:                                       ; preds = %53, %18, %._crit_edge
  %40 = load i32, ptr @M, align 4, !tbaa !8
  %41 = icmp sgt i32 %40, 0
  br i1 %41, label %.lr.ph85, label %._crit_edge86

.lr.ph83:                                         ; preds = %.lr.ph83.preheader, %53
  %indvars.iv90 = phi i64 [ %25, %.lr.ph83.preheader ], [ %indvars.iv.next91, %53 ]
  %.281 = phi i32 [ %24, %.lr.ph83.preheader ], [ %.3, %53 ]
  %42 = load i32, ptr @N, align 4, !tbaa !8
  %43 = add nsw i32 %42, -1
  %44 = sext i32 %43 to i64
  %45 = icmp slt i64 %indvars.iv90, %44
  br i1 %45, label %46, label %.lr.ph83._crit_edge

.lr.ph83._crit_edge:                              ; preds = %.lr.ph83
  %.pre95 = trunc nuw nsw i64 %indvars.iv90 to i32
  br label %53

46:                                               ; preds = %.lr.ph83
  %47 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %indvars.iv90)
  %48 = load i8, ptr %47, align 1, !tbaa !13
  %49 = add nuw nsw i64 %indvars.iv90, 1
  %50 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %49)
  %51 = load i8, ptr %50, align 1, !tbaa !13
  %.not = icmp eq i8 %48, %51
  %52 = trunc nuw nsw i64 %indvars.iv90 to i32
  %spec.select57 = select i1 %.not, i32 %.281, i32 %52
  br label %53

53:                                               ; preds = %.lr.ph83._crit_edge, %46
  %.pre-phi96 = phi i32 [ %.pre95, %.lr.ph83._crit_edge ], [ %52, %46 ]
  %.3 = phi i32 [ %.281, %.lr.ph83._crit_edge ], [ %spec.select57, %46 ]
  %54 = load ptr, ptr @sr, align 8, !tbaa !11
  tail call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %54, i32 noundef %.pre-phi96, i32 noundef %.3, i32 noundef 1)
  %indvars.iv.next91 = add nsw i64 %indvars.iv90, -1
  %55 = icmp sgt i64 %indvars.iv90, 0
  br i1 %55, label %.lr.ph83, label %.preheader, !llvm.loop !17

._crit_edge86:                                    ; preds = %141, %.preheader
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.2)
  ret i32 0

.lr.ph85:                                         ; preds = %.preheader, %141
  %.04984 = phi i32 [ %148, %141 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %57 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %58 = load i32, ptr %1, align 4, !tbaa !8
  %59 = add nsw i32 %58, -1
  store i32 %59, ptr %1, align 4, !tbaa !8
  %60 = load ptr, ptr @sr, align 8, !tbaa !11
  %61 = call noundef i32 @_ZN4segt3qryEii(ptr noundef nonnull align 8 dereferenceable(40) %60, i32 noundef %59, i32 noundef %59)
  %62 = sub i32 0, %61
  %63 = load ptr, ptr @sl, align 8, !tbaa !11
  %64 = load i32, ptr %1, align 4, !tbaa !8
  %65 = call noundef i32 @_ZN4segt3qryEii(ptr noundef nonnull align 8 dereferenceable(40) %63, i32 noundef %64, i32 noundef %64)
  %66 = load i32, ptr %1, align 4, !tbaa !8
  %reass.sub = sub i32 %66, %61
  %67 = add i32 %reass.sub, 1
  %68 = add i32 %65, -1
  %69 = add i32 %68, %66
  %70 = load ptr, ptr @sl, align 8, !tbaa !11
  %71 = sub nsw i32 0, %65
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %70, i32 noundef %67, i32 noundef %66, i32 noundef %71)
  %72 = load ptr, ptr @sr, align 8, !tbaa !11
  %73 = load i32, ptr %1, align 4, !tbaa !8
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %72, i32 noundef %73, i32 noundef %69, i32 noundef %62)
  %74 = load i32, ptr %1, align 4, !tbaa !8
  %75 = sext i32 %74 to i64
  %76 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %75)
  %77 = load i8, ptr %76, align 1, !tbaa !13
  %78 = icmp eq i8 %77, 48
  %79 = select i1 %78, i8 49, i8 48
  %80 = load i32, ptr %1, align 4, !tbaa !8
  %81 = sext i32 %80 to i64
  %82 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %81)
  store i8 %79, ptr %82, align 1, !tbaa !13
  %83 = load i32, ptr %1, align 4, !tbaa !8
  %84 = icmp sgt i32 %83, 0
  br i1 %84, label %85, label %101

85:                                               ; preds = %.lr.ph85
  %86 = zext nneg i32 %83 to i64
  %87 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %86)
  %88 = load i8, ptr %87, align 1, !tbaa !13
  %89 = load i32, ptr %1, align 4, !tbaa !8
  %90 = add nsw i32 %89, -1
  %91 = sext i32 %90 to i64
  %92 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %91)
  %93 = load i8, ptr %92, align 1, !tbaa !13
  %94 = icmp eq i8 %88, %93
  %.pre93 = load i32, ptr %1, align 4, !tbaa !8
  br i1 %94, label %95, label %101

95:                                               ; preds = %85
  %96 = load ptr, ptr @sr, align 8, !tbaa !11
  %97 = add nsw i32 %.pre93, -1
  %98 = call noundef i32 @_ZN4segt3qryEii(ptr noundef nonnull align 8 dereferenceable(40) %96, i32 noundef %97, i32 noundef %97)
  %99 = load i32, ptr %1, align 4, !tbaa !8
  %100 = sub i32 %99, %98
  br label %101

101:                                              ; preds = %95, %85, %.lr.ph85
  %102 = phi i32 [ %99, %95 ], [ %.pre93, %85 ], [ %83, %.lr.ph85 ]
  %.044 = phi i1 [ true, %95 ], [ false, %85 ], [ false, %.lr.ph85 ]
  %.042 = phi i32 [ %98, %95 ], [ -1, %85 ], [ -1, %.lr.ph85 ]
  %.040 = phi i32 [ %100, %95 ], [ -1, %85 ], [ -1, %.lr.ph85 ]
  %103 = load i32, ptr @N, align 4, !tbaa !8
  %104 = add nsw i32 %103, -1
  %105 = icmp slt i32 %102, %104
  br i1 %105, label %106, label %.thread67

106:                                              ; preds = %101
  %107 = sext i32 %102 to i64
  %108 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %107)
  %109 = load i8, ptr %108, align 1, !tbaa !13
  %110 = load i32, ptr %1, align 4, !tbaa !8
  %111 = add nsw i32 %110, 1
  %112 = sext i32 %111 to i64
  %113 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %112)
  %114 = load i8, ptr %113, align 1, !tbaa !13
  %115 = icmp eq i8 %109, %114
  br i1 %115, label %116, label %.thread67

116:                                              ; preds = %106
  %117 = load ptr, ptr @sl, align 8, !tbaa !11
  %118 = load i32, ptr %1, align 4, !tbaa !8
  %119 = add nsw i32 %118, 1
  %120 = call noundef i32 @_ZN4segt3qryEii(ptr noundef nonnull align 8 dereferenceable(40) %117, i32 noundef %119, i32 noundef %119)
  %121 = load i32, ptr %1, align 4, !tbaa !8
  %122 = add i32 %121, %120
  %123 = load ptr, ptr @sl, align 8, !tbaa !11
  %124 = add nsw i32 %120, 1
  br i1 %.044, label %125, label %135

125:                                              ; preds = %116
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %123, i32 noundef %.040, i32 noundef %121, i32 noundef %124)
  %126 = load ptr, ptr @sr, align 8, !tbaa !11
  %127 = load i32, ptr %1, align 4, !tbaa !8
  %128 = add nsw i32 %.042, 1
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %126, i32 noundef %127, i32 noundef %122, i32 noundef %128)
  br label %141

.thread67:                                        ; preds = %101, %106
  %129 = load ptr, ptr @sl, align 8, !tbaa !11
  %130 = load i32, ptr %1, align 4, !tbaa !8
  br i1 %.044, label %131, label %138

131:                                              ; preds = %.thread67
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %129, i32 noundef %.040, i32 noundef %130, i32 noundef 1)
  %132 = load ptr, ptr @sr, align 8, !tbaa !11
  %133 = load i32, ptr %1, align 4, !tbaa !8
  %134 = add nsw i32 %.042, 1
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %132, i32 noundef %133, i32 noundef %133, i32 noundef %134)
  br label %141

135:                                              ; preds = %116
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %123, i32 noundef %121, i32 noundef %121, i32 noundef %124)
  %136 = load ptr, ptr @sr, align 8, !tbaa !11
  %137 = load i32, ptr %1, align 4, !tbaa !8
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %136, i32 noundef %137, i32 noundef %122, i32 noundef 1)
  br label %141

138:                                              ; preds = %.thread67
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %129, i32 noundef %130, i32 noundef %130, i32 noundef 1)
  %139 = load ptr, ptr @sr, align 8, !tbaa !11
  %140 = load i32, ptr %1, align 4, !tbaa !8
  call void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40) %139, i32 noundef %140, i32 noundef %140, i32 noundef 1)
  br label %141

141:                                              ; preds = %131, %138, %135, %125
  %142 = load ptr, ptr @sr, align 8, !tbaa !11
  %143 = load i32, ptr @N, align 4, !tbaa !8
  %144 = add nsw i32 %143, -1
  %145 = call noundef i32 @_ZN4segt3qryEii(ptr noundef nonnull align 8 dereferenceable(40) %142, i32 noundef 0, i32 noundef %144)
  %146 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %145)
  %147 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %146, ptr noundef nonnull @.str)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  %148 = add nuw nsw i32 %.04984, 1
  %149 = load i32, ptr @M, align 4, !tbaa !8
  %150 = icmp slt i32 %148, %149
  br i1 %150, label %.lr.ph85, label %._crit_edge86, !llvm.loop !18

151:                                              ; preds = %28, %26
  %.sink = phi ptr [ %15, %28 ], [ %12, %26 ]
  %.pn = phi { ptr, i32 } [ %29, %28 ], [ %27, %26 ]
  tail call void @_ZdlPvm(ptr noundef nonnull %.sink, i64 noundef 40) #10
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4segtC2Eii(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef, i32 noundef) unnamed_addr #4 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #5

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4segt3updEiii(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4segt3qryEii(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef, i32 noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #7

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

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


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