; LLVM IR from ShahjalalShohag/code-library :: Dynamic Programming Optimizations (SOS DP)

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

@a = external dso_local global [1048576 x i32], align 16
@f = external dso_local global [1048576 x i32], align 16
@g = external dso_local global [1048576 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_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
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %10 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %11 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %13
  %15 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  %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)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !8
  br label %17

17:                                               ; preds = %43, %0
  %18 = load i32, ptr %3, align 4, !tbaa !8
  %19 = load i32, ptr %2, align 4, !tbaa !8
  %20 = icmp sle i32 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %46

22:                                               ; preds = %17
  %23 = load i32, ptr %3, align 4, !tbaa !8
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [1048576 x i32], ptr @a, i64 0, i64 %24
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %25)
  %27 = load i32, ptr %3, align 4, !tbaa !8
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [1048576 x i32], ptr @a, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !8
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [1048576 x i32], ptr @f, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !8
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %32, align 4, !tbaa !8
  %35 = load i32, ptr %3, align 4, !tbaa !8
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [1048576 x i32], ptr @a, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !8
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [1048576 x i32], ptr @g, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !8
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %40, align 4, !tbaa !8
  br label %43

43:                                               ; preds = %22
  %44 = load i32, ptr %3, align 4, !tbaa !8
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %3, align 4, !tbaa !8
  br label %17, !llvm.loop !11

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

47:                                               ; preds = %80, %46
  %48 = load i32, ptr %4, align 4, !tbaa !8
  %49 = icmp slt i32 %48, 20
  br i1 %49, label %51, label %50

50:                                               ; preds = %47
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %83

51:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !8
  br label %52

52:                                               ; preds = %76, %51
  %53 = load i32, ptr %6, align 4, !tbaa !8
  %54 = icmp slt i32 %53, 1048576
  br i1 %54, label %56, label %55

55:                                               ; preds = %52
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %79

56:                                               ; preds = %52
  %57 = load i32, ptr %6, align 4, !tbaa !8
  %58 = load i32, ptr %4, align 4, !tbaa !8
  %59 = shl i32 1, %58
  %60 = and i32 %57, %59
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %62, label %75

62:                                               ; preds = %56
  %63 = load i32, ptr %6, align 4, !tbaa !8
  %64 = load i32, ptr %4, align 4, !tbaa !8
  %65 = shl i32 1, %64
  %66 = xor i32 %63, %65
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [1048576 x i32], ptr @f, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !8
  %70 = load i32, ptr %6, align 4, !tbaa !8
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [1048576 x i32], ptr @f, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !8
  %74 = add nsw i32 %73, %69
  store i32 %74, ptr %72, align 4, !tbaa !8
  br label %75

75:                                               ; preds = %62, %56
  br label %76

76:                                               ; preds = %75
  %77 = load i32, ptr %6, align 4, !tbaa !8
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %6, align 4, !tbaa !8
  br label %52, !llvm.loop !13

79:                                               ; preds = %55
  br label %80

80:                                               ; preds = %79
  %81 = load i32, ptr %4, align 4, !tbaa !8
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %4, align 4, !tbaa !8
  br label %47, !llvm.loop !14

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

84:                                               ; preds = %117, %83
  %85 = load i32, ptr %7, align 4, !tbaa !8
  %86 = icmp slt i32 %85, 20
  br i1 %86, label %88, label %87

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

88:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1048575, ptr %8, align 4, !tbaa !8
  br label %89

89:                                               ; preds = %113, %88
  %90 = load i32, ptr %8, align 4, !tbaa !8
  %91 = icmp sge i32 %90, 0
  br i1 %91, label %93, label %92

92:                                               ; preds = %89
  store i32 14, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %116

93:                                               ; preds = %89
  %94 = load i32, ptr %8, align 4, !tbaa !8
  %95 = load i32, ptr %7, align 4, !tbaa !8
  %96 = shl i32 1, %95
  %97 = and i32 %94, %96
  %98 = icmp eq i32 %97, 0
  br i1 %98, label %99, label %112

99:                                               ; preds = %93
  %100 = load i32, ptr %8, align 4, !tbaa !8
  %101 = load i32, ptr %7, align 4, !tbaa !8
  %102 = shl i32 1, %101
  %103 = xor i32 %100, %102
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [1048576 x i32], ptr @g, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !8
  %107 = load i32, ptr %8, align 4, !tbaa !8
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [1048576 x i32], ptr @g, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !8
  %111 = add nsw i32 %110, %106
  store i32 %111, ptr %109, align 4, !tbaa !8
  br label %112

112:                                              ; preds = %99, %93
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %8, align 4, !tbaa !8
  %115 = add nsw i32 %114, -1
  store i32 %115, ptr %8, align 4, !tbaa !8
  br label %89, !llvm.loop !15

116:                                              ; preds = %92
  br label %117

117:                                              ; preds = %116
  %118 = load i32, ptr %7, align 4, !tbaa !8
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %7, align 4, !tbaa !8
  br label %84, !llvm.loop !16

120:                                              ; preds = %87
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 1, ptr %9, align 4, !tbaa !8
  br label %121

121:                                              ; preds = %157, %120
  %122 = load i32, ptr %9, align 4, !tbaa !8
  %123 = load i32, ptr %2, align 4, !tbaa !8
  %124 = icmp sle i32 %122, %123
  br i1 %124, label %126, label %125

125:                                              ; preds = %121
  store i32 17, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %160

126:                                              ; preds = %121
  %127 = load i32, ptr %9, align 4, !tbaa !8
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [1048576 x i32], ptr @a, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !8
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1048576 x i32], ptr @f, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !8
  %134 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %133)
  %135 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %134, i8 noundef signext 32)
  %136 = load i32, ptr %9, align 4, !tbaa !8
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [1048576 x i32], ptr @a, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !8
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [1048576 x i32], ptr @g, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !8
  %143 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %135, i32 noundef %142)
  %144 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %143, i8 noundef signext 32)
  %145 = load i32, ptr %2, align 4, !tbaa !8
  %146 = load i32, ptr %9, align 4, !tbaa !8
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [1048576 x i32], ptr @a, i64 0, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !8
  %150 = sub nsw i32 1048575, %149
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [1048576 x i32], ptr @f, i64 0, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !8
  %154 = sub nsw i32 %145, %153
  %155 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %144, i32 noundef %154)
  %156 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %155, i8 noundef signext 10)
  br label %157

157:                                              ; preds = %126
  %158 = load i32, ptr %9, align 4, !tbaa !8
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %9, align 4, !tbaa !8
  br label %121, !llvm.loop !17

160:                                              ; preds = %125
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %161 = load i32, ptr %1, align 4
  ret i32 %161
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #4

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

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 = { 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !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_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" }

@a = external dso_local global [1048576 x i32], align 16
@f = external dso_local local_unnamed_addr global [1048576 x i32], align 16
@g = external dso_local local_unnamed_addr global [1048576 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_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 = alloca i32, align 4
  %2 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %3 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %4 = getelementptr i8, ptr %3, i64 -24
  %5 = load i64, ptr %4, align 8
  %6 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %5
  %7 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %6, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %8 = 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)
  %9 = load i32, ptr %1, align 4, !tbaa !8
  %.not40 = icmp slt i32 %9, 1
  br i1 %.not40, label %.preheader39, label %.lr.ph

.preheader39.loopexit:                            ; preds = %.lr.ph
  %10 = icmp slt i32 %21, 1
  br label %.preheader39

.preheader39:                                     ; preds = %.preheader39.loopexit, %0
  %.not3446 = phi i1 [ %10, %.preheader39.loopexit ], [ true, %0 ]
  br label %.preheader38

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %11 = getelementptr inbounds [1048576 x i32], ptr @a, i64 0, i64 %indvars.iv
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %13 = load i32, ptr %11, align 4, !tbaa !8
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [1048576 x i32], ptr @f, i64 0, i64 %14
  %16 = load i32, ptr %15, align 4, !tbaa !8
  %17 = add nsw i32 %16, 1
  store i32 %17, ptr %15, align 4, !tbaa !8
  %18 = getelementptr inbounds [1048576 x i32], ptr @g, i64 0, i64 %14
  %19 = load i32, ptr %18, align 4, !tbaa !8
  %20 = add nsw i32 %19, 1
  store i32 %20, ptr %18, align 4, !tbaa !8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %21 = load i32, ptr %1, align 4, !tbaa !8
  %22 = sext i32 %21 to i64
  %.not.not = icmp slt i64 %indvars.iv, %22
  br i1 %.not.not, label %.lr.ph, label %.preheader39.loopexit, !llvm.loop !11

.preheader38:                                     ; preds = %.preheader39, %24
  %.03243 = phi i32 [ 0, %.preheader39 ], [ %25, %24 ]
  %23 = shl nuw nsw i32 1, %.03243
  br label %26

24:                                               ; preds = %48
  %25 = add nuw nsw i32 %.03243, 1
  %exitcond53.not = icmp eq i32 %25, 20
  br i1 %exitcond53.not, label %.preheader36, label %.preheader38, !llvm.loop !13

26:                                               ; preds = %48, %.preheader38
  %indvars.iv50 = phi i64 [ 0, %.preheader38 ], [ %indvars.iv.next51.1, %48 ]
  %27 = trunc nuw nsw i64 %indvars.iv50 to i32
  %28 = and i32 %23, %27
  %.not35 = icmp eq i32 %28, 0
  br i1 %.not35, label %37, label %29

29:                                               ; preds = %26
  %30 = xor i32 %23, %27
  %31 = zext nneg i32 %30 to i64
  %32 = getelementptr inbounds [1048576 x i32], ptr @f, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !8
  %34 = getelementptr inbounds [1048576 x i32], ptr @f, i64 0, i64 %indvars.iv50
  %35 = load i32, ptr %34, align 8, !tbaa !8
  %36 = add nsw i32 %35, %33
  store i32 %36, ptr %34, align 8, !tbaa !8
  br label %37

37:                                               ; preds = %26, %29
  %indvars.iv.next51 = or disjoint i64 %indvars.iv50, 1
  %38 = trunc nuw nsw i64 %indvars.iv.next51 to i32
  %39 = and i32 %23, %38
  %.not35.1 = icmp eq i32 %39, 0
  br i1 %.not35.1, label %48, label %40

40:                                               ; preds = %37
  %41 = xor i32 %23, %38
  %42 = zext nneg i32 %41 to i64
  %43 = getelementptr inbounds [1048576 x i32], ptr @f, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !8
  %45 = getelementptr inbounds [1048576 x i32], ptr @f, i64 0, i64 %indvars.iv.next51
  %46 = load i32, ptr %45, align 4, !tbaa !8
  %47 = add nsw i32 %46, %44
  store i32 %47, ptr %45, align 4, !tbaa !8
  br label %48

48:                                               ; preds = %40, %37
  %indvars.iv.next51.1 = add nuw nsw i64 %indvars.iv50, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next51.1, 1048576
  br i1 %exitcond.not.1, label %24, label %26, !llvm.loop !14

.preheader36:                                     ; preds = %24, %50
  %.03045 = phi i32 [ %51, %50 ], [ 0, %24 ]
  %49 = shl nuw nsw i32 1, %.03045
  br label %52

.preheader:                                       ; preds = %50
  br i1 %.not3446, label %._crit_edge, label %.lr.ph48

50:                                               ; preds = %76
  %51 = add nuw nsw i32 %.03045, 1
  %exitcond57.not = icmp eq i32 %51, 20
  br i1 %exitcond57.not, label %.preheader, label %.preheader36, !llvm.loop !15

52:                                               ; preds = %76, %.preheader36
  %indvars.iv54 = phi i64 [ 1048575, %.preheader36 ], [ %indvars.iv.next55.1, %76 ]
  %53 = trunc nuw nsw i64 %indvars.iv54 to i32
  %54 = and i32 %49, %53
  %55 = icmp eq i32 %54, 0
  br i1 %55, label %56, label %64

56:                                               ; preds = %52
  %57 = xor i32 %49, %53
  %58 = zext nneg i32 %57 to i64
  %59 = getelementptr inbounds [1048576 x i32], ptr @g, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !8
  %61 = getelementptr inbounds [1048576 x i32], ptr @g, i64 0, i64 %indvars.iv54
  %62 = load i32, ptr %61, align 4, !tbaa !8
  %63 = add nsw i32 %62, %60
  store i32 %63, ptr %61, align 4, !tbaa !8
  br label %64

64:                                               ; preds = %52, %56
  %indvars.iv.next55 = add nsw i64 %indvars.iv54, -1
  %65 = trunc nuw nsw i64 %indvars.iv.next55 to i32
  %66 = and i32 %49, %65
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %68, label %76

68:                                               ; preds = %64
  %69 = xor i32 %49, %65
  %70 = zext nneg i32 %69 to i64
  %71 = getelementptr inbounds [1048576 x i32], ptr @g, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !8
  %73 = getelementptr inbounds [1048576 x i32], ptr @g, i64 0, i64 %indvars.iv.next55
  %74 = load i32, ptr %73, align 4, !tbaa !8
  %75 = add nsw i32 %74, %72
  store i32 %75, ptr %73, align 4, !tbaa !8
  br label %76

76:                                               ; preds = %68, %64
  %indvars.iv.next55.1 = add nsw i64 %indvars.iv54, -2
  %.not.1 = icmp eq i64 %indvars.iv.next55, 0
  br i1 %.not.1, label %50, label %52, !llvm.loop !16

._crit_edge:                                      ; preds = %.lr.ph48, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0

.lr.ph48:                                         ; preds = %.preheader, %.lr.ph48
  %indvars.iv58 = phi i64 [ %indvars.iv.next59, %.lr.ph48 ], [ 1, %.preheader ]
  %77 = getelementptr inbounds [1048576 x i32], ptr @a, i64 0, i64 %indvars.iv58
  %78 = load i32, ptr %77, align 4, !tbaa !8
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [1048576 x i32], ptr @f, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !8
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %81)
  %83 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %82, i8 noundef signext 32)
  %84 = load i32, ptr %77, align 4, !tbaa !8
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [1048576 x i32], ptr @g, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !8
  %88 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %83, i32 noundef %87)
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %88, i8 noundef signext 32)
  %90 = load i32, ptr %1, align 4, !tbaa !8
  %91 = load i32, ptr %77, align 4, !tbaa !8
  %92 = sub nsw i32 1048575, %91
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [1048576 x i32], ptr @f, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !8
  %96 = sub nsw i32 %90, %95
  %97 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %89, i32 noundef %96)
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %97, i8 noundef signext 10)
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %99 = load i32, ptr %1, align 4, !tbaa !8
  %100 = sext i32 %99 to i64
  %.not34.not = icmp slt i64 %indvars.iv58, %100
  br i1 %.not34.not, label %.lr.ph48, label %._crit_edge, !llvm.loop !17
}

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

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

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

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 #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #4

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

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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


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