; 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 }
%union.Data = type { %struct.Arrays }
%struct.Arrays = type { [1001 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [101 x double], [101 x double], [101 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [2048 x double], [101 x double], [101 x double], [101 x double], [101 x double], [101 x double], [101 x double], [101 x double], [101 x double], [300 x double], [300 x double], [101 x double], [101 x double], [512 x [4 x double]], [101 x [25 x double]], [101 x [25 x double]], [25 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [64 x [64 x double]], [64 x [64 x double]], [64 x [64 x double]], [2 x [101 x [5 x double]]], [2 x [101 x [5 x double]]], [2 x [101 x [5 x double]]], [40 x double], [96 x i64], [96 x i64], [1001 x i64], [1001 x i64], [301 x i64], [1001 x double], [1001 x double], [101 x [25 x double]], [512 x [4 x double]], [64 x [64 x double]], [2048 x double], [101 x double], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [101 x [25 x double]], double, double }

@as2 = external dso_local global %struct.Parameters, align 8
@as1 = external dso_local global %union.Data, align 8
@__const.iqranf.seed = external hidden unnamed_addr constant [3 x i64], 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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #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 void @iqranf() #3 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca [3 x i64], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %16, ptr align 16 @__const.iqranf.seed, i64 24, i1 false)
  store i64 1001, ptr %4, align 8, !tbaa !5
  store i64 1, ptr %2, align 8, !tbaa !5
  store i64 1001, ptr %3, align 8, !tbaa !5
  %17 = load i64, ptr getelementptr inbounds (%struct.Parameters, ptr @as2, i32 0, i32 23), align 8, !tbaa !9
  %18 = getelementptr inbounds [3 x i64], ptr %16, i64 0, i64 %17
  %19 = load i64, ptr %18, align 8, !tbaa !5
  store i64 %19, ptr %6, align 8, !tbaa !5
  %20 = load i64, ptr %2, align 8, !tbaa !5
  store i64 %20, ptr %1, align 8, !tbaa !5
  %21 = load i64, ptr %3, align 8, !tbaa !5
  %22 = load i64, ptr %2, align 8, !tbaa !5
  %23 = sub nsw i64 %21, %22
  %24 = sitofp i64 %23 to double
  store double %24, ptr %7, align 8, !tbaa !12
  store double 1.680700e+04, ptr %8, align 8, !tbaa !12
  store double 0x41DFFFFFFFC00000, ptr %10, align 8, !tbaa !12
  %25 = load i64, ptr %4, align 8, !tbaa !5
  %26 = sitofp i64 %25 to double
  store double %26, ptr %9, align 8, !tbaa !12
  store double 1.000010e+00, ptr %11, align 8, !tbaa !12
  %27 = load double, ptr %11, align 8, !tbaa !12
  %28 = load double, ptr %7, align 8, !tbaa !12
  %29 = load double, ptr %9, align 8, !tbaa !12
  %30 = fdiv double %28, %29
  %31 = fmul double %27, %30
  store double %31, ptr %12, align 8, !tbaa !12
  %32 = load i64, ptr %6, align 8, !tbaa !5
  %33 = sitofp i64 %32 to double
  store double %33, ptr %13, align 8, !tbaa !12
  store i64 0, ptr %5, align 8, !tbaa !5
  br label %34

34:                                               ; preds = %87, %0
  %35 = load i64, ptr %5, align 8, !tbaa !5
  %36 = load i64, ptr %4, align 8, !tbaa !5
  %37 = icmp slt i64 %35, %36
  br i1 %37, label %38, label %90

38:                                               ; preds = %34
  %39 = load double, ptr %13, align 8, !tbaa !12
  %40 = load double, ptr %8, align 8, !tbaa !12
  %41 = fmul double %39, %40
  store double %41, ptr %14, align 8, !tbaa !12
  %42 = load double, ptr %14, align 8, !tbaa !12
  %43 = load double, ptr %14, align 8, !tbaa !12
  %44 = load double, ptr %10, align 8, !tbaa !12
  %45 = fdiv double %43, %44
  %46 = fptosi double %45 to i64
  %47 = sitofp i64 %46 to double
  %48 = load double, ptr %10, align 8, !tbaa !12
  %49 = fneg double %47
  %50 = call double @llvm.fmuladd.f64(double %49, double %48, double %42)
  store double %50, ptr %13, align 8, !tbaa !12
  %51 = load double, ptr %13, align 8, !tbaa !12
  %52 = load double, ptr %7, align 8, !tbaa !12
  %53 = fmul double %51, %52
  store double %53, ptr %15, align 8, !tbaa !12
  %54 = load i64, ptr %1, align 8, !tbaa !5
  %55 = load double, ptr %15, align 8, !tbaa !12
  %56 = load double, ptr %10, align 8, !tbaa !12
  %57 = fdiv double %55, %56
  %58 = fptosi double %57 to i64
  %59 = add nsw i64 %54, %58
  %60 = load i64, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds [1001 x i64], ptr getelementptr inbounds (%struct.Arrays, ptr @as1, i32 0, i32 58), i64 0, i64 %60
  store i64 %59, ptr %61, align 8, !tbaa !13
  %62 = load i64, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds [1001 x i64], ptr getelementptr inbounds (%struct.Arrays, ptr @as1, i32 0, i32 58), i64 0, i64 %62
  %64 = load i64, ptr %63, align 8, !tbaa !13
  %65 = load i64, ptr %2, align 8, !tbaa !5
  %66 = icmp slt i64 %64, %65
  %67 = zext i1 %66 to i32
  %68 = load i64, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds [1001 x i64], ptr getelementptr inbounds (%struct.Arrays, ptr @as1, i32 0, i32 58), i64 0, i64 %68
  %70 = load i64, ptr %69, align 8, !tbaa !13
  %71 = load i64, ptr %3, align 8, !tbaa !5
  %72 = icmp sgt i64 %70, %71
  %73 = zext i1 %72 to i32
  %74 = or i32 %67, %73
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %86

76:                                               ; preds = %38
  %77 = load i64, ptr %1, align 8, !tbaa !5
  %78 = load i64, ptr %5, align 8, !tbaa !5
  %79 = add nsw i64 %77, %78
  %80 = load double, ptr %12, align 8, !tbaa !12
  %81 = fptosi double %80 to i64
  %82 = mul nsw i64 1, %81
  %83 = add nsw i64 %79, %82
  %84 = load i64, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds [1001 x i64], ptr getelementptr inbounds (%struct.Arrays, ptr @as1, i32 0, i32 58), i64 0, i64 %84
  store i64 %83, ptr %85, align 8, !tbaa !13
  br label %86

86:                                               ; preds = %76, %38
  br label %87

87:                                               ; preds = %86
  %88 = load i64, ptr %5, align 8, !tbaa !5
  %89 = add nsw i64 %88, 1
  store i64 %89, ptr %5, align 8, !tbaa !5
  br label %34, !llvm.loop !14

90:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !6, i64 5112}
!10 = !{!"Parameters", !6, i64 0, !6, i64 8, !6, i64 16, !11, 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, !11, i64 4432, !11, i64 4440, !11, 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, !11, i64 5128, !6, i64 5136}
!11 = !{!"double", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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"

%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 }
%union.Data = type { %struct.Arrays }
%struct.Arrays = type { [1001 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [101 x double], [101 x double], [101 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [1001 x double], [2048 x double], [101 x double], [101 x double], [101 x double], [101 x double], [101 x double], [101 x double], [101 x double], [101 x double], [300 x double], [300 x double], [101 x double], [101 x double], [512 x [4 x double]], [101 x [25 x double]], [101 x [25 x double]], [25 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [64 x [64 x double]], [64 x [64 x double]], [64 x [64 x double]], [2 x [101 x [5 x double]]], [2 x [101 x [5 x double]]], [2 x [101 x [5 x double]]], [40 x double], [96 x i64], [96 x i64], [1001 x i64], [1001 x i64], [301 x i64], [1001 x double], [1001 x double], [101 x [25 x double]], [512 x [4 x double]], [64 x [64 x double]], [2048 x double], [101 x double], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [7 x [101 x double]], [101 x [25 x double]], double, double }

@as2 = external dso_local local_unnamed_addr global %struct.Parameters, align 8
@as1 = external dso_local local_unnamed_addr global %union.Data, align 8
@__const.iqranf.seed = external hidden unnamed_addr constant [3 x i64], align 16

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @iqranf() local_unnamed_addr #1 {
  %1 = load i64, ptr getelementptr inbounds (i8, ptr @as2, i64 5112), align 8, !tbaa !5
  %2 = getelementptr inbounds [3 x i64], ptr @__const.iqranf.seed, i64 0, i64 %1
  %3 = load i64, ptr %2, align 8, !tbaa !11
  %4 = sitofp i64 %3 to double
  br label %5

5:                                                ; preds = %0, %5
  %.032 = phi i64 [ 0, %0 ], [ %20, %5 ]
  %.03031 = phi double [ %4, %0 ], [ %11, %5 ]
  %6 = fmul double %.03031, 1.680700e+04
  %7 = fdiv double %6, 0x41DFFFFFFFC00000
  %8 = fptosi double %7 to i64
  %9 = sitofp i64 %8 to double
  %10 = fneg double %9
  %11 = tail call double @llvm.fmuladd.f64(double %10, double 0x41DFFFFFFFC00000, double %6)
  %12 = fmul double %11, 1.000000e+03
  %13 = fdiv double %12, 0x41DFFFFFFFC00000
  %14 = fptosi double %13 to i64
  %15 = getelementptr inbounds [1001 x i64], ptr getelementptr inbounds (i8, ptr @as1, i64 434728), i64 0, i64 %.032
  %.lobit = lshr i64 %14, 63
  %16 = trunc nuw nsw i64 %.lobit to i32
  %17 = icmp sgt i64 %14, 1000
  %18 = zext i1 %17 to i32
  %19 = or i32 %16, %18
  %.not = icmp eq i32 %19, 0
  %spec.select = select i1 %.not, i64 %14, i64 %.032
  %storemerge = add nsw i64 %spec.select, 1
  store i64 %storemerge, ptr %15, align 8, !tbaa !12
  %20 = add nuw nsw i64 %.032, 1
  %exitcond.not = icmp eq i64 %20, 1001
  br i1 %exitcond.not, label %21, label %5, !llvm.loop !13

21:                                               ; preds = %5
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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" }

!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 = !{!8, !8, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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