; LLVM IR from whatliesbeyond/Power-Control-for-Wireless-Sensor-Networks :: PCRA (shortpath)

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

@mxNo = external dso_local global i32, align 4

; 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
declare dso_local i32 @allselected(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @shortpath(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca [400 x i32], align 16
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %15 = load i32, ptr @mxNo, align 4, !tbaa !9
  %16 = zext i32 %15 to i64
  call void @llvm.lifetime.start.p0(i64 1600, ptr %7) #3
  %17 = getelementptr inbounds [400 x i32], ptr %7, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %17, i8 0, i64 1600, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %27, %3
  %19 = load i32, ptr %9, align 4, !tbaa !9
  %20 = load i32, ptr @mxNo, align 4, !tbaa !9
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %22, label %30

22:                                               ; preds = %18
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = load i32, ptr %9, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds float, ptr %23, i64 %25
  store float 9.999900e+04, ptr %26, align 4, !tbaa !11
  br label %27

27:                                               ; preds = %22
  %28 = load i32, ptr %9, align 4, !tbaa !9
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %9, align 4, !tbaa !9
  br label %18, !llvm.loop !13

30:                                               ; preds = %18
  %31 = load i32, ptr %8, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [400 x i32], ptr %7, i64 0, i64 %32
  store i32 1, ptr %33, align 4, !tbaa !9
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds float, ptr %34, i64 0
  store float 0.000000e+00, ptr %35, align 4, !tbaa !11
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %36 = getelementptr inbounds [400 x i32], ptr %7, i64 0, i64 0
  %37 = call i32 @allselected(ptr noundef %36)
  store i32 %37, ptr %14, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %114, %30
  %39 = load i32, ptr %14, align 4, !tbaa !9
  %40 = load i32, ptr @mxNo, align 4, !tbaa !9
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  br label %117

43:                                               ; preds = %38
  store float 9.999900e+04, ptr %13, align 4, !tbaa !11
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = load i32, ptr %8, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds float, ptr %44, i64 %46
  %48 = load float, ptr %47, align 4, !tbaa !11
  store float %48, ptr %12, align 4, !tbaa !11
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %49

49:                                               ; preds = %106, %43
  %50 = load i32, ptr %9, align 4, !tbaa !9
  %51 = load i32, ptr @mxNo, align 4, !tbaa !9
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %53, label %109

53:                                               ; preds = %49
  %54 = load i32, ptr %9, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [400 x i32], ptr %7, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !9
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %105

59:                                               ; preds = %53
  %60 = load float, ptr %12, align 4, !tbaa !11
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = load i32, ptr %8, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = mul nsw i64 %63, %16
  %65 = getelementptr inbounds float, ptr %61, i64 %64
  %66 = load i32, ptr %9, align 4, !tbaa !9
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds float, ptr %65, i64 %67
  %69 = load float, ptr %68, align 4, !tbaa !11
  %70 = fadd float %60, %69
  store float %70, ptr %11, align 4, !tbaa !11
  %71 = load float, ptr %11, align 4, !tbaa !11
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = load i32, ptr %9, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds float, ptr %72, i64 %74
  %76 = load float, ptr %75, align 4, !tbaa !11
  %77 = fcmp olt float %71, %76
  br i1 %77, label %78, label %89

78:                                               ; preds = %59
  %79 = load float, ptr %11, align 4, !tbaa !11
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = load i32, ptr %9, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds float, ptr %80, i64 %82
  store float %79, ptr %83, align 4, !tbaa !11
  %84 = load i32, ptr %8, align 4, !tbaa !9
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = load i32, ptr %9, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds i32, ptr %85, i64 %87
  store i32 %84, ptr %88, align 4, !tbaa !9
  br label %89

89:                                               ; preds = %78, %59
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = load i32, ptr %9, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds float, ptr %90, i64 %92
  %94 = load float, ptr %93, align 4, !tbaa !11
  %95 = load float, ptr %13, align 4, !tbaa !11
  %96 = fcmp olt float %94, %95
  br i1 %96, label %97, label %104

97:                                               ; preds = %89
  %98 = load ptr, ptr %6, align 8, !tbaa !5
  %99 = load i32, ptr %9, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds float, ptr %98, i64 %100
  %102 = load float, ptr %101, align 4, !tbaa !11
  store float %102, ptr %13, align 4, !tbaa !11
  %103 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %103, ptr %10, align 4, !tbaa !9
  br label %104

104:                                              ; preds = %97, %89
  br label %105

105:                                              ; preds = %104, %53
  br label %106

106:                                              ; preds = %105
  %107 = load i32, ptr %9, align 4, !tbaa !9
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %9, align 4, !tbaa !9
  br label %49, !llvm.loop !15

109:                                              ; preds = %49
  %110 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %110, ptr %8, align 4, !tbaa !9
  %111 = load i32, ptr %8, align 4, !tbaa !9
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [400 x i32], ptr %7, i64 0, i64 %112
  store i32 1, ptr %113, align 4, !tbaa !9
  br label %114

114:                                              ; preds = %109
  %115 = load i32, ptr %14, align 4, !tbaa !9
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %14, align 4, !tbaa !9
  br label %38, !llvm.loop !16

117:                                              ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 1600, ptr %7) #3
  ret void
}

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

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


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

@mxNo = external dso_local local_unnamed_addr global i32, align 4

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @shortpath(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef %2) local_unnamed_addr #1 {
  %4 = alloca [400 x i32], align 16
  %5 = load i32, ptr @mxNo, align 4, !tbaa !5
  %6 = zext i32 %5 to i64
  call void @llvm.lifetime.start.p0(i64 1600, ptr nonnull %4) #3
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1600) %4, i8 0, i64 1600, i1 false)
  %7 = icmp sgt i32 %5, 0
  br i1 %7, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %3
  %min.iters.check = icmp ult i32 %5, 8
  br i1 %min.iters.check, label %.lr.ph.preheader59, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %6, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %8 = getelementptr inbounds float, ptr %2, i64 %index
  %9 = getelementptr inbounds i8, ptr %8, i64 16
  store <4 x float> <float 9.999900e+04, float 9.999900e+04, float 9.999900e+04, float 9.999900e+04>, ptr %8, align 4, !tbaa !9
  store <4 x float> <float 9.999900e+04, float 9.999900e+04, float 9.999900e+04, float 9.999900e+04>, ptr %9, align 4, !tbaa !9
  %index.next = add nuw i64 %index, 8
  %10 = icmp eq i64 %index.next, %n.vec
  br i1 %10, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %6
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader59

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

.lr.ph:                                           ; preds = %.lr.ph.preheader59, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader59 ]
  %11 = getelementptr inbounds float, ptr %2, i64 %indvars.iv
  store float 9.999900e+04, ptr %11, align 4, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %6
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !15

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %3
  store i32 1, ptr %4, align 16, !tbaa !5
  store float 0.000000e+00, ptr %2, align 4, !tbaa !9
  %12 = call i32 @allselected(ptr noundef nonnull %4)
  %13 = load i32, ptr @mxNo, align 4, !tbaa !5
  %14 = icmp slt i32 %12, %13
  %15 = icmp sgt i32 %13, 0
  %or.cond = and i1 %14, %15
  br i1 %or.cond, label %.lr.ph52.split, label %._crit_edge53

._crit_edge53:                                    ; preds = %._crit_edge47, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 1600, ptr nonnull %4) #3
  ret void

.lr.ph52.split:                                   ; preds = %._crit_edge, %._crit_edge47
  %16 = phi i32 [ %45, %._crit_edge47 ], [ %13, %._crit_edge ]
  %.050 = phi i32 [ %48, %._crit_edge47 ], [ %12, %._crit_edge ]
  %.03449 = phi i32 [ %.138.lcssa, %._crit_edge47 ], [ 0, %._crit_edge ]
  %.03748 = phi i32 [ %.138.lcssa, %._crit_edge47 ], [ undef, %._crit_edge ]
  %17 = sext i32 %.03449 to i64
  %18 = getelementptr inbounds float, ptr %2, i64 %17
  %19 = load float, ptr %18, align 4, !tbaa !9
  %20 = icmp sgt i32 %16, 0
  br i1 %20, label %.lr.ph46, label %._crit_edge47

.lr.ph46:                                         ; preds = %.lr.ph52.split
  %21 = mul nsw i64 %17, %6
  %22 = getelementptr inbounds float, ptr %0, i64 %21
  br label %23

23:                                               ; preds = %.lr.ph46, %41
  %indvars.iv56 = phi i64 [ 0, %.lr.ph46 ], [ %indvars.iv.next57, %41 ]
  %.03344 = phi float [ 9.999900e+04, %.lr.ph46 ], [ %.1, %41 ]
  %.13842 = phi i32 [ %.03748, %.lr.ph46 ], [ %.2, %41 ]
  %24 = getelementptr inbounds [400 x i32], ptr %4, i64 0, i64 %indvars.iv56
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %41

27:                                               ; preds = %23
  %28 = getelementptr inbounds float, ptr %22, i64 %indvars.iv56
  %29 = load float, ptr %28, align 4, !tbaa !9
  %30 = fadd float %19, %29
  %31 = getelementptr inbounds float, ptr %2, i64 %indvars.iv56
  %32 = load float, ptr %31, align 4, !tbaa !9
  %33 = fcmp olt float %30, %32
  br i1 %33, label %34, label %36

34:                                               ; preds = %27
  store float %30, ptr %31, align 4, !tbaa !9
  %35 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv56
  store i32 %.03449, ptr %35, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %34, %27
  %37 = phi float [ %30, %34 ], [ %32, %27 ]
  %38 = fcmp olt float %37, %.03344
  br i1 %38, label %39, label %41

39:                                               ; preds = %36
  %40 = trunc nuw nsw i64 %indvars.iv56 to i32
  br label %41

41:                                               ; preds = %23, %39, %36
  %.2 = phi i32 [ %40, %39 ], [ %.13842, %36 ], [ %.13842, %23 ]
  %.1 = phi float [ %37, %39 ], [ %.03344, %36 ], [ %.03344, %23 ]
  %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
  %42 = load i32, ptr @mxNo, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = icmp slt i64 %indvars.iv.next57, %43
  br i1 %44, label %23, label %._crit_edge47, !llvm.loop !16

._crit_edge47:                                    ; preds = %41, %.lr.ph52.split
  %45 = phi i32 [ %16, %.lr.ph52.split ], [ %42, %41 ]
  %.138.lcssa = phi i32 [ %.03748, %.lr.ph52.split ], [ %.2, %41 ]
  %46 = sext i32 %.138.lcssa to i64
  %47 = getelementptr inbounds [400 x i32], ptr %4, i64 0, i64 %46
  store i32 1, ptr %47, align 4, !tbaa !5
  %48 = add nsw i32 %.050, 1
  %49 = icmp slt i32 %48, %45
  br i1 %49, label %.lr.ph52.split, label %._crit_edge53, !llvm.loop !17
}

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

attributes #0 = { mustprogress 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !14, !13}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12, !18}
!18 = !{!"llvm.loop.unswitch.partial.disable"}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass