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

@stdout = external global ptr, align 8
@.str = external hidden unnamed_addr constant [28 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [77 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #3

; 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 ptr @new_NormEffect1(ptr noundef %0) #4 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %5 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 256) #6
  store ptr %5, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  %7 = icmp eq ptr null, %6
  br i1 %7, label %8, label %11

8:                                                ; preds = %1
  %9 = load ptr, ptr @stdout, align 8, !tbaa !5
  %10 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %9, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 496) #5
  call void @exit(i32 noundef 1) #7
  unreachable

11:                                               ; preds = %1
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct._Effect, ptr %12, i32 0, i32 0
  %14 = load i32, ptr %13, align 8, !tbaa !9
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct._NormEffect, ptr %15, i32 0, i32 0
  store i32 %14, ptr %16, align 8, !tbaa !12
  store i32 0, ptr %3, align 4, !tbaa !14
  br label %17

17:                                               ; preds = %40, %11
  %18 = load i32, ptr %3, align 4, !tbaa !14
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct._Effect, ptr %19, i32 0, i32 0
  %21 = load i32, ptr %20, align 8, !tbaa !9
  %22 = icmp slt i32 %18, %21
  br i1 %22, label %23, label %43

23:                                               ; preds = %17
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._Effect, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %3, align 4, !tbaa !14
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [15 x i32], ptr %25, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !14
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct._NormEffect, ptr %30, i32 0, i32 1
  %32 = load i32, ptr %3, align 4, !tbaa !14
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [15 x i32], ptr %31, i64 0, i64 %33
  store i32 %29, ptr %34, align 4, !tbaa !14
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct._NormEffect, ptr %35, i32 0, i32 2
  %37 = load i32, ptr %3, align 4, !tbaa !14
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [15 x i32], ptr %36, i64 0, i64 %38
  store i32 -1, ptr %39, align 4, !tbaa !14
  br label %40

40:                                               ; preds = %23
  %41 = load i32, ptr %3, align 4, !tbaa !14
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %3, align 4, !tbaa !14
  br label %17, !llvm.loop !15

43:                                               ; preds = %17
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct._NormEffect, ptr %44, i32 0, i32 3
  store ptr null, ptr %45, align 8, !tbaa !17
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct._NormEffect, ptr %46, i32 0, i32 4
  store i32 0, ptr %47, align 8, !tbaa !18
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct._NormEffect, ptr %48, i32 0, i32 5
  store ptr null, ptr %49, align 8, !tbaa !19
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._NormEffect, ptr %50, i32 0, i32 6
  store i32 0, ptr %51, align 8, !tbaa !20
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct._NormEffect, ptr %52, i32 0, i32 7
  store ptr null, ptr %53, align 8, !tbaa !21
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct._NormEffect, ptr %54, i32 0, i32 8
  store i32 0, ptr %55, align 8, !tbaa !22
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._NormEffect, ptr %56, i32 0, i32 9
  store ptr null, ptr %57, align 8, !tbaa !23
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct._NormEffect, ptr %58, i32 0, i32 10
  store ptr null, ptr %59, align 8, !tbaa !24
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct._NormEffect, ptr %60, i32 0, i32 11
  store ptr null, ptr %61, align 8, !tbaa !25
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct._NormEffect, ptr %62, i32 0, i32 12
  store i32 0, ptr %63, align 8, !tbaa !26
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct._NormEffect, ptr %64, i32 0, i32 13
  store ptr null, ptr %65, align 8, !tbaa !27
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct._NormEffect, ptr %66, i32 0, i32 14
  store ptr null, ptr %67, align 8, !tbaa !28
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._NormEffect, ptr %68, i32 0, i32 15
  store ptr null, ptr %69, align 8, !tbaa !29
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct._NormEffect, ptr %70, i32 0, i32 16
  store i32 0, ptr %71, align 8, !tbaa !30
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct._NormEffect, ptr %72, i32 0, i32 18
  store ptr null, ptr %73, align 8, !tbaa !31
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct._NormEffect, ptr %74, i32 0, i32 17
  store ptr null, ptr %75, align 8, !tbaa !32
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  ret ptr %76
}

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


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

@stdout = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [28 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [77 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local noalias noundef ptr @new_NormEffect1(ptr nocapture noundef readonly %0) local_unnamed_addr #3 {
  %2 = tail call noalias dereferenceable_or_null(256) ptr @calloc(i64 noundef 1, i64 noundef 256) #5
  %3 = icmp eq ptr %2, null
  br i1 %3, label %4, label %7

4:                                                ; preds = %1
  %5 = load ptr, ptr @stdout, align 8, !tbaa !5
  %6 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %5, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 496) #6
  tail call void @exit(i32 noundef 1) #7
  unreachable

7:                                                ; preds = %1
  %8 = load i32, ptr %0, align 8, !tbaa !9
  store i32 %8, ptr %2, align 8, !tbaa !12
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %7
  %10 = getelementptr inbounds i8, ptr %0, i64 4
  %11 = getelementptr inbounds i8, ptr %2, i64 4
  %12 = getelementptr inbounds i8, ptr %2, i64 64
  %wide.trip.count = zext nneg i32 %8 to i64
  %min.iters.check = icmp ult i32 %8, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.vec = and i64 %wide.trip.count, 2147483644
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %13 = getelementptr inbounds [15 x i32], ptr %10, i64 0, i64 %index
  %wide.load = load <4 x i32>, ptr %13, align 4, !tbaa !14
  %14 = getelementptr inbounds [15 x i32], ptr %11, i64 0, i64 %index
  store <4 x i32> %wide.load, ptr %14, align 4, !tbaa !14
  %15 = getelementptr inbounds [15 x i32], ptr %12, i64 0, i64 %index
  store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, ptr %15, align 4, !tbaa !14
  %index.next = add nuw i64 %index, 4
  %16 = icmp eq i64 %index.next, %n.vec
  br i1 %16, label %middle.block, label %vector.body, !llvm.loop !15

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph ], [ %n.vec, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %17 = getelementptr inbounds [15 x i32], ptr %10, i64 0, i64 %indvars.iv
  %18 = load i32, ptr %17, align 4, !tbaa !14
  %19 = getelementptr inbounds [15 x i32], ptr %11, i64 0, i64 %indvars.iv
  store i32 %18, ptr %19, align 4, !tbaa !14
  %20 = getelementptr inbounds [15 x i32], ptr %12, i64 0, i64 %indvars.iv
  store i32 -1, ptr %20, align 4, !tbaa !14
  %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 %scalar.ph, !llvm.loop !19

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %7
  %21 = getelementptr inbounds i8, ptr %2, i64 136
  store i32 0, ptr %21, align 8, !tbaa !20
  %22 = getelementptr inbounds i8, ptr %2, i64 152
  store i32 0, ptr %22, align 8, !tbaa !21
  %23 = getelementptr inbounds i8, ptr %2, i64 168
  store i32 0, ptr %23, align 8, !tbaa !22
  %24 = getelementptr inbounds i8, ptr %2, i64 176
  %25 = getelementptr inbounds i8, ptr %2, i64 208
  %26 = getelementptr inbounds i8, ptr %2, i64 240
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(28) %24, i8 0, i64 28, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(28) %25, i8 0, i64 28, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %26, i8 0, i64 16, i1 false)
  ret ptr %2
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(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 = { nofree 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 = { noreturn 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 #3 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind allocsize(0,1) }
attributes #6 = { nounwind }
attributes #7 = { noreturn 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, !11, i64 0}
!10 = !{!"_Effect", !11, i64 0, !7, i64 4, !7, i64 64, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 0}
!13 = !{!"_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}
!14 = !{!11, !11, i64 0}
!15 = distinct !{!15, !16, !17, !18}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!"llvm.loop.isvectorized", i32 1}
!18 = !{!"llvm.loop.unroll.runtime.disable"}
!19 = distinct !{!19, !16, !18, !17}
!20 = !{!13, !11, i64 136}
!21 = !{!13, !11, i64 152}
!22 = !{!13, !11, i64 168}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass