; LLVM IR from Razakhel/RaZ :: extern/tracy/client/TracyCallstack.ll (ZN5tracy18DecodeCallstackPtrEm)

; 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.tracy::CallstackEntry" = type { ptr, ptr, i32, i32, i64 }
%"struct.tracy::CallstackEntryData" = type { ptr, i8, ptr }
%class.anon = type { i8 }
%"struct.tracy::ImageCache::ImageEntry" = type { ptr, ptr, ptr }
%"struct.tracy::KernelSymbol" = type { i64, i32, ptr, ptr }

@_ZN5tracy6cb_btsE = external dso_local global ptr, align 8
@_ZN5tracy6cb_numE = external dso_local global i32, align 4
@_ZN5tracy7cb_dataE = external dso_local global [64 x %"struct.tracy::CallstackEntry"], align 16
@_ZN5tracy11s_kernelSymE = external dso_local global ptr, align 8
@_ZN5tracy14s_kernelSymCntE = external dso_local global i64, align 8
@_ZN5tracyL12s_imageCacheE = external hidden global ptr, align 8
@_ZN5tracyL29s_shouldResolveSymbolsOfflineE = external hidden global i8, align 1
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [85 x i8], align 1
@__PRETTY_FUNCTION__._ZN5tracy18DecodeCallstackPtrEm = external hidden unnamed_addr constant [55 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [9 x i8], align 1

; 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: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN5tracyL12InitRpmallocEv() #1

declare noundef i32 @_ZN5tracy16backtrace_pcinfoEPNS_15backtrace_stateEmPFiPvmmPKciS4_EPFvS2_S4_iES2_(ptr noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5tracy15SymInfoCallbackEPvmPKcmm(ptr noundef, i64 noundef, ptr noundef, i64 noundef, i64 noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5tracy12SymInfoErrorEPvPKci(ptr noundef, ptr noundef, i32 noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5tracy26GetSymbolForOfflineResolveEPvmRNS_14CallstackEntryE(ptr noundef, i64 noundef, ptr noundef nonnull align 8 dereferenceable(32)) #4

; Function Attrs: alwaysinline mustprogress uwtable
declare hidden noundef ptr @_ZN5tracyL14CopyStringFastEPKc(ptr noundef) #5

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5tracy18DecodeCallstackPtrEm(ptr dead_on_unwind noalias writable sret(%"struct.tracy::CallstackEntryData") align 8 %0, i64 noundef %1) #4 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %class.anon, align 1
  %9 = alloca i32, align 4
  store i64 %1, ptr %3, align 8, !tbaa !5
  call void @_ZN5tracyL12InitRpmallocEv()
  %10 = load i64, ptr %3, align 8, !tbaa !5
  %11 = lshr i64 %10, 63
  %12 = icmp eq i64 %11, 0
  br i1 %12, label %13, label %61

13:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  store ptr null, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  store i64 0, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %14 = load ptr, ptr @_ZN5tracyL12s_imageCacheE, align 8, !tbaa !9
  %15 = load i64, ptr %3, align 8, !tbaa !5
  %16 = inttoptr i64 %15 to ptr
  %17 = call noundef ptr @_ZN5tracy10ImageCache18GetImageForAddressEPv(ptr noundef nonnull align 8 dereferenceable(26) %14, ptr noundef %16)
  store ptr %17, ptr %6, align 8, !tbaa !9
  %18 = load ptr, ptr %6, align 8, !tbaa !9
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %28

20:                                               ; preds = %13
  %21 = load ptr, ptr %6, align 8, !tbaa !9
  %22 = getelementptr inbounds %"struct.tracy::ImageCache::ImageEntry", ptr %21, i32 0, i32 2
  %23 = load ptr, ptr %22, align 8, !tbaa !11
  store ptr %23, ptr %4, align 8, !tbaa !9
  %24 = load ptr, ptr %6, align 8, !tbaa !9
  %25 = getelementptr inbounds %"struct.tracy::ImageCache::ImageEntry", ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !13
  %27 = ptrtoint ptr %26 to i64
  store i64 %27, ptr %5, align 8, !tbaa !5
  br label %28

28:                                               ; preds = %20, %13
  %29 = load i8, ptr @_ZN5tracyL29s_shouldResolveSymbolsOfflineE, align 1, !tbaa !14, !range !16, !noundef !17
  %30 = trunc i8 %29 to i1
  br i1 %30, label %31, label %35

31:                                               ; preds = %28
  store i32 1, ptr @_ZN5tracy6cb_numE, align 4, !tbaa !18
  %32 = load i64, ptr %3, align 8, !tbaa !5
  %33 = inttoptr i64 %32 to ptr
  %34 = load i64, ptr %5, align 8, !tbaa !5
  call void @_ZN5tracy26GetSymbolForOfflineResolveEPvmRNS_14CallstackEntryE(ptr noundef %33, i64 noundef %34, ptr noundef nonnull align 8 dereferenceable(32) @_ZN5tracy7cb_dataE)
  br label %48

35:                                               ; preds = %28
  store i32 0, ptr @_ZN5tracy6cb_numE, align 4, !tbaa !18
  %36 = load ptr, ptr @_ZN5tracy6cb_btsE, align 8, !tbaa !9
  %37 = load i64, ptr %3, align 8, !tbaa !5
  %38 = call noundef i32 @_ZN5tracy16backtrace_pcinfoEPNS_15backtrace_stateEmPFiPvmmPKciS4_EPFvS2_S4_iES2_(ptr noundef %36, i64 noundef %37, ptr noundef @_ZN5tracyL15CallstackDataCbEPvmmPKciS2_, ptr noundef @_ZN5tracyL16CallstackErrorCbEPvPKci, ptr noundef null)
  %39 = load i32, ptr @_ZN5tracy6cb_numE, align 4, !tbaa !18
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %41, label %42

41:                                               ; preds = %35
  br label %44

42:                                               ; preds = %35
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.6, i32 noundef 1285, ptr noundef @__PRETTY_FUNCTION__._ZN5tracy18DecodeCallstackPtrEm) #9
  unreachable

43:                                               ; No predecessors!
  br label %44

44:                                               ; preds = %43, %41
  %45 = load ptr, ptr @_ZN5tracy6cb_btsE, align 8, !tbaa !9
  %46 = load i64, ptr %3, align 8, !tbaa !5
  %47 = call noundef i32 @_ZN5tracy17backtrace_syminfoEPNS_15backtrace_stateEmPFvPvmPKcmmEPFvS2_S4_iES2_(ptr noundef %45, i64 noundef %46, ptr noundef @_ZN5tracy15SymInfoCallbackEPvmPKcmm, ptr noundef @_ZN5tracy12SymInfoErrorEPvPKci, ptr noundef null)
  br label %48

48:                                               ; preds = %44, %31
  %49 = getelementptr inbounds %"struct.tracy::CallstackEntryData", ptr %0, i32 0, i32 0
  store ptr @_ZN5tracy7cb_dataE, ptr %49, align 8, !tbaa !20
  %50 = getelementptr inbounds %"struct.tracy::CallstackEntryData", ptr %0, i32 0, i32 1
  %51 = load i32, ptr @_ZN5tracy6cb_numE, align 4, !tbaa !18
  %52 = trunc i32 %51 to i8
  store i8 %52, ptr %50, align 8, !tbaa !22
  %53 = getelementptr inbounds %"struct.tracy::CallstackEntryData", ptr %0, i32 0, i32 2
  %54 = load ptr, ptr %4, align 8, !tbaa !9
  %55 = icmp ne ptr %54, null
  br i1 %55, label %56, label %58

56:                                               ; preds = %48
  %57 = load ptr, ptr %4, align 8, !tbaa !9
  br label %59

58:                                               ; preds = %48
  br label %59

59:                                               ; preds = %58, %56
  %60 = phi ptr [ %57, %56 ], [ @.str.4, %58 ]
  store ptr %60, ptr %53, align 8, !tbaa !23
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  br label %112

61:                                               ; preds = %2
  %62 = load ptr, ptr @_ZN5tracy11s_kernelSymE, align 8, !tbaa !9
  %63 = icmp ne ptr %62, null
  br i1 %63, label %64, label %105

64:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %65 = load ptr, ptr @_ZN5tracy11s_kernelSymE, align 8, !tbaa !9
  %66 = load ptr, ptr @_ZN5tracy11s_kernelSymE, align 8, !tbaa !9
  %67 = load i64, ptr @_ZN5tracy14s_kernelSymCntE, align 8, !tbaa !5
  %68 = getelementptr inbounds %"struct.tracy::KernelSymbol", ptr %66, i64 %67
  %69 = call noundef ptr @"_ZSt11lower_boundIPN5tracy12KernelSymbolEmZNS0_18DecodeCallstackPtrEmE3$_0ET_S4_S4_RKT0_T1_"(ptr noundef %65, ptr noundef %68, ptr noundef nonnull align 8 dereferenceable(8) %3)
  store ptr %69, ptr %7, align 8, !tbaa !9
  %70 = load ptr, ptr %7, align 8, !tbaa !9
  %71 = load ptr, ptr @_ZN5tracy11s_kernelSymE, align 8, !tbaa !9
  %72 = load i64, ptr @_ZN5tracy14s_kernelSymCntE, align 8, !tbaa !5
  %73 = getelementptr inbounds %"struct.tracy::KernelSymbol", ptr %71, i64 %72
  %74 = icmp ne ptr %70, %73
  br i1 %74, label %75, label %101

75:                                               ; preds = %64
  %76 = load ptr, ptr %7, align 8, !tbaa !9
  %77 = getelementptr inbounds %"struct.tracy::KernelSymbol", ptr %76, i32 0, i32 2
  %78 = load ptr, ptr %77, align 8, !tbaa !24
  %79 = call noundef ptr @_ZN5tracyL14CopyStringFastEPKc(ptr noundef %78)
  store ptr %79, ptr @_ZN5tracy7cb_dataE, align 16, !tbaa !26
  %80 = call noundef ptr @_ZN5tracyL14CopyStringFastEPKc(ptr noundef @.str.7)
  store ptr %80, ptr getelementptr inbounds (%"struct.tracy::CallstackEntry", ptr @_ZN5tracy7cb_dataE, i32 0, i32 1), align 8, !tbaa !28
  store i32 0, ptr getelementptr inbounds (%"struct.tracy::CallstackEntry", ptr @_ZN5tracy7cb_dataE, i32 0, i32 2), align 16, !tbaa !29
  %81 = load ptr, ptr %7, align 8, !tbaa !9
  %82 = getelementptr inbounds %"struct.tracy::KernelSymbol", ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 8, !tbaa !30
  store i32 %83, ptr getelementptr inbounds (%"struct.tracy::CallstackEntry", ptr @_ZN5tracy7cb_dataE, i32 0, i32 3), align 4, !tbaa !31
  %84 = load ptr, ptr %7, align 8, !tbaa !9
  %85 = getelementptr inbounds %"struct.tracy::KernelSymbol", ptr %84, i32 0, i32 0
  %86 = load i64, ptr %85, align 8, !tbaa !32
  store i64 %86, ptr getelementptr inbounds (%"struct.tracy::CallstackEntry", ptr @_ZN5tracy7cb_dataE, i32 0, i32 4), align 8, !tbaa !33
  %87 = getelementptr inbounds %"struct.tracy::CallstackEntryData", ptr %0, i32 0, i32 0
  store ptr @_ZN5tracy7cb_dataE, ptr %87, align 8, !tbaa !20
  %88 = getelementptr inbounds %"struct.tracy::CallstackEntryData", ptr %0, i32 0, i32 1
  store i8 1, ptr %88, align 8, !tbaa !22
  %89 = getelementptr inbounds %"struct.tracy::CallstackEntryData", ptr %0, i32 0, i32 2
  %90 = load ptr, ptr %7, align 8, !tbaa !9
  %91 = getelementptr inbounds %"struct.tracy::KernelSymbol", ptr %90, i32 0, i32 3
  %92 = load ptr, ptr %91, align 8, !tbaa !34
  %93 = icmp ne ptr %92, null
  br i1 %93, label %94, label %98

94:                                               ; preds = %75
  %95 = load ptr, ptr %7, align 8, !tbaa !9
  %96 = getelementptr inbounds %"struct.tracy::KernelSymbol", ptr %95, i32 0, i32 3
  %97 = load ptr, ptr %96, align 8, !tbaa !34
  br label %99

98:                                               ; preds = %75
  br label %99

99:                                               ; preds = %98, %94
  %100 = phi ptr [ %97, %94 ], [ @.str.7, %98 ]
  store ptr %100, ptr %89, align 8, !tbaa !23
  store i32 1, ptr %9, align 4
  br label %102

101:                                              ; preds = %64
  store i32 0, ptr %9, align 4
  br label %102

102:                                              ; preds = %101, %99
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  %103 = load i32, ptr %9, align 4
  switch i32 %103, label %113 [
    i32 0, label %104
    i32 1, label %112
  ]

104:                                              ; preds = %102
  br label %105

105:                                              ; preds = %104, %61
  br label %106

106:                                              ; preds = %105
  %107 = call noundef ptr @_ZN5tracyL14CopyStringFastEPKc(ptr noundef @.str.4)
  store ptr %107, ptr @_ZN5tracy7cb_dataE, align 16, !tbaa !26
  %108 = call noundef ptr @_ZN5tracyL14CopyStringFastEPKc(ptr noundef @.str.7)
  store ptr %108, ptr getelementptr inbounds (%"struct.tracy::CallstackEntry", ptr @_ZN5tracy7cb_dataE, i32 0, i32 1), align 8, !tbaa !28
  store i32 0, ptr getelementptr inbounds (%"struct.tracy::CallstackEntry", ptr @_ZN5tracy7cb_dataE, i32 0, i32 2), align 16, !tbaa !29
  store i32 0, ptr getelementptr inbounds (%"struct.tracy::CallstackEntry", ptr @_ZN5tracy7cb_dataE, i32 0, i32 3), align 4, !tbaa !31
  store i64 0, ptr getelementptr inbounds (%"struct.tracy::CallstackEntry", ptr @_ZN5tracy7cb_dataE, i32 0, i32 4), align 8, !tbaa !33
  %109 = getelementptr inbounds %"struct.tracy::CallstackEntryData", ptr %0, i32 0, i32 0
  store ptr @_ZN5tracy7cb_dataE, ptr %109, align 8, !tbaa !20
  %110 = getelementptr inbounds %"struct.tracy::CallstackEntryData", ptr %0, i32 0, i32 1
  store i8 1, ptr %110, align 8, !tbaa !22
  %111 = getelementptr inbounds %"struct.tracy::CallstackEntryData", ptr %0, i32 0, i32 2
  store ptr @.str.7, ptr %111, align 8, !tbaa !23
  br label %112

112:                                              ; preds = %106, %102, %59
  ret void

113:                                              ; preds = %102
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN5tracy10ImageCache18GetImageForAddressEPv(ptr noundef nonnull align 8 dereferenceable(26), ptr noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZN5tracyL15CallstackDataCbEPvmmPKciS2_(ptr noundef, i64 noundef, i64 noundef, ptr noundef, i32 noundef, ptr noundef) #4

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN5tracyL16CallstackErrorCbEPvPKci(ptr noundef, ptr noundef, i32 noundef) #4

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #6

declare noundef i32 @_ZN5tracy17backtrace_syminfoEPNS_15backtrace_stateEmPFvPvmPKcmmEPFvS2_S4_iES2_(ptr noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef ptr @"_ZSt11lower_boundIPN5tracy12KernelSymbolEmZNS0_18DecodeCallstackPtrEmE3$_0ET_S4_S4_RKT0_T1_"(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) #7

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { "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 = { 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 #4 = { 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 #5 = { alwaysinline 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 #6 = { noreturn 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 #7 = { 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 #8 = { nounwind }
attributes #9 = { noreturn 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 = !{!"long", !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 16}
!12 = !{!"_ZTSN5tracy10ImageCache10ImageEntryE", !10, i64 0, !10, i64 8, !10, i64 16}
!13 = !{!12, !10, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!19, !19, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = !{!21, !10, i64 0}
!21 = !{!"_ZTSN5tracy18CallstackEntryDataE", !10, i64 0, !7, i64 8, !10, i64 16}
!22 = !{!21, !7, i64 8}
!23 = !{!21, !10, i64 16}
!24 = !{!25, !10, i64 16}
!25 = !{!"_ZTSN5tracy12KernelSymbolE", !6, i64 0, !19, i64 8, !10, i64 16, !10, i64 24}
!26 = !{!27, !10, i64 0}
!27 = !{!"_ZTSN5tracy14CallstackEntryE", !10, i64 0, !10, i64 8, !19, i64 16, !19, i64 20, !6, i64 24}
!28 = !{!27, !10, i64 8}
!29 = !{!27, !19, i64 16}
!30 = !{!25, !19, i64 8}
!31 = !{!27, !19, i64 20}
!32 = !{!25, !6, i64 0}
!33 = !{!27, !6, i64 24}
!34 = !{!25, !10, 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"

%"struct.tracy::CallstackEntry" = type { ptr, ptr, i32, i32, i64 }
%"struct.tracy::CallstackEntryData" = type { ptr, i8, ptr }
%"struct.tracy::KernelSymbol" = type { i64, i32, ptr, ptr }

@_ZN5tracy6cb_btsE = external dso_local local_unnamed_addr global ptr, align 8
@_ZN5tracy6cb_numE = external dso_local local_unnamed_addr global i32, align 4
@_ZN5tracy7cb_dataE = external dso_local global [64 x %"struct.tracy::CallstackEntry"], align 16
@_ZN5tracy11s_kernelSymE = external dso_local local_unnamed_addr global ptr, align 8
@_ZN5tracy14s_kernelSymCntE = external dso_local local_unnamed_addr global i64, align 8
@_ZN5tracyL12s_imageCacheE = external hidden local_unnamed_addr global ptr, align 8
@_ZN5tracyL29s_shouldResolveSymbolsOfflineE = external hidden local_unnamed_addr global i8, align 1
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [85 x i8], align 1
@__PRETTY_FUNCTION__._ZN5tracy18DecodeCallstackPtrEm = external hidden unnamed_addr constant [55 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden void @_ZN5tracyL12InitRpmallocEv() local_unnamed_addr #0

declare noundef i32 @_ZN5tracy16backtrace_pcinfoEPNS_15backtrace_stateEmPFiPvmmPKciS4_EPFvS2_S4_iES2_(ptr noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5tracy15SymInfoCallbackEPvmPKcmm(ptr noundef, i64 noundef, ptr noundef, i64 noundef, i64 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5tracy12SymInfoErrorEPvPKci(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5tracy26GetSymbolForOfflineResolveEPvmRNS_14CallstackEntryE(ptr noundef, i64 noundef, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3

; Function Attrs: alwaysinline mustprogress uwtable
declare hidden noundef ptr @_ZN5tracyL14CopyStringFastEPKc(ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5tracy18DecodeCallstackPtrEm(ptr dead_on_unwind noalias nocapture writable writeonly sret(%"struct.tracy::CallstackEntryData") align 8 %0, i64 noundef %1) local_unnamed_addr #3 {
  %3 = alloca i64, align 8
  store i64 %1, ptr %3, align 8, !tbaa !5
  tail call void @_ZN5tracyL12InitRpmallocEv()
  %4 = icmp sgt i64 %1, -1
  br i1 %4, label %5, label %33

5:                                                ; preds = %2
  %6 = load ptr, ptr @_ZN5tracyL12s_imageCacheE, align 8, !tbaa !9
  %7 = inttoptr i64 %1 to ptr
  %8 = tail call noundef ptr @_ZN5tracy10ImageCache18GetImageForAddressEPv(ptr noundef nonnull align 8 dereferenceable(26) %6, ptr noundef %7)
  %.not20 = icmp eq ptr %8, null
  br i1 %.not20, label %14, label %9

9:                                                ; preds = %5
  %10 = getelementptr inbounds i8, ptr %8, i64 16
  %11 = load ptr, ptr %10, align 8, !tbaa !11
  %12 = load ptr, ptr %8, align 8, !tbaa !13
  %13 = ptrtoint ptr %12 to i64
  br label %14

14:                                               ; preds = %9, %5
  %.013 = phi i64 [ %13, %9 ], [ 0, %5 ]
  %.012 = phi ptr [ %11, %9 ], [ null, %5 ]
  %15 = load i8, ptr @_ZN5tracyL29s_shouldResolveSymbolsOfflineE, align 1, !tbaa !14, !range !16, !noundef !17
  %16 = trunc nuw i8 %15 to i1
  br i1 %16, label %17, label %18

17:                                               ; preds = %14
  store i32 1, ptr @_ZN5tracy6cb_numE, align 4, !tbaa !18
  tail call void @_ZN5tracy26GetSymbolForOfflineResolveEPvmRNS_14CallstackEntryE(ptr noundef %7, i64 noundef %.013, ptr noundef nonnull align 8 dereferenceable(32) @_ZN5tracy7cb_dataE)
  br label %27

18:                                               ; preds = %14
  store i32 0, ptr @_ZN5tracy6cb_numE, align 4, !tbaa !18
  %19 = load ptr, ptr @_ZN5tracy6cb_btsE, align 8, !tbaa !9
  %20 = tail call noundef i32 @_ZN5tracy16backtrace_pcinfoEPNS_15backtrace_stateEmPFiPvmmPKciS4_EPFvS2_S4_iES2_(ptr noundef %19, i64 noundef %1, ptr noundef nonnull @_ZN5tracyL15CallstackDataCbEPvmmPKciS2_, ptr noundef nonnull @_ZN5tracyL16CallstackErrorCbEPvPKci, ptr noundef null)
  %21 = load i32, ptr @_ZN5tracy6cb_numE, align 4, !tbaa !18
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %24, label %23

23:                                               ; preds = %18
  tail call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.6, i32 noundef 1285, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN5tracy18DecodeCallstackPtrEm) #8
  unreachable

24:                                               ; preds = %18
  %25 = load ptr, ptr @_ZN5tracy6cb_btsE, align 8, !tbaa !9
  %26 = tail call noundef i32 @_ZN5tracy17backtrace_syminfoEPNS_15backtrace_stateEmPFvPvmPKcmmEPFvS2_S4_iES2_(ptr noundef %25, i64 noundef %1, ptr noundef nonnull @_ZN5tracy15SymInfoCallbackEPvmPKcmm, ptr noundef nonnull @_ZN5tracy12SymInfoErrorEPvPKci, ptr noundef null)
  br label %27

27:                                               ; preds = %24, %17
  store ptr @_ZN5tracy7cb_dataE, ptr %0, align 8, !tbaa !20
  %28 = getelementptr inbounds i8, ptr %0, i64 8
  %29 = load i32, ptr @_ZN5tracy6cb_numE, align 4, !tbaa !18
  %30 = trunc i32 %29 to i8
  store i8 %30, ptr %28, align 8, !tbaa !22
  %31 = getelementptr inbounds i8, ptr %0, i64 16
  %.not21 = icmp eq ptr %.012, null
  %32 = select i1 %.not21, ptr @.str.4, ptr %.012
  store ptr %32, ptr %31, align 8, !tbaa !23
  br label %58

33:                                               ; preds = %2
  %34 = load ptr, ptr @_ZN5tracy11s_kernelSymE, align 8, !tbaa !9
  %.not = icmp eq ptr %34, null
  br i1 %.not, label %.thread, label %35

35:                                               ; preds = %33
  %36 = load i64, ptr @_ZN5tracy14s_kernelSymCntE, align 8, !tbaa !5
  %37 = getelementptr inbounds %"struct.tracy::KernelSymbol", ptr %34, i64 %36
  %38 = call noundef ptr @"_ZSt11lower_boundIPN5tracy12KernelSymbolEmZNS0_18DecodeCallstackPtrEmE3$_0ET_S4_S4_RKT0_T1_"(ptr noundef nonnull %34, ptr noundef nonnull %37, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %39 = load ptr, ptr @_ZN5tracy11s_kernelSymE, align 8, !tbaa !9
  %40 = load i64, ptr @_ZN5tracy14s_kernelSymCntE, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.tracy::KernelSymbol", ptr %39, i64 %40
  %.not18.not = icmp eq ptr %38, %41
  br i1 %.not18.not, label %.thread, label %42

42:                                               ; preds = %35
  %43 = getelementptr inbounds i8, ptr %38, i64 16
  %44 = load ptr, ptr %43, align 8, !tbaa !24
  %45 = call noundef ptr @_ZN5tracyL14CopyStringFastEPKc(ptr noundef %44)
  store ptr %45, ptr @_ZN5tracy7cb_dataE, align 16, !tbaa !26
  %46 = call noundef ptr @_ZN5tracyL14CopyStringFastEPKc(ptr noundef nonnull @.str.7)
  store ptr %46, ptr getelementptr inbounds (i8, ptr @_ZN5tracy7cb_dataE, i64 8), align 8, !tbaa !28
  store i32 0, ptr getelementptr inbounds (i8, ptr @_ZN5tracy7cb_dataE, i64 16), align 16, !tbaa !29
  %47 = getelementptr inbounds i8, ptr %38, i64 8
  %48 = load i32, ptr %47, align 8, !tbaa !30
  store i32 %48, ptr getelementptr inbounds (i8, ptr @_ZN5tracy7cb_dataE, i64 20), align 4, !tbaa !31
  %49 = load i64, ptr %38, align 8, !tbaa !32
  store i64 %49, ptr getelementptr inbounds (i8, ptr @_ZN5tracy7cb_dataE, i64 24), align 8, !tbaa !33
  store ptr @_ZN5tracy7cb_dataE, ptr %0, align 8, !tbaa !20
  %50 = getelementptr inbounds i8, ptr %0, i64 8
  store i8 1, ptr %50, align 8, !tbaa !22
  %51 = getelementptr inbounds i8, ptr %0, i64 16
  %52 = getelementptr inbounds i8, ptr %38, i64 24
  %53 = load ptr, ptr %52, align 8, !tbaa !34
  %.not19 = icmp eq ptr %53, null
  %spec.select = select i1 %.not19, ptr @.str.7, ptr %53
  store ptr %spec.select, ptr %51, align 8, !tbaa !23
  br label %58

.thread:                                          ; preds = %35, %33
  %54 = call noundef ptr @_ZN5tracyL14CopyStringFastEPKc(ptr noundef nonnull @.str.4)
  store ptr %54, ptr @_ZN5tracy7cb_dataE, align 16, !tbaa !26
  %55 = call noundef ptr @_ZN5tracyL14CopyStringFastEPKc(ptr noundef nonnull @.str.7)
  store ptr %55, ptr getelementptr inbounds (i8, ptr @_ZN5tracy7cb_dataE, i64 8), align 8, !tbaa !28
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) getelementptr inbounds (i8, ptr @_ZN5tracy7cb_dataE, i64 16), i8 0, i64 16, i1 false)
  store ptr @_ZN5tracy7cb_dataE, ptr %0, align 8, !tbaa !20
  %56 = getelementptr inbounds i8, ptr %0, i64 8
  store i8 1, ptr %56, align 8, !tbaa !22
  %57 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr @.str.7, ptr %57, align 8, !tbaa !23
  br label %58

58:                                               ; preds = %42, %.thread, %27
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN5tracy10ImageCache18GetImageForAddressEPv(ptr noundef nonnull align 8 dereferenceable(26), ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZN5tracyL15CallstackDataCbEPvmmPKciS2_(ptr noundef, i64 noundef, i64 noundef, ptr noundef, i32 noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN5tracyL16CallstackErrorCbEPvPKci(ptr noundef, ptr noundef, i32 noundef) #3

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #5

declare noundef i32 @_ZN5tracy17backtrace_syminfoEPNS_15backtrace_stateEmPFvPvmPKcmmEPFvS2_S4_iES2_(ptr noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef ptr @"_ZSt11lower_boundIPN5tracy12KernelSymbolEmZNS0_18DecodeCallstackPtrEmE3$_0ET_S4_S4_RKT0_T1_"(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7

attributes #0 = { inlinehint 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 #1 = { "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 = { 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 #3 = { 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 = { alwaysinline 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 #5 = { noreturn 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 #6 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { noreturn 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 = !{!"long", !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 16}
!12 = !{!"_ZTSN5tracy10ImageCache10ImageEntryE", !10, i64 0, !10, i64 8, !10, i64 16}
!13 = !{!12, !10, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!19, !19, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = !{!21, !10, i64 0}
!21 = !{!"_ZTSN5tracy18CallstackEntryDataE", !10, i64 0, !7, i64 8, !10, i64 16}
!22 = !{!21, !7, i64 8}
!23 = !{!21, !10, i64 16}
!24 = !{!25, !10, i64 16}
!25 = !{!"_ZTSN5tracy12KernelSymbolE", !6, i64 0, !19, i64 8, !10, i64 16, !10, i64 24}
!26 = !{!27, !10, i64 0}
!27 = !{!"_ZTSN5tracy14CallstackEntryE", !10, i64 0, !10, i64 8, !19, i64 16, !19, i64 20, !6, i64 24}
!28 = !{!27, !10, i64 8}
!29 = !{!27, !19, i64 16}
!30 = !{!25, !19, i64 8}
!31 = !{!27, !19, i64 20}
!32 = !{!25, !6, i64 0}
!33 = !{!27, !6, i64 24}
!34 = !{!25, !10, i64 24}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass