; LLVM IR from HassenSaidi/IC_sqlite :: src (sqlite3)

; 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.Sqlite3Config = type { i32, i8, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, %struct.sqlite3_mem_methods, %struct.sqlite3_mutex_methods, %struct.sqlite3_pcache_methods2, ptr, i32, i32, i32, i64, i64, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, i32, i32, i32, i32 }
%struct.sqlite3_mem_methods = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.sqlite3_mutex_methods = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.sqlite3_pcache_methods2 = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.FuncDefHash = type { [23 x ptr] }

@sqlite3Config = external hidden global %struct.Sqlite3Config, align 8
@sqlite3BuiltinFunctions = external hidden global %struct.FuncDefHash, align 8

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

; Function Attrs: nounwind uwtable
declare dso_local void @sqlite3_mutex_enter(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @sqlite3_mutex_leave(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @sqlite3_initialize() #1 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %5 = load i32, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 27), align 4, !tbaa !5
  %6 = icmp ne i32 %5, 0
  br i1 %6, label %7, label %8

7:                                                ; preds = %0
  call void @sqlite3MemoryBarrier()
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %87

8:                                                ; preds = %0
  %9 = call i32 @sqlite3MutexInit()
  store i32 %9, ptr %3, align 4, !tbaa !15
  %10 = load i32, ptr %3, align 4, !tbaa !15
  %11 = icmp ne i32 %10, 0
  br i1 %11, label %12, label %14

12:                                               ; preds = %8
  %13 = load i32, ptr %3, align 4, !tbaa !15
  store i32 %13, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %87

14:                                               ; preds = %8
  %15 = call ptr @sqlite3MutexAlloc(i32 noundef 2)
  store ptr %15, ptr %2, align 8, !tbaa !16
  %16 = load ptr, ptr %2, align 8, !tbaa !16
  call void @sqlite3_mutex_enter(ptr noundef %16)
  store i32 1, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 29), align 4, !tbaa !17
  %17 = load i32, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 30), align 8, !tbaa !18
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %21, label %19

19:                                               ; preds = %14
  %20 = call i32 @sqlite3MallocInit()
  store i32 %20, ptr %3, align 4, !tbaa !15
  br label %21

21:                                               ; preds = %19, %14
  %22 = load i32, ptr %3, align 4, !tbaa !15
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %38

24:                                               ; preds = %21
  store i32 1, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 30), align 8, !tbaa !18
  %25 = load ptr, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 33), align 8, !tbaa !19
  %26 = icmp ne ptr %25, null
  br i1 %26, label %37, label %27

27:                                               ; preds = %24
  %28 = call ptr @sqlite3MutexAlloc(i32 noundef 1)
  store ptr %28, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 33), align 8, !tbaa !19
  %29 = load i8, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 1), align 4, !tbaa !20
  %30 = zext i8 %29 to i32
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %36

32:                                               ; preds = %27
  %33 = load ptr, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 33), align 8, !tbaa !19
  %34 = icmp ne ptr %33, null
  br i1 %34, label %36, label %35

35:                                               ; preds = %32
  store i32 7, ptr %3, align 4, !tbaa !15
  br label %36

36:                                               ; preds = %35, %32, %27
  br label %37

37:                                               ; preds = %36, %24
  br label %38

38:                                               ; preds = %37, %21
  %39 = load i32, ptr %3, align 4, !tbaa !15
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %41, label %44

41:                                               ; preds = %38
  %42 = load i32, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 32), align 8, !tbaa !21
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 32), align 8, !tbaa !21
  br label %44

44:                                               ; preds = %41, %38
  %45 = load ptr, ptr %2, align 8, !tbaa !16
  call void @sqlite3_mutex_leave(ptr noundef %45)
  %46 = load i32, ptr %3, align 4, !tbaa !15
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %50

48:                                               ; preds = %44
  %49 = load i32, ptr %3, align 4, !tbaa !15
  store i32 %49, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %87

50:                                               ; preds = %44
  %51 = load ptr, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 33), align 8, !tbaa !19
  call void @sqlite3_mutex_enter(ptr noundef %51)
  %52 = load i32, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 27), align 4, !tbaa !5
  %53 = icmp eq i32 %52, 0
  br i1 %53, label %54, label %75

54:                                               ; preds = %50
  %55 = load i32, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 28), align 8, !tbaa !22
  %56 = icmp eq i32 %55, 0
  br i1 %56, label %57, label %75

57:                                               ; preds = %54
  store i32 1, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 28), align 8, !tbaa !22
  call void @llvm.memset.p0.i64(ptr align 8 @sqlite3BuiltinFunctions, i8 0, i64 184, i1 false)
  call void @sqlite3RegisterBuiltinFunctions()
  %58 = load i32, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 31), align 4, !tbaa !23
  %59 = icmp eq i32 %58, 0
  br i1 %59, label %60, label %62

60:                                               ; preds = %57
  %61 = call i32 @sqlite3PcacheInitialize()
  store i32 %61, ptr %3, align 4, !tbaa !15
  br label %62

62:                                               ; preds = %60, %57
  %63 = load i32, ptr %3, align 4, !tbaa !15
  %64 = icmp eq i32 %63, 0
  br i1 %64, label %65, label %67

65:                                               ; preds = %62
  store i32 1, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 31), align 4, !tbaa !23
  %66 = call i32 @sqlite3OsInit()
  store i32 %66, ptr %3, align 4, !tbaa !15
  br label %67

67:                                               ; preds = %65, %62
  %68 = load i32, ptr %3, align 4, !tbaa !15
  %69 = icmp eq i32 %68, 0
  br i1 %69, label %70, label %74

70:                                               ; preds = %67
  %71 = load ptr, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 21), align 8, !tbaa !24
  %72 = load i32, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 22), align 8, !tbaa !25
  %73 = load i32, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 23), align 4, !tbaa !26
  call void @sqlite3PCacheBufferSetup(ptr noundef %71, i32 noundef %72, i32 noundef %73)
  call void @sqlite3MemoryBarrier()
  store i32 1, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 27), align 4, !tbaa !5
  br label %74

74:                                               ; preds = %70, %67
  store i32 0, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 28), align 8, !tbaa !22
  br label %75

75:                                               ; preds = %74, %54, %50
  %76 = load ptr, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 33), align 8, !tbaa !19
  call void @sqlite3_mutex_leave(ptr noundef %76)
  %77 = load ptr, ptr %2, align 8, !tbaa !16
  call void @sqlite3_mutex_enter(ptr noundef %77)
  %78 = load i32, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 32), align 8, !tbaa !21
  %79 = add nsw i32 %78, -1
  store i32 %79, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 32), align 8, !tbaa !21
  %80 = load i32, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 32), align 8, !tbaa !21
  %81 = icmp sle i32 %80, 0
  br i1 %81, label %82, label %84

82:                                               ; preds = %75
  %83 = load ptr, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 33), align 8, !tbaa !19
  call void @sqlite3_mutex_free(ptr noundef %83)
  store ptr null, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 33), align 8, !tbaa !19
  br label %84

84:                                               ; preds = %82, %75
  %85 = load ptr, ptr %2, align 8, !tbaa !16
  call void @sqlite3_mutex_leave(ptr noundef %85)
  %86 = load i32, ptr %3, align 4, !tbaa !15
  store i32 %86, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %87

87:                                               ; preds = %84, %48, %12, %7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  %88 = load i32, ptr %1, align 4
  ret i32 %88
}

; Function Attrs: nounwind uwtable
declare hidden ptr @sqlite3MutexAlloc(i32 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @sqlite3MutexInit() #1

; Function Attrs: nounwind uwtable
declare dso_local void @sqlite3_mutex_free(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
declare hidden void @sqlite3MemoryBarrier() #1

; Function Attrs: nounwind uwtable
declare hidden i32 @sqlite3MallocInit() #1

; Function Attrs: nounwind uwtable
declare hidden void @sqlite3RegisterBuiltinFunctions() #1

; Function Attrs: nounwind uwtable
declare hidden i32 @sqlite3PcacheInitialize() #1

; Function Attrs: nounwind uwtable
declare hidden i32 @sqlite3OsInit() #1

; Function Attrs: nounwind uwtable
declare hidden void @sqlite3PCacheBufferSetup(ptr noundef, i32 noundef, i32 noundef) #1

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 340}
!6 = !{!"Sqlite3Config", !7, i64 0, !8, i64 4, !8, i64 5, !8, i64 6, !8, i64 7, !8, i64 8, !8, i64 9, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !10, i64 32, !12, i64 96, !13, i64 168, !11, i64 272, !7, i64 280, !7, i64 284, !7, i64 288, !14, i64 296, !14, i64 304, !11, i64 312, !7, i64 320, !7, i64 324, !7, i64 328, !7, i64 332, !7, i64 336, !7, i64 340, !7, i64 344, !7, i64 348, !7, i64 352, !7, i64 356, !7, i64 360, !11, i64 368, !11, i64 376, !11, i64 384, !11, i64 392, !7, i64 400, !7, i64 404, !7, i64 408, !7, i64 412}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"sqlite3_mem_methods", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"sqlite3_mutex_methods", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64}
!13 = !{!"sqlite3_pcache_methods2", !7, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96}
!14 = !{!"long long", !8, i64 0}
!15 = !{!7, !7, i64 0}
!16 = !{!11, !11, i64 0}
!17 = !{!6, !7, i64 348}
!18 = !{!6, !7, i64 352}
!19 = !{!6, !11, i64 368}
!20 = !{!6, !8, i64 4}
!21 = !{!6, !7, i64 360}
!22 = !{!6, !7, i64 344}
!23 = !{!6, !7, i64 356}
!24 = !{!6, !11, i64 312}
!25 = !{!6, !7, i64 320}
!26 = !{!6, !7, i64 324}


; 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.Sqlite3Config = type { i32, i8, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, %struct.sqlite3_mem_methods, %struct.sqlite3_mutex_methods, %struct.sqlite3_pcache_methods2, ptr, i32, i32, i32, i64, i64, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, i32, i32, i32, i32 }
%struct.sqlite3_mem_methods = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.sqlite3_mutex_methods = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.sqlite3_pcache_methods2 = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.FuncDefHash = type { [23 x ptr] }

@sqlite3Config = external hidden local_unnamed_addr global %struct.Sqlite3Config, align 8
@sqlite3BuiltinFunctions = external hidden local_unnamed_addr global %struct.FuncDefHash, align 8

; Function Attrs: nounwind uwtable
declare dso_local void @sqlite3_mutex_enter(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @sqlite3_mutex_leave(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @sqlite3_initialize() local_unnamed_addr #0 {
  %1 = load i32, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 340), align 4, !tbaa !5
  %.not = icmp eq i32 %1, 0
  br i1 %.not, label %3, label %2

2:                                                ; preds = %0
  tail call void @sqlite3MemoryBarrier()
  br label %44

3:                                                ; preds = %0
  %4 = tail call i32 @sqlite3MutexInit()
  %.not19 = icmp eq i32 %4, 0
  br i1 %.not19, label %5, label %44

5:                                                ; preds = %3
  %6 = tail call ptr @sqlite3MutexAlloc(i32 noundef 2)
  tail call void @sqlite3_mutex_enter(ptr noundef %6)
  store i32 1, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 348), align 4, !tbaa !15
  %7 = load i32, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 352), align 8, !tbaa !16
  %.not20 = icmp eq i32 %7, 0
  br i1 %.not20, label %8, label %.thread

8:                                                ; preds = %5
  %9 = tail call i32 @sqlite3MallocInit()
  %10 = icmp eq i32 %9, 0
  br i1 %10, label %.thread, label %.thread29

.thread:                                          ; preds = %5, %8
  store i32 1, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 352), align 8, !tbaa !16
  %11 = load ptr, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 368), align 8, !tbaa !17
  %.not21 = icmp eq ptr %11, null
  br i1 %.not21, label %12, label %select.unfold

12:                                               ; preds = %.thread
  %13 = tail call ptr @sqlite3MutexAlloc(i32 noundef 1)
  store ptr %13, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 368), align 8, !tbaa !17
  %14 = load i8, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 4), align 4, !tbaa !18
  %15 = icmp eq i8 %14, 0
  %16 = icmp ne ptr %13, null
  %or.cond = select i1 %15, i1 true, i1 %16
  br i1 %or.cond, label %select.unfold, label %.thread29

.thread29:                                        ; preds = %12, %8
  %.126.ph = phi i32 [ 7, %12 ], [ %9, %8 ]
  tail call void @sqlite3_mutex_leave(ptr noundef %6)
  br label %44

select.unfold:                                    ; preds = %12, %.thread
  %17 = load i32, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 360), align 8, !tbaa !19
  %18 = add nsw i32 %17, 1
  store i32 %18, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 360), align 8, !tbaa !19
  tail call void @sqlite3_mutex_leave(ptr noundef %6)
  %19 = load ptr, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 368), align 8, !tbaa !17
  tail call void @sqlite3_mutex_enter(ptr noundef %19)
  %20 = load i32, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 340), align 4, !tbaa !5
  %21 = icmp eq i32 %20, 0
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 344), align 8
  %23 = icmp eq i32 %22, 0
  %or.cond3 = select i1 %21, i1 %23, i1 false
  br i1 %or.cond3, label %24, label %36

24:                                               ; preds = %select.unfold
  store i32 1, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 344), align 8, !tbaa !20
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(184) @sqlite3BuiltinFunctions, i8 0, i64 184, i1 false)
  tail call void @sqlite3RegisterBuiltinFunctions()
  %25 = load i32, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 356), align 4, !tbaa !21
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %.thread31

27:                                               ; preds = %24
  %28 = tail call i32 @sqlite3PcacheInitialize()
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %.thread31, label %.thread33

.thread31:                                        ; preds = %24, %27
  store i32 1, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 356), align 4, !tbaa !21
  %30 = tail call i32 @sqlite3OsInit()
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %32, label %.thread33

32:                                               ; preds = %.thread31
  %33 = load ptr, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 312), align 8, !tbaa !22
  %34 = load i32, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 320), align 8, !tbaa !23
  %35 = load i32, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 324), align 4, !tbaa !24
  tail call void @sqlite3PCacheBufferSetup(ptr noundef %33, i32 noundef %34, i32 noundef %35)
  tail call void @sqlite3MemoryBarrier()
  store i32 1, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 340), align 4, !tbaa !5
  br label %.thread33

.thread33:                                        ; preds = %27, %32, %.thread31
  %.335 = phi i32 [ 0, %32 ], [ %30, %.thread31 ], [ %28, %27 ]
  store i32 0, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 344), align 8, !tbaa !20
  br label %36

36:                                               ; preds = %.thread33, %select.unfold
  %.4 = phi i32 [ %.335, %.thread33 ], [ 0, %select.unfold ]
  %37 = load ptr, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 368), align 8, !tbaa !17
  tail call void @sqlite3_mutex_leave(ptr noundef %37)
  tail call void @sqlite3_mutex_enter(ptr noundef %6)
  %38 = load i32, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 360), align 8, !tbaa !19
  %39 = add nsw i32 %38, -1
  store i32 %39, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 360), align 8, !tbaa !19
  %40 = icmp slt i32 %38, 2
  br i1 %40, label %41, label %43

41:                                               ; preds = %36
  %42 = load ptr, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 368), align 8, !tbaa !17
  tail call void @sqlite3_mutex_free(ptr noundef %42)
  store ptr null, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 368), align 8, !tbaa !17
  br label %43

43:                                               ; preds = %41, %36
  tail call void @sqlite3_mutex_leave(ptr noundef %6)
  br label %44

44:                                               ; preds = %.thread29, %3, %43, %2
  %.016 = phi i32 [ 0, %2 ], [ %.4, %43 ], [ %4, %3 ], [ %.126.ph, %.thread29 ]
  ret i32 %.016
}

; Function Attrs: nounwind uwtable
declare hidden ptr @sqlite3MutexAlloc(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @sqlite3MutexInit() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @sqlite3_mutex_free(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare hidden void @sqlite3MemoryBarrier() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @sqlite3MallocInit() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @sqlite3RegisterBuiltinFunctions() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @sqlite3PcacheInitialize() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @sqlite3OsInit() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @sqlite3PCacheBufferSetup(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

attributes #0 = { 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 = { mustprogress 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, !7, i64 340}
!6 = !{!"Sqlite3Config", !7, i64 0, !8, i64 4, !8, i64 5, !8, i64 6, !8, i64 7, !8, i64 8, !8, i64 9, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !10, i64 32, !12, i64 96, !13, i64 168, !11, i64 272, !7, i64 280, !7, i64 284, !7, i64 288, !14, i64 296, !14, i64 304, !11, i64 312, !7, i64 320, !7, i64 324, !7, i64 328, !7, i64 332, !7, i64 336, !7, i64 340, !7, i64 344, !7, i64 348, !7, i64 352, !7, i64 356, !7, i64 360, !11, i64 368, !11, i64 376, !11, i64 384, !11, i64 392, !7, i64 400, !7, i64 404, !7, i64 408, !7, i64 412}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"sqlite3_mem_methods", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"sqlite3_mutex_methods", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64}
!13 = !{!"sqlite3_pcache_methods2", !7, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96}
!14 = !{!"long long", !8, i64 0}
!15 = !{!6, !7, i64 348}
!16 = !{!6, !7, i64 352}
!17 = !{!6, !11, i64 368}
!18 = !{!6, !8, i64 4}
!19 = !{!6, !7, i64 360}
!20 = !{!6, !7, i64 344}
!21 = !{!6, !7, i64 356}
!22 = !{!6, !11, i64 312}
!23 = !{!6, !7, i64 320}
!24 = !{!6, !7, i64 324}


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