; LLVM IR from gzc/CLRS :: C15-Dynamic-Programming (Assembly-line-sche)

; 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 [12 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @Fastway(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, 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: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca [2 x i32], align 4
  %4 = alloca [2 x i32], align 4
  %5 = alloca [5 x i32], align 16
  %6 = alloca [5 x i32], align 16
  %7 = alloca [6 x i32], align 16
  %8 = alloca [6 x i32], align 16
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 6, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %13 = getelementptr inbounds [2 x i32], ptr %3, i64 0, i64 0
  store i32 2, ptr %13, align 4, !tbaa !5
  %14 = getelementptr inbounds [2 x i32], ptr %3, i64 0, i64 1
  store i32 4, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %15 = getelementptr inbounds [2 x i32], ptr %4, i64 0, i64 0
  store i32 3, ptr %15, align 4, !tbaa !5
  %16 = getelementptr inbounds [2 x i32], ptr %4, i64 0, i64 1
  store i32 2, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 20, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 20, ptr %6) #4
  %17 = getelementptr inbounds [5 x i32], ptr %5, i64 0, i64 0
  store i32 2, ptr %17, align 16, !tbaa !5
  %18 = getelementptr inbounds [5 x i32], ptr %5, i64 0, i64 1
  store i32 3, ptr %18, align 4, !tbaa !5
  %19 = getelementptr inbounds [5 x i32], ptr %5, i64 0, i64 2
  store i32 1, ptr %19, align 8, !tbaa !5
  %20 = getelementptr inbounds [5 x i32], ptr %5, i64 0, i64 3
  store i32 3, ptr %20, align 4, !tbaa !5
  %21 = getelementptr inbounds [5 x i32], ptr %5, i64 0, i64 4
  store i32 4, ptr %21, align 16, !tbaa !5
  %22 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 0
  store i32 2, ptr %22, align 16, !tbaa !5
  %23 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 1
  store i32 1, ptr %23, align 4, !tbaa !5
  %24 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 2
  store i32 2, ptr %24, align 8, !tbaa !5
  %25 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 3
  store i32 2, ptr %25, align 4, !tbaa !5
  %26 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 4
  store i32 1, ptr %26, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #4
  %27 = getelementptr inbounds [6 x i32], ptr %7, i64 0, i64 0
  store i32 7, ptr %27, align 16, !tbaa !5
  %28 = getelementptr inbounds [6 x i32], ptr %7, i64 0, i64 1
  store i32 9, ptr %28, align 4, !tbaa !5
  %29 = getelementptr inbounds [6 x i32], ptr %7, i64 0, i64 2
  store i32 3, ptr %29, align 8, !tbaa !5
  %30 = getelementptr inbounds [6 x i32], ptr %7, i64 0, i64 3
  store i32 4, ptr %30, align 4, !tbaa !5
  %31 = getelementptr inbounds [6 x i32], ptr %7, i64 0, i64 4
  store i32 8, ptr %31, align 16, !tbaa !5
  %32 = getelementptr inbounds [6 x i32], ptr %7, i64 0, i64 5
  store i32 4, ptr %32, align 4, !tbaa !5
  %33 = getelementptr inbounds [6 x i32], ptr %8, i64 0, i64 0
  store i32 8, ptr %33, align 16, !tbaa !5
  %34 = getelementptr inbounds [6 x i32], ptr %8, i64 0, i64 1
  store i32 5, ptr %34, align 4, !tbaa !5
  %35 = getelementptr inbounds [6 x i32], ptr %8, i64 0, i64 2
  store i32 6, ptr %35, align 8, !tbaa !5
  %36 = getelementptr inbounds [6 x i32], ptr %8, i64 0, i64 3
  store i32 4, ptr %36, align 4, !tbaa !5
  %37 = getelementptr inbounds [6 x i32], ptr %8, i64 0, i64 4
  store i32 5, ptr %37, align 16, !tbaa !5
  %38 = getelementptr inbounds [6 x i32], ptr %8, i64 0, i64 5
  store i32 7, ptr %38, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = sub nsw i32 %39, 1
  %41 = sext i32 %40 to i64
  %42 = mul i64 %41, 4
  %43 = call noalias ptr @malloc(i64 noundef %42) #5
  store ptr %43, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = sub nsw i32 %44, 1
  %46 = sext i32 %45 to i64
  %47 = mul i64 %46, 4
  %48 = call noalias ptr @malloc(i64 noundef %47) #5
  store ptr %48, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %49 = getelementptr inbounds [6 x i32], ptr %7, i64 0, i64 0
  %50 = getelementptr inbounds [6 x i32], ptr %8, i64 0, i64 0
  %51 = getelementptr inbounds [5 x i32], ptr %5, i64 0, i64 0
  %52 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 0
  %53 = getelementptr inbounds [2 x i32], ptr %3, i64 0, i64 0
  %54 = getelementptr inbounds [2 x i32], ptr %4, i64 0, i64 0
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = load ptr, ptr %10, align 8, !tbaa !9
  %57 = load ptr, ptr %11, align 8, !tbaa !9
  %58 = call i32 @Fastway(ptr noundef %49, ptr noundef %50, ptr noundef %51, ptr noundef %52, ptr noundef %53, ptr noundef %54, i32 noundef %55, ptr noundef %56, ptr noundef %57, ptr noundef %9)
  store i32 %58, ptr %12, align 4, !tbaa !5
  %59 = load i32, ptr %9, align 4, !tbaa !5
  %60 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %59)
  %61 = load ptr, ptr %10, align 8, !tbaa !9
  %62 = load ptr, ptr %11, align 8, !tbaa !9
  %63 = load i32, ptr %12, align 4, !tbaa !5
  %64 = load i32, ptr %2, align 4, !tbaa !5
  call void @reverse_PRINT_STATIONS(ptr noundef %61, ptr noundef %62, i32 noundef %63, i32 noundef %64)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 20, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 20, 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 4, ptr %2) #4
  ret i32 0
}

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 }
attributes #5 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"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.1 = external hidden unnamed_addr constant [12 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @Fastway(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, 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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) 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

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca [2 x i32], align 4
  %2 = alloca [2 x i32], align 4
  %3 = alloca [5 x i32], align 16
  %4 = alloca [5 x i32], align 16
  %5 = alloca [6 x i32], align 16
  %6 = alloca [6 x i32], align 16
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  store i32 2, ptr %1, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %1, i64 4
  store i32 4, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  store i32 3, ptr %2, align 4, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %2, i64 4
  store i32 2, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %4) #4
  store <4 x i32> <i32 2, i32 3, i32 1, i32 3>, ptr %3, align 16, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %3, i64 16
  store i32 4, ptr %10, align 16, !tbaa !5
  store <4 x i32> <i32 2, i32 1, i32 2, i32 2>, ptr %4, align 16, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %4, i64 16
  store i32 1, ptr %11, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #4
  store <4 x i32> <i32 7, i32 9, i32 3, i32 4>, ptr %5, align 16, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %5, i64 16
  store i32 8, ptr %12, align 16, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %5, i64 20
  store i32 4, ptr %13, align 4, !tbaa !5
  store <4 x i32> <i32 8, i32 5, i32 6, i32 4>, ptr %6, align 16, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %6, i64 16
  store i32 5, ptr %14, align 16, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %6, i64 20
  store i32 7, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  %16 = tail call noalias dereferenceable_or_null(20) ptr @malloc(i64 noundef 20) #5
  %17 = tail call noalias dereferenceable_or_null(20) ptr @malloc(i64 noundef 20) #5
  %18 = call i32 @Fastway(ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %1, ptr noundef nonnull %2, i32 noundef 6, ptr noundef %16, ptr noundef %17, ptr noundef nonnull %7)
  %19 = load i32, ptr %7, align 4, !tbaa !5
  %20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %19)
  call void @reverse_PRINT_STATIONS(ptr noundef %16, ptr noundef %17, i32 noundef %18, i32 noundef 6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret i32 0
}

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { nounwind }
attributes #5 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,TailCallElimPass