; LLVM IR from USDA-ARS-ACSL/MAIZSIM :: Crop source/timer.ll (ZN5TimerC2Eiiid)

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

%class.Timer = type <{ ptr, double, double, double, i32, [4 x i8] }>

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5TimerC2Eiiid(ptr noundef nonnull align 8 dereferenceable(36) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, double noundef %4) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca double, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  store double %4, ptr %10, align 8, !tbaa !11
  %13 = load ptr, ptr %6, align 8
  %14 = load i32, ptr %8, align 4, !tbaa !9
  %15 = load i32, ptr %7, align 4, !tbaa !9
  %16 = load i32, ptr %9, align 4, !tbaa !9
  %17 = call noundef i32 @_ZN5Timer6juldayEiii(ptr noundef nonnull align 8 dereferenceable(36) %13, i32 noundef %14, i32 noundef %15, i32 noundef %16)
  %18 = load i32, ptr %9, align 4, !tbaa !9
  %19 = call noundef i32 @_ZN5Timer6juldayEiii(ptr noundef nonnull align 8 dereferenceable(36) %13, i32 noundef 1, i32 noundef 1, i32 noundef %18)
  %20 = sub nsw i32 %17, %19
  %21 = add nsw i32 %20, 1
  %22 = getelementptr inbounds %class.Timer, ptr %13, i32 0, i32 4
  store i32 %21, ptr %22, align 8, !tbaa !13
  %23 = getelementptr inbounds %class.Timer, ptr %13, i32 0, i32 1
  store double 0.000000e+00, ptr %23, align 8, !tbaa !15
  %24 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 136) #4
  %25 = getelementptr inbounds %class.Timer, ptr %13, i32 0, i32 4
  %26 = load i32, ptr %25, align 8, !tbaa !13
  %27 = load i32, ptr %9, align 4, !tbaa !9
  invoke void @_ZN7CPMDateC1Eii(ptr noundef nonnull align 4 dereferenceable(136) %24, i32 noundef %26, i32 noundef %27)
          to label %28 unwind label %36

28:                                               ; preds = %5
  %29 = getelementptr inbounds %class.Timer, ptr %13, i32 0, i32 0
  store ptr %24, ptr %29, align 8, !tbaa !16
  %30 = load double, ptr %10, align 8, !tbaa !11
  %31 = getelementptr inbounds %class.Timer, ptr %13, i32 0, i32 2
  store double %30, ptr %31, align 8, !tbaa !17
  %32 = getelementptr inbounds %class.Timer, ptr %13, i32 0, i32 2
  %33 = load double, ptr %32, align 8, !tbaa !17
  %34 = fdiv double 2.400000e+01, %33
  %35 = getelementptr inbounds %class.Timer, ptr %13, i32 0, i32 3
  store double %34, ptr %35, align 8, !tbaa !18
  ret void

36:                                               ; preds = %5
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %11, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %12, align 4
  call void @_ZdlPvm(ptr noundef %24, i64 noundef 136) #5
  br label %40

40:                                               ; preds = %36
  %41 = load ptr, ptr %11, align 8
  %42 = load i32, ptr %12, align 4
  %43 = insertvalue { ptr, i32 } poison, ptr %41, 0
  %44 = insertvalue { ptr, i32 } %43, i32 %42, 1
  resume { ptr, i32 } %44
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN5Timer6juldayEiii(ptr noundef nonnull align 8 dereferenceable(36), i32 noundef, i32 noundef, i32 noundef) #0 align 2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #1

declare void @_ZN7CPMDateC1Eii(ptr noundef nonnull align 4 dereferenceable(136), i32 noundef, i32 noundef) unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #3

attributes #0 = { 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 #1 = { nobuiltin allocsize(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 = { "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 #3 = { nobuiltin nounwind "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 = { builtin allocsize(0) }
attributes #5 = { builtin 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 = !{!"double", !7, i64 0}
!13 = !{!14, !10, i64 32}
!14 = !{!"_ZTS5Timer", !6, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !10, i64 32}
!15 = !{!14, !12, i64 8}
!16 = !{!14, !6, i64 0}
!17 = !{!14, !12, i64 16}
!18 = !{!14, !12, i64 24}


; 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 uwtable
define dso_local void @_ZN5TimerC2Eiiid(ptr noundef nonnull align 8 dereferenceable(36) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, double noundef %4) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %6 = tail call noundef i32 @_ZN5Timer6juldayEiii(ptr noundef nonnull align 8 dereferenceable(36) %0, i32 noundef %2, i32 noundef %1, i32 noundef %3)
  %7 = tail call noundef i32 @_ZN5Timer6juldayEiii(ptr noundef nonnull align 8 dereferenceable(36) %0, i32 noundef 1, i32 noundef 1, i32 noundef %3)
  %8 = sub nsw i32 %6, %7
  %9 = add nsw i32 %8, 1
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %9, ptr %10, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  store double 0.000000e+00, ptr %11, align 8, !tbaa !12
  %12 = tail call noalias noundef nonnull dereferenceable(136) ptr @_Znwm(i64 noundef 136) #4
  invoke void @_ZN7CPMDateC1Eii(ptr noundef nonnull align 4 dereferenceable(136) %12, i32 noundef %9, i32 noundef %3)
          to label %13 unwind label %17

13:                                               ; preds = %5
  store ptr %12, ptr %0, align 8, !tbaa !13
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  store double %4, ptr %14, align 8, !tbaa !14
  %15 = fdiv double 2.400000e+01, %4
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  store double %15, ptr %16, align 8, !tbaa !15
  ret void

17:                                               ; preds = %5
  %18 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %12, i64 noundef 136) #5
  resume { ptr, i32 } %18
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN5Timer6juldayEiii(ptr noundef nonnull align 8 dereferenceable(36), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #1

declare void @_ZN7CPMDateC1Eii(ptr noundef nonnull align 4 dereferenceable(136), i32 noundef, i32 noundef) unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #3

attributes #0 = { 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 #1 = { nobuiltin allocsize(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 = { "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 #3 = { nobuiltin nounwind "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 = { builtin allocsize(0) }
attributes #5 = { builtin 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, !11, i64 32}
!6 = !{!"_ZTS5Timer", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !11, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!6, !10, i64 8}
!13 = !{!6, !7, i64 0}
!14 = !{!6, !10, i64 16}
!15 = !{!6, !10, i64 24}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass