; LLVM IR from sgtlaugh/algovault :: code_library (bit_string_lcs)

; 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 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [84 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1

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

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

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

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca [100000 x i8], align 16
  %3 = alloca [100000 x i8], align 16
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 100000, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 100000, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 99990, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 99990, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %9

9:                                                ; preds = %26, %0
  %10 = load i32, ptr %6, align 4, !tbaa !5
  %11 = load i32, ptr %4, align 4, !tbaa !5
  %12 = icmp slt i32 %10, %11
  br i1 %12, label %14, label %13

13:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %29

14:                                               ; preds = %9
  %15 = load i32, ptr %6, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = load i32, ptr %6, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = mul nsw i64 %16, %18
  %20 = srem i64 %19, 26
  %21 = add nsw i64 %20, 97
  %22 = trunc i64 %21 to i8
  %23 = load i32, ptr %6, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [100000 x i8], ptr %2, i64 0, i64 %24
  store i8 %22, ptr %25, align 1, !tbaa !9
  br label %26

26:                                               ; preds = %14
  %27 = load i32, ptr %6, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %6, align 4, !tbaa !5
  br label %9, !llvm.loop !10

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

30:                                               ; preds = %50, %29
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %53

35:                                               ; preds = %30
  %36 = load i32, ptr %7, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = mul nsw i64 %37, %39
  %41 = load i32, ptr %7, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = mul nsw i64 %40, %42
  %44 = srem i64 %43, 26
  %45 = add nsw i64 %44, 97
  %46 = trunc i64 %45 to i8
  %47 = load i32, ptr %7, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [100000 x i8], ptr %3, i64 0, i64 %48
  store i8 %46, ptr %49, align 1, !tbaa !9
  br label %50

50:                                               ; preds = %35
  %51 = load i32, ptr %7, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %7, align 4, !tbaa !5
  br label %30, !llvm.loop !12

53:                                               ; preds = %34
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [100000 x i8], ptr %3, i64 0, i64 %55
  store i8 0, ptr %56, align 1, !tbaa !9
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [100000 x i8], ptr %2, i64 0, i64 %58
  store i8 0, ptr %59, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %60 = call i64 @clock() #5
  store i64 %60, ptr %8, align 8, !tbaa !13
  %61 = getelementptr inbounds [100000 x i8], ptr %2, i64 0, i64 0
  %62 = getelementptr inbounds [100000 x i8], ptr %3, i64 0, i64 0
  %63 = call noundef i32 @_Z3lcsPKcS0_(ptr noundef %61, ptr noundef %62)
  %64 = icmp eq i32 %63, 23075
  br i1 %64, label %65, label %66

65:                                               ; preds = %53
  br label %68

66:                                               ; preds = %53
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 55, ptr noundef @__PRETTY_FUNCTION__.main) #6
  unreachable

67:                                               ; No predecessors!
  br label %68

68:                                               ; preds = %67, %65
  %69 = load ptr, ptr @stderr, align 8, !tbaa !15
  %70 = call i64 @clock() #5
  %71 = load i64, ptr %8, align 8, !tbaa !13
  %72 = sub nsw i64 %70, %71
  %73 = sitofp i64 %72 to double
  %74 = fdiv double %73, 1.000000e+06
  %75 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %69, ptr noundef @.str.2, double noundef %74) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 100000, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 100000, ptr %2) #5
  ret i32 0
}

; Function Attrs: nounwind
declare i64 @clock() #3

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress norecurse 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 "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 = { noreturn 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 #5 = { nounwind }
attributes #6 = { noreturn 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !7, i64 0}


; 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 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [84 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3lcsPKcS0_(ptr noundef, ptr noundef) local_unnamed_addr #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca [100000 x i8], align 16
  %2 = alloca [100000 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 100000, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 100000, ptr nonnull %2) #6
  br label %3

3:                                                ; preds = %3, %0
  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next.1, %3 ]
  %4 = mul nuw nsw i64 %indvars.iv, %indvars.iv
  %5 = urem i64 %4, 26
  %6 = trunc nuw nsw i64 %5 to i8
  %7 = or disjoint i8 %6, 97
  %8 = getelementptr inbounds [100000 x i8], ptr %1, i64 0, i64 %indvars.iv
  store i8 %7, ptr %8, align 2, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %9 = mul nuw nsw i64 %indvars.iv.next, %indvars.iv.next
  %10 = urem i64 %9, 26
  %11 = trunc nuw nsw i64 %10 to i8
  %12 = add nuw nsw i8 %11, 97
  %13 = getelementptr inbounds [100000 x i8], ptr %1, i64 0, i64 %indvars.iv.next
  store i8 %12, ptr %13, align 1, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 99990
  br i1 %exitcond.not.1, label %.preheader, label %3, !llvm.loop !8

14:                                               ; preds = %.preheader
  %15 = getelementptr inbounds i8, ptr %2, i64 99990
  store i8 0, ptr %15, align 2, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %1, i64 99990
  store i8 0, ptr %16, align 2, !tbaa !5
  %17 = tail call i64 @clock() #6
  %18 = call noundef i32 @_Z3lcsPKcS0_(ptr noundef nonnull %1, ptr noundef nonnull %2)
  %19 = icmp eq i32 %18, 23075
  br i1 %19, label %33, label %32

.preheader:                                       ; preds = %3, %.preheader
  %indvars.iv20 = phi i64 [ %indvars.iv.next21.1, %.preheader ], [ 0, %3 ]
  %20 = mul nuw nsw i64 %indvars.iv20, %indvars.iv20
  %21 = mul nuw nsw i64 %20, %indvars.iv20
  %22 = urem i64 %21, 26
  %23 = trunc nuw nsw i64 %22 to i8
  %24 = or disjoint i8 %23, 97
  %25 = getelementptr inbounds [100000 x i8], ptr %2, i64 0, i64 %indvars.iv20
  store i8 %24, ptr %25, align 2, !tbaa !5
  %indvars.iv.next21 = or disjoint i64 %indvars.iv20, 1
  %26 = mul nuw nsw i64 %indvars.iv.next21, %indvars.iv.next21
  %27 = mul nuw nsw i64 %26, %indvars.iv.next21
  %28 = urem i64 %27, 26
  %29 = trunc nuw nsw i64 %28 to i8
  %30 = add nuw nsw i8 %29, 97
  %31 = getelementptr inbounds [100000 x i8], ptr %2, i64 0, i64 %indvars.iv.next21
  store i8 %30, ptr %31, align 1, !tbaa !5
  %indvars.iv.next21.1 = add nuw nsw i64 %indvars.iv20, 2
  %exitcond23.not.1 = icmp eq i64 %indvars.iv.next21.1, 99990
  br i1 %exitcond23.not.1, label %14, label %.preheader, !llvm.loop !10

32:                                               ; preds = %14
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 55, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

33:                                               ; preds = %14
  %34 = load ptr, ptr @stderr, align 8, !tbaa !11
  %35 = call i64 @clock() #6
  %36 = sub nsw i64 %35, %17
  %37 = sitofp i64 %36 to double
  %38 = fdiv double %37, 1.000000e+06
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef nonnull @.str.2, double noundef %38) #8
  call void @llvm.lifetime.end.p0(i64 100000, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 100000, ptr nonnull %1) #6
  ret i32 0
}

; Function Attrs: nounwind
declare i64 @clock() local_unnamed_addr #3

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

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

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 = { mustprogress norecurse 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 "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 = { noreturn 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn nounwind }
attributes #8 = { cold 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !6, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass