; LLVM IR from bqi343/cp-notebook :: Implementations/content/geometry (13)/3D/death_conveyor.ll (Z5roundRKSt5arrayIeLm4EE)

; 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.std::array" = type { [4 x x86_fp80] }

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 16 dereferenceable(16) ptr @_ZNSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64), i64 noundef) #1 align 2

; 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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 16 dereferenceable(16) ptr @_ZNKSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64), i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_Z4abs2RKSt5arrayIeLm4EE(ptr noundef nonnull align 16 dereferenceable(64)) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZmiSt5arrayIeLm4EERKS0_(ptr dead_on_unwind noalias writable sret(%"struct.std::array") align 16, ptr noundef byval(%"struct.std::array") align 16, ptr noundef nonnull align 16 dereferenceable(64)) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5roundRKSt5arrayIeLm4EE(ptr dead_on_unwind noalias writable sret(%"struct.std::array") align 16 %0, ptr noundef nonnull align 16 dereferenceable(64) %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca %"struct.std::array", align 16
  %5 = alloca %"struct.std::array", align 16
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::array", align 16
  %9 = alloca %"struct.std::array", align 16
  %10 = alloca %"struct.std::array", align 16
  %11 = alloca %"struct.std::array", align 16
  store ptr %1, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 64, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 64, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %12

12:                                               ; preds = %26, %2
  %13 = load i32, ptr %6, align 4, !tbaa !9
  %14 = icmp slt i32 %13, 4
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %29

16:                                               ; preds = %12
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = load i32, ptr %6, align 4, !tbaa !9
  %19 = sext i32 %18 to i64
  %20 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNKSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %17, i64 noundef %19) #4
  %21 = load x86_fp80, ptr %20, align 16, !tbaa !11
  %22 = call noundef x86_fp80 @_ZSt5rounde(x86_fp80 noundef %21)
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %4, i64 noundef %24) #4
  store x86_fp80 %22, ptr %25, align 16, !tbaa !11
  br label %26

26:                                               ; preds = %16
  %27 = load i32, ptr %6, align 4, !tbaa !9
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %6, align 4, !tbaa !9
  br label %12, !llvm.loop !13

29:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %46, %29
  %31 = load i32, ptr %7, align 4, !tbaa !9
  %32 = icmp slt i32 %31, 4
  br i1 %32, label %34, label %33

33:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %49

34:                                               ; preds = %30
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = load i32, ptr %7, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNKSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %35, i64 noundef %37) #4
  %39 = load x86_fp80, ptr %38, align 16, !tbaa !11
  %40 = fsub x86_fp80 %39, 0xK3FFE8000000000000000
  %41 = call noundef x86_fp80 @_ZSt5rounde(x86_fp80 noundef %40)
  %42 = fadd x86_fp80 %41, 0xK3FFE8000000000000000
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %5, i64 noundef %44) #4
  store x86_fp80 %42, ptr %45, align 16, !tbaa !11
  br label %46

46:                                               ; preds = %34
  %47 = load i32, ptr %7, align 4, !tbaa !9
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %7, align 4, !tbaa !9
  br label %30, !llvm.loop !15

49:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 64, ptr %8) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %9, ptr align 16 %4, i64 64, i1 false), !tbaa.struct !16
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZmiSt5arrayIeLm4EERKS0_(ptr dead_on_unwind writable sret(%"struct.std::array") align 16 %8, ptr noundef byval(%"struct.std::array") align 16 %9, ptr noundef nonnull align 16 dereferenceable(64) %50)
  %51 = call noundef x86_fp80 @_Z4abs2RKSt5arrayIeLm4EE(ptr noundef nonnull align 16 dereferenceable(64) %8)
  call void @llvm.lifetime.start.p0(i64 64, ptr %10) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %11, ptr align 16 %5, i64 64, i1 false), !tbaa.struct !16
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZmiSt5arrayIeLm4EERKS0_(ptr dead_on_unwind writable sret(%"struct.std::array") align 16 %10, ptr noundef byval(%"struct.std::array") align 16 %11, ptr noundef nonnull align 16 dereferenceable(64) %52)
  %53 = call noundef x86_fp80 @_Z4abs2RKSt5arrayIeLm4EE(ptr noundef nonnull align 16 dereferenceable(64) %10)
  %54 = fcmp olt x86_fp80 %51, %53
  br i1 %54, label %55, label %56

55:                                               ; preds = %49
  br label %57

56:                                               ; preds = %49
  br label %57

57:                                               ; preds = %56, %55
  %58 = phi ptr [ %4, %55 ], [ %5, %56 ]
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %0, ptr align 16 %58, i64 64, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 64, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr %4) #4
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_ZSt5rounde(x86_fp80 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = !{!"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 = !{!12, !12, i64 0}
!12 = !{!"long double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{i64 0, i64 64, !17}
!17 = !{!7, !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"

%"struct.std::array" = type { [4 x x86_fp80] }

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 16 dereferenceable(16) ptr @_ZNSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64), i64 noundef) local_unnamed_addr #1 align 2

; 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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 16 dereferenceable(16) ptr @_ZNKSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_Z4abs2RKSt5arrayIeLm4EE(ptr noundef nonnull align 16 dereferenceable(64)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZmiSt5arrayIeLm4EERKS0_(ptr dead_on_unwind noalias writable sret(%"struct.std::array") align 16, ptr noundef byval(%"struct.std::array") align 16, ptr noundef nonnull align 16 dereferenceable(64)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z5roundRKSt5arrayIeLm4EE(ptr dead_on_unwind noalias nocapture writable writeonly sret(%"struct.std::array") align 16 %0, ptr noundef nonnull align 16 dereferenceable(64) %1) local_unnamed_addr #1 {
.preheader.preheader:
  %2 = alloca %"struct.std::array", align 16
  %3 = alloca %"struct.std::array", align 16
  %4 = alloca %"struct.std::array", align 16
  %5 = alloca %"struct.std::array", align 16
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %3) #3
  %6 = tail call noundef nonnull align 16 dereferenceable(16) ptr @_ZNKSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %1, i64 noundef 0) #3
  %7 = load x86_fp80, ptr %6, align 16, !tbaa !5
  %8 = tail call noundef x86_fp80 @_ZSt5rounde(x86_fp80 noundef %7)
  %9 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %2, i64 noundef 0) #3
  store x86_fp80 %8, ptr %9, align 16, !tbaa !5
  %10 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNKSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %1, i64 noundef 1) #3
  %11 = load x86_fp80, ptr %10, align 16, !tbaa !5
  %12 = call noundef x86_fp80 @_ZSt5rounde(x86_fp80 noundef %11)
  %13 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %2, i64 noundef 1) #3
  store x86_fp80 %12, ptr %13, align 16, !tbaa !5
  %14 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNKSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %1, i64 noundef 2) #3
  %15 = load x86_fp80, ptr %14, align 16, !tbaa !5
  %16 = call noundef x86_fp80 @_ZSt5rounde(x86_fp80 noundef %15)
  %17 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %2, i64 noundef 2) #3
  store x86_fp80 %16, ptr %17, align 16, !tbaa !5
  %18 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNKSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %1, i64 noundef 3) #3
  %19 = load x86_fp80, ptr %18, align 16, !tbaa !5
  %20 = call noundef x86_fp80 @_ZSt5rounde(x86_fp80 noundef %19)
  %21 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %2, i64 noundef 3) #3
  store x86_fp80 %20, ptr %21, align 16, !tbaa !5
  %22 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNKSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %1, i64 noundef 0) #3
  %23 = load x86_fp80, ptr %22, align 16, !tbaa !5
  %24 = fadd x86_fp80 %23, 0xKBFFE8000000000000000
  %25 = call noundef x86_fp80 @_ZSt5rounde(x86_fp80 noundef %24)
  %26 = fadd x86_fp80 %25, 0xK3FFE8000000000000000
  %27 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %3, i64 noundef 0) #3
  store x86_fp80 %26, ptr %27, align 16, !tbaa !5
  %28 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNKSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %1, i64 noundef 1) #3
  %29 = load x86_fp80, ptr %28, align 16, !tbaa !5
  %30 = fadd x86_fp80 %29, 0xKBFFE8000000000000000
  %31 = call noundef x86_fp80 @_ZSt5rounde(x86_fp80 noundef %30)
  %32 = fadd x86_fp80 %31, 0xK3FFE8000000000000000
  %33 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %3, i64 noundef 1) #3
  store x86_fp80 %32, ptr %33, align 16, !tbaa !5
  %34 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNKSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %1, i64 noundef 2) #3
  %35 = load x86_fp80, ptr %34, align 16, !tbaa !5
  %36 = fadd x86_fp80 %35, 0xKBFFE8000000000000000
  %37 = call noundef x86_fp80 @_ZSt5rounde(x86_fp80 noundef %36)
  %38 = fadd x86_fp80 %37, 0xK3FFE8000000000000000
  %39 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %3, i64 noundef 2) #3
  store x86_fp80 %38, ptr %39, align 16, !tbaa !5
  %40 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNKSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %1, i64 noundef 3) #3
  %41 = load x86_fp80, ptr %40, align 16, !tbaa !5
  %42 = fadd x86_fp80 %41, 0xKBFFE8000000000000000
  %43 = call noundef x86_fp80 @_ZSt5rounde(x86_fp80 noundef %42)
  %44 = fadd x86_fp80 %43, 0xK3FFE8000000000000000
  %45 = call noundef nonnull align 16 dereferenceable(16) ptr @_ZNSt5arrayIeLm4EEixEm(ptr noundef nonnull align 16 dereferenceable(64) %3, i64 noundef 3) #3
  store x86_fp80 %44, ptr %45, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %4) #3
  call void @_ZmiSt5arrayIeLm4EERKS0_(ptr dead_on_unwind nonnull writable sret(%"struct.std::array") align 16 %4, ptr noundef nonnull byval(%"struct.std::array") align 16 %2, ptr noundef nonnull align 16 dereferenceable(64) %1)
  %46 = call noundef x86_fp80 @_Z4abs2RKSt5arrayIeLm4EE(ptr noundef nonnull align 16 dereferenceable(64) %4)
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %5) #3
  call void @_ZmiSt5arrayIeLm4EERKS0_(ptr dead_on_unwind nonnull writable sret(%"struct.std::array") align 16 %5, ptr noundef nonnull byval(%"struct.std::array") align 16 %3, ptr noundef nonnull align 16 dereferenceable(64) %1)
  %47 = call noundef x86_fp80 @_Z4abs2RKSt5arrayIeLm4EE(ptr noundef nonnull align 16 dereferenceable(64) %5)
  %48 = fcmp olt x86_fp80 %46, %47
  %49 = select i1 %48, ptr %2, ptr %3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %0, ptr noundef nonnull align 16 dereferenceable(64) %49, i64 64, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %2) #3
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_ZSt5rounde(x86_fp80 noundef) local_unnamed_addr #1

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


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