; LLVM IR from aras-p/ToyPathTracer :: Cpp/Source/enkiTS (TaskScheduler_c)

; 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.enkiTaskSchedulerConfig = type { i32, i32, %struct.enkiProfilerCallbacks, %struct.enkiCustomAllocator }
%struct.enkiProfilerCallbacks = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.enkiCustomAllocator = type { ptr, ptr, ptr }
%"struct.enki::TaskSchedulerConfig" = type { i32, i32, %"struct.enki::ProfilerCallbacks", %"struct.enki::CustomAllocator" }
%"struct.enki::ProfilerCallbacks" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%"struct.enki::CustomAllocator" = type { ptr, ptr, ptr }

; 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: 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) #1

; Function Attrs: mustprogress uwtable
define dso_local void @enkiInitTaskSchedulerWithConfig(ptr noundef %0, ptr noundef byval(%struct.enkiTaskSchedulerConfig) align 8 %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca %"struct.enki::TaskSchedulerConfig", align 8
  %5 = alloca %"struct.enki::TaskSchedulerConfig", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 96, ptr %4) #5
  call void @_ZN4enki19TaskSchedulerConfigC2Ev(ptr noundef nonnull align 8 dereferenceable(96) %4)
  %6 = getelementptr inbounds %struct.enkiTaskSchedulerConfig, ptr %1, i32 0, i32 1
  %7 = load i32, ptr %6, align 4, !tbaa !9
  %8 = getelementptr inbounds %"struct.enki::TaskSchedulerConfig", ptr %4, i32 0, i32 1
  store i32 %7, ptr %8, align 4, !tbaa !14
  %9 = getelementptr inbounds %struct.enkiTaskSchedulerConfig, ptr %1, i32 0, i32 0
  %10 = load i32, ptr %9, align 8, !tbaa !18
  %11 = getelementptr inbounds %"struct.enki::TaskSchedulerConfig", ptr %4, i32 0, i32 0
  store i32 %10, ptr %11, align 8, !tbaa !19
  %12 = getelementptr inbounds %struct.enkiTaskSchedulerConfig, ptr %1, i32 0, i32 2
  %13 = getelementptr inbounds %struct.enkiProfilerCallbacks, ptr %12, i32 0, i32 0
  %14 = load ptr, ptr %13, align 8, !tbaa !20
  %15 = getelementptr inbounds %"struct.enki::TaskSchedulerConfig", ptr %4, i32 0, i32 2
  %16 = getelementptr inbounds %"struct.enki::ProfilerCallbacks", ptr %15, i32 0, i32 0
  store ptr %14, ptr %16, align 8, !tbaa !21
  %17 = getelementptr inbounds %struct.enkiTaskSchedulerConfig, ptr %1, i32 0, i32 2
  %18 = getelementptr inbounds %struct.enkiProfilerCallbacks, ptr %17, i32 0, i32 1
  %19 = load ptr, ptr %18, align 8, !tbaa !22
  %20 = getelementptr inbounds %"struct.enki::TaskSchedulerConfig", ptr %4, i32 0, i32 2
  %21 = getelementptr inbounds %"struct.enki::ProfilerCallbacks", ptr %20, i32 0, i32 1
  store ptr %19, ptr %21, align 8, !tbaa !23
  %22 = getelementptr inbounds %struct.enkiTaskSchedulerConfig, ptr %1, i32 0, i32 2
  %23 = getelementptr inbounds %struct.enkiProfilerCallbacks, ptr %22, i32 0, i32 2
  %24 = load ptr, ptr %23, align 8, !tbaa !24
  %25 = getelementptr inbounds %"struct.enki::TaskSchedulerConfig", ptr %4, i32 0, i32 2
  %26 = getelementptr inbounds %"struct.enki::ProfilerCallbacks", ptr %25, i32 0, i32 2
  store ptr %24, ptr %26, align 8, !tbaa !25
  %27 = getelementptr inbounds %struct.enkiTaskSchedulerConfig, ptr %1, i32 0, i32 2
  %28 = getelementptr inbounds %struct.enkiProfilerCallbacks, ptr %27, i32 0, i32 3
  %29 = load ptr, ptr %28, align 8, !tbaa !26
  %30 = getelementptr inbounds %"struct.enki::TaskSchedulerConfig", ptr %4, i32 0, i32 2
  %31 = getelementptr inbounds %"struct.enki::ProfilerCallbacks", ptr %30, i32 0, i32 3
  store ptr %29, ptr %31, align 8, !tbaa !27
  %32 = getelementptr inbounds %struct.enkiTaskSchedulerConfig, ptr %1, i32 0, i32 2
  %33 = getelementptr inbounds %struct.enkiProfilerCallbacks, ptr %32, i32 0, i32 4
  %34 = load ptr, ptr %33, align 8, !tbaa !28
  %35 = getelementptr inbounds %"struct.enki::TaskSchedulerConfig", ptr %4, i32 0, i32 2
  %36 = getelementptr inbounds %"struct.enki::ProfilerCallbacks", ptr %35, i32 0, i32 4
  store ptr %34, ptr %36, align 8, !tbaa !29
  %37 = getelementptr inbounds %struct.enkiTaskSchedulerConfig, ptr %1, i32 0, i32 2
  %38 = getelementptr inbounds %struct.enkiProfilerCallbacks, ptr %37, i32 0, i32 5
  %39 = load ptr, ptr %38, align 8, !tbaa !30
  %40 = getelementptr inbounds %"struct.enki::TaskSchedulerConfig", ptr %4, i32 0, i32 2
  %41 = getelementptr inbounds %"struct.enki::ProfilerCallbacks", ptr %40, i32 0, i32 5
  store ptr %39, ptr %41, align 8, !tbaa !31
  %42 = getelementptr inbounds %struct.enkiTaskSchedulerConfig, ptr %1, i32 0, i32 2
  %43 = getelementptr inbounds %struct.enkiProfilerCallbacks, ptr %42, i32 0, i32 6
  %44 = load ptr, ptr %43, align 8, !tbaa !32
  %45 = getelementptr inbounds %"struct.enki::TaskSchedulerConfig", ptr %4, i32 0, i32 2
  %46 = getelementptr inbounds %"struct.enki::ProfilerCallbacks", ptr %45, i32 0, i32 6
  store ptr %44, ptr %46, align 8, !tbaa !33
  %47 = getelementptr inbounds %struct.enkiTaskSchedulerConfig, ptr %1, i32 0, i32 2
  %48 = getelementptr inbounds %struct.enkiProfilerCallbacks, ptr %47, i32 0, i32 7
  %49 = load ptr, ptr %48, align 8, !tbaa !34
  %50 = getelementptr inbounds %"struct.enki::TaskSchedulerConfig", ptr %4, i32 0, i32 2
  %51 = getelementptr inbounds %"struct.enki::ProfilerCallbacks", ptr %50, i32 0, i32 7
  store ptr %49, ptr %51, align 8, !tbaa !35
  %52 = getelementptr inbounds %struct.enkiTaskSchedulerConfig, ptr %1, i32 0, i32 3
  %53 = getelementptr inbounds %struct.enkiCustomAllocator, ptr %52, i32 0, i32 0
  %54 = load ptr, ptr %53, align 8, !tbaa !36
  %55 = getelementptr inbounds %"struct.enki::TaskSchedulerConfig", ptr %4, i32 0, i32 3
  %56 = getelementptr inbounds %"struct.enki::CustomAllocator", ptr %55, i32 0, i32 0
  store ptr %54, ptr %56, align 8, !tbaa !37
  %57 = getelementptr inbounds %struct.enkiTaskSchedulerConfig, ptr %1, i32 0, i32 3
  %58 = getelementptr inbounds %struct.enkiCustomAllocator, ptr %57, i32 0, i32 1
  %59 = load ptr, ptr %58, align 8, !tbaa !38
  %60 = getelementptr inbounds %"struct.enki::TaskSchedulerConfig", ptr %4, i32 0, i32 3
  %61 = getelementptr inbounds %"struct.enki::CustomAllocator", ptr %60, i32 0, i32 1
  store ptr %59, ptr %61, align 8, !tbaa !39
  %62 = getelementptr inbounds %struct.enkiTaskSchedulerConfig, ptr %1, i32 0, i32 3
  %63 = getelementptr inbounds %struct.enkiCustomAllocator, ptr %62, i32 0, i32 2
  %64 = load ptr, ptr %63, align 8, !tbaa !40
  %65 = getelementptr inbounds %"struct.enki::TaskSchedulerConfig", ptr %4, i32 0, i32 3
  %66 = getelementptr inbounds %"struct.enki::CustomAllocator", ptr %65, i32 0, i32 2
  store ptr %64, ptr %66, align 8, !tbaa !41
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %5, ptr align 8 %4, i64 96, i1 false), !tbaa.struct !42
  call void @_ZN4enki13TaskScheduler10InitializeENS_19TaskSchedulerConfigE(ptr noundef nonnull align 8 dereferenceable(220) %67, ptr noundef byval(%"struct.enki::TaskSchedulerConfig") align 8 %5)
  call void @llvm.lifetime.end.p0(i64 96, ptr %4) #5
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4enki19TaskSchedulerConfigC2Ev(ptr noundef nonnull align 8 dereferenceable(96)) unnamed_addr #3 align 2

declare void @_ZN4enki13TaskScheduler10InitializeENS_19TaskSchedulerConfigE(ptr noundef nonnull align 8 dereferenceable(220), ptr noundef byval(%"struct.enki::TaskSchedulerConfig") align 8) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { inlinehint 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 = { "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 #5 = { 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, !11, i64 4}
!10 = !{!"_ZTS23enkiTaskSchedulerConfig", !11, i64 0, !11, i64 4, !12, i64 8, !13, i64 72}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTS21enkiProfilerCallbacks", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!13 = !{!"_ZTS19enkiCustomAllocator", !6, i64 0, !6, i64 8, !6, i64 16}
!14 = !{!15, !11, i64 4}
!15 = !{!"_ZTSN4enki19TaskSchedulerConfigE", !11, i64 0, !11, i64 4, !16, i64 8, !17, i64 72}
!16 = !{!"_ZTSN4enki17ProfilerCallbacksE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!17 = !{!"_ZTSN4enki15CustomAllocatorE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!10, !11, i64 0}
!19 = !{!15, !11, i64 0}
!20 = !{!10, !6, i64 8}
!21 = !{!15, !6, i64 8}
!22 = !{!10, !6, i64 16}
!23 = !{!15, !6, i64 16}
!24 = !{!10, !6, i64 24}
!25 = !{!15, !6, i64 24}
!26 = !{!10, !6, i64 32}
!27 = !{!15, !6, i64 32}
!28 = !{!10, !6, i64 40}
!29 = !{!15, !6, i64 40}
!30 = !{!10, !6, i64 48}
!31 = !{!15, !6, i64 48}
!32 = !{!10, !6, i64 56}
!33 = !{!15, !6, i64 56}
!34 = !{!10, !6, i64 64}
!35 = !{!15, !6, i64 64}
!36 = !{!10, !6, i64 72}
!37 = !{!15, !6, i64 72}
!38 = !{!10, !6, i64 80}
!39 = !{!15, !6, i64 80}
!40 = !{!10, !6, i64 88}
!41 = !{!15, !6, i64 88}
!42 = !{i64 0, i64 4, !43, i64 4, i64 4, !43, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 8, !5, i64 32, i64 8, !5, i64 40, i64 8, !5, i64 48, i64 8, !5, i64 56, i64 8, !5, i64 64, i64 8, !5, i64 72, i64 8, !5, i64 80, i64 8, !5, i64 88, i64 8, !5}
!43 = !{!11, !11, 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.enkiTaskSchedulerConfig = type { i32, i32, %struct.enkiProfilerCallbacks, %struct.enkiCustomAllocator }
%struct.enkiProfilerCallbacks = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.enkiCustomAllocator = type { ptr, ptr, ptr }
%"struct.enki::TaskSchedulerConfig" = type { i32, i32, %"struct.enki::ProfilerCallbacks", %"struct.enki::CustomAllocator" }
%"struct.enki::ProfilerCallbacks" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%"struct.enki::CustomAllocator" = type { ptr, ptr, ptr }

; 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 uwtable
define dso_local void @enkiInitTaskSchedulerWithConfig(ptr noundef %0, ptr nocapture noundef readonly byval(%struct.enkiTaskSchedulerConfig) align 8 %1) local_unnamed_addr #1 {
  %3 = alloca %"struct.enki::TaskSchedulerConfig", align 8
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %3) #4
  call void @_ZN4enki19TaskSchedulerConfigC2Ev(ptr noundef nonnull align 8 dereferenceable(96) %3)
  %4 = load <2 x i32>, ptr %1, align 8, !tbaa !5
  store <2 x i32> %4, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 8
  %6 = getelementptr inbounds i8, ptr %3, i64 8
  %7 = load <2 x ptr>, ptr %5, align 8, !tbaa !9
  store <2 x ptr> %7, ptr %6, align 8, !tbaa !9
  %8 = getelementptr inbounds i8, ptr %1, i64 24
  %9 = getelementptr inbounds i8, ptr %3, i64 24
  %10 = load <2 x ptr>, ptr %8, align 8, !tbaa !9
  store <2 x ptr> %10, ptr %9, align 8, !tbaa !9
  %11 = getelementptr inbounds i8, ptr %1, i64 40
  %12 = getelementptr inbounds i8, ptr %3, i64 40
  %13 = load <2 x ptr>, ptr %11, align 8, !tbaa !9
  store <2 x ptr> %13, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %1, i64 56
  %15 = getelementptr inbounds i8, ptr %3, i64 56
  %16 = load <2 x ptr>, ptr %14, align 8, !tbaa !9
  store <2 x ptr> %16, ptr %15, align 8, !tbaa !9
  %17 = getelementptr inbounds i8, ptr %1, i64 72
  %18 = getelementptr inbounds i8, ptr %3, i64 72
  %19 = load <2 x ptr>, ptr %17, align 8, !tbaa !9
  store <2 x ptr> %19, ptr %18, align 8, !tbaa !9
  %20 = getelementptr inbounds i8, ptr %1, i64 88
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = getelementptr inbounds i8, ptr %3, i64 88
  store ptr %21, ptr %22, align 8, !tbaa !15
  call void @_ZN4enki13TaskScheduler10InitializeENS_19TaskSchedulerConfigE(ptr noundef nonnull align 8 dereferenceable(220) %0, ptr noundef nonnull byval(%"struct.enki::TaskSchedulerConfig") align 8 %3)
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %3) #4
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN4enki19TaskSchedulerConfigC2Ev(ptr noundef nonnull align 8 dereferenceable(96)) unnamed_addr #2 align 2

declare void @_ZN4enki13TaskScheduler10InitializeENS_19TaskSchedulerConfigE(ptr noundef nonnull align 8 dereferenceable(220), ptr noundef byval(%"struct.enki::TaskSchedulerConfig") align 8) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { inlinehint 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 #3 = { "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 88}
!12 = !{!"_ZTS23enkiTaskSchedulerConfig", !6, i64 0, !6, i64 4, !13, i64 8, !14, i64 72}
!13 = !{!"_ZTS21enkiProfilerCallbacks", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56}
!14 = !{!"_ZTS19enkiCustomAllocator", !10, i64 0, !10, i64 8, !10, i64 16}
!15 = !{!16, !10, i64 88}
!16 = !{!"_ZTSN4enki19TaskSchedulerConfigE", !6, i64 0, !6, i64 4, !17, i64 8, !18, i64 72}
!17 = !{!"_ZTSN4enki17ProfilerCallbacksE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56}
!18 = !{!"_ZTSN4enki15CustomAllocatorE", !10, i64 0, !10, i64 8, !10, i64 16}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass