; LLVM IR from aferikoglou/GenHLSOptimizer :: dataset/rodinia_streamcluster_0_baseline_0 (streamcluster)

; 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: mustprogress nounwind uwtable
define dso_local void @workload(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, i32 noundef %8, ptr noundef %9, i32 noundef %10) #0 {
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca float, align 4
  %26 = alloca float, align 4
  %27 = alloca float, align 4
  %28 = alloca i32, align 4
  store ptr %0, ptr %12, align 8, !tbaa !5
  store ptr %1, ptr %13, align 8, !tbaa !5
  store ptr %2, ptr %14, align 8, !tbaa !5
  store ptr %3, ptr %15, align 8, !tbaa !5
  store ptr %4, ptr %16, align 8, !tbaa !5
  store ptr %5, ptr %17, align 8, !tbaa !5
  store ptr %6, ptr %18, align 8, !tbaa !5
  store ptr %7, ptr %19, align 8, !tbaa !5
  store i32 %8, ptr %20, align 4, !tbaa !9
  store ptr %9, ptr %21, align 8, !tbaa !5
  store i32 %10, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #3
  br label %29

29:                                               ; preds = %11
  store i32 0, ptr %23, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %104, %29
  %31 = load i32, ptr %23, align 4, !tbaa !9
  %32 = icmp slt i32 %31, 1024
  br i1 %32, label %33, label %107

33:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #3
  store float 0.000000e+00, ptr %25, align 4, !tbaa !11
  br label %34

34:                                               ; preds = %33
  store i32 0, ptr %24, align 4, !tbaa !9
  br label %35

35:                                               ; preds = %57, %34
  %36 = load i32, ptr %24, align 4, !tbaa !9
  %37 = icmp slt i32 %36, 200
  br i1 %37, label %38, label %60

38:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #3
  %39 = load ptr, ptr %12, align 8, !tbaa !5
  %40 = load i32, ptr %23, align 4, !tbaa !9
  %41 = mul nsw i32 %40, 200
  %42 = load i32, ptr %24, align 4, !tbaa !9
  %43 = add nsw i32 %41, %42
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds float, ptr %39, i64 %44
  %46 = load float, ptr %45, align 4, !tbaa !11
  %47 = load ptr, ptr %15, align 8, !tbaa !5
  %48 = load i32, ptr %24, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds float, ptr %47, i64 %49
  %51 = load float, ptr %50, align 4, !tbaa !11
  %52 = fsub float %46, %51
  store float %52, ptr %26, align 4, !tbaa !11
  %53 = load float, ptr %26, align 4, !tbaa !11
  %54 = load float, ptr %26, align 4, !tbaa !11
  %55 = load float, ptr %25, align 4, !tbaa !11
  %56 = call float @llvm.fmuladd.f32(float %53, float %54, float %55)
  store float %56, ptr %25, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #3
  br label %57

57:                                               ; preds = %38
  %58 = load i32, ptr %24, align 4, !tbaa !9
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %24, align 4, !tbaa !9
  br label %35, !llvm.loop !13

60:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #3
  %61 = load float, ptr %25, align 4, !tbaa !11
  %62 = load ptr, ptr %13, align 8, !tbaa !5
  %63 = load i32, ptr %23, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds float, ptr %62, i64 %64
  %66 = load float, ptr %65, align 4, !tbaa !11
  %67 = load ptr, ptr %14, align 8, !tbaa !5
  %68 = load i32, ptr %23, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds float, ptr %67, i64 %69
  %71 = load float, ptr %70, align 4, !tbaa !11
  %72 = fneg float %71
  %73 = call float @llvm.fmuladd.f32(float %61, float %66, float %72)
  store float %73, ptr %27, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #3
  %74 = load ptr, ptr %17, align 8, !tbaa !5
  %75 = load ptr, ptr %16, align 8, !tbaa !5
  %76 = load i32, ptr %23, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds i32, ptr %75, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds i32, ptr %74, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !9
  store i32 %82, ptr %28, align 4, !tbaa !9
  %83 = load float, ptr %27, align 4, !tbaa !11
  %84 = fcmp olt float %83, 0.000000e+00
  br i1 %84, label %85, label %95

85:                                               ; preds = %60
  %86 = load ptr, ptr %18, align 8, !tbaa !5
  %87 = load i32, ptr %23, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds i8, ptr %86, i64 %88
  store i8 1, ptr %89, align 1, !tbaa !15
  %90 = load float, ptr %27, align 4, !tbaa !11
  %91 = load ptr, ptr %21, align 8, !tbaa !5
  %92 = getelementptr inbounds float, ptr %91, i64 0
  %93 = load float, ptr %92, align 4, !tbaa !11
  %94 = fadd float %93, %90
  store float %94, ptr %92, align 4, !tbaa !11
  br label %103

95:                                               ; preds = %60
  %96 = load float, ptr %27, align 4, !tbaa !11
  %97 = load ptr, ptr %19, align 8, !tbaa !5
  %98 = load i32, ptr %28, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds float, ptr %97, i64 %99
  %101 = load float, ptr %100, align 4, !tbaa !11
  %102 = fsub float %101, %96
  store float %102, ptr %100, align 4, !tbaa !11
  br label %103

103:                                              ; preds = %95, %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #3
  br label %104

104:                                              ; preds = %103
  %105 = load i32, ptr %23, align 4, !tbaa !9
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %23, align 4, !tbaa !9
  br label %30, !llvm.loop !16

107:                                              ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #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 float @llvm.fmuladd.f32(float, float, float) #2

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

attributes #0 = { mustprogress 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple 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 = !{!7, !7, i64 0}
!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"

; Function Attrs: mustprogress nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @workload(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, ptr nocapture noundef readonly %3, ptr nocapture noundef readonly %4, ptr nocapture noundef readonly %5, ptr nocapture noundef writeonly %6, ptr nocapture noundef %7, i32 noundef %8, ptr nocapture noundef %9, i32 noundef %10) local_unnamed_addr #0 {
  br label %.preheader

.preheader:                                       ; preds = %11, %55
  %indvars.iv34 = phi i64 [ 0, %11 ], [ %indvars.iv.next35, %55 ]
  %.idx = mul i64 %indvars.iv34, 800
  %invariant.gep = getelementptr i8, ptr %0, i64 %.idx
  br label %12

12:                                               ; preds = %12, %.preheader
  %indvars.iv = phi i64 [ 0, %.preheader ], [ %indvars.iv.next.3, %12 ]
  %.02830 = phi float [ 0.000000e+00, %.preheader ], [ %32, %12 ]
  %gep = getelementptr float, ptr %invariant.gep, i64 %indvars.iv
  %13 = load float, ptr %gep, align 4, !tbaa !5
  %14 = getelementptr inbounds float, ptr %3, i64 %indvars.iv
  %15 = load float, ptr %14, align 4, !tbaa !5
  %16 = fsub float %13, %15
  %17 = tail call float @llvm.fmuladd.f32(float %16, float %16, float %.02830)
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %gep.1 = getelementptr float, ptr %invariant.gep, i64 %indvars.iv.next
  %18 = load float, ptr %gep.1, align 4, !tbaa !5
  %19 = getelementptr inbounds float, ptr %3, i64 %indvars.iv.next
  %20 = load float, ptr %19, align 4, !tbaa !5
  %21 = fsub float %18, %20
  %22 = tail call float @llvm.fmuladd.f32(float %21, float %21, float %17)
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %gep.2 = getelementptr float, ptr %invariant.gep, i64 %indvars.iv.next.1
  %23 = load float, ptr %gep.2, align 4, !tbaa !5
  %24 = getelementptr inbounds float, ptr %3, i64 %indvars.iv.next.1
  %25 = load float, ptr %24, align 4, !tbaa !5
  %26 = fsub float %23, %25
  %27 = tail call float @llvm.fmuladd.f32(float %26, float %26, float %22)
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %gep.3 = getelementptr float, ptr %invariant.gep, i64 %indvars.iv.next.2
  %28 = load float, ptr %gep.3, align 4, !tbaa !5
  %29 = getelementptr inbounds float, ptr %3, i64 %indvars.iv.next.2
  %30 = load float, ptr %29, align 4, !tbaa !5
  %31 = fsub float %28, %30
  %32 = tail call float @llvm.fmuladd.f32(float %31, float %31, float %27)
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, 200
  br i1 %exitcond.not.3, label %33, label %12, !llvm.loop !9

33:                                               ; preds = %12
  %34 = getelementptr inbounds float, ptr %1, i64 %indvars.iv34
  %35 = load float, ptr %34, align 4, !tbaa !5
  %36 = getelementptr inbounds float, ptr %2, i64 %indvars.iv34
  %37 = load float, ptr %36, align 4, !tbaa !5
  %38 = fneg float %37
  %39 = tail call float @llvm.fmuladd.f32(float %32, float %35, float %38)
  %40 = fcmp olt float %39, 0.000000e+00
  br i1 %40, label %41, label %45

41:                                               ; preds = %33
  %42 = getelementptr inbounds i8, ptr %6, i64 %indvars.iv34
  store i8 1, ptr %42, align 1, !tbaa !11
  %43 = load float, ptr %9, align 4, !tbaa !5
  %44 = fadd float %39, %43
  store float %44, ptr %9, align 4, !tbaa !5
  br label %55

45:                                               ; preds = %33
  %46 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv34
  %47 = load i32, ptr %46, align 4, !tbaa !12
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds i32, ptr %5, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !12
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds float, ptr %7, i64 %51
  %53 = load float, ptr %52, align 4, !tbaa !5
  %54 = fsub float %53, %39
  store float %54, ptr %52, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %45, %41
  %indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
  %exitcond37.not = icmp eq i64 %indvars.iv.next35, 1024
  br i1 %exitcond37.not, label %56, label %.preheader, !llvm.loop !14

56:                                               ; preds = %55
  ret void
}

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

attributes #0 = { mustprogress nofree norecurse nosync nounwind memory(argmem: readwrite) 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) }

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !10}


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