; LLVM IR from ShahjalalShohag/code-library :: Graph Theory/Counting Labeled Graphs.ll (Z3prev)

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

%struct.modint = type { i32 }

@comb = external dso_local global [210 x [210 x %struct.modint]], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3prev() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %struct.modint, align 4
  %5 = alloca i32, align 4
  %6 = alloca %struct.modint, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %struct.modint, align 4
  %10 = alloca %struct.modint, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %31, %0
  %12 = load i32, ptr %1, align 4, !tbaa !5
  %13 = icmp slt i32 %12, 210
  br i1 %13, label %15, label %14

14:                                               ; preds = %11
  store i32 2, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  br label %34

15:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %27, %15
  %17 = load i32, ptr %3, align 4, !tbaa !5
  %18 = icmp slt i32 %17, 210
  br i1 %18, label %20, label %19

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

20:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @_ZN6modintILi1000000007EEC2Ei(ptr noundef nonnull align 4 dereferenceable(4) %4, i32 noundef 0)
  %21 = load i32, ptr %1, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [210 x [210 x %struct.modint]], ptr @comb, i64 0, i64 %22
  %24 = load i32, ptr %3, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [210 x %struct.modint], ptr %23, i64 0, i64 %25
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %4, i64 4, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %27

27:                                               ; preds = %20
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %3, align 4, !tbaa !5
  br label %16, !llvm.loop !10

30:                                               ; preds = %19
  br label %31

31:                                               ; preds = %30
  %32 = load i32, ptr %1, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %1, align 4, !tbaa !5
  br label %11, !llvm.loop !12

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

35:                                               ; preds = %44, %34
  %36 = load i32, ptr %5, align 4, !tbaa !5
  %37 = icmp slt i32 %36, 210
  br i1 %37, label %39, label %38

38:                                               ; preds = %35
  store i32 8, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %47

39:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @_ZN6modintILi1000000007EEC2Ei(ptr noundef nonnull align 4 dereferenceable(4) %6, i32 noundef 1)
  %40 = load i32, ptr %5, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [210 x [210 x %struct.modint]], ptr @comb, i64 0, i64 %41
  %43 = getelementptr inbounds [210 x %struct.modint], ptr %42, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %43, ptr align 4 %6, i64 4, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %44

44:                                               ; preds = %39
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %5, align 4, !tbaa !5
  br label %35, !llvm.loop !13

47:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %87, %47
  %49 = load i32, ptr %7, align 4, !tbaa !5
  %50 = icmp slt i32 %49, 210
  br i1 %50, label %52, label %51

51:                                               ; preds = %48
  store i32 11, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %90

52:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %83, %52
  %54 = load i32, ptr %8, align 4, !tbaa !5
  %55 = icmp slt i32 %54, 210
  br i1 %55, label %57, label %56

56:                                               ; preds = %53
  store i32 14, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %86

57:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %58 = load i32, ptr %7, align 4, !tbaa !5
  %59 = sub nsw i32 %58, 1
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [210 x [210 x %struct.modint]], ptr @comb, i64 0, i64 %60
  %62 = load i32, ptr %8, align 4, !tbaa !5
  %63 = sub nsw i32 %62, 1
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [210 x %struct.modint], ptr %61, i64 0, i64 %64
  %66 = load i32, ptr %7, align 4, !tbaa !5
  %67 = sub nsw i32 %66, 1
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [210 x [210 x %struct.modint]], ptr @comb, i64 0, i64 %68
  %70 = load i32, ptr %8, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [210 x %struct.modint], ptr %69, i64 0, i64 %71
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 %72, i64 4, i1 false), !tbaa.struct !9
  %73 = getelementptr inbounds %struct.modint, ptr %10, i32 0, i32 0
  %74 = load i32, ptr %73, align 4
  %75 = call i32 @_ZNK6modintILi1000000007EEplES0_(ptr noundef nonnull align 4 dereferenceable(4) %65, i32 %74)
  %76 = getelementptr inbounds %struct.modint, ptr %9, i32 0, i32 0
  store i32 %75, ptr %76, align 4
  %77 = load i32, ptr %7, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [210 x [210 x %struct.modint]], ptr @comb, i64 0, i64 %78
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [210 x %struct.modint], ptr %79, i64 0, i64 %81
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %82, ptr align 4 %9, i64 4, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %83

83:                                               ; preds = %57
  %84 = load i32, ptr %8, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %8, align 4, !tbaa !5
  br label %53, !llvm.loop !14

86:                                               ; preds = %56
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %7, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %7, align 4, !tbaa !5
  br label %48, !llvm.loop !15

90:                                               ; preds = %51
  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: mustprogress nounwind uwtable
declare dso_local void @_ZN6modintILi1000000007EEC2Ei(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) unnamed_addr #2 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

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

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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{i64 0, i64 4, !5}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}


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

%struct.modint = type { i32 }

@comb = external dso_local global [210 x [210 x %struct.modint]], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3prev() local_unnamed_addr #0 {
  %1 = alloca %struct.modint, align 4
  %2 = alloca %struct.modint, align 4
  br label %.preheader26

.preheader26:                                     ; preds = %0, %3
  %indvars.iv33 = phi i64 [ 0, %0 ], [ %indvars.iv.next34, %3 ]
  br label %4

3:                                                ; preds = %4
  %indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1
  %exitcond36.not = icmp eq i64 %indvars.iv.next34, 210
  br i1 %exitcond36.not, label %.preheader25, label %.preheader26, !llvm.loop !5

4:                                                ; preds = %.preheader26, %4
  %indvars.iv = phi i64 [ 0, %.preheader26 ], [ %indvars.iv.next, %4 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  call void @_ZN6modintILi1000000007EEC2Ei(ptr noundef nonnull align 4 dereferenceable(4) %1, i32 noundef 0)
  %5 = getelementptr inbounds [210 x [210 x %struct.modint]], ptr @comb, i64 0, i64 %indvars.iv33, i64 %indvars.iv
  %6 = load i32, ptr %1, align 4, !tbaa !7
  store i32 %6, ptr %5, align 4, !tbaa !7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 210
  br i1 %exitcond.not, label %3, label %4, !llvm.loop !11

.preheader25:                                     ; preds = %3, %.preheader25
  %indvars.iv37 = phi i64 [ %indvars.iv.next38, %.preheader25 ], [ 0, %3 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  call void @_ZN6modintILi1000000007EEC2Ei(ptr noundef nonnull align 4 dereferenceable(4) %2, i32 noundef 1)
  %7 = getelementptr inbounds [210 x [210 x %struct.modint]], ptr @comb, i64 0, i64 %indvars.iv37
  %8 = load i32, ptr %2, align 4, !tbaa !7
  store i32 %8, ptr %7, align 8, !tbaa !7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  %indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
  %exitcond40.not = icmp eq i64 %indvars.iv.next38, 210
  br i1 %exitcond40.not, label %.preheader, label %.preheader25, !llvm.loop !12

.preheader:                                       ; preds = %.preheader25, %11
  %indvars.iv45 = phi i64 [ %indvars.iv.next46, %11 ], [ 1, %.preheader25 ]
  %9 = add nsw i64 %indvars.iv45, -1
  br label %12

10:                                               ; preds = %11
  ret void

11:                                               ; preds = %12
  %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
  %exitcond48.not = icmp eq i64 %indvars.iv.next46, 210
  br i1 %exitcond48.not, label %10, label %.preheader, !llvm.loop !13

12:                                               ; preds = %.preheader, %12
  %indvars.iv41 = phi i64 [ 1, %.preheader ], [ %indvars.iv.next42, %12 ]
  %13 = add nsw i64 %indvars.iv41, -1
  %14 = getelementptr inbounds [210 x [210 x %struct.modint]], ptr @comb, i64 0, i64 %9, i64 %13
  %15 = getelementptr inbounds [210 x [210 x %struct.modint]], ptr @comb, i64 0, i64 %9, i64 %indvars.iv41
  %.sroa.0.0.copyload = load i32, ptr %15, align 4, !tbaa !7
  %16 = call i32 @_ZNK6modintILi1000000007EEplES0_(ptr noundef nonnull align 4 dereferenceable(4) %14, i32 %.sroa.0.0.copyload)
  %17 = getelementptr inbounds [210 x [210 x %struct.modint]], ptr @comb, i64 0, i64 %indvars.iv45, i64 %indvars.iv41
  store i32 %16, ptr %17, align 4, !tbaa !7
  %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
  %exitcond44.not = icmp eq i64 %indvars.iv.next42, 210
  br i1 %exitcond44.not, label %11, label %12, !llvm.loop !14
}

; 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 nounwind uwtable
declare dso_local void @_ZN6modintILi1000000007EEC2Ei(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) 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: inlinehint mustprogress uwtable
declare dso_local i32 @_ZNK6modintILi1000000007EEplES0_(ptr noundef nonnull align 4 dereferenceable(4), i32) local_unnamed_addr #3 align 2

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass