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

declare void @_ZNK4enki13TaskScheduler9GetConfigEv(ptr dead_on_unwind writable sret(%"struct.enki::TaskSchedulerConfig") align 8, ptr noundef nonnull align 8 dereferenceable(220)) #2

attributes #0 = { 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 = { "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 }

!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 = !{!"_ZTSN4enki19TaskSchedulerConfigE", !11, i64 0, !11, i64 4, !12, i64 8, !13, i64 72}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_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}
!13 = !{!"_ZTSN4enki15CustomAllocatorE", !6, i64 0, !6, i64 8, !6, i64 16}
!14 = !{!15, !11, i64 4}
!15 = !{!"_ZTS23enkiTaskSchedulerConfig", !11, i64 0, !11, i64 4, !16, i64 8, !17, i64 72}
!16 = !{!"_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}
!17 = !{!"_ZTS19enkiCustomAllocator", !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}


; 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 @enkiGetTaskSchedulerConfig(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.enkiTaskSchedulerConfig) align 8 %0, ptr noundef nonnull %1) local_unnamed_addr #1 {
  %3 = alloca %"struct.enki::TaskSchedulerConfig", align 8
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %3) #3
  call void @_ZNK4enki13TaskScheduler9GetConfigEv(ptr dead_on_unwind nonnull writable sret(%"struct.enki::TaskSchedulerConfig") align 8 %3, ptr noundef nonnull align 8 dereferenceable(220) %1)
  %4 = load <2 x i32>, ptr %3, align 8, !tbaa !5
  store <2 x i32> %4, ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %3, i64 8
  %6 = getelementptr inbounds i8, ptr %0, 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 %3, i64 24
  %9 = getelementptr inbounds i8, ptr %0, 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 %3, i64 40
  %12 = getelementptr inbounds i8, ptr %0, 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 %3, i64 56
  %15 = getelementptr inbounds i8, ptr %0, 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 %3, i64 72
  %18 = getelementptr inbounds i8, ptr %0, 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 %3, i64 88
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = getelementptr inbounds i8, ptr %0, i64 88
  store ptr %21, ptr %22, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %3) #3
  ret void
}

declare void @_ZNK4enki13TaskScheduler9GetConfigEv(ptr dead_on_unwind writable sret(%"struct.enki::TaskSchedulerConfig") align 8, ptr noundef nonnull align 8 dereferenceable(220)) local_unnamed_addr #2

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 = { "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 }

!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 = !{!"_ZTSN4enki19TaskSchedulerConfigE", !6, i64 0, !6, i64 4, !13, i64 8, !14, i64 72}
!13 = !{!"_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}
!14 = !{!"_ZTSN4enki15CustomAllocatorE", !10, i64 0, !10, i64 8, !10, i64 16}
!15 = !{!16, !10, i64 88}
!16 = !{!"_ZTS23enkiTaskSchedulerConfig", !6, i64 0, !6, i64 4, !17, i64 8, !18, i64 72}
!17 = !{!"_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}
!18 = !{!"_ZTS19enkiCustomAllocator", !10, i64 0, !10, i64 8, !10, i64 16}


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