; LLVM IR from AlgoGenesis/C :: Recursion/VoseAlias (VoseAlias)

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @initAliasTable(i32 noundef) #0

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @buildAliasTableRecursively(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local ptr @createAliasTable(ptr noundef %0, i32 noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %11 = load i32, ptr %4, align 4, !tbaa !9
  %12 = call ptr @initAliasTable(i32 noundef %11)
  store ptr %12, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %13 = load i32, ptr %4, align 4, !tbaa !9
  %14 = sext i32 %13 to i64
  %15 = mul i64 %14, 4
  %16 = call noalias ptr @malloc(i64 noundef %15) #5
  store ptr %16, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %17 = load i32, ptr %4, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = mul i64 %18, 4
  %20 = call noalias ptr @malloc(i64 noundef %19) #5
  store ptr %20, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %51, %2
  %22 = load i32, ptr %10, align 4, !tbaa !9
  %23 = load i32, ptr %4, align 4, !tbaa !9
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %54

26:                                               ; preds = %21
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = load i32, ptr %10, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds double, ptr %27, i64 %29
  %31 = load double, ptr %30, align 8, !tbaa !11
  %32 = load i32, ptr %4, align 4, !tbaa !9
  %33 = sitofp i32 %32 to double
  %34 = fdiv double 1.000000e+00, %33
  %35 = fcmp olt double %31, %34
  br i1 %35, label %36, label %43

36:                                               ; preds = %26
  %37 = load i32, ptr %10, align 4, !tbaa !9
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = load i32, ptr %8, align 4, !tbaa !9
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %8, align 4, !tbaa !9
  %41 = sext i32 %39 to i64
  %42 = getelementptr inbounds i32, ptr %38, i64 %41
  store i32 %37, ptr %42, align 4, !tbaa !9
  br label %50

43:                                               ; preds = %26
  %44 = load i32, ptr %10, align 4, !tbaa !9
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = load i32, ptr %9, align 4, !tbaa !9
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %9, align 4, !tbaa !9
  %48 = sext i32 %46 to i64
  %49 = getelementptr inbounds i32, ptr %45, i64 %48
  store i32 %44, ptr %49, align 4, !tbaa !9
  br label %50

50:                                               ; preds = %43, %36
  br label %51

51:                                               ; preds = %50
  %52 = load i32, ptr %10, align 4, !tbaa !9
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %10, align 4, !tbaa !9
  br label %21, !llvm.loop !13

54:                                               ; preds = %25
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  call void @buildAliasTableRecursively(ptr noundef %55, ptr noundef %56, ptr noundef %8, ptr noundef %9, ptr noundef %57, ptr noundef %58)
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  call void @free(ptr noundef %59) #4
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %60) #4
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret ptr %61
}

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind allocsize(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 "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 }
attributes #5 = { nounwind allocsize(0) }

!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 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

; Function Attrs: nounwind uwtable
declare dso_local ptr @initAliasTable(i32 noundef) local_unnamed_addr #0

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @buildAliasTableRecursively(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local ptr @createAliasTable(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = tail call ptr @initAliasTable(i32 noundef %1)
  %6 = sext i32 %1 to i64
  %7 = shl nsw i64 %6, 2
  %8 = tail call noalias ptr @malloc(i64 noundef %7) #4
  %9 = tail call noalias ptr @malloc(i64 noundef %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  %10 = icmp sgt i32 %1, 0
  br i1 %10, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2
  %11 = uitofp nneg i32 %1 to double
  %12 = fdiv double 1.000000e+00, %11
  %wide.trip.count = zext nneg i32 %1 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %13 = icmp eq i32 %1, 1
  br i1 %13, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %26

._crit_edge.loopexit.unr-lcssa:                   ; preds = %50, %.lr.ph
  %.lcssa34.ph = phi i32 [ poison, %.lr.ph ], [ %51, %50 ]
  %.lcssa33.ph = phi i32 [ poison, %.lr.ph ], [ %52, %50 ]
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next.1, %50 ]
  %.unr = phi i32 [ 0, %.lr.ph ], [ %52, %50 ]
  %.unr35 = phi i32 [ 0, %.lr.ph ], [ %51, %50 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.loopexit.unr-lcssa
  %14 = getelementptr inbounds double, ptr %0, i64 %indvars.iv.unr
  %15 = load double, ptr %14, align 8, !tbaa !5
  %16 = fcmp olt double %15, %12
  %17 = trunc nuw nsw i64 %indvars.iv.unr to i32
  br i1 %16, label %20, label %18

18:                                               ; preds = %.epil.preheader
  %19 = add nsw i32 %.unr, 1
  br label %._crit_edge.loopexit.epilog-lcssa

20:                                               ; preds = %.epil.preheader
  %21 = add nsw i32 %.unr35, 1
  br label %._crit_edge.loopexit.epilog-lcssa

._crit_edge.loopexit.epilog-lcssa:                ; preds = %20, %18
  %.sink.epil = phi i32 [ %.unr35, %20 ], [ %.unr, %18 ]
  %.sink29.epil = phi ptr [ %8, %20 ], [ %9, %18 ]
  %22 = phi i32 [ %21, %20 ], [ %.unr35, %18 ]
  %23 = phi i32 [ %.unr, %20 ], [ %19, %18 ]
  %24 = sext i32 %.sink.epil to i64
  %25 = getelementptr inbounds i32, ptr %.sink29.epil, i64 %24
  store i32 %17, ptr %25, align 4, !tbaa !9
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.epilog-lcssa, %._crit_edge.loopexit.unr-lcssa, %2
  %.lcssa21 = phi i32 [ 0, %2 ], [ %.lcssa34.ph, %._crit_edge.loopexit.unr-lcssa ], [ %22, %._crit_edge.loopexit.epilog-lcssa ]
  %.lcssa = phi i32 [ 0, %2 ], [ %.lcssa33.ph, %._crit_edge.loopexit.unr-lcssa ], [ %23, %._crit_edge.loopexit.epilog-lcssa ]
  store i32 %.lcssa, ptr %4, align 4, !tbaa !9
  store i32 %.lcssa21, ptr %3, align 4, !tbaa !9
  call void @buildAliasTableRecursively(ptr noundef %8, ptr noundef %9, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef %5, ptr noundef %0)
  call void @free(ptr noundef %8) #5
  call void @free(ptr noundef %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  ret ptr %5

26:                                               ; preds = %50, %.lr.ph.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.new ], [ %indvars.iv.next.1, %50 ]
  %27 = phi i32 [ 0, %.lr.ph.new ], [ %52, %50 ]
  %28 = phi i32 [ 0, %.lr.ph.new ], [ %51, %50 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %50 ]
  %29 = getelementptr inbounds double, ptr %0, i64 %indvars.iv
  %30 = load double, ptr %29, align 8, !tbaa !5
  %31 = fcmp olt double %30, %12
  %32 = trunc nuw nsw i64 %indvars.iv to i32
  br i1 %31, label %33, label %35

33:                                               ; preds = %26
  %34 = add nsw i32 %28, 1
  br label %37

35:                                               ; preds = %26
  %36 = add nsw i32 %27, 1
  br label %37

37:                                               ; preds = %33, %35
  %.sink = phi i32 [ %28, %33 ], [ %27, %35 ]
  %.sink29 = phi ptr [ %8, %33 ], [ %9, %35 ]
  %38 = phi i32 [ %34, %33 ], [ %28, %35 ]
  %39 = phi i32 [ %27, %33 ], [ %36, %35 ]
  %40 = sext i32 %.sink to i64
  %41 = getelementptr inbounds i32, ptr %.sink29, i64 %40
  store i32 %32, ptr %41, align 4, !tbaa !9
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %42 = getelementptr inbounds double, ptr %0, i64 %indvars.iv.next
  %43 = load double, ptr %42, align 8, !tbaa !5
  %44 = fcmp olt double %43, %12
  %45 = trunc nuw nsw i64 %indvars.iv.next to i32
  br i1 %44, label %48, label %46

46:                                               ; preds = %37
  %47 = add nsw i32 %39, 1
  br label %50

48:                                               ; preds = %37
  %49 = add nsw i32 %38, 1
  br label %50

50:                                               ; preds = %48, %46
  %.sink.1 = phi i32 [ %38, %48 ], [ %39, %46 ]
  %.sink29.1 = phi ptr [ %8, %48 ], [ %9, %46 ]
  %51 = phi i32 [ %49, %48 ], [ %38, %46 ]
  %52 = phi i32 [ %39, %48 ], [ %47, %46 ]
  %53 = sext i32 %.sink.1 to i64
  %54 = getelementptr inbounds i32, ptr %.sink29.1, i64 %53
  store i32 %45, ptr %54, align 4, !tbaa !9
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %26, !llvm.loop !11
}

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) 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 #3 = { 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 #4 = { nounwind allocsize(0) }
attributes #5 = { 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 = !{!"double", !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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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