; LLVM IR from begeekmyfriend/leetcode :: 0207_course_schedule (course_schedule)

; 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 [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 6, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 6, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %7 = load i32, ptr %4, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %9 = mul i64 %8, 8
  %10 = call noalias ptr @malloc(i64 noundef %9) #5
  store ptr %10, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %11 = load i32, ptr %4, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = mul i64 %12, 4
  %14 = call noalias ptr @malloc(i64 noundef %13) #5
  store ptr %14, ptr %6, align 8, !tbaa !9
  %15 = call noalias ptr @malloc(i64 noundef 8) #5
  %16 = load ptr, ptr %5, align 8, !tbaa !9
  %17 = getelementptr inbounds ptr, ptr %16, i64 0
  store ptr %15, ptr %17, align 8, !tbaa !9
  %18 = load ptr, ptr %5, align 8, !tbaa !9
  %19 = getelementptr inbounds ptr, ptr %18, i64 0
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  %21 = getelementptr inbounds i32, ptr %20, i64 0
  store i32 1, ptr %21, align 4, !tbaa !5
  %22 = load ptr, ptr %5, align 8, !tbaa !9
  %23 = getelementptr inbounds ptr, ptr %22, i64 0
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = getelementptr inbounds i32, ptr %24, i64 1
  store i32 0, ptr %25, align 4, !tbaa !5
  %26 = load ptr, ptr %6, align 8, !tbaa !9
  %27 = getelementptr inbounds i32, ptr %26, i64 0
  store i32 2, ptr %27, align 4, !tbaa !5
  %28 = call noalias ptr @malloc(i64 noundef 8) #5
  %29 = load ptr, ptr %5, align 8, !tbaa !9
  %30 = getelementptr inbounds ptr, ptr %29, i64 1
  store ptr %28, ptr %30, align 8, !tbaa !9
  %31 = load ptr, ptr %5, align 8, !tbaa !9
  %32 = getelementptr inbounds ptr, ptr %31, i64 1
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = getelementptr inbounds i32, ptr %33, i64 0
  store i32 2, ptr %34, align 4, !tbaa !5
  %35 = load ptr, ptr %5, align 8, !tbaa !9
  %36 = getelementptr inbounds ptr, ptr %35, i64 1
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %38 = getelementptr inbounds i32, ptr %37, i64 1
  store i32 1, ptr %38, align 4, !tbaa !5
  %39 = load ptr, ptr %6, align 8, !tbaa !9
  %40 = getelementptr inbounds i32, ptr %39, i64 1
  store i32 2, ptr %40, align 4, !tbaa !5
  %41 = call noalias ptr @malloc(i64 noundef 8) #5
  %42 = load ptr, ptr %5, align 8, !tbaa !9
  %43 = getelementptr inbounds ptr, ptr %42, i64 2
  store ptr %41, ptr %43, align 8, !tbaa !9
  %44 = load ptr, ptr %5, align 8, !tbaa !9
  %45 = getelementptr inbounds ptr, ptr %44, i64 2
  %46 = load ptr, ptr %45, align 8, !tbaa !9
  %47 = getelementptr inbounds i32, ptr %46, i64 0
  store i32 3, ptr %47, align 4, !tbaa !5
  %48 = load ptr, ptr %5, align 8, !tbaa !9
  %49 = getelementptr inbounds ptr, ptr %48, i64 2
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  %51 = getelementptr inbounds i32, ptr %50, i64 1
  store i32 2, ptr %51, align 4, !tbaa !5
  %52 = load ptr, ptr %6, align 8, !tbaa !9
  %53 = getelementptr inbounds i32, ptr %52, i64 2
  store i32 2, ptr %53, align 4, !tbaa !5
  %54 = call noalias ptr @malloc(i64 noundef 8) #5
  %55 = load ptr, ptr %5, align 8, !tbaa !9
  %56 = getelementptr inbounds ptr, ptr %55, i64 3
  store ptr %54, ptr %56, align 8, !tbaa !9
  %57 = load ptr, ptr %5, align 8, !tbaa !9
  %58 = getelementptr inbounds ptr, ptr %57, i64 3
  %59 = load ptr, ptr %58, align 8, !tbaa !9
  %60 = getelementptr inbounds i32, ptr %59, i64 0
  store i32 1, ptr %60, align 4, !tbaa !5
  %61 = load ptr, ptr %5, align 8, !tbaa !9
  %62 = getelementptr inbounds ptr, ptr %61, i64 3
  %63 = load ptr, ptr %62, align 8, !tbaa !9
  %64 = getelementptr inbounds i32, ptr %63, i64 1
  store i32 3, ptr %64, align 4, !tbaa !5
  %65 = load ptr, ptr %6, align 8, !tbaa !9
  %66 = getelementptr inbounds i32, ptr %65, i64 3
  store i32 2, ptr %66, align 4, !tbaa !5
  %67 = call noalias ptr @malloc(i64 noundef 8) #5
  %68 = load ptr, ptr %5, align 8, !tbaa !9
  %69 = getelementptr inbounds ptr, ptr %68, i64 4
  store ptr %67, ptr %69, align 8, !tbaa !9
  %70 = load ptr, ptr %5, align 8, !tbaa !9
  %71 = getelementptr inbounds ptr, ptr %70, i64 4
  %72 = load ptr, ptr %71, align 8, !tbaa !9
  %73 = getelementptr inbounds i32, ptr %72, i64 0
  store i32 4, ptr %73, align 4, !tbaa !5
  %74 = load ptr, ptr %5, align 8, !tbaa !9
  %75 = getelementptr inbounds ptr, ptr %74, i64 4
  %76 = load ptr, ptr %75, align 8, !tbaa !9
  %77 = getelementptr inbounds i32, ptr %76, i64 1
  store i32 0, ptr %77, align 4, !tbaa !5
  %78 = load ptr, ptr %6, align 8, !tbaa !9
  %79 = getelementptr inbounds i32, ptr %78, i64 4
  store i32 2, ptr %79, align 4, !tbaa !5
  %80 = call noalias ptr @malloc(i64 noundef 8) #5
  %81 = load ptr, ptr %5, align 8, !tbaa !9
  %82 = getelementptr inbounds ptr, ptr %81, i64 5
  store ptr %80, ptr %82, align 8, !tbaa !9
  %83 = load ptr, ptr %5, align 8, !tbaa !9
  %84 = getelementptr inbounds ptr, ptr %83, i64 5
  %85 = load ptr, ptr %84, align 8, !tbaa !9
  %86 = getelementptr inbounds i32, ptr %85, i64 0
  store i32 0, ptr %86, align 4, !tbaa !5
  %87 = load ptr, ptr %5, align 8, !tbaa !9
  %88 = getelementptr inbounds ptr, ptr %87, i64 5
  %89 = load ptr, ptr %88, align 8, !tbaa !9
  %90 = getelementptr inbounds i32, ptr %89, i64 1
  store i32 5, ptr %90, align 4, !tbaa !5
  %91 = load ptr, ptr %6, align 8, !tbaa !9
  %92 = getelementptr inbounds i32, ptr %91, i64 5
  store i32 2, ptr %92, align 4, !tbaa !5
  %93 = load i32, ptr %3, align 4, !tbaa !5
  %94 = load ptr, ptr %5, align 8, !tbaa !9
  %95 = load i32, ptr %4, align 4, !tbaa !5
  %96 = load ptr, ptr %6, align 8, !tbaa !9
  %97 = call zeroext i1 @canFinish(i32 noundef %93, ptr noundef %94, i32 noundef %95, ptr noundef %96)
  %98 = zext i1 %97 to i64
  %99 = select i1 %97, ptr @.str.1, ptr @.str.2
  %100 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %99)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  ret i32 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

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

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @canFinish(i32 noundef, ptr noundef, i32 noundef, ptr noundef) #0

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

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 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call noalias dereferenceable_or_null(48) ptr @malloc(i64 noundef 48) #3
  %2 = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #3
  %3 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #3
  store ptr %3, ptr %1, align 8, !tbaa !5
  store i32 1, ptr %3, align 4, !tbaa !9
  %4 = getelementptr inbounds i8, ptr %3, i64 4
  store i32 0, ptr %4, align 4, !tbaa !9
  %5 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #3
  %6 = getelementptr inbounds i8, ptr %1, i64 8
  store ptr %5, ptr %6, align 8, !tbaa !5
  store i32 2, ptr %5, align 4, !tbaa !9
  %7 = getelementptr inbounds i8, ptr %5, i64 4
  store i32 1, ptr %7, align 4, !tbaa !9
  %8 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #3
  %9 = getelementptr inbounds i8, ptr %1, i64 16
  store ptr %8, ptr %9, align 8, !tbaa !5
  store i32 3, ptr %8, align 4, !tbaa !9
  %10 = getelementptr inbounds i8, ptr %8, i64 4
  store i32 2, ptr %10, align 4, !tbaa !9
  %11 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #3
  %12 = getelementptr inbounds i8, ptr %1, i64 24
  store ptr %11, ptr %12, align 8, !tbaa !5
  store i32 1, ptr %11, align 4, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %11, i64 4
  store i32 3, ptr %13, align 4, !tbaa !9
  store <4 x i32> <i32 2, i32 2, i32 2, i32 2>, ptr %2, align 4, !tbaa !9
  %14 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #3
  %15 = getelementptr inbounds i8, ptr %1, i64 32
  store ptr %14, ptr %15, align 8, !tbaa !5
  store i32 4, ptr %14, align 4, !tbaa !9
  %16 = getelementptr inbounds i8, ptr %14, i64 4
  store i32 0, ptr %16, align 4, !tbaa !9
  %17 = getelementptr inbounds i8, ptr %2, i64 16
  store i32 2, ptr %17, align 4, !tbaa !9
  %18 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #3
  %19 = getelementptr inbounds i8, ptr %1, i64 40
  store ptr %18, ptr %19, align 8, !tbaa !5
  store i32 0, ptr %18, align 4, !tbaa !9
  %20 = getelementptr inbounds i8, ptr %18, i64 4
  store i32 5, ptr %20, align 4, !tbaa !9
  %21 = getelementptr inbounds i8, ptr %2, i64 20
  store i32 2, ptr %21, align 4, !tbaa !9
  %22 = tail call zeroext i1 @canFinish(i32 noundef 6, ptr noundef nonnull %1, i32 noundef 6, ptr noundef nonnull %2)
  %23 = select i1 %22, ptr @.str.1, ptr @.str.2
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %23)
  ret i32 0
}

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

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

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @canFinish(i32 noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #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 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 #2 = { 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 #3 = { 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}


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