; LLVM IR from aferikoglou/GenHLSOptimizer :: dataset/rodinia-backprop-1-tiling-forward (backprop_kernel)

; 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 uwtable
define dso_local void @workload(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca float, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca [65536 x float], align 16
  %12 = alloca [8192 x float], align 16
  %13 = alloca [16 x float], align 16
  %14 = alloca [16 x float], align 16
  %15 = alloca float, 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  br label %16

16:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 262144, ptr %11) #4
  br label %17

17:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 32768, ptr %12) #4
  br label %18

18:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 64, ptr %13) #4
  br label %19

19:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 64, ptr %14) #4
  %20 = getelementptr inbounds [65536 x float], ptr %11, i64 0, i64 0
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds float, ptr %21, i64 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %20, ptr align 4 %22, i64 262144, i1 false)
  %23 = getelementptr inbounds [16 x float], ptr %14, i64 0, i64 0
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %23, ptr align 4 %24, i64 64, i1 false)
  br label %25

25:                                               ; preds = %19
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %86, %25
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = icmp slt i32 %27, 16
  br i1 %28, label %29, label %89

29:                                               ; preds = %26
  %30 = load i32, ptr %8, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [16 x float], ptr %14, i64 0, i64 %31
  %33 = load float, ptr %32, align 4, !tbaa !11
  store float %33, ptr %7, align 4, !tbaa !11
  br label %34

34:                                               ; preds = %29
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %35

35:                                               ; preds = %72, %34
  %36 = load i32, ptr %10, align 4, !tbaa !9
  %37 = icmp slt i32 %36, 65537
  br i1 %37, label %38, label %75

38:                                               ; preds = %35
  %39 = getelementptr inbounds [8192 x float], ptr %12, i64 0, i64 0
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = load i32, ptr %10, align 4, !tbaa !9
  %42 = mul nsw i32 %41, 16
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds float, ptr %40, i64 %43
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %39, ptr align 4 %44, i64 32768, i1 false)
  br label %45

45:                                               ; preds = %38
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %46

46:                                               ; preds = %68, %45
  %47 = load i32, ptr %9, align 4, !tbaa !9
  %48 = icmp slt i32 %47, 512
  br i1 %48, label %49, label %71

49:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %50 = load i32, ptr %9, align 4, !tbaa !9
  %51 = mul nsw i32 %50, 16
  %52 = load i32, ptr %8, align 4, !tbaa !9
  %53 = add nsw i32 %51, %52
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [8192 x float], ptr %12, i64 0, i64 %54
  %56 = load float, ptr %55, align 4, !tbaa !11
  %57 = load i32, ptr %9, align 4, !tbaa !9
  %58 = load i32, ptr %10, align 4, !tbaa !9
  %59 = add nsw i32 %57, %58
  %60 = sub nsw i32 %59, 1
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [65536 x float], ptr %11, i64 0, i64 %61
  %63 = load float, ptr %62, align 4, !tbaa !11
  %64 = fmul float %56, %63
  store float %64, ptr %15, align 4, !tbaa !11
  %65 = load float, ptr %15, align 4, !tbaa !11
  %66 = load float, ptr %7, align 4, !tbaa !11
  %67 = fadd float %66, %65
  store float %67, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %68

68:                                               ; preds = %49
  %69 = load i32, ptr %9, align 4, !tbaa !9
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %9, align 4, !tbaa !9
  br label %46, !llvm.loop !13

71:                                               ; preds = %46
  br label %72

72:                                               ; preds = %71
  %73 = load i32, ptr %10, align 4, !tbaa !9
  %74 = add nsw i32 %73, 512
  store i32 %74, ptr %10, align 4, !tbaa !9
  br label %35, !llvm.loop !15

75:                                               ; preds = %35
  %76 = load float, ptr %7, align 4, !tbaa !11
  %77 = fneg float %76
  %78 = call noundef float @_ZSt3expf(float noundef %77)
  %79 = fpext float %78 to double
  %80 = fadd double 1.000000e+00, %79
  %81 = fdiv double 1.000000e+00, %80
  %82 = fptrunc double %81 to float
  %83 = load i32, ptr %8, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [16 x float], ptr %13, i64 0, i64 %84
  store float %82, ptr %85, align 4, !tbaa !11
  br label %86

86:                                               ; preds = %75
  %87 = load i32, ptr %8, align 4, !tbaa !9
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %8, align 4, !tbaa !9
  br label %26, !llvm.loop !16

89:                                               ; preds = %26
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds float, ptr %90, i64 1
  %92 = getelementptr inbounds [16 x float], ptr %13, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %91, ptr align 16 %92, i64 64, i1 false)
  call void @llvm.lifetime.end.p0(i64 64, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 32768, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 262144, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  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 4, ptr %7) #4
  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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3expf(float noundef) #3

attributes #0 = { mustprogress 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 nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #4 = { 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 = 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"

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @workload(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  %4 = alloca [65536 x float], align 16
  %5 = alloca [8192 x float], align 16
  %6 = alloca [16 x float], align 16
  %7 = alloca [16 x float], align 16
  call void @llvm.lifetime.start.p0(i64 262144, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 32768, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %7) #4
  %8 = getelementptr inbounds i8, ptr %0, i64 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(262144) %4, ptr noundef nonnull align 4 dereferenceable(262144) %8, i64 262144, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %7, ptr noundef nonnull align 4 dereferenceable(64) %2, i64 64, i1 false)
  br label %9

9:                                                ; preds = %3, %36
  %indvars.iv31 = phi i64 [ 0, %3 ], [ %indvars.iv.next32, %36 ]
  %10 = getelementptr inbounds [16 x float], ptr %7, i64 0, i64 %indvars.iv31
  %11 = load float, ptr %10, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %9, %34
  %indvars.iv28 = phi i64 [ 1, %9 ], [ %indvars.iv.next29, %34 ]
  %.025 = phi float [ %11, %9 ], [ %33, %34 ]
  %.idx = shl nuw nsw i64 %indvars.iv28, 6
  %13 = getelementptr inbounds i8, ptr %2, i64 %.idx
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32768) %5, ptr noundef nonnull align 4 dereferenceable(32768) %13, i64 32768, i1 false)
  %14 = add nsw i64 %indvars.iv28, -1
  br label %15

15:                                               ; preds = %15, %12
  %indvars.iv = phi i64 [ 0, %12 ], [ %indvars.iv.next.1, %15 ]
  %.123 = phi float [ %.025, %12 ], [ %33, %15 ]
  %16 = shl nuw nsw i64 %indvars.iv, 4
  %17 = add nuw nsw i64 %16, %indvars.iv31
  %18 = getelementptr inbounds [8192 x float], ptr %5, i64 0, i64 %17
  %19 = load float, ptr %18, align 4, !tbaa !5
  %20 = add nuw nsw i64 %14, %indvars.iv
  %21 = getelementptr inbounds [65536 x float], ptr %4, i64 0, i64 %20
  %22 = load float, ptr %21, align 4, !tbaa !5
  %23 = fmul float %19, %22
  %24 = fadd float %.123, %23
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %25 = shl nuw nsw i64 %indvars.iv.next, 4
  %26 = add nuw nsw i64 %25, %indvars.iv31
  %27 = getelementptr inbounds [8192 x float], ptr %5, i64 0, i64 %26
  %28 = load float, ptr %27, align 4, !tbaa !5
  %29 = add nuw nsw i64 %14, %indvars.iv.next
  %30 = getelementptr inbounds [65536 x float], ptr %4, i64 0, i64 %29
  %31 = load float, ptr %30, align 4, !tbaa !5
  %32 = fmul float %28, %31
  %33 = fadd float %24, %32
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 512
  br i1 %exitcond.not.1, label %34, label %15, !llvm.loop !9

34:                                               ; preds = %15
  %indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 512
  %35 = icmp ult i64 %indvars.iv28, 65025
  br i1 %35, label %12, label %36, !llvm.loop !11

36:                                               ; preds = %34
  %37 = fneg float %33
  %38 = tail call noundef float @_ZSt3expf(float noundef %37)
  %39 = fpext float %38 to double
  %40 = fadd double %39, 1.000000e+00
  %41 = fdiv double 1.000000e+00, %40
  %42 = fptrunc double %41 to float
  %43 = getelementptr inbounds [16 x float], ptr %6, i64 0, i64 %indvars.iv31
  store float %42, ptr %43, align 4, !tbaa !5
  %indvars.iv.next32 = add nuw nsw i64 %indvars.iv31, 1
  %exitcond34.not = icmp eq i64 %indvars.iv.next32, 16
  br i1 %exitcond34.not, label %44, label %9, !llvm.loop !12

44:                                               ; preds = %36
  %45 = getelementptr inbounds i8, ptr %1, i64 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(64) %45, ptr noundef nonnull align 16 dereferenceable(64) %6, i64 64, i1 false)
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 32768, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 262144, ptr nonnull %4) #4
  ret void
}

; 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 nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3expf(float noundef) local_unnamed_addr #3

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #4 = { 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}


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