; LLVM IR from ANL-CESAR/XSBench :: openmp-threading (Simulation)

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

; Function Attrs: nounwind uwtable
define dso_local i64 @fast_forward_LCG(i64 noundef %0, i64 noundef %1) #1 {
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  store i64 %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  store i64 -9223372036854775808, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  store i64 2806196910506780709, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  store i64 1, ptr %7, align 8, !tbaa !5
  %10 = load i64, ptr %4, align 8, !tbaa !5
  %11 = urem i64 %10, -9223372036854775808
  store i64 %11, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  store i64 1, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  store i64 0, ptr %9, align 8, !tbaa !5
  br label %12

12:                                               ; preds = %28, %2
  %13 = load i64, ptr %4, align 8, !tbaa !5
  %14 = icmp ugt i64 %13, 0
  br i1 %14, label %15, label %38

15:                                               ; preds = %12
  %16 = load i64, ptr %4, align 8, !tbaa !5
  %17 = and i64 %16, 1
  %18 = icmp ne i64 %17, 0
  br i1 %18, label %19, label %28

19:                                               ; preds = %15
  %20 = load i64, ptr %6, align 8, !tbaa !5
  %21 = load i64, ptr %8, align 8, !tbaa !5
  %22 = mul i64 %21, %20
  store i64 %22, ptr %8, align 8, !tbaa !5
  %23 = load i64, ptr %9, align 8, !tbaa !5
  %24 = load i64, ptr %6, align 8, !tbaa !5
  %25 = mul i64 %23, %24
  %26 = load i64, ptr %7, align 8, !tbaa !5
  %27 = add i64 %25, %26
  store i64 %27, ptr %9, align 8, !tbaa !5
  br label %28

28:                                               ; preds = %19, %15
  %29 = load i64, ptr %6, align 8, !tbaa !5
  %30 = add i64 %29, 1
  %31 = load i64, ptr %7, align 8, !tbaa !5
  %32 = mul i64 %31, %30
  store i64 %32, ptr %7, align 8, !tbaa !5
  %33 = load i64, ptr %6, align 8, !tbaa !5
  %34 = load i64, ptr %6, align 8, !tbaa !5
  %35 = mul i64 %34, %33
  store i64 %35, ptr %6, align 8, !tbaa !5
  %36 = load i64, ptr %4, align 8, !tbaa !5
  %37 = lshr i64 %36, 1
  store i64 %37, ptr %4, align 8, !tbaa !5
  br label %12, !llvm.loop !9

38:                                               ; preds = %12
  %39 = load i64, ptr %8, align 8, !tbaa !5
  %40 = load i64, ptr %3, align 8, !tbaa !5
  %41 = mul i64 %39, %40
  %42 = load i64, ptr %9, align 8, !tbaa !5
  %43 = add i64 %41, %42
  %44 = urem i64 %43, -9223372036854775808
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  ret i64 %44
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"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"

; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local range(i64 0, -9223372036854775808) i64 @fast_forward_LCG(i64 noundef %0, i64 noundef %1) local_unnamed_addr #0 {
  %3 = and i64 %1, 9223372036854775807
  %.not22 = icmp eq i64 %3, 0
  br i1 %.not22, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %9
  %.027 = phi i64 [ %.1, %9 ], [ 0, %2 ]
  %.01626 = phi i64 [ %.117, %9 ], [ 1, %2 ]
  %.01825 = phi i64 [ %11, %9 ], [ 1, %2 ]
  %.01924 = phi i64 [ %12, %9 ], [ 2806196910506780709, %2 ]
  %.02023 = phi i64 [ %13, %9 ], [ %3, %2 ]
  %4 = and i64 %.02023, 1
  %.not21 = icmp eq i64 %4, 0
  br i1 %.not21, label %9, label %5

5:                                                ; preds = %.lr.ph
  %6 = mul i64 %.01626, %.01924
  %7 = mul i64 %.027, %.01924
  %8 = add i64 %7, %.01825
  br label %9

9:                                                ; preds = %5, %.lr.ph
  %.117 = phi i64 [ %6, %5 ], [ %.01626, %.lr.ph ]
  %.1 = phi i64 [ %8, %5 ], [ %.027, %.lr.ph ]
  %10 = add i64 %.01924, 1
  %11 = mul i64 %.01825, %10
  %12 = mul i64 %.01924, %.01924
  %13 = lshr i64 %.02023, 1
  %.not = icmp ult i64 %.02023, 2
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !5

._crit_edge:                                      ; preds = %9, %2
  %.016.lcssa = phi i64 [ 1, %2 ], [ %.117, %9 ]
  %.0.lcssa = phi i64 [ 0, %2 ], [ %.1, %9 ]
  %14 = mul i64 %.016.lcssa, %0
  %15 = add i64 %14, %.0.lcssa
  %16 = and i64 %15, 9223372036854775807
  ret i64 %16
}

attributes #0 = { nofree norecurse nosync nounwind memory(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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass