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

@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_NormOperator(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 320) #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 611) #5
  call void @exit(i32 noundef 1) #7
  unreachable

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

20:                                               ; preds = %43, %11
  %21 = load i32, ptr %3, align 4, !tbaa !15
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct._Operator, ptr %22, i32 0, i32 4
  %24 = load i32, ptr %23, align 8, !tbaa !12
  %25 = icmp slt i32 %21, %24
  br i1 %25, label %26, label %46

26:                                               ; preds = %20
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct._Operator, ptr %27, i32 0, i32 5
  %29 = load i32, ptr %3, align 4, !tbaa !15
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [15 x i32], ptr %28, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !15
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._NormOperator, ptr %33, i32 0, i32 2
  %35 = load i32, ptr %3, align 4, !tbaa !15
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [15 x i32], ptr %34, i64 0, i64 %36
  store i32 %32, ptr %37, align 4, !tbaa !15
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct._NormOperator, ptr %38, i32 0, i32 3
  %40 = load i32, ptr %3, align 4, !tbaa !15
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [15 x i32], ptr %39, i64 0, i64 %41
  store i32 -1, ptr %42, align 4, !tbaa !15
  br label %43

43:                                               ; preds = %26
  %44 = load i32, ptr %3, align 4, !tbaa !15
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %3, align 4, !tbaa !15
  br label %20, !llvm.loop !16

46:                                               ; preds = %20
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct._NormOperator, ptr %47, i32 0, i32 5
  store i32 0, ptr %48, align 8, !tbaa !18
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct._NormOperator, ptr %49, i32 0, i32 7
  store ptr null, ptr %50, align 8, !tbaa !19
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct._NormOperator, ptr %51, i32 0, i32 8
  store i32 0, ptr %52, align 8, !tbaa !20
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct._NormOperator, ptr %53, i32 0, i32 9
  store ptr null, ptr %54, align 8, !tbaa !21
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct._NormOperator, ptr %55, i32 0, i32 10
  store ptr null, ptr %56, align 8, !tbaa !22
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct._NormOperator, ptr %57, i32 0, i32 11
  store ptr null, ptr %58, align 8, !tbaa !23
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct._NormOperator, ptr %59, i32 0, i32 12
  store i32 0, ptr %60, align 8, !tbaa !24
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct._NormOperator, ptr %61, i32 0, i32 13
  store ptr null, ptr %62, align 8, !tbaa !25
  %63 = 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 %63
}

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, !6, i64 0}
!10 = !{!"_NormOperator", !6, i64 0, !11, i64 8, !7, i64 12, !7, i64 72, !7, i64 132, !11, i64 192, !7, i64 196, !6, i64 256, !11, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !11, i64 296, !6, i64 304, !7, i64 312}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 136}
!13 = !{!"_Operator", !6, i64 0, !7, i64 8, !11, i64 128, !7, i64 132, !11, i64 136, !7, i64 140, !7, i64 200, !6, i64 216, !6, i64 224, !7, i64 232}
!14 = !{!10, !11, i64 8}
!15 = !{!11, !11, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!10, !11, i64 192}
!19 = !{!10, !6, i64 256}
!20 = !{!10, !11, i64 264}
!21 = !{!10, !6, i64 272}
!22 = !{!10, !6, i64 280}
!23 = !{!10, !6, i64 288}
!24 = !{!10, !11, i64 296}
!25 = !{!10, !6, i64 304}


; 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_NormOperator(ptr noundef %0) local_unnamed_addr #3 {
  %2 = tail call noalias dereferenceable_or_null(320) ptr @calloc(i64 noundef 1, i64 noundef 320) #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 611) #6
  tail call void @exit(i32 noundef 1) #7
  unreachable

7:                                                ; preds = %1
  store ptr %0, ptr %2, align 8, !tbaa !9
  %8 = getelementptr inbounds i8, ptr %0, i64 136
  %9 = load i32, ptr %8, align 8, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %2, i64 8
  store i32 %9, ptr %10, align 8, !tbaa !14
  %11 = icmp sgt i32 %9, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %7
  %12 = getelementptr inbounds i8, ptr %0, i64 140
  %13 = getelementptr inbounds i8, ptr %2, i64 12
  %14 = getelementptr inbounds i8, ptr %2, i64 72
  %wide.trip.count = zext nneg i32 %9 to i64
  %min.iters.check = icmp ult i32 %9, 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 ]
  %15 = getelementptr inbounds [15 x i32], ptr %12, i64 0, i64 %index
  %wide.load = load <4 x i32>, ptr %15, align 4, !tbaa !15
  %16 = getelementptr inbounds [15 x i32], ptr %13, i64 0, i64 %index
  store <4 x i32> %wide.load, ptr %16, align 4, !tbaa !15
  %17 = getelementptr inbounds [15 x i32], ptr %14, i64 0, i64 %index
  store <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>, ptr %17, align 4, !tbaa !15
  %index.next = add nuw i64 %index, 4
  %18 = icmp eq i64 %index.next, %n.vec
  br i1 %18, label %middle.block, label %vector.body, !llvm.loop !16

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 ]
  %19 = getelementptr inbounds [15 x i32], ptr %12, i64 0, i64 %indvars.iv
  %20 = load i32, ptr %19, align 4, !tbaa !15
  %21 = getelementptr inbounds [15 x i32], ptr %13, i64 0, i64 %indvars.iv
  store i32 %20, ptr %21, align 4, !tbaa !15
  %22 = getelementptr inbounds [15 x i32], ptr %14, i64 0, i64 %indvars.iv
  store i32 -1, ptr %22, align 4, !tbaa !15
  %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 !20

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %7
  %23 = getelementptr inbounds i8, ptr %2, i64 192
  store i32 0, ptr %23, align 8, !tbaa !21
  %24 = getelementptr inbounds i8, ptr %2, i64 264
  store i32 0, ptr %24, align 8, !tbaa !22
  %25 = getelementptr inbounds i8, ptr %2, i64 272
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(28) %25, i8 0, i64 28, 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, !6, i64 0}
!10 = !{!"_NormOperator", !6, i64 0, !11, i64 8, !7, i64 12, !7, i64 72, !7, i64 132, !11, i64 192, !7, i64 196, !6, i64 256, !11, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !11, i64 296, !6, i64 304, !7, i64 312}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 136}
!13 = !{!"_Operator", !6, i64 0, !7, i64 8, !11, i64 128, !7, i64 132, !11, i64 136, !7, i64 140, !7, i64 200, !6, i64 216, !6, i64 224, !7, i64 232}
!14 = !{!10, !11, i64 8}
!15 = !{!11, !11, i64 0}
!16 = distinct !{!16, !17, !18, !19}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!"llvm.loop.isvectorized", i32 1}
!19 = !{!"llvm.loop.unroll.runtime.disable"}
!20 = distinct !{!20, !17, !19, !18}
!21 = !{!10, !11, i64 192}
!22 = !{!10, !11, i64 264}


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