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

@gop_conn = external global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [42 x i8], align 1
@goptimization_established = external global i8, align 1
@.str.27 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [10 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

declare void @print_op_name(i32 noundef) #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @print_state_trace(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca [500 x i32], align 16
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca float, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 2000, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = icmp eq ptr %9, null
  br i1 %10, label %11, label %13

11:                                               ; preds = %1
  %12 = call i32 (ptr, ...) @printf(ptr noundef @.str.27)
  store i32 1, ptr %8, align 4
  br label %75

13:                                               ; preds = %1
  store i32 0, ptr %5, align 4, !tbaa !9
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %14, ptr %3, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %33, %13
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct._BfsNode, ptr %16, i32 0, i32 1
  %18 = load i32, ptr %17, align 8, !tbaa !11
  %19 = icmp ne i32 %18, -1
  br i1 %19, label %20, label %37

20:                                               ; preds = %15
  %21 = load i32, ptr %5, align 4, !tbaa !9
  %22 = icmp eq i32 %21, 500
  br i1 %22, label %23, label %25

23:                                               ; preds = %20
  %24 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef 500)
  call void @exit(i32 noundef 1) #5
  unreachable

25:                                               ; preds = %20
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct._BfsNode, ptr %26, i32 0, i32 1
  %28 = load i32, ptr %27, align 8, !tbaa !11
  %29 = load i32, ptr %5, align 4, !tbaa !9
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %5, align 4, !tbaa !9
  %31 = sext i32 %29 to i64
  %32 = getelementptr inbounds [500 x i32], ptr %4, i64 0, i64 %31
  store i32 %28, ptr %32, align 4, !tbaa !9
  br label %33

33:                                               ; preds = %25
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct._BfsNode, ptr %34, i32 0, i32 9
  %36 = load ptr, ptr %35, align 8, !tbaa !15
  store ptr %36, ptr %3, align 8, !tbaa !5
  br label %15, !llvm.loop !16

37:                                               ; preds = %15
  store float 0.000000e+00, ptr %7, align 4, !tbaa !18
  %38 = load i32, ptr %5, align 4, !tbaa !9
  %39 = sub nsw i32 %38, 1
  store i32 %39, ptr %6, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %64, %37
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = icmp sgt i32 %41, -1
  br i1 %42, label %43, label %67

43:                                               ; preds = %40
  %44 = call i32 (ptr, ...) @printf(ptr noundef @.str.28)
  %45 = load i32, ptr %6, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [500 x i32], ptr %4, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !9
  call void @print_op_name(i32 noundef %48)
  %49 = load i8, ptr @goptimization_established, align 1, !tbaa !19
  %50 = icmp ne i8 %49, 0
  br i1 %50, label %51, label %63

51:                                               ; preds = %43
  %52 = load ptr, ptr @gop_conn, align 8, !tbaa !5
  %53 = load i32, ptr %6, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [500 x i32], ptr %4, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds %struct._OpConn, ptr %52, i64 %57
  %59 = getelementptr inbounds %struct._OpConn, ptr %58, i32 0, i32 8
  %60 = load float, ptr %59, align 8, !tbaa !20
  %61 = load float, ptr %7, align 4, !tbaa !18
  %62 = fadd float %61, %60
  store float %62, ptr %7, align 4, !tbaa !18
  br label %63

63:                                               ; preds = %51, %43
  br label %64

64:                                               ; preds = %63
  %65 = load i32, ptr %6, align 4, !tbaa !9
  %66 = add nsw i32 %65, -1
  store i32 %66, ptr %6, align 4, !tbaa !9
  br label %40, !llvm.loop !22

67:                                               ; preds = %40
  %68 = load i8, ptr @goptimization_established, align 1, !tbaa !19
  %69 = icmp ne i8 %68, 0
  br i1 %69, label %70, label %74

70:                                               ; preds = %67
  %71 = load float, ptr %7, align 4, !tbaa !18
  %72 = fpext float %71 to double
  %73 = call i32 (ptr, ...) @printf(ptr noundef @.str.29, double noundef %72)
  br label %74

74:                                               ; preds = %70, %67
  store i32 0, ptr %8, align 4
  br label %75

75:                                               ; preds = %74, %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 2000, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  %76 = load i32, ptr %8, align 4
  switch i32 %76, label %78 [
    i32 0, label %77
    i32 1, label %77
  ]

77:                                               ; preds = %75, %75
  ret void

78:                                               ; preds = %75
  unreachable
}

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


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

%struct._OpConn = type { ptr, i8, ptr, i32, i8, i8, i32, i8, float }

@gop_conn = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [42 x i8], align 1
@goptimization_established = external local_unnamed_addr global i8, align 1
@.str.27 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [10 x i8], align 1

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

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

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

declare void @print_op_name(i32 noundef) local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @print_state_trace(ptr noundef readonly %0) local_unnamed_addr #4 {
  %2 = alloca [500 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %2) #5
  %3 = icmp eq ptr %0, null
  br i1 %3, label %6, label %.preheader20

.preheader20:                                     ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 32
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %.not22 = icmp eq i32 %5, -1
  br i1 %.not22, label %.preheader.._crit_edge_crit_edge, label %.lr.ph

6:                                                ; preds = %1
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.27)
  br label %45

.preheader.._crit_edge_crit_edge:                 ; preds = %.preheader20
  %.pre = load i8, ptr @goptimization_established, align 1, !tbaa !13
  br label %._crit_edge

.lr.ph28.preheader:                               ; preds = %23, %.lr.ph.1, %.lr.ph
  %indvars.iv.next.lcssa = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.next.1, %.lr.ph.1 ], [ %indvars.iv.next.2, %23 ]
  %8 = and i64 %indvars.iv.next.lcssa, 4294967295
  br label %.lr.ph28

.lr.ph:                                           ; preds = %.preheader20, %23
  %indvars.iv = phi i64 [ %indvars.iv.next.2, %23 ], [ 0, %.preheader20 ]
  %9 = phi i32 [ %28, %23 ], [ %5, %.preheader20 ]
  %.01523 = phi ptr [ %26, %23 ], [ %0, %.preheader20 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %10 = getelementptr inbounds [500 x i32], ptr %2, i64 0, i64 %indvars.iv
  store i32 %9, ptr %10, align 4, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %.01523, i64 72
  %12 = load ptr, ptr %11, align 8, !tbaa !15
  %13 = getelementptr inbounds i8, ptr %12, i64 32
  %14 = load i32, ptr %13, align 8, !tbaa !5
  %.not = icmp eq i32 %14, -1
  br i1 %.not, label %.lr.ph28.preheader, label %.lr.ph.1, !llvm.loop !16

15:                                               ; preds = %.lr.ph.2
  %16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 500)
  tail call void @exit(i32 noundef 1) #6
  unreachable

.lr.ph.1:                                         ; preds = %.lr.ph
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %17 = getelementptr inbounds [500 x i32], ptr %2, i64 0, i64 %indvars.iv.next
  store i32 %14, ptr %17, align 4, !tbaa !14
  %18 = getelementptr inbounds i8, ptr %12, i64 72
  %19 = load ptr, ptr %18, align 8, !tbaa !15
  %20 = getelementptr inbounds i8, ptr %19, i64 32
  %21 = load i32, ptr %20, align 8, !tbaa !5
  %.not.1 = icmp eq i32 %21, -1
  br i1 %.not.1, label %.lr.ph28.preheader, label %.lr.ph.2, !llvm.loop !16

.lr.ph.2:                                         ; preds = %.lr.ph.1
  %22 = icmp eq i64 %indvars.iv.next.1, 500
  br i1 %22, label %15, label %23

23:                                               ; preds = %.lr.ph.2
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %24 = getelementptr inbounds [500 x i32], ptr %2, i64 0, i64 %indvars.iv.next.1
  store i32 %21, ptr %24, align 4, !tbaa !14
  %25 = getelementptr inbounds i8, ptr %19, i64 72
  %26 = load ptr, ptr %25, align 8, !tbaa !15
  %27 = getelementptr inbounds i8, ptr %26, i64 32
  %28 = load i32, ptr %27, align 8, !tbaa !5
  %.not.2 = icmp eq i32 %28, -1
  br i1 %.not.2, label %.lr.ph28.preheader, label %.lr.ph, !llvm.loop !16

.lr.ph28:                                         ; preds = %.lr.ph28.preheader, %39
  %indvars.iv31 = phi i64 [ %8, %.lr.ph28.preheader ], [ %indvars.iv.next32, %39 ]
  %.026 = phi float [ 0.000000e+00, %.lr.ph28.preheader ], [ %.1, %39 ]
  %indvars.iv.next32 = add nsw i64 %indvars.iv31, -1
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.28)
  %30 = getelementptr inbounds [500 x i32], ptr %2, i64 0, i64 %indvars.iv.next32
  %31 = load i32, ptr %30, align 4, !tbaa !14
  tail call void @print_op_name(i32 noundef %31) #5
  %32 = load i8, ptr @goptimization_established, align 1, !tbaa !13
  %.not19 = icmp eq i8 %32, 0
  br i1 %.not19, label %39, label %33

33:                                               ; preds = %.lr.ph28
  %34 = load ptr, ptr @gop_conn, align 8, !tbaa !18
  %35 = sext i32 %31 to i64
  %36 = getelementptr inbounds %struct._OpConn, ptr %34, i64 %35, i32 8
  %37 = load float, ptr %36, align 8, !tbaa !19
  %38 = fadd float %.026, %37
  br label %39

39:                                               ; preds = %.lr.ph28, %33
  %.1 = phi float [ %38, %33 ], [ %.026, %.lr.ph28 ]
  %40 = icmp ugt i64 %indvars.iv31, 1
  br i1 %40, label %.lr.ph28, label %._crit_edge.loopexit, !llvm.loop !21

._crit_edge.loopexit:                             ; preds = %39
  %41 = fpext float %.1 to double
  br label %._crit_edge

._crit_edge:                                      ; preds = %.preheader.._crit_edge_crit_edge, %._crit_edge.loopexit
  %42 = phi i8 [ %.pre, %.preheader.._crit_edge_crit_edge ], [ %32, %._crit_edge.loopexit ]
  %.0.lcssa = phi double [ 0.000000e+00, %.preheader.._crit_edge_crit_edge ], [ %41, %._crit_edge.loopexit ]
  %.not18 = icmp eq i8 %42, 0
  br i1 %.not18, label %45, label %43

43:                                               ; preds = %._crit_edge
  %44 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.29, double noundef %.0.lcssa)
  br label %45

45:                                               ; preds = %._crit_edge, %43, %6
  call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %2) #5
  ret void
}

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


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