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

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

@lbfs_space_head = external dso_local global ptr, align 8
@.str.25 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [61 x i8], align 1

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

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

; 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 @print_state_trace(ptr noundef) #2

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

6:                                                ; preds = %33, %0
  %7 = load ptr, ptr %1, align 8, !tbaa !9
  %8 = icmp ne ptr %7, null
  br i1 %8, label %9, label %37

9:                                                ; preds = %6
  %10 = call i32 (ptr, ...) @printf(ptr noundef @.str.25)
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = add nsw i32 %11, 1
  store i32 %12, ptr %2, align 4, !tbaa !5
  %13 = load ptr, ptr %1, align 8, !tbaa !9
  %14 = getelementptr inbounds %struct._BfsNode, ptr %13, i32 0, i32 2
  %15 = load i32, ptr %14, align 4, !tbaa !15
  %16 = load ptr, ptr %1, align 8, !tbaa !9
  %17 = getelementptr inbounds %struct._BfsNode, ptr %16, i32 0, i32 3
  %18 = load i32, ptr %17, align 8, !tbaa !16
  %19 = load ptr, ptr %1, align 8, !tbaa !9
  %20 = getelementptr inbounds %struct._BfsNode, ptr %19, i32 0, i32 4
  %21 = load float, ptr %20, align 4, !tbaa !17
  %22 = fpext float %21 to double
  %23 = load ptr, ptr %1, align 8, !tbaa !9
  %24 = getelementptr inbounds %struct._BfsNode, ptr %23, i32 0, i32 5
  %25 = load float, ptr %24, align 8, !tbaa !18
  %26 = fpext float %25 to double
  %27 = load ptr, ptr %1, align 8, !tbaa !9
  %28 = getelementptr inbounds %struct._BfsNode, ptr %27, i32 0, i32 6
  %29 = load float, ptr %28, align 4, !tbaa !19
  %30 = fpext float %29 to double
  %31 = call i32 (ptr, ...) @printf(ptr noundef @.str.26, i32 noundef %11, i32 noundef %15, i32 noundef %18, double noundef %22, double noundef %26, double noundef %30)
  %32 = load ptr, ptr %1, align 8, !tbaa !9
  call void @print_state_trace(ptr noundef %32)
  br label %33

33:                                               ; preds = %9
  %34 = load ptr, ptr %1, align 8, !tbaa !9
  %35 = getelementptr inbounds %struct._BfsNode, ptr %34, i32 0, i32 10
  %36 = load ptr, ptr %35, align 8, !tbaa !11
  store ptr %36, ptr %1, align 8, !tbaa !9
  br label %6, !llvm.loop !20

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 80}
!12 = !{!"_BfsNode", !13, i64 0, !6, i64 32, !6, i64 36, !6, i64 40, !14, i64 44, !14, i64 48, !14, i64 52, !10, i64 56, !6, i64 64, !10, i64 72, !10, i64 80, !10, i64 88}
!13 = !{!"_State", !10, i64 0, !6, i64 8, !10, i64 16, !10, i64 24}
!14 = !{!"float", !7, i64 0}
!15 = !{!12, !6, i64 36}
!16 = !{!12, !6, i64 40}
!17 = !{!12, !14, i64 44}
!18 = !{!12, !14, i64 48}
!19 = !{!12, !14, i64 52}
!20 = distinct !{!20, !21}
!21 = !{!"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"

@lbfs_space_head = external dso_local local_unnamed_addr global ptr, align 8
@.str.25 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [61 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local void @print_open_list() local_unnamed_addr #1 {
  %1 = load ptr, ptr @lbfs_space_head, align 8, !tbaa !5
  %.08.in9 = getelementptr inbounds i8, ptr %1, i64 80
  %.0810 = load ptr, ptr %.08.in9, align 8, !tbaa !9
  %.not11 = icmp eq ptr %.0810, null
  br i1 %.not11, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.0813 = phi ptr [ %.08, %.lr.ph ], [ %.0810, %0 ]
  %.012 = phi i32 [ %3, %.lr.ph ], [ 0, %0 ]
  %2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.25)
  %3 = add nuw nsw i32 %.012, 1
  %4 = getelementptr inbounds i8, ptr %.0813, i64 36
  %5 = load i32, ptr %4, align 4, !tbaa !14
  %6 = getelementptr inbounds i8, ptr %.0813, i64 40
  %7 = load i32, ptr %6, align 8, !tbaa !15
  %8 = getelementptr inbounds i8, ptr %.0813, i64 44
  %9 = load float, ptr %8, align 4, !tbaa !16
  %10 = fpext float %9 to double
  %11 = getelementptr inbounds i8, ptr %.0813, i64 48
  %12 = load float, ptr %11, align 8, !tbaa !17
  %13 = fpext float %12 to double
  %14 = getelementptr inbounds i8, ptr %.0813, i64 52
  %15 = load float, ptr %14, align 4, !tbaa !18
  %16 = fpext float %15 to double
  %17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.26, i32 noundef %.012, i32 noundef %5, i32 noundef %7, double noundef %10, double noundef %13, double noundef %16)
  tail call void @print_state_trace(ptr noundef nonnull %.0813)
  %.08.in = getelementptr inbounds i8, ptr %.0813, i64 80
  %.08 = load ptr, ptr %.08.in, align 8, !tbaa !9
  %.not = icmp eq ptr %.08, null
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !19

._crit_edge:                                      ; preds = %.lr.ph, %0
  ret void
}

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 = { 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 80}
!10 = !{!"_BfsNode", !11, i64 0, !12, i64 32, !12, i64 36, !12, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !6, i64 56, !12, i64 64, !6, i64 72, !6, i64 80, !6, i64 88}
!11 = !{!"_State", !6, i64 0, !12, i64 8, !6, i64 16, !6, i64 24}
!12 = !{!"int", !7, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{!10, !12, i64 36}
!15 = !{!10, !12, i64 40}
!16 = !{!10, !13, i64 44}
!17 = !{!10, !13, i64 48}
!18 = !{!10, !13, i64 52}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


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