; LLVM IR from DionysiosB/CodeForces :: 0400-0499 (448D-MultiplicationTable)

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

@_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
  %10 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(8) %4)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %14 = load i64, ptr %2, align 8, !tbaa !5
  %15 = load i64, ptr %3, align 8, !tbaa !5
  %16 = mul nsw i64 %14, %15
  %17 = add nsw i64 %16, 1
  store i64 %17, ptr %6, align 8, !tbaa !5
  br label %18

18:                                               ; preds = %68, %0
  %19 = load i64, ptr %5, align 8, !tbaa !5
  %20 = load i64, ptr %6, align 8, !tbaa !5
  %21 = icmp slt i64 %19, %20
  br i1 %21, label %22, label %69

22:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %23 = load i64, ptr %5, align 8, !tbaa !5
  %24 = load i64, ptr %6, align 8, !tbaa !5
  %25 = add nsw i64 %23, %24
  %26 = sdiv i64 %25, 2
  store i64 %26, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i64 0, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store i64 1, ptr %9, align 8, !tbaa !5
  br label %27

27:                                               ; preds = %51, %22
  %28 = load i64, ptr %9, align 8, !tbaa !5
  %29 = load i64, ptr %2, align 8, !tbaa !5
  %30 = icmp sle i64 %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %54

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %33 = load i64, ptr %3, align 8, !tbaa !5
  %34 = load i64, ptr %7, align 8, !tbaa !5
  %35 = sub nsw i64 %34, 1
  %36 = load i64, ptr %9, align 8, !tbaa !5
  %37 = sdiv i64 %35, %36
  %38 = icmp slt i64 %33, %37
  br i1 %38, label %39, label %41

39:                                               ; preds = %32
  %40 = load i64, ptr %3, align 8, !tbaa !5
  br label %46

41:                                               ; preds = %32
  %42 = load i64, ptr %7, align 8, !tbaa !5
  %43 = sub nsw i64 %42, 1
  %44 = load i64, ptr %9, align 8, !tbaa !5
  %45 = sdiv i64 %43, %44
  br label %46

46:                                               ; preds = %41, %39
  %47 = phi i64 [ %40, %39 ], [ %45, %41 ]
  store i64 %47, ptr %10, align 8, !tbaa !5
  %48 = load i64, ptr %10, align 8, !tbaa !5
  %49 = load i64, ptr %8, align 8, !tbaa !5
  %50 = add nsw i64 %49, %48
  store i64 %50, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %51

51:                                               ; preds = %46
  %52 = load i64, ptr %9, align 8, !tbaa !5
  %53 = add nsw i64 %52, 1
  store i64 %53, ptr %9, align 8, !tbaa !5
  br label %27, !llvm.loop !9

54:                                               ; preds = %31
  %55 = load i64, ptr %8, align 8, !tbaa !5
  %56 = load i64, ptr %4, align 8, !tbaa !5
  %57 = icmp slt i64 %55, %56
  br i1 %57, label %58, label %61

58:                                               ; preds = %54
  %59 = load i64, ptr %7, align 8, !tbaa !5
  %60 = add nsw i64 %59, 1
  store i64 %60, ptr %5, align 8, !tbaa !5
  br label %68

61:                                               ; preds = %54
  %62 = load i64, ptr %8, align 8, !tbaa !5
  %63 = load i64, ptr %4, align 8, !tbaa !5
  %64 = icmp sge i64 %62, %63
  br i1 %64, label %65, label %67

65:                                               ; preds = %61
  %66 = load i64, ptr %7, align 8, !tbaa !5
  store i64 %66, ptr %6, align 8, !tbaa !5
  br label %67

67:                                               ; preds = %65, %61
  br label %68

68:                                               ; preds = %67, %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %18, !llvm.loop !11

69:                                               ; preds = %18
  %70 = load i64, ptr %5, align 8, !tbaa !5
  %71 = sub nsw i64 %70, 1
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %71)
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %72, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  ret i32 0
}

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

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

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

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 #4 = { 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", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


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

@_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
  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
  %4 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %5 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %6 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %7 = load i64, ptr %1, align 8, !tbaa !5
  %8 = load i64, ptr %2, align 8, !tbaa !5
  %9 = mul nsw i64 %8, %7
  %10 = add nsw i64 %9, 1
  %11 = icmp sgt i64 %9, 0
  br i1 %11, label %.lr.ph29, label %._crit_edge30

.lr.ph29:                                         ; preds = %0
  %.not23 = icmp slt i64 %7, 1
  %12 = load i64, ptr %3, align 8, !tbaa !5
  %.fr33 = freeze i64 %12
  br i1 %.not23, label %.lr.ph29.split.us, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.lr.ph29
  %xtraiter = and i64 %7, 1
  %13 = icmp eq i64 %7, 1
  %unroll_iter = and i64 %7, 9223372036854775806
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.lr.ph

.lr.ph29.split.us:                                ; preds = %.lr.ph29
  %14 = icmp sgt i64 %.fr33, 0
  br i1 %14, label %.lr.ph29.split.us.split.us, label %._crit_edge30

.lr.ph29.split.us.split.us:                       ; preds = %.lr.ph29.split.us, %.lr.ph29.split.us.split.us
  %.027.us.us = phi i64 [ %17, %.lr.ph29.split.us.split.us ], [ 1, %.lr.ph29.split.us ]
  %15 = add nuw nsw i64 %.027.us.us, %10
  %16 = lshr i64 %15, 1
  %17 = add nuw nsw i64 %16, 1
  %18 = icmp ult i64 %16, %9
  br i1 %18, label %.lr.ph29.split.us.split.us, label %._crit_edge30, !llvm.loop !9

.lr.ph:                                           ; preds = %.lr.ph.preheader, %._crit_edge
  %.027 = phi i64 [ %.1, %._crit_edge ], [ 1, %.lr.ph.preheader ]
  %.01926 = phi i64 [ %.120, %._crit_edge ], [ %10, %.lr.ph.preheader ]
  %19 = add nuw nsw i64 %.027, %.01926
  %20 = lshr i64 %19, 1
  %21 = add nsw i64 %20, -1
  br i1 %13, label %._crit_edge.unr-lcssa, label %.lr.ph.new

._crit_edge.unr-lcssa:                            ; preds = %.lr.ph.new, %.lr.ph
  %.lcssa39.ph = phi i64 [ poison, %.lr.ph ], [ %31, %.lr.ph.new ]
  %.01725.unr = phi i64 [ 1, %.lr.ph ], [ %32, %.lr.ph.new ]
  %.01824.unr = phi i64 [ 0, %.lr.ph ], [ %31, %.lr.ph.new ]
  br i1 %lcmp.mod.not, label %._crit_edge, label %._crit_edge.epilog-lcssa

._crit_edge.epilog-lcssa:                         ; preds = %._crit_edge.unr-lcssa
  %22 = sdiv i64 %21, %.01725.unr
  %..epil = call i64 @llvm.smin.i64(i64 %8, i64 %22)
  %23 = add nsw i64 %..epil, %.01824.unr
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.unr-lcssa, %._crit_edge.epilog-lcssa
  %.lcssa39 = phi i64 [ %.lcssa39.ph, %._crit_edge.unr-lcssa ], [ %23, %._crit_edge.epilog-lcssa ]
  %24 = icmp slt i64 %.lcssa39, %.fr33
  %25 = add nuw nsw i64 %20, 1
  %.120 = select i1 %24, i64 %.01926, i64 %20
  %.1 = select i1 %24, i64 %25, i64 %.027
  %26 = icmp slt i64 %.1, %.120
  br i1 %26, label %.lr.ph, label %._crit_edge30.loopexit35, !llvm.loop !9

.lr.ph.new:                                       ; preds = %.lr.ph, %.lr.ph.new
  %.01725 = phi i64 [ %32, %.lr.ph.new ], [ 1, %.lr.ph ]
  %.01824 = phi i64 [ %31, %.lr.ph.new ], [ 0, %.lr.ph ]
  %niter = phi i64 [ %niter.next.1, %.lr.ph.new ], [ 0, %.lr.ph ]
  %27 = sdiv i64 %21, %.01725
  %. = call i64 @llvm.smin.i64(i64 %8, i64 %27)
  %28 = add nsw i64 %., %.01824
  %29 = add nuw i64 %.01725, 1
  %30 = sdiv i64 %21, %29
  %..1 = call i64 @llvm.smin.i64(i64 %8, i64 %30)
  %31 = add nsw i64 %..1, %28
  %32 = add nuw i64 %.01725, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.unr-lcssa, label %.lr.ph.new, !llvm.loop !11

._crit_edge30.loopexit35:                         ; preds = %._crit_edge
  %33 = add nsw i64 %.1, -1
  br label %._crit_edge30

._crit_edge30:                                    ; preds = %.lr.ph29.split.us.split.us, %.lr.ph29.split.us, %._crit_edge30.loopexit35, %0
  %.0.lcssa = phi i64 [ 0, %0 ], [ %33, %._crit_edge30.loopexit35 ], [ 0, %.lr.ph29.split.us ], [ %16, %.lr.ph29.split.us.split.us ]
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.0.lcssa)
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %34, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  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 i32 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 uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #4

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


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