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

; Function Attrs: nounwind uwtable
declare dso_local void @make_either_ty(ptr noundef) #1

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

8:                                                ; preds = %1
  store i32 1, ptr %5, align 4
  br label %60

9:                                                ; preds = %1
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct._PlNode, ptr %10, i32 0, i32 0
  %12 = load i32, ptr %11, align 8, !tbaa !9
  switch i32 %12, label %58 [
    i32 2008, label %13
    i32 2009, label %13
    i32 2006, label %30
    i32 2007, label %30
    i32 2005, label %44
    i32 2002, label %48
    i32 2000, label %48
    i32 2001, label %48
    i32 2010, label %49
  ]

13:                                               ; preds = %9, %9
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct._PlNode, ptr %14, i32 0, i32 1
  %16 = load ptr, ptr %15, align 8, !tbaa !12
  store ptr %16, ptr %4, align 8, !tbaa !5
  br label %17

17:                                               ; preds = %22, %13
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %26

20:                                               ; preds = %17
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  call void @make_either_ty(ptr noundef %21)
  br label %22

22:                                               ; preds = %20
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct._TypedList, ptr %23, i32 0, i32 3
  %25 = load ptr, ptr %24, align 8, !tbaa !13
  store ptr %25, ptr %4, align 8, !tbaa !5
  br label %17, !llvm.loop !15

26:                                               ; preds = %17
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct._PlNode, ptr %27, i32 0, i32 7
  %29 = load ptr, ptr %28, align 8, !tbaa !17
  call void @make_either_ty_in_pl(ptr noundef %29)
  br label %59

30:                                               ; preds = %9, %9
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct._PlNode, ptr %31, i32 0, i32 7
  %33 = load ptr, ptr %32, align 8, !tbaa !17
  store ptr %33, ptr %3, align 8, !tbaa !5
  br label %34

34:                                               ; preds = %39, %30
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %43

37:                                               ; preds = %34
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  call void @make_either_ty_in_pl(ptr noundef %38)
  br label %39

39:                                               ; preds = %37
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._PlNode, ptr %40, i32 0, i32 8
  %42 = load ptr, ptr %41, align 8, !tbaa !18
  store ptr %42, ptr %3, align 8, !tbaa !5
  br label %34, !llvm.loop !19

43:                                               ; preds = %34
  br label %59

44:                                               ; preds = %9
  %45 = load ptr, ptr %2, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct._PlNode, ptr %45, i32 0, i32 7
  %47 = load ptr, ptr %46, align 8, !tbaa !17
  call void @make_either_ty_in_pl(ptr noundef %47)
  br label %59

48:                                               ; preds = %9, %9, %9
  br label %59

49:                                               ; preds = %9
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._PlNode, ptr %50, i32 0, i32 7
  %52 = load ptr, ptr %51, align 8, !tbaa !17
  call void @make_either_ty_in_pl(ptr noundef %52)
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct._PlNode, ptr %53, i32 0, i32 7
  %55 = load ptr, ptr %54, align 8, !tbaa !17
  %56 = getelementptr inbounds %struct._PlNode, ptr %55, i32 0, i32 8
  %57 = load ptr, ptr %56, align 8, !tbaa !18
  call void @make_either_ty_in_pl(ptr noundef %57)
  br label %59

58:                                               ; preds = %9
  br label %59

59:                                               ; preds = %58, %49, %48, %44, %43, %26
  store i32 0, ptr %5, align 4
  br label %60

60:                                               ; preds = %59, %8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #2
  %61 = load i32, ptr %5, align 4
  switch i32 %61, label %63 [
    i32 0, label %62
    i32 1, label %62
  ]

62:                                               ; preds = %60, %60
  ret void

63:                                               ; preds = %60
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 8}
!13 = !{!14, !6, i64 24}
!14 = !{!"_TypedList", !6, i64 0, !6, i64 8, !11, i64 16, !6, i64 24}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!10, !6, i64 48}
!18 = !{!10, !6, i64 56}
!19 = distinct !{!19, !16}


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

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

; Function Attrs: nounwind uwtable
define dso_local void @make_either_ty_in_pl(ptr noundef readonly %0) local_unnamed_addr #0 {
  %.not23 = icmp eq ptr %0, null
  br i1 %.not23, label %.loopexit, label %.lr.ph26

.lr.ph26:                                         ; preds = %1, %tailrecurse.backedge
  %.tr24 = phi ptr [ %.tr.be, %tailrecurse.backedge ], [ %0, %1 ]
  %2 = load i32, ptr %.tr24, align 8, !tbaa !5
  switch i32 %2, label %.loopexit [
    i32 2008, label %3
    i32 2009, label %3
    i32 2006, label %7
    i32 2007, label %7
    i32 2005, label %10
    i32 2010, label %12
  ]

3:                                                ; preds = %.lr.ph26, %.lr.ph26
  %4 = getelementptr inbounds i8, ptr %.tr24, i64 8
  %.020 = load ptr, ptr %4, align 8, !tbaa !11
  %.not1721 = icmp eq ptr %.020, null
  br i1 %.not1721, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3, %.lr.ph
  %.022 = phi ptr [ %.0, %.lr.ph ], [ %.020, %3 ]
  tail call void @make_either_ty(ptr noundef nonnull %.022)
  %5 = getelementptr inbounds i8, ptr %.022, i64 24
  %.0 = load ptr, ptr %5, align 8, !tbaa !11
  %.not17 = icmp eq ptr %.0, null
  br i1 %.not17, label %._crit_edge, label %.lr.ph, !llvm.loop !12

._crit_edge:                                      ; preds = %.lr.ph, %3
  %6 = getelementptr inbounds i8, ptr %.tr24, i64 48
  br label %tailrecurse.backedge

tailrecurse.backedge:                             ; preds = %._crit_edge, %10, %12
  %.tr.be.in = phi ptr [ %6, %._crit_edge ], [ %11, %10 ], [ %16, %12 ]
  %.tr.be = load ptr, ptr %.tr.be.in, align 8, !tbaa !11
  %.not = icmp eq ptr %.tr.be, null
  br i1 %.not, label %.loopexit, label %.lr.ph26

7:                                                ; preds = %.lr.ph26, %.lr.ph26
  %8 = getelementptr inbounds i8, ptr %.tr24, i64 48
  %.01427 = load ptr, ptr %8, align 8, !tbaa !11
  %.not1628 = icmp eq ptr %.01427, null
  br i1 %.not1628, label %.loopexit, label %.lr.ph31

.lr.ph31:                                         ; preds = %7, %.lr.ph31
  %.01429 = phi ptr [ %.014, %.lr.ph31 ], [ %.01427, %7 ]
  tail call void @make_either_ty_in_pl(ptr noundef nonnull %.01429)
  %9 = getelementptr inbounds i8, ptr %.01429, i64 56
  %.014 = load ptr, ptr %9, align 8, !tbaa !11
  %.not16 = icmp eq ptr %.014, null
  br i1 %.not16, label %.loopexit, label %.lr.ph31, !llvm.loop !14

10:                                               ; preds = %.lr.ph26
  %11 = getelementptr inbounds i8, ptr %.tr24, i64 48
  br label %tailrecurse.backedge

12:                                               ; preds = %.lr.ph26
  %13 = getelementptr inbounds i8, ptr %.tr24, i64 48
  %14 = load ptr, ptr %13, align 8, !tbaa !15
  tail call void @make_either_ty_in_pl(ptr noundef %14)
  %15 = load ptr, ptr %13, align 8, !tbaa !15
  %16 = getelementptr inbounds i8, ptr %15, i64 56
  br label %tailrecurse.backedge

.loopexit:                                        ; preds = %tailrecurse.backedge, %.lr.ph26, %.lr.ph31, %1, %7
  ret void
}

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

!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, !7, i64 0}
!6 = !{!"_PlNode", !7, i64 0, !10, i64 8, !10, i64 16, !7, i64 24, !7, i64 28, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = !{!6, !10, i64 48}


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