; LLVM IR from DanEngelbrecht/longtail :: test (test)

; 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.TestAsyncBlockStore = type { %struct.Longtail_BlockStoreAPI, ptr, ptr, i32, ptr, ptr, ptr, [8 x ptr], i32, ptr, i64, ptr, i64, ptr, i64, ptr, ptr, ptr }
%struct.Longtail_BlockStoreAPI = type { %struct.Longtail_API, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.Longtail_API = type { ptr }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare ptr @Longtail_Alloc(ptr noundef, i64 noundef) #1

declare void @Longtail_Free(ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare i32 @Longtail_CreateStoreIndexFromBlocks(i32 noundef, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN19TestAsyncBlockStore14InitBlockStoreEPS_P16Longtail_HashAPIP15Longtail_JobAPI(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %12, i32 0, i32 0
  %14 = call ptr @Longtail_MakeBlockStoreAPI(ptr noundef %13, ptr noundef @_ZN19TestAsyncBlockStore7DisposeEP12Longtail_API, ptr noundef @_ZN19TestAsyncBlockStore14PutStoredBlockEP22Longtail_BlockStoreAPIP20Longtail_StoredBlockP31Longtail_AsyncPutStoredBlockAPI, ptr noundef @_ZN19TestAsyncBlockStore12PreflightGetEP22Longtail_BlockStoreAPIjPKmP33Longtail_AsyncPreflightStartedAPI, ptr noundef @_ZN19TestAsyncBlockStore14GetStoredBlockEP22Longtail_BlockStoreAPImP31Longtail_AsyncGetStoredBlockAPI, ptr noundef @_ZN19TestAsyncBlockStore18GetExistingContentEP22Longtail_BlockStoreAPIjPKmjP35Longtail_AsyncGetExistingContentAPI, ptr noundef @_ZN19TestAsyncBlockStore11PruneBlocksEP22Longtail_BlockStoreAPIjPKmP28Longtail_AsyncPruneBlocksAPI, ptr noundef @_ZN19TestAsyncBlockStore8GetStatsEP22Longtail_BlockStoreAPIP25Longtail_BlockStore_Stats, ptr noundef @_ZN19TestAsyncBlockStore5FlushEP22Longtail_BlockStoreAPIP22Longtail_AsyncFlushAPI)
  store ptr %14, ptr %8, align 8, !tbaa !5
  %15 = load ptr, ptr %8, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %18, label %17

17:                                               ; preds = %3
  store i32 12, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %176

18:                                               ; preds = %3
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %20, i32 0, i32 1
  store ptr %19, ptr %21, align 8, !tbaa !9
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %23, i32 0, i32 2
  store ptr %22, ptr %24, align 8, !tbaa !15
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %25, i32 0, i32 3
  store volatile i32 0, ptr %26, align 8, !tbaa !16
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %27, i32 0, i32 10
  store i64 0, ptr %28, align 8, !tbaa !17
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %29, i32 0, i32 11
  store ptr null, ptr %30, align 8, !tbaa !18
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %31, i32 0, i32 12
  store i64 0, ptr %32, align 8, !tbaa !19
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %33, i32 0, i32 13
  store ptr null, ptr %34, align 8, !tbaa !20
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %35, i32 0, i32 14
  store i64 0, ptr %36, align 8, !tbaa !21
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %37, i32 0, i32 15
  store ptr null, ptr %38, align 8, !tbaa !22
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %39, i32 0, i32 17
  store ptr null, ptr %40, align 8, !tbaa !23
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %41, i32 0, i32 8
  store volatile i32 0, ptr %42, align 8, !tbaa !24
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %43, i32 0, i32 9
  store ptr null, ptr %44, align 8, !tbaa !25
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %45, i32 0, i32 16
  %47 = call i32 @Longtail_CreateStoreIndexFromBlocks(i32 noundef 0, ptr noundef null, ptr noundef %46)
  store i32 %47, ptr %10, align 4, !tbaa !26
  %48 = load i32, ptr %10, align 4, !tbaa !26
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %52

50:                                               ; preds = %18
  %51 = load i32, ptr %10, align 4, !tbaa !26
  store i32 %51, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %175

52:                                               ; preds = %18
  %53 = call i64 @Longtail_GetSpinLockSize()
  %54 = call ptr @Longtail_Alloc(ptr noundef null, i64 noundef %53)
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %55, i32 0, i32 4
  %57 = call i32 @Longtail_CreateSpinLock(ptr noundef %54, ptr noundef %56)
  store i32 %57, ptr %10, align 4, !tbaa !26
  %58 = load i32, ptr %10, align 4, !tbaa !26
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %65

60:                                               ; preds = %52
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %61, i32 0, i32 16
  %63 = load ptr, ptr %62, align 8, !tbaa !27
  call void @Longtail_Free(ptr noundef %63)
  %64 = load i32, ptr %10, align 4, !tbaa !26
  store i32 %64, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %175

65:                                               ; preds = %52
  %66 = call i64 @Longtail_GetSpinLockSize()
  %67 = call ptr @Longtail_Alloc(ptr noundef null, i64 noundef %66)
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %68, i32 0, i32 5
  %70 = call i32 @Longtail_CreateSpinLock(ptr noundef %67, ptr noundef %69)
  store i32 %70, ptr %10, align 4, !tbaa !26
  %71 = load i32, ptr %10, align 4, !tbaa !26
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %81

73:                                               ; preds = %65
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %74, i32 0, i32 4
  %76 = load ptr, ptr %75, align 8, !tbaa !28
  call void @Longtail_DeleteSpinLock(ptr noundef %76)
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %77, i32 0, i32 16
  %79 = load ptr, ptr %78, align 8, !tbaa !27
  call void @Longtail_Free(ptr noundef %79)
  %80 = load i32, ptr %10, align 4, !tbaa !26
  store i32 %80, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %175

81:                                               ; preds = %65
  %82 = call i64 @Longtail_GetSemaSize()
  %83 = call ptr @Longtail_Alloc(ptr noundef null, i64 noundef %82)
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %84, i32 0, i32 6
  %86 = call i32 @Longtail_CreateSema(ptr noundef %83, i32 noundef 0, ptr noundef %85)
  store i32 %86, ptr %10, align 4, !tbaa !26
  %87 = load i32, ptr %10, align 4, !tbaa !26
  %88 = icmp ne i32 %87, 0
  br i1 %88, label %89, label %106

89:                                               ; preds = %81
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %90, i32 0, i32 5
  %92 = load ptr, ptr %91, align 8, !tbaa !29
  call void @Longtail_DeleteSpinLock(ptr noundef %92)
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %93, i32 0, i32 5
  %95 = load ptr, ptr %94, align 8, !tbaa !29
  call void @Longtail_Free(ptr noundef %95)
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %96, i32 0, i32 4
  %98 = load ptr, ptr %97, align 8, !tbaa !28
  call void @Longtail_DeleteSpinLock(ptr noundef %98)
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %99, i32 0, i32 4
  %101 = load ptr, ptr %100, align 8, !tbaa !28
  call void @Longtail_Free(ptr noundef %101)
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  %103 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %102, i32 0, i32 16
  %104 = load ptr, ptr %103, align 8, !tbaa !27
  call void @Longtail_Free(ptr noundef %104)
  %105 = load i32, ptr %10, align 4, !tbaa !26
  store i32 %105, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %175

106:                                              ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !26
  br label %107

107:                                              ; preds = %169, %106
  %108 = load i32, ptr %11, align 4, !tbaa !26
  %109 = icmp ult i32 %108, 8
  br i1 %109, label %111, label %110

110:                                              ; preds = %107
  store i32 2, ptr %9, align 4
  br label %172

111:                                              ; preds = %107
  %112 = call i64 @Longtail_GetThreadSize()
  %113 = call ptr @Longtail_Alloc(ptr noundef null, i64 noundef %112)
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %115, i32 0, i32 7
  %117 = load i32, ptr %11, align 4, !tbaa !26
  %118 = zext i32 %117 to i64
  %119 = getelementptr inbounds [8 x ptr], ptr %116, i64 0, i64 %118
  %120 = call i32 @Longtail_CreateThread(ptr noundef %113, ptr noundef @_ZN19TestAsyncBlockStore6WorkerEPv, i64 noundef 0, ptr noundef %114, i32 noundef -1, ptr noundef %119)
  store i32 %120, ptr %10, align 4, !tbaa !26
  %121 = load i32, ptr %10, align 4, !tbaa !26
  %122 = icmp ne i32 %121, 0
  br i1 %122, label %123, label %168

123:                                              ; preds = %111
  br label %124

124:                                              ; preds = %128, %123
  %125 = load i32, ptr %11, align 4, !tbaa !26
  %126 = add i32 %125, -1
  store i32 %126, ptr %11, align 4, !tbaa !26
  %127 = icmp ne i32 %125, 0
  br i1 %127, label %128, label %148

128:                                              ; preds = %124
  %129 = load ptr, ptr %5, align 8, !tbaa !5
  %130 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %129, i32 0, i32 7
  %131 = load i32, ptr %11, align 4, !tbaa !26
  %132 = zext i32 %131 to i64
  %133 = getelementptr inbounds [8 x ptr], ptr %130, i64 0, i64 %132
  %134 = load ptr, ptr %133, align 8, !tbaa !5
  %135 = call i32 @Longtail_JoinThread(ptr noundef %134, i64 noundef -1)
  %136 = load ptr, ptr %5, align 8, !tbaa !5
  %137 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %136, i32 0, i32 7
  %138 = load i32, ptr %11, align 4, !tbaa !26
  %139 = zext i32 %138 to i64
  %140 = getelementptr inbounds [8 x ptr], ptr %137, i64 0, i64 %139
  %141 = load ptr, ptr %140, align 8, !tbaa !5
  call void @Longtail_DeleteThread(ptr noundef %141)
  %142 = load ptr, ptr %5, align 8, !tbaa !5
  %143 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %142, i32 0, i32 7
  %144 = load i32, ptr %11, align 4, !tbaa !26
  %145 = zext i32 %144 to i64
  %146 = getelementptr inbounds [8 x ptr], ptr %143, i64 0, i64 %145
  %147 = load ptr, ptr %146, align 8, !tbaa !5
  call void @Longtail_Free(ptr noundef %147)
  br label %124, !llvm.loop !30

148:                                              ; preds = %124
  %149 = load ptr, ptr %5, align 8, !tbaa !5
  %150 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %149, i32 0, i32 6
  %151 = load ptr, ptr %150, align 8, !tbaa !32
  call void @Longtail_DeleteSema(ptr noundef %151)
  %152 = load ptr, ptr %5, align 8, !tbaa !5
  %153 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %152, i32 0, i32 6
  %154 = load ptr, ptr %153, align 8, !tbaa !32
  call void @Longtail_Free(ptr noundef %154)
  %155 = load ptr, ptr %5, align 8, !tbaa !5
  %156 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %155, i32 0, i32 5
  %157 = load ptr, ptr %156, align 8, !tbaa !29
  call void @Longtail_DeleteSpinLock(ptr noundef %157)
  %158 = load ptr, ptr %5, align 8, !tbaa !5
  %159 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %158, i32 0, i32 5
  %160 = load ptr, ptr %159, align 8, !tbaa !29
  call void @Longtail_Free(ptr noundef %160)
  %161 = load ptr, ptr %5, align 8, !tbaa !5
  %162 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %161, i32 0, i32 4
  %163 = load ptr, ptr %162, align 8, !tbaa !28
  call void @Longtail_DeleteSpinLock(ptr noundef %163)
  %164 = load ptr, ptr %5, align 8, !tbaa !5
  %165 = getelementptr inbounds %class.TestAsyncBlockStore, ptr %164, i32 0, i32 4
  %166 = load ptr, ptr %165, align 8, !tbaa !28
  call void @Longtail_Free(ptr noundef %166)
  %167 = load i32, ptr %10, align 4, !tbaa !26
  store i32 %167, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %172

168:                                              ; preds = %111
  br label %169

169:                                              ; preds = %168
  %170 = load i32, ptr %11, align 4, !tbaa !26
  %171 = add i32 %170, 1
  store i32 %171, ptr %11, align 4, !tbaa !26
  br label %107, !llvm.loop !33

172:                                              ; preds = %148, %110
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  %173 = load i32, ptr %9, align 4
  switch i32 %173, label %175 [
    i32 2, label %174
  ]

174:                                              ; preds = %172
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %175

175:                                              ; preds = %174, %172, %89, %73, %60, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %176

176:                                              ; preds = %175, %17
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %177 = load i32, ptr %4, align 4
  ret i32 %177
}

declare ptr @Longtail_MakeBlockStoreAPI(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN19TestAsyncBlockStore7DisposeEP12Longtail_API(ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN19TestAsyncBlockStore14PutStoredBlockEP22Longtail_BlockStoreAPIP20Longtail_StoredBlockP31Longtail_AsyncPutStoredBlockAPI(ptr noundef, ptr noundef, ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN19TestAsyncBlockStore12PreflightGetEP22Longtail_BlockStoreAPIjPKmP33Longtail_AsyncPreflightStartedAPI(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN19TestAsyncBlockStore14GetStoredBlockEP22Longtail_BlockStoreAPImP31Longtail_AsyncGetStoredBlockAPI(ptr noundef, i64 noundef, ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN19TestAsyncBlockStore18GetExistingContentEP22Longtail_BlockStoreAPIjPKmjP35Longtail_AsyncGetExistingContentAPI(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN19TestAsyncBlockStore11PruneBlocksEP22Longtail_BlockStoreAPIjPKmP28Longtail_AsyncPruneBlocksAPI(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN19TestAsyncBlockStore8GetStatsEP22Longtail_BlockStoreAPIP25Longtail_BlockStore_Stats(ptr noundef, ptr noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN19TestAsyncBlockStore5FlushEP22Longtail_BlockStoreAPIP22Longtail_AsyncFlushAPI(ptr noundef, ptr noundef) #2 align 2

declare i32 @Longtail_CreateSpinLock(ptr noundef, ptr noundef) #1

declare i64 @Longtail_GetSpinLockSize() #1

declare void @Longtail_DeleteSpinLock(ptr noundef) #1

declare i32 @Longtail_CreateSema(ptr noundef, i32 noundef, ptr noundef) #1

declare i64 @Longtail_GetSemaSize() #1

declare i32 @Longtail_CreateThread(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i32 noundef, ptr noundef) #1

declare i64 @Longtail_GetThreadSize() #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN19TestAsyncBlockStore6WorkerEPv(ptr noundef) #2 align 2

declare i32 @Longtail_JoinThread(ptr noundef, i64 noundef) #1

declare void @Longtail_DeleteThread(ptr noundef) #1

declare void @Longtail_DeleteSema(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 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 = { 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 64}
!10 = !{!"_ZTS19TestAsyncBlockStore", !11, i64 0, !6, i64 64, !6, i64 72, !13, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !7, i64 112, !13, i64 176, !6, i64 184, !14, i64 192, !6, i64 200, !14, i64 208, !6, i64 216, !14, i64 224, !6, i64 232, !6, i64 240, !6, i64 248}
!11 = !{!"_ZTS22Longtail_BlockStoreAPI", !12, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!12 = !{!"_ZTS12Longtail_API", !6, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!10, !6, i64 72}
!16 = !{!10, !13, i64 80}
!17 = !{!10, !14, i64 192}
!18 = !{!10, !6, i64 200}
!19 = !{!10, !14, i64 208}
!20 = !{!10, !6, i64 216}
!21 = !{!10, !14, i64 224}
!22 = !{!10, !6, i64 232}
!23 = !{!10, !6, i64 248}
!24 = !{!10, !13, i64 176}
!25 = !{!10, !6, i64 184}
!26 = !{!13, !13, i64 0}
!27 = !{!10, !6, i64 240}
!28 = !{!10, !6, i64 88}
!29 = !{!10, !6, i64 96}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{!10, !6, i64 104}
!33 = distinct !{!33, !31}


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

declare ptr @Longtail_Alloc(ptr noundef, i64 noundef) local_unnamed_addr #0

declare void @Longtail_Free(ptr noundef) local_unnamed_addr #0

declare i32 @Longtail_CreateStoreIndexFromBlocks(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN19TestAsyncBlockStore14InitBlockStoreEPS_P16Longtail_HashAPIP15Longtail_JobAPI(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 align 2 {
  %4 = tail call ptr @Longtail_MakeBlockStoreAPI(ptr noundef %0, ptr noundef nonnull @_ZN19TestAsyncBlockStore7DisposeEP12Longtail_API, ptr noundef nonnull @_ZN19TestAsyncBlockStore14PutStoredBlockEP22Longtail_BlockStoreAPIP20Longtail_StoredBlockP31Longtail_AsyncPutStoredBlockAPI, ptr noundef nonnull @_ZN19TestAsyncBlockStore12PreflightGetEP22Longtail_BlockStoreAPIjPKmP33Longtail_AsyncPreflightStartedAPI, ptr noundef nonnull @_ZN19TestAsyncBlockStore14GetStoredBlockEP22Longtail_BlockStoreAPImP31Longtail_AsyncGetStoredBlockAPI, ptr noundef nonnull @_ZN19TestAsyncBlockStore18GetExistingContentEP22Longtail_BlockStoreAPIjPKmjP35Longtail_AsyncGetExistingContentAPI, ptr noundef nonnull @_ZN19TestAsyncBlockStore11PruneBlocksEP22Longtail_BlockStoreAPIjPKmP28Longtail_AsyncPruneBlocksAPI, ptr noundef nonnull @_ZN19TestAsyncBlockStore8GetStatsEP22Longtail_BlockStoreAPIP25Longtail_BlockStore_Stats, ptr noundef nonnull @_ZN19TestAsyncBlockStore5FlushEP22Longtail_BlockStoreAPIP22Longtail_AsyncFlushAPI)
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %.loopexit, label %5

5:                                                ; preds = %3
  %6 = getelementptr inbounds i8, ptr %0, i64 64
  store ptr %1, ptr %6, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 72
  store ptr %2, ptr %7, align 8, !tbaa !14
  %8 = getelementptr inbounds i8, ptr %0, i64 80
  store volatile i32 0, ptr %8, align 8, !tbaa !15
  %9 = getelementptr inbounds i8, ptr %0, i64 192
  %10 = getelementptr inbounds i8, ptr %0, i64 248
  store ptr null, ptr %10, align 8, !tbaa !16
  %11 = getelementptr inbounds i8, ptr %0, i64 176
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %9, i8 0, i64 48, i1 false)
  store volatile i32 0, ptr %11, align 8, !tbaa !17
  %12 = getelementptr inbounds i8, ptr %0, i64 184
  store ptr null, ptr %12, align 8, !tbaa !18
  %13 = getelementptr inbounds i8, ptr %0, i64 240
  %14 = tail call i32 @Longtail_CreateStoreIndexFromBlocks(i32 noundef 0, ptr noundef null, ptr noundef nonnull %13)
  %.not64 = icmp eq i32 %14, 0
  br i1 %.not64, label %15, label %.loopexit

15:                                               ; preds = %5
  %16 = tail call i64 @Longtail_GetSpinLockSize()
  %17 = tail call ptr @Longtail_Alloc(ptr noundef null, i64 noundef %16)
  %18 = getelementptr inbounds i8, ptr %0, i64 88
  %19 = tail call i32 @Longtail_CreateSpinLock(ptr noundef %17, ptr noundef nonnull %18)
  %.not65 = icmp eq i32 %19, 0
  br i1 %.not65, label %20, label %.loopexit.sink.split

20:                                               ; preds = %15
  %21 = tail call i64 @Longtail_GetSpinLockSize()
  %22 = tail call ptr @Longtail_Alloc(ptr noundef null, i64 noundef %21)
  %23 = getelementptr inbounds i8, ptr %0, i64 96
  %24 = tail call i32 @Longtail_CreateSpinLock(ptr noundef %22, ptr noundef nonnull %23)
  %.not66 = icmp eq i32 %24, 0
  br i1 %.not66, label %27, label %25

25:                                               ; preds = %20
  %26 = load ptr, ptr %18, align 8, !tbaa !19
  tail call void @Longtail_DeleteSpinLock(ptr noundef %26)
  br label %.loopexit.sink.split

27:                                               ; preds = %20
  %28 = tail call i64 @Longtail_GetSemaSize()
  %29 = tail call ptr @Longtail_Alloc(ptr noundef null, i64 noundef %28)
  %30 = getelementptr inbounds i8, ptr %0, i64 104
  %31 = tail call i32 @Longtail_CreateSema(ptr noundef %29, i32 noundef 0, ptr noundef nonnull %30)
  %.not67 = icmp eq i32 %31, 0
  br i1 %.not67, label %.preheader70, label %36

.preheader70:                                     ; preds = %27
  %32 = getelementptr inbounds i8, ptr %0, i64 112
  %33 = tail call i64 @Longtail_GetThreadSize()
  %34 = tail call ptr @Longtail_Alloc(ptr noundef null, i64 noundef %33)
  %35 = tail call i32 @Longtail_CreateThread(ptr noundef %34, ptr noundef nonnull @_ZN19TestAsyncBlockStore6WorkerEPv, i64 noundef 0, ptr noundef nonnull %0, i32 noundef -1, ptr noundef nonnull %32)
  %.not68.not = icmp eq i32 %35, 0
  br i1 %.not68.not, label %52, label %._crit_edge

36:                                               ; preds = %27
  %37 = load ptr, ptr %23, align 8, !tbaa !20
  tail call void @Longtail_DeleteSpinLock(ptr noundef %37)
  %38 = load ptr, ptr %23, align 8, !tbaa !20
  tail call void @Longtail_Free(ptr noundef %38)
  %39 = load ptr, ptr %18, align 8, !tbaa !19
  tail call void @Longtail_DeleteSpinLock(ptr noundef %39)
  %40 = load ptr, ptr %18, align 8, !tbaa !19
  tail call void @Longtail_Free(ptr noundef %40)
  br label %.loopexit.sink.split

.lr.ph.preheader:                                 ; preds = %82, %77, %72, %67, %62, %57, %52
  %.073.lcssa.wide.ph = phi i64 [ 7, %82 ], [ 6, %77 ], [ 5, %72 ], [ 4, %67 ], [ 3, %62 ], [ 2, %57 ], [ 1, %52 ]
  %.lcssa.ph = phi i32 [ %86, %82 ], [ %81, %77 ], [ %76, %72 ], [ %71, %67 ], [ %66, %62 ], [ %61, %57 ], [ %56, %52 ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %.073.lcssa.wide.ph, %.lr.ph.preheader ], [ %41, %.lr.ph ]
  %41 = add nsw i64 %indvars.iv, -1
  %42 = getelementptr inbounds [8 x ptr], ptr %32, i64 0, i64 %41
  %43 = load ptr, ptr %42, align 8, !tbaa !21
  %44 = tail call i32 @Longtail_JoinThread(ptr noundef %43, i64 noundef -1)
  %45 = load ptr, ptr %42, align 8, !tbaa !21
  tail call void @Longtail_DeleteThread(ptr noundef %45)
  %46 = load ptr, ptr %42, align 8, !tbaa !21
  tail call void @Longtail_Free(ptr noundef %46)
  %.not69.wide = icmp eq i64 %41, 0
  br i1 %.not69.wide, label %._crit_edge, label %.lr.ph, !llvm.loop !22

._crit_edge:                                      ; preds = %.lr.ph, %.preheader70
  %.lcssa83 = phi i32 [ %35, %.preheader70 ], [ %.lcssa.ph, %.lr.ph ]
  %47 = load ptr, ptr %30, align 8, !tbaa !24
  tail call void @Longtail_DeleteSema(ptr noundef %47)
  %48 = load ptr, ptr %30, align 8, !tbaa !24
  tail call void @Longtail_Free(ptr noundef %48)
  %49 = load ptr, ptr %23, align 8, !tbaa !20
  tail call void @Longtail_DeleteSpinLock(ptr noundef %49)
  %50 = load ptr, ptr %23, align 8, !tbaa !20
  tail call void @Longtail_Free(ptr noundef %50)
  %51 = load ptr, ptr %18, align 8, !tbaa !19
  tail call void @Longtail_DeleteSpinLock(ptr noundef %51)
  br label %.loopexit.sink.split

52:                                               ; preds = %.preheader70
  %53 = tail call i64 @Longtail_GetThreadSize()
  %54 = tail call ptr @Longtail_Alloc(ptr noundef null, i64 noundef %53)
  %55 = getelementptr inbounds i8, ptr %0, i64 120
  %56 = tail call i32 @Longtail_CreateThread(ptr noundef %54, ptr noundef nonnull @_ZN19TestAsyncBlockStore6WorkerEPv, i64 noundef 0, ptr noundef nonnull %0, i32 noundef -1, ptr noundef nonnull %55)
  %.not68.1 = icmp eq i32 %56, 0
  br i1 %.not68.1, label %57, label %.lr.ph.preheader

57:                                               ; preds = %52
  %58 = tail call i64 @Longtail_GetThreadSize()
  %59 = tail call ptr @Longtail_Alloc(ptr noundef null, i64 noundef %58)
  %60 = getelementptr inbounds i8, ptr %0, i64 128
  %61 = tail call i32 @Longtail_CreateThread(ptr noundef %59, ptr noundef nonnull @_ZN19TestAsyncBlockStore6WorkerEPv, i64 noundef 0, ptr noundef nonnull %0, i32 noundef -1, ptr noundef nonnull %60)
  %.not68.2 = icmp eq i32 %61, 0
  br i1 %.not68.2, label %62, label %.lr.ph.preheader

62:                                               ; preds = %57
  %63 = tail call i64 @Longtail_GetThreadSize()
  %64 = tail call ptr @Longtail_Alloc(ptr noundef null, i64 noundef %63)
  %65 = getelementptr inbounds i8, ptr %0, i64 136
  %66 = tail call i32 @Longtail_CreateThread(ptr noundef %64, ptr noundef nonnull @_ZN19TestAsyncBlockStore6WorkerEPv, i64 noundef 0, ptr noundef nonnull %0, i32 noundef -1, ptr noundef nonnull %65)
  %.not68.3 = icmp eq i32 %66, 0
  br i1 %.not68.3, label %67, label %.lr.ph.preheader

67:                                               ; preds = %62
  %68 = tail call i64 @Longtail_GetThreadSize()
  %69 = tail call ptr @Longtail_Alloc(ptr noundef null, i64 noundef %68)
  %70 = getelementptr inbounds i8, ptr %0, i64 144
  %71 = tail call i32 @Longtail_CreateThread(ptr noundef %69, ptr noundef nonnull @_ZN19TestAsyncBlockStore6WorkerEPv, i64 noundef 0, ptr noundef nonnull %0, i32 noundef -1, ptr noundef nonnull %70)
  %.not68.4 = icmp eq i32 %71, 0
  br i1 %.not68.4, label %72, label %.lr.ph.preheader

72:                                               ; preds = %67
  %73 = tail call i64 @Longtail_GetThreadSize()
  %74 = tail call ptr @Longtail_Alloc(ptr noundef null, i64 noundef %73)
  %75 = getelementptr inbounds i8, ptr %0, i64 152
  %76 = tail call i32 @Longtail_CreateThread(ptr noundef %74, ptr noundef nonnull @_ZN19TestAsyncBlockStore6WorkerEPv, i64 noundef 0, ptr noundef nonnull %0, i32 noundef -1, ptr noundef nonnull %75)
  %.not68.5 = icmp eq i32 %76, 0
  br i1 %.not68.5, label %77, label %.lr.ph.preheader

77:                                               ; preds = %72
  %78 = tail call i64 @Longtail_GetThreadSize()
  %79 = tail call ptr @Longtail_Alloc(ptr noundef null, i64 noundef %78)
  %80 = getelementptr inbounds i8, ptr %0, i64 160
  %81 = tail call i32 @Longtail_CreateThread(ptr noundef %79, ptr noundef nonnull @_ZN19TestAsyncBlockStore6WorkerEPv, i64 noundef 0, ptr noundef nonnull %0, i32 noundef -1, ptr noundef nonnull %80)
  %.not68.6 = icmp eq i32 %81, 0
  br i1 %.not68.6, label %82, label %.lr.ph.preheader

82:                                               ; preds = %77
  %83 = tail call i64 @Longtail_GetThreadSize()
  %84 = tail call ptr @Longtail_Alloc(ptr noundef null, i64 noundef %83)
  %85 = getelementptr inbounds i8, ptr %0, i64 168
  %86 = tail call i32 @Longtail_CreateThread(ptr noundef %84, ptr noundef nonnull @_ZN19TestAsyncBlockStore6WorkerEPv, i64 noundef 0, ptr noundef nonnull %0, i32 noundef -1, ptr noundef nonnull %85)
  %.not68.7 = icmp eq i32 %86, 0
  br i1 %.not68.7, label %.loopexit, label %.lr.ph.preheader

.loopexit.sink.split:                             ; preds = %15, %36, %25, %._crit_edge
  %.sink85 = phi ptr [ %18, %._crit_edge ], [ %13, %25 ], [ %13, %36 ], [ %13, %15 ]
  %.2.ph = phi i32 [ %.lcssa83, %._crit_edge ], [ %24, %25 ], [ %31, %36 ], [ %19, %15 ]
  %87 = load ptr, ptr %.sink85, align 8, !tbaa !21
  tail call void @Longtail_Free(ptr noundef %87)
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.sink.split, %82, %5, %3
  %.2 = phi i32 [ 12, %3 ], [ %14, %5 ], [ 0, %82 ], [ %.2.ph, %.loopexit.sink.split ]
  ret i32 %.2
}

declare ptr @Longtail_MakeBlockStoreAPI(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN19TestAsyncBlockStore7DisposeEP12Longtail_API(ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN19TestAsyncBlockStore14PutStoredBlockEP22Longtail_BlockStoreAPIP20Longtail_StoredBlockP31Longtail_AsyncPutStoredBlockAPI(ptr noundef, ptr noundef, ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN19TestAsyncBlockStore12PreflightGetEP22Longtail_BlockStoreAPIjPKmP33Longtail_AsyncPreflightStartedAPI(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN19TestAsyncBlockStore14GetStoredBlockEP22Longtail_BlockStoreAPImP31Longtail_AsyncGetStoredBlockAPI(ptr noundef, i64 noundef, ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN19TestAsyncBlockStore18GetExistingContentEP22Longtail_BlockStoreAPIjPKmjP35Longtail_AsyncGetExistingContentAPI(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN19TestAsyncBlockStore11PruneBlocksEP22Longtail_BlockStoreAPIjPKmP28Longtail_AsyncPruneBlocksAPI(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN19TestAsyncBlockStore5FlushEP22Longtail_BlockStoreAPIP22Longtail_AsyncFlushAPI(ptr noundef, ptr noundef) #1 align 2

declare i32 @Longtail_CreateSpinLock(ptr noundef, ptr noundef) local_unnamed_addr #0

declare i64 @Longtail_GetSpinLockSize() local_unnamed_addr #0

declare void @Longtail_DeleteSpinLock(ptr noundef) local_unnamed_addr #0

declare i32 @Longtail_CreateSema(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

declare i64 @Longtail_GetSemaSize() local_unnamed_addr #0

declare i32 @Longtail_CreateThread(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

declare i64 @Longtail_GetThreadSize() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN19TestAsyncBlockStore6WorkerEPv(ptr noundef) #1 align 2

declare i32 @Longtail_JoinThread(ptr noundef, i64 noundef) local_unnamed_addr #0

declare void @Longtail_DeleteThread(ptr noundef) local_unnamed_addr #0

declare void @Longtail_DeleteSema(ptr noundef) local_unnamed_addr #0

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

attributes #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 = { 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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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, !9, i64 64}
!6 = !{!"_ZTS19TestAsyncBlockStore", !7, i64 0, !9, i64 64, !9, i64 72, !12, i64 80, !9, i64 88, !9, i64 96, !9, i64 104, !10, i64 112, !12, i64 176, !9, i64 184, !13, i64 192, !9, i64 200, !13, i64 208, !9, i64 216, !13, i64 224, !9, i64 232, !9, i64 240, !9, i64 248}
!7 = !{!"_ZTS22Longtail_BlockStoreAPI", !8, i64 0, !9, i64 8, !9, i64 16, !9, i64 24, !9, i64 32, !9, i64 40, !9, i64 48, !9, i64 56}
!8 = !{!"_ZTS12Longtail_API", !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"int", !10, i64 0}
!13 = !{!"long", !10, i64 0}
!14 = !{!6, !9, i64 72}
!15 = !{!6, !12, i64 80}
!16 = !{!6, !9, i64 248}
!17 = !{!6, !12, i64 176}
!18 = !{!6, !9, i64 184}
!19 = !{!6, !9, i64 88}
!20 = !{!6, !9, i64 96}
!21 = !{!9, !9, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!6, !9, i64 104}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass