; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/WF/Easy Medium/POWERMUL/A.ll (Z5solvev)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@p = external dso_local global %"class.std::vector", align 8
@g = external dso_local global [100100 x i64], align 16
@pwrs = external dso_local global [100100 x [10 x i64]], align 16
@f = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4fastxxx(i64 noundef, i64 noundef, i64 noundef) #0

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

; 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 dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3getix(i32 noundef, i64 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #2 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %1, ptr noundef %2, ptr noundef %3)
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @f) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %17 = load i64, ptr %2, align 8, !tbaa !5
  store i64 %17, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %18 = load i64, ptr %2, align 8, !tbaa !5
  store i64 %18, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store ptr @p, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %19 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @p) #5
  %20 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %19, ptr %20, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %21 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @p) #5
  %22 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %21, ptr %22, align 8
  br label %23

23:                                               ; preds = %77, %0
  %24 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #5
  br i1 %24, label %26, label %25

25:                                               ; preds = %23
  store i32 2, ptr %9, align 4
  br label %79

26:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %27 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  store ptr %27, ptr %10, align 8, !tbaa !9
  %28 = load i64, ptr %5, align 8, !tbaa !5
  %29 = load ptr, ptr %10, align 8, !tbaa !9
  %30 = load i32, ptr %29, align 4, !tbaa !11
  %31 = sext i32 %30 to i64
  %32 = srem i64 %28, %31
  %33 = icmp eq i64 %32, 0
  br i1 %33, label %34, label %57

34:                                               ; preds = %26
  %35 = load ptr, ptr %10, align 8, !tbaa !9
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @f, ptr noundef nonnull align 4 dereferenceable(4) %35)
  %36 = load i64, ptr %4, align 8, !tbaa !5
  %37 = load ptr, ptr %10, align 8, !tbaa !9
  %38 = load i32, ptr %37, align 4, !tbaa !11
  %39 = sext i32 %38 to i64
  %40 = sdiv i64 %36, %39
  %41 = load i64, ptr %4, align 8, !tbaa !5
  %42 = sub nsw i64 %41, %40
  store i64 %42, ptr %4, align 8, !tbaa !5
  br label %43

43:                                               ; preds = %50, %34
  %44 = load i64, ptr %5, align 8, !tbaa !5
  %45 = load ptr, ptr %10, align 8, !tbaa !9
  %46 = load i32, ptr %45, align 4, !tbaa !11
  %47 = sext i32 %46 to i64
  %48 = srem i64 %44, %47
  %49 = icmp eq i64 %48, 0
  br i1 %49, label %50, label %56

50:                                               ; preds = %43
  %51 = load ptr, ptr %10, align 8, !tbaa !9
  %52 = load i32, ptr %51, align 4, !tbaa !11
  %53 = sext i32 %52 to i64
  %54 = load i64, ptr %5, align 8, !tbaa !5
  %55 = sdiv i64 %54, %53
  store i64 %55, ptr %5, align 8, !tbaa !5
  br label %43, !llvm.loop !13

56:                                               ; preds = %43
  br label %57

57:                                               ; preds = %56, %26
  %58 = load i64, ptr %5, align 8, !tbaa !5
  %59 = icmp eq i64 %58, 1
  br i1 %59, label %60, label %61

60:                                               ; preds = %57
  store i32 2, ptr %9, align 4
  br label %74

61:                                               ; preds = %57
  %62 = load ptr, ptr %10, align 8, !tbaa !9
  %63 = load i32, ptr %62, align 4, !tbaa !11
  %64 = sext i32 %63 to i64
  %65 = mul nsw i64 1, %64
  %66 = load ptr, ptr %10, align 8, !tbaa !9
  %67 = load i32, ptr %66, align 4, !tbaa !11
  %68 = sext i32 %67 to i64
  %69 = mul nsw i64 %65, %68
  %70 = load i64, ptr %5, align 8, !tbaa !5
  %71 = icmp sgt i64 %69, %70
  br i1 %71, label %72, label %73

72:                                               ; preds = %61
  store i32 2, ptr %9, align 4
  br label %74

73:                                               ; preds = %61
  store i32 0, ptr %9, align 4
  br label %74

74:                                               ; preds = %73, %72, %60
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  %75 = load i32, ptr %9, align 4
  switch i32 %75, label %79 [
    i32 0, label %76
  ]

76:                                               ; preds = %74
  br label %77

77:                                               ; preds = %76
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  br label %23

79:                                               ; preds = %74, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %80

80:                                               ; preds = %79
  %81 = load i64, ptr %5, align 8, !tbaa !5
  %82 = icmp sgt i64 %81, 1
  br i1 %82, label %83, label %91

83:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %84 = load i64, ptr %5, align 8, !tbaa !5
  %85 = trunc i64 %84 to i32
  store i32 %85, ptr %11, align 4, !tbaa !11
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) @f, ptr noundef nonnull align 4 dereferenceable(4) %11)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  %86 = load i64, ptr %4, align 8, !tbaa !5
  %87 = load i64, ptr %5, align 8, !tbaa !5
  %88 = sdiv i64 %86, %87
  %89 = load i64, ptr %4, align 8, !tbaa !5
  %90 = sub nsw i64 %89, %88
  store i64 %90, ptr %4, align 8, !tbaa !5
  br label %91

91:                                               ; preds = %83, %80
  %92 = load i64, ptr %1, align 8, !tbaa !5
  %93 = trunc i64 %92 to i32
  %94 = load i64, ptr %2, align 8, !tbaa !5
  call void @_Z3getix(i32 noundef %93, i64 noundef %94)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  br label %95

95:                                               ; preds = %181, %91
  %96 = load i64, ptr %3, align 8, !tbaa !5
  %97 = add nsw i64 %96, -1
  store i64 %97, ptr %3, align 8, !tbaa !5
  %98 = icmp ne i64 %96, 0
  br i1 %98, label %99, label %185

99:                                               ; preds = %95
  %100 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %12)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %101 = load i64, ptr %1, align 8, !tbaa !5
  %102 = getelementptr inbounds [100100 x i64], ptr @g, i64 0, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !5
  %104 = load i32, ptr %12, align 4, !tbaa !11
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [100100 x i64], ptr @g, i64 0, i64 %105
  %107 = load i64, ptr %106, align 8, !tbaa !5
  %108 = load i64, ptr %4, align 8, !tbaa !5
  %109 = sub nsw i64 %108, 1
  %110 = load i64, ptr %2, align 8, !tbaa !5
  %111 = call noundef i64 @_Z4fastxxx(i64 noundef %107, i64 noundef %109, i64 noundef %110)
  %112 = mul nsw i64 %103, %111
  %113 = load i64, ptr %2, align 8, !tbaa !5
  %114 = srem i64 %112, %113
  %115 = load i64, ptr %1, align 8, !tbaa !5
  %116 = load i32, ptr %12, align 4, !tbaa !11
  %117 = sext i32 %116 to i64
  %118 = sub nsw i64 %115, %117
  %119 = getelementptr inbounds [100100 x i64], ptr @g, i64 0, i64 %118
  %120 = load i64, ptr %119, align 8, !tbaa !5
  %121 = load i64, ptr %4, align 8, !tbaa !5
  %122 = sub nsw i64 %121, 1
  %123 = load i64, ptr %2, align 8, !tbaa !5
  %124 = call noundef i64 @_Z4fastxxx(i64 noundef %120, i64 noundef %122, i64 noundef %123)
  %125 = mul nsw i64 %114, %124
  %126 = load i64, ptr %2, align 8, !tbaa !5
  %127 = srem i64 %125, %126
  store i64 %127, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %128

128:                                              ; preds = %178, %99
  %129 = load i32, ptr %14, align 4, !tbaa !11
  %130 = sext i32 %129 to i64
  %131 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @f) #5
  %132 = icmp ult i64 %130, %131
  br i1 %132, label %134, label %133

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

134:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %135 = load i64, ptr %1, align 8, !tbaa !5
  %136 = getelementptr inbounds [100100 x [10 x i64]], ptr @pwrs, i64 0, i64 %135
  %137 = load i32, ptr %14, align 4, !tbaa !11
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [10 x i64], ptr %136, i64 0, i64 %138
  %140 = load i64, ptr %139, align 8, !tbaa !5
  %141 = load i32, ptr %12, align 4, !tbaa !11
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [100100 x [10 x i64]], ptr @pwrs, i64 0, i64 %142
  %144 = load i32, ptr %14, align 4, !tbaa !11
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [10 x i64], ptr %143, i64 0, i64 %145
  %147 = load i64, ptr %146, align 8, !tbaa !5
  %148 = sub nsw i64 %140, %147
  %149 = load i64, ptr %1, align 8, !tbaa !5
  %150 = load i32, ptr %12, align 4, !tbaa !11
  %151 = sext i32 %150 to i64
  %152 = sub nsw i64 %149, %151
  %153 = getelementptr inbounds [100100 x [10 x i64]], ptr @pwrs, i64 0, i64 %152
  %154 = load i32, ptr %14, align 4, !tbaa !11
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [10 x i64], ptr %153, i64 0, i64 %155
  %157 = load i64, ptr %156, align 8, !tbaa !5
  %158 = sub nsw i64 %148, %157
  store i64 %158, ptr %15, align 8, !tbaa !5
  %159 = load i64, ptr %15, align 8, !tbaa !5
  %160 = icmp ne i64 %159, 0
  br i1 %160, label %162, label %161

161:                                              ; preds = %134
  store i32 10, ptr %9, align 4
  br label %175

162:                                              ; preds = %134
  %163 = load i64, ptr %13, align 8, !tbaa !5
  %164 = load i32, ptr %14, align 4, !tbaa !11
  %165 = sext i32 %164 to i64
  %166 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @f, i64 noundef %165) #5
  %167 = load i32, ptr %166, align 4, !tbaa !11
  %168 = sext i32 %167 to i64
  %169 = load i64, ptr %15, align 8, !tbaa !5
  %170 = load i64, ptr %2, align 8, !tbaa !5
  %171 = call noundef i64 @_Z4fastxxx(i64 noundef %168, i64 noundef %169, i64 noundef %170)
  %172 = mul nsw i64 %163, %171
  %173 = load i64, ptr %2, align 8, !tbaa !5
  %174 = srem i64 %172, %173
  store i64 %174, ptr %13, align 8, !tbaa !5
  store i32 0, ptr %9, align 4
  br label %175

175:                                              ; preds = %162, %161
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  %176 = load i32, ptr %9, align 4
  switch i32 %176, label %186 [
    i32 0, label %177
    i32 10, label %178
  ]

177:                                              ; preds = %175
  br label %178

178:                                              ; preds = %177, %175
  %179 = load i32, ptr %14, align 4, !tbaa !11
  %180 = add nsw i32 %179, 1
  store i32 %180, ptr %14, align 4, !tbaa !11
  br label %128, !llvm.loop !15

181:                                              ; preds = %133
  %182 = load i64, ptr %13, align 8, !tbaa !5
  %183 = trunc i64 %182 to i32
  %184 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %183)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %95, !llvm.loop !16

185:                                              ; preds = %95
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  ret void

186:                                              ; preds = %175
  unreachable
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

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

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { inlinehint 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 #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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@p = external dso_local global %"class.std::vector", align 8
@g = external dso_local local_unnamed_addr global [100100 x i64], align 16
@pwrs = external dso_local local_unnamed_addr global [100100 x [10 x i64]], align 16
@f = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4fastxxx(i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #0

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

; 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 dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #2 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @f) #5
  %9 = load i64, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %10 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @p) #5
  store ptr %10, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %11 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @p) #5
  store ptr %11, ptr %5, align 8
  %12 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  br i1 %12, label %.lr.ph48, label %.critedge

.lr.ph48:                                         ; preds = %0, %33
  %.047 = phi i64 [ %.1, %33 ], [ %9, %0 ]
  %.03446 = phi i64 [ %.236, %33 ], [ %9, %0 ]
  %13 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  %14 = load i32, ptr %13, align 4, !tbaa !9
  %15 = sext i32 %14 to i64
  %16 = srem i64 %.03446, %15
  %17 = icmp eq i64 %16, 0
  br i1 %17, label %18, label %.loopexit

18:                                               ; preds = %.lr.ph48
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @f, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %19 = load i32, ptr %13, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = sdiv i64 %.047, %20
  %22 = sub nsw i64 %.047, %21
  %23 = srem i64 %.03446, %20
  %24 = icmp eq i64 %23, 0
  br i1 %24, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %18, %.lr.ph
  %.13545 = phi i64 [ %25, %.lr.ph ], [ %.03446, %18 ]
  %25 = sdiv i64 %.13545, %20
  %26 = srem i64 %25, %20
  %27 = icmp eq i64 %26, 0
  br i1 %27, label %.lr.ph, label %.loopexit, !llvm.loop !11

.loopexit:                                        ; preds = %.lr.ph, %18, %.lr.ph48
  %28 = phi i32 [ %14, %.lr.ph48 ], [ %19, %18 ], [ %19, %.lr.ph ]
  %.236 = phi i64 [ %.03446, %.lr.ph48 ], [ %.03446, %18 ], [ %25, %.lr.ph ]
  %.1 = phi i64 [ %.047, %.lr.ph48 ], [ %22, %18 ], [ %22, %.lr.ph ]
  %29 = icmp eq i64 %.236, 1
  br i1 %29, label %.critedge.thread, label %30

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

30:                                               ; preds = %.loopexit
  %31 = sext i32 %28 to i64
  %32 = mul nsw i64 %31, %31
  %.not44 = icmp sgt i64 %32, %.236
  br i1 %.not44, label %.critedge, label %33

33:                                               ; preds = %30
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  %35 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  br i1 %35, label %.lr.ph48, label %.critedge

.critedge:                                        ; preds = %30, %33, %0
  %.337 = phi i64 [ %9, %0 ], [ %.236, %33 ], [ %.236, %30 ]
  %.2 = phi i64 [ %9, %0 ], [ %.1, %33 ], [ %.1, %30 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  %36 = icmp sgt i64 %.337, 1
  br i1 %36, label %37, label %41

37:                                               ; preds = %.critedge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  %38 = trunc i64 %.337 to i32
  store i32 %38, ptr %6, align 4, !tbaa !9
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) @f, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  %39 = sdiv i64 %.2, %.337
  %40 = sub nsw i64 %.2, %39
  br label %41

41:                                               ; preds = %.critedge.thread, %37, %.critedge
  %.3 = phi i64 [ %40, %37 ], [ %.2, %.critedge ], [ %.1, %.critedge.thread ]
  %42 = load i64, ptr %1, align 8, !tbaa !5
  %43 = trunc i64 %42 to i32
  %44 = load i64, ptr %2, align 8, !tbaa !5
  call void @_Z3getix(i32 noundef %43, i64 noundef %44)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %45 = load i64, ptr %3, align 8, !tbaa !5
  %46 = add nsw i64 %45, -1
  store i64 %46, ptr %3, align 8, !tbaa !5
  %.not58 = icmp eq i64 %45, 0
  br i1 %.not58, label %._crit_edge61, label %.lr.ph60

.lr.ph60:                                         ; preds = %41
  %47 = add nsw i64 %.3, -1
  br label %48

48:                                               ; preds = %.lr.ph60, %._crit_edge
  %49 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %7)
  %50 = load i64, ptr %1, align 8, !tbaa !5
  %51 = getelementptr inbounds [100100 x i64], ptr @g, i64 0, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !5
  %53 = load i32, ptr %7, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [100100 x i64], ptr @g, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !5
  %57 = load i64, ptr %2, align 8, !tbaa !5
  %58 = call noundef i64 @_Z4fastxxx(i64 noundef %56, i64 noundef %47, i64 noundef %57)
  %59 = mul nsw i64 %58, %52
  %60 = load i64, ptr %2, align 8, !tbaa !5
  %61 = srem i64 %59, %60
  %62 = load i64, ptr %1, align 8, !tbaa !5
  %63 = load i32, ptr %7, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = sub nsw i64 %62, %64
  %66 = getelementptr inbounds [100100 x i64], ptr @g, i64 0, i64 %65
  %67 = load i64, ptr %66, align 8, !tbaa !5
  %68 = call noundef i64 @_Z4fastxxx(i64 noundef %67, i64 noundef %47, i64 noundef %60)
  %69 = mul nsw i64 %68, %61
  %70 = load i64, ptr %2, align 8, !tbaa !5
  %71 = srem i64 %69, %70
  %72 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @f) #5
  %.not62 = icmp eq i64 %72, 0
  br i1 %.not62, label %._crit_edge, label %.lr.ph56

._crit_edge:                                      ; preds = %98, %48
  %.032.lcssa = phi i64 [ %71, %48 ], [ %.133, %98 ]
  %73 = trunc i64 %.032.lcssa to i32
  %74 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %73)
  %75 = load i64, ptr %3, align 8, !tbaa !5
  %76 = add nsw i64 %75, -1
  store i64 %76, ptr %3, align 8, !tbaa !5
  %.not = icmp eq i64 %75, 0
  br i1 %.not, label %._crit_edge61, label %48, !llvm.loop !13

.lr.ph56:                                         ; preds = %48, %98
  %indvars.iv = phi i64 [ %indvars.iv.next, %98 ], [ 0, %48 ]
  %.03254 = phi i64 [ %.133, %98 ], [ %71, %48 ]
  %77 = load i64, ptr %1, align 8, !tbaa !5
  %78 = getelementptr inbounds [100100 x [10 x i64]], ptr @pwrs, i64 0, i64 %77, i64 %indvars.iv
  %79 = load i64, ptr %78, align 8, !tbaa !5
  %80 = load i32, ptr %7, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [100100 x [10 x i64]], ptr @pwrs, i64 0, i64 %81, i64 %indvars.iv
  %83 = load i64, ptr %82, align 8, !tbaa !5
  %84 = sub nsw i64 %77, %81
  %85 = getelementptr inbounds [100100 x [10 x i64]], ptr @pwrs, i64 0, i64 %84, i64 %indvars.iv
  %86 = load i64, ptr %85, align 8, !tbaa !5
  %87 = add i64 %86, %83
  %.not41 = icmp eq i64 %79, %87
  br i1 %.not41, label %98, label %88

88:                                               ; preds = %.lr.ph56
  %89 = sub i64 %79, %87
  %90 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @f, i64 noundef %indvars.iv) #5
  %91 = load i32, ptr %90, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = load i64, ptr %2, align 8, !tbaa !5
  %94 = call noundef i64 @_Z4fastxxx(i64 noundef %92, i64 noundef %89, i64 noundef %93)
  %95 = mul nsw i64 %94, %.03254
  %96 = load i64, ptr %2, align 8, !tbaa !5
  %97 = srem i64 %95, %96
  br label %98

98:                                               ; preds = %.lr.ph56, %88
  %.133 = phi i64 [ %97, %88 ], [ %.03254, %.lr.ph56 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %99 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @f) #5
  %100 = icmp ugt i64 %99, %indvars.iv.next
  br i1 %100, label %.lr.ph56, label %._crit_edge, !llvm.loop !14

._crit_edge61:                                    ; preds = %._crit_edge, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

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

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

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 #4 = { inlinehint 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 #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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}


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