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

@gfl_conn = external global ptr, align 8
@gmneed_start_D = external global ptr, align 8
@gmneed_start_V = external global ptr, align 8

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: nounwind uwtable
define dso_local zeroext i8 @supv(ptr noundef %0, i32 noundef %1, i32 noundef %2, float noundef %3) #2 {
  %5 = alloca i8, align 1
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store float %3, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  store i32 0, ptr %11, align 4, !tbaa !9
  %13 = load float, ptr %9, align 4, !tbaa !11
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  store float %13, ptr %14, align 4, !tbaa !11
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %85, %4
  %16 = load i32, ptr %10, align 4, !tbaa !9
  %17 = load ptr, ptr @gfl_conn, align 8, !tbaa !5
  %18 = load i32, ptr %8, align 4, !tbaa !9
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds %struct._FlConn, ptr %17, i64 %19
  %21 = getelementptr inbounds %struct._FlConn, ptr %20, i32 0, i32 13
  %22 = load i32, ptr %21, align 8, !tbaa !13
  %23 = icmp slt i32 %16, %22
  br i1 %23, label %24, label %88

24:                                               ; preds = %15
  %25 = load ptr, ptr @gfl_conn, align 8, !tbaa !5
  %26 = load i32, ptr %8, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds %struct._FlConn, ptr %25, i64 %27
  %29 = getelementptr inbounds %struct._FlConn, ptr %28, i32 0, i32 11
  %30 = load ptr, ptr %29, align 8, !tbaa !15
  %31 = load i32, ptr %10, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds i32, ptr %30, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !9
  %35 = load i32, ptr %7, align 4, !tbaa !9
  %36 = icmp eq i32 %34, %35
  br i1 %36, label %37, label %39

37:                                               ; preds = %24
  %38 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %38, ptr %11, align 4, !tbaa !9
  br label %85

39:                                               ; preds = %24
  %40 = load ptr, ptr @gmneed_start_D, align 8, !tbaa !5
  %41 = load ptr, ptr @gfl_conn, align 8, !tbaa !5
  %42 = load i32, ptr %8, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds %struct._FlConn, ptr %41, i64 %43
  %45 = getelementptr inbounds %struct._FlConn, ptr %44, i32 0, i32 11
  %46 = load ptr, ptr %45, align 8, !tbaa !15
  %47 = load i32, ptr %10, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds i32, ptr %46, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds i8, ptr %40, i64 %51
  %53 = load i8, ptr %52, align 1, !tbaa !16
  %54 = icmp ne i8 %53, 0
  br i1 %54, label %56, label %55

55:                                               ; preds = %39
  store i8 0, ptr %5, align 1
  store i32 1, ptr %12, align 4
  br label %102

56:                                               ; preds = %39
  %57 = load ptr, ptr @gfl_conn, align 8, !tbaa !5
  %58 = load i32, ptr %8, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds %struct._FlConn, ptr %57, i64 %59
  %61 = getelementptr inbounds %struct._FlConn, ptr %60, i32 0, i32 12
  %62 = load ptr, ptr %61, align 8, !tbaa !17
  %63 = load i32, ptr %10, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds float, ptr %62, i64 %64
  %66 = load float, ptr %65, align 4, !tbaa !11
  %67 = load ptr, ptr @gmneed_start_V, align 8, !tbaa !5
  %68 = load ptr, ptr @gfl_conn, align 8, !tbaa !5
  %69 = load i32, ptr %8, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds %struct._FlConn, ptr %68, i64 %70
  %72 = getelementptr inbounds %struct._FlConn, ptr %71, i32 0, i32 11
  %73 = load ptr, ptr %72, align 8, !tbaa !15
  %74 = load i32, ptr %10, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds i32, ptr %73, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds float, ptr %67, i64 %78
  %80 = load float, ptr %79, align 4, !tbaa !11
  %81 = load ptr, ptr %6, align 8, !tbaa !5
  %82 = load float, ptr %81, align 4, !tbaa !11
  %83 = fneg float %66
  %84 = call float @llvm.fmuladd.f32(float %83, float %80, float %82)
  store float %84, ptr %81, align 4, !tbaa !11
  br label %85

85:                                               ; preds = %56, %37
  %86 = load i32, ptr %10, align 4, !tbaa !9
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %10, align 4, !tbaa !9
  br label %15, !llvm.loop !18

88:                                               ; preds = %15
  %89 = load ptr, ptr @gfl_conn, align 8, !tbaa !5
  %90 = load i32, ptr %8, align 4, !tbaa !9
  %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 12
  %94 = load ptr, ptr %93, align 8, !tbaa !17
  %95 = load i32, ptr %11, align 4, !tbaa !9
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds float, ptr %94, i64 %96
  %98 = load float, ptr %97, align 4, !tbaa !11
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = load float, ptr %99, align 4, !tbaa !11
  %101 = fdiv float %100, %98
  store float %101, ptr %99, align 4, !tbaa !11
  store i8 1, ptr %5, align 1
  store i32 1, ptr %12, align 4
  br label %102

102:                                              ; preds = %88, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %103 = load i8, ptr %5, align 1
  ret i8 %103
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #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, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !10, i64 96}
!14 = !{!"_FlConn", !6, i64 0, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !10, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !10, i64 72, !7, i64 76, !6, i64 80, !6, i64 88, !10, i64 96, !7, i64 100, !12, i64 104, !7, i64 108, !6, i64 112, !6, i64 120, !7, i64 128, !12, i64 132, !10, i64 136}
!15 = !{!14, !6, i64 80}
!16 = !{!7, !7, i64 0}
!17 = !{!14, !6, i64 88}
!18 = distinct !{!18, !19}
!19 = !{!"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"

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

@gfl_conn = external local_unnamed_addr global ptr, align 8
@gmneed_start_D = external local_unnamed_addr global ptr, align 8
@gmneed_start_V = external local_unnamed_addr global ptr, align 8

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

; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local zeroext range(i8 0, 2) i8 @supv(ptr nocapture noundef writeonly %0, i32 noundef %1, i32 noundef %2, float noundef %3) local_unnamed_addr #1 {
  store float %3, ptr %0, align 4, !tbaa !5
  %5 = load ptr, ptr @gfl_conn, align 8, !tbaa !9
  %6 = sext i32 %2 to i64
  %7 = getelementptr inbounds %struct._FlConn, ptr %5, i64 %6
  %8 = getelementptr inbounds i8, ptr %7, i64 96
  %9 = load i32, ptr %8, align 8, !tbaa !11
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph, label %._crit_edge

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

16:                                               ; preds = %.lr.ph, %34
  %17 = phi float [ %3, %.lr.ph ], [ %35, %34 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %34 ]
  %.025 = phi i32 [ 0, %.lr.ph ], [ %.1, %34 ]
  %18 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv
  %19 = load i32, ptr %18, align 4, !tbaa !15
  %20 = icmp eq i32 %19, %1
  %21 = trunc nuw nsw i64 %indvars.iv to i32
  br i1 %20, label %34, label %22

22:                                               ; preds = %16
  %23 = sext i32 %19 to i64
  %24 = getelementptr inbounds i8, ptr %13, i64 %23
  %25 = load i8, ptr %24, align 1, !tbaa !16
  %.not = icmp eq i8 %25, 0
  br i1 %.not, label %.loopexit, label %26

26:                                               ; preds = %22
  %27 = load ptr, ptr %14, align 8, !tbaa !17
  %28 = getelementptr inbounds float, ptr %27, i64 %indvars.iv
  %29 = load float, ptr %28, align 4, !tbaa !5
  %30 = getelementptr inbounds float, ptr %15, i64 %23
  %31 = load float, ptr %30, align 4, !tbaa !5
  %32 = fneg float %29
  %33 = tail call float @llvm.fmuladd.f32(float %32, float %31, float %17)
  store float %33, ptr %0, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %16, %26
  %35 = phi float [ %33, %26 ], [ %17, %16 ]
  %.1 = phi i32 [ %.025, %26 ], [ %21, %16 ]
  %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.loopexit, label %16, !llvm.loop !18

._crit_edge.loopexit:                             ; preds = %34
  %36 = sext i32 %.1 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %4
  %37 = phi float [ %3, %4 ], [ %35, %._crit_edge.loopexit ]
  %.0.lcssa = phi i64 [ 0, %4 ], [ %36, %._crit_edge.loopexit ]
  %38 = getelementptr inbounds i8, ptr %7, i64 88
  %39 = load ptr, ptr %38, align 8, !tbaa !17
  %40 = getelementptr inbounds float, ptr %39, i64 %.0.lcssa
  %41 = load float, ptr %40, align 4, !tbaa !5
  %42 = fdiv float %37, %41
  store float %42, ptr %0, align 4, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %22, %._crit_edge
  %.020 = phi i8 [ 1, %._crit_edge ], [ 0, %22 ]
  ret i8 %.020
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nofree norecurse nosync nounwind memory(read, argmem: 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 = !{!"float", !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, !13, i64 96}
!12 = !{!"_FlConn", !10, i64 0, !13, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !13, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !13, i64 72, !7, i64 76, !10, i64 80, !10, i64 88, !13, i64 96, !7, i64 100, !6, i64 104, !7, i64 108, !10, i64 112, !10, i64 120, !7, i64 128, !6, i64 132, !13, i64 136}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !10, i64 80}
!15 = !{!13, !13, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!12, !10, i64 88}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


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