; LLVM IR from simbody/simbody :: SimTKcommon/src/Parallel2DExecutor.ll (ZN5SimTK22Parallel2DExecutorImplD2Ev)

; 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.SimTK::Parallel2DExecutorImpl" = type <{ %"class.SimTK::PIMPLImplementation.base", i32, %"class.SimTK::Array_", %"class.SimTK::Array_.0", ptr, i8, [7 x i8] }>
%"class.SimTK::PIMPLImplementation.base" = type <{ ptr, i32 }>
%"class.SimTK::Array_" = type { %"class.SimTK::ArrayView_" }
%"class.SimTK::ArrayView_" = type { %"class.SimTK::ArrayViewConst_" }
%"class.SimTK::ArrayViewConst_" = type { ptr, i32, i32 }
%"class.SimTK::Array_.0" = type { %"class.SimTK::ArrayView_.1" }
%"class.SimTK::ArrayView_.1" = type { %"class.SimTK::ArrayViewConst_.2" }
%"class.SimTK::ArrayViewConst_.2" = type { ptr, i32, i32 }

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5SimTK6Array_IijED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5SimTK6Array_INS0_ISt4pairIiiEjEEjED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1 align 2

; Function Attrs: nounwind
declare void @_ZN5SimTK19PIMPLImplementationINS_18Parallel2DExecutorENS_22Parallel2DExecutorImplEED2Ev(ptr noundef nonnull align 8 dereferenceable(12)) unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN5SimTK22Parallel2DExecutorImplD2Ev(ptr noundef nonnull align 8 dereferenceable(57) %0) unnamed_addr #1 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %"class.SimTK::Parallel2DExecutorImpl", ptr %3, i32 0, i32 4
  %5 = load ptr, ptr %4, align 8, !tbaa !9
  %6 = icmp ne ptr %5, null
  br i1 %6, label %7, label %17

7:                                                ; preds = %1
  %8 = getelementptr inbounds %"class.SimTK::Parallel2DExecutorImpl", ptr %3, i32 0, i32 5
  %9 = load i8, ptr %8, align 8, !tbaa !20, !range !21, !noundef !22
  %10 = trunc i8 %9 to i1
  br i1 %10, label %11, label %17

11:                                               ; preds = %7
  %12 = getelementptr inbounds %"class.SimTK::Parallel2DExecutorImpl", ptr %3, i32 0, i32 4
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = icmp eq ptr %13, null
  br i1 %14, label %16, label %15

15:                                               ; preds = %11
  call void @_ZN5SimTK11PIMPLHandleINS_16ParallelExecutorENS_20ParallelExecutorImplELb0EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #3
  call void @_ZdlPvm(ptr noundef %13, i64 noundef 8) #4
  br label %16

16:                                               ; preds = %15, %11
  br label %17

17:                                               ; preds = %16, %7, %1
  %18 = getelementptr inbounds %"class.SimTK::Parallel2DExecutorImpl", ptr %3, i32 0, i32 3
  call void @_ZN5SimTK6Array_IijED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %18) #3
  %19 = getelementptr inbounds %"class.SimTK::Parallel2DExecutorImpl", ptr %3, i32 0, i32 2
  call void @_ZN5SimTK6Array_INS0_ISt4pairIiiEjEEjED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %19) #3
  call void @_ZN5SimTK19PIMPLImplementationINS_18Parallel2DExecutorENS_22Parallel2DExecutorImplEED2Ev(ptr noundef nonnull align 8 dereferenceable(12) %3) #3
  ret void
}

; Function Attrs: nounwind
declare void @_ZN5SimTK11PIMPLHandleINS_16ParallelExecutorENS_20ParallelExecutorImplELb0EED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2

attributes #0 = { 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 #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 = { 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 #3 = { nounwind }
attributes #4 = { 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, !6, i64 48}
!10 = !{!"_ZTSN5SimTK22Parallel2DExecutorImplE", !11, i64 0, !12, i64 12, !13, i64 16, !16, i64 32, !6, i64 48, !19, i64 56}
!11 = !{!"_ZTSN5SimTK19PIMPLImplementationINS_18Parallel2DExecutorENS_22Parallel2DExecutorImplEEE", !6, i64 0, !12, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTSN5SimTK6Array_INS0_ISt4pairIiiEjEEjEE", !14, i64 0}
!14 = !{!"_ZTSN5SimTK10ArrayView_INS_6Array_ISt4pairIiiEjEEjEE", !15, i64 0}
!15 = !{!"_ZTSN5SimTK15ArrayViewConst_INS_6Array_ISt4pairIiiEjEEjEE", !6, i64 0, !12, i64 8, !12, i64 12}
!16 = !{!"_ZTSN5SimTK6Array_IijEE", !17, i64 0}
!17 = !{!"_ZTSN5SimTK10ArrayView_IijEE", !18, i64 0}
!18 = !{!"_ZTSN5SimTK15ArrayViewConst_IijEE", !6, i64 0, !12, i64 8, !12, i64 12}
!19 = !{!"bool", !7, i64 0}
!20 = !{!10, !19, i64 56}
!21 = !{i8 0, i8 2}
!22 = !{}


; 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: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5SimTK6Array_IijED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5SimTK6Array_INS0_ISt4pairIiiEjEEjED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1 align 2

; Function Attrs: nounwind
declare void @_ZN5SimTK19PIMPLImplementationINS_18Parallel2DExecutorENS_22Parallel2DExecutorImplEED2Ev(ptr noundef nonnull align 8 dereferenceable(12)) unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN5SimTK22Parallel2DExecutorImplD2Ev(ptr noundef nonnull align 8 dereferenceable(57) %0) unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 48
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %9, label %4

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 56
  %6 = load i8, ptr %5, align 8, !tbaa !19, !range !20, !noundef !21
  %7 = trunc nuw i8 %6 to i1
  br i1 %7, label %8, label %9

8:                                                ; preds = %4
  tail call void @_ZN5SimTK11PIMPLHandleINS_16ParallelExecutorENS_20ParallelExecutorImplELb0EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  tail call void @_ZdlPvm(ptr noundef nonnull %3, i64 noundef 8) #4
  br label %9

9:                                                ; preds = %8, %4, %1
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @_ZN5SimTK6Array_IijED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #3
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @_ZN5SimTK6Array_INS0_ISt4pairIiiEjEEjED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #3
  tail call void @_ZN5SimTK19PIMPLImplementationINS_18Parallel2DExecutorENS_22Parallel2DExecutorImplEED2Ev(ptr noundef nonnull align 8 dereferenceable(12) %0) #3
  ret void
}

; Function Attrs: nounwind
declare void @_ZN5SimTK11PIMPLHandleINS_16ParallelExecutorENS_20ParallelExecutorImplELb0EED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2

attributes #0 = { 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 #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 = { 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 #3 = { nounwind }
attributes #4 = { 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, !8, i64 48}
!6 = !{!"_ZTSN5SimTK22Parallel2DExecutorImplE", !7, i64 0, !11, i64 12, !12, i64 16, !15, i64 32, !8, i64 48, !18, i64 56}
!7 = !{!"_ZTSN5SimTK19PIMPLImplementationINS_18Parallel2DExecutorENS_22Parallel2DExecutorImplEEE", !8, i64 0, !11, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"_ZTSN5SimTK6Array_INS0_ISt4pairIiiEjEEjEE", !13, i64 0}
!13 = !{!"_ZTSN5SimTK10ArrayView_INS_6Array_ISt4pairIiiEjEEjEE", !14, i64 0}
!14 = !{!"_ZTSN5SimTK15ArrayViewConst_INS_6Array_ISt4pairIiiEjEEjEE", !8, i64 0, !11, i64 8, !11, i64 12}
!15 = !{!"_ZTSN5SimTK6Array_IijEE", !16, i64 0}
!16 = !{!"_ZTSN5SimTK10ArrayView_IijEE", !17, i64 0}
!17 = !{!"_ZTSN5SimTK15ArrayViewConst_IijEE", !8, i64 0, !11, i64 8, !11, i64 12}
!18 = !{!"bool", !9, i64 0}
!19 = !{!6, !18, i64 56}
!20 = !{i8 0, i8 2}
!21 = !{}


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