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

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

@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [28 x i8], align 1

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @print_PlNode(ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @print_plops(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  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 4, ptr %4) #3
  store i32 0, ptr %4, align 4, !tbaa !9
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  %6 = icmp ne ptr %5, null
  br i1 %6, label %9, label %7

7:                                                ; preds = %1
  %8 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  br label %9

9:                                                ; preds = %7, %1
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %10, ptr %3, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %46, %9
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %50

14:                                               ; preds = %11
  %15 = call i32 (ptr, ...) @printf(ptr noundef @.str.40)
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct._PlOperator, ptr %16, i32 0, i32 1
  %18 = load i8, ptr %17, align 8, !tbaa !11
  %19 = icmp ne i8 %18, 0
  br i1 %19, label %20, label %22

20:                                               ; preds = %14
  %21 = call i32 (ptr, ...) @printf(ptr noundef @.str.41)
  br label %22

22:                                               ; preds = %20, %14
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.42)
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._PlOperator, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !13
  %27 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, ptr noundef %26)
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._PlOperator, ptr %28, i32 0, i32 2
  %30 = load i32, ptr %29, align 4, !tbaa !14
  %31 = call i32 (ptr, ...) @printf(ptr noundef @.str.43, i32 noundef %30)
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct._PlOperator, ptr %32, i32 0, i32 4
  %34 = load ptr, ptr %33, align 8, !tbaa !15
  call void @print_FactList(ptr noundef %34, ptr noundef @.str.40, ptr noundef @.str.44)
  %35 = call i32 (ptr, ...) @printf(ptr noundef @.str.45)
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._PlOperator, ptr %36, i32 0, i32 5
  %38 = load ptr, ptr %37, align 8, !tbaa !16
  call void @print_PlNode(ptr noundef %38, i32 noundef 0)
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str.46)
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._PlOperator, ptr %40, i32 0, i32 6
  %42 = load ptr, ptr %41, align 8, !tbaa !17
  call void @print_PlNode(ptr noundef %42, i32 noundef 0)
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.47)
  %44 = load i32, ptr %4, align 4, !tbaa !9
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %4, align 4, !tbaa !9
  br label %46

46:                                               ; preds = %22
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct._PlOperator, ptr %47, i32 0, i32 7
  %49 = load ptr, ptr %48, align 8, !tbaa !18
  store ptr %49, ptr %3, align 8, !tbaa !5
  br label %11, !llvm.loop !19

50:                                               ; preds = %11
  %51 = load i32, ptr %4, align 4, !tbaa !9
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str.48, i32 noundef %51)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  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" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !7, i64 8}
!12 = !{!"_PlOperator", !6, i64 0, !7, i64 8, !10, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!13 = !{!12, !6, i64 0}
!14 = !{!12, !10, i64 12}
!15 = !{!12, !6, i64 24}
!16 = !{!12, !6, i64 32}
!17 = !{!12, !6, i64 40}
!18 = !{!12, !6, i64 48}
!19 = distinct !{!19, !20}
!20 = !{!"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"

@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [28 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @print_plops(ptr noundef readonly %0) local_unnamed_addr #0 {
  %cond = icmp eq ptr %0, null
  br i1 %cond, label %2, label %.lr.ph

2:                                                ; preds = %1
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  br label %._crit_edge

.lr.ph:                                           ; preds = %1, %9
  %.016 = phi i32 [ %25, %9 ], [ 0, %1 ]
  %.01115 = phi ptr [ %27, %9 ], [ %0, %1 ]
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.40)
  %5 = getelementptr inbounds i8, ptr %.01115, i64 8
  %6 = load i8, ptr %5, align 8, !tbaa !5
  %.not13 = icmp eq i8 %6, 0
  br i1 %.not13, label %9, label %7

7:                                                ; preds = %.lr.ph
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.41)
  br label %9

9:                                                ; preds = %7, %.lr.ph
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.42)
  %11 = load ptr, ptr %.01115, align 8, !tbaa !11
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef %11)
  %13 = getelementptr inbounds i8, ptr %.01115, i64 12
  %14 = load i32, ptr %13, align 4, !tbaa !12
  %15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.43, i32 noundef %14)
  %16 = getelementptr inbounds i8, ptr %.01115, i64 24
  %17 = load ptr, ptr %16, align 8, !tbaa !13
  tail call void @print_FactList(ptr noundef %17, ptr noundef nonnull @.str.40, ptr noundef nonnull @.str.44)
  %18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.45)
  %19 = getelementptr inbounds i8, ptr %.01115, i64 32
  %20 = load ptr, ptr %19, align 8, !tbaa !14
  tail call void @print_PlNode(ptr noundef %20, i32 noundef 0)
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.46)
  %22 = getelementptr inbounds i8, ptr %.01115, i64 40
  %23 = load ptr, ptr %22, align 8, !tbaa !15
  tail call void @print_PlNode(ptr noundef %23, i32 noundef 0)
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.47)
  %25 = add nuw nsw i32 %.016, 1
  %26 = getelementptr inbounds i8, ptr %.01115, i64 48
  %27 = load ptr, ptr %26, align 8, !tbaa !16
  %.not12 = icmp eq ptr %27, null
  br i1 %.not12, label %._crit_edge, label %.lr.ph, !llvm.loop !17

._crit_edge:                                      ; preds = %9, %2
  %.0.lcssa = phi i32 [ 0, %2 ], [ %25, %9 ]
  %28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.48, i32 noundef %.0.lcssa)
  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" }
attributes #1 = { 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" }

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


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