; LLVM IR from yourtion/LearningMasteringAlgorithms-C :: Example/routing (main)

; 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.EdgeData_ = type { [2 x i8], [2 x i8], double }
%struct.Graph_ = type { i32, i32, ptr, ptr, %struct.List_ }
%struct.List_ = type { i32, ptr, ptr, ptr, ptr }
%struct.PathVertex_ = type { ptr, double, i32, double, ptr }
%struct.ListElmt_ = type { ptr, ptr }

@stdout = external global ptr, align 8
@.str = external hidden unnamed_addr constant [26 x i8], align 1
@PthTestV = external hidden global [6 x [2 x i8]], align 1
@PthTestE = external hidden global [11 x %struct.EdgeData_], align 16
@.str.1 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [46 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca %struct.Graph_, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %struct.PathVertex_, align 8
  %10 = alloca ptr, align 8
  %11 = alloca %struct.List_, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 64, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store ptr null, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 40, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 40, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  call void @graph_init(ptr noundef %6, ptr noundef @match_pth, ptr noundef @free)
  %15 = load ptr, ptr @stdout, align 8, !tbaa !9
  %16 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef @.str) #5
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %41, %2
  %18 = load i32, ptr %13, align 4, !tbaa !5
  %19 = icmp slt i32 %18, 6
  br i1 %19, label %20, label %44

20:                                               ; preds = %17
  %21 = call noalias ptr @malloc(i64 noundef 40) #6
  store ptr %21, ptr %8, align 8, !tbaa !9
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %24

23:                                               ; preds = %20
  store i32 1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %137

24:                                               ; preds = %20
  %25 = load i32, ptr %13, align 4, !tbaa !5
  %26 = icmp eq i32 %25, 1
  br i1 %26, label %27, label %29

27:                                               ; preds = %24
  %28 = load ptr, ptr %8, align 8, !tbaa !9
  store ptr %28, ptr %7, align 8, !tbaa !9
  br label %29

29:                                               ; preds = %27, %24
  %30 = load i32, ptr %13, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [6 x [2 x i8]], ptr @PthTestV, i64 0, i64 %31
  %33 = getelementptr inbounds [2 x i8], ptr %32, i64 0, i64 0
  %34 = load ptr, ptr %8, align 8, !tbaa !9
  %35 = getelementptr inbounds %struct.PathVertex_, ptr %34, i32 0, i32 0
  store ptr %33, ptr %35, align 8, !tbaa !11
  %36 = load ptr, ptr %8, align 8, !tbaa !9
  %37 = call i32 @graph_ins_vertex(ptr noundef %6, ptr noundef %36)
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %40

39:                                               ; preds = %29
  store i32 1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %137

40:                                               ; preds = %29
  br label %41

41:                                               ; preds = %40
  %42 = load i32, ptr %13, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %13, align 4, !tbaa !5
  br label %17, !llvm.loop !14

44:                                               ; preds = %17
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %78, %44
  %46 = load i32, ptr %13, align 4, !tbaa !5
  %47 = icmp slt i32 %46, 11
  br i1 %47, label %48, label %81

48:                                               ; preds = %45
  %49 = call noalias ptr @malloc(i64 noundef 40) #6
  store ptr %49, ptr %10, align 8, !tbaa !9
  %50 = icmp eq ptr %49, null
  br i1 %50, label %51, label %52

51:                                               ; preds = %48
  store i32 1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %137

52:                                               ; preds = %48
  %53 = load i32, ptr %13, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [11 x %struct.EdgeData_], ptr @PthTestE, i64 0, i64 %54
  %56 = getelementptr inbounds %struct.EdgeData_, ptr %55, i32 0, i32 0
  %57 = getelementptr inbounds [2 x i8], ptr %56, i64 0, i64 0
  %58 = getelementptr inbounds %struct.PathVertex_, ptr %9, i32 0, i32 0
  store ptr %57, ptr %58, align 8, !tbaa !11
  %59 = load i32, ptr %13, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [11 x %struct.EdgeData_], ptr @PthTestE, i64 0, i64 %60
  %62 = getelementptr inbounds %struct.EdgeData_, ptr %61, i32 0, i32 1
  %63 = getelementptr inbounds [2 x i8], ptr %62, i64 0, i64 0
  %64 = load ptr, ptr %10, align 8, !tbaa !9
  %65 = getelementptr inbounds %struct.PathVertex_, ptr %64, i32 0, i32 0
  store ptr %63, ptr %65, align 8, !tbaa !11
  %66 = load i32, ptr %13, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [11 x %struct.EdgeData_], ptr @PthTestE, i64 0, i64 %67
  %69 = getelementptr inbounds %struct.EdgeData_, ptr %68, i32 0, i32 2
  %70 = load double, ptr %69, align 8, !tbaa !16
  %71 = load ptr, ptr %10, align 8, !tbaa !9
  %72 = getelementptr inbounds %struct.PathVertex_, ptr %71, i32 0, i32 1
  store double %70, ptr %72, align 8, !tbaa !18
  %73 = load ptr, ptr %10, align 8, !tbaa !9
  %74 = call i32 @graph_ins_edge(ptr noundef %6, ptr noundef %9, ptr noundef %73)
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %77

76:                                               ; preds = %52
  store i32 1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %137

77:                                               ; preds = %52
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %13, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %13, align 4, !tbaa !5
  br label %45, !llvm.loop !19

81:                                               ; preds = %45
  call void @print_graph_pth(ptr noundef %6)
  %82 = load ptr, ptr %7, align 8, !tbaa !9
  %83 = call i32 @shortest(ptr noundef %6, ptr noundef %82, ptr noundef %11, ptr noundef @match_pth)
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %86

85:                                               ; preds = %81
  store i32 1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %137

86:                                               ; preds = %81
  %87 = getelementptr inbounds %struct.List_, ptr %11, i32 0, i32 3
  %88 = load ptr, ptr %87, align 8, !tbaa !20
  store ptr %88, ptr %12, align 8, !tbaa !9
  br label %89

89:                                               ; preds = %117, %86
  %90 = load ptr, ptr %12, align 8, !tbaa !9
  %91 = icmp ne ptr %90, null
  br i1 %91, label %92, label %121

92:                                               ; preds = %89
  %93 = load ptr, ptr %12, align 8, !tbaa !9
  %94 = getelementptr inbounds %struct.ListElmt_, ptr %93, i32 0, i32 0
  %95 = load ptr, ptr %94, align 8, !tbaa !22
  store ptr %95, ptr %8, align 8, !tbaa !9
  %96 = load ptr, ptr @stdout, align 8, !tbaa !9
  %97 = load ptr, ptr %8, align 8, !tbaa !9
  %98 = getelementptr inbounds %struct.PathVertex_, ptr %97, i32 0, i32 0
  %99 = load ptr, ptr %98, align 8, !tbaa !11
  %100 = load ptr, ptr %8, align 8, !tbaa !9
  %101 = getelementptr inbounds %struct.PathVertex_, ptr %100, i32 0, i32 4
  %102 = load ptr, ptr %101, align 8, !tbaa !24
  %103 = icmp ne ptr %102, null
  br i1 %103, label %104, label %110

104:                                              ; preds = %92
  %105 = load ptr, ptr %8, align 8, !tbaa !9
  %106 = getelementptr inbounds %struct.PathVertex_, ptr %105, i32 0, i32 4
  %107 = load ptr, ptr %106, align 8, !tbaa !24
  %108 = getelementptr inbounds %struct.PathVertex_, ptr %107, i32 0, i32 0
  %109 = load ptr, ptr %108, align 8, !tbaa !11
  br label %111

110:                                              ; preds = %92
  br label %111

111:                                              ; preds = %110, %104
  %112 = phi ptr [ %109, %104 ], [ @.str.2, %110 ]
  %113 = load ptr, ptr %8, align 8, !tbaa !9
  %114 = getelementptr inbounds %struct.PathVertex_, ptr %113, i32 0, i32 3
  %115 = load double, ptr %114, align 8, !tbaa !25
  %116 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %96, ptr noundef @.str.1, ptr noundef %99, ptr noundef %112, double noundef %115) #5
  br label %117

117:                                              ; preds = %111
  %118 = load ptr, ptr %12, align 8, !tbaa !9
  %119 = getelementptr inbounds %struct.ListElmt_, ptr %118, i32 0, i32 1
  %120 = load ptr, ptr %119, align 8, !tbaa !26
  store ptr %120, ptr %12, align 8, !tbaa !9
  br label %89, !llvm.loop !27

121:                                              ; preds = %89
  %122 = getelementptr inbounds %struct.PathVertex_, ptr %9, i32 0, i32 0
  store ptr @.str.3, ptr %122, align 8, !tbaa !11
  %123 = call i32 @route(ptr noundef %11, ptr noundef %9, ptr noundef %8, ptr noundef @match_pth)
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %125, label %126

125:                                              ; preds = %121
  store i32 1, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %137

126:                                              ; preds = %121
  %127 = load ptr, ptr @stdout, align 8, !tbaa !9
  %128 = load ptr, ptr %7, align 8, !tbaa !9
  %129 = getelementptr inbounds %struct.PathVertex_, ptr %128, i32 0, i32 0
  %130 = load ptr, ptr %129, align 8, !tbaa !11
  %131 = getelementptr inbounds %struct.PathVertex_, ptr %9, i32 0, i32 0
  %132 = load ptr, ptr %131, align 8, !tbaa !11
  %133 = load ptr, ptr %8, align 8, !tbaa !9
  %134 = getelementptr inbounds %struct.PathVertex_, ptr %133, i32 0, i32 0
  %135 = load ptr, ptr %134, align 8, !tbaa !11
  %136 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %127, ptr noundef @.str.4, ptr noundef %130, ptr noundef %132, ptr noundef %135) #5
  call void @list_destroy(ptr noundef %11)
  call void @graph_destroy(ptr noundef %6)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %137

137:                                              ; preds = %126, %125, %85, %76, %51, %39, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %6) #5
  %138 = load i32, ptr %3, align 4
  ret i32 %138
}

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

declare void @graph_init(ptr noundef, ptr noundef, ptr noundef) #2

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

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

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

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

declare i32 @graph_ins_vertex(ptr noundef, ptr noundef) #2

declare i32 @graph_ins_edge(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @print_graph_pth(ptr noundef) #0

declare i32 @shortest(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @route(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare void @list_destroy(ptr noundef) #2

declare void @graph_destroy(ptr noundef) #2

; 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 = { "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 = { 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 }
attributes #6 = { 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}
!11 = !{!12, !10, i64 0}
!12 = !{!"PathVertex_", !10, i64 0, !13, i64 8, !6, i64 16, !13, i64 24, !10, i64 32}
!13 = !{!"double", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !13, i64 8}
!17 = !{!"EdgeData_", !7, i64 0, !7, i64 2, !13, i64 8}
!18 = !{!12, !13, i64 8}
!19 = distinct !{!19, !15}
!20 = !{!21, !10, i64 24}
!21 = !{!"List_", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!22 = !{!23, !10, i64 0}
!23 = !{!"ListElmt_", !10, i64 0, !10, i64 8}
!24 = !{!12, !10, i64 32}
!25 = !{!12, !13, i64 24}
!26 = !{!23, !10, i64 8}
!27 = distinct !{!27, !15}


; 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.EdgeData_ = type { [2 x i8], [2 x i8], double }
%struct.Graph_ = type { i32, i32, ptr, ptr, %struct.List_ }
%struct.List_ = type { i32, ptr, ptr, ptr, ptr }
%struct.PathVertex_ = type { ptr, double, i32, double, ptr }

@stdout = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [26 x i8], align 1
@PthTestV = external hidden global [6 x [2 x i8]], align 1
@PthTestE = external hidden global [11 x %struct.EdgeData_], align 16
@.str.1 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [46 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = alloca %struct.Graph_, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.PathVertex_, align 8
  %6 = alloca %struct.List_, align 8
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %6) #6
  call void @graph_init(ptr noundef nonnull %3, ptr noundef nonnull @match_pth, ptr noundef nonnull @free) #6
  %7 = load ptr, ptr @stdout, align 8, !tbaa !5
  %8 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %7, ptr noundef nonnull @.str) #6
  %9 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #7
  %10 = icmp eq ptr %9, null
  br i1 %10, label %.loopexit, label %11

11:                                               ; preds = %2
  store ptr @PthTestV, ptr %9, align 8, !tbaa !9
  %12 = call i32 @graph_ins_vertex(ptr noundef nonnull %3, ptr noundef nonnull %9) #6
  %.not28 = icmp eq i32 %12, 0
  br i1 %.not28, label %13, label %.loopexit

13:                                               ; preds = %11
  %14 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #7
  %15 = icmp eq ptr %14, null
  br i1 %15, label %.loopexit, label %16

16:                                               ; preds = %13
  store ptr getelementptr inbounds (i8, ptr @PthTestV, i64 2), ptr %14, align 8, !tbaa !9
  %17 = call i32 @graph_ins_vertex(ptr noundef nonnull %3, ptr noundef nonnull %14) #6
  %.not28.1 = icmp eq i32 %17, 0
  br i1 %.not28.1, label %18, label %.loopexit

18:                                               ; preds = %16
  %19 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #7
  %20 = icmp eq ptr %19, null
  br i1 %20, label %.loopexit, label %21

21:                                               ; preds = %18
  store ptr getelementptr inbounds (i8, ptr @PthTestV, i64 4), ptr %19, align 8, !tbaa !9
  %22 = call i32 @graph_ins_vertex(ptr noundef nonnull %3, ptr noundef nonnull %19) #6
  %.not28.2 = icmp eq i32 %22, 0
  br i1 %.not28.2, label %23, label %.loopexit

23:                                               ; preds = %21
  %24 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #7
  %25 = icmp eq ptr %24, null
  br i1 %25, label %.loopexit, label %26

26:                                               ; preds = %23
  store ptr getelementptr inbounds (i8, ptr @PthTestV, i64 6), ptr %24, align 8, !tbaa !9
  %27 = call i32 @graph_ins_vertex(ptr noundef nonnull %3, ptr noundef nonnull %24) #6
  %.not28.3 = icmp eq i32 %27, 0
  br i1 %.not28.3, label %28, label %.loopexit

28:                                               ; preds = %26
  %29 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #7
  %30 = icmp eq ptr %29, null
  br i1 %30, label %.loopexit, label %31

31:                                               ; preds = %28
  store ptr getelementptr inbounds (i8, ptr @PthTestV, i64 8), ptr %29, align 8, !tbaa !9
  %32 = call i32 @graph_ins_vertex(ptr noundef nonnull %3, ptr noundef nonnull %29) #6
  %.not28.4 = icmp eq i32 %32, 0
  br i1 %.not28.4, label %33, label %.loopexit

33:                                               ; preds = %31
  %34 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #7
  store ptr %34, ptr %4, align 8, !tbaa !5
  %35 = icmp eq ptr %34, null
  br i1 %35, label %.loopexit, label %36

36:                                               ; preds = %33
  store ptr getelementptr inbounds (i8, ptr @PthTestV, i64 10), ptr %34, align 8, !tbaa !9
  %37 = call i32 @graph_ins_vertex(ptr noundef nonnull %3, ptr noundef nonnull %34) #6
  %.not28.5 = icmp eq i32 %37, 0
  br i1 %.not28.5, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %36
  %38 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #7
  %39 = icmp eq ptr %38, null
  br i1 %39, label %.loopexit, label %112

40:                                               ; preds = %112
  %41 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #7
  %42 = icmp eq ptr %41, null
  br i1 %42, label %.loopexit, label %43

43:                                               ; preds = %40
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 16), ptr %5, align 8, !tbaa !9
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 18), ptr %41, align 8, !tbaa !9
  %44 = load double, ptr getelementptr inbounds (i8, ptr @PthTestE, i64 24), align 8, !tbaa !13
  %45 = getelementptr inbounds i8, ptr %41, i64 8
  store double %44, ptr %45, align 8, !tbaa !15
  %46 = call i32 @graph_ins_edge(ptr noundef nonnull %3, ptr noundef nonnull %5, ptr noundef nonnull %41) #6
  %.not27.1 = icmp eq i32 %46, 0
  br i1 %.not27.1, label %47, label %.loopexit

47:                                               ; preds = %43
  %48 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #7
  %49 = icmp eq ptr %48, null
  br i1 %49, label %.loopexit, label %50

50:                                               ; preds = %47
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 32), ptr %5, align 8, !tbaa !9
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 34), ptr %48, align 8, !tbaa !9
  %51 = load double, ptr getelementptr inbounds (i8, ptr @PthTestE, i64 40), align 8, !tbaa !13
  %52 = getelementptr inbounds i8, ptr %48, i64 8
  store double %51, ptr %52, align 8, !tbaa !15
  %53 = call i32 @graph_ins_edge(ptr noundef nonnull %3, ptr noundef nonnull %5, ptr noundef nonnull %48) #6
  %.not27.2 = icmp eq i32 %53, 0
  br i1 %.not27.2, label %54, label %.loopexit

54:                                               ; preds = %50
  %55 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #7
  %56 = icmp eq ptr %55, null
  br i1 %56, label %.loopexit, label %57

57:                                               ; preds = %54
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 48), ptr %5, align 8, !tbaa !9
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 50), ptr %55, align 8, !tbaa !9
  %58 = load double, ptr getelementptr inbounds (i8, ptr @PthTestE, i64 56), align 8, !tbaa !13
  %59 = getelementptr inbounds i8, ptr %55, i64 8
  store double %58, ptr %59, align 8, !tbaa !15
  %60 = call i32 @graph_ins_edge(ptr noundef nonnull %3, ptr noundef nonnull %5, ptr noundef nonnull %55) #6
  %.not27.3 = icmp eq i32 %60, 0
  br i1 %.not27.3, label %61, label %.loopexit

61:                                               ; preds = %57
  %62 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #7
  %63 = icmp eq ptr %62, null
  br i1 %63, label %.loopexit, label %64

64:                                               ; preds = %61
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 64), ptr %5, align 8, !tbaa !9
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 66), ptr %62, align 8, !tbaa !9
  %65 = load double, ptr getelementptr inbounds (i8, ptr @PthTestE, i64 72), align 8, !tbaa !13
  %66 = getelementptr inbounds i8, ptr %62, i64 8
  store double %65, ptr %66, align 8, !tbaa !15
  %67 = call i32 @graph_ins_edge(ptr noundef nonnull %3, ptr noundef nonnull %5, ptr noundef nonnull %62) #6
  %.not27.4 = icmp eq i32 %67, 0
  br i1 %.not27.4, label %68, label %.loopexit

68:                                               ; preds = %64
  %69 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #7
  %70 = icmp eq ptr %69, null
  br i1 %70, label %.loopexit, label %71

71:                                               ; preds = %68
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 80), ptr %5, align 8, !tbaa !9
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 82), ptr %69, align 8, !tbaa !9
  %72 = load double, ptr getelementptr inbounds (i8, ptr @PthTestE, i64 88), align 8, !tbaa !13
  %73 = getelementptr inbounds i8, ptr %69, i64 8
  store double %72, ptr %73, align 8, !tbaa !15
  %74 = call i32 @graph_ins_edge(ptr noundef nonnull %3, ptr noundef nonnull %5, ptr noundef nonnull %69) #6
  %.not27.5 = icmp eq i32 %74, 0
  br i1 %.not27.5, label %75, label %.loopexit

75:                                               ; preds = %71
  %76 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #7
  %77 = icmp eq ptr %76, null
  br i1 %77, label %.loopexit, label %78

78:                                               ; preds = %75
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 96), ptr %5, align 8, !tbaa !9
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 98), ptr %76, align 8, !tbaa !9
  %79 = load double, ptr getelementptr inbounds (i8, ptr @PthTestE, i64 104), align 8, !tbaa !13
  %80 = getelementptr inbounds i8, ptr %76, i64 8
  store double %79, ptr %80, align 8, !tbaa !15
  %81 = call i32 @graph_ins_edge(ptr noundef nonnull %3, ptr noundef nonnull %5, ptr noundef nonnull %76) #6
  %.not27.6 = icmp eq i32 %81, 0
  br i1 %.not27.6, label %82, label %.loopexit

82:                                               ; preds = %78
  %83 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #7
  %84 = icmp eq ptr %83, null
  br i1 %84, label %.loopexit, label %85

85:                                               ; preds = %82
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 112), ptr %5, align 8, !tbaa !9
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 114), ptr %83, align 8, !tbaa !9
  %86 = load double, ptr getelementptr inbounds (i8, ptr @PthTestE, i64 120), align 8, !tbaa !13
  %87 = getelementptr inbounds i8, ptr %83, i64 8
  store double %86, ptr %87, align 8, !tbaa !15
  %88 = call i32 @graph_ins_edge(ptr noundef nonnull %3, ptr noundef nonnull %5, ptr noundef nonnull %83) #6
  %.not27.7 = icmp eq i32 %88, 0
  br i1 %.not27.7, label %89, label %.loopexit

89:                                               ; preds = %85
  %90 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #7
  %91 = icmp eq ptr %90, null
  br i1 %91, label %.loopexit, label %92

92:                                               ; preds = %89
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 128), ptr %5, align 8, !tbaa !9
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 130), ptr %90, align 8, !tbaa !9
  %93 = load double, ptr getelementptr inbounds (i8, ptr @PthTestE, i64 136), align 8, !tbaa !13
  %94 = getelementptr inbounds i8, ptr %90, i64 8
  store double %93, ptr %94, align 8, !tbaa !15
  %95 = call i32 @graph_ins_edge(ptr noundef nonnull %3, ptr noundef nonnull %5, ptr noundef nonnull %90) #6
  %.not27.8 = icmp eq i32 %95, 0
  br i1 %.not27.8, label %96, label %.loopexit

96:                                               ; preds = %92
  %97 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #7
  %98 = icmp eq ptr %97, null
  br i1 %98, label %.loopexit, label %99

99:                                               ; preds = %96
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 144), ptr %5, align 8, !tbaa !9
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 146), ptr %97, align 8, !tbaa !9
  %100 = load double, ptr getelementptr inbounds (i8, ptr @PthTestE, i64 152), align 8, !tbaa !13
  %101 = getelementptr inbounds i8, ptr %97, i64 8
  store double %100, ptr %101, align 8, !tbaa !15
  %102 = call i32 @graph_ins_edge(ptr noundef nonnull %3, ptr noundef nonnull %5, ptr noundef nonnull %97) #6
  %.not27.9 = icmp eq i32 %102, 0
  br i1 %.not27.9, label %103, label %.loopexit

103:                                              ; preds = %99
  %104 = call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #7
  %105 = icmp eq ptr %104, null
  br i1 %105, label %.loopexit, label %106

106:                                              ; preds = %103
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 160), ptr %5, align 8, !tbaa !9
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 162), ptr %104, align 8, !tbaa !9
  %107 = load double, ptr getelementptr inbounds (i8, ptr @PthTestE, i64 168), align 8, !tbaa !13
  %108 = getelementptr inbounds i8, ptr %104, i64 8
  store double %107, ptr %108, align 8, !tbaa !15
  %109 = call i32 @graph_ins_edge(ptr noundef nonnull %3, ptr noundef nonnull %5, ptr noundef nonnull %104) #6
  %.not27.10 = icmp eq i32 %109, 0
  br i1 %.not27.10, label %110, label %.loopexit

110:                                              ; preds = %106
  call void @print_graph_pth(ptr noundef nonnull %3)
  %111 = call i32 @shortest(ptr noundef nonnull %3, ptr noundef nonnull %14, ptr noundef nonnull %6, ptr noundef nonnull @match_pth) #6
  %.not = icmp eq i32 %111, 0
  br i1 %.not, label %116, label %.loopexit

112:                                              ; preds = %.preheader
  store ptr @PthTestE, ptr %5, align 8, !tbaa !9
  store ptr getelementptr inbounds (i8, ptr @PthTestE, i64 2), ptr %38, align 8, !tbaa !9
  %113 = load double, ptr getelementptr inbounds (i8, ptr @PthTestE, i64 8), align 8, !tbaa !13
  %114 = getelementptr inbounds i8, ptr %38, i64 8
  store double %113, ptr %114, align 8, !tbaa !15
  %115 = call i32 @graph_ins_edge(ptr noundef nonnull %3, ptr noundef nonnull %5, ptr noundef nonnull %38) #6
  %.not27 = icmp eq i32 %115, 0
  br i1 %.not27, label %40, label %.loopexit

116:                                              ; preds = %110
  %117 = getelementptr inbounds i8, ptr %6, i64 24
  %118 = load ptr, ptr %117, align 8, !tbaa !16
  %.not2434 = icmp eq ptr %118, null
  br i1 %.not2434, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %116, %126
  %.01735 = phi ptr [ %132, %126 ], [ %118, %116 ]
  %119 = load ptr, ptr %.01735, align 8, !tbaa !18
  store ptr %119, ptr %4, align 8, !tbaa !5
  %120 = load ptr, ptr @stdout, align 8, !tbaa !5
  %121 = load ptr, ptr %119, align 8, !tbaa !9
  %122 = getelementptr inbounds i8, ptr %119, i64 32
  %123 = load ptr, ptr %122, align 8, !tbaa !20
  %.not26 = icmp eq ptr %123, null
  br i1 %.not26, label %126, label %124

124:                                              ; preds = %.lr.ph
  %125 = load ptr, ptr %123, align 8, !tbaa !9
  br label %126

126:                                              ; preds = %.lr.ph, %124
  %127 = phi ptr [ %125, %124 ], [ @.str.2, %.lr.ph ]
  %128 = getelementptr inbounds i8, ptr %119, i64 24
  %129 = load double, ptr %128, align 8, !tbaa !21
  %130 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %120, ptr noundef nonnull @.str.1, ptr noundef %121, ptr noundef %127, double noundef %129) #6
  %131 = getelementptr inbounds i8, ptr %.01735, i64 8
  %132 = load ptr, ptr %131, align 8, !tbaa !22
  %.not24 = icmp eq ptr %132, null
  br i1 %.not24, label %._crit_edge, label %.lr.ph, !llvm.loop !23

._crit_edge:                                      ; preds = %126, %116
  store ptr @.str.3, ptr %5, align 8, !tbaa !9
  %133 = call i32 @route(ptr noundef nonnull %6, ptr noundef nonnull %5, ptr noundef nonnull %4, ptr noundef nonnull @match_pth) #6
  %.not25 = icmp eq i32 %133, 0
  br i1 %.not25, label %134, label %.loopexit

134:                                              ; preds = %._crit_edge
  %135 = load ptr, ptr @stdout, align 8, !tbaa !5
  %136 = load ptr, ptr %14, align 8, !tbaa !9
  %137 = load ptr, ptr %5, align 8, !tbaa !9
  %138 = load ptr, ptr %4, align 8, !tbaa !5
  %139 = load ptr, ptr %138, align 8, !tbaa !9
  %140 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %135, ptr noundef nonnull @.str.4, ptr noundef %136, ptr noundef %137, ptr noundef %139) #6
  call void @list_destroy(ptr noundef nonnull %6) #6
  call void @graph_destroy(ptr noundef nonnull %3) #6
  br label %.loopexit

.loopexit:                                        ; preds = %11, %2, %13, %16, %18, %21, %23, %26, %28, %31, %33, %36, %112, %.preheader, %40, %43, %47, %50, %54, %57, %61, %64, %68, %71, %75, %78, %82, %85, %89, %92, %96, %99, %103, %106, %._crit_edge, %110, %134
  %.018 = phi i32 [ 0, %134 ], [ 1, %110 ], [ 1, %._crit_edge ], [ 1, %106 ], [ 1, %103 ], [ 1, %99 ], [ 1, %96 ], [ 1, %92 ], [ 1, %89 ], [ 1, %85 ], [ 1, %82 ], [ 1, %78 ], [ 1, %75 ], [ 1, %71 ], [ 1, %68 ], [ 1, %64 ], [ 1, %61 ], [ 1, %57 ], [ 1, %54 ], [ 1, %50 ], [ 1, %47 ], [ 1, %43 ], [ 1, %40 ], [ 1, %.preheader ], [ 1, %112 ], [ 1, %36 ], [ 1, %33 ], [ 1, %31 ], [ 1, %28 ], [ 1, %26 ], [ 1, %23 ], [ 1, %21 ], [ 1, %18 ], [ 1, %16 ], [ 1, %13 ], [ 1, %2 ], [ 1, %11 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %3) #6
  ret i32 %.018
}

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

declare void @graph_init(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

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

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

declare i32 @graph_ins_vertex(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @graph_ins_edge(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @print_graph_pth(ptr noundef) local_unnamed_addr #0

declare i32 @shortest(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @route(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @list_destroy(ptr noundef) local_unnamed_addr #2

declare void @graph_destroy(ptr 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

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 = { "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 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 #4 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { 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, !6, i64 0}
!10 = !{!"PathVertex_", !6, i64 0, !11, i64 8, !12, i64 16, !11, i64 24, !6, i64 32}
!11 = !{!"double", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !11, i64 8}
!14 = !{!"EdgeData_", !7, i64 0, !7, i64 2, !11, i64 8}
!15 = !{!10, !11, i64 8}
!16 = !{!17, !6, i64 24}
!17 = !{!"List_", !12, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!18 = !{!19, !6, i64 0}
!19 = !{!"ListElmt_", !6, i64 0, !6, i64 8}
!20 = !{!10, !6, i64 32}
!21 = !{!10, !11, i64 24}
!22 = !{!19, !6, i64 8}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass