; LLVM IR from aferikoglou/GenHLSOptimizer :: dataset/rodinia-backprop-0-baseline-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 [65537 x float], align 16
  %12 = alloca [8704 x float], align 16
  %13 = alloca [17 x float], align 16
  %14 = alloca i32, align 4
  %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 262148, ptr %11) #4
  br label %17

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

18:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 68, ptr %13) #4
  %19 = getelementptr inbounds [65537 x float], ptr %11, i64 0, i64 0
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %19, ptr align 4 %20, i64 262148, i1 false)
  %21 = getelementptr inbounds [65537 x float], ptr %11, i64 0, i64 0
  store float 1.000000e+00, ptr %21, align 16, !tbaa !9
  br label %22

22:                                               ; preds = %18
  store i32 1, ptr %8, align 4, !tbaa !11
  br label %23

23:                                               ; preds = %92, %22
  %24 = load i32, ptr %8, align 4, !tbaa !11
  %25 = icmp slt i32 %24, 17
  br i1 %25, label %26, label %95

26:                                               ; preds = %23
  store float 0.000000e+00, ptr %7, align 4, !tbaa !9
  br label %27

27:                                               ; preds = %26
  store i32 0, ptr %10, align 4, !tbaa !11
  br label %28

28:                                               ; preds = %78, %27
  %29 = load i32, ptr %10, align 4, !tbaa !11
  %30 = icmp slt i32 %29, 66048
  br i1 %30, label %31, label %81

31:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %32 = load i32, ptr %10, align 4, !tbaa !11
  %33 = icmp eq i32 %32, 65536
  %34 = zext i1 %33 to i64
  %35 = select i1 %33, i32 1, i32 512
  store i32 %35, ptr %14, align 4, !tbaa !11
  %36 = getelementptr inbounds [8704 x float], ptr %12, i64 0, i64 0
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = load i32, ptr %10, align 4, !tbaa !11
  %39 = mul nsw i32 %38, 17
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds float, ptr %37, i64 %40
  %42 = load i32, ptr %14, align 4, !tbaa !11
  %43 = sext i32 %42 to i64
  %44 = mul i64 4, %43
  %45 = mul i64 %44, 17
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %36, ptr align 4 %41, i64 %45, i1 false)
  br label %46

46:                                               ; preds = %31
  store i32 0, ptr %9, align 4, !tbaa !11
  br label %47

47:                                               ; preds = %74, %46
  %48 = load i32, ptr %9, align 4, !tbaa !11
  %49 = icmp slt i32 %48, 512
  br i1 %49, label %50, label %77

50:                                               ; preds = %47
  %51 = load i32, ptr %9, align 4, !tbaa !11
  %52 = load i32, ptr %10, align 4, !tbaa !11
  %53 = add nsw i32 %51, %52
  %54 = icmp slt i32 %53, 65537
  br i1 %54, label %55, label %73

55:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %56 = load i32, ptr %9, align 4, !tbaa !11
  %57 = mul nsw i32 %56, 17
  %58 = load i32, ptr %8, align 4, !tbaa !11
  %59 = add nsw i32 %57, %58
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [8704 x float], ptr %12, i64 0, i64 %60
  %62 = load float, ptr %61, align 4, !tbaa !9
  %63 = load i32, ptr %9, align 4, !tbaa !11
  %64 = load i32, ptr %10, align 4, !tbaa !11
  %65 = add nsw i32 %63, %64
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [65537 x float], ptr %11, i64 0, i64 %66
  %68 = load float, ptr %67, align 4, !tbaa !9
  %69 = fmul float %62, %68
  store float %69, ptr %15, align 4, !tbaa !9
  %70 = load float, ptr %15, align 4, !tbaa !9
  %71 = load float, ptr %7, align 4, !tbaa !9
  %72 = fadd float %71, %70
  store float %72, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %73

73:                                               ; preds = %55, %50
  br label %74

74:                                               ; preds = %73
  %75 = load i32, ptr %9, align 4, !tbaa !11
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %9, align 4, !tbaa !11
  br label %47, !llvm.loop !13

77:                                               ; preds = %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %10, align 4, !tbaa !11
  %80 = add nsw i32 %79, 512
  store i32 %80, ptr %10, align 4, !tbaa !11
  br label %28, !llvm.loop !15

81:                                               ; preds = %28
  %82 = load float, ptr %7, align 4, !tbaa !9
  %83 = fneg float %82
  %84 = call noundef float @_ZSt3expf(float noundef %83)
  %85 = fpext float %84 to double
  %86 = fadd double 1.000000e+00, %85
  %87 = fdiv double 1.000000e+00, %86
  %88 = fptrunc double %87 to float
  %89 = load i32, ptr %8, align 4, !tbaa !11
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [17 x float], ptr %13, i64 0, i64 %90
  store float %88, ptr %91, align 4, !tbaa !9
  br label %92

92:                                               ; preds = %81
  %93 = load i32, ptr %8, align 4, !tbaa !11
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %8, align 4, !tbaa !11
  br label %23, !llvm.loop !16

95:                                               ; preds = %23
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds [17 x float], ptr %13, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %96, ptr align 16 %97, i64 68, i1 false)
  call void @llvm.lifetime.end.p0(i64 68, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 34816, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 262148, 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 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !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 [65537 x float], align 16
  %5 = alloca [8704 x float], align 16
  %6 = alloca [17 x float], align 16
  call void @llvm.lifetime.start.p0(i64 262148, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 34816, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 68, ptr nonnull %6) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(262148) %4, ptr noundef nonnull align 4 dereferenceable(262148) %0, i64 262148, i1 false)
  store float 1.000000e+00, ptr %4, align 16, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %3, %38
  %indvars.iv34 = phi i64 [ 1, %3 ], [ %indvars.iv.next35, %38 ]
  br label %7

7:                                                ; preds = %.preheader, %36
  %indvars.iv31 = phi i64 [ 0, %.preheader ], [ %indvars.iv.next32, %36 ]
  %.028 = phi float [ 0.000000e+00, %.preheader ], [ %.2.1, %36 ]
  %8 = icmp eq i64 %indvars.iv31, 65536
  %.idx = mul nuw nsw i64 %indvars.iv31, 68
  %9 = getelementptr inbounds i8, ptr %2, i64 %.idx
  %10 = select i1 %8, i64 68, i64 34816
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(68) %5, ptr noundef nonnull align 4 dereferenceable(68) %9, i64 %10, i1 false)
  br label %11

11:                                               ; preds = %35, %7
  %indvars.iv = phi i64 [ 0, %7 ], [ %indvars.iv.next.1, %35 ]
  %.126 = phi float [ %.028, %7 ], [ %.2.1, %35 ]
  %12 = or disjoint i64 %indvars.iv, %indvars.iv31
  %13 = icmp ult i64 %12, 65537
  br i1 %13, label %14, label %23

14:                                               ; preds = %11
  %15 = mul nuw nsw i64 %indvars.iv, 17
  %16 = add nuw nsw i64 %15, %indvars.iv34
  %17 = getelementptr inbounds [8704 x float], ptr %5, i64 0, i64 %16
  %18 = load float, ptr %17, align 4, !tbaa !5
  %19 = getelementptr inbounds [65537 x float], ptr %4, i64 0, i64 %12
  %20 = load float, ptr %19, align 8, !tbaa !5
  %21 = fmul float %18, %20
  %22 = fadd float %.126, %21
  br label %23

23:                                               ; preds = %11, %14
  %.2 = phi float [ %22, %14 ], [ %.126, %11 ]
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %24 = or disjoint i64 %indvars.iv.next, %indvars.iv31
  %25 = icmp ult i64 %24, 65537
  br i1 %25, label %26, label %35

26:                                               ; preds = %23
  %27 = mul nuw nsw i64 %indvars.iv.next, 17
  %28 = add nuw nsw i64 %27, %indvars.iv34
  %29 = getelementptr inbounds [8704 x float], ptr %5, i64 0, i64 %28
  %30 = load float, ptr %29, align 4, !tbaa !5
  %31 = getelementptr inbounds [65537 x float], ptr %4, i64 0, i64 %24
  %32 = load float, ptr %31, align 4, !tbaa !5
  %33 = fmul float %30, %32
  %34 = fadd float %.2, %33
  br label %35

35:                                               ; preds = %26, %23
  %.2.1 = phi float [ %34, %26 ], [ %.2, %23 ]
  %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 %36, label %11, !llvm.loop !9

36:                                               ; preds = %35
  %indvars.iv.next32 = add nuw nsw i64 %indvars.iv31, 512
  %37 = icmp ult i64 %indvars.iv31, 65536
  br i1 %37, label %7, label %38, !llvm.loop !11

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

46:                                               ; preds = %38
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(68) %1, ptr noundef nonnull align 16 dereferenceable(68) %6, i64 68, i1 false)
  call void @llvm.lifetime.end.p0(i64 68, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 34816, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 262148, 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,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass