; LLVM IR from chirag-singhal/Coding-Interview-101 :: Miscellaneous/Dynamic Programming (wildcard)

; 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 }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [26 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.1 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1

; 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 ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  %15 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = add nsw i32 %17, 1
  %19 = zext i32 %18 to i64
  %20 = call ptr @llvm.stacksave.p0()
  store ptr %20, ptr %4, align 8
  %21 = alloca i8, i64 %19, align 16
  store i64 %19, ptr %5, align 8
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef %21)
  %24 = 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)
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  %28 = zext i32 %27 to i64
  %29 = alloca i8, i64 %28, align 16
  store i64 %28, ptr %6, align 8
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef %29)
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  %34 = zext i32 %33 to i64
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  %37 = zext i32 %36 to i64
  %38 = mul nuw i64 %34, %37
  %39 = alloca i8, i64 %38, align 16
  store i64 %34, ptr %7, align 8
  store i64 %37, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %63, %0
  %41 = load i32, ptr %9, align 4, !tbaa !5
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = icmp sle i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  store i32 2, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %66

45:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %59, %45
  %47 = load i32, ptr %11, align 4, !tbaa !5
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = icmp sle i32 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %62

51:                                               ; preds = %46
  %52 = load i32, ptr %9, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = mul nsw i64 %53, %37
  %55 = getelementptr inbounds i8, ptr %39, i64 %54
  %56 = load i32, ptr %11, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds i8, ptr %55, i64 %57
  store i8 0, ptr %58, align 1, !tbaa !9
  br label %59

59:                                               ; preds = %51
  %60 = load i32, ptr %11, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %11, align 4, !tbaa !5
  br label %46, !llvm.loop !11

62:                                               ; preds = %50
  br label %63

63:                                               ; preds = %62
  %64 = load i32, ptr %9, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %9, align 4, !tbaa !5
  br label %40, !llvm.loop !13

66:                                               ; preds = %44
  %67 = mul nsw i64 0, %37
  %68 = getelementptr inbounds i8, ptr %39, i64 %67
  %69 = getelementptr inbounds i8, ptr %68, i64 0
  store i8 1, ptr %69, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %99, %66
  %71 = load i32, ptr %12, align 4, !tbaa !5
  %72 = load i32, ptr %3, align 4, !tbaa !5
  %73 = icmp sle i32 %71, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %70
  store i32 8, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %102

75:                                               ; preds = %70
  %76 = load i32, ptr %12, align 4, !tbaa !5
  %77 = sub nsw i32 %76, 1
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds i8, ptr %29, i64 %78
  %80 = load i8, ptr %79, align 1, !tbaa !14
  %81 = sext i8 %80 to i32
  %82 = icmp eq i32 %81, 42
  br i1 %82, label %83, label %98

83:                                               ; preds = %75
  %84 = mul nsw i64 0, %37
  %85 = getelementptr inbounds i8, ptr %39, i64 %84
  %86 = load i32, ptr %12, align 4, !tbaa !5
  %87 = sub nsw i32 %86, 1
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds i8, ptr %85, i64 %88
  %90 = load i8, ptr %89, align 1, !tbaa !9, !range !15, !noundef !16
  %91 = trunc i8 %90 to i1
  %92 = mul nsw i64 0, %37
  %93 = getelementptr inbounds i8, ptr %39, i64 %92
  %94 = load i32, ptr %12, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds i8, ptr %93, i64 %95
  %97 = zext i1 %91 to i8
  store i8 %97, ptr %96, align 1, !tbaa !9
  br label %98

98:                                               ; preds = %83, %75
  br label %99

99:                                               ; preds = %98
  %100 = load i32, ptr %12, align 4, !tbaa !5
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %12, align 4, !tbaa !5
  br label %70, !llvm.loop !17

102:                                              ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %210, %102
  %104 = load i32, ptr %13, align 4, !tbaa !5
  %105 = load i32, ptr %2, align 4, !tbaa !5
  %106 = icmp sle i32 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  store i32 11, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %213

108:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %109

109:                                              ; preds = %206, %108
  %110 = load i32, ptr %14, align 4, !tbaa !5
  %111 = load i32, ptr %3, align 4, !tbaa !5
  %112 = icmp sle i32 %110, %111
  br i1 %112, label %114, label %113

113:                                              ; preds = %109
  store i32 14, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %209

114:                                              ; preds = %109
  %115 = load i32, ptr %14, align 4, !tbaa !5
  %116 = sub nsw i32 %115, 1
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds i8, ptr %29, i64 %117
  %119 = load i8, ptr %118, align 1, !tbaa !14
  %120 = sext i8 %119 to i32
  %121 = icmp eq i32 %120, 42
  br i1 %121, label %122, label %154

122:                                              ; preds = %114
  %123 = load i32, ptr %13, align 4, !tbaa !5
  %124 = sub nsw i32 %123, 1
  %125 = sext i32 %124 to i64
  %126 = mul nsw i64 %125, %37
  %127 = getelementptr inbounds i8, ptr %39, i64 %126
  %128 = load i32, ptr %14, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds i8, ptr %127, i64 %129
  %131 = load i8, ptr %130, align 1, !tbaa !9, !range !15, !noundef !16
  %132 = trunc i8 %131 to i1
  br i1 %132, label %144, label %133

133:                                              ; preds = %122
  %134 = load i32, ptr %13, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = mul nsw i64 %135, %37
  %137 = getelementptr inbounds i8, ptr %39, i64 %136
  %138 = load i32, ptr %14, align 4, !tbaa !5
  %139 = sub nsw i32 %138, 1
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds i8, ptr %137, i64 %140
  %142 = load i8, ptr %141, align 1, !tbaa !9, !range !15, !noundef !16
  %143 = trunc i8 %142 to i1
  br label %144

144:                                              ; preds = %133, %122
  %145 = phi i1 [ true, %122 ], [ %143, %133 ]
  %146 = load i32, ptr %13, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = mul nsw i64 %147, %37
  %149 = getelementptr inbounds i8, ptr %39, i64 %148
  %150 = load i32, ptr %14, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds i8, ptr %149, i64 %151
  %153 = zext i1 %145 to i8
  store i8 %153, ptr %152, align 1, !tbaa !9
  br label %205

154:                                              ; preds = %114
  %155 = load i32, ptr %14, align 4, !tbaa !5
  %156 = sub nsw i32 %155, 1
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds i8, ptr %29, i64 %157
  %159 = load i8, ptr %158, align 1, !tbaa !14
  %160 = sext i8 %159 to i32
  %161 = icmp eq i32 %160, 63
  br i1 %161, label %176, label %162

162:                                              ; preds = %154
  %163 = load i32, ptr %14, align 4, !tbaa !5
  %164 = sub nsw i32 %163, 1
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds i8, ptr %29, i64 %165
  %167 = load i8, ptr %166, align 1, !tbaa !14
  %168 = sext i8 %167 to i32
  %169 = load i32, ptr %13, align 4, !tbaa !5
  %170 = sub nsw i32 %169, 1
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds i8, ptr %21, i64 %171
  %173 = load i8, ptr %172, align 1, !tbaa !14
  %174 = sext i8 %173 to i32
  %175 = icmp eq i32 %168, %174
  br i1 %175, label %176, label %196

176:                                              ; preds = %162, %154
  %177 = load i32, ptr %13, align 4, !tbaa !5
  %178 = sub nsw i32 %177, 1
  %179 = sext i32 %178 to i64
  %180 = mul nsw i64 %179, %37
  %181 = getelementptr inbounds i8, ptr %39, i64 %180
  %182 = load i32, ptr %14, align 4, !tbaa !5
  %183 = sub nsw i32 %182, 1
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds i8, ptr %181, i64 %184
  %186 = load i8, ptr %185, align 1, !tbaa !9, !range !15, !noundef !16
  %187 = trunc i8 %186 to i1
  %188 = load i32, ptr %13, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = mul nsw i64 %189, %37
  %191 = getelementptr inbounds i8, ptr %39, i64 %190
  %192 = load i32, ptr %14, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds i8, ptr %191, i64 %193
  %195 = zext i1 %187 to i8
  store i8 %195, ptr %194, align 1, !tbaa !9
  br label %204

196:                                              ; preds = %162
  %197 = load i32, ptr %13, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = mul nsw i64 %198, %37
  %200 = getelementptr inbounds i8, ptr %39, i64 %199
  %201 = load i32, ptr %14, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds i8, ptr %200, i64 %202
  store i8 0, ptr %203, align 1, !tbaa !9
  br label %204

204:                                              ; preds = %196, %176
  br label %205

205:                                              ; preds = %204, %144
  br label %206

206:                                              ; preds = %205
  %207 = load i32, ptr %14, align 4, !tbaa !5
  %208 = add nsw i32 %207, 1
  store i32 %208, ptr %14, align 4, !tbaa !5
  br label %109, !llvm.loop !18

209:                                              ; preds = %113
  br label %210

210:                                              ; preds = %209
  %211 = load i32, ptr %13, align 4, !tbaa !5
  %212 = add nsw i32 %211, 1
  store i32 %212, ptr %13, align 4, !tbaa !5
  br label %103, !llvm.loop !19

213:                                              ; preds = %107
  %214 = load i32, ptr %2, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = mul nsw i64 %215, %37
  %217 = getelementptr inbounds i8, ptr %39, i64 %216
  %218 = load i32, ptr %3, align 4, !tbaa !5
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds i8, ptr %217, i64 %219
  %221 = load i8, ptr %220, align 1, !tbaa !9, !range !15, !noundef !16
  %222 = trunc i8 %221 to i1
  br i1 %222, label %223, label %226

223:                                              ; preds = %213
  %224 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.4)
  %225 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %224, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %229

226:                                              ; preds = %213
  %227 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.5)
  %228 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %227, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %229

229:                                              ; preds = %226, %223
  store i32 0, ptr %1, align 4
  store i32 1, ptr %10, align 4
  %230 = load ptr, ptr %4, align 8
  call void @llvm.stackrestore.p0(ptr %230)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %231 = load i32, ptr %1, align 4
  ret i32 %231
}

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull) #2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5 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)) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = { nocallback nofree nosync nounwind willreturn }
attributes #5 = { 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 #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!7, !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!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.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 }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [26 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.1 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %3 = tail 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)
  %4 = 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)
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = add nsw i32 %5, 1
  %7 = zext i32 %6 to i64
  %8 = call ptr @llvm.stacksave.p0()
  %9 = alloca i8, i64 %7, align 16
  %10 = 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.1)
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef %9)
  %12 = 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)
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = add nsw i32 %14, 1
  %16 = zext i32 %15 to i64
  %17 = alloca i8, i64 %16, align 16
  %18 = 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.3)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef %17)
  %20 = load i32, ptr %1, align 4, !tbaa !5
  %21 = add i32 %20, 1
  %22 = zext i32 %21 to i64
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = add i32 %23, 1
  %25 = zext i32 %24 to i64
  %26 = mul nuw i64 %25, %22
  %27 = alloca i8, i64 %26, align 16
  %.not46 = icmp slt i32 %20, 0
  br i1 %.not46, label %._crit_edge48, label %.preheader43.lr.ph

.preheader43.lr.ph:                               ; preds = %0
  %.not4144 = icmp slt i32 %23, 0
  br i1 %.not4144, label %.preheader.lr.ph.thread, label %.preheader43.preheader

.preheader.lr.ph.thread:                          ; preds = %.preheader43.lr.ph
  store i8 1, ptr %27, align 16, !tbaa !9
  br label %._crit_edge58

.preheader43.preheader:                           ; preds = %.preheader43.lr.ph
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %27, i8 0, i64 %26, i1 false), !tbaa !9
  br label %._crit_edge48

._crit_edge48:                                    ; preds = %.preheader43.preheader, %0
  store i8 1, ptr %27, align 16, !tbaa !9
  %.not3849 = icmp slt i32 %23, 1
  br i1 %.not3849, label %.preheader42, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %._crit_edge48
  %28 = add nsw i64 %25, -1
  %xtraiter = and i64 %28, 1
  %29 = icmp eq i32 %24, 2
  br i1 %29, label %.preheader42.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %28, -2
  %invariant.gep85 = getelementptr inbounds i8, ptr %27, i64 1
  br label %.lr.ph

.preheader42.loopexit.unr-lcssa:                  ; preds = %53, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next.1, %53 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader42, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %.preheader42.loopexit.unr-lcssa
  %30 = add nsw i64 %indvars.iv.unr, -1
  %31 = getelementptr inbounds i8, ptr %17, i64 %30
  %32 = load i8, ptr %31, align 1, !tbaa !11
  %33 = icmp eq i8 %32, 42
  br i1 %33, label %34, label %.preheader42

34:                                               ; preds = %.lr.ph.epil
  %35 = getelementptr inbounds i8, ptr %27, i64 %30
  %36 = load i8, ptr %35, align 1, !tbaa !9, !range !12, !noundef !13
  %37 = getelementptr inbounds i8, ptr %27, i64 %indvars.iv.unr
  store i8 %36, ptr %37, align 1, !tbaa !9
  br label %.preheader42

.preheader42:                                     ; preds = %.preheader42.loopexit.unr-lcssa, %34, %.lr.ph.epil, %._crit_edge48
  br i1 %.not46, label %._crit_edge58, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %.preheader42
  %invariant.gep = getelementptr i8, ptr %9, i64 -1
  %.not4052 = icmp slt i32 %23, 0
  br i1 %.not4052, label %._crit_edge58, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader.lr.ph
  %xtraiter81 = and i64 %25, 1
  %38 = icmp eq i32 %23, 0
  %unroll_iter83 = and i64 %25, 4294967294
  %lcmp.mod82.not = icmp eq i64 %xtraiter81, 0
  br label %.preheader

.lr.ph:                                           ; preds = %53, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader.new ], [ %indvars.iv.next.1, %53 ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %53 ]
  %39 = add nsw i64 %indvars.iv, -1
  %40 = getelementptr inbounds i8, ptr %17, i64 %39
  %41 = load i8, ptr %40, align 1, !tbaa !11
  %42 = icmp eq i8 %41, 42
  br i1 %42, label %43, label %.lr.ph.1

43:                                               ; preds = %.lr.ph
  %44 = getelementptr inbounds i8, ptr %27, i64 %39
  %45 = load i8, ptr %44, align 1, !tbaa !9, !range !12, !noundef !13
  %46 = getelementptr inbounds i8, ptr %27, i64 %indvars.iv
  store i8 %45, ptr %46, align 1, !tbaa !9
  br label %.lr.ph.1

.lr.ph.1:                                         ; preds = %.lr.ph, %43
  %47 = getelementptr inbounds i8, ptr %17, i64 %indvars.iv
  %48 = load i8, ptr %47, align 1, !tbaa !11
  %49 = icmp eq i8 %48, 42
  br i1 %49, label %50, label %53

50:                                               ; preds = %.lr.ph.1
  %51 = getelementptr inbounds i8, ptr %27, i64 %indvars.iv
  %52 = load i8, ptr %51, align 1, !tbaa !9, !range !12, !noundef !13
  %gep86 = getelementptr inbounds i8, ptr %invariant.gep85, i64 %indvars.iv
  store i8 %52, ptr %gep86, align 1, !tbaa !9
  br label %53

53:                                               ; preds = %50, %.lr.ph.1
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.preheader42.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !14

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge55
  %indvars.iv69 = phi i64 [ %indvars.iv.next70, %._crit_edge55 ], [ 0, %.preheader.preheader ]
  %54 = add nsw i64 %indvars.iv69, -1
  %55 = mul nsw i64 %54, %25
  %56 = getelementptr inbounds i8, ptr %27, i64 %55
  %57 = mul nuw nsw i64 %indvars.iv69, %25
  %58 = getelementptr inbounds i8, ptr %27, i64 %57
  %gep = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv69
  br i1 %38, label %._crit_edge55.unr-lcssa, label %.preheader.new

._crit_edge58:                                    ; preds = %._crit_edge55, %.preheader.lr.ph, %.preheader.lr.ph.thread, %.preheader42
  %59 = sext i32 %20 to i64
  %60 = mul nsw i64 %25, %59
  %61 = getelementptr inbounds i8, ptr %27, i64 %60
  %62 = sext i32 %23 to i64
  %63 = getelementptr inbounds i8, ptr %61, i64 %62
  %64 = load i8, ptr %63, align 1, !tbaa !9, !range !12, !noundef !13
  %65 = trunc nuw i8 %64 to i1
  %.str.4..str.5 = select i1 %65, ptr @.str.4, ptr @.str.5
  %66 = 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.4..str.5)
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %66, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.stackrestore.p0(ptr %8)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0

._crit_edge55.unr-lcssa:                          ; preds = %106, %.preheader
  %indvars.iv64.unr = phi i64 [ 0, %.preheader ], [ %indvars.iv.next65.1, %106 ]
  br i1 %lcmp.mod82.not, label %._crit_edge55, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge55.unr-lcssa
  %68 = add nsw i64 %indvars.iv64.unr, -1
  %69 = getelementptr inbounds i8, ptr %17, i64 %68
  %70 = load i8, ptr %69, align 1, !tbaa !11
  switch i8 %70, label %75 [
    i8 42, label %71
    i8 63, label %.sink.split.epil
  ]

71:                                               ; preds = %.epil.preheader
  %72 = getelementptr inbounds i8, ptr %56, i64 %indvars.iv64.unr
  %73 = load i8, ptr %72, align 1, !tbaa !9, !range !12, !noundef !13
  %74 = trunc nuw i8 %73 to i1
  br i1 %74, label %._crit_edge55.epilog-lcssa, label %.sink.split.epil

75:                                               ; preds = %.epil.preheader
  %76 = load i8, ptr %gep, align 1, !tbaa !11
  %77 = icmp eq i8 %70, %76
  br i1 %77, label %.sink.split.epil, label %._crit_edge55.epilog-lcssa

.sink.split.epil:                                 ; preds = %75, %71, %.epil.preheader
  %.sink80.epil = phi ptr [ %58, %71 ], [ %56, %.epil.preheader ], [ %56, %75 ]
  %78 = getelementptr inbounds i8, ptr %.sink80.epil, i64 %68
  %79 = load i8, ptr %78, align 1, !tbaa !9, !range !12, !noundef !13
  br label %._crit_edge55.epilog-lcssa

._crit_edge55.epilog-lcssa:                       ; preds = %.sink.split.epil, %75, %71
  %.sink.epil = phi i8 [ 1, %71 ], [ 0, %75 ], [ %79, %.sink.split.epil ]
  %80 = getelementptr inbounds i8, ptr %58, i64 %indvars.iv64.unr
  store i8 %.sink.epil, ptr %80, align 1, !tbaa !9
  br label %._crit_edge55

._crit_edge55:                                    ; preds = %._crit_edge55.unr-lcssa, %._crit_edge55.epilog-lcssa
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %exitcond73.not = icmp eq i64 %indvars.iv.next70, %22
  br i1 %exitcond73.not, label %._crit_edge58, label %.preheader, !llvm.loop !16

.preheader.new:                                   ; preds = %.preheader, %106
  %indvars.iv64 = phi i64 [ %indvars.iv.next65.1, %106 ], [ 0, %.preheader ]
  %niter84 = phi i64 [ %niter84.next.1, %106 ], [ 0, %.preheader ]
  %81 = add nsw i64 %indvars.iv64, -1
  %82 = getelementptr inbounds i8, ptr %17, i64 %81
  %83 = load i8, ptr %82, align 1, !tbaa !11
  switch i8 %83, label %88 [
    i8 42, label %84
    i8 63, label %.sink.split
  ]

84:                                               ; preds = %.preheader.new
  %85 = getelementptr inbounds i8, ptr %56, i64 %indvars.iv64
  %86 = load i8, ptr %85, align 1, !tbaa !9, !range !12, !noundef !13
  %87 = trunc nuw i8 %86 to i1
  br i1 %87, label %93, label %.sink.split

88:                                               ; preds = %.preheader.new
  %89 = load i8, ptr %gep, align 1, !tbaa !11
  %90 = icmp eq i8 %83, %89
  br i1 %90, label %.sink.split, label %93

.sink.split:                                      ; preds = %88, %.preheader.new, %84
  %.sink80 = phi ptr [ %58, %84 ], [ %56, %.preheader.new ], [ %56, %88 ]
  %91 = getelementptr inbounds i8, ptr %.sink80, i64 %81
  %92 = load i8, ptr %91, align 1, !tbaa !9, !range !12, !noundef !13
  br label %93

93:                                               ; preds = %.sink.split, %88, %84
  %.sink = phi i8 [ 1, %84 ], [ 0, %88 ], [ %92, %.sink.split ]
  %94 = getelementptr inbounds i8, ptr %58, i64 %indvars.iv64
  store i8 %.sink, ptr %94, align 1, !tbaa !9
  %indvars.iv.next65 = or disjoint i64 %indvars.iv64, 1
  %95 = getelementptr inbounds i8, ptr %17, i64 %indvars.iv64
  %96 = load i8, ptr %95, align 2, !tbaa !11
  switch i8 %96, label %101 [
    i8 42, label %97
    i8 63, label %.sink.split.1
  ]

97:                                               ; preds = %93
  %98 = getelementptr inbounds i8, ptr %56, i64 %indvars.iv.next65
  %99 = load i8, ptr %98, align 1, !tbaa !9, !range !12, !noundef !13
  %100 = trunc nuw i8 %99 to i1
  br i1 %100, label %106, label %.sink.split.1

101:                                              ; preds = %93
  %102 = load i8, ptr %gep, align 1, !tbaa !11
  %103 = icmp eq i8 %96, %102
  br i1 %103, label %.sink.split.1, label %106

.sink.split.1:                                    ; preds = %101, %97, %93
  %.sink80.1 = phi ptr [ %58, %97 ], [ %56, %93 ], [ %56, %101 ]
  %104 = getelementptr inbounds i8, ptr %.sink80.1, i64 %indvars.iv64
  %105 = load i8, ptr %104, align 1, !tbaa !9, !range !12, !noundef !13
  br label %106

106:                                              ; preds = %.sink.split.1, %101, %97
  %.sink.1 = phi i8 [ 1, %97 ], [ 0, %101 ], [ %105, %.sink.split.1 ]
  %107 = getelementptr inbounds i8, ptr %58, i64 %indvars.iv.next65
  store i8 %.sink.1, ptr %107, align 1, !tbaa !9
  %indvars.iv.next65.1 = add nuw nsw i64 %indvars.iv64, 2
  %niter84.next.1 = add i64 %niter84, 2
  %niter84.ncmp.1 = icmp eq i64 %niter84.next.1, %unroll_iter83
  br i1 %niter84.ncmp.1, label %._crit_edge55.unr-lcssa, label %.preheader.new, !llvm.loop !17
}

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

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

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 nocallback nofree nosync nounwind willreturn }
attributes #5 = { 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{i8 0, i8 2}
!13 = !{}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}


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