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

; 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._LnfExpNode = type { [25 x i32], [25 x float], i32, [25 x i32], [25 x float], i32, float }

@glnf_metric = external global %struct._LnfExpNode, align 4
@lminus_fluent = external dso_local global [1000 x i32], align 16
@.str.34 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [75 x i8], align 1

declare i32 @printf(ptr noundef, ...) #0

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @translate_subtractions() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %3

3:                                                ; preds = %10, %0
  %4 = load i32, ptr %1, align 4, !tbaa !5
  %5 = icmp slt i32 %4, 1000
  br i1 %5, label %6, label %13

6:                                                ; preds = %3
  %7 = load i32, ptr %1, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds [1000 x i32], ptr @lminus_fluent, i64 0, i64 %8
  store i32 -1, ptr %9, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %6
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %12 = add nsw i32 %11, 1
  store i32 %12, ptr %1, align 4, !tbaa !5
  br label %3, !llvm.loop !9

13:                                               ; preds = %3
  br label %14

14:                                               ; preds = %29, %27, %13
  br label %15

15:                                               ; preds = %14
  %16 = call zeroext i8 @ex_fl_in_nF_of_pre_cond_eff_goal(ptr noundef %2)
  %17 = icmp ne i8 %16, 0
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  br label %34

19:                                               ; preds = %15
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = icmp slt i32 %20, 0
  br i1 %21, label %22, label %29

22:                                               ; preds = %19
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = icmp ne i32 %23, -2
  br i1 %24, label %25, label %27

25:                                               ; preds = %22
  %26 = call i32 (ptr, ...) @printf(ptr noundef @.str.34)
  call void @exit(i32 noundef 1) #5
  unreachable

27:                                               ; preds = %22
  %28 = call i32 (ptr, ...) @printf(ptr noundef @.str.35)
  store i32 0, ptr getelementptr inbounds (%struct._LnfExpNode, ptr @glnf_metric, i32 0, i32 2), align 4, !tbaa !11
  store i32 0, ptr getelementptr inbounds (%struct._LnfExpNode, ptr @glnf_metric, i32 0, i32 5), align 4, !tbaa !14
  br label %14

29:                                               ; preds = %19
  %30 = load i32, ptr %2, align 4, !tbaa !5
  call void @introduce_minus_fluent(i32 noundef %30)
  %31 = load i32, ptr %2, align 4, !tbaa !5
  call void @replace_fl_in_nF_with_minus_fl(i32 noundef %31)
  %32 = load i32, ptr %2, align 4, !tbaa !5
  call void @set_minus_fl_initial(i32 noundef %32)
  %33 = load i32, ptr %2, align 4, !tbaa !5
  call void @introduce_minus_fl_effects(i32 noundef %33)
  br label %14

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @ex_fl_in_nF_of_pre_cond_eff_goal(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @introduce_minus_fluent(i32 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @replace_fl_in_nF_with_minus_fl(i32 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @set_minus_fl_initial(i32 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @introduce_minus_fl_effects(i32 noundef) #2

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 = { noreturn 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind }
attributes #5 = { noreturn 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 200}
!12 = !{!"_LnfExpNode", !7, i64 0, !7, i64 100, !6, i64 200, !7, i64 204, !7, i64 304, !6, i64 404, !13, i64 408}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !6, i64 404}


; 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._LnfExpNode = type { [25 x i32], [25 x float], i32, [25 x i32], [25 x float], i32, float }

@glnf_metric = external local_unnamed_addr global %struct._LnfExpNode, align 4
@lminus_fluent = external dso_local local_unnamed_addr global [1000 x i32], align 16
@.str.34 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [75 x i8], align 1

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @translate_subtractions() local_unnamed_addr #2 {
.preheader:
  %0 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %0) #5
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000) @lminus_fluent, i8 -1, i64 4000, i1 false), !tbaa !5
  %1 = call zeroext i8 @ex_fl_in_nF_of_pre_cond_eff_goal(ptr noundef nonnull %0)
  %.not6 = icmp eq i8 %1, 0
  br i1 %.not6, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %.backedge
  %2 = load i32, ptr %0, align 4, !tbaa !5
  %3 = icmp slt i32 %2, 0
  br i1 %3, label %4, label %10

4:                                                ; preds = %.lr.ph
  %.not4 = icmp eq i32 %2, -2
  br i1 %.not4, label %7, label %5

5:                                                ; preds = %4
  %6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.34)
  call void @exit(i32 noundef 1) #6
  unreachable

7:                                                ; preds = %4
  %8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.35)
  store i32 0, ptr getelementptr inbounds (i8, ptr @glnf_metric, i64 200), align 4, !tbaa !9
  store i32 0, ptr getelementptr inbounds (i8, ptr @glnf_metric, i64 404), align 4, !tbaa !12
  br label %.backedge

.backedge:                                        ; preds = %7, %10
  %9 = call zeroext i8 @ex_fl_in_nF_of_pre_cond_eff_goal(ptr noundef nonnull %0)
  %.not = icmp eq i8 %9, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

10:                                               ; preds = %.lr.ph
  call void @introduce_minus_fluent(i32 noundef %2)
  %11 = load i32, ptr %0, align 4, !tbaa !5
  call void @replace_fl_in_nF_with_minus_fl(i32 noundef %11)
  %12 = load i32, ptr %0, align 4, !tbaa !5
  call void @set_minus_fl_initial(i32 noundef %12)
  %13 = load i32, ptr %0, align 4, !tbaa !5
  call void @introduce_minus_fl_effects(i32 noundef %13)
  br label %.backedge

._crit_edge:                                      ; preds = %.backedge, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %0) #5
  ret void
}

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

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @ex_fl_in_nF_of_pre_cond_eff_goal(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @introduce_minus_fluent(i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @replace_fl_in_nF_with_minus_fl(i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @set_minus_fl_initial(i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @introduce_minus_fl_effects(i32 noundef) local_unnamed_addr #2

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

attributes #0 = { 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 #1 = { noreturn 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
attributes #6 = { noreturn 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 = !{!10, !6, i64 200}
!10 = !{!"_LnfExpNode", !7, i64 0, !7, i64 100, !6, i64 200, !7, i64 204, !7, i64 304, !6, i64 404, !11, i64 408}
!11 = !{!"float", !7, i64 0}
!12 = !{!10, !6, i64 404}


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