; LLVM IR from smv1999/CompetitiveProgrammingQuestionBank :: Dynamic Programming (LCS_Memoization)

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

@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @LCS(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %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
  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 8, ptr %5) #6
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = call i64 @strlen(ptr noundef %11) #7
  %13 = add i64 1, %12
  %14 = trunc i64 %13 to i32
  store i32 %14, ptr %6, align 4, !tbaa !9
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = call i64 @strlen(ptr noundef %15) #7
  %17 = add i64 1, %16
  %18 = trunc i64 %17 to i32
  store i32 %18, ptr %7, align 4, !tbaa !9
  %19 = load i32, ptr %6, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = mul i64 %20, 8
  %22 = call noalias ptr @malloc(i64 noundef %21) #8
  store ptr %22, ptr %5, align 8, !tbaa !5
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %36, %2
  %24 = load i32, ptr %8, align 4, !tbaa !9
  %25 = load i32, ptr %6, align 4, !tbaa !9
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %27, label %39

27:                                               ; preds = %23
  %28 = load i32, ptr %7, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = mul i64 %29, 4
  %31 = call noalias ptr @malloc(i64 noundef %30) #8
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = load i32, ptr %8, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds ptr, ptr %32, i64 %34
  store ptr %31, ptr %35, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %27
  %37 = load i32, ptr %8, align 4, !tbaa !9
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %8, align 4, !tbaa !9
  br label %23, !llvm.loop !11

39:                                               ; preds = %23
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %62, %39
  %41 = load i32, ptr %8, align 4, !tbaa !9
  %42 = load i32, ptr %6, align 4, !tbaa !9
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %44, label %65

44:                                               ; preds = %40
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %45

45:                                               ; preds = %58, %44
  %46 = load i32, ptr %9, align 4, !tbaa !9
  %47 = load i32, ptr %7, align 4, !tbaa !9
  %48 = icmp slt i32 %46, %47
  br i1 %48, label %49, label %61

49:                                               ; preds = %45
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = load i32, ptr %8, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds ptr, ptr %50, i64 %52
  %54 = load ptr, ptr %53, align 8, !tbaa !5
  %55 = load i32, ptr %9, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds i32, ptr %54, i64 %56
  store i32 -1, ptr %57, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %49
  %59 = load i32, ptr %9, align 4, !tbaa !9
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %9, align 4, !tbaa !9
  br label %45, !llvm.loop !13

61:                                               ; preds = %45
  br label %62

62:                                               ; preds = %61
  %63 = load i32, ptr %8, align 4, !tbaa !9
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %8, align 4, !tbaa !9
  br label %40, !llvm.loop !14

65:                                               ; preds = %40
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = call i32 @LCS_utility(ptr noundef %66, ptr noundef %67, i32 noundef 0, i32 noundef 0, ptr noundef %68)
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %70

70:                                               ; preds = %94, %65
  %71 = load i32, ptr %8, align 4, !tbaa !9
  %72 = load i32, ptr %6, align 4, !tbaa !9
  %73 = icmp slt i32 %71, %72
  br i1 %73, label %74, label %98

74:                                               ; preds = %70
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %75

75:                                               ; preds = %90, %74
  %76 = load i32, ptr %9, align 4, !tbaa !9
  %77 = load i32, ptr %7, align 4, !tbaa !9
  %78 = icmp slt i32 %76, %77
  br i1 %78, label %79, label %93

79:                                               ; preds = %75
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = load i32, ptr %8, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds ptr, ptr %80, i64 %82
  %84 = load ptr, ptr %83, align 8, !tbaa !5
  %85 = load i32, ptr %9, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds i32, ptr %84, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !9
  %89 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %88)
  br label %90

90:                                               ; preds = %79
  %91 = load i32, ptr %9, align 4, !tbaa !9
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %9, align 4, !tbaa !9
  br label %75, !llvm.loop !15

93:                                               ; preds = %75
  br label %94

94:                                               ; preds = %93
  %95 = load i32, ptr %8, align 4, !tbaa !9
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %8, align 4, !tbaa !9
  %97 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %70, !llvm.loop !16

98:                                               ; preds = %70
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds ptr, ptr %99, i64 0
  %101 = load ptr, ptr %100, align 8, !tbaa !5
  %102 = getelementptr inbounds i32, ptr %101, i64 0
  %103 = load i32, ptr %102, align 4, !tbaa !9
  store i32 %103, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %104

104:                                              ; preds = %114, %98
  %105 = load i32, ptr %8, align 4, !tbaa !9
  %106 = load i32, ptr %6, align 4, !tbaa !9
  %107 = icmp slt i32 %105, %106
  br i1 %107, label %108, label %117

108:                                              ; preds = %104
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = load i32, ptr %8, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds ptr, ptr %109, i64 %111
  %113 = load ptr, ptr %112, align 8, !tbaa !5
  call void @free(ptr noundef %113) #6
  br label %114

114:                                              ; preds = %108
  %115 = load i32, ptr %8, align 4, !tbaa !9
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %8, align 4, !tbaa !9
  br label %104, !llvm.loop !17

117:                                              ; preds = %104
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %118) #6
  %119 = load i32, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  ret i32 %119
}

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local i32 @LCS_utility(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind
declare void @free(ptr noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 willreturn memory(read) "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 allocsize(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 "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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { nounwind allocsize(0) }

!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/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}
!17 = distinct !{!17, !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"

@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @LCS(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #6
  %4 = trunc i64 %3 to i32
  %5 = add i32 %4, 1
  %6 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #6
  %7 = trunc i64 %6 to i32
  %8 = add i32 %7, 1
  %9 = sext i32 %5 to i64
  %10 = shl nsw i64 %9, 3
  %11 = tail call noalias ptr @malloc(i64 noundef %10) #7
  %12 = icmp ult i32 %4, 2147483647
  br i1 %12, label %.lr.ph, label %._crit_edge46.thread

.lr.ph:                                           ; preds = %2
  %13 = sext i32 %8 to i64
  %14 = shl nsw i64 %13, 2
  %wide.trip.count = zext nneg i32 %5 to i64
  br label %36

.preheader41:                                     ; preds = %36
  br i1 %12, label %.preheader40.lr.ph, label %._crit_edge46.thread

.preheader40.lr.ph:                               ; preds = %.preheader41
  %15 = icmp ult i32 %7, 2147483647
  br i1 %15, label %.preheader40.us.preheader, label %.preheader.lr.ph.thread

.preheader.lr.ph.thread:                          ; preds = %.preheader40.lr.ph
  %16 = tail call i32 @LCS_utility(ptr noundef %0, ptr noundef %1, i32 noundef 0, i32 noundef 0, ptr noundef nonnull %11)
  br label %.preheader

.preheader40.us.preheader:                        ; preds = %.preheader40.lr.ph
  %17 = zext nneg i32 %8 to i64
  %18 = shl nuw nsw i64 %17, 2
  %xtraiter = and i64 %wide.trip.count, 7
  %19 = icmp ult i32 %5, 8
  br i1 %19, label %._crit_edge46.unr-lcssa, label %.preheader40.us.preheader.new

.preheader40.us.preheader.new:                    ; preds = %.preheader40.us.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483640
  br label %.preheader40.us

.preheader40.us:                                  ; preds = %.preheader40.us, %.preheader40.us.preheader.new
  %indvars.iv60 = phi i64 [ 0, %.preheader40.us.preheader.new ], [ %indvars.iv.next61.7, %.preheader40.us ]
  %niter = phi i64 [ 0, %.preheader40.us.preheader.new ], [ %niter.next.7, %.preheader40.us ]
  %20 = getelementptr inbounds ptr, ptr %11, i64 %indvars.iv60
  %21 = load ptr, ptr %20, align 8, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr align 4 %21, i8 -1, i64 %18, i1 false), !tbaa !9
  %indvars.iv.next61 = or disjoint i64 %indvars.iv60, 1
  %22 = getelementptr inbounds ptr, ptr %11, i64 %indvars.iv.next61
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr align 4 %23, i8 -1, i64 %18, i1 false), !tbaa !9
  %indvars.iv.next61.1 = or disjoint i64 %indvars.iv60, 2
  %24 = getelementptr inbounds ptr, ptr %11, i64 %indvars.iv.next61.1
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr align 4 %25, i8 -1, i64 %18, i1 false), !tbaa !9
  %indvars.iv.next61.2 = or disjoint i64 %indvars.iv60, 3
  %26 = getelementptr inbounds ptr, ptr %11, i64 %indvars.iv.next61.2
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr align 4 %27, i8 -1, i64 %18, i1 false), !tbaa !9
  %indvars.iv.next61.3 = or disjoint i64 %indvars.iv60, 4
  %28 = getelementptr inbounds ptr, ptr %11, i64 %indvars.iv.next61.3
  %29 = load ptr, ptr %28, align 8, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr align 4 %29, i8 -1, i64 %18, i1 false), !tbaa !9
  %indvars.iv.next61.4 = or disjoint i64 %indvars.iv60, 5
  %30 = getelementptr inbounds ptr, ptr %11, i64 %indvars.iv.next61.4
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr align 4 %31, i8 -1, i64 %18, i1 false), !tbaa !9
  %indvars.iv.next61.5 = or disjoint i64 %indvars.iv60, 6
  %32 = getelementptr inbounds ptr, ptr %11, i64 %indvars.iv.next61.5
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr align 4 %33, i8 -1, i64 %18, i1 false), !tbaa !9
  %indvars.iv.next61.6 = or disjoint i64 %indvars.iv60, 7
  %34 = getelementptr inbounds ptr, ptr %11, i64 %indvars.iv.next61.6
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr align 4 %35, i8 -1, i64 %18, i1 false), !tbaa !9
  %indvars.iv.next61.7 = add nuw nsw i64 %indvars.iv60, 8
  %niter.next.7 = add i64 %niter, 8
  %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %._crit_edge46.unr-lcssa, label %.preheader40.us, !llvm.loop !11

36:                                               ; preds = %.lr.ph, %36
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %36 ]
  %37 = tail call noalias ptr @malloc(i64 noundef %14) #7
  %38 = getelementptr inbounds ptr, ptr %11, i64 %indvars.iv
  store ptr %37, ptr %38, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader41, label %36, !llvm.loop !13

._crit_edge46.thread:                             ; preds = %.preheader41, %2
  %39 = tail call i32 @LCS_utility(ptr noundef %0, ptr noundef %1, i32 noundef 0, i32 noundef 0, ptr noundef %11)
  br label %._crit_edge50.thread

._crit_edge46.unr-lcssa:                          ; preds = %.preheader40.us, %.preheader40.us.preheader
  %indvars.iv60.unr = phi i64 [ 0, %.preheader40.us.preheader ], [ %indvars.iv.next61.7, %.preheader40.us ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge46, label %.preheader40.us.epil

.preheader40.us.epil:                             ; preds = %._crit_edge46.unr-lcssa, %.preheader40.us.epil
  %indvars.iv60.epil = phi i64 [ %indvars.iv.next61.epil, %.preheader40.us.epil ], [ %indvars.iv60.unr, %._crit_edge46.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.preheader40.us.epil ], [ 0, %._crit_edge46.unr-lcssa ]
  %40 = getelementptr inbounds ptr, ptr %11, i64 %indvars.iv60.epil
  %41 = load ptr, ptr %40, align 8, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr align 4 %41, i8 -1, i64 %18, i1 false), !tbaa !9
  %indvars.iv.next61.epil = add nuw nsw i64 %indvars.iv60.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge46, label %.preheader40.us.epil, !llvm.loop !14

._crit_edge46:                                    ; preds = %.preheader40.us.epil, %._crit_edge46.unr-lcssa
  %42 = tail call i32 @LCS_utility(ptr noundef %0, ptr noundef %1, i32 noundef 0, i32 noundef 0, ptr noundef nonnull %11)
  br i1 %12, label %.preheader.us.preheader, label %._crit_edge50.thread

.preheader.us.preheader:                          ; preds = %._crit_edge46
  %wide.trip.count74 = zext nneg i32 %5 to i64
  %wide.trip.count69 = zext i32 %8 to i64
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge.us51
  %indvars.iv71 = phi i64 [ 0, %.preheader.us.preheader ], [ %indvars.iv.next72, %._crit_edge.us51 ]
  %43 = getelementptr inbounds ptr, ptr %11, i64 %indvars.iv71
  br label %44

44:                                               ; preds = %.preheader.us, %44
  %indvars.iv66 = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next67, %44 ]
  %45 = load ptr, ptr %43, align 8, !tbaa !5
  %46 = getelementptr inbounds i32, ptr %45, i64 %indvars.iv66
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %47)
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %exitcond70.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count69
  br i1 %exitcond70.not, label %._crit_edge.us51, label %44, !llvm.loop !16

._crit_edge.us51:                                 ; preds = %44
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %49 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %exitcond75.not = icmp eq i64 %indvars.iv.next72, %wide.trip.count74
  br i1 %exitcond75.not, label %._crit_edge50, label %.preheader.us, !llvm.loop !17

.preheader:                                       ; preds = %.preheader.lr.ph.thread, %.preheader
  %.249 = phi i32 [ %50, %.preheader ], [ 0, %.preheader.lr.ph.thread ]
  %50 = add nuw nsw i32 %.249, 1
  %51 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %exitcond65.not = icmp eq i32 %.249, %4
  br i1 %exitcond65.not, label %._crit_edge50, label %.preheader, !llvm.loop !17

._crit_edge50.thread:                             ; preds = %._crit_edge46.thread, %._crit_edge46
  %52 = load ptr, ptr %11, align 8, !tbaa !5
  %53 = load i32, ptr %52, align 4, !tbaa !9
  br label %._crit_edge

._crit_edge50:                                    ; preds = %.preheader, %._crit_edge.us51
  %54 = load ptr, ptr %11, align 8, !tbaa !5
  %55 = load i32, ptr %54, align 4, !tbaa !9
  br i1 %12, label %.lr.ph53.preheader, label %._crit_edge

.lr.ph53.preheader:                               ; preds = %._crit_edge50
  %wide.trip.count79 = zext nneg i32 %5 to i64
  br label %.lr.ph53

.lr.ph53:                                         ; preds = %.lr.ph53.preheader, %.lr.ph53
  %indvars.iv76 = phi i64 [ 0, %.lr.ph53.preheader ], [ %indvars.iv.next77, %.lr.ph53 ]
  %56 = getelementptr inbounds ptr, ptr %11, i64 %indvars.iv76
  %57 = load ptr, ptr %56, align 8, !tbaa !5
  tail call void @free(ptr noundef %57) #8
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
  %exitcond80.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count79
  br i1 %exitcond80.not, label %._crit_edge, label %.lr.ph53, !llvm.loop !18

._crit_edge:                                      ; preds = %.lr.ph53, %._crit_edge50.thread, %._crit_edge50
  %58 = phi i32 [ %53, %._crit_edge50.thread ], [ %55, %._crit_edge50 ], [ %55, %.lr.ph53 ]
  tail call void @free(ptr noundef nonnull %11) #8
  ret i32 %58
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @LCS_utility(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

attributes #0 = { 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 = { 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 #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind willreturn memory(read) }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { 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/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, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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