; LLVM IR from ryanlayer/giggle :: src (cache)

; 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.simple_cache = type { ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, ptr, %union.pthread_mutex_t, ptr, ptr, i64, i64, i32 }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.cache_handler = type { ptr, ptr, ptr }
%struct.value_cache_handler_pair = type { ptr, ptr, ptr }
%struct.lru_ll_element = type { i32, i32, i64, ptr, ptr }

@CACHE_NAME_SPACE = external dso_local global i32, align 4
@_cache = external dso_local global [10 x ptr], align 16
@.str.7 = external hidden unnamed_addr constant [32 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: nounwind
declare void @free(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local ptr @simple_cache_get(i32 noundef %0, i32 noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !9
  %15 = load i32, ptr @CACHE_NAME_SPACE, align 4, !tbaa !5
  %16 = zext i32 %15 to i64
  %17 = getelementptr inbounds [10 x ptr], ptr @_cache, i64 0, i64 %16
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %3
  call void (i32, ptr, ...) @errx(i32 noundef 1, ptr noundef @.str.7) #5
  unreachable

21:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %22 = load i32, ptr @CACHE_NAME_SPACE, align 4, !tbaa !5
  %23 = zext i32 %22 to i64
  %24 = getelementptr inbounds [10 x ptr], ptr @_cache, i64 0, i64 %23
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  store ptr %25, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %26 = load ptr, ptr %8, align 8, !tbaa !9
  %27 = getelementptr inbounds %struct.simple_cache, ptr %26, i32 0, i32 1
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = load i32, ptr %5, align 4, !tbaa !5
  %30 = zext i32 %29 to i64
  %31 = getelementptr inbounds ptr, ptr %28, i64 %30
  %32 = load ptr, ptr %31, align 8, !tbaa !9
  %33 = load i32, ptr %6, align 4, !tbaa !5
  %34 = call ptr @hash_list_get(ptr noundef %32, i32 noundef %33)
  store ptr %34, ptr %9, align 8, !tbaa !9
  %35 = load ptr, ptr %9, align 8, !tbaa !9
  %36 = icmp eq ptr %35, null
  br i1 %36, label %37, label %94

37:                                               ; preds = %21
  %38 = load ptr, ptr %8, align 8, !tbaa !9
  %39 = getelementptr inbounds %struct.simple_cache, ptr %38, i32 0, i32 9
  %40 = call i32 @pthread_mutex_lock(ptr noundef %39) #6
  %41 = load ptr, ptr %8, align 8, !tbaa !9
  %42 = getelementptr inbounds %struct.simple_cache, ptr %41, i32 0, i32 8
  %43 = load ptr, ptr %42, align 8, !tbaa !14
  %44 = icmp ne ptr %43, null
  br i1 %44, label %45, label %90

45:                                               ; preds = %37
  %46 = load ptr, ptr %8, align 8, !tbaa !9
  %47 = getelementptr inbounds %struct.simple_cache, ptr %46, i32 0, i32 8
  %48 = load ptr, ptr %47, align 8, !tbaa !14
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = zext i32 %49 to i64
  %51 = getelementptr inbounds ptr, ptr %48, i64 %50
  %52 = load ptr, ptr %51, align 8, !tbaa !9
  %53 = icmp ne ptr %52, null
  br i1 %53, label %54, label %90

54:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %55 = load ptr, ptr %8, align 8, !tbaa !9
  %56 = getelementptr inbounds %struct.simple_cache, ptr %55, i32 0, i32 8
  %57 = load ptr, ptr %56, align 8, !tbaa !14
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = zext i32 %58 to i64
  %60 = getelementptr inbounds ptr, ptr %57, i64 %59
  %61 = load ptr, ptr %60, align 8, !tbaa !9
  %62 = load i32, ptr %6, align 4, !tbaa !5
  %63 = call ptr @disk_store_get(ptr noundef %61, i32 noundef %62, ptr noundef %10)
  store ptr %63, ptr %11, align 8, !tbaa !9
  %64 = load ptr, ptr %11, align 8, !tbaa !9
  %65 = icmp eq ptr %64, null
  br i1 %65, label %66, label %67

66:                                               ; preds = %54
  store ptr null, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %89

67:                                               ; preds = %54
  %68 = load i64, ptr %10, align 8, !tbaa !15
  %69 = load ptr, ptr %8, align 8, !tbaa !9
  %70 = getelementptr inbounds %struct.simple_cache, ptr %69, i32 0, i32 13
  %71 = load i64, ptr %70, align 8, !tbaa !16
  %72 = add i64 %71, %68
  store i64 %72, ptr %70, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %73 = load ptr, ptr %7, align 8, !tbaa !9
  %74 = getelementptr inbounds %struct.cache_handler, ptr %73, i32 0, i32 1
  %75 = load ptr, ptr %74, align 8, !tbaa !17
  %76 = load ptr, ptr %11, align 8, !tbaa !9
  %77 = load i64, ptr %10, align 8, !tbaa !15
  %78 = call i64 %75(ptr noundef %76, i64 noundef %77, ptr noundef %13)
  store i64 %78, ptr %14, align 8, !tbaa !15
  %79 = load i32, ptr %5, align 4, !tbaa !5
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = load ptr, ptr %13, align 8, !tbaa !9
  %82 = load i64, ptr %10, align 8, !tbaa !15
  %83 = load ptr, ptr %7, align 8, !tbaa !9
  call void @simple_cache_add(i32 noundef %79, i32 noundef %80, ptr noundef %81, i64 noundef %82, ptr noundef %83)
  %84 = load ptr, ptr %11, align 8, !tbaa !9
  call void @free(ptr noundef %84) #6
  %85 = load ptr, ptr %8, align 8, !tbaa !9
  %86 = getelementptr inbounds %struct.simple_cache, ptr %85, i32 0, i32 9
  %87 = call i32 @pthread_mutex_unlock(ptr noundef %86) #6
  %88 = load ptr, ptr %13, align 8, !tbaa !9
  store ptr %88, ptr %4, align 8
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %89

89:                                               ; preds = %67, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %169

90:                                               ; preds = %45, %37
  %91 = load ptr, ptr %8, align 8, !tbaa !9
  %92 = getelementptr inbounds %struct.simple_cache, ptr %91, i32 0, i32 9
  %93 = call i32 @pthread_mutex_unlock(ptr noundef %92) #6
  store ptr null, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %169

94:                                               ; preds = %21
  %95 = load ptr, ptr %8, align 8, !tbaa !9
  %96 = getelementptr inbounds %struct.simple_cache, ptr %95, i32 0, i32 11
  %97 = load ptr, ptr %96, align 8, !tbaa !19
  %98 = load ptr, ptr %9, align 8, !tbaa !9
  %99 = getelementptr inbounds %struct.value_cache_handler_pair, ptr %98, i32 0, i32 2
  %100 = load ptr, ptr %99, align 8, !tbaa !20
  %101 = icmp ne ptr %97, %100
  br i1 %101, label %102, label %165

102:                                              ; preds = %94
  %103 = load ptr, ptr %8, align 8, !tbaa !9
  %104 = getelementptr inbounds %struct.simple_cache, ptr %103, i32 0, i32 10
  %105 = load ptr, ptr %104, align 8, !tbaa !22
  %106 = load ptr, ptr %9, align 8, !tbaa !9
  %107 = getelementptr inbounds %struct.value_cache_handler_pair, ptr %106, i32 0, i32 2
  %108 = load ptr, ptr %107, align 8, !tbaa !20
  %109 = icmp eq ptr %105, %108
  br i1 %109, label %110, label %118

110:                                              ; preds = %102
  %111 = load ptr, ptr %9, align 8, !tbaa !9
  %112 = getelementptr inbounds %struct.value_cache_handler_pair, ptr %111, i32 0, i32 2
  %113 = load ptr, ptr %112, align 8, !tbaa !20
  %114 = getelementptr inbounds %struct.lru_ll_element, ptr %113, i32 0, i32 4
  %115 = load ptr, ptr %114, align 8, !tbaa !23
  %116 = load ptr, ptr %8, align 8, !tbaa !9
  %117 = getelementptr inbounds %struct.simple_cache, ptr %116, i32 0, i32 10
  store ptr %115, ptr %117, align 8, !tbaa !22
  br label %141

118:                                              ; preds = %102
  %119 = load ptr, ptr %9, align 8, !tbaa !9
  %120 = getelementptr inbounds %struct.value_cache_handler_pair, ptr %119, i32 0, i32 2
  %121 = load ptr, ptr %120, align 8, !tbaa !20
  %122 = getelementptr inbounds %struct.lru_ll_element, ptr %121, i32 0, i32 3
  %123 = load ptr, ptr %122, align 8, !tbaa !25
  %124 = load ptr, ptr %9, align 8, !tbaa !9
  %125 = getelementptr inbounds %struct.value_cache_handler_pair, ptr %124, i32 0, i32 2
  %126 = load ptr, ptr %125, align 8, !tbaa !20
  %127 = getelementptr inbounds %struct.lru_ll_element, ptr %126, i32 0, i32 4
  %128 = load ptr, ptr %127, align 8, !tbaa !23
  %129 = getelementptr inbounds %struct.lru_ll_element, ptr %128, i32 0, i32 3
  store ptr %123, ptr %129, align 8, !tbaa !25
  %130 = load ptr, ptr %9, align 8, !tbaa !9
  %131 = getelementptr inbounds %struct.value_cache_handler_pair, ptr %130, i32 0, i32 2
  %132 = load ptr, ptr %131, align 8, !tbaa !20
  %133 = getelementptr inbounds %struct.lru_ll_element, ptr %132, i32 0, i32 4
  %134 = load ptr, ptr %133, align 8, !tbaa !23
  %135 = load ptr, ptr %9, align 8, !tbaa !9
  %136 = getelementptr inbounds %struct.value_cache_handler_pair, ptr %135, i32 0, i32 2
  %137 = load ptr, ptr %136, align 8, !tbaa !20
  %138 = getelementptr inbounds %struct.lru_ll_element, ptr %137, i32 0, i32 3
  %139 = load ptr, ptr %138, align 8, !tbaa !25
  %140 = getelementptr inbounds %struct.lru_ll_element, ptr %139, i32 0, i32 4
  store ptr %134, ptr %140, align 8, !tbaa !23
  br label %141

141:                                              ; preds = %118, %110
  %142 = load ptr, ptr %8, align 8, !tbaa !9
  %143 = getelementptr inbounds %struct.simple_cache, ptr %142, i32 0, i32 11
  %144 = load ptr, ptr %143, align 8, !tbaa !19
  %145 = load ptr, ptr %9, align 8, !tbaa !9
  %146 = getelementptr inbounds %struct.value_cache_handler_pair, ptr %145, i32 0, i32 2
  %147 = load ptr, ptr %146, align 8, !tbaa !20
  %148 = getelementptr inbounds %struct.lru_ll_element, ptr %147, i32 0, i32 3
  store ptr %144, ptr %148, align 8, !tbaa !25
  %149 = load ptr, ptr %9, align 8, !tbaa !9
  %150 = getelementptr inbounds %struct.value_cache_handler_pair, ptr %149, i32 0, i32 2
  %151 = load ptr, ptr %150, align 8, !tbaa !20
  %152 = load ptr, ptr %8, align 8, !tbaa !9
  %153 = getelementptr inbounds %struct.simple_cache, ptr %152, i32 0, i32 11
  %154 = load ptr, ptr %153, align 8, !tbaa !19
  %155 = getelementptr inbounds %struct.lru_ll_element, ptr %154, i32 0, i32 4
  store ptr %151, ptr %155, align 8, !tbaa !23
  %156 = load ptr, ptr %9, align 8, !tbaa !9
  %157 = getelementptr inbounds %struct.value_cache_handler_pair, ptr %156, i32 0, i32 2
  %158 = load ptr, ptr %157, align 8, !tbaa !20
  %159 = load ptr, ptr %8, align 8, !tbaa !9
  %160 = getelementptr inbounds %struct.simple_cache, ptr %159, i32 0, i32 11
  store ptr %158, ptr %160, align 8, !tbaa !19
  %161 = load ptr, ptr %8, align 8, !tbaa !9
  %162 = getelementptr inbounds %struct.simple_cache, ptr %161, i32 0, i32 11
  %163 = load ptr, ptr %162, align 8, !tbaa !19
  %164 = getelementptr inbounds %struct.lru_ll_element, ptr %163, i32 0, i32 4
  store ptr null, ptr %164, align 8, !tbaa !23
  br label %165

165:                                              ; preds = %141, %94
  %166 = load ptr, ptr %9, align 8, !tbaa !9
  %167 = getelementptr inbounds %struct.value_cache_handler_pair, ptr %166, i32 0, i32 0
  %168 = load ptr, ptr %167, align 8, !tbaa !26
  store ptr %168, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %169

169:                                              ; preds = %165, %90, %89
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %170 = load ptr, ptr %4, align 8
  ret ptr %170
}

; Function Attrs: noreturn
declare void @errx(i32 noundef, ptr noundef, ...) #3

declare ptr @hash_list_get(ptr noundef, i32 noundef) #4

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) #1

declare ptr @disk_store_get(ptr noundef, i32 noundef, ptr noundef) #4

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { noreturn "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 = { noreturn }
attributes #6 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"simple_cache", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !6, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !7, i64 72, !10, i64 112, !10, i64 120, !13, i64 128, !13, i64 136, !6, i64 144}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !10, i64 64}
!15 = !{!13, !13, i64 0}
!16 = !{!12, !13, i64 136}
!17 = !{!18, !10, i64 8}
!18 = !{!"cache_handler", !10, i64 0, !10, i64 8, !10, i64 16}
!19 = !{!12, !10, i64 120}
!20 = !{!21, !10, i64 16}
!21 = !{!"value_cache_handler_pair", !10, i64 0, !10, i64 8, !10, i64 16}
!22 = !{!12, !10, i64 112}
!23 = !{!24, !10, i64 24}
!24 = !{!"lru_ll_element", !6, i64 0, !6, i64 4, !13, i64 8, !10, i64 16, !10, i64 24}
!25 = !{!24, !10, i64 16}
!26 = !{!21, !10, 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"

@CACHE_NAME_SPACE = external dso_local local_unnamed_addr global i32, align 4
@_cache = external dso_local local_unnamed_addr global [10 x ptr], align 16
@.str.7 = external hidden unnamed_addr constant [32 x i8], align 1

; 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 nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @simple_cache_add(i32 noundef, i32 noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local ptr @simple_cache_get(i32 noundef %0, i32 noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = load i32, ptr @CACHE_NAME_SPACE, align 4, !tbaa !5
  %7 = zext i32 %6 to i64
  %8 = getelementptr inbounds [10 x ptr], ptr @_cache, i64 0, i64 %7
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %10 = icmp eq ptr %9, null
  br i1 %10, label %11, label %12

11:                                               ; preds = %3
  tail call void (i32, ptr, ...) @errx(i32 noundef 1, ptr noundef nonnull @.str.7) #6
  unreachable

12:                                               ; preds = %3
  %13 = getelementptr inbounds i8, ptr %9, i64 8
  %14 = load ptr, ptr %13, align 8, !tbaa !11
  %15 = zext i32 %0 to i64
  %16 = getelementptr inbounds ptr, ptr %14, i64 %15
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %18 = tail call ptr @hash_list_get(ptr noundef %17, i32 noundef %1) #7
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %46

20:                                               ; preds = %12
  %21 = getelementptr inbounds i8, ptr %9, i64 72
  %22 = tail call i32 @pthread_mutex_lock(ptr noundef nonnull %21) #7
  %23 = getelementptr inbounds i8, ptr %9, i64 64
  %24 = load ptr, ptr %23, align 8, !tbaa !14
  %.not44 = icmp eq ptr %24, null
  br i1 %.not44, label %44, label %25

25:                                               ; preds = %20
  %26 = getelementptr inbounds ptr, ptr %24, i64 %15
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  %.not45 = icmp eq ptr %27, null
  br i1 %.not45, label %44, label %28

28:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %29 = call ptr @disk_store_get(ptr noundef nonnull %27, i32 noundef %1, ptr noundef nonnull %4) #7
  %30 = icmp eq ptr %29, null
  br i1 %30, label %43, label %31

31:                                               ; preds = %28
  %32 = load i64, ptr %4, align 8, !tbaa !15
  %33 = getelementptr inbounds i8, ptr %9, i64 136
  %34 = load i64, ptr %33, align 8, !tbaa !16
  %35 = add i64 %34, %32
  store i64 %35, ptr %33, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %36 = getelementptr inbounds i8, ptr %2, i64 8
  %37 = load ptr, ptr %36, align 8, !tbaa !17
  %38 = call i64 %37(ptr noundef nonnull %29, i64 noundef %32, ptr noundef nonnull %5) #7
  %39 = load ptr, ptr %5, align 8, !tbaa !9
  %40 = load i64, ptr %4, align 8, !tbaa !15
  call void @simple_cache_add(i32 noundef %0, i32 noundef %1, ptr noundef %39, i64 noundef %40, ptr noundef %2)
  call void @free(ptr noundef nonnull %29) #7
  %41 = call i32 @pthread_mutex_unlock(ptr noundef nonnull %21) #7
  %42 = load ptr, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %43

43:                                               ; preds = %28, %31
  %.0 = phi ptr [ %42, %31 ], [ null, %28 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  br label %71

44:                                               ; preds = %25, %20
  %45 = tail call i32 @pthread_mutex_unlock(ptr noundef nonnull %21) #7
  br label %71

46:                                               ; preds = %12
  %47 = getelementptr inbounds i8, ptr %9, i64 120
  %48 = load ptr, ptr %47, align 8, !tbaa !19
  %49 = getelementptr inbounds i8, ptr %18, i64 16
  %50 = load ptr, ptr %49, align 8, !tbaa !20
  %.not = icmp eq ptr %48, %50
  br i1 %.not, label %69, label %51

51:                                               ; preds = %46
  %52 = getelementptr inbounds i8, ptr %9, i64 112
  %53 = load ptr, ptr %52, align 8, !tbaa !22
  %54 = icmp eq ptr %53, %50
  br i1 %54, label %55, label %58

55:                                               ; preds = %51
  %56 = getelementptr inbounds i8, ptr %50, i64 24
  %57 = load ptr, ptr %56, align 8, !tbaa !23
  store ptr %57, ptr %52, align 8, !tbaa !22
  br label %65

58:                                               ; preds = %51
  %59 = getelementptr inbounds i8, ptr %50, i64 16
  %60 = load ptr, ptr %59, align 8, !tbaa !25
  %61 = getelementptr inbounds i8, ptr %50, i64 24
  %62 = load ptr, ptr %61, align 8, !tbaa !23
  %63 = getelementptr inbounds i8, ptr %62, i64 16
  store ptr %60, ptr %63, align 8, !tbaa !25
  %64 = getelementptr inbounds i8, ptr %60, i64 24
  store ptr %62, ptr %64, align 8, !tbaa !23
  br label %65

65:                                               ; preds = %58, %55
  %66 = getelementptr inbounds i8, ptr %50, i64 16
  store ptr %48, ptr %66, align 8, !tbaa !25
  %67 = getelementptr inbounds i8, ptr %48, i64 24
  store ptr %50, ptr %67, align 8, !tbaa !23
  store ptr %50, ptr %47, align 8, !tbaa !19
  %68 = getelementptr inbounds i8, ptr %50, i64 24
  store ptr null, ptr %68, align 8, !tbaa !23
  br label %69

69:                                               ; preds = %65, %46
  %70 = load ptr, ptr %18, align 8, !tbaa !26
  br label %71

71:                                               ; preds = %69, %44, %43
  %.1 = phi ptr [ %.0, %43 ], [ null, %44 ], [ %70, %69 ]
  ret ptr %.1
}

; Function Attrs: noreturn
declare void @errx(i32 noundef, ptr noundef, ...) local_unnamed_addr #3

declare ptr @hash_list_get(ptr noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) local_unnamed_addr #5

declare ptr @disk_store_get(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) local_unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind 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 = { noreturn "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 "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 }
attributes #7 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"simple_cache", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !6, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !7, i64 72, !10, i64 112, !10, i64 120, !13, i64 128, !13, i64 136, !6, i64 144}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !10, i64 64}
!15 = !{!13, !13, i64 0}
!16 = !{!12, !13, i64 136}
!17 = !{!18, !10, i64 8}
!18 = !{!"cache_handler", !10, i64 0, !10, i64 8, !10, i64 16}
!19 = !{!12, !10, i64 120}
!20 = !{!21, !10, i64 16}
!21 = !{!"value_cache_handler_pair", !10, i64 0, !10, i64 8, !10, i64 16}
!22 = !{!12, !10, i64 112}
!23 = !{!24, !10, i64 24}
!24 = !{!"lru_ll_element", !6, i64 0, !6, i64 4, !13, i64 8, !10, i64 16, !10, i64 24}
!25 = !{!24, !10, i64 16}
!26 = !{!21, !10, i64 0}


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