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

; 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._NormEffect = type { i32, [15 x i32], [15 x i32], ptr, i32, ptr, i32, ptr, i32, ptr, ptr, ptr, i32, ptr, ptr, ptr, i32, ptr, ptr }

; 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
declare void @free(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @free_ExpNode(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @free_NormEffect(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  %5 = icmp ne ptr %4, null
  br i1 %5, label %6, label %135

6:                                                ; preds = %1
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct._NormEffect, ptr %7, i32 0, i32 18
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  call void @free_NormEffect(ptr noundef %9)
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct._NormEffect, ptr %10, i32 0, i32 3
  %12 = load ptr, ptr %11, align 8, !tbaa !12
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %18

14:                                               ; preds = %6
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct._NormEffect, ptr %15, i32 0, i32 3
  %17 = load ptr, ptr %16, align 8, !tbaa !12
  call void @free(ptr noundef %17) #3
  br label %18

18:                                               ; preds = %14, %6
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct._NormEffect, ptr %19, i32 0, i32 5
  %21 = load ptr, ptr %20, align 8, !tbaa !13
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %27

23:                                               ; preds = %18
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._NormEffect, ptr %24, i32 0, i32 5
  %26 = load ptr, ptr %25, align 8, !tbaa !13
  call void @free(ptr noundef %26) #3
  br label %27

27:                                               ; preds = %23, %18
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._NormEffect, ptr %28, i32 0, i32 7
  %30 = load ptr, ptr %29, align 8, !tbaa !14
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %36

32:                                               ; preds = %27
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._NormEffect, ptr %33, i32 0, i32 7
  %35 = load ptr, ptr %34, align 8, !tbaa !14
  call void @free(ptr noundef %35) #3
  br label %36

36:                                               ; preds = %32, %27
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct._NormEffect, ptr %37, i32 0, i32 9
  %39 = load ptr, ptr %38, align 8, !tbaa !15
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %45

41:                                               ; preds = %36
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct._NormEffect, ptr %42, i32 0, i32 9
  %44 = load ptr, ptr %43, align 8, !tbaa !15
  call void @free(ptr noundef %44) #3
  br label %45

45:                                               ; preds = %41, %36
  store i32 0, ptr %3, align 4, !tbaa !16
  br label %46

46:                                               ; preds = %67, %45
  %47 = load i32, ptr %3, align 4, !tbaa !16
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct._NormEffect, ptr %48, i32 0, i32 12
  %50 = load i32, ptr %49, align 8, !tbaa !17
  %51 = icmp slt i32 %47, %50
  br i1 %51, label %52, label %70

52:                                               ; preds = %46
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct._NormEffect, ptr %53, i32 0, i32 10
  %55 = load ptr, ptr %54, align 8, !tbaa !18
  %56 = load i32, ptr %3, align 4, !tbaa !16
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds ptr, ptr %55, i64 %57
  %59 = load ptr, ptr %58, align 8, !tbaa !5
  call void @free_ExpNode(ptr noundef %59)
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct._NormEffect, ptr %60, i32 0, i32 11
  %62 = load ptr, ptr %61, align 8, !tbaa !19
  %63 = load i32, ptr %3, align 4, !tbaa !16
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds ptr, ptr %62, i64 %64
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  call void @free_ExpNode(ptr noundef %66)
  br label %67

67:                                               ; preds = %52
  %68 = load i32, ptr %3, align 4, !tbaa !16
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %3, align 4, !tbaa !16
  br label %46, !llvm.loop !20

70:                                               ; preds = %46
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct._NormEffect, ptr %71, i32 0, i32 10
  %73 = load ptr, ptr %72, align 8, !tbaa !18
  %74 = icmp ne ptr %73, null
  br i1 %74, label %75, label %79

75:                                               ; preds = %70
  %76 = load ptr, ptr %2, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct._NormEffect, ptr %76, i32 0, i32 10
  %78 = load ptr, ptr %77, align 8, !tbaa !18
  call void @free(ptr noundef %78) #3
  br label %79

79:                                               ; preds = %75, %70
  %80 = load ptr, ptr %2, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct._NormEffect, ptr %80, i32 0, i32 11
  %82 = load ptr, ptr %81, align 8, !tbaa !19
  %83 = icmp ne ptr %82, null
  br i1 %83, label %84, label %88

84:                                               ; preds = %79
  %85 = load ptr, ptr %2, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct._NormEffect, ptr %85, i32 0, i32 11
  %87 = load ptr, ptr %86, align 8, !tbaa !19
  call void @free(ptr noundef %87) #3
  br label %88

88:                                               ; preds = %84, %79
  %89 = load ptr, ptr %2, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct._NormEffect, ptr %89, i32 0, i32 13
  %91 = load ptr, ptr %90, align 8, !tbaa !22
  %92 = icmp ne ptr %91, null
  br i1 %92, label %93, label %97

93:                                               ; preds = %88
  %94 = load ptr, ptr %2, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct._NormEffect, ptr %94, i32 0, i32 13
  %96 = load ptr, ptr %95, align 8, !tbaa !22
  call void @free(ptr noundef %96) #3
  br label %97

97:                                               ; preds = %93, %88
  %98 = load ptr, ptr %2, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct._NormEffect, ptr %98, i32 0, i32 14
  %100 = load ptr, ptr %99, align 8, !tbaa !23
  %101 = icmp ne ptr %100, null
  br i1 %101, label %102, label %106

102:                                              ; preds = %97
  %103 = load ptr, ptr %2, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct._NormEffect, ptr %103, i32 0, i32 14
  %105 = load ptr, ptr %104, align 8, !tbaa !23
  call void @free(ptr noundef %105) #3
  br label %106

106:                                              ; preds = %102, %97
  store i32 0, ptr %3, align 4, !tbaa !16
  br label %107

107:                                              ; preds = %121, %106
  %108 = load i32, ptr %3, align 4, !tbaa !16
  %109 = load ptr, ptr %2, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct._NormEffect, ptr %109, i32 0, i32 16
  %111 = load i32, ptr %110, align 8, !tbaa !24
  %112 = icmp slt i32 %108, %111
  br i1 %112, label %113, label %124

113:                                              ; preds = %107
  %114 = load ptr, ptr %2, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct._NormEffect, ptr %114, i32 0, i32 15
  %116 = load ptr, ptr %115, align 8, !tbaa !25
  %117 = load i32, ptr %3, align 4, !tbaa !16
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds ptr, ptr %116, i64 %118
  %120 = load ptr, ptr %119, align 8, !tbaa !5
  call void @free_ExpNode(ptr noundef %120)
  br label %121

121:                                              ; preds = %113
  %122 = load i32, ptr %3, align 4, !tbaa !16
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %3, align 4, !tbaa !16
  br label %107, !llvm.loop !26

124:                                              ; preds = %107
  %125 = load ptr, ptr %2, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct._NormEffect, ptr %125, i32 0, i32 15
  %127 = load ptr, ptr %126, align 8, !tbaa !25
  %128 = icmp ne ptr %127, null
  br i1 %128, label %129, label %133

129:                                              ; preds = %124
  %130 = load ptr, ptr %2, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct._NormEffect, ptr %130, i32 0, i32 15
  %132 = load ptr, ptr %131, align 8, !tbaa !25
  call void @free(ptr noundef %132) #3
  br label %133

133:                                              ; preds = %129, %124
  %134 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %134) #3
  br label %135

135:                                              ; preds = %133, %1
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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, !6, i64 248}
!10 = !{!"_NormEffect", !11, i64 0, !7, i64 4, !7, i64 64, !6, i64 128, !11, i64 136, !6, i64 144, !11, i64 152, !6, i64 160, !11, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !11, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !11, i64 232, !6, i64 240, !6, i64 248}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 128}
!13 = !{!10, !6, i64 144}
!14 = !{!10, !6, i64 160}
!15 = !{!10, !6, i64 176}
!16 = !{!11, !11, i64 0}
!17 = !{!10, !11, i64 200}
!18 = !{!10, !6, i64 184}
!19 = !{!10, !6, i64 192}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!10, !6, i64 208}
!23 = !{!10, !6, i64 216}
!24 = !{!10, !11, i64 232}
!25 = !{!10, !6, i64 224}
!26 = distinct !{!26, !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"

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @free_ExpNode(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @free_NormEffect(ptr noundef %0) local_unnamed_addr #1 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %67, label %2

2:                                                ; preds = %1
  %3 = getelementptr inbounds i8, ptr %0, i64 248
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  tail call void @free_NormEffect(ptr noundef %4)
  %5 = getelementptr inbounds i8, ptr %0, i64 128
  %6 = load ptr, ptr %5, align 8, !tbaa !11
  %.not42 = icmp eq ptr %6, null
  br i1 %.not42, label %8, label %7

7:                                                ; preds = %2
  tail call void @free(ptr noundef nonnull %6) #2
  br label %8

8:                                                ; preds = %7, %2
  %9 = getelementptr inbounds i8, ptr %0, i64 144
  %10 = load ptr, ptr %9, align 8, !tbaa !12
  %.not43 = icmp eq ptr %10, null
  br i1 %.not43, label %12, label %11

11:                                               ; preds = %8
  tail call void @free(ptr noundef nonnull %10) #2
  br label %12

12:                                               ; preds = %11, %8
  %13 = getelementptr inbounds i8, ptr %0, i64 160
  %14 = load ptr, ptr %13, align 8, !tbaa !13
  %.not44 = icmp eq ptr %14, null
  br i1 %.not44, label %16, label %15

15:                                               ; preds = %12
  tail call void @free(ptr noundef nonnull %14) #2
  br label %16

16:                                               ; preds = %15, %12
  %17 = getelementptr inbounds i8, ptr %0, i64 176
  %18 = load ptr, ptr %17, align 8, !tbaa !14
  %.not45 = icmp eq ptr %18, null
  br i1 %.not45, label %20, label %19

19:                                               ; preds = %16
  tail call void @free(ptr noundef nonnull %18) #2
  br label %20

20:                                               ; preds = %19, %16
  %21 = getelementptr inbounds i8, ptr %0, i64 200
  %22 = load i32, ptr %21, align 8, !tbaa !15
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %20
  %24 = getelementptr inbounds i8, ptr %0, i64 184
  %25 = getelementptr inbounds i8, ptr %0, i64 192
  br label %26

26:                                               ; preds = %.lr.ph, %26
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %26 ]
  %27 = load ptr, ptr %24, align 8, !tbaa !16
  %28 = getelementptr inbounds ptr, ptr %27, i64 %indvars.iv
  %29 = load ptr, ptr %28, align 8, !tbaa !17
  tail call void @free_ExpNode(ptr noundef %29)
  %30 = load ptr, ptr %25, align 8, !tbaa !18
  %31 = getelementptr inbounds ptr, ptr %30, i64 %indvars.iv
  %32 = load ptr, ptr %31, align 8, !tbaa !17
  tail call void @free_ExpNode(ptr noundef %32)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %33 = load i32, ptr %21, align 8, !tbaa !15
  %34 = sext i32 %33 to i64
  %35 = icmp slt i64 %indvars.iv.next, %34
  br i1 %35, label %26, label %._crit_edge, !llvm.loop !19

._crit_edge:                                      ; preds = %26, %20
  %36 = getelementptr inbounds i8, ptr %0, i64 184
  %37 = load ptr, ptr %36, align 8, !tbaa !16
  %.not46 = icmp eq ptr %37, null
  br i1 %.not46, label %39, label %38

38:                                               ; preds = %._crit_edge
  tail call void @free(ptr noundef nonnull %37) #2
  br label %39

39:                                               ; preds = %38, %._crit_edge
  %40 = getelementptr inbounds i8, ptr %0, i64 192
  %41 = load ptr, ptr %40, align 8, !tbaa !18
  %.not47 = icmp eq ptr %41, null
  br i1 %.not47, label %43, label %42

42:                                               ; preds = %39
  tail call void @free(ptr noundef nonnull %41) #2
  br label %43

43:                                               ; preds = %42, %39
  %44 = getelementptr inbounds i8, ptr %0, i64 208
  %45 = load ptr, ptr %44, align 8, !tbaa !21
  %.not48 = icmp eq ptr %45, null
  br i1 %.not48, label %47, label %46

46:                                               ; preds = %43
  tail call void @free(ptr noundef nonnull %45) #2
  br label %47

47:                                               ; preds = %46, %43
  %48 = getelementptr inbounds i8, ptr %0, i64 216
  %49 = load ptr, ptr %48, align 8, !tbaa !22
  %.not49 = icmp eq ptr %49, null
  br i1 %.not49, label %51, label %50

50:                                               ; preds = %47
  tail call void @free(ptr noundef nonnull %49) #2
  br label %51

51:                                               ; preds = %50, %47
  %52 = getelementptr inbounds i8, ptr %0, i64 232
  %53 = load i32, ptr %52, align 8, !tbaa !23
  %54 = icmp sgt i32 %53, 0
  br i1 %54, label %.lr.ph54, label %._crit_edge55

.lr.ph54:                                         ; preds = %51
  %55 = getelementptr inbounds i8, ptr %0, i64 224
  br label %56

56:                                               ; preds = %.lr.ph54, %56
  %indvars.iv57 = phi i64 [ 0, %.lr.ph54 ], [ %indvars.iv.next58, %56 ]
  %57 = load ptr, ptr %55, align 8, !tbaa !24
  %58 = getelementptr inbounds ptr, ptr %57, i64 %indvars.iv57
  %59 = load ptr, ptr %58, align 8, !tbaa !17
  tail call void @free_ExpNode(ptr noundef %59)
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %60 = load i32, ptr %52, align 8, !tbaa !23
  %61 = sext i32 %60 to i64
  %62 = icmp slt i64 %indvars.iv.next58, %61
  br i1 %62, label %56, label %._crit_edge55, !llvm.loop !25

._crit_edge55:                                    ; preds = %56, %51
  %63 = getelementptr inbounds i8, ptr %0, i64 224
  %64 = load ptr, ptr %63, align 8, !tbaa !24
  %.not50 = icmp eq ptr %64, null
  br i1 %.not50, label %66, label %65

65:                                               ; preds = %._crit_edge55
  tail call void @free(ptr noundef nonnull %64) #2
  br label %66

66:                                               ; preds = %65, %._crit_edge55
  tail call void @free(ptr noundef nonnull %0) #2
  br label %67

67:                                               ; preds = %66, %1
  ret void
}

attributes #0 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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, !10, i64 248}
!6 = !{!"_NormEffect", !7, i64 0, !8, i64 4, !8, i64 64, !10, i64 128, !7, i64 136, !10, i64 144, !7, i64 152, !10, i64 160, !7, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !7, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !7, i64 232, !10, i64 240, !10, i64 248}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 128}
!12 = !{!6, !10, i64 144}
!13 = !{!6, !10, i64 160}
!14 = !{!6, !10, i64 176}
!15 = !{!6, !7, i64 200}
!16 = !{!6, !10, i64 184}
!17 = !{!10, !10, i64 0}
!18 = !{!6, !10, i64 192}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!6, !10, i64 208}
!22 = !{!6, !10, i64 216}
!23 = !{!6, !7, i64 232}
!24 = !{!6, !10, i64 224}
!25 = distinct !{!25, !20}


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