; 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
@gw = external global float, align 4
@.str.16 = external hidden unnamed_addr constant [54 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: noreturn nounwind
declare void @exit(i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local ptr @Astar_epsilon_select_first() #3 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca i32, align 4
  %8 = alloca float, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %11 = load ptr, ptr @lbfs_space_head, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct._BfsNode, ptr %11, i32 0, i32 10
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds %struct._BfsNode, ptr %13, i32 0, i32 6
  %15 = load float, ptr %14, align 4, !tbaa !14
  store float %15, ptr %5, align 4, !tbaa !15
  %16 = load float, ptr @gw, align 4, !tbaa !15
  %17 = load float, ptr %5, align 4, !tbaa !15
  %18 = fmul float %16, %17
  store float %18, ptr %6, align 4, !tbaa !15
  store i32 -1, ptr %7, align 4, !tbaa !16
  store i32 -1, ptr %9, align 4, !tbaa !16
  store ptr null, ptr %2, align 8, !tbaa !5
  %19 = load ptr, ptr @lbfs_space_head, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct._BfsNode, ptr %19, i32 0, i32 10
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  store ptr %21, ptr %1, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %71, %0
  %23 = load ptr, ptr %1, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %75

25:                                               ; preds = %22
  %26 = load ptr, ptr %1, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct._BfsNode, ptr %26, i32 0, i32 6
  %28 = load float, ptr %27, align 4, !tbaa !14
  %29 = load float, ptr %6, align 4, !tbaa !15
  %30 = fcmp ogt float %28, %29
  br i1 %30, label %31, label %32

31:                                               ; preds = %25
  br label %75

32:                                               ; preds = %25
  %33 = load i32, ptr %7, align 4, !tbaa !16
  %34 = icmp eq i32 %33, -1
  br i1 %34, label %41, label %35

35:                                               ; preds = %32
  %36 = load ptr, ptr %1, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._BfsNode, ptr %36, i32 0, i32 3
  %38 = load i32, ptr %37, align 8, !tbaa !17
  %39 = load i32, ptr %7, align 4, !tbaa !16
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %41, label %49

41:                                               ; preds = %35, %32
  %42 = load ptr, ptr %1, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct._BfsNode, ptr %42, i32 0, i32 3
  %44 = load i32, ptr %43, align 8, !tbaa !17
  store i32 %44, ptr %7, align 4, !tbaa !16
  %45 = load ptr, ptr %1, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct._BfsNode, ptr %45, i32 0, i32 4
  %47 = load float, ptr %46, align 4, !tbaa !18
  store float %47, ptr %8, align 4, !tbaa !15
  %48 = load ptr, ptr %1, align 8, !tbaa !5
  store ptr %48, ptr %2, align 8, !tbaa !5
  br label %71

49:                                               ; preds = %35
  %50 = load ptr, ptr %1, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._BfsNode, ptr %50, i32 0, i32 3
  %52 = load i32, ptr %51, align 8, !tbaa !17
  %53 = load i32, ptr %7, align 4, !tbaa !16
  %54 = icmp eq i32 %52, %53
  br i1 %54, label %55, label %70

55:                                               ; preds = %49
  %56 = call i64 @random() #5
  %57 = srem i64 %56, 2
  %58 = trunc i64 %57 to i32
  store i32 %58, ptr %10, align 4, !tbaa !16
  %59 = load i32, ptr %10, align 4, !tbaa !16
  %60 = icmp eq i32 %59, 1
  br i1 %60, label %61, label %69

61:                                               ; preds = %55
  %62 = load ptr, ptr %1, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct._BfsNode, ptr %62, i32 0, i32 3
  %64 = load i32, ptr %63, align 8, !tbaa !17
  store i32 %64, ptr %7, align 4, !tbaa !16
  %65 = load ptr, ptr %1, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct._BfsNode, ptr %65, i32 0, i32 4
  %67 = load float, ptr %66, align 4, !tbaa !18
  store float %67, ptr %8, align 4, !tbaa !15
  %68 = load ptr, ptr %1, align 8, !tbaa !5
  store ptr %68, ptr %2, align 8, !tbaa !5
  br label %69

69:                                               ; preds = %61, %55
  br label %70

70:                                               ; preds = %69, %49
  br label %71

71:                                               ; preds = %70, %41
  %72 = load ptr, ptr %1, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct._BfsNode, ptr %72, i32 0, i32 10
  %74 = load ptr, ptr %73, align 8, !tbaa !9
  store ptr %74, ptr %1, align 8, !tbaa !5
  br label %22, !llvm.loop !19

75:                                               ; preds = %31, %22
  %76 = load i32, ptr %7, align 4, !tbaa !16
  %77 = icmp eq i32 %76, -1
  br i1 %77, label %78, label %80

78:                                               ; preds = %75
  %79 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  call void @exit(i32 noundef 1) #6
  unreachable

80:                                               ; preds = %75
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct._BfsNode, ptr %81, i32 0, i32 11
  %83 = load ptr, ptr %82, align 8, !tbaa !21
  store ptr %83, ptr %3, align 8, !tbaa !5
  %84 = load ptr, ptr %2, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct._BfsNode, ptr %84, i32 0, i32 10
  %86 = load ptr, ptr %85, align 8, !tbaa !9
  store ptr %86, ptr %4, align 8, !tbaa !5
  %87 = load ptr, ptr %2, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct._BfsNode, ptr %87, i32 0, i32 10
  %89 = load ptr, ptr %88, align 8, !tbaa !9
  %90 = load ptr, ptr %3, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct._BfsNode, ptr %90, i32 0, i32 10
  store ptr %89, ptr %91, align 8, !tbaa !9
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = icmp ne ptr %92, null
  br i1 %93, label %94, label %98

94:                                               ; preds = %80
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct._BfsNode, ptr %96, i32 0, i32 11
  store ptr %95, ptr %97, align 8, !tbaa !21
  br label %98

98:                                               ; preds = %94, %80
  %99 = load ptr, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  ret ptr %99
}

; Function Attrs: nounwind
declare i64 @random() #4

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 = { 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 #3 = { 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 #4 = { 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 #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 = !{!"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, !13, i64 52}
!15 = !{!13, !13, i64 0}
!16 = !{!12, !12, i64 0}
!17 = !{!10, !12, i64 40}
!18 = !{!10, !13, i64 44}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!10, !6, i64 88}


; 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
@gw = external local_unnamed_addr global float, align 4
@.str.16 = external hidden unnamed_addr constant [54 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 ptr @Astar_epsilon_select_first() local_unnamed_addr #2 {
.lr.ph.preheader:
  %0 = load ptr, ptr @lbfs_space_head, align 8, !tbaa !5
  %1 = getelementptr inbounds i8, ptr %0, i64 80
  %2 = load ptr, ptr %1, align 8, !tbaa !9
  %3 = getelementptr inbounds i8, ptr %2, i64 52
  %4 = load float, ptr %3, align 4, !tbaa !14
  %5 = load float, ptr @gw, align 4, !tbaa !15
  %6 = fmul float %4, %5
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %._crit_edge39
  %.034 = phi ptr [ %22, %._crit_edge39 ], [ %2, %.lr.ph.preheader ]
  %.02533 = phi ptr [ %.1, %._crit_edge39 ], [ null, %.lr.ph.preheader ]
  %.02632 = phi i32 [ %.127, %._crit_edge39 ], [ -1, %.lr.ph.preheader ]
  %7 = getelementptr inbounds i8, ptr %.034, i64 52
  %8 = load float, ptr %7, align 4, !tbaa !14
  %9 = fcmp ogt float %8, %6
  br i1 %9, label %._crit_edge, label %10

10:                                               ; preds = %.lr.ph
  %11 = icmp eq i32 %.02632, -1
  %.phi.trans.insert = getelementptr inbounds i8, ptr %.034, i64 40
  %.pre = load i32, ptr %.phi.trans.insert, align 8, !tbaa !16
  %12 = icmp slt i32 %.pre, %.02632
  %or.cond = select i1 %11, i1 true, i1 %12
  br i1 %or.cond, label %._crit_edge39, label %13

13:                                               ; preds = %10
  %14 = icmp eq i32 %.pre, %.02632
  br i1 %14, label %15, label %._crit_edge39

15:                                               ; preds = %13
  %16 = tail call i64 @random() #4
  %17 = and i64 %16, -9223372036854775807
  %18 = icmp eq i64 %17, 1
  br i1 %18, label %19, label %._crit_edge39

19:                                               ; preds = %15
  %20 = load i32, ptr %.phi.trans.insert, align 8, !tbaa !16
  br label %._crit_edge39

._crit_edge39:                                    ; preds = %10, %13, %19, %15
  %.127 = phi i32 [ %20, %19 ], [ %.02632, %15 ], [ %.02632, %13 ], [ %.pre, %10 ]
  %.1 = phi ptr [ %.034, %19 ], [ %.02533, %15 ], [ %.02533, %13 ], [ %.034, %10 ]
  %21 = getelementptr inbounds i8, ptr %.034, i64 80
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  %.not = icmp eq ptr %22, null
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !17

._crit_edge:                                      ; preds = %._crit_edge39, %.lr.ph
  %.026.lcssa.ph = phi i32 [ %.127, %._crit_edge39 ], [ %.02632, %.lr.ph ]
  %.025.lcssa.ph = phi ptr [ %.1, %._crit_edge39 ], [ %.02533, %.lr.ph ]
  %23 = icmp eq i32 %.026.lcssa.ph, -1
  br i1 %23, label %24, label %26

24:                                               ; preds = %._crit_edge
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  tail call void @exit(i32 noundef 1) #5
  unreachable

26:                                               ; preds = %._crit_edge
  %27 = getelementptr inbounds i8, ptr %.025.lcssa.ph, i64 88
  %28 = load ptr, ptr %27, align 8, !tbaa !19
  %29 = getelementptr inbounds i8, ptr %.025.lcssa.ph, i64 80
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = getelementptr inbounds i8, ptr %28, i64 80
  store ptr %30, ptr %31, align 8, !tbaa !9
  %.not30 = icmp eq ptr %30, null
  br i1 %.not30, label %34, label %32

32:                                               ; preds = %26
  %33 = getelementptr inbounds i8, ptr %30, i64 88
  store ptr %28, ptr %33, align 8, !tbaa !19
  br label %34

34:                                               ; preds = %32, %26
  ret ptr %.025.lcssa.ph
}

; Function Attrs: nounwind
declare i64 @random() local_unnamed_addr #3

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 = { 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 #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 = !{!"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, !13, i64 52}
!15 = !{!13, !13, i64 0}
!16 = !{!10, !12, i64 40}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!10, !6, i64 88}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass