; LLVM IR from EntityFX/anybench :: src/benchmarks/generic/lloops (lloops)

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

%struct.Parameters = type { i64, i64, i64, double, [3 x [25 x double]], [3 x [25 x i64]], [3 x [25 x double]], [3 x [25 x double]], [3 x [25 x double]], [25 x i64], [3 x [25 x i64]], [3 x [25 x i64]], double, double, double, i64, i64, i64, [3 x [25 x i64]], i64, i64, i64, i64, i64, i64, double, i64 }

@as2 = external dso_local global %struct.Parameters, align 8
@__const.parameters.nloops = external hidden unnamed_addr constant [3 x [25 x i64]], align 16
@__const.parameters.lpass = external hidden unnamed_addr constant [3 x [25 x i64]], align 16
@__const.parameters.sums = external hidden unnamed_addr constant [3 x [25 x double]], align 16
@__const.parameters.number_flops = external hidden unnamed_addr constant [25 x double], align 16

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

; 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) #1

declare void @start_time(...) #2

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

; Function Attrs: nounwind uwtable
define dso_local i64 @parameters(i64 noundef %0) #3 {
  %2 = alloca i64, align 8
  %3 = alloca [3 x [25 x i64]], align 16
  %4 = alloca [3 x [25 x i64]], align 16
  %5 = alloca [3 x [25 x double]], align 16
  %6 = alloca [25 x double], align 16
  %7 = alloca double, align 8
  store i64 %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 600, ptr %3) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %3, ptr align 16 @__const.parameters.nloops, i64 600, i1 false)
  call void @llvm.lifetime.start.p0(i64 600, ptr %4) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %4, ptr align 16 @__const.parameters.lpass, i64 600, i1 false)
  call void @llvm.lifetime.start.p0(i64 600, ptr %5) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %5, ptr align 16 @__const.parameters.sums, i64 600, i1 false)
  call void @llvm.lifetime.start.p0(i64 200, ptr %6) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %6, ptr align 16 @__const.parameters.number_flops, i64 200, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store double 1.000000e+00, ptr %7, align 8, !tbaa !9
  %8 = load i64, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 23), align 8, !tbaa !11
  %9 = getelementptr inbounds [3 x [25 x i64]], ptr %3, i64 0, i64 %8
  %10 = load i64, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds [25 x i64], ptr %9, i64 0, i64 %10
  %12 = load i64, ptr %11, align 8, !tbaa !5
  store i64 %12, ptr @as2, align 8, !tbaa !13
  %13 = load i64, ptr @as2, align 8, !tbaa !13
  %14 = load i64, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 23), align 8, !tbaa !11
  %15 = getelementptr inbounds [3 x [25 x i64]], ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 11), i64 0, i64 %14
  %16 = load i64, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds [25 x i64], ptr %15, i64 0, i64 %16
  store i64 %13, ptr %17, align 8, !tbaa !5
  %18 = load i64, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 23), align 8, !tbaa !11
  %19 = getelementptr inbounds [3 x [25 x i64]], ptr %3, i64 0, i64 %18
  %20 = getelementptr inbounds [25 x i64], ptr %19, i64 0, i64 16
  %21 = load i64, ptr %20, align 8, !tbaa !5
  store i64 %21, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 24), align 8, !tbaa !14
  %22 = load i64, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds [25 x double], ptr %6, i64 0, i64 %22
  %24 = load double, ptr %23, align 8, !tbaa !9
  store double %24, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 3), align 8, !tbaa !15
  %25 = load double, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 3), align 8, !tbaa !15
  %26 = fptosi double %25 to i64
  %27 = load i64, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds [25 x i64], ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 9), i64 0, i64 %27
  store i64 %26, ptr %28, align 8, !tbaa !5
  %29 = load i64, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 23), align 8, !tbaa !11
  %30 = getelementptr inbounds [3 x [25 x i64]], ptr %4, i64 0, i64 %29
  %31 = load i64, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds [25 x i64], ptr %30, i64 0, i64 %31
  %33 = load i64, ptr %32, align 8, !tbaa !5
  store i64 %33, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 1), align 8, !tbaa !16
  %34 = load i64, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 1), align 8, !tbaa !16
  %35 = load i64, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 23), align 8, !tbaa !11
  %36 = getelementptr inbounds [3 x [25 x i64]], ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 10), i64 0, i64 %35
  %37 = load i64, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds [25 x i64], ptr %36, i64 0, i64 %37
  store i64 %34, ptr %38, align 8, !tbaa !5
  %39 = load i64, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 1), align 8, !tbaa !16
  %40 = load i64, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 2), align 8, !tbaa !17
  %41 = mul nsw i64 %39, %40
  store i64 %41, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 1), align 8, !tbaa !16
  %42 = load i64, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 23), align 8, !tbaa !11
  %43 = getelementptr inbounds [3 x [25 x double]], ptr %5, i64 0, i64 %42
  %44 = load i64, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds [25 x double], ptr %43, i64 0, i64 %44
  %46 = load double, ptr %45, align 8, !tbaa !9
  store double %46, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 25), align 8, !tbaa !18
  store i64 0, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 15), align 8, !tbaa !19
  %47 = load i64, ptr %2, align 8, !tbaa !5
  call void @init(i64 noundef %47)
  %48 = load i64, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 16), align 8, !tbaa !20
  %49 = icmp eq i64 %48, 0
  br i1 %49, label %50, label %51

50:                                               ; preds = %1
  call void (...) @start_time()
  br label %51

51:                                               ; preds = %50, %1
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 200, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 600, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 600, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 600, ptr %3) #4
  ret i64 0
}

; Function Attrs: nounwind uwtable
declare dso_local void @init(i64 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 #3 = { 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 = !{!"long", !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 = !{!12, !6, i64 5112}
!12 = !{!"Parameters", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !7, i64 32, !7, i64 632, !7, i64 1232, !7, i64 1832, !7, i64 2432, !7, i64 3032, !7, i64 3232, !7, i64 3832, !10, i64 4432, !10, i64 4440, !10, i64 4448, !6, i64 4456, !6, i64 4464, !6, i64 4472, !7, i64 4480, !6, i64 5080, !6, i64 5088, !6, i64 5096, !6, i64 5104, !6, i64 5112, !6, i64 5120, !10, i64 5128, !6, i64 5136}
!13 = !{!12, !6, i64 0}
!14 = !{!12, !6, i64 5120}
!15 = !{!12, !10, i64 24}
!16 = !{!12, !6, i64 8}
!17 = !{!12, !6, i64 16}
!18 = !{!12, !10, i64 5128}
!19 = !{!12, !6, i64 4456}
!20 = !{!12, !6, i64 4464}


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

%struct.Parameters = type { i64, i64, i64, double, [3 x [25 x double]], [3 x [25 x i64]], [3 x [25 x double]], [3 x [25 x double]], [3 x [25 x double]], [25 x i64], [3 x [25 x i64]], [3 x [25 x i64]], double, double, double, i64, i64, i64, [3 x [25 x i64]], i64, i64, i64, i64, i64, i64, double, i64 }

@as2 = external dso_local local_unnamed_addr global %struct.Parameters, align 8
@__const.parameters.nloops = external hidden unnamed_addr constant [3 x [25 x i64]], align 16
@__const.parameters.lpass = external hidden unnamed_addr constant [3 x [25 x i64]], align 16
@__const.parameters.sums = external hidden unnamed_addr constant [3 x [25 x double]], align 16
@__const.parameters.number_flops = external hidden unnamed_addr constant [25 x double], align 16

declare void @start_time(...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i64 @parameters(i64 noundef %0) local_unnamed_addr #1 {
  %2 = load i64, ptr getelementptr inbounds (i8, ptr @as2, i64 5112), align 8, !tbaa !5
  %3 = getelementptr inbounds [3 x [25 x i64]], ptr @__const.parameters.nloops, i64 0, i64 %2, i64 %0
  %4 = load i64, ptr %3, align 8, !tbaa !11
  store i64 %4, ptr @as2, align 8, !tbaa !12
  %5 = getelementptr inbounds [3 x [25 x i64]], ptr getelementptr inbounds (i8, ptr @as2, i64 3832), i64 0, i64 %2, i64 %0
  store i64 %4, ptr %5, align 8, !tbaa !11
  %6 = load i64, ptr getelementptr inbounds (i8, ptr @as2, i64 5112), align 8, !tbaa !5
  %7 = getelementptr inbounds [3 x [25 x i64]], ptr @__const.parameters.nloops, i64 0, i64 %6, i64 16
  %8 = load i64, ptr %7, align 8, !tbaa !11
  store i64 %8, ptr getelementptr inbounds (i8, ptr @as2, i64 5120), align 8, !tbaa !13
  %9 = getelementptr inbounds [25 x double], ptr @__const.parameters.number_flops, i64 0, i64 %0
  %10 = load double, ptr %9, align 8, !tbaa !14
  store double %10, ptr getelementptr inbounds (i8, ptr @as2, i64 24), align 8, !tbaa !15
  %11 = fptosi double %10 to i64
  %12 = getelementptr inbounds [25 x i64], ptr getelementptr inbounds (i8, ptr @as2, i64 3032), i64 0, i64 %0
  store i64 %11, ptr %12, align 8, !tbaa !11
  %13 = load i64, ptr getelementptr inbounds (i8, ptr @as2, i64 5112), align 8, !tbaa !5
  %14 = getelementptr inbounds [3 x [25 x i64]], ptr @__const.parameters.lpass, i64 0, i64 %13, i64 %0
  %15 = load i64, ptr %14, align 8, !tbaa !11
  store i64 %15, ptr getelementptr inbounds (i8, ptr @as2, i64 8), align 8, !tbaa !16
  %16 = getelementptr inbounds [3 x [25 x i64]], ptr getelementptr inbounds (i8, ptr @as2, i64 3232), i64 0, i64 %13, i64 %0
  store i64 %15, ptr %16, align 8, !tbaa !11
  %17 = load i64, ptr getelementptr inbounds (i8, ptr @as2, i64 8), align 8, !tbaa !16
  %18 = load i64, ptr getelementptr inbounds (i8, ptr @as2, i64 16), align 8, !tbaa !17
  %19 = mul nsw i64 %18, %17
  store i64 %19, ptr getelementptr inbounds (i8, ptr @as2, i64 8), align 8, !tbaa !16
  %20 = load i64, ptr getelementptr inbounds (i8, ptr @as2, i64 5112), align 8, !tbaa !5
  %21 = getelementptr inbounds [3 x [25 x double]], ptr @__const.parameters.sums, i64 0, i64 %20, i64 %0
  %22 = load double, ptr %21, align 8, !tbaa !14
  store double %22, ptr getelementptr inbounds (i8, ptr @as2, i64 5128), align 8, !tbaa !18
  store i64 0, ptr getelementptr inbounds (i8, ptr @as2, i64 4456), align 8, !tbaa !19
  tail call void @init(i64 noundef %0)
  %23 = load i64, ptr getelementptr inbounds (i8, ptr @as2, i64 4464), align 8, !tbaa !20
  %24 = icmp eq i64 %23, 0
  br i1 %24, label %25, label %26

25:                                               ; preds = %1
  tail call void (...) @start_time() #2
  br label %26

26:                                               ; preds = %25, %1
  ret i64 0
}

; Function Attrs: nounwind uwtable
declare dso_local void @init(i64 noundef) local_unnamed_addr #1

attributes #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 = { 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 #2 = { 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, !7, i64 5112}
!6 = !{!"Parameters", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !8, i64 32, !8, i64 632, !8, i64 1232, !8, i64 1832, !8, i64 2432, !8, i64 3032, !8, i64 3232, !8, i64 3832, !10, i64 4432, !10, i64 4440, !10, i64 4448, !7, i64 4456, !7, i64 4464, !7, i64 4472, !8, i64 4480, !7, i64 5080, !7, i64 5088, !7, i64 5096, !7, i64 5104, !7, i64 5112, !7, i64 5120, !10, i64 5128, !7, i64 5136}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !7, i64 5120}
!14 = !{!10, !10, i64 0}
!15 = !{!6, !10, i64 24}
!16 = !{!6, !7, i64 8}
!17 = !{!6, !7, i64 16}
!18 = !{!6, !10, i64 5128}
!19 = !{!6, !7, i64 4456}
!20 = !{!6, !7, i64 4464}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,TailCallElimPass