; 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._Operator = type { ptr, [15 x ptr], i32, i8, i32, [15 x i32], [15 x i8], ptr, ptr, i8 }
%struct._Effect = type { i32, [15 x i32], [15 x ptr], ptr, ptr, ptr, ptr, ptr }
%struct._Literal = type { i8, %struct._Fact, ptr, ptr }
%struct._Fact = type { i32, [5 x i32] }
%struct._NumericEffect = type { %struct._Fluent, i32, ptr, ptr, ptr }
%struct._Fluent = type { i32, [5 x i32] }

@gnum_predicates = external global i32, align 4
@gnum_functions = external global i32, align 4
@gnum_operators = external global i32, align 4
@goperators = external global [50000 x ptr], align 16
@gis_added = external global [50 x i8], align 16
@gis_deleted = external global [50 x i8], align 16
@gis_changed = external global [50 x i8], align 16

; 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
define dso_local void @collect_inertia_information() #1 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %5

5:                                                ; preds = %16, %0
  %6 = load i32, ptr %1, align 4, !tbaa !5
  %7 = load i32, ptr @gnum_predicates, align 4, !tbaa !5
  %8 = icmp slt i32 %6, %7
  br i1 %8, label %9, label %19

9:                                                ; preds = %5
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds [50 x i8], ptr @gis_added, i64 0, i64 %11
  store i8 0, ptr %12, align 1, !tbaa !9
  %13 = load i32, ptr %1, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [50 x i8], ptr @gis_deleted, i64 0, i64 %14
  store i8 0, ptr %15, align 1, !tbaa !9
  br label %16

16:                                               ; preds = %9
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = add nsw i32 %17, 1
  store i32 %18, ptr %1, align 4, !tbaa !5
  br label %5, !llvm.loop !10

19:                                               ; preds = %5
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %28, %19
  %21 = load i32, ptr %1, align 4, !tbaa !5
  %22 = load i32, ptr @gnum_functions, align 4, !tbaa !5
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %24, label %31

24:                                               ; preds = %20
  %25 = load i32, ptr %1, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [50 x i8], ptr @gis_changed, i64 0, i64 %26
  store i8 0, ptr %27, align 1, !tbaa !9
  br label %28

28:                                               ; preds = %24
  %29 = load i32, ptr %1, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %1, align 4, !tbaa !5
  br label %20, !llvm.loop !12

31:                                               ; preds = %20
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %101, %31
  %33 = load i32, ptr %1, align 4, !tbaa !5
  %34 = load i32, ptr @gnum_operators, align 4, !tbaa !5
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %36, label %104

36:                                               ; preds = %32
  %37 = load i32, ptr %1, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [50000 x ptr], ptr @goperators, i64 0, i64 %38
  %40 = load ptr, ptr %39, align 8, !tbaa !13
  %41 = getelementptr inbounds %struct._Operator, ptr %40, i32 0, i32 8
  %42 = load ptr, ptr %41, align 8, !tbaa !15
  store ptr %42, ptr %2, align 8, !tbaa !13
  br label %43

43:                                               ; preds = %96, %36
  %44 = load ptr, ptr %2, align 8, !tbaa !13
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %100

46:                                               ; preds = %43
  %47 = load ptr, ptr %2, align 8, !tbaa !13
  %48 = getelementptr inbounds %struct._Effect, ptr %47, i32 0, i32 4
  %49 = load ptr, ptr %48, align 8, !tbaa !17
  store ptr %49, ptr %3, align 8, !tbaa !13
  br label %50

50:                                               ; preds = %73, %46
  %51 = load ptr, ptr %3, align 8, !tbaa !13
  %52 = icmp ne ptr %51, null
  br i1 %52, label %53, label %77

53:                                               ; preds = %50
  %54 = load ptr, ptr %3, align 8, !tbaa !13
  %55 = getelementptr inbounds %struct._Literal, ptr %54, i32 0, i32 0
  %56 = load i8, ptr %55, align 8, !tbaa !19
  %57 = icmp ne i8 %56, 0
  br i1 %57, label %58, label %65

58:                                               ; preds = %53
  %59 = load ptr, ptr %3, align 8, !tbaa !13
  %60 = getelementptr inbounds %struct._Literal, ptr %59, i32 0, i32 1
  %61 = getelementptr inbounds %struct._Fact, ptr %60, i32 0, i32 0
  %62 = load i32, ptr %61, align 4, !tbaa !22
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [50 x i8], ptr @gis_deleted, i64 0, i64 %63
  store i8 1, ptr %64, align 1, !tbaa !9
  br label %72

65:                                               ; preds = %53
  %66 = load ptr, ptr %3, align 8, !tbaa !13
  %67 = getelementptr inbounds %struct._Literal, ptr %66, i32 0, i32 1
  %68 = getelementptr inbounds %struct._Fact, ptr %67, i32 0, i32 0
  %69 = load i32, ptr %68, align 4, !tbaa !22
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [50 x i8], ptr @gis_added, i64 0, i64 %70
  store i8 1, ptr %71, align 1, !tbaa !9
  br label %72

72:                                               ; preds = %65, %58
  br label %73

73:                                               ; preds = %72
  %74 = load ptr, ptr %3, align 8, !tbaa !13
  %75 = getelementptr inbounds %struct._Literal, ptr %74, i32 0, i32 2
  %76 = load ptr, ptr %75, align 8, !tbaa !23
  store ptr %76, ptr %3, align 8, !tbaa !13
  br label %50, !llvm.loop !24

77:                                               ; preds = %50
  %78 = load ptr, ptr %2, align 8, !tbaa !13
  %79 = getelementptr inbounds %struct._Effect, ptr %78, i32 0, i32 5
  %80 = load ptr, ptr %79, align 8, !tbaa !25
  store ptr %80, ptr %4, align 8, !tbaa !13
  br label %81

81:                                               ; preds = %91, %77
  %82 = load ptr, ptr %4, align 8, !tbaa !13
  %83 = icmp ne ptr %82, null
  br i1 %83, label %84, label %95

84:                                               ; preds = %81
  %85 = load ptr, ptr %4, align 8, !tbaa !13
  %86 = getelementptr inbounds %struct._NumericEffect, ptr %85, i32 0, i32 0
  %87 = getelementptr inbounds %struct._Fluent, ptr %86, i32 0, i32 0
  %88 = load i32, ptr %87, align 8, !tbaa !26
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [50 x i8], ptr @gis_changed, i64 0, i64 %89
  store i8 1, ptr %90, align 1, !tbaa !9
  br label %91

91:                                               ; preds = %84
  %92 = load ptr, ptr %4, align 8, !tbaa !13
  %93 = getelementptr inbounds %struct._NumericEffect, ptr %92, i32 0, i32 3
  %94 = load ptr, ptr %93, align 8, !tbaa !29
  store ptr %94, ptr %4, align 8, !tbaa !13
  br label %81, !llvm.loop !30

95:                                               ; preds = %81
  br label %96

96:                                               ; preds = %95
  %97 = load ptr, ptr %2, align 8, !tbaa !13
  %98 = getelementptr inbounds %struct._Effect, ptr %97, i32 0, i32 6
  %99 = load ptr, ptr %98, align 8, !tbaa !31
  store ptr %99, ptr %2, align 8, !tbaa !13
  br label %43, !llvm.loop !32

100:                                              ; preds = %43
  br label %101

101:                                              ; preds = %100
  %102 = load i32, ptr %1, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %1, align 4, !tbaa !5
  br label %32, !llvm.loop !33

104:                                              ; preds = %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #2
  ret void
}

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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!16, !14, i64 224}
!16 = !{!"_Operator", !14, i64 0, !7, i64 8, !6, i64 128, !7, i64 132, !6, i64 136, !7, i64 140, !7, i64 200, !14, i64 216, !14, i64 224, !7, i64 232}
!17 = !{!18, !14, i64 192}
!18 = !{!"_Effect", !6, i64 0, !7, i64 4, !7, i64 64, !14, i64 184, !14, i64 192, !14, i64 200, !14, i64 208, !14, i64 216}
!19 = !{!20, !7, i64 0}
!20 = !{!"_Literal", !7, i64 0, !21, i64 4, !14, i64 32, !14, i64 40}
!21 = !{!"_Fact", !6, i64 0, !7, i64 4}
!22 = !{!20, !6, i64 4}
!23 = !{!20, !14, i64 32}
!24 = distinct !{!24, !11}
!25 = !{!18, !14, i64 200}
!26 = !{!27, !6, i64 0}
!27 = !{!"_NumericEffect", !28, i64 0, !6, i64 24, !14, i64 32, !14, i64 40, !14, i64 48}
!28 = !{!"_Fluent", !6, i64 0, !7, i64 4}
!29 = !{!27, !14, i64 40}
!30 = distinct !{!30, !11}
!31 = !{!18, !14, i64 208}
!32 = distinct !{!32, !11}
!33 = distinct !{!33, !11}


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

@gnum_predicates = external local_unnamed_addr global i32, align 4
@gnum_functions = external local_unnamed_addr global i32, align 4
@gnum_operators = external local_unnamed_addr global i32, align 4
@goperators = external local_unnamed_addr global [50000 x ptr], align 16
@gis_added = external local_unnamed_addr global [50 x i8], align 16
@gis_deleted = external local_unnamed_addr global [50 x i8], align 16
@gis_changed = external local_unnamed_addr global [50 x i8], align 16

; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @collect_inertia_information() local_unnamed_addr #0 {
  %1 = load i32, ptr @gnum_predicates, align 4, !tbaa !5
  %2 = icmp sgt i32 %1, 0
  br i1 %2, label %.lr.ph.preheader, label %.preheader27

.lr.ph.preheader:                                 ; preds = %0
  %3 = zext nneg i32 %1 to i64
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @gis_added, i8 0, i64 %3, i1 false), !tbaa !9
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @gis_deleted, i8 0, i64 %3, i1 false), !tbaa !9
  br label %.preheader27

.preheader27:                                     ; preds = %.lr.ph.preheader, %0
  %4 = load i32, ptr @gnum_functions, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph30.preheader, label %.preheader

.lr.ph30.preheader:                               ; preds = %.preheader27
  %6 = zext nneg i32 %4 to i64
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @gis_changed, i8 0, i64 %6, i1 false), !tbaa !9
  br label %.preheader

.preheader:                                       ; preds = %.lr.ph30.preheader, %.preheader27
  %7 = load i32, ptr @gnum_operators, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph48.preheader, label %._crit_edge49

.lr.ph48.preheader:                               ; preds = %.preheader
  %wide.trip.count = zext nneg i32 %7 to i64
  br label %.lr.ph48

.lr.ph48:                                         ; preds = %.lr.ph48.preheader, %._crit_edge46
  %indvars.iv = phi i64 [ 0, %.lr.ph48.preheader ], [ %indvars.iv.next, %._crit_edge46 ]
  %9 = getelementptr inbounds [50000 x ptr], ptr @goperators, i64 0, i64 %indvars.iv
  %10 = load ptr, ptr %9, align 8, !tbaa !10
  %11 = getelementptr inbounds i8, ptr %10, i64 224
  %.02241 = load ptr, ptr %11, align 8, !tbaa !10
  %.not42 = icmp eq ptr %.02241, null
  br i1 %.not42, label %._crit_edge46, label %.lr.ph45

.lr.ph45:                                         ; preds = %.lr.ph48, %._crit_edge40
  %.02243 = phi ptr [ %.022, %._crit_edge40 ], [ %.02241, %.lr.ph48 ]
  %12 = getelementptr inbounds i8, ptr %.02243, i64 192
  %.02131 = load ptr, ptr %12, align 8, !tbaa !10
  %.not2432 = icmp eq ptr %.02131, null
  br i1 %.not2432, label %._crit_edge, label %.lr.ph34

.lr.ph34:                                         ; preds = %.lr.ph45, %.lr.ph34
  %.02133 = phi ptr [ %.021, %.lr.ph34 ], [ %.02131, %.lr.ph45 ]
  %13 = load i8, ptr %.02133, align 8, !tbaa !12
  %.not26 = icmp eq i8 %13, 0
  %14 = getelementptr inbounds i8, ptr %.02133, i64 4
  %15 = load i32, ptr %14, align 4, !tbaa !15
  %16 = sext i32 %15 to i64
  %gis_added.gis_deleted = select i1 %.not26, ptr @gis_added, ptr @gis_deleted
  %17 = getelementptr inbounds [50 x i8], ptr %gis_added.gis_deleted, i64 0, i64 %16
  store i8 1, ptr %17, align 1, !tbaa !9
  %18 = getelementptr inbounds i8, ptr %.02133, i64 32
  %.021 = load ptr, ptr %18, align 8, !tbaa !10
  %.not24 = icmp eq ptr %.021, null
  br i1 %.not24, label %._crit_edge, label %.lr.ph34, !llvm.loop !16

._crit_edge:                                      ; preds = %.lr.ph34, %.lr.ph45
  %19 = getelementptr inbounds i8, ptr %.02243, i64 200
  %.035 = load ptr, ptr %19, align 8, !tbaa !10
  %.not2536 = icmp eq ptr %.035, null
  br i1 %.not2536, label %._crit_edge40, label %.lr.ph39

.lr.ph39:                                         ; preds = %._crit_edge, %.lr.ph39
  %.037 = phi ptr [ %.0, %.lr.ph39 ], [ %.035, %._crit_edge ]
  %20 = load i32, ptr %.037, align 8, !tbaa !18
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [50 x i8], ptr @gis_changed, i64 0, i64 %21
  store i8 1, ptr %22, align 1, !tbaa !9
  %23 = getelementptr inbounds i8, ptr %.037, i64 40
  %.0 = load ptr, ptr %23, align 8, !tbaa !10
  %.not25 = icmp eq ptr %.0, null
  br i1 %.not25, label %._crit_edge40, label %.lr.ph39, !llvm.loop !21

._crit_edge40:                                    ; preds = %.lr.ph39, %._crit_edge
  %24 = getelementptr inbounds i8, ptr %.02243, i64 208
  %.022 = load ptr, ptr %24, align 8, !tbaa !10
  %.not = icmp eq ptr %.022, null
  br i1 %.not, label %._crit_edge46, label %.lr.ph45, !llvm.loop !22

._crit_edge46:                                    ; preds = %._crit_edge40, %.lr.ph48
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge49, label %.lr.ph48, !llvm.loop !23

._crit_edge49:                                    ; preds = %._crit_edge46, %.preheader
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) 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 nounwind willreturn memory(argmem: write) }

!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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!13, !7, i64 0}
!13 = !{!"_Literal", !7, i64 0, !14, i64 4, !11, i64 32, !11, i64 40}
!14 = !{!"_Fact", !6, i64 0, !7, i64 4}
!15 = !{!13, !6, i64 4}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!19, !6, i64 0}
!19 = !{!"_NumericEffect", !20, i64 0, !6, i64 24, !11, i64 32, !11, i64 40, !11, i64 48}
!20 = !{!"_Fluent", !6, i64 0, !7, i64 4}
!21 = distinct !{!21, !17}
!22 = distinct !{!22, !17}
!23 = distinct !{!23, !17}


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