; LLVM IR from bondhugula/pluto :: orio-0.1.0/testsuite (polysyn_profiling)

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

@L = external dso_local global [500 x [500 x double]], align 16
@U = external dso_local global [500 x [500 x double]], align 16
@A = external dso_local global [500 x [500 x double]], align 16

; Function Attrs: nounwind uwtable
define dso_local void @init_array() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %4

4:                                                ; preds = %28, %0
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = icmp slt i32 %5, 500
  br i1 %6, label %7, label %31

7:                                                ; preds = %4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %8

8:                                                ; preds = %24, %7
  %9 = load i32, ptr %2, align 4, !tbaa !5
  %10 = icmp slt i32 %9, 500
  br i1 %10, label %11, label %27

11:                                               ; preds = %8
  %12 = load i32, ptr %1, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [500 x [500 x double]], ptr @L, i64 0, i64 %13
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [500 x double], ptr %14, i64 0, i64 %16
  store double 0.000000e+00, ptr %17, align 8, !tbaa !9
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [500 x [500 x double]], ptr @U, i64 0, i64 %19
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [500 x double], ptr %20, i64 0, i64 %22
  store double 0.000000e+00, ptr %23, align 8, !tbaa !9
  br label %24

24:                                               ; preds = %11
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %2, align 4, !tbaa !5
  br label %8, !llvm.loop !11

27:                                               ; preds = %8
  br label %28

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

31:                                               ; preds = %4
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %67, %31
  %33 = load i32, ptr %1, align 4, !tbaa !5
  %34 = icmp slt i32 %33, 500
  br i1 %34, label %35, label %70

35:                                               ; preds = %32
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %63, %35
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = load i32, ptr %1, align 4, !tbaa !5
  %39 = icmp sle i32 %37, %38
  br i1 %39, label %40, label %66

40:                                               ; preds = %36
  %41 = load i32, ptr %1, align 4, !tbaa !5
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = add nsw i32 %41, %42
  %44 = add nsw i32 %43, 1
  %45 = sitofp i32 %44 to double
  %46 = load i32, ptr %1, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [500 x [500 x double]], ptr @L, i64 0, i64 %47
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [500 x double], ptr %48, i64 0, i64 %50
  store double %45, ptr %51, align 8, !tbaa !9
  %52 = load i32, ptr %1, align 4, !tbaa !5
  %53 = load i32, ptr %2, align 4, !tbaa !5
  %54 = add nsw i32 %52, %53
  %55 = add nsw i32 %54, 1
  %56 = sitofp i32 %55 to double
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [500 x [500 x double]], ptr @U, i64 0, i64 %58
  %60 = load i32, ptr %1, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [500 x double], ptr %59, i64 0, i64 %61
  store double %56, ptr %62, align 8, !tbaa !9
  br label %63

63:                                               ; preds = %40
  %64 = load i32, ptr %2, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %2, align 4, !tbaa !5
  br label %36, !llvm.loop !14

66:                                               ; preds = %36
  br label %67

67:                                               ; preds = %66
  %68 = load i32, ptr %1, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %1, align 4, !tbaa !5
  br label %32, !llvm.loop !15

70:                                               ; preds = %32
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %113, %70
  %72 = load i32, ptr %1, align 4, !tbaa !5
  %73 = icmp slt i32 %72, 500
  br i1 %73, label %74, label %116

74:                                               ; preds = %71
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %109, %74
  %76 = load i32, ptr %2, align 4, !tbaa !5
  %77 = icmp slt i32 %76, 500
  br i1 %77, label %78, label %112

78:                                               ; preds = %75
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %105, %78
  %80 = load i32, ptr %3, align 4, !tbaa !5
  %81 = icmp slt i32 %80, 500
  br i1 %81, label %82, label %108

82:                                               ; preds = %79
  %83 = load i32, ptr %1, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [500 x [500 x double]], ptr @L, i64 0, i64 %84
  %86 = load i32, ptr %3, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [500 x double], ptr %85, i64 0, i64 %87
  %89 = load double, ptr %88, align 8, !tbaa !9
  %90 = load i32, ptr %3, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [500 x [500 x double]], ptr @U, i64 0, i64 %91
  %93 = load i32, ptr %2, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [500 x double], ptr %92, i64 0, i64 %94
  %96 = load double, ptr %95, align 8, !tbaa !9
  %97 = load i32, ptr %1, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [500 x [500 x double]], ptr @A, i64 0, i64 %98
  %100 = load i32, ptr %2, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [500 x double], ptr %99, i64 0, i64 %101
  %103 = load double, ptr %102, align 8, !tbaa !9
  %104 = call double @llvm.fmuladd.f64(double %89, double %96, double %103)
  store double %104, ptr %102, align 8, !tbaa !9
  br label %105

105:                                              ; preds = %82
  %106 = load i32, ptr %3, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %3, align 4, !tbaa !5
  br label %79, !llvm.loop !16

108:                                              ; preds = %79
  br label %109

109:                                              ; preds = %108
  %110 = load i32, ptr %2, align 4, !tbaa !5
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %2, align 4, !tbaa !5
  br label %75, !llvm.loop !17

112:                                              ; preds = %75
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %1, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %1, align 4, !tbaa !5
  br label %71, !llvm.loop !18

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

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

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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

@L = external dso_local local_unnamed_addr global [500 x [500 x double]], align 16
@U = external dso_local local_unnamed_addr global [500 x [500 x double]], align 16
@A = external dso_local local_unnamed_addr global [500 x [500 x double]], align 16

; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @init_array() local_unnamed_addr #0 {
.preheader39.preheader:
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2000000) @L, i8 0, i64 2000000, i1 false), !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2000000) @U, i8 0, i64 2000000, i1 false), !tbaa !5
  br label %.preheader39

.preheader39:                                     ; preds = %.preheader39.preheader, %17
  %indvars.iv57 = phi i64 [ 0, %.preheader39.preheader ], [ %indvars.iv.next58, %17 ]
  %indvars.iv55 = phi i64 [ 1, %.preheader39.preheader ], [ %indvars.iv.next56, %17 ]
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %xtraiter = and i64 %indvars.iv55, 1
  %0 = icmp eq i64 %indvars.iv57, 0
  br i1 %0, label %.unr-lcssa, label %.preheader39.new

.preheader39.new:                                 ; preds = %.preheader39
  %unroll_iter = and i64 %indvars.iv55, 9223372036854775806
  br label %1

1:                                                ; preds = %1, %.preheader39.new
  %indvars.iv = phi i64 [ 0, %.preheader39.new ], [ %indvars.iv.next.1, %1 ]
  %niter = phi i64 [ 0, %.preheader39.new ], [ %niter.next.1, %1 ]
  %2 = add nuw nsw i64 %indvars.iv.next58, %indvars.iv
  %3 = trunc nuw nsw i64 %2 to i32
  %4 = uitofp nneg i32 %3 to double
  %5 = getelementptr inbounds [500 x [500 x double]], ptr @L, i64 0, i64 %indvars.iv57, i64 %indvars.iv
  store double %4, ptr %5, align 16, !tbaa !5
  %6 = getelementptr inbounds [500 x [500 x double]], ptr @U, i64 0, i64 %indvars.iv, i64 %indvars.iv57
  store double %4, ptr %6, align 8, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %7 = add nuw nsw i64 %indvars.iv.next58, %indvars.iv.next
  %8 = trunc nuw nsw i64 %7 to i32
  %9 = uitofp nneg i32 %8 to double
  %10 = getelementptr inbounds [500 x [500 x double]], ptr @L, i64 0, i64 %indvars.iv57, i64 %indvars.iv.next
  store double %9, ptr %10, align 8, !tbaa !5
  %11 = getelementptr inbounds [500 x [500 x double]], ptr @U, i64 0, i64 %indvars.iv.next, i64 %indvars.iv57
  store double %9, ptr %11, align 8, !tbaa !5
  %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 %.unr-lcssa, label %1, !llvm.loop !9

.unr-lcssa:                                       ; preds = %1, %.preheader39
  %indvars.iv.unr = phi i64 [ 0, %.preheader39 ], [ %indvars.iv.next.1, %1 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %17, label %.epilog-lcssa

.epilog-lcssa:                                    ; preds = %.unr-lcssa
  %12 = add nuw nsw i64 %indvars.iv.next58, %indvars.iv.unr
  %13 = trunc nuw nsw i64 %12 to i32
  %14 = uitofp nneg i32 %13 to double
  %15 = getelementptr inbounds [500 x [500 x double]], ptr @L, i64 0, i64 %indvars.iv57, i64 %indvars.iv.unr
  store double %14, ptr %15, align 8, !tbaa !5
  %16 = getelementptr inbounds [500 x [500 x double]], ptr @U, i64 0, i64 %indvars.iv.unr, i64 %indvars.iv57
  store double %14, ptr %16, align 8, !tbaa !5
  br label %17

17:                                               ; preds = %.unr-lcssa, %.epilog-lcssa
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %exitcond62.not = icmp eq i64 %indvars.iv.next58, 500
  br i1 %exitcond62.not, label %.preheader37, label %.preheader39, !llvm.loop !11

.preheader37:                                     ; preds = %17, %32
  %indvars.iv71 = phi i64 [ %indvars.iv.next72, %32 ], [ 0, %17 ]
  br label %.preheader

.preheader:                                       ; preds = %.preheader37, %31
  %indvars.iv67 = phi i64 [ 0, %.preheader37 ], [ %indvars.iv.next68, %31 ]
  %18 = getelementptr inbounds [500 x [500 x double]], ptr @A, i64 0, i64 %indvars.iv71, i64 %indvars.iv67
  %.promoted = load double, ptr %18, align 8, !tbaa !5
  br label %19

19:                                               ; preds = %19, %.preheader
  %indvars.iv63 = phi i64 [ 0, %.preheader ], [ %indvars.iv.next64.1, %19 ]
  %20 = phi double [ %.promoted, %.preheader ], [ %30, %19 ]
  %21 = getelementptr inbounds [500 x [500 x double]], ptr @L, i64 0, i64 %indvars.iv71, i64 %indvars.iv63
  %22 = load double, ptr %21, align 16, !tbaa !5
  %23 = getelementptr inbounds [500 x [500 x double]], ptr @U, i64 0, i64 %indvars.iv63, i64 %indvars.iv67
  %24 = load double, ptr %23, align 8, !tbaa !5
  %25 = tail call double @llvm.fmuladd.f64(double %22, double %24, double %20)
  %indvars.iv.next64 = or disjoint i64 %indvars.iv63, 1
  %26 = getelementptr inbounds [500 x [500 x double]], ptr @L, i64 0, i64 %indvars.iv71, i64 %indvars.iv.next64
  %27 = load double, ptr %26, align 8, !tbaa !5
  %28 = getelementptr inbounds [500 x [500 x double]], ptr @U, i64 0, i64 %indvars.iv.next64, i64 %indvars.iv67
  %29 = load double, ptr %28, align 8, !tbaa !5
  %30 = tail call double @llvm.fmuladd.f64(double %27, double %29, double %25)
  %indvars.iv.next64.1 = add nuw nsw i64 %indvars.iv63, 2
  %exitcond66.not.1 = icmp eq i64 %indvars.iv.next64.1, 500
  br i1 %exitcond66.not.1, label %31, label %19, !llvm.loop !12

31:                                               ; preds = %19
  store double %30, ptr %18, align 8, !tbaa !5
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %exitcond70.not = icmp eq i64 %indvars.iv.next68, 500
  br i1 %exitcond70.not, label %32, label %.preheader, !llvm.loop !13

32:                                               ; preds = %31
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %exitcond74.not = icmp eq i64 %indvars.iv.next72, 500
  br i1 %exitcond74.not, label %33, label %.preheader37, !llvm.loop !14

33:                                               ; preds = %32
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; 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 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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 speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass