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

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

@MOD = external dso_local global i64, align 8
@a = external dso_local global [101 x i64], align 16
@dp = external dso_local global [101 x i64], align 16
@b = external dso_local global [101 x [101 x i64]], align 16
@ans = external dso_local global i64, align 8
@n = external dso_local global i32, align 4
@xx = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3expi(i32 noundef) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %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
  %10 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @xx)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %24, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = icmp slt i32 %13, %14
  br i1 %15, label %17, label %16

16:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %27

17:                                               ; preds = %12
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @d)
  %19 = load i32, ptr @d, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [101 x i64], ptr @a, i64 0, i64 %20
  %22 = load i64, ptr %21, align 8, !tbaa !9
  %23 = add nsw i64 %22, 1
  store i64 %23, ptr %21, align 8, !tbaa !9
  br label %24

24:                                               ; preds = %17
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !11

27:                                               ; preds = %16
  store i64 1, ptr @dp, align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %75, %27
  %29 = load i32, ptr %3, align 4, !tbaa !5
  %30 = icmp sle i32 %29, 100
  br i1 %30, label %32, label %31

31:                                               ; preds = %28
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %78

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

33:                                               ; preds = %71, %32
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = icmp sle i32 %34, %35
  br i1 %36, label %38, label %37

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

38:                                               ; preds = %33
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = load i32, ptr %5, align 4, !tbaa !5
  %41 = sub nsw i32 %39, %40
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [101 x i64], ptr @dp, i64 0, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !9
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [101 x i64], ptr @a, i64 0, i64 %46
  %48 = load i64, ptr %47, align 8, !tbaa !9
  %49 = mul nsw i64 %44, %48
  %50 = load i64, ptr @MOD, align 8, !tbaa !9
  %51 = srem i64 %49, %50
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [101 x i64], ptr @dp, i64 0, i64 %53
  %55 = load i64, ptr %54, align 8, !tbaa !9
  %56 = add nsw i64 %55, %51
  store i64 %56, ptr %54, align 8, !tbaa !9
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [101 x i64], ptr @dp, i64 0, i64 %58
  %60 = load i64, ptr %59, align 8, !tbaa !9
  %61 = load i64, ptr @MOD, align 8, !tbaa !9
  %62 = icmp sge i64 %60, %61
  br i1 %62, label %63, label %70

63:                                               ; preds = %38
  %64 = load i64, ptr @MOD, align 8, !tbaa !9
  %65 = load i32, ptr %3, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [101 x i64], ptr @dp, i64 0, i64 %66
  %68 = load i64, ptr %67, align 8, !tbaa !9
  %69 = sub nsw i64 %68, %64
  store i64 %69, ptr %67, align 8, !tbaa !9
  br label %70

70:                                               ; preds = %63, %38
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %5, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %5, align 4, !tbaa !5
  br label %33, !llvm.loop !13

74:                                               ; preds = %37
  br label %75

75:                                               ; preds = %74
  %76 = load i32, ptr %3, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %3, align 4, !tbaa !5
  br label %28, !llvm.loop !14

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

79:                                               ; preds = %91, %78
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = icmp slt i32 %80, 100
  br i1 %81, label %83, label %82

82:                                               ; preds = %79
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %94

83:                                               ; preds = %79
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [101 x [101 x i64]], ptr @b, i64 0, i64 %85
  %87 = load i32, ptr %6, align 4, !tbaa !5
  %88 = sub nsw i32 %87, 1
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [101 x i64], ptr %86, i64 0, i64 %89
  store i64 1, ptr %90, align 8, !tbaa !9
  br label %91

91:                                               ; preds = %83
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %6, align 4, !tbaa !5
  br label %79, !llvm.loop !15

94:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %113, %94
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = icmp slt i32 %96, 100
  br i1 %97, label %99, label %98

98:                                               ; preds = %95
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %116

99:                                               ; preds = %95
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = sub nsw i32 100, %100
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [101 x i64], ptr @a, i64 0, i64 %102
  %104 = load i64, ptr %103, align 8, !tbaa !9
  %105 = load i32, ptr %7, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [101 x [101 x i64]], ptr @b, i64 0, i64 %106
  %108 = getelementptr inbounds [101 x i64], ptr %107, i64 0, i64 100
  store i64 %104, ptr %108, align 8, !tbaa !9
  %109 = load i32, ptr %7, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [101 x [101 x i64]], ptr @b, i64 0, i64 %110
  %112 = getelementptr inbounds [101 x i64], ptr %111, i64 0, i64 99
  store i64 %104, ptr %112, align 8, !tbaa !9
  br label %113

113:                                              ; preds = %99
  %114 = load i32, ptr %7, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %7, align 4, !tbaa !5
  br label %95, !llvm.loop !16

116:                                              ; preds = %98
  store i64 1, ptr getelementptr inbounds ([101 x i64], ptr getelementptr inbounds ([101 x [101 x i64]], ptr @b, i64 0, i64 100), i64 0, i64 100), align 16, !tbaa !9
  %117 = load i32, ptr @xx, align 4, !tbaa !5
  %118 = icmp sle i32 %117, 100
  br i1 %118, label %119, label %141

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

120:                                              ; preds = %132, %119
  %121 = load i32, ptr %8, align 4, !tbaa !5
  %122 = load i32, ptr @xx, align 4, !tbaa !5
  %123 = icmp sle i32 %121, %122
  br i1 %123, label %125, label %124

124:                                              ; preds = %120
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %135

125:                                              ; preds = %120
  %126 = load i32, ptr %8, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [101 x i64], ptr @dp, i64 0, i64 %127
  %129 = load i64, ptr %128, align 8, !tbaa !9
  %130 = load i64, ptr @ans, align 8, !tbaa !9
  %131 = add nsw i64 %130, %129
  store i64 %131, ptr @ans, align 8, !tbaa !9
  br label %132

132:                                              ; preds = %125
  %133 = load i32, ptr %8, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %8, align 4, !tbaa !5
  br label %120, !llvm.loop !17

135:                                              ; preds = %124
  %136 = load i64, ptr @ans, align 8, !tbaa !9
  %137 = load i64, ptr @MOD, align 8, !tbaa !9
  %138 = srem i64 %136, %137
  %139 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %138)
  %140 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %139, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %202

141:                                              ; preds = %116
  %142 = load i32, ptr @xx, align 4, !tbaa !5
  %143 = sub nsw i32 %142, 100
  call void @_Z3expi(i32 noundef %143)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %172, %141
  %145 = load i32, ptr %9, align 4, !tbaa !5
  %146 = icmp slt i32 %145, 100
  br i1 %146, label %148, label %147

147:                                              ; preds = %144
  store i32 20, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %175

148:                                              ; preds = %144
  %149 = load i32, ptr %9, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [101 x i64], ptr @dp, i64 0, i64 %151
  %153 = load i64, ptr %152, align 8, !tbaa !9
  %154 = load i32, ptr %9, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [101 x [101 x i64]], ptr @b, i64 0, i64 %155
  %157 = getelementptr inbounds [101 x i64], ptr %156, i64 0, i64 100
  %158 = load i64, ptr %157, align 8, !tbaa !9
  %159 = mul nsw i64 %153, %158
  %160 = load i64, ptr @MOD, align 8, !tbaa !9
  %161 = srem i64 %159, %160
  %162 = load i64, ptr @ans, align 8, !tbaa !9
  %163 = add nsw i64 %162, %161
  store i64 %163, ptr @ans, align 8, !tbaa !9
  %164 = load i64, ptr @ans, align 8, !tbaa !9
  %165 = load i64, ptr @MOD, align 8, !tbaa !9
  %166 = icmp sge i64 %164, %165
  br i1 %166, label %167, label %171

167:                                              ; preds = %148
  %168 = load i64, ptr @MOD, align 8, !tbaa !9
  %169 = load i64, ptr @ans, align 8, !tbaa !9
  %170 = sub nsw i64 %169, %168
  store i64 %170, ptr @ans, align 8, !tbaa !9
  br label %171

171:                                              ; preds = %167, %148
  br label %172

172:                                              ; preds = %171
  %173 = load i32, ptr %9, align 4, !tbaa !5
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %9, align 4, !tbaa !5
  br label %144, !llvm.loop !18

175:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %176

176:                                              ; preds = %195, %175
  %177 = load i32, ptr %10, align 4, !tbaa !5
  %178 = icmp sle i32 %177, 100
  br i1 %178, label %180, label %179

179:                                              ; preds = %176
  store i32 23, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %198

180:                                              ; preds = %176
  %181 = load i32, ptr %10, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [101 x i64], ptr @dp, i64 0, i64 %182
  %184 = load i64, ptr %183, align 8, !tbaa !9
  %185 = load i64, ptr @ans, align 8, !tbaa !9
  %186 = add nsw i64 %185, %184
  store i64 %186, ptr @ans, align 8, !tbaa !9
  %187 = load i64, ptr @ans, align 8, !tbaa !9
  %188 = load i64, ptr @MOD, align 8, !tbaa !9
  %189 = icmp sge i64 %187, %188
  br i1 %189, label %190, label %194

190:                                              ; preds = %180
  %191 = load i64, ptr @MOD, align 8, !tbaa !9
  %192 = load i64, ptr @ans, align 8, !tbaa !9
  %193 = sub nsw i64 %192, %191
  store i64 %193, ptr @ans, align 8, !tbaa !9
  br label %194

194:                                              ; preds = %190, %180
  br label %195

195:                                              ; preds = %194
  %196 = load i32, ptr %10, align 4, !tbaa !5
  %197 = add nsw i32 %196, 1
  store i32 %197, ptr %10, align 4, !tbaa !5
  br label %176, !llvm.loop !19

198:                                              ; preds = %179
  %199 = load i64, ptr @ans, align 8, !tbaa !9
  %200 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %199)
  %201 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %200, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %202

202:                                              ; preds = %198, %135
  ret i32 0
}

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #4 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 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 = { 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 #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 = !{!"long long", !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}
!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 }

@MOD = external dso_local local_unnamed_addr global i64, align 8
@a = external dso_local local_unnamed_addr global [101 x i64], align 16
@dp = external dso_local local_unnamed_addr global [101 x i64], align 16
@b = external dso_local local_unnamed_addr global [101 x [101 x i64]], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@n = external dso_local global i32, align 4
@xx = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3expi(i32 noundef) local_unnamed_addr #0

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

._crit_edge:                                      ; preds = %.lr.ph, %0
  store i64 1, ptr @dp, align 16, !tbaa !9
  %4 = load i64, ptr @MOD, align 8, !tbaa !9
  br label %.preheader54

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.03855 = phi i32 [ %11, %.lr.ph ], [ 0, %0 ]
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @d)
  %6 = load i32, ptr @d, align 4, !tbaa !5
  %7 = sext i32 %6 to i64
  %8 = getelementptr inbounds [101 x i64], ptr @a, i64 0, i64 %7
  %9 = load i64, ptr %8, align 8, !tbaa !9
  %10 = add nsw i64 %9, 1
  store i64 %10, ptr %8, align 8, !tbaa !9
  %11 = add nuw nsw i32 %.03855, 1
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = icmp slt i32 %11, %12
  br i1 %13, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader54:                                     ; preds = %._crit_edge, %15
  %indvars.iv79 = phi i64 [ 1, %._crit_edge ], [ %indvars.iv.next80, %15 ]
  %indvars.iv77 = phi i64 [ 2, %._crit_edge ], [ %indvars.iv.next78, %15 ]
  %14 = getelementptr inbounds [101 x i64], ptr @dp, i64 0, i64 %indvars.iv79
  %.promoted = load i64, ptr %14, align 8, !tbaa !9
  br label %16

15:                                               ; preds = %16
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %exitcond84.not = icmp eq i64 %indvars.iv.next80, 101
  br i1 %exitcond84.not, label %.preheader53, label %.preheader54, !llvm.loop !13

16:                                               ; preds = %.preheader54, %16
  %indvars.iv = phi i64 [ 0, %.preheader54 ], [ %indvars.iv.next, %16 ]
  %spec.select505657 = phi i64 [ %.promoted, %.preheader54 ], [ %spec.select50, %16 ]
  %17 = sub nsw i64 %indvars.iv79, %indvars.iv
  %18 = getelementptr inbounds [101 x i64], ptr @dp, i64 0, i64 %17
  %19 = load i64, ptr %18, align 8, !tbaa !9
  %20 = getelementptr inbounds [101 x i64], ptr @a, i64 0, i64 %indvars.iv
  %21 = load i64, ptr %20, align 8, !tbaa !9
  %22 = mul nsw i64 %21, %19
  %23 = srem i64 %22, %4
  %24 = add nsw i64 %spec.select505657, %23
  %.not49 = icmp slt i64 %24, %4
  %25 = select i1 %.not49, i64 0, i64 %4
  %spec.select50 = sub nsw i64 %24, %25
  store i64 %spec.select50, ptr %14, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %indvars.iv77
  br i1 %exitcond.not, label %15, label %16, !llvm.loop !14

.preheader53:                                     ; preds = %15, %.preheader53
  %indvars.iv85 = phi i64 [ %indvars.iv.next86.2, %.preheader53 ], [ 1, %15 ]
  %26 = add nsw i64 %indvars.iv85, -1
  %27 = getelementptr inbounds [101 x [101 x i64]], ptr @b, i64 0, i64 %indvars.iv85, i64 %26
  store i64 1, ptr %27, align 8, !tbaa !9
  %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
  %28 = getelementptr inbounds [101 x [101 x i64]], ptr @b, i64 0, i64 %indvars.iv.next86, i64 %indvars.iv85
  store i64 1, ptr %28, align 8, !tbaa !9
  %indvars.iv.next86.1 = add nuw nsw i64 %indvars.iv85, 2
  %29 = add nuw nsw i64 %indvars.iv85, 1
  %30 = getelementptr inbounds [101 x [101 x i64]], ptr @b, i64 0, i64 %indvars.iv.next86.1, i64 %29
  store i64 1, ptr %30, align 8, !tbaa !9
  %indvars.iv.next86.2 = add nuw nsw i64 %indvars.iv85, 3
  %exitcond88.not.2 = icmp eq i64 %indvars.iv.next86.2, 100
  br i1 %exitcond88.not.2, label %.preheader52, label %.preheader53, !llvm.loop !15

31:                                               ; preds = %.preheader52
  store i64 1, ptr getelementptr inbounds (i8, ptr @b, i64 81600), align 16, !tbaa !9
  %32 = load i32, ptr @xx, align 4, !tbaa !5
  %33 = icmp slt i32 %32, 101
  br i1 %33, label %.preheader, label %73

.preheader:                                       ; preds = %31
  %ans.promoted67 = load i64, ptr @ans, align 8, !tbaa !9
  %.not4768 = icmp slt i32 %32, 0
  br i1 %.not4768, label %66, label %.lr.ph70.preheader

.lr.ph70.preheader:                               ; preds = %.preheader
  %34 = add nuw nsw i32 %32, 1
  %wide.trip.count = zext nneg i32 %34 to i64
  %min.iters.check = icmp ult i32 %32, 3
  br i1 %min.iters.check, label %.lr.ph70.preheader107, label %vector.ph

.lr.ph70.preheader107:                            ; preds = %middle.block, %.lr.ph70.preheader
  %indvars.iv101.ph = phi i64 [ 0, %.lr.ph70.preheader ], [ %n.vec, %middle.block ]
  %.ph = phi i64 [ %ans.promoted67, %.lr.ph70.preheader ], [ %41, %middle.block ]
  br label %.lr.ph70

vector.ph:                                        ; preds = %.lr.ph70.preheader
  %n.vec = and i64 %wide.trip.count, 2147483644
  %35 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %ans.promoted67, i64 0
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ %35, %vector.ph ], [ %38, %vector.body ]
  %vec.phi105 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %39, %vector.body ]
  %36 = getelementptr inbounds [101 x i64], ptr @dp, i64 0, i64 %index
  %37 = getelementptr inbounds i8, ptr %36, i64 16
  %wide.load = load <2 x i64>, ptr %36, align 16, !tbaa !9
  %wide.load106 = load <2 x i64>, ptr %37, align 16, !tbaa !9
  %38 = add <2 x i64> %vec.phi, %wide.load
  %39 = add <2 x i64> %vec.phi105, %wide.load106
  %index.next = add nuw i64 %index, 4
  %40 = icmp eq i64 %index.next, %n.vec
  br i1 %40, label %middle.block, label %vector.body, !llvm.loop !16

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %39, %38
  %41 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge71, label %.lr.ph70.preheader107

.preheader52:                                     ; preds = %.preheader53, %.preheader52
  %indvars.iv89 = phi i64 [ %indvars.iv.next90.3, %.preheader52 ], [ 0, %.preheader53 ]
  %42 = sub nuw nsw i64 100, %indvars.iv89
  %43 = getelementptr inbounds [101 x i64], ptr @a, i64 0, i64 %42
  %44 = load i64, ptr %43, align 16, !tbaa !9
  %45 = getelementptr inbounds [101 x [101 x i64]], ptr @b, i64 0, i64 %indvars.iv89
  %46 = getelementptr inbounds i8, ptr %45, i64 800
  store i64 %44, ptr %46, align 16, !tbaa !9
  %47 = getelementptr inbounds i8, ptr %45, i64 792
  store i64 %44, ptr %47, align 8, !tbaa !9
  %indvars.iv.next90 = or disjoint i64 %indvars.iv89, 1
  %48 = sub nuw nsw i64 100, %indvars.iv.next90
  %49 = getelementptr inbounds [101 x i64], ptr @a, i64 0, i64 %48
  %50 = load i64, ptr %49, align 8, !tbaa !9
  %51 = getelementptr inbounds [101 x [101 x i64]], ptr @b, i64 0, i64 %indvars.iv.next90
  %52 = getelementptr inbounds i8, ptr %51, i64 800
  store i64 %50, ptr %52, align 8, !tbaa !9
  %53 = getelementptr inbounds i8, ptr %51, i64 792
  store i64 %50, ptr %53, align 16, !tbaa !9
  %indvars.iv.next90.1 = or disjoint i64 %indvars.iv89, 2
  %54 = sub nuw nsw i64 100, %indvars.iv.next90.1
  %55 = getelementptr inbounds [101 x i64], ptr @a, i64 0, i64 %54
  %56 = load i64, ptr %55, align 16, !tbaa !9
  %57 = getelementptr inbounds [101 x [101 x i64]], ptr @b, i64 0, i64 %indvars.iv.next90.1
  %58 = getelementptr inbounds i8, ptr %57, i64 800
  store i64 %56, ptr %58, align 16, !tbaa !9
  %59 = getelementptr inbounds i8, ptr %57, i64 792
  store i64 %56, ptr %59, align 8, !tbaa !9
  %indvars.iv.next90.2 = or disjoint i64 %indvars.iv89, 3
  %60 = sub nuw nsw i64 100, %indvars.iv.next90.2
  %61 = getelementptr inbounds [101 x i64], ptr @a, i64 0, i64 %60
  %62 = load i64, ptr %61, align 8, !tbaa !9
  %63 = getelementptr inbounds [101 x [101 x i64]], ptr @b, i64 0, i64 %indvars.iv.next90.2
  %64 = getelementptr inbounds i8, ptr %63, i64 800
  store i64 %62, ptr %64, align 8, !tbaa !9
  %65 = getelementptr inbounds i8, ptr %63, i64 792
  store i64 %62, ptr %65, align 16, !tbaa !9
  %indvars.iv.next90.3 = add nuw nsw i64 %indvars.iv89, 4
  %exitcond92.not.3 = icmp eq i64 %indvars.iv.next90.3, 100
  br i1 %exitcond92.not.3, label %31, label %.preheader52, !llvm.loop !19

._crit_edge71:                                    ; preds = %.lr.ph70, %middle.block
  %.lcssa = phi i64 [ %41, %middle.block ], [ %72, %.lr.ph70 ]
  store i64 %.lcssa, ptr @ans, align 8, !tbaa !9
  br label %66

66:                                               ; preds = %._crit_edge71, %.preheader
  %67 = phi i64 [ %.lcssa, %._crit_edge71 ], [ %ans.promoted67, %.preheader ]
  %68 = srem i64 %67, %4
  br label %111

.lr.ph70:                                         ; preds = %.lr.ph70.preheader107, %.lr.ph70
  %indvars.iv101 = phi i64 [ %indvars.iv.next102, %.lr.ph70 ], [ %indvars.iv101.ph, %.lr.ph70.preheader107 ]
  %69 = phi i64 [ %72, %.lr.ph70 ], [ %.ph, %.lr.ph70.preheader107 ]
  %70 = getelementptr inbounds [101 x i64], ptr @dp, i64 0, i64 %indvars.iv101
  %71 = load i64, ptr %70, align 8, !tbaa !9
  %72 = add nsw i64 %69, %71
  %indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
  %exitcond104.not = icmp eq i64 %indvars.iv.next102, %wide.trip.count
  br i1 %exitcond104.not, label %._crit_edge71, label %.lr.ph70, !llvm.loop !20

73:                                               ; preds = %31
  %74 = add nsw i32 %32, -100
  tail call void @_Z3expi(i32 noundef %74)
  %75 = load i64, ptr @MOD, align 8, !tbaa !9
  %ans.promoted = load i64, ptr @ans, align 8, !tbaa !9
  br label %76

76:                                               ; preds = %76, %73
  %indvars.iv93 = phi i64 [ 0, %73 ], [ %indvars.iv.next94.1, %76 ]
  %spec.select6263 = phi i64 [ %ans.promoted, %73 ], [ %spec.select.1, %76 ]
  %indvars.iv.next94 = or disjoint i64 %indvars.iv93, 1
  %77 = getelementptr inbounds [101 x i64], ptr @dp, i64 0, i64 %indvars.iv.next94
  %78 = load i64, ptr %77, align 8, !tbaa !9
  %79 = getelementptr inbounds [101 x [101 x i64]], ptr @b, i64 0, i64 %indvars.iv93, i64 100
  %80 = load i64, ptr %79, align 16, !tbaa !9
  %81 = mul nsw i64 %80, %78
  %82 = srem i64 %81, %75
  %83 = add nsw i64 %spec.select6263, %82
  %.not46 = icmp slt i64 %83, %75
  %84 = select i1 %.not46, i64 0, i64 %75
  %spec.select = sub nsw i64 %83, %84
  %indvars.iv.next94.1 = add nuw nsw i64 %indvars.iv93, 2
  %85 = getelementptr inbounds [101 x i64], ptr @dp, i64 0, i64 %indvars.iv.next94.1
  %86 = load i64, ptr %85, align 16, !tbaa !9
  %87 = getelementptr inbounds [101 x [101 x i64]], ptr @b, i64 0, i64 %indvars.iv.next94, i64 100
  %88 = load i64, ptr %87, align 8, !tbaa !9
  %89 = mul nsw i64 %88, %86
  %90 = srem i64 %89, %75
  %91 = add nsw i64 %spec.select, %90
  %.not46.1 = icmp slt i64 %91, %75
  %92 = select i1 %.not46.1, i64 0, i64 %75
  %spec.select.1 = sub nsw i64 %91, %92
  %exitcond96.not.1 = icmp eq i64 %indvars.iv.next94.1, 100
  br i1 %exitcond96.not.1, label %.preheader51, label %76, !llvm.loop !21

93:                                               ; preds = %.preheader51
  store i64 %spec.select73, ptr @ans, align 8, !tbaa !9
  br label %111

.preheader51:                                     ; preds = %76, %.preheader51.1
  %indvars.iv97 = phi i64 [ %indvars.iv.next98.3, %.preheader51.1 ], [ 0, %76 ]
  %94 = phi i64 [ %spec.select73.3, %.preheader51.1 ], [ %spec.select.1, %76 ]
  %95 = getelementptr inbounds [101 x i64], ptr @dp, i64 0, i64 %indvars.iv97
  %96 = load i64, ptr %95, align 16, !tbaa !9
  %97 = add nsw i64 %94, %96
  %.not = icmp slt i64 %97, %75
  %98 = select i1 %.not, i64 0, i64 %75
  %spec.select73 = sub nsw i64 %97, %98
  %exitcond100.not = icmp eq i64 %indvars.iv97, 100
  br i1 %exitcond100.not, label %93, label %.preheader51.1, !llvm.loop !22

.preheader51.1:                                   ; preds = %.preheader51
  %indvars.iv.next98 = or disjoint i64 %indvars.iv97, 1
  %99 = getelementptr inbounds [101 x i64], ptr @dp, i64 0, i64 %indvars.iv.next98
  %100 = load i64, ptr %99, align 8, !tbaa !9
  %101 = add nsw i64 %spec.select73, %100
  %.not.1 = icmp slt i64 %101, %75
  %102 = select i1 %.not.1, i64 0, i64 %75
  %spec.select73.1 = sub nsw i64 %101, %102
  %indvars.iv.next98.1 = or disjoint i64 %indvars.iv97, 2
  %103 = getelementptr inbounds [101 x i64], ptr @dp, i64 0, i64 %indvars.iv.next98.1
  %104 = load i64, ptr %103, align 16, !tbaa !9
  %105 = add nsw i64 %spec.select73.1, %104
  %.not.2 = icmp slt i64 %105, %75
  %106 = select i1 %.not.2, i64 0, i64 %75
  %spec.select73.2 = sub nsw i64 %105, %106
  %indvars.iv.next98.2 = or disjoint i64 %indvars.iv97, 3
  %107 = getelementptr inbounds [101 x i64], ptr @dp, i64 0, i64 %indvars.iv.next98.2
  %108 = load i64, ptr %107, align 8, !tbaa !9
  %109 = add nsw i64 %spec.select73.2, %108
  %.not.3 = icmp slt i64 %109, %75
  %110 = select i1 %.not.3, i64 0, i64 %75
  %spec.select73.3 = sub nsw i64 %109, %110
  %indvars.iv.next98.3 = add nuw nsw i64 %indvars.iv97, 4
  br label %.preheader51

111:                                              ; preds = %93, %66
  %spec.select73.lcssa.sink = phi i64 [ %spec.select73, %93 ], [ %68, %66 ]
  %112 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %spec.select73.lcssa.sink)
  %113 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %112, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #5

attributes #0 = { 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 #1 = { 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 #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 = !{!"long long", !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, !18}
!17 = !{!"llvm.loop.isvectorized", i32 1}
!18 = !{!"llvm.loop.unroll.runtime.disable"}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12, !18, !17}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}


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