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

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

; 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
declare void @free(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @merge_next_step_ANDs_and_ORs_in_wff(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct._WffNode, ptr %7, i32 0, i32 4
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  store ptr %9, ptr %3, align 8, !tbaa !5
  br label %10

10:                                               ; preds = %129, %123, %60, %1
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = icmp ne ptr %11, null
  br i1 %12, label %13, label %133

13:                                               ; preds = %10
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct._WffNode, ptr %14, i32 0, i32 0
  %16 = load i32, ptr %15, align 8, !tbaa !12
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = load ptr, ptr %17, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct._WffNode, ptr %18, i32 0, i32 0
  %20 = load i32, ptr %19, align 8, !tbaa !12
  %21 = icmp eq i32 %16, %20
  br i1 %21, label %22, label %129

22:                                               ; preds = %13
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct._WffNode, ptr %23, i32 0, i32 4
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  %26 = icmp ne ptr %25, null
  br i1 %26, label %66, label %27

27:                                               ; preds = %22
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._WffNode, ptr %28, i32 0, i32 5
  %30 = load ptr, ptr %29, align 8, !tbaa !13
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %40

32:                                               ; preds = %27
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._WffNode, ptr %33, i32 0, i32 6
  %35 = load ptr, ptr %34, align 8, !tbaa !14
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._WffNode, ptr %36, i32 0, i32 5
  %38 = load ptr, ptr %37, align 8, !tbaa !13
  %39 = getelementptr inbounds %struct._WffNode, ptr %38, i32 0, i32 6
  store ptr %35, ptr %39, align 8, !tbaa !14
  br label %40

40:                                               ; preds = %32, %27
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct._WffNode, ptr %41, i32 0, i32 6
  %43 = load ptr, ptr %42, align 8, !tbaa !14
  %44 = icmp ne ptr %43, null
  br i1 %44, label %45, label %53

45:                                               ; preds = %40
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct._WffNode, ptr %46, i32 0, i32 5
  %48 = load ptr, ptr %47, align 8, !tbaa !13
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct._WffNode, ptr %49, i32 0, i32 6
  %51 = load ptr, ptr %50, align 8, !tbaa !14
  %52 = getelementptr inbounds %struct._WffNode, ptr %51, i32 0, i32 5
  store ptr %48, ptr %52, align 8, !tbaa !13
  br label %60

53:                                               ; preds = %40
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct._WffNode, ptr %54, i32 0, i32 5
  %56 = load ptr, ptr %55, align 8, !tbaa !13
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct._WffNode, ptr %58, i32 0, i32 4
  store ptr %56, ptr %59, align 8, !tbaa !9
  br label %60

60:                                               ; preds = %53, %45
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %61, ptr %5, align 8, !tbaa !5
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct._WffNode, ptr %62, i32 0, i32 5
  %64 = load ptr, ptr %63, align 8, !tbaa !13
  store ptr %64, ptr %3, align 8, !tbaa !5
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %65) #3
  br label %10, !llvm.loop !15

66:                                               ; preds = %22
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct._WffNode, ptr %67, i32 0, i32 4
  %69 = load ptr, ptr %68, align 8, !tbaa !9
  store ptr %69, ptr %4, align 8, !tbaa !5
  br label %70

70:                                               ; preds = %76, %66
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct._WffNode, ptr %71, i32 0, i32 5
  %73 = load ptr, ptr %72, align 8, !tbaa !13
  %74 = icmp ne ptr %73, null
  br i1 %74, label %75, label %80

75:                                               ; preds = %70
  br label %76

76:                                               ; preds = %75
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct._WffNode, ptr %77, i32 0, i32 5
  %79 = load ptr, ptr %78, align 8, !tbaa !13
  store ptr %79, ptr %4, align 8, !tbaa !5
  br label %70, !llvm.loop !17

80:                                               ; preds = %70
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct._WffNode, ptr %81, i32 0, i32 5
  %83 = load ptr, ptr %82, align 8, !tbaa !13
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct._WffNode, ptr %84, i32 0, i32 5
  store ptr %83, ptr %85, align 8, !tbaa !13
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct._WffNode, ptr %86, i32 0, i32 5
  %88 = load ptr, ptr %87, align 8, !tbaa !13
  %89 = icmp ne ptr %88, null
  br i1 %89, label %90, label %96

90:                                               ; preds = %80
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = load ptr, ptr %3, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct._WffNode, ptr %92, i32 0, i32 5
  %94 = load ptr, ptr %93, align 8, !tbaa !13
  %95 = getelementptr inbounds %struct._WffNode, ptr %94, i32 0, i32 6
  store ptr %91, ptr %95, align 8, !tbaa !14
  br label %96

96:                                               ; preds = %90, %80
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct._WffNode, ptr %97, i32 0, i32 6
  %99 = load ptr, ptr %98, align 8, !tbaa !14
  %100 = icmp ne ptr %99, null
  br i1 %100, label %101, label %116

101:                                              ; preds = %96
  %102 = load ptr, ptr %3, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._WffNode, ptr %102, i32 0, i32 4
  %104 = load ptr, ptr %103, align 8, !tbaa !9
  %105 = load ptr, ptr %3, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct._WffNode, ptr %105, i32 0, i32 6
  %107 = load ptr, ptr %106, align 8, !tbaa !14
  %108 = getelementptr inbounds %struct._WffNode, ptr %107, i32 0, i32 5
  store ptr %104, ptr %108, align 8, !tbaa !13
  %109 = load ptr, ptr %3, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct._WffNode, ptr %109, i32 0, i32 6
  %111 = load ptr, ptr %110, align 8, !tbaa !14
  %112 = load ptr, ptr %3, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct._WffNode, ptr %112, i32 0, i32 4
  %114 = load ptr, ptr %113, align 8, !tbaa !9
  %115 = getelementptr inbounds %struct._WffNode, ptr %114, i32 0, i32 6
  store ptr %111, ptr %115, align 8, !tbaa !14
  br label %123

116:                                              ; preds = %96
  %117 = load ptr, ptr %3, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct._WffNode, ptr %117, i32 0, i32 4
  %119 = load ptr, ptr %118, align 8, !tbaa !9
  %120 = load ptr, ptr %2, align 8, !tbaa !5
  %121 = load ptr, ptr %120, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct._WffNode, ptr %121, i32 0, i32 4
  store ptr %119, ptr %122, align 8, !tbaa !9
  br label %123

123:                                              ; preds = %116, %101
  %124 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %124, ptr %5, align 8, !tbaa !5
  %125 = load ptr, ptr %3, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct._WffNode, ptr %125, i32 0, i32 5
  %127 = load ptr, ptr %126, align 8, !tbaa !13
  store ptr %127, ptr %3, align 8, !tbaa !5
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %128) #3
  br label %10, !llvm.loop !15

129:                                              ; preds = %13
  %130 = load ptr, ptr %3, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct._WffNode, ptr %130, i32 0, i32 5
  %132 = load ptr, ptr %131, align 8, !tbaa !13
  store ptr %132, ptr %3, align 8, !tbaa !5
  br label %10, !llvm.loop !15

133:                                              ; preds = %10
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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, !6, i64 24}
!10 = !{!"_WffNode", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !11, i64 56, !6, i64 64, !11, i64 72, !6, i64 80, !6, i64 88, !7, i64 96}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = !{!10, !6, i64 32}
!14 = !{!10, !6, i64 40}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !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: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @merge_next_step_ANDs_and_ORs_in_wff(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = load ptr, ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %2, i64 24
  %4 = load ptr, ptr %3, align 8, !tbaa !9
  %.not49 = icmp eq ptr %4, null
  br i1 %.not49, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1, %.backedge
  %.03550 = phi ptr [ %.035.be, %.backedge ], [ %4, %1 ]
  %5 = load i32, ptr %.03550, align 8, !tbaa !12
  %6 = load ptr, ptr %0, align 8, !tbaa !5
  %7 = load i32, ptr %6, align 8, !tbaa !12
  %8 = icmp eq i32 %5, %7
  br i1 %8, label %9, label %43

9:                                                ; preds = %.lr.ph
  %10 = getelementptr inbounds i8, ptr %.03550, i64 24
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %.not42 = icmp eq ptr %11, null
  br i1 %.not42, label %12, label %.preheader

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %.03550, i64 32
  %14 = load ptr, ptr %13, align 8, !tbaa !13
  %.not43 = icmp eq ptr %14, null
  %.phi.trans.insert = getelementptr inbounds i8, ptr %.03550, i64 40
  %.pre52 = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !14
  br i1 %.not43, label %._crit_edge51, label %15

15:                                               ; preds = %12
  %16 = getelementptr inbounds i8, ptr %14, i64 40
  store ptr %.pre52, ptr %16, align 8, !tbaa !14
  br label %._crit_edge51

._crit_edge51:                                    ; preds = %12, %15
  %.not44 = icmp eq ptr %.pre52, null
  br i1 %.not44, label %19, label %17

17:                                               ; preds = %._crit_edge51
  %18 = getelementptr inbounds i8, ptr %.pre52, i64 32
  store ptr %14, ptr %18, align 8, !tbaa !13
  %.pre53 = load ptr, ptr %13, align 8, !tbaa !13
  br label %22

19:                                               ; preds = %._crit_edge51
  %20 = load ptr, ptr %0, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %20, i64 24
  store ptr %14, ptr %21, align 8, !tbaa !9
  br label %22

22:                                               ; preds = %19, %17
  %23 = phi ptr [ %14, %19 ], [ %.pre53, %17 ]
  tail call void @free(ptr noundef nonnull %.03550) #2
  br label %.backedge

.backedge:                                        ; preds = %22, %41, %43
  %.035.be = phi ptr [ %42, %41 ], [ %23, %22 ], [ %45, %43 ]
  %.not = icmp eq ptr %.035.be, null
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !15

.preheader:                                       ; preds = %9, %.preheader
  %.0 = phi ptr [ %25, %.preheader ], [ %11, %9 ]
  %24 = getelementptr inbounds i8, ptr %.0, i64 32
  %25 = load ptr, ptr %24, align 8, !tbaa !13
  %.not45 = icmp eq ptr %25, null
  br i1 %.not45, label %26, label %.preheader, !llvm.loop !17

26:                                               ; preds = %.preheader
  %27 = getelementptr inbounds i8, ptr %.0, i64 32
  %28 = getelementptr inbounds i8, ptr %.03550, i64 32
  %29 = load ptr, ptr %28, align 8, !tbaa !13
  store ptr %29, ptr %27, align 8, !tbaa !13
  %.not46 = icmp eq ptr %29, null
  br i1 %.not46, label %32, label %30

30:                                               ; preds = %26
  %31 = getelementptr inbounds i8, ptr %29, i64 40
  store ptr %.0, ptr %31, align 8, !tbaa !14
  br label %32

32:                                               ; preds = %30, %26
  %33 = getelementptr inbounds i8, ptr %.03550, i64 40
  %34 = load ptr, ptr %33, align 8, !tbaa !14
  %.not47 = icmp eq ptr %34, null
  br i1 %.not47, label %38, label %35

35:                                               ; preds = %32
  %36 = getelementptr inbounds i8, ptr %34, i64 32
  store ptr %11, ptr %36, align 8, !tbaa !13
  %37 = getelementptr inbounds i8, ptr %11, i64 40
  store ptr %34, ptr %37, align 8, !tbaa !14
  %.pre = load ptr, ptr %28, align 8, !tbaa !13
  br label %41

38:                                               ; preds = %32
  %39 = load ptr, ptr %0, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %39, i64 24
  store ptr %11, ptr %40, align 8, !tbaa !9
  br label %41

41:                                               ; preds = %38, %35
  %42 = phi ptr [ %29, %38 ], [ %.pre, %35 ]
  tail call void @free(ptr noundef nonnull %.03550) #2
  br label %.backedge

43:                                               ; preds = %.lr.ph
  %44 = getelementptr inbounds i8, ptr %.03550, i64 32
  %45 = load ptr, ptr %44, align 8, !tbaa !13
  br label %.backedge

._crit_edge:                                      ; preds = %.backedge, %1
  ret void
}

attributes #0 = { 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 #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, !6, i64 24}
!10 = !{!"_WffNode", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !11, i64 56, !6, i64 64, !11, i64 72, !6, i64 80, !6, i64 88, !7, i64 96}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = !{!10, !6, i64 32}
!14 = !{!10, !6, i64 40}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


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