; LLVM IR from aferikoglou/GenHLSOptimizer :: dataset/rodinia_lc_gicov_1_tiling_0 (lc_gicov)

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

@__const.workload.sin_angle = external hidden unnamed_addr constant [16 x float], align 16
@__const.workload.cos_angle = external hidden unnamed_addr constant [16 x float], align 16
@__const.workload.tX = external hidden unnamed_addr constant [2 x [16 x i32]], align 16
@__const.workload.tY = external hidden unnamed_addr constant [2 x [16 x i32]], align 16

; Function Attrs: mustprogress uwtable
declare dso_local void @lc_gicov(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #0

; 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; 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 i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca [16 x float], align 16
  %11 = alloca [16 x float], align 16
  %12 = alloca [2 x [16 x i32]], align 16
  %13 = alloca [2 x [16 x i32]], align 16
  %14 = alloca [16384 x float], align 16
  %15 = alloca [17920 x float], align 16
  %16 = alloca [17920 x float], align 16
  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) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  br label %17

17:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 64, ptr %10) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %10, ptr align 16 @__const.workload.sin_angle, i64 64, i1 false)
  br label %18

18:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 64, ptr %11) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %11, ptr align 16 @__const.workload.cos_angle, i64 64, i1 false)
  br label %19

19:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 128, ptr %12) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %12, ptr align 16 @__const.workload.tX, i64 128, i1 false)
  br label %20

20:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 128, ptr %13) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %13, ptr align 16 @__const.workload.tY, i64 128, i1 false)
  br label %21

21:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 65536, ptr %14) #3
  br label %22

22:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 71680, ptr %15) #3
  br label %23

23:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 71680, ptr %16) #3
  br label %24

24:                                               ; preds = %23
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %25

25:                                               ; preds = %60, %24
  %26 = load i32, ptr %9, align 4, !tbaa !9
  %27 = icmp slt i32 %26, 4
  br i1 %27, label %28, label %63

28:                                               ; preds = %25
  %29 = getelementptr inbounds [17920 x float], ptr %15, i64 0, i64 0
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = load i32, ptr %9, align 4, !tbaa !9
  %32 = mul nsw i32 %31, 64
  %33 = mul nsw i32 %32, 256
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds float, ptr %30, i64 %34
  %36 = getelementptr inbounds float, ptr %35, i64 -768
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %29, ptr align 4 %36, i64 71680, i1 false)
  %37 = getelementptr inbounds [17920 x float], ptr %16, i64 0, i64 0
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = load i32, ptr %9, align 4, !tbaa !9
  %40 = mul nsw i32 %39, 64
  %41 = mul nsw i32 %40, 256
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds float, ptr %38, i64 %42
  %44 = getelementptr inbounds float, ptr %43, i64 -768
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %37, ptr align 4 %44, i64 71680, i1 false)
  %45 = getelementptr inbounds [16384 x float], ptr %14, i64 0, i64 0
  %46 = getelementptr inbounds [17920 x float], ptr %15, i64 0, i64 0
  %47 = getelementptr inbounds [17920 x float], ptr %16, i64 0, i64 0
  %48 = getelementptr inbounds [2 x [16 x i32]], ptr %12, i64 0, i64 0
  %49 = getelementptr inbounds [2 x [16 x i32]], ptr %13, i64 0, i64 0
  %50 = getelementptr inbounds [16 x float], ptr %10, i64 0, i64 0
  %51 = getelementptr inbounds [16 x float], ptr %11, i64 0, i64 0
  %52 = load i32, ptr %9, align 4, !tbaa !9
  call void @lc_gicov(ptr noundef %45, ptr noundef %46, ptr noundef %47, ptr noundef %48, ptr noundef %49, ptr noundef %50, ptr noundef %51, i32 noundef %52)
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = load i32, ptr %9, align 4, !tbaa !9
  %55 = mul nsw i32 %54, 64
  %56 = mul nsw i32 %55, 256
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds float, ptr %53, i64 %57
  %59 = getelementptr inbounds [16384 x float], ptr %14, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %58, ptr align 16 %59, i64 65536, i1 false)
  br label %60

60:                                               ; preds = %28
  %61 = load i32, ptr %9, align 4, !tbaa !9
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %9, align 4, !tbaa !9
  br label %25, !llvm.loop !11

63:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 71680, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 71680, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 65536, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 128, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 128, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 64, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 64, 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 4, ptr %7) #3
  ret void
}

; 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

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


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

@__const.workload.sin_angle = external hidden unnamed_addr constant [16 x float], align 16
@__const.workload.cos_angle = external hidden unnamed_addr constant [16 x float], align 16
@__const.workload.tX = external hidden unnamed_addr constant [2 x [16 x i32]], align 16
@__const.workload.tY = external hidden unnamed_addr constant [2 x [16 x i32]], align 16

; Function Attrs: mustprogress uwtable
declare dso_local void @lc_gicov(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
define dso_local void @workload(ptr nocapture noundef writeonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  %4 = alloca [16 x float], align 16
  %5 = alloca [16 x float], align 16
  %6 = alloca [2 x [16 x i32]], align 16
  %7 = alloca [2 x [16 x i32]], align 16
  %8 = alloca [16384 x float], align 16
  %9 = alloca [17920 x float], align 16
  %10 = alloca [17920 x float], align 16
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %4) #3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %4, ptr noundef nonnull align 16 dereferenceable(64) @__const.workload.sin_angle, i64 64, i1 false)
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %5) #3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %5, ptr noundef nonnull align 16 dereferenceable(64) @__const.workload.cos_angle, i64 64, i1 false)
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %6) #3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(128) %6, ptr noundef nonnull align 16 dereferenceable(128) @__const.workload.tX, i64 128, i1 false)
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %7) #3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(128) %7, ptr noundef nonnull align 16 dereferenceable(128) @__const.workload.tY, i64 128, i1 false)
  call void @llvm.lifetime.start.p0(i64 65536, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 71680, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 71680, ptr nonnull %10) #3
  %invariant.gep = getelementptr i8, ptr %1, i64 -3072
  %invariant.gep8 = getelementptr i8, ptr %2, i64 -3072
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(71680) %9, ptr noundef nonnull align 4 dereferenceable(71680) %invariant.gep, i64 71680, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(71680) %10, ptr noundef nonnull align 4 dereferenceable(71680) %invariant.gep8, i64 71680, i1 false)
  call void @lc_gicov(ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %4, ptr noundef nonnull %5, i32 noundef 0)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(65536) %0, ptr noundef nonnull align 16 dereferenceable(65536) %8, i64 65536, i1 false)
  %gep.1 = getelementptr i8, ptr %1, i64 62464
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(71680) %9, ptr noundef nonnull align 4 dereferenceable(71680) %gep.1, i64 71680, i1 false)
  %gep9.1 = getelementptr i8, ptr %2, i64 62464
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(71680) %10, ptr noundef nonnull align 4 dereferenceable(71680) %gep9.1, i64 71680, i1 false)
  call void @lc_gicov(ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %4, ptr noundef nonnull %5, i32 noundef 1)
  %11 = getelementptr inbounds i8, ptr %0, i64 65536
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(65536) %11, ptr noundef nonnull align 16 dereferenceable(65536) %8, i64 65536, i1 false)
  %gep.2 = getelementptr i8, ptr %1, i64 128000
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(71680) %9, ptr noundef nonnull align 4 dereferenceable(71680) %gep.2, i64 71680, i1 false)
  %gep9.2 = getelementptr i8, ptr %2, i64 128000
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(71680) %10, ptr noundef nonnull align 4 dereferenceable(71680) %gep9.2, i64 71680, i1 false)
  call void @lc_gicov(ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %4, ptr noundef nonnull %5, i32 noundef 2)
  %12 = getelementptr inbounds i8, ptr %0, i64 131072
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(65536) %12, ptr noundef nonnull align 16 dereferenceable(65536) %8, i64 65536, i1 false)
  %gep.3 = getelementptr i8, ptr %1, i64 193536
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(71680) %9, ptr noundef nonnull align 4 dereferenceable(71680) %gep.3, i64 71680, i1 false)
  %gep9.3 = getelementptr i8, ptr %2, i64 193536
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(71680) %10, ptr noundef nonnull align 4 dereferenceable(71680) %gep9.3, i64 71680, i1 false)
  call void @lc_gicov(ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %4, ptr noundef nonnull %5, i32 noundef 3)
  %13 = getelementptr inbounds i8, ptr %0, i64 196608
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(65536) %13, ptr noundef nonnull align 16 dereferenceable(65536) %8, i64 65536, i1 false)
  call void @llvm.lifetime.end.p0(i64 71680, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 71680, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 65536, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %4) #3
  ret void
}

; 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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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)"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass