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

; 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

; 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 zeroext i8 @i_inc_influences_j(i32 noundef %0, i32 noundef %1) #1 {
  %3 = alloca i8, align 1
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #2
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %76, %2
  %11 = load i32, ptr %6, align 4, !tbaa !5
  %12 = load ptr, ptr @gfl_conn, align 8, !tbaa !9
  %13 = load i32, ptr %5, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds %struct._FlConn, ptr %12, i64 %14
  %16 = getelementptr inbounds %struct._FlConn, ptr %15, i32 0, i32 5
  %17 = load i32, ptr %16, align 8, !tbaa !11
  %18 = icmp slt i32 %11, %17
  br i1 %18, label %19, label %79

19:                                               ; preds = %10
  %20 = load ptr, ptr @gfl_conn, align 8, !tbaa !9
  %21 = load i32, ptr %5, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds %struct._FlConn, ptr %20, i64 %22
  %24 = getelementptr inbounds %struct._FlConn, ptr %23, i32 0, i32 3
  %25 = load ptr, ptr %24, align 8, !tbaa !14
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds i32, ptr %25, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  store i32 %29, ptr %8, align 4, !tbaa !5
  %30 = load i32, ptr %8, align 4, !tbaa !5
  %31 = icmp slt i32 %30, 0
  br i1 %31, label %32, label %33

32:                                               ; preds = %19
  br label %76

33:                                               ; preds = %19
  %34 = load i32, ptr %8, align 4, !tbaa !5
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = icmp eq i32 %34, %35
  br i1 %36, label %37, label %38

37:                                               ; preds = %33
  store i8 1, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %80

38:                                               ; preds = %33
  %39 = load ptr, ptr @gfl_conn, align 8, !tbaa !9
  %40 = load i32, ptr %8, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds %struct._FlConn, ptr %39, i64 %41
  %43 = getelementptr inbounds %struct._FlConn, ptr %42, i32 0, i32 10
  %44 = load i8, ptr %43, align 4, !tbaa !15
  %45 = icmp ne i8 %44, 0
  br i1 %45, label %47, label %46

46:                                               ; preds = %38
  br label %76

47:                                               ; preds = %38
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %72, %47
  %49 = load i32, ptr %7, align 4, !tbaa !5
  %50 = load ptr, ptr @gfl_conn, align 8, !tbaa !9
  %51 = load i32, ptr %8, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds %struct._FlConn, ptr %50, i64 %52
  %54 = getelementptr inbounds %struct._FlConn, ptr %53, i32 0, i32 13
  %55 = load i32, ptr %54, align 8, !tbaa !16
  %56 = icmp slt i32 %49, %55
  br i1 %56, label %57, label %75

57:                                               ; preds = %48
  %58 = load ptr, ptr @gfl_conn, align 8, !tbaa !9
  %59 = load i32, ptr %8, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds %struct._FlConn, ptr %58, i64 %60
  %62 = getelementptr inbounds %struct._FlConn, ptr %61, i32 0, i32 11
  %63 = load ptr, ptr %62, align 8, !tbaa !17
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds i32, ptr %63, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = load i32, ptr %4, align 4, !tbaa !5
  %69 = icmp eq i32 %67, %68
  br i1 %69, label %70, label %71

70:                                               ; preds = %57
  store i8 1, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %80

71:                                               ; preds = %57
  br label %72

72:                                               ; preds = %71
  %73 = load i32, ptr %7, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %7, align 4, !tbaa !5
  br label %48, !llvm.loop !18

75:                                               ; preds = %48
  br label %76

76:                                               ; preds = %75, %46, %32
  %77 = load i32, ptr %6, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %6, align 4, !tbaa !5
  br label %10, !llvm.loop !20

79:                                               ; preds = %10
  store i8 0, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %80

80:                                               ; preds = %79, %70, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  %81 = load i8, ptr %3, align 1
  ret i8 %81
}

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 40}
!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 24}
!15 = !{!12, !7, i64 76}
!16 = !{!12, !6, i64 96}
!17 = !{!12, !10, i64 80}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}


; 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

; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local zeroext range(i8 0, 2) i8 @i_inc_influences_j(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = load ptr, ptr @gfl_conn, align 8, !tbaa !5
  %4 = sext i32 %1 to i64
  %5 = getelementptr inbounds %struct._FlConn, ptr %3, i64 %4
  %6 = getelementptr inbounds i8, ptr %5, i64 40
  %7 = load i32, ptr %6, align 8, !tbaa !9
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph24, label %.loopexit20

.lr.ph24:                                         ; preds = %2
  %9 = getelementptr inbounds i8, ptr %5, i64 24
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  %wide.trip.count32 = zext nneg i32 %7 to i64
  br label %11

11:                                               ; preds = %.lr.ph24, %.loopexit
  %indvars.iv29 = phi i64 [ 0, %.lr.ph24 ], [ %indvars.iv.next30, %.loopexit ]
  %12 = getelementptr inbounds i32, ptr %10, i64 %indvars.iv29
  %13 = load i32, ptr %12, align 4, !tbaa !14
  %14 = icmp slt i32 %13, 0
  br i1 %14, label %.loopexit, label %15

15:                                               ; preds = %11
  %16 = icmp eq i32 %13, %0
  br i1 %16, label %.loopexit20, label %17

17:                                               ; preds = %15
  %18 = zext nneg i32 %13 to i64
  %19 = getelementptr inbounds %struct._FlConn, ptr %3, i64 %18, i32 10
  %20 = load i8, ptr %19, align 4, !tbaa !15
  %.not = icmp eq i8 %20, 0
  br i1 %.not, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %17
  %21 = getelementptr inbounds %struct._FlConn, ptr %3, i64 %18
  %22 = getelementptr inbounds i8, ptr %21, i64 96
  %23 = load i32, ptr %22, align 8, !tbaa !16
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader
  %25 = getelementptr inbounds i8, ptr %21, i64 80
  %26 = load ptr, ptr %25, align 8, !tbaa !17
  %wide.trip.count = zext nneg i32 %23 to i64
  br label %28

27:                                               ; preds = %28
  %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 %.loopexit, label %28, !llvm.loop !18

28:                                               ; preds = %.lr.ph, %27
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %27 ]
  %29 = getelementptr inbounds i32, ptr %26, i64 %indvars.iv
  %30 = load i32, ptr %29, align 4, !tbaa !14
  %31 = icmp eq i32 %30, %0
  br i1 %31, label %.loopexit20, label %27

.loopexit:                                        ; preds = %27, %.preheader, %17, %11
  %indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
  %exitcond33.not = icmp eq i64 %indvars.iv.next30, %wide.trip.count32
  br i1 %exitcond33.not, label %.loopexit20, label %11, !llvm.loop !20

.loopexit20:                                      ; preds = %15, %.loopexit, %28, %2
  %.0 = phi i8 [ 0, %2 ], [ 1, %28 ], [ 1, %15 ], [ 0, %.loopexit ]
  ret i8 %.0
}

attributes #0 = { nofree norecurse nosync nounwind memory(read, 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 40}
!10 = !{!"_FlConn", !6, i64 0, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !11, i64 72, !7, i64 76, !6, i64 80, !6, i64 88, !11, i64 96, !7, i64 100, !12, i64 104, !7, i64 108, !6, i64 112, !6, i64 120, !7, i64 128, !12, i64 132, !11, i64 136}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!10, !6, i64 24}
!14 = !{!11, !11, i64 0}
!15 = !{!10, !7, i64 76}
!16 = !{!10, !11, i64 96}
!17 = !{!10, !6, i64 80}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}


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