; LLVM IR from CLASS-SZ/class_sz :: class-sz/tools (r8lib)

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

@r8_fall_values.f_vec = external hidden global [15 x double], align 16
@r8_fall_values.n_vec = external hidden global [15 x i32], align 16
@r8_fall_values.x_vec = external hidden global [15 x double], align 16

; Function Attrs: nounwind uwtable
define dso_local void @r8_fall_values(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = load i32, ptr %9, align 4, !tbaa !9
  %11 = icmp slt i32 %10, 0
  br i1 %11, label %12, label %14

12:                                               ; preds = %4
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %14

14:                                               ; preds = %12, %4
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = load i32, ptr %15, align 4, !tbaa !9
  %17 = add nsw i32 %16, 1
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  store i32 %17, ptr %18, align 4, !tbaa !9
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = load i32, ptr %19, align 4, !tbaa !9
  %21 = icmp slt i32 15, %20
  br i1 %21, label %22, label %27

22:                                               ; preds = %14
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  store i32 0, ptr %23, align 4, !tbaa !9
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  store double 0.000000e+00, ptr %24, align 8, !tbaa !11
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 0, ptr %25, align 4, !tbaa !9
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  store double 0.000000e+00, ptr %26, align 8, !tbaa !11
  br label %49

27:                                               ; preds = %14
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %30 = sub nsw i32 %29, 1
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [15 x double], ptr @r8_fall_values.x_vec, i64 0, i64 %31
  %33 = load double, ptr %32, align 8, !tbaa !11
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  store double %33, ptr %34, align 8, !tbaa !11
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = load i32, ptr %35, align 4, !tbaa !9
  %37 = sub nsw i32 %36, 1
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [15 x i32], ptr @r8_fall_values.n_vec, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !9
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 %40, ptr %41, align 4, !tbaa !9
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = load i32, ptr %42, align 4, !tbaa !9
  %44 = sub nsw i32 %43, 1
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [15 x double], ptr @r8_fall_values.f_vec, i64 0, i64 %45
  %47 = load double, ptr %46, align 8, !tbaa !11
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  store double %47, ptr %48, align 8, !tbaa !11
  br label %49

49:                                               ; preds = %27, %22
  ret void
}

attributes #0 = { 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" }

!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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}


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

@r8_fall_values.f_vec = external hidden local_unnamed_addr global [15 x double], align 16
@r8_fall_values.n_vec = external hidden local_unnamed_addr global [15 x i32], align 16
@r8_fall_values.x_vec = external hidden local_unnamed_addr global [15 x double], align 16

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @r8_fall_values(ptr nocapture noundef %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #0 {
  %5 = load i32, ptr %0, align 4, !tbaa !5
  %6 = icmp slt i32 %5, 0
  br i1 %6, label %.thread, label %7

.thread:                                          ; preds = %4
  store i32 1, ptr %0, align 4, !tbaa !5
  br label %11

7:                                                ; preds = %4
  %8 = add nuw nsw i32 %5, 1
  store i32 %8, ptr %0, align 4, !tbaa !5
  %9 = icmp ugt i32 %5, 14
  br i1 %9, label %10, label %11

10:                                               ; preds = %7
  store i32 0, ptr %0, align 4, !tbaa !5
  store double 0.000000e+00, ptr %1, align 8, !tbaa !9
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %23

11:                                               ; preds = %.thread, %7
  %12 = phi i32 [ 0, %.thread ], [ %5, %7 ]
  %13 = zext nneg i32 %12 to i64
  %14 = getelementptr inbounds [15 x double], ptr @r8_fall_values.x_vec, i64 0, i64 %13
  %15 = load double, ptr %14, align 8, !tbaa !9
  store double %15, ptr %1, align 8, !tbaa !9
  %16 = getelementptr inbounds [15 x i32], ptr @r8_fall_values.n_vec, i64 0, i64 %13
  %17 = load i32, ptr %16, align 4, !tbaa !5
  store i32 %17, ptr %2, align 4, !tbaa !5
  %18 = load i32, ptr %0, align 4, !tbaa !5
  %19 = add nsw i32 %18, -1
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [15 x double], ptr @r8_fall_values.f_vec, i64 0, i64 %20
  %22 = load double, ptr %21, align 8, !tbaa !9
  br label %23

23:                                               ; preds = %11, %10
  %storemerge = phi double [ %22, %11 ], [ 0.000000e+00, %10 ]
  store double %storemerge, ptr %3, align 8, !tbaa !9
  ret void
}

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass