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

; 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: nounwind uwtable
define dso_local void @r8_to_dhms(double noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #1 {
  %6 = alloca double, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store double %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #2
  %12 = load double, ptr %6, align 8, !tbaa !5
  %13 = fcmp ole double 0.000000e+00, %12
  br i1 %13, label %14, label %15

14:                                               ; preds = %5
  store i32 1, ptr %11, align 4, !tbaa !11
  br label %22

15:                                               ; preds = %5
  %16 = load double, ptr %6, align 8, !tbaa !5
  %17 = fcmp olt double %16, 0.000000e+00
  br i1 %17, label %18, label %21

18:                                               ; preds = %15
  store i32 -1, ptr %11, align 4, !tbaa !11
  %19 = load double, ptr %6, align 8, !tbaa !5
  %20 = fneg double %19
  store double %20, ptr %6, align 8, !tbaa !5
  br label %21

21:                                               ; preds = %18, %15
  br label %22

22:                                               ; preds = %21, %14
  %23 = load double, ptr %6, align 8, !tbaa !5
  %24 = fptosi double %23 to i32
  %25 = load ptr, ptr %7, align 8, !tbaa !9
  store i32 %24, ptr %25, align 4, !tbaa !11
  %26 = load double, ptr %6, align 8, !tbaa !5
  %27 = load ptr, ptr %7, align 8, !tbaa !9
  %28 = load i32, ptr %27, align 4, !tbaa !11
  %29 = sitofp i32 %28 to double
  %30 = fsub double %26, %29
  store double %30, ptr %6, align 8, !tbaa !5
  %31 = load double, ptr %6, align 8, !tbaa !5
  %32 = fmul double 2.400000e+01, %31
  store double %32, ptr %6, align 8, !tbaa !5
  %33 = load double, ptr %6, align 8, !tbaa !5
  %34 = fptosi double %33 to i32
  %35 = load ptr, ptr %8, align 8, !tbaa !9
  store i32 %34, ptr %35, align 4, !tbaa !11
  %36 = load double, ptr %6, align 8, !tbaa !5
  %37 = load ptr, ptr %8, align 8, !tbaa !9
  %38 = load i32, ptr %37, align 4, !tbaa !11
  %39 = sitofp i32 %38 to double
  %40 = fsub double %36, %39
  store double %40, ptr %6, align 8, !tbaa !5
  %41 = load double, ptr %6, align 8, !tbaa !5
  %42 = fmul double 6.000000e+01, %41
  store double %42, ptr %6, align 8, !tbaa !5
  %43 = load double, ptr %6, align 8, !tbaa !5
  %44 = fptosi double %43 to i32
  %45 = load ptr, ptr %9, align 8, !tbaa !9
  store i32 %44, ptr %45, align 4, !tbaa !11
  %46 = load double, ptr %6, align 8, !tbaa !5
  %47 = load ptr, ptr %9, align 8, !tbaa !9
  %48 = load i32, ptr %47, align 4, !tbaa !11
  %49 = sitofp i32 %48 to double
  %50 = fsub double %46, %49
  store double %50, ptr %6, align 8, !tbaa !5
  %51 = load double, ptr %6, align 8, !tbaa !5
  %52 = fmul double 6.000000e+01, %51
  store double %52, ptr %6, align 8, !tbaa !5
  %53 = load double, ptr %6, align 8, !tbaa !5
  %54 = fptosi double %53 to i32
  %55 = load ptr, ptr %10, align 8, !tbaa !9
  store i32 %54, ptr %55, align 4, !tbaa !11
  %56 = load i32, ptr %11, align 4, !tbaa !11
  %57 = icmp eq i32 %56, -1
  br i1 %57, label %58, label %75

58:                                               ; preds = %22
  %59 = load ptr, ptr %7, align 8, !tbaa !9
  %60 = load i32, ptr %59, align 4, !tbaa !11
  %61 = sub nsw i32 0, %60
  %62 = load ptr, ptr %7, align 8, !tbaa !9
  store i32 %61, ptr %62, align 4, !tbaa !11
  %63 = load ptr, ptr %8, align 8, !tbaa !9
  %64 = load i32, ptr %63, align 4, !tbaa !11
  %65 = sub nsw i32 0, %64
  %66 = load ptr, ptr %8, align 8, !tbaa !9
  store i32 %65, ptr %66, align 4, !tbaa !11
  %67 = load ptr, ptr %9, align 8, !tbaa !9
  %68 = load i32, ptr %67, align 4, !tbaa !11
  %69 = sub nsw i32 0, %68
  %70 = load ptr, ptr %9, align 8, !tbaa !9
  store i32 %69, ptr %70, align 4, !tbaa !11
  %71 = load ptr, ptr %10, align 8, !tbaa !9
  %72 = load i32, ptr %71, align 4, !tbaa !11
  %73 = sub nsw i32 0, %72
  %74 = load ptr, ptr %10, align 8, !tbaa !9
  store i32 %73, ptr %74, align 4, !tbaa !11
  br label %75

75:                                               ; preds = %58, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #2
  ret void
}

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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @r8_to_dhms(double noundef %0, ptr nocapture noundef %1, ptr nocapture noundef %2, ptr nocapture noundef %3, ptr nocapture noundef %4) local_unnamed_addr #0 {
  %6 = fcmp ult double %0, 0.000000e+00
  br i1 %6, label %7, label %11

7:                                                ; preds = %5
  %8 = fcmp olt double %0, 0.000000e+00
  br i1 %8, label %9, label %11

9:                                                ; preds = %7
  %10 = fneg double %0
  br label %11

11:                                               ; preds = %5, %7, %9
  %.028 = phi double [ %10, %9 ], [ %0, %7 ], [ %0, %5 ]
  %12 = phi i1 [ true, %9 ], [ undef, %7 ], [ false, %5 ]
  %13 = fptosi double %.028 to i32
  store i32 %13, ptr %1, align 4, !tbaa !5
  %14 = sitofp i32 %13 to double
  %15 = fsub double %.028, %14
  %16 = fmul double %15, 2.400000e+01
  %17 = fptosi double %16 to i32
  store i32 %17, ptr %2, align 4, !tbaa !5
  %18 = sitofp i32 %17 to double
  %19 = fsub double %16, %18
  %20 = fmul double %19, 6.000000e+01
  %21 = fptosi double %20 to i32
  store i32 %21, ptr %3, align 4, !tbaa !5
  %22 = sitofp i32 %21 to double
  %23 = fsub double %20, %22
  %24 = fmul double %23, 6.000000e+01
  %25 = fptosi double %24 to i32
  store i32 %25, ptr %4, align 4, !tbaa !5
  br i1 %12, label %26, label %35

26:                                               ; preds = %11
  %27 = load i32, ptr %1, align 4, !tbaa !5
  %28 = sub nsw i32 0, %27
  store i32 %28, ptr %1, align 4, !tbaa !5
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sub nsw i32 0, %29
  store i32 %30, ptr %2, align 4, !tbaa !5
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = sub nsw i32 0, %31
  store i32 %32, ptr %3, align 4, !tbaa !5
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = sub nsw i32 0, %33
  store i32 %34, ptr %4, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %26, %11
  ret void
}

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


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