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

@lehc_hash_entry = external dso_local global [8192 x ptr], align 16
@lnum_ehc_hash_entry = external dso_local global [8192 x i32], align 16
@lchanged_ehc_entry = external dso_local global [8192 x i8], align 16
@lnum_changed_ehc_entrys = external dso_local global i32, align 4
@lchanged_ehc_entrys = external dso_local global [8192 x i32], 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 void @hash_ehc_node(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store ptr null, ptr %7, align 8, !tbaa !5
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct._EhcNode, ptr %9, i32 0, i32 0
  %11 = call i32 @state_sum(ptr noundef %10)
  store i32 %11, ptr %4, align 4, !tbaa !9
  %12 = load i32, ptr %4, align 4, !tbaa !9
  %13 = and i32 %12, 8191
  store i32 %13, ptr %5, align 4, !tbaa !9
  %14 = load i32, ptr %5, align 4, !tbaa !9
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [8192 x ptr], ptr @lehc_hash_entry, i64 0, i64 %15
  %17 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %17, ptr %6, align 8, !tbaa !5
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %52, label %20

20:                                               ; preds = %1
  %21 = call ptr @new_EhcHashEntry()
  store ptr %21, ptr %6, align 8, !tbaa !5
  %22 = load i32, ptr %4, align 4, !tbaa !9
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct._EhcHashEntry, ptr %23, i32 0, i32 0
  store i32 %22, ptr %24, align 8, !tbaa !11
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct._EhcHashEntry, ptr %26, i32 0, i32 1
  store ptr %25, ptr %27, align 8, !tbaa !13
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = load i32, ptr %5, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [8192 x ptr], ptr @lehc_hash_entry, i64 0, i64 %30
  store ptr %28, ptr %31, align 8, !tbaa !5
  %32 = load i32, ptr %5, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [8192 x i32], ptr @lnum_ehc_hash_entry, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %34, align 4, !tbaa !9
  %37 = load i32, ptr %5, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [8192 x i8], ptr @lchanged_ehc_entry, i64 0, i64 %38
  %40 = load i8, ptr %39, align 1, !tbaa !14
  %41 = icmp ne i8 %40, 0
  br i1 %41, label %51, label %42

42:                                               ; preds = %20
  %43 = load i32, ptr %5, align 4, !tbaa !9
  %44 = load i32, ptr @lnum_changed_ehc_entrys, align 4, !tbaa !9
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr @lnum_changed_ehc_entrys, align 4, !tbaa !9
  %46 = sext i32 %44 to i64
  %47 = getelementptr inbounds [8192 x i32], ptr @lchanged_ehc_entrys, i64 0, i64 %46
  store i32 %43, ptr %47, align 4, !tbaa !9
  %48 = load i32, ptr %5, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [8192 x i8], ptr @lchanged_ehc_entry, i64 0, i64 %49
  store i8 1, ptr %50, align 1, !tbaa !14
  br label %51

51:                                               ; preds = %42, %20
  store i32 1, ptr %8, align 4
  br label %132

52:                                               ; preds = %1
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %53

53:                                               ; preds = %64, %52
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = icmp ne ptr %54, null
  br i1 %55, label %56, label %71

56:                                               ; preds = %53
  %57 = load i32, ptr %3, align 4, !tbaa !9
  %58 = load i32, ptr %5, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [8192 x i32], ptr @lnum_ehc_hash_entry, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !9
  %62 = icmp eq i32 %57, %61
  br i1 %62, label %63, label %64

63:                                               ; preds = %56
  br label %71

64:                                               ; preds = %56
  %65 = load i32, ptr %3, align 4, !tbaa !9
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %3, align 4, !tbaa !9
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %67, ptr %7, align 8, !tbaa !5
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._EhcHashEntry, ptr %68, i32 0, i32 2
  %70 = load ptr, ptr %69, align 8, !tbaa !15
  store ptr %70, ptr %6, align 8, !tbaa !5
  br label %53, !llvm.loop !16

71:                                               ; preds = %63, %53
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = icmp ne ptr %72, null
  br i1 %73, label %74, label %101

74:                                               ; preds = %71
  %75 = load i32, ptr %4, align 4, !tbaa !9
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct._EhcHashEntry, ptr %76, i32 0, i32 0
  store i32 %75, ptr %77, align 8, !tbaa !11
  %78 = load ptr, ptr %2, align 8, !tbaa !5
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct._EhcHashEntry, ptr %79, i32 0, i32 1
  store ptr %78, ptr %80, align 8, !tbaa !13
  %81 = load i32, ptr %5, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [8192 x i32], ptr @lnum_ehc_hash_entry, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !9
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %83, align 4, !tbaa !9
  %86 = load i32, ptr %5, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [8192 x i8], ptr @lchanged_ehc_entry, i64 0, i64 %87
  %89 = load i8, ptr %88, align 1, !tbaa !14
  %90 = icmp ne i8 %89, 0
  br i1 %90, label %100, label %91

91:                                               ; preds = %74
  %92 = load i32, ptr %5, align 4, !tbaa !9
  %93 = load i32, ptr @lnum_changed_ehc_entrys, align 4, !tbaa !9
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr @lnum_changed_ehc_entrys, align 4, !tbaa !9
  %95 = sext i32 %93 to i64
  %96 = getelementptr inbounds [8192 x i32], ptr @lchanged_ehc_entrys, i64 0, i64 %95
  store i32 %92, ptr %96, align 4, !tbaa !9
  %97 = load i32, ptr %5, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [8192 x i8], ptr @lchanged_ehc_entry, i64 0, i64 %98
  store i8 1, ptr %99, align 1, !tbaa !14
  br label %100

100:                                              ; preds = %91, %74
  store i32 1, ptr %8, align 4
  br label %132

101:                                              ; preds = %71
  %102 = call ptr @new_EhcHashEntry()
  store ptr %102, ptr %6, align 8, !tbaa !5
  %103 = load i32, ptr %4, align 4, !tbaa !9
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct._EhcHashEntry, ptr %104, i32 0, i32 0
  store i32 %103, ptr %105, align 8, !tbaa !11
  %106 = load ptr, ptr %2, align 8, !tbaa !5
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct._EhcHashEntry, ptr %107, i32 0, i32 1
  store ptr %106, ptr %108, align 8, !tbaa !13
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = load ptr, ptr %7, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct._EhcHashEntry, ptr %110, i32 0, i32 2
  store ptr %109, ptr %111, align 8, !tbaa !15
  %112 = load i32, ptr %5, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [8192 x i32], ptr @lnum_ehc_hash_entry, i64 0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !9
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %114, align 4, !tbaa !9
  %117 = load i32, ptr %5, align 4, !tbaa !9
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [8192 x i8], ptr @lchanged_ehc_entry, i64 0, i64 %118
  %120 = load i8, ptr %119, align 1, !tbaa !14
  %121 = icmp ne i8 %120, 0
  br i1 %121, label %131, label %122

122:                                              ; preds = %101
  %123 = load i32, ptr %5, align 4, !tbaa !9
  %124 = load i32, ptr @lnum_changed_ehc_entrys, align 4, !tbaa !9
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr @lnum_changed_ehc_entrys, align 4, !tbaa !9
  %126 = sext i32 %124 to i64
  %127 = getelementptr inbounds [8192 x i32], ptr @lchanged_ehc_entrys, i64 0, i64 %126
  store i32 %123, ptr %127, align 4, !tbaa !9
  %128 = load i32, ptr %5, align 4, !tbaa !9
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [8192 x i8], ptr @lchanged_ehc_entry, i64 0, i64 %129
  store i8 1, ptr %130, align 1, !tbaa !14
  br label %131

131:                                              ; preds = %122, %101
  store i32 1, ptr %8, align 4
  br label %132

132:                                              ; preds = %131, %100, %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

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

declare ptr @new_EhcHashEntry() #2

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 = { "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, !10, i64 0}
!12 = !{!"_EhcHashEntry", !10, i64 0, !6, i64 8, !6, i64 16}
!13 = !{!12, !6, i64 8}
!14 = !{!7, !7, i64 0}
!15 = !{!12, !6, i64 16}
!16 = distinct !{!16, !17}
!17 = !{!"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"

@lehc_hash_entry = external dso_local local_unnamed_addr global [8192 x ptr], align 16
@lnum_ehc_hash_entry = external dso_local local_unnamed_addr global [8192 x i32], align 16
@lchanged_ehc_entry = external dso_local local_unnamed_addr global [8192 x i8], align 16
@lnum_changed_ehc_entrys = external dso_local local_unnamed_addr global i32, align 4
@lchanged_ehc_entrys = external dso_local local_unnamed_addr global [8192 x i32], align 16

; Function Attrs: nounwind uwtable
define dso_local void @hash_ehc_node(ptr noundef %0) local_unnamed_addr #0 {
  %2 = tail call i32 @state_sum(ptr noundef %0)
  %3 = and i32 %2, 8191
  %4 = zext nneg i32 %3 to i64
  %5 = getelementptr inbounds [8192 x ptr], ptr @lehc_hash_entry, i64 0, i64 %4
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %9, label %.preheader

.preheader:                                       ; preds = %1
  %7 = getelementptr inbounds [8192 x i32], ptr @lnum_ehc_hash_entry, i64 0, i64 %4
  %8 = load i32, ptr %7, align 4, !tbaa !9
  br label %17

9:                                                ; preds = %1
  %10 = tail call ptr @new_EhcHashEntry() #2
  store i32 %2, ptr %10, align 8, !tbaa !11
  %11 = getelementptr inbounds i8, ptr %10, i64 8
  store ptr %0, ptr %11, align 8, !tbaa !13
  store ptr %10, ptr %5, align 8, !tbaa !5
  %12 = getelementptr inbounds [8192 x i32], ptr @lnum_ehc_hash_entry, i64 0, i64 %4
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %14 = add nsw i32 %13, 1
  store i32 %14, ptr %12, align 4, !tbaa !9
  %15 = getelementptr inbounds [8192 x i8], ptr @lchanged_ehc_entry, i64 0, i64 %4
  %16 = load i8, ptr %15, align 1, !tbaa !14
  %.not41 = icmp eq i8 %16, 0
  br i1 %.not41, label %.sink.split, label %40

17:                                               ; preds = %.preheader, %19
  %.03848 = phi ptr [ %6, %.preheader ], [ %22, %19 ]
  %.03947 = phi i32 [ 0, %.preheader ], [ %20, %19 ]
  %18 = icmp eq i32 %.03947, %8
  br i1 %18, label %23, label %19

19:                                               ; preds = %17
  %20 = add nuw nsw i32 %.03947, 1
  %21 = getelementptr inbounds i8, ptr %.03848, i64 16
  %22 = load ptr, ptr %21, align 8, !tbaa !15
  %.not42 = icmp eq ptr %22, null
  br i1 %.not42, label %.critedge, label %17, !llvm.loop !16

23:                                               ; preds = %17
  store i32 %2, ptr %.03848, align 8, !tbaa !11
  %24 = getelementptr inbounds i8, ptr %.03848, i64 8
  store ptr %0, ptr %24, align 8, !tbaa !13
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %7, align 4, !tbaa !9
  %27 = getelementptr inbounds [8192 x i8], ptr @lchanged_ehc_entry, i64 0, i64 %4
  %28 = load i8, ptr %27, align 1, !tbaa !14
  %.not44 = icmp eq i8 %28, 0
  br i1 %.not44, label %.sink.split, label %40

.critedge:                                        ; preds = %19
  %29 = getelementptr inbounds i8, ptr %.03848, i64 16
  %30 = tail call ptr @new_EhcHashEntry() #2
  store i32 %2, ptr %30, align 8, !tbaa !11
  %31 = getelementptr inbounds i8, ptr %30, i64 8
  store ptr %0, ptr %31, align 8, !tbaa !13
  store ptr %30, ptr %29, align 8, !tbaa !15
  %32 = load i32, ptr %7, align 4, !tbaa !9
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %7, align 4, !tbaa !9
  %34 = getelementptr inbounds [8192 x i8], ptr @lchanged_ehc_entry, i64 0, i64 %4
  %35 = load i8, ptr %34, align 1, !tbaa !14
  %.not43 = icmp eq i8 %35, 0
  br i1 %.not43, label %.sink.split, label %40

.sink.split:                                      ; preds = %.critedge, %23, %9
  %.sink = phi ptr [ %15, %9 ], [ %27, %23 ], [ %34, %.critedge ]
  %36 = load i32, ptr @lnum_changed_ehc_entrys, align 4, !tbaa !9
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr @lnum_changed_ehc_entrys, align 4, !tbaa !9
  %38 = sext i32 %36 to i64
  %39 = getelementptr inbounds [8192 x i32], ptr @lchanged_ehc_entrys, i64 0, i64 %38
  store i32 %3, ptr %39, align 4, !tbaa !9
  store i8 1, ptr %.sink, align 1, !tbaa !14
  br label %40

40:                                               ; preds = %.sink.split, %.critedge, %23, %9
  ret void
}

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

declare ptr @new_EhcHashEntry() local_unnamed_addr #1

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 = { "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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_EhcHashEntry", !10, i64 0, !6, i64 8, !6, i64 16}
!13 = !{!12, !6, i64 8}
!14 = !{!7, !7, i64 0}
!15 = !{!12, !6, i64 16}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


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