; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/323 Division 2/Problem D/D.ll (Z3mulPA101_iS0_)

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

@n = external dso_local global i32, align 4
@inf = external dso_local global i32, align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3mulPA101_iS0_(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [101 x [101 x i32]], align 16
  %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
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 40804, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %13

13:                                               ; preds = %78, %2
  %14 = load i32, ptr %6, align 4, !tbaa !9
  %15 = load i32, ptr @n, align 4, !tbaa !9
  %16 = icmp sle i32 %14, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %81

18:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 1, ptr %8, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %74, %18
  %20 = load i32, ptr %8, align 4, !tbaa !9
  %21 = load i32, ptr @n, align 4, !tbaa !9
  %22 = icmp sle i32 %20, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %77

24:                                               ; preds = %19
  %25 = load i32, ptr @inf, align 4, !tbaa !9
  %26 = sub nsw i32 0, %25
  %27 = load i32, ptr %6, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [101 x [101 x i32]], ptr %5, i64 0, i64 %28
  %30 = load i32, ptr %8, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [101 x i32], ptr %29, i64 0, i64 %31
  store i32 %26, ptr %32, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %33

33:                                               ; preds = %70, %24
  %34 = load i32, ptr %9, align 4, !tbaa !9
  %35 = load i32, ptr @n, align 4, !tbaa !9
  %36 = icmp sle i32 %34, %35
  br i1 %36, label %38, label %37

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

38:                                               ; preds = %33
  %39 = load i32, ptr %6, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [101 x [101 x i32]], ptr %5, i64 0, i64 %40
  %42 = load i32, ptr %8, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [101 x i32], ptr %41, i64 0, i64 %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = load i32, ptr %6, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [101 x i32], ptr %45, i64 %47
  %49 = load i32, ptr %9, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [101 x i32], ptr %48, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !9
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = load i32, ptr %9, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [101 x i32], ptr %53, i64 %55
  %57 = load i32, ptr %8, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [101 x i32], ptr %56, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !9
  %61 = add nsw i32 %52, %60
  store i32 %61, ptr %10, align 4, !tbaa !9
  %62 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %44, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %63 = load i32, ptr %62, align 4, !tbaa !9
  %64 = load i32, ptr %6, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [101 x [101 x i32]], ptr %5, i64 0, i64 %65
  %67 = load i32, ptr %8, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [101 x i32], ptr %66, i64 0, i64 %68
  store i32 %63, ptr %69, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %70

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

73:                                               ; preds = %37
  br label %74

74:                                               ; preds = %73
  %75 = load i32, ptr %8, align 4, !tbaa !9
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %8, align 4, !tbaa !9
  br label %19, !llvm.loop !13

77:                                               ; preds = %23
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %6, align 4, !tbaa !9
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %6, align 4, !tbaa !9
  br label %13, !llvm.loop !14

81:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  store i32 1, ptr %11, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %112, %81
  %83 = load i32, ptr %11, align 4, !tbaa !9
  %84 = load i32, ptr @n, align 4, !tbaa !9
  %85 = icmp sle i32 %83, %84
  br i1 %85, label %87, label %86

86:                                               ; preds = %82
  store i32 11, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  br label %115

87:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 1, ptr %12, align 4, !tbaa !9
  br label %88

88:                                               ; preds = %108, %87
  %89 = load i32, ptr %12, align 4, !tbaa !9
  %90 = load i32, ptr @n, align 4, !tbaa !9
  %91 = icmp sle i32 %89, %90
  br i1 %91, label %93, label %92

92:                                               ; preds = %88
  store i32 14, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  br label %111

93:                                               ; preds = %88
  %94 = load i32, ptr %11, align 4, !tbaa !9
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [101 x [101 x i32]], ptr %5, i64 0, i64 %95
  %97 = load i32, ptr %12, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [101 x i32], ptr %96, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !9
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = load i32, ptr %11, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [101 x i32], ptr %101, i64 %103
  %105 = load i32, ptr %12, align 4, !tbaa !9
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [101 x i32], ptr %104, i64 0, i64 %106
  store i32 %100, ptr %107, align 4, !tbaa !9
  br label %108

108:                                              ; preds = %93
  %109 = load i32, ptr %12, align 4, !tbaa !9
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %12, align 4, !tbaa !9
  br label %88, !llvm.loop !15

111:                                              ; preds = %92
  br label %112

112:                                              ; preds = %111
  %113 = load i32, ptr %11, align 4, !tbaa !9
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %11, align 4, !tbaa !9
  br label %82, !llvm.loop !16

115:                                              ; preds = %86
  call void @llvm.lifetime.end.p0(i64 40804, ptr %5) #3
  ret void
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 = !{!"any pointer", !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}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !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"

@n = external dso_local local_unnamed_addr global i32, align 4
@inf = external dso_local local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z3mulPA101_iS0_(ptr nocapture noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca [101 x [101 x i32]], align 16
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 40804, ptr nonnull %3) #3
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %.not42 = icmp slt i32 %5, 1
  br i1 %.not42, label %._crit_edge50, label %.preheader35

.preheader35:                                     ; preds = %2, %._crit_edge41
  %6 = phi i32 [ %7, %._crit_edge41 ], [ %5, %2 ]
  %indvars.iv61 = phi i64 [ %indvars.iv.next62, %._crit_edge41 ], [ 1, %2 ]
  %.not3238 = icmp slt i32 %6, 1
  br i1 %.not3238, label %._crit_edge41, label %.lr.ph40.split

.preheader34:                                     ; preds = %._crit_edge41
  %.not3048 = icmp slt i32 %7, 1
  br i1 %.not3048, label %._crit_edge50, label %.preheader

._crit_edge41:                                    ; preds = %._crit_edge, %.preheader35
  %7 = phi i32 [ %6, %.preheader35 ], [ %14, %._crit_edge ]
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %8 = sext i32 %7 to i64
  %.not.not = icmp slt i64 %indvars.iv61, %8
  br i1 %.not.not, label %.preheader35, label %.preheader34, !llvm.loop !9

.lr.ph40.split:                                   ; preds = %.preheader35, %._crit_edge
  %9 = phi i32 [ %14, %._crit_edge ], [ %6, %.preheader35 ]
  %10 = phi i32 [ %15, %._crit_edge ], [ %6, %.preheader35 ]
  %indvars.iv55 = phi i64 [ %indvars.iv.next56, %._crit_edge ], [ 1, %.preheader35 ]
  %11 = load i32, ptr @inf, align 4, !tbaa !5
  %12 = sub nsw i32 0, %11
  %13 = getelementptr inbounds [101 x [101 x i32]], ptr %3, i64 0, i64 %indvars.iv61, i64 %indvars.iv55
  store i32 %12, ptr %13, align 4, !tbaa !5
  %.not3336 = icmp slt i32 %10, 1
  br i1 %.not3336, label %.lr.ph40.split.._crit_edge_crit_edge, label %.lr.ph

.lr.ph40.split.._crit_edge_crit_edge:             ; preds = %.lr.ph40.split
  %.pre70 = sext i32 %10 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph40.split.._crit_edge_crit_edge
  %.pre-phi71 = phi i64 [ %.pre70, %.lr.ph40.split.._crit_edge_crit_edge ], [ %24, %.lr.ph ]
  %14 = phi i32 [ %9, %.lr.ph40.split.._crit_edge_crit_edge ], [ %23, %.lr.ph ]
  %15 = phi i32 [ %10, %.lr.ph40.split.._crit_edge_crit_edge ], [ %23, %.lr.ph ]
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %.not32.not = icmp slt i64 %indvars.iv55, %.pre-phi71
  br i1 %.not32.not, label %.lr.ph40.split, label %._crit_edge41, !llvm.loop !12

.lr.ph:                                           ; preds = %.lr.ph40.split, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.lr.ph40.split ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #3
  %16 = getelementptr inbounds [101 x i32], ptr %0, i64 %indvars.iv61, i64 %indvars.iv
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = getelementptr inbounds [101 x i32], ptr %1, i64 %indvars.iv, i64 %indvars.iv55
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = add nsw i32 %19, %17
  store i32 %20, ptr %4, align 4, !tbaa !5
  %21 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %22 = load i32, ptr %21, align 4, !tbaa !5
  store i32 %22, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %.not33.not = icmp slt i64 %indvars.iv, %24
  br i1 %.not33.not, label %.lr.ph, label %._crit_edge, !llvm.loop !13

.preheader:                                       ; preds = %.preheader34, %._crit_edge47
  %25 = phi i32 [ %26, %._crit_edge47 ], [ %7, %.preheader34 ]
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %._crit_edge47 ], [ 1, %.preheader34 ]
  %.not3144 = icmp slt i32 %25, 1
  br i1 %.not3144, label %.preheader.._crit_edge47_crit_edge, label %.lr.ph46

.preheader.._crit_edge47_crit_edge:               ; preds = %.preheader
  %.pre = sext i32 %25 to i64
  br label %._crit_edge47

._crit_edge50:                                    ; preds = %._crit_edge47, %2, %.preheader34
  call void @llvm.lifetime.end.p0(i64 40804, ptr nonnull %3) #3
  ret void

._crit_edge47:                                    ; preds = %.lr.ph46, %.preheader.._crit_edge47_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader.._crit_edge47_crit_edge ], [ %31, %.lr.ph46 ]
  %26 = phi i32 [ %25, %.preheader.._crit_edge47_crit_edge ], [ %30, %.lr.ph46 ]
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %.not30.not = icmp slt i64 %indvars.iv67, %.pre-phi
  br i1 %.not30.not, label %.preheader, label %._crit_edge50, !llvm.loop !14

.lr.ph46:                                         ; preds = %.preheader, %.lr.ph46
  %indvars.iv64 = phi i64 [ %indvars.iv.next65, %.lr.ph46 ], [ 1, %.preheader ]
  %27 = getelementptr inbounds [101 x [101 x i32]], ptr %3, i64 0, i64 %indvars.iv67, i64 %indvars.iv64
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = getelementptr inbounds [101 x i32], ptr %0, i64 %indvars.iv67, i64 %indvars.iv64
  store i32 %28, ptr %29, align 4, !tbaa !5
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %.not31.not = icmp slt i64 %indvars.iv64, %31
  br i1 %.not31.not, label %.lr.ph46, label %._crit_edge47, !llvm.loop !15
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

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

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 = { 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 #3 = { 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 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.unswitch.partial.disable"}
!12 = distinct !{!12, !10, !11}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !11}
!15 = distinct !{!15, !10}


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