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

@gnum_fl_conn = external global i32, align 4
@gfl_conn = external global ptr, align 8
@gnum_real_fl_conn = external 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 @determine_artificial_fl_levels(i32 noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca float, align 4
  store i32 %0, ptr %2, align 4, !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
  %6 = load i32, ptr @gnum_real_fl_conn, align 4, !tbaa !5
  store i32 %6, ptr %3, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %109, %1
  %8 = load i32, ptr %3, align 4, !tbaa !5
  %9 = load i32, ptr @gnum_fl_conn, align 4, !tbaa !5
  %10 = icmp slt i32 %8, %9
  br i1 %10, label %11, label %112

11:                                               ; preds = %7
  store float 0.000000e+00, ptr %5, align 4, !tbaa !9
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %75, %11
  %13 = load i32, ptr %4, align 4, !tbaa !5
  %14 = load ptr, ptr @gfl_conn, align 8, !tbaa !11
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds %struct._FlConn, ptr %14, i64 %16
  %18 = getelementptr inbounds %struct._FlConn, ptr %17, i32 0, i32 13
  %19 = load i32, ptr %18, align 8, !tbaa !13
  %20 = icmp slt i32 %13, %19
  br i1 %20, label %21, label %78

21:                                               ; preds = %12
  %22 = load ptr, ptr @gfl_conn, align 8, !tbaa !11
  %23 = load ptr, ptr @gfl_conn, align 8, !tbaa !11
  %24 = load i32, ptr %3, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds %struct._FlConn, ptr %23, i64 %25
  %27 = getelementptr inbounds %struct._FlConn, ptr %26, i32 0, i32 11
  %28 = load ptr, ptr %27, align 8, !tbaa !15
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds i32, ptr %28, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds %struct._FlConn, ptr %22, i64 %33
  %35 = getelementptr inbounds %struct._FlConn, ptr %34, i32 0, i32 17
  %36 = load ptr, ptr %35, align 8, !tbaa !16
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds i8, ptr %36, i64 %38
  %40 = load i8, ptr %39, align 1, !tbaa !17
  %41 = icmp ne i8 %40, 0
  br i1 %41, label %43, label %42

42:                                               ; preds = %21
  br label %78

43:                                               ; preds = %21
  %44 = load ptr, ptr @gfl_conn, align 8, !tbaa !11
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds %struct._FlConn, ptr %44, i64 %46
  %48 = getelementptr inbounds %struct._FlConn, ptr %47, i32 0, i32 12
  %49 = load ptr, ptr %48, align 8, !tbaa !18
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds float, ptr %49, i64 %51
  %53 = load float, ptr %52, align 4, !tbaa !9
  %54 = load ptr, ptr @gfl_conn, align 8, !tbaa !11
  %55 = load ptr, ptr @gfl_conn, align 8, !tbaa !11
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds %struct._FlConn, ptr %55, i64 %57
  %59 = getelementptr inbounds %struct._FlConn, ptr %58, i32 0, i32 11
  %60 = load ptr, ptr %59, align 8, !tbaa !15
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds i32, ptr %60, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds %struct._FlConn, ptr %54, i64 %65
  %67 = getelementptr inbounds %struct._FlConn, ptr %66, i32 0, i32 18
  %68 = load ptr, ptr %67, align 8, !tbaa !19
  %69 = load i32, ptr %2, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds float, ptr %68, i64 %70
  %72 = load float, ptr %71, align 4, !tbaa !9
  %73 = load float, ptr %5, align 4, !tbaa !9
  %74 = call float @llvm.fmuladd.f32(float %53, float %72, float %73)
  store float %74, ptr %5, align 4, !tbaa !9
  br label %75

75:                                               ; preds = %43
  %76 = load i32, ptr %4, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %4, align 4, !tbaa !5
  br label %12, !llvm.loop !20

78:                                               ; preds = %42, %12
  %79 = load i32, ptr %4, align 4, !tbaa !5
  %80 = load ptr, ptr @gfl_conn, align 8, !tbaa !11
  %81 = load i32, ptr %3, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds %struct._FlConn, ptr %80, i64 %82
  %84 = getelementptr inbounds %struct._FlConn, ptr %83, i32 0, i32 13
  %85 = load i32, ptr %84, align 8, !tbaa !13
  %86 = icmp slt i32 %79, %85
  br i1 %86, label %87, label %88

87:                                               ; preds = %78
  br label %109

88:                                               ; preds = %78
  %89 = load ptr, ptr @gfl_conn, align 8, !tbaa !11
  %90 = load i32, ptr %3, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds %struct._FlConn, ptr %89, i64 %91
  %93 = getelementptr inbounds %struct._FlConn, ptr %92, i32 0, i32 17
  %94 = load ptr, ptr %93, align 8, !tbaa !16
  %95 = load i32, ptr %2, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds i8, ptr %94, i64 %96
  store i8 1, ptr %97, align 1, !tbaa !17
  %98 = load float, ptr %5, align 4, !tbaa !9
  %99 = load ptr, ptr @gfl_conn, align 8, !tbaa !11
  %100 = load i32, ptr %3, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds %struct._FlConn, ptr %99, i64 %101
  %103 = getelementptr inbounds %struct._FlConn, ptr %102, i32 0, i32 18
  %104 = load ptr, ptr %103, align 8, !tbaa !19
  %105 = load i32, ptr %2, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds float, ptr %104, i64 %106
  store float %98, ptr %107, align 4, !tbaa !9
  br label %108

108:                                              ; preds = %88
  br label %109

109:                                              ; preds = %108, %87
  %110 = load i32, ptr %3, align 4, !tbaa !5
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %3, align 4, !tbaa !5
  br label %7, !llvm.loop !22

112:                                              ; preds = %7
  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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"int", !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 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !6, i64 96}
!14 = !{!"_FlConn", !12, i64 0, !6, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !6, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !6, i64 72, !7, i64 76, !12, i64 80, !12, i64 88, !6, i64 96, !7, i64 100, !10, i64 104, !7, i64 108, !12, i64 112, !12, i64 120, !7, i64 128, !10, i64 132, !6, i64 136}
!15 = !{!14, !12, i64 80}
!16 = !{!14, !12, i64 112}
!17 = !{!7, !7, i64 0}
!18 = !{!14, !12, i64 88}
!19 = !{!14, !12, i64 120}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}


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

@gnum_fl_conn = external local_unnamed_addr global i32, align 4
@gfl_conn = external local_unnamed_addr global ptr, align 8
@gnum_real_fl_conn = external local_unnamed_addr global i32, align 4

; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @determine_artificial_fl_levels(i32 noundef %0) local_unnamed_addr #0 {
  %2 = load i32, ptr @gnum_real_fl_conn, align 4, !tbaa !5
  %3 = load i32, ptr @gnum_fl_conn, align 4, !tbaa !5
  %4 = icmp slt i32 %2, %3
  br i1 %4, label %.preheader.lr.ph, label %._crit_edge31

.preheader.lr.ph:                                 ; preds = %1
  %5 = sext i32 %0 to i64
  %6 = sext i32 %2 to i64
  %.pre = load ptr, ptr @gfl_conn, align 8, !tbaa !9
  br label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %.thread
  %7 = phi i32 [ %3, %.preheader.lr.ph ], [ %41, %.thread ]
  %8 = phi ptr [ %.pre, %.preheader.lr.ph ], [ %42, %.thread ]
  %indvars.iv33 = phi i64 [ %6, %.preheader.lr.ph ], [ %indvars.iv.next34, %.thread ]
  %9 = getelementptr inbounds %struct._FlConn, ptr %8, i64 %indvars.iv33
  %10 = getelementptr inbounds i8, ptr %9, i64 96
  %11 = load i32, ptr %10, align 8, !tbaa !11
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader
  %13 = getelementptr inbounds i8, ptr %9, i64 80
  %14 = load ptr, ptr %13, align 8, !tbaa !14
  %15 = getelementptr inbounds i8, ptr %9, i64 88
  %wide.trip.count = zext nneg i32 %11 to i64
  br label %16

16:                                               ; preds = %.lr.ph, %25
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %25 ]
  %.027 = phi float [ 0.000000e+00, %.lr.ph ], [ %33, %25 ]
  %17 = getelementptr inbounds i32, ptr %14, i64 %indvars.iv
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds %struct._FlConn, ptr %8, i64 %19
  %21 = getelementptr inbounds i8, ptr %20, i64 112
  %22 = load ptr, ptr %21, align 8, !tbaa !15
  %23 = getelementptr inbounds i8, ptr %22, i64 %5
  %24 = load i8, ptr %23, align 1, !tbaa !16
  %.not = icmp eq i8 %24, 0
  br i1 %.not, label %.thread, label %25

25:                                               ; preds = %16
  %26 = load ptr, ptr %15, align 8, !tbaa !17
  %27 = getelementptr inbounds float, ptr %26, i64 %indvars.iv
  %28 = load float, ptr %27, align 4, !tbaa !18
  %29 = getelementptr inbounds i8, ptr %20, i64 120
  %30 = load ptr, ptr %29, align 8, !tbaa !19
  %31 = getelementptr inbounds float, ptr %30, i64 %5
  %32 = load float, ptr %31, align 4, !tbaa !18
  %33 = tail call float @llvm.fmuladd.f32(float %28, float %32, float %.027)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %16, !llvm.loop !20

._crit_edge:                                      ; preds = %25, %.preheader
  %.0.lcssa = phi float [ 0.000000e+00, %.preheader ], [ %33, %25 ]
  %34 = getelementptr inbounds i8, ptr %9, i64 112
  %35 = load ptr, ptr %34, align 8, !tbaa !15
  %36 = getelementptr inbounds i8, ptr %35, i64 %5
  store i8 1, ptr %36, align 1, !tbaa !16
  %37 = load ptr, ptr @gfl_conn, align 8, !tbaa !9
  %38 = getelementptr inbounds %struct._FlConn, ptr %37, i64 %indvars.iv33, i32 18
  %39 = load ptr, ptr %38, align 8, !tbaa !19
  %40 = getelementptr inbounds float, ptr %39, i64 %5
  store float %.0.lcssa, ptr %40, align 4, !tbaa !18
  %.pre36 = load i32, ptr @gnum_fl_conn, align 4, !tbaa !5
  br label %.thread

.thread:                                          ; preds = %16, %._crit_edge
  %41 = phi i32 [ %.pre36, %._crit_edge ], [ %7, %16 ]
  %42 = phi ptr [ %37, %._crit_edge ], [ %8, %16 ]
  %indvars.iv.next34 = add nsw i64 %indvars.iv33, 1
  %43 = sext i32 %41 to i64
  %44 = icmp slt i64 %indvars.iv.next34, %43
  br i1 %44, label %.preheader, label %._crit_edge31, !llvm.loop !22

._crit_edge31:                                    ; preds = %.thread, %1
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

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" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 96}
!12 = !{!"_FlConn", !10, i64 0, !6, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !6, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !6, i64 72, !7, i64 76, !10, i64 80, !10, i64 88, !6, i64 96, !7, i64 100, !13, i64 104, !7, i64 108, !10, i64 112, !10, i64 120, !7, i64 128, !13, i64 132, !6, i64 136}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !10, i64 80}
!15 = !{!12, !10, i64 112}
!16 = !{!7, !7, i64 0}
!17 = !{!12, !10, i64 88}
!18 = !{!13, !13, i64 0}
!19 = !{!12, !10, i64 120}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}


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