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

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

@gop_conn = external global ptr, align 8
@gef_conn = external global ptr, align 8
@gft_conn = external global ptr, align 8
@lch_F = external dso_local global ptr, align 8
@lnum_ch_F = external dso_local global i32, align 4
@lused_O = external dso_local global ptr, align 8
@lnum_used_O = external dso_local global i32, align 4
@lin_plan_E = external dso_local global ptr, align 8
@lnum_in_plan_E = external dso_local global i32, align 4

; 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 @reset_search_info() #1 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #2
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %2

2:                                                ; preds = %34, %0
  %3 = load i32, ptr %1, align 4, !tbaa !5
  %4 = load i32, ptr @lnum_ch_F, align 4, !tbaa !5
  %5 = icmp slt i32 %3, %4
  br i1 %5, label %6, label %37

6:                                                ; preds = %2
  %7 = load ptr, ptr @gft_conn, align 8, !tbaa !9
  %8 = load ptr, ptr @lch_F, align 8, !tbaa !9
  %9 = load i32, ptr %1, align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds i32, ptr %8, i64 %10
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds %struct._FtConn, ptr %7, i64 %13
  %15 = getelementptr inbounds %struct._FtConn, ptr %14, i32 0, i32 12
  store i32 -1, ptr %15, align 4, !tbaa !11
  %16 = load ptr, ptr @gft_conn, align 8, !tbaa !9
  %17 = load ptr, ptr @lch_F, align 8, !tbaa !9
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds i32, ptr %17, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds %struct._FtConn, ptr %16, i64 %22
  %24 = getelementptr inbounds %struct._FtConn, ptr %23, i32 0, i32 11
  store i32 0, ptr %24, align 8, !tbaa !14
  %25 = load ptr, ptr @gft_conn, align 8, !tbaa !9
  %26 = load ptr, ptr @lch_F, align 8, !tbaa !9
  %27 = load i32, ptr %1, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds i32, ptr %26, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds %struct._FtConn, ptr %25, i64 %31
  %33 = getelementptr inbounds %struct._FtConn, ptr %32, i32 0, i32 13
  store i8 0, ptr %33, align 8, !tbaa !15
  br label %34

34:                                               ; preds = %6
  %35 = load i32, ptr %1, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %1, align 4, !tbaa !5
  br label %2, !llvm.loop !16

37:                                               ; preds = %2
  store i32 0, ptr @lnum_ch_F, align 4, !tbaa !5
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %52, %37
  %39 = load i32, ptr %1, align 4, !tbaa !5
  %40 = load i32, ptr @lnum_used_O, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %42, label %55

42:                                               ; preds = %38
  %43 = load ptr, ptr @gop_conn, align 8, !tbaa !9
  %44 = load ptr, ptr @lused_O, align 8, !tbaa !9
  %45 = load i32, ptr %1, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds i32, ptr %44, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds %struct._OpConn, ptr %43, i64 %49
  %51 = getelementptr inbounds %struct._OpConn, ptr %50, i32 0, i32 6
  store i32 -1, ptr %51, align 8, !tbaa !18
  br label %52

52:                                               ; preds = %42
  %53 = load i32, ptr %1, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %1, align 4, !tbaa !5
  br label %38, !llvm.loop !20

55:                                               ; preds = %38
  store i32 0, ptr @lnum_used_O, align 4, !tbaa !5
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %70, %55
  %57 = load i32, ptr %1, align 4, !tbaa !5
  %58 = load i32, ptr @lnum_in_plan_E, align 4, !tbaa !5
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %60, label %73

60:                                               ; preds = %56
  %61 = load ptr, ptr @gef_conn, align 8, !tbaa !9
  %62 = load ptr, ptr @lin_plan_E, align 8, !tbaa !9
  %63 = load i32, ptr %1, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds i32, ptr %62, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds %struct._EfConn, ptr %61, i64 %67
  %69 = getelementptr inbounds %struct._EfConn, ptr %68, i32 0, i32 32
  store i32 -1, ptr %69, align 4, !tbaa !21
  br label %70

70:                                               ; preds = %60
  %71 = load i32, ptr %1, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %1, align 4, !tbaa !5
  br label %56, !llvm.loop !23

73:                                               ; preds = %56
  store i32 0, ptr @lnum_in_plan_E, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #2
  ret void
}

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 = !{!"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, !6, i64 76}
!12 = !{!"_FtConn", !10, i64 0, !6, i64 8, !10, i64 16, !6, i64 24, !10, i64 32, !6, i64 40, !10, i64 48, !6, i64 56, !6, i64 60, !13, i64 64, !7, i64 68, !6, i64 72, !6, i64 76, !7, i64 80, !6, i64 84, !7, i64 88}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !6, i64 72}
!15 = !{!12, !7, i64 80}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!19, !6, i64 32}
!19 = !{!"_OpConn", !10, i64 0, !7, i64 8, !10, i64 16, !6, i64 24, !7, i64 28, !7, i64 29, !6, i64 32, !7, i64 36, !13, i64 40}
!20 = distinct !{!20, !17}
!21 = !{!22, !6, i64 212}
!22 = !{!"_EfConn", !6, i64 0, !7, i64 4, !7, i64 5, !13, i64 8, !10, i64 16, !6, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !6, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !6, i64 88, !10, i64 96, !6, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !6, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !6, i64 168, !10, i64 176, !6, i64 184, !6, i64 188, !13, i64 192, !7, i64 196, !6, i64 200, !7, i64 204, !6, i64 208, !6, i64 212}
!23 = distinct !{!23, !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._FtConn = type { ptr, i32, ptr, i32, ptr, i32, ptr, i32, i32, float, i8, i32, i32, i8, i32, i8 }
%struct._OpConn = type { ptr, i8, ptr, i32, i8, i8, i32, i8, float }
%struct._EfConn = type { i32, i8, i8, float, ptr, i32, ptr, ptr, ptr, i32, ptr, ptr, ptr, i32, ptr, i32, ptr, ptr, ptr, i32, ptr, ptr, ptr, i32, ptr, i32, i32, float, i8, i32, i8, i32, i32 }

@gop_conn = external local_unnamed_addr global ptr, align 8
@gef_conn = external local_unnamed_addr global ptr, align 8
@gft_conn = external local_unnamed_addr global ptr, align 8
@lch_F = external dso_local local_unnamed_addr global ptr, align 8
@lnum_ch_F = external dso_local local_unnamed_addr global i32, align 4
@lused_O = external dso_local local_unnamed_addr global ptr, align 8
@lnum_used_O = external dso_local local_unnamed_addr global i32, align 4
@lin_plan_E = external dso_local local_unnamed_addr global ptr, align 8
@lnum_in_plan_E = external dso_local local_unnamed_addr global i32, align 4

; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @reset_search_info() local_unnamed_addr #0 {
  %1 = load i32, ptr @lnum_ch_F, align 4, !tbaa !5
  %2 = icmp sgt i32 %1, 0
  br i1 %2, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0
  %3 = load ptr, ptr @gft_conn, align 8, !tbaa !9
  %4 = load ptr, ptr @lch_F, align 8, !tbaa !9
  br label %5

5:                                                ; preds = %.lr.ph, %5
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %5 ]
  %6 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds %struct._FtConn, ptr %3, i64 %8, i32 12
  store i32 -1, ptr %9, align 4, !tbaa !11
  %10 = load i32, ptr %6, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds %struct._FtConn, ptr %3, i64 %11, i32 11
  store i32 0, ptr %12, align 8, !tbaa !14
  %13 = load i32, ptr %6, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds %struct._FtConn, ptr %3, i64 %14, i32 13
  store i8 0, ptr %15, align 8, !tbaa !15
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %16 = load i32, ptr @lnum_ch_F, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = icmp slt i64 %indvars.iv.next, %17
  br i1 %18, label %5, label %._crit_edge, !llvm.loop !16

._crit_edge:                                      ; preds = %5, %0
  store i32 0, ptr @lnum_ch_F, align 4, !tbaa !5
  %19 = load i32, ptr @lnum_used_O, align 4, !tbaa !5
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph14, label %._crit_edge15

.lr.ph14:                                         ; preds = %._crit_edge
  %21 = load ptr, ptr @gop_conn, align 8, !tbaa !9
  %22 = load ptr, ptr @lused_O, align 8, !tbaa !9
  br label %23

23:                                               ; preds = %.lr.ph14, %23
  %indvars.iv21 = phi i64 [ 0, %.lr.ph14 ], [ %indvars.iv.next22, %23 ]
  %24 = getelementptr inbounds i32, ptr %22, i64 %indvars.iv21
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds %struct._OpConn, ptr %21, i64 %26, i32 6
  store i32 -1, ptr %27, align 8, !tbaa !18
  %indvars.iv.next22 = add nuw nsw i64 %indvars.iv21, 1
  %28 = load i32, ptr @lnum_used_O, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = icmp slt i64 %indvars.iv.next22, %29
  br i1 %30, label %23, label %._crit_edge15, !llvm.loop !20

._crit_edge15:                                    ; preds = %23, %._crit_edge
  store i32 0, ptr @lnum_used_O, align 4, !tbaa !5
  %31 = load i32, ptr @lnum_in_plan_E, align 4, !tbaa !5
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %.lr.ph18, label %._crit_edge19

.lr.ph18:                                         ; preds = %._crit_edge15
  %33 = load ptr, ptr @gef_conn, align 8, !tbaa !9
  %34 = load ptr, ptr @lin_plan_E, align 8, !tbaa !9
  br label %35

35:                                               ; preds = %.lr.ph18, %35
  %indvars.iv24 = phi i64 [ 0, %.lr.ph18 ], [ %indvars.iv.next25, %35 ]
  %36 = getelementptr inbounds i32, ptr %34, i64 %indvars.iv24
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds %struct._EfConn, ptr %33, i64 %38, i32 32
  store i32 -1, ptr %39, align 4, !tbaa !21
  %indvars.iv.next25 = add nuw nsw i64 %indvars.iv24, 1
  %40 = load i32, ptr @lnum_in_plan_E, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = icmp slt i64 %indvars.iv.next25, %41
  br i1 %42, label %35, label %._crit_edge19, !llvm.loop !23

._crit_edge19:                                    ; preds = %35, %._crit_edge15
  store i32 0, ptr @lnum_in_plan_E, align 4, !tbaa !5
  ret void
}

attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) 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 = !{!"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, !6, i64 76}
!12 = !{!"_FtConn", !10, i64 0, !6, i64 8, !10, i64 16, !6, i64 24, !10, i64 32, !6, i64 40, !10, i64 48, !6, i64 56, !6, i64 60, !13, i64 64, !7, i64 68, !6, i64 72, !6, i64 76, !7, i64 80, !6, i64 84, !7, i64 88}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !6, i64 72}
!15 = !{!12, !7, i64 80}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!19, !6, i64 32}
!19 = !{!"_OpConn", !10, i64 0, !7, i64 8, !10, i64 16, !6, i64 24, !7, i64 28, !7, i64 29, !6, i64 32, !7, i64 36, !13, i64 40}
!20 = distinct !{!20, !17}
!21 = !{!22, !6, i64 212}
!22 = !{!"_EfConn", !6, i64 0, !7, i64 4, !7, i64 5, !13, i64 8, !10, i64 16, !6, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !6, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !6, i64 88, !10, i64 96, !6, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !6, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !6, i64 168, !10, i64 176, !6, i64 184, !6, i64 188, !13, i64 192, !7, i64 196, !6, i64 200, !7, i64 204, !6, i64 208, !6, i64 212}
!23 = distinct !{!23, !17}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass