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

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

@n = external dso_local global i64, align 8
@m = external dso_local global i64, align 8
@k = external dso_local global i64, align 8
@mn = external dso_local global i64, align 8
@_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 i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  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)
  %16 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %17 = getelementptr i8, ptr %16, i64 -24
  %18 = load i64, ptr %17, align 8
  %19 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %18
  %20 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %19, ptr noundef null)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 8 dereferenceable(8) @m)
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 8 dereferenceable(8) @k)
  %24 = load i64, ptr @n, align 8, !tbaa !8
  %25 = icmp eq i64 %24, 1
  br i1 %25, label %26, label %32

26:                                               ; preds = %0
  %27 = load i64, ptr @m, align 8, !tbaa !8
  %28 = icmp eq i64 %27, 1
  br i1 %28, label %29, label %32

29:                                               ; preds = %26
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %30, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  br label %200

32:                                               ; preds = %26, %0
  %33 = load i64, ptr @n, align 8, !tbaa !8
  %34 = icmp eq i64 %33, 1
  br i1 %34, label %35, label %40

35:                                               ; preds = %32
  %36 = load i64, ptr @k, align 8, !tbaa !8
  %37 = load i64, ptr @m, align 8, !tbaa !8
  %38 = sub nsw i64 %37, 1
  %39 = icmp sgt i64 %36, %38
  br i1 %39, label %48, label %40

40:                                               ; preds = %35, %32
  %41 = load i64, ptr @m, align 8, !tbaa !8
  %42 = icmp eq i64 %41, 1
  br i1 %42, label %43, label %51

43:                                               ; preds = %40
  %44 = load i64, ptr @k, align 8, !tbaa !8
  %45 = load i64, ptr @n, align 8, !tbaa !8
  %46 = sub nsw i64 %45, 1
  %47 = icmp sgt i64 %44, %46
  br i1 %47, label %48, label %51

48:                                               ; preds = %43, %35
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %49, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  br label %200

51:                                               ; preds = %43, %40
  %52 = load i64, ptr @n, align 8, !tbaa !8
  %53 = icmp ne i64 %52, 1
  br i1 %53, label %54, label %68

54:                                               ; preds = %51
  %55 = load i64, ptr @m, align 8, !tbaa !8
  %56 = icmp ne i64 %55, 1
  br i1 %56, label %57, label %68

57:                                               ; preds = %54
  %58 = load i64, ptr @k, align 8, !tbaa !8
  %59 = load i64, ptr @n, align 8, !tbaa !8
  %60 = sub nsw i64 %59, 1
  %61 = load i64, ptr @m, align 8, !tbaa !8
  %62 = sub nsw i64 %61, 1
  %63 = add nsw i64 %60, %62
  %64 = icmp sgt i64 %58, %63
  br i1 %64, label %65, label %68

65:                                               ; preds = %57
  %66 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %66, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  br label %200

68:                                               ; preds = %57, %54, %51
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %71

71:                                               ; preds = %130, %70
  %72 = load i64, ptr %2, align 8, !tbaa !8
  %73 = load i64, ptr %2, align 8, !tbaa !8
  %74 = mul nsw i64 %72, %73
  %75 = load i64, ptr @n, align 8, !tbaa !8
  %76 = icmp sle i64 %74, %75
  br i1 %76, label %77, label %81

77:                                               ; preds = %71
  %78 = load i64, ptr %2, align 8, !tbaa !8
  %79 = load i64, ptr @k, align 8, !tbaa !8
  %80 = icmp sle i64 %78, %79
  br label %81

81:                                               ; preds = %77, %71
  %82 = phi i1 [ false, %71 ], [ %80, %77 ]
  br i1 %82, label %84, label %83

83:                                               ; preds = %81
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %133

84:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  %85 = load i64, ptr @n, align 8, !tbaa !8
  %86 = load i64, ptr %2, align 8, !tbaa !8
  %87 = add nsw i64 %86, 1
  %88 = sdiv i64 %85, %87
  store i64 %88, ptr %3, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %89 = load i64, ptr @n, align 8, !tbaa !8
  %90 = load i64, ptr %2, align 8, !tbaa !8
  %91 = add nsw i64 %90, 1
  %92 = sdiv i64 %89, %91
  %93 = load i64, ptr @m, align 8, !tbaa !8
  %94 = load i64, ptr @k, align 8, !tbaa !8
  %95 = load i64, ptr %2, align 8, !tbaa !8
  %96 = sub nsw i64 %94, %95
  %97 = add nsw i64 %96, 1
  %98 = sdiv i64 %93, %97
  %99 = mul nsw i64 %92, %98
  store i64 %99, ptr %4, align 8, !tbaa !8
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @mn, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %101 = load i64, ptr %100, align 8, !tbaa !8
  store i64 %101, ptr @mn, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  %102 = load i64, ptr %3, align 8, !tbaa !8
  %103 = load i64, ptr @k, align 8, !tbaa !8
  %104 = icmp sle i64 %102, %103
  br i1 %104, label %105, label %129

105:                                              ; preds = %84
  %106 = load i64, ptr %3, align 8, !tbaa !8
  %107 = icmp sgt i64 %106, 0
  br i1 %107, label %108, label %129

108:                                              ; preds = %105
  %109 = load i64, ptr @k, align 8, !tbaa !8
  %110 = load i64, ptr %3, align 8, !tbaa !8
  %111 = sub nsw i64 %110, 1
  %112 = sub nsw i64 %109, %111
  %113 = add nsw i64 %112, 1
  %114 = icmp sgt i64 %113, 0
  br i1 %114, label %115, label %129

115:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %116 = load i64, ptr @n, align 8, !tbaa !8
  %117 = load i64, ptr %3, align 8, !tbaa !8
  %118 = sdiv i64 %116, %117
  %119 = load i64, ptr @m, align 8, !tbaa !8
  %120 = load i64, ptr @k, align 8, !tbaa !8
  %121 = load i64, ptr %3, align 8, !tbaa !8
  %122 = sub nsw i64 %121, 1
  %123 = sub nsw i64 %120, %122
  %124 = add nsw i64 %123, 1
  %125 = sdiv i64 %119, %124
  %126 = mul nsw i64 %118, %125
  store i64 %126, ptr %5, align 8, !tbaa !8
  %127 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @mn, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %128 = load i64, ptr %127, align 8, !tbaa !8
  store i64 %128, ptr @mn, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %129

129:                                              ; preds = %115, %108, %105, %84
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br label %130

130:                                              ; preds = %129
  %131 = load i64, ptr %2, align 8, !tbaa !8
  %132 = add nsw i64 %131, 1
  store i64 %132, ptr %2, align 8, !tbaa !8
  br label %71, !llvm.loop !11

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

134:                                              ; preds = %193, %133
  %135 = load i64, ptr %6, align 8, !tbaa !8
  %136 = load i64, ptr %6, align 8, !tbaa !8
  %137 = mul nsw i64 %135, %136
  %138 = load i64, ptr @m, align 8, !tbaa !8
  %139 = icmp sle i64 %137, %138
  br i1 %139, label %140, label %144

140:                                              ; preds = %134
  %141 = load i64, ptr %6, align 8, !tbaa !8
  %142 = load i64, ptr @k, align 8, !tbaa !8
  %143 = icmp sle i64 %141, %142
  br label %144

144:                                              ; preds = %140, %134
  %145 = phi i1 [ false, %134 ], [ %143, %140 ]
  br i1 %145, label %147, label %146

146:                                              ; preds = %144
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %196

147:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %148 = load i64, ptr @m, align 8, !tbaa !8
  %149 = load i64, ptr %6, align 8, !tbaa !8
  %150 = add nsw i64 %149, 1
  %151 = sdiv i64 %148, %150
  store i64 %151, ptr %7, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %152 = load i64, ptr @m, align 8, !tbaa !8
  %153 = load i64, ptr %6, align 8, !tbaa !8
  %154 = add nsw i64 %153, 1
  %155 = sdiv i64 %152, %154
  %156 = load i64, ptr @n, align 8, !tbaa !8
  %157 = load i64, ptr @k, align 8, !tbaa !8
  %158 = load i64, ptr %6, align 8, !tbaa !8
  %159 = sub nsw i64 %157, %158
  %160 = add nsw i64 %159, 1
  %161 = sdiv i64 %156, %160
  %162 = mul nsw i64 %155, %161
  store i64 %162, ptr %8, align 8, !tbaa !8
  %163 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @mn, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %164 = load i64, ptr %163, align 8, !tbaa !8
  store i64 %164, ptr @mn, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  %165 = load i64, ptr %7, align 8, !tbaa !8
  %166 = load i64, ptr @k, align 8, !tbaa !8
  %167 = icmp sle i64 %165, %166
  br i1 %167, label %168, label %192

168:                                              ; preds = %147
  %169 = load i64, ptr %7, align 8, !tbaa !8
  %170 = icmp sgt i64 %169, 0
  br i1 %170, label %171, label %192

171:                                              ; preds = %168
  %172 = load i64, ptr @k, align 8, !tbaa !8
  %173 = load i64, ptr %7, align 8, !tbaa !8
  %174 = sub nsw i64 %173, 1
  %175 = sub nsw i64 %172, %174
  %176 = add nsw i64 %175, 1
  %177 = icmp sgt i64 %176, 0
  br i1 %177, label %178, label %192

178:                                              ; preds = %171
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %179 = load i64, ptr @m, align 8, !tbaa !8
  %180 = load i64, ptr %7, align 8, !tbaa !8
  %181 = sdiv i64 %179, %180
  %182 = load i64, ptr @n, align 8, !tbaa !8
  %183 = load i64, ptr @k, align 8, !tbaa !8
  %184 = load i64, ptr %7, align 8, !tbaa !8
  %185 = sub nsw i64 %184, 1
  %186 = sub nsw i64 %183, %185
  %187 = add nsw i64 %186, 1
  %188 = sdiv i64 %182, %187
  %189 = mul nsw i64 %181, %188
  store i64 %189, ptr %9, align 8, !tbaa !8
  %190 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @mn, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %191 = load i64, ptr %190, align 8, !tbaa !8
  store i64 %191, ptr @mn, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %192

192:                                              ; preds = %178, %171, %168, %147
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %193

193:                                              ; preds = %192
  %194 = load i64, ptr %6, align 8, !tbaa !8
  %195 = add nsw i64 %194, 1
  store i64 %195, ptr %6, align 8, !tbaa !8
  br label %134, !llvm.loop !13

196:                                              ; preds = %146
  %197 = load i64, ptr @mn, align 8, !tbaa !8
  %198 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %197)
  %199 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %198, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  br label %200

200:                                              ; preds = %196, %65, %48, %29
  %201 = load i32, ptr %1, align 4
  ret i32 %201
}

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: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #6

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

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 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 willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !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" }

@n = external dso_local global i64, align 8
@m = external dso_local global i64, align 8
@k = external dso_local global i64, align 8
@mn = external dso_local global i64, align 8
@_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 i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %6 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %7 = getelementptr i8, ptr %6, i64 -24
  %8 = load i64, ptr %7, align 8
  %9 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %8
  %10 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %9, ptr noundef null)
  %11 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %13
  %15 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  %16 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %17 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(8) @m)
  %18 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(8) @k)
  %19 = load i64, ptr @n, align 8, !tbaa !8
  %20 = icmp eq i64 %19, 1
  %21 = load i64, ptr @m, align 8
  %22 = icmp eq i64 %21, 1
  %or.cond = select i1 %20, i1 %22, i1 false
  br i1 %or.cond, label %23, label %26

23:                                               ; preds = %0
  %24 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %25 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %111

26:                                               ; preds = %0
  %27 = load i64, ptr @k, align 8
  %.not = icmp sge i64 %27, %21
  %or.cond45.not = select i1 %20, i1 %.not, i1 false
  br i1 %or.cond45.not, label %30, label %28

28:                                               ; preds = %26
  br i1 %22, label %29, label %33

29:                                               ; preds = %28
  %.not41 = icmp slt i64 %27, %19
  br i1 %.not41, label %.thread, label %30

30:                                               ; preds = %26, %29
  %31 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %32 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %31, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %111

33:                                               ; preds = %28
  br i1 %20, label %.thread, label %34

34:                                               ; preds = %33
  %35 = add i64 %19, -2
  %36 = add i64 %35, %21
  %37 = icmp sgt i64 %27, %36
  br i1 %37, label %38, label %.thread

38:                                               ; preds = %34
  %39 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %40 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %39, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %111

.thread:                                          ; preds = %29, %34, %33
  %41 = icmp sgt i64 %19, -1
  %42 = icmp sgt i64 %27, -1
  %43 = select i1 %41, i1 %42, i1 false
  br i1 %43, label %.lr.ph, label %.preheader

.preheader.loopexit:                              ; preds = %71
  %.pre55 = load i64, ptr @m, align 8, !tbaa !8
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %.thread
  %44 = phi i64 [ %72, %.preheader.loopexit ], [ %27, %.thread ]
  %45 = phi i64 [ %.pre55, %.preheader.loopexit ], [ %21, %.thread ]
  %46 = icmp sgt i64 %45, -1
  %47 = icmp sgt i64 %44, -1
  %48 = select i1 %46, i1 %47, i1 false
  br i1 %48, label %.lr.ph51, label %.preheader.._crit_edge_crit_edge

.preheader.._crit_edge_crit_edge:                 ; preds = %.preheader
  %.pre57 = load i64, ptr @mn, align 8, !tbaa !8
  br label %._crit_edge

.lr.ph:                                           ; preds = %.thread, %71
  %49 = phi i64 [ %72, %71 ], [ %27, %.thread ]
  %50 = phi i64 [ %74, %71 ], [ %19, %.thread ]
  %.03349 = phi i64 [ %51, %71 ], [ 0, %.thread ]
  %51 = add nuw nsw i64 %.03349, 1
  %52 = sdiv i64 %50, %51
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  %53 = load i64, ptr @m, align 8, !tbaa !8
  %reass.sub = sub i64 %49, %.03349
  %54 = add i64 %reass.sub, 1
  %55 = sdiv i64 %53, %54
  %56 = mul nsw i64 %55, %52
  store i64 %56, ptr %1, align 8, !tbaa !8
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @mn, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %58 = load i64, ptr %57, align 8, !tbaa !8
  store i64 %58, ptr @mn, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %59 = load i64, ptr @k, align 8
  %60 = icmp sle i64 %52, %59
  %61 = icmp sgt i64 %52, 0
  %or.cond5 = and i1 %61, %60
  br i1 %or.cond5, label %62, label %71

62:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %63 = load i64, ptr @n, align 8, !tbaa !8
  %64 = sdiv i64 %63, %52
  %65 = load i64, ptr @m, align 8, !tbaa !8
  %reass.sub52 = sub i64 %59, %52
  %66 = add i64 %reass.sub52, 2
  %67 = sdiv i64 %65, %66
  %68 = mul nsw i64 %67, %64
  store i64 %68, ptr %2, align 8, !tbaa !8
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @mn, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %70 = load i64, ptr %69, align 8, !tbaa !8
  store i64 %70, ptr @mn, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  %.pre = load i64, ptr @k, align 8
  br label %71

71:                                               ; preds = %62, %.lr.ph
  %72 = phi i64 [ %.pre, %62 ], [ %59, %.lr.ph ]
  %73 = mul nuw nsw i64 %51, %51
  %74 = load i64, ptr @n, align 8, !tbaa !8
  %75 = icmp sle i64 %73, %74
  %76 = icmp slt i64 %.03349, %72
  %77 = select i1 %75, i1 %76, i1 false
  br i1 %77, label %.lr.ph, label %.preheader.loopexit, !llvm.loop !11

._crit_edge:                                      ; preds = %103, %.preheader.._crit_edge_crit_edge
  %78 = phi i64 [ %.pre57, %.preheader.._crit_edge_crit_edge ], [ %104, %103 ]
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %78)
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %79, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %111

.lr.ph51:                                         ; preds = %.preheader, %103
  %81 = phi i64 [ %105, %103 ], [ %44, %.preheader ]
  %82 = phi i64 [ %107, %103 ], [ %45, %.preheader ]
  %.03250 = phi i64 [ %83, %103 ], [ 0, %.preheader ]
  %83 = add nuw nsw i64 %.03250, 1
  %84 = sdiv i64 %82, %83
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %85 = load i64, ptr @n, align 8, !tbaa !8
  %reass.sub53 = sub i64 %81, %.03250
  %86 = add i64 %reass.sub53, 1
  %87 = sdiv i64 %85, %86
  %88 = mul nsw i64 %87, %84
  store i64 %88, ptr %3, align 8, !tbaa !8
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @mn, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %90 = load i64, ptr %89, align 8, !tbaa !8
  store i64 %90, ptr @mn, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  %91 = load i64, ptr @k, align 8
  %92 = icmp sle i64 %84, %91
  %93 = icmp sgt i64 %84, 0
  %or.cond7 = and i1 %93, %92
  br i1 %or.cond7, label %94, label %103

94:                                               ; preds = %.lr.ph51
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %95 = load i64, ptr @m, align 8, !tbaa !8
  %96 = sdiv i64 %95, %84
  %97 = load i64, ptr @n, align 8, !tbaa !8
  %reass.sub54 = sub i64 %91, %84
  %98 = add i64 %reass.sub54, 2
  %99 = sdiv i64 %97, %98
  %100 = mul nsw i64 %99, %96
  store i64 %100, ptr %4, align 8, !tbaa !8
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @mn, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %102 = load i64, ptr %101, align 8, !tbaa !8
  store i64 %102, ptr @mn, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  %.pre56 = load i64, ptr @k, align 8
  br label %103

103:                                              ; preds = %94, %.lr.ph51
  %104 = phi i64 [ %102, %94 ], [ %90, %.lr.ph51 ]
  %105 = phi i64 [ %.pre56, %94 ], [ %91, %.lr.ph51 ]
  %106 = mul nuw nsw i64 %83, %83
  %107 = load i64, ptr @m, align 8, !tbaa !8
  %108 = icmp sle i64 %106, %107
  %109 = icmp slt i64 %.03250, %105
  %110 = select i1 %108, i1 %109, i1 false
  br i1 %110, label %.lr.ph51, label %._crit_edge, !llvm.loop !13

111:                                              ; preds = %._crit_edge, %38, %30, %23
  ret i32 0
}

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 uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

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

; 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

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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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