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

@lbfs_hash_entry = external dso_local global [65536 x ptr], 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 zeroext i8 @Astar_better_state_hashed(ptr noundef %0, float noundef %1) #1 {
  %3 = alloca i8, align 1
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store float %1, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct._BfsNode, ptr %11, i32 0, i32 0
  store ptr %12, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = call i32 @logical_state_sum(ptr noundef %13)
  store i32 %14, ptr %7, align 4, !tbaa !11
  %15 = load i32, ptr %7, align 4, !tbaa !11
  %16 = and i32 %15, 65535
  store i32 %16, ptr %8, align 4, !tbaa !11
  %17 = load i32, ptr %8, align 4, !tbaa !11
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [65536 x ptr], ptr @lbfs_hash_entry, i64 0, i64 %18
  %20 = load ptr, ptr %19, align 8, !tbaa !5
  store ptr %20, ptr %9, align 8, !tbaa !5
  %21 = load i32, ptr %8, align 4, !tbaa !11
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [65536 x ptr], ptr @lbfs_hash_entry, i64 0, i64 %22
  %24 = load ptr, ptr %23, align 8, !tbaa !5
  store ptr %24, ptr %9, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %54, %2
  %26 = load ptr, ptr %9, align 8, !tbaa !5
  %27 = icmp ne ptr %26, null
  br i1 %27, label %28, label %58

28:                                               ; preds = %25
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct._BfsHashEntry, ptr %29, i32 0, i32 0
  %31 = load i32, ptr %30, align 8, !tbaa !13
  %32 = load i32, ptr %7, align 4, !tbaa !11
  %33 = icmp ne i32 %31, %32
  br i1 %33, label %34, label %35

34:                                               ; preds = %28
  br label %54

35:                                               ; preds = %28
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._BfsHashEntry, ptr %36, i32 0, i32 1
  %38 = load ptr, ptr %37, align 8, !tbaa !15
  %39 = getelementptr inbounds %struct._BfsNode, ptr %38, i32 0, i32 0
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = call zeroext i8 @logical_same_state(ptr noundef %39, ptr noundef %40)
  %42 = icmp ne i8 %41, 0
  br i1 %42, label %43, label %53

43:                                               ; preds = %35
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct._BfsHashEntry, ptr %44, i32 0, i32 1
  %46 = load ptr, ptr %45, align 8, !tbaa !15
  %47 = getelementptr inbounds %struct._BfsNode, ptr %46, i32 0, i32 4
  %48 = load float, ptr %47, align 4, !tbaa !16
  %49 = load float, ptr %5, align 4, !tbaa !9
  %50 = fcmp olt float %48, %49
  br i1 %50, label %51, label %52

51:                                               ; preds = %43
  store i8 1, ptr %3, align 1
  store i32 1, ptr %10, align 4
  br label %59

52:                                               ; preds = %43
  br label %53

53:                                               ; preds = %52, %35
  br label %54

54:                                               ; preds = %53, %34
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct._BfsHashEntry, ptr %55, i32 0, i32 2
  %57 = load ptr, ptr %56, align 8, !tbaa !19
  store ptr %57, ptr %9, align 8, !tbaa !5
  br label %25, !llvm.loop !20

58:                                               ; preds = %25
  store i8 0, ptr %3, align 1
  store i32 1, ptr %10, align 4
  br label %59

59:                                               ; preds = %58, %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  %60 = load i8, ptr %3, align 1
  ret i8 %60
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @logical_state_sum(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @logical_same_state(ptr noundef, ptr noundef) #1

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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"_BfsHashEntry", !12, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!14, !6, i64 8}
!16 = !{!17, !10, i64 44}
!17 = !{!"_BfsNode", !18, i64 0, !12, i64 32, !12, i64 36, !12, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !6, i64 56, !12, i64 64, !6, i64 72, !6, i64 80, !6, i64 88}
!18 = !{!"_State", !6, i64 0, !12, i64 8, !6, i64 16, !6, i64 24}
!19 = !{!14, !6, i64 16}
!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_hash_entry = external dso_local local_unnamed_addr global [65536 x ptr], align 16

; Function Attrs: nounwind uwtable
define dso_local zeroext range(i8 0, 2) i8 @Astar_better_state_hashed(ptr noundef %0, float noundef %1) local_unnamed_addr #0 {
  %3 = tail call i32 @logical_state_sum(ptr noundef %0)
  %4 = and i32 %3, 65535
  %5 = zext nneg i32 %4 to i64
  %6 = getelementptr inbounds [65536 x ptr], ptr @lbfs_hash_entry, i64 0, i64 %5
  %.016 = load ptr, ptr %6, align 8, !tbaa !5
  %.not17 = icmp eq ptr %.016, null
  br i1 %.not17, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %17
  %.018 = phi ptr [ %.0, %17 ], [ %.016, %2 ]
  %7 = load i32, ptr %.018, align 8, !tbaa !9
  %.not14 = icmp eq i32 %7, %3
  br i1 %.not14, label %8, label %17

8:                                                ; preds = %.lr.ph
  %9 = getelementptr inbounds i8, ptr %.018, i64 8
  %10 = load ptr, ptr %9, align 8, !tbaa !12
  %11 = tail call zeroext i8 @logical_same_state(ptr noundef %10, ptr noundef %0)
  %.not15 = icmp eq i8 %11, 0
  br i1 %.not15, label %17, label %12

12:                                               ; preds = %8
  %13 = load ptr, ptr %9, align 8, !tbaa !12
  %14 = getelementptr inbounds i8, ptr %13, i64 44
  %15 = load float, ptr %14, align 4, !tbaa !13
  %16 = fcmp olt float %15, %1
  br i1 %16, label %._crit_edge, label %17

17:                                               ; preds = %8, %12, %.lr.ph
  %18 = getelementptr inbounds i8, ptr %.018, i64 16
  %.0 = load ptr, ptr %18, align 8, !tbaa !5
  %.not = icmp eq ptr %.0, null
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !17

._crit_edge:                                      ; preds = %12, %17, %2
  %.013 = phi i8 [ 0, %2 ], [ 0, %17 ], [ 1, %12 ]
  ret i8 %.013
}

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @logical_same_state(ptr noundef, ptr noundef) local_unnamed_addr #0

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

!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, !11, i64 0}
!10 = !{!"_BfsHashEntry", !11, i64 0, !6, i64 8, !6, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = !{!14, !16, i64 44}
!14 = !{!"_BfsNode", !15, i64 0, !11, i64 32, !11, i64 36, !11, i64 40, !16, i64 44, !16, i64 48, !16, i64 52, !6, i64 56, !11, i64 64, !6, i64 72, !6, i64 80, !6, i64 88}
!15 = !{!"_State", !6, i64 0, !11, i64 8, !6, i64 16, !6, i64 24}
!16 = !{!"float", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


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