; LLVM IR from askforalfred/alfred :: gen/ff_planner (parse)

; 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._PlNode = type { i32, ptr, ptr, i32, i32, ptr, ptr, ptr, ptr }

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

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

declare ptr @new_PlNode(i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local zeroext i8 @make_conjunction_of_atoms(ptr noundef %0) #2 {
  %2 = alloca i8, align 1
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  %11 = icmp ne ptr %10, null
  br i1 %11, label %13, label %12

12:                                               ; preds = %1
  store i8 1, ptr %2, align 1
  store i32 1, ptr %8, align 4
  br label %132

13:                                               ; preds = %1
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct._PlNode, ptr %15, i32 0, i32 0
  %17 = load i32, ptr %16, align 8, !tbaa !9
  %18 = icmp ne i32 %17, 2006
  br i1 %18, label %19, label %83

19:                                               ; preds = %13
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = load ptr, ptr %20, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._PlNode, ptr %21, i32 0, i32 0
  %23 = load i32, ptr %22, align 8, !tbaa !9
  switch i32 %23, label %82 [
    i32 2002, label %24
    i32 2003, label %42
    i32 2005, label %78
  ]

24:                                               ; preds = %19
  %25 = call ptr @new_PlNode(i32 noundef 2002)
  store ptr %25, ptr %4, align 8, !tbaa !5
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct._PlNode, ptr %27, i32 0, i32 2
  %29 = load ptr, ptr %28, align 8, !tbaa !12
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct._PlNode, ptr %30, i32 0, i32 2
  store ptr %29, ptr %31, align 8, !tbaa !12
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._PlNode, ptr %33, i32 0, i32 2
  store ptr null, ptr %34, align 8, !tbaa !12
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = load ptr, ptr %35, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._PlNode, ptr %36, i32 0, i32 0
  store i32 2006, ptr %37, align 8, !tbaa !9
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = load ptr, ptr %39, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._PlNode, ptr %40, i32 0, i32 7
  store ptr %38, ptr %41, align 8, !tbaa !13
  store i8 1, ptr %2, align 1
  store i32 1, ptr %8, align 4
  br label %132

42:                                               ; preds = %19
  %43 = call ptr @new_PlNode(i32 noundef 2003)
  store ptr %43, ptr %4, align 8, !tbaa !5
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct._PlNode, ptr %45, i32 0, i32 3
  %47 = load i32, ptr %46, align 8, !tbaa !14
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct._PlNode, ptr %48, i32 0, i32 3
  store i32 %47, ptr %49, align 8, !tbaa !14
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = load ptr, ptr %50, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct._PlNode, ptr %51, i32 0, i32 5
  %53 = load ptr, ptr %52, align 8, !tbaa !15
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct._PlNode, ptr %54, i32 0, i32 5
  store ptr %53, ptr %55, align 8, !tbaa !15
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = load ptr, ptr %56, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct._PlNode, ptr %57, i32 0, i32 6
  %59 = load ptr, ptr %58, align 8, !tbaa !16
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct._PlNode, ptr %60, i32 0, i32 6
  store ptr %59, ptr %61, align 8, !tbaa !16
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = load ptr, ptr %62, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct._PlNode, ptr %63, i32 0, i32 5
  store ptr null, ptr %64, align 8, !tbaa !15
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct._PlNode, ptr %66, i32 0, i32 6
  store ptr null, ptr %67, align 8, !tbaa !16
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = load ptr, ptr %68, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct._PlNode, ptr %69, i32 0, i32 3
  store i32 -1, ptr %70, align 8, !tbaa !14
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = load ptr, ptr %71, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct._PlNode, ptr %72, i32 0, i32 0
  store i32 2006, ptr %73, align 8, !tbaa !9
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = load ptr, ptr %75, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct._PlNode, ptr %76, i32 0, i32 7
  store ptr %74, ptr %77, align 8, !tbaa !13
  store i8 1, ptr %2, align 1
  store i32 1, ptr %8, align 4
  br label %132

78:                                               ; preds = %19
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = load ptr, ptr %79, align 8, !tbaa !5
  call void @free_PlNode(ptr noundef %80)
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr null, ptr %81, align 8, !tbaa !5
  store i8 1, ptr %2, align 1
  store i32 1, ptr %8, align 4
  br label %132

82:                                               ; preds = %19
  store i8 0, ptr %2, align 1
  store i32 1, ptr %8, align 4
  br label %132

83:                                               ; preds = %13
  store ptr null, ptr %6, align 8, !tbaa !5
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = load ptr, ptr %84, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct._PlNode, ptr %85, i32 0, i32 7
  %87 = load ptr, ptr %86, align 8, !tbaa !13
  store ptr %87, ptr %5, align 8, !tbaa !5
  br label %88

88:                                               ; preds = %130, %83
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = icmp ne ptr %89, null
  br i1 %90, label %91, label %131

91:                                               ; preds = %88
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct._PlNode, ptr %92, i32 0, i32 0
  %94 = load i32, ptr %93, align 8, !tbaa !9
  switch i32 %94, label %119 [
    i32 2002, label %120
    i32 2003, label %120
    i32 2005, label %95
  ]

95:                                               ; preds = %91
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = icmp ne ptr %96, null
  br i1 %97, label %98, label %104

98:                                               ; preds = %95
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct._PlNode, ptr %99, i32 0, i32 8
  %101 = load ptr, ptr %100, align 8, !tbaa !17
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._PlNode, ptr %102, i32 0, i32 8
  store ptr %101, ptr %103, align 8, !tbaa !17
  br label %111

104:                                              ; preds = %95
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct._PlNode, ptr %105, i32 0, i32 8
  %107 = load ptr, ptr %106, align 8, !tbaa !17
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = load ptr, ptr %108, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct._PlNode, ptr %109, i32 0, i32 7
  store ptr %107, ptr %110, align 8, !tbaa !13
  br label %111

111:                                              ; preds = %104, %98
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct._PlNode, ptr %112, i32 0, i32 8
  %114 = load ptr, ptr %113, align 8, !tbaa !17
  store ptr %114, ptr %7, align 8, !tbaa !5
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct._PlNode, ptr %115, i32 0, i32 8
  store ptr null, ptr %116, align 8, !tbaa !17
  %117 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free_PlNode(ptr noundef %117)
  %118 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %118, ptr %5, align 8, !tbaa !5
  br label %120

119:                                              ; preds = %91
  store i8 0, ptr %2, align 1
  store i32 1, ptr %8, align 4
  br label %132

120:                                              ; preds = %111, %91, %91
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct._PlNode, ptr %121, i32 0, i32 0
  %123 = load i32, ptr %122, align 8, !tbaa !9
  %124 = icmp ne i32 %123, 2005
  br i1 %124, label %125, label %130

125:                                              ; preds = %120
  %126 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %126, ptr %6, align 8, !tbaa !5
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct._PlNode, ptr %127, i32 0, i32 8
  %129 = load ptr, ptr %128, align 8, !tbaa !17
  store ptr %129, ptr %5, align 8, !tbaa !5
  br label %130

130:                                              ; preds = %125, %120
  br label %88, !llvm.loop !18

131:                                              ; preds = %88
  store i8 1, ptr %2, align 1
  store i32 1, ptr %8, align 4
  br label %132

132:                                              ; preds = %131, %119, %82, %78, %42, %24, %12
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %133 = load i8, ptr %2, align 1
  ret i8 %133
}

declare void @free_PlNode(ptr noundef) #1

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

!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, !11, i64 0}
!10 = !{!"_PlNode", !11, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !11, i64 28, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 16}
!13 = !{!10, !6, i64 48}
!14 = !{!10, !11, i64 24}
!15 = !{!10, !6, i64 32}
!16 = !{!10, !6, i64 40}
!17 = !{!10, !6, i64 56}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


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

declare ptr @new_PlNode(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local zeroext range(i8 0, 2) i8 @make_conjunction_of_atoms(ptr nocapture noundef %0) local_unnamed_addr #1 {
  %2 = load ptr, ptr %0, align 8, !tbaa !5
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %.loopexit, label %3

3:                                                ; preds = %1
  %4 = load i32, ptr %2, align 8, !tbaa !9
  switch i32 %4, label %.loopexit [
    i32 2006, label %36
    i32 2002, label %5
    i32 2003, label %15
    i32 2005, label %35
  ]

5:                                                ; preds = %3
  %6 = tail call ptr @new_PlNode(i32 noundef 2002) #2
  %7 = load ptr, ptr %0, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 16
  %9 = load ptr, ptr %8, align 8, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %6, i64 16
  store ptr %9, ptr %10, align 8, !tbaa !12
  %11 = load ptr, ptr %0, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %11, i64 16
  store ptr null, ptr %12, align 8, !tbaa !12
  %13 = load ptr, ptr %0, align 8, !tbaa !5
  store i32 2006, ptr %13, align 8, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %13, i64 48
  store ptr %6, ptr %14, align 8, !tbaa !13
  br label %.loopexit

15:                                               ; preds = %3
  %16 = tail call ptr @new_PlNode(i32 noundef 2003) #2
  %17 = load ptr, ptr %0, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i64 24
  %19 = load i32, ptr %18, align 8, !tbaa !14
  %20 = getelementptr inbounds i8, ptr %16, i64 24
  store i32 %19, ptr %20, align 8, !tbaa !14
  %21 = getelementptr inbounds i8, ptr %17, i64 32
  %22 = load ptr, ptr %21, align 8, !tbaa !15
  %23 = getelementptr inbounds i8, ptr %16, i64 32
  store ptr %22, ptr %23, align 8, !tbaa !15
  %24 = load ptr, ptr %0, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i64 40
  %26 = load ptr, ptr %25, align 8, !tbaa !16
  %27 = getelementptr inbounds i8, ptr %16, i64 40
  store ptr %26, ptr %27, align 8, !tbaa !16
  %28 = load ptr, ptr %0, align 8, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %28, i64 32
  store ptr null, ptr %29, align 8, !tbaa !15
  %30 = load ptr, ptr %0, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %30, i64 40
  store ptr null, ptr %31, align 8, !tbaa !16
  %32 = load ptr, ptr %0, align 8, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %32, i64 24
  store i32 -1, ptr %33, align 8, !tbaa !14
  store i32 2006, ptr %32, align 8, !tbaa !9
  %34 = getelementptr inbounds i8, ptr %32, i64 48
  store ptr %16, ptr %34, align 8, !tbaa !13
  br label %.loopexit

35:                                               ; preds = %3
  tail call void @free_PlNode(ptr noundef nonnull %2) #2
  store ptr null, ptr %0, align 8, !tbaa !5
  br label %.loopexit

36:                                               ; preds = %3
  %37 = getelementptr inbounds i8, ptr %2, i64 48
  %38 = load ptr, ptr %37, align 8, !tbaa !13
  %.not4450 = icmp eq ptr %38, null
  br i1 %.not4450, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %36, %52
  %.03852 = phi ptr [ %.1, %52 ], [ null, %36 ]
  %.03951 = phi ptr [ %.2, %52 ], [ %38, %36 ]
  %39 = load i32, ptr %.03951, align 8, !tbaa !9
  switch i32 %39, label %.loopexit [
    i32 2002, label %.thread
    i32 2003, label %.thread
    i32 2005, label %40
  ]

40:                                               ; preds = %.lr.ph
  %.not45 = icmp eq ptr %.03852, null
  %41 = getelementptr inbounds i8, ptr %.03951, i64 56
  %42 = load ptr, ptr %41, align 8, !tbaa !17
  br i1 %.not45, label %45, label %43

43:                                               ; preds = %40
  %44 = getelementptr inbounds i8, ptr %.03852, i64 56
  br label %48

45:                                               ; preds = %40
  %46 = load ptr, ptr %0, align 8, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %46, i64 48
  br label %48

48:                                               ; preds = %43, %45
  %.sink = phi ptr [ %44, %43 ], [ %47, %45 ]
  store ptr %42, ptr %.sink, align 8, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %.03951, i64 56
  store ptr null, ptr %49, align 8, !tbaa !17
  tail call void @free_PlNode(ptr noundef nonnull %.03951) #2
  %.pr = load i32, ptr %42, align 8, !tbaa !9
  %.not46 = icmp eq i32 %.pr, 2005
  br i1 %.not46, label %52, label %.thread

.thread:                                          ; preds = %.lr.ph, %.lr.ph, %48
  %.14049 = phi ptr [ %42, %48 ], [ %.03951, %.lr.ph ], [ %.03951, %.lr.ph ]
  %50 = getelementptr inbounds i8, ptr %.14049, i64 56
  %51 = load ptr, ptr %50, align 8, !tbaa !17
  br label %52

52:                                               ; preds = %.thread, %48
  %.2 = phi ptr [ %51, %.thread ], [ %42, %48 ]
  %.1 = phi ptr [ %.14049, %.thread ], [ %.03852, %48 ]
  %.not44 = icmp eq ptr %.2, null
  br i1 %.not44, label %.loopexit, label %.lr.ph, !llvm.loop !18

.loopexit:                                        ; preds = %.lr.ph, %52, %36, %3, %1, %35, %15, %5
  %.0 = phi i8 [ 1, %35 ], [ 1, %15 ], [ 1, %5 ], [ 1, %1 ], [ 0, %3 ], [ 1, %36 ], [ 0, %.lr.ph ], [ 1, %52 ]
  ret i8 %.0
}

declare void @free_PlNode(ptr noundef) local_unnamed_addr #0

attributes #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 = { 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 = { 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, !11, i64 0}
!10 = !{!"_PlNode", !11, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !11, i64 28, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 16}
!13 = !{!10, !6, i64 48}
!14 = !{!10, !11, i64 24}
!15 = !{!10, !6, i64 32}
!16 = !{!10, !6, i64 40}
!17 = !{!10, !6, i64 56}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass