; LLVM IR from awawa-dev/HyperHDR :: external/sqlite (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, 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, i64, ptr, i32, ptr, 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) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %5 = load i32, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 28), 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 %95

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 %95

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 30), align 4, !tbaa !17
  %17 = load i32, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 31), 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 31), align 8, !tbaa !18
  %25 = load ptr, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 34), 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 34), 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 34), 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 33), align 8, !tbaa !21
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 33), 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 %95

50:                                               ; preds = %44
  %51 = load ptr, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 34), 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 28), align 4, !tbaa !5
  %53 = icmp eq i32 %52, 0
  br i1 %53, label %54, label %80

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

57:                                               ; preds = %54
  store i32 1, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 29), 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 32), 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 32), 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 %72

70:                                               ; preds = %67
  %71 = call i32 @sqlite3MemdbInit()
  store i32 %71, ptr %3, align 4, !tbaa !15
  br label %72

72:                                               ; preds = %70, %67
  %73 = load i32, ptr %3, align 4, !tbaa !15
  %74 = icmp eq i32 %73, 0
  br i1 %74, label %75, label %79

75:                                               ; preds = %72
  %76 = load ptr, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 22), align 8, !tbaa !24
  %77 = load i32, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 23), align 8, !tbaa !25
  %78 = load i32, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 24), align 4, !tbaa !26
  call void @sqlite3PCacheBufferSetup(ptr noundef %76, i32 noundef %77, i32 noundef %78)
  call void @sqlite3MemoryBarrier()
  store i32 1, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 28), align 4, !tbaa !5
  br label %79

79:                                               ; preds = %75, %72
  store i32 0, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 29), align 8, !tbaa !22
  br label %80

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

87:                                               ; preds = %80
  %88 = load ptr, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 34), align 8, !tbaa !19
  call void @sqlite3_mutex_free(ptr noundef %88)
  store ptr null, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 34), align 8, !tbaa !19
  br label %89

89:                                               ; preds = %87, %80
  %90 = load ptr, ptr %2, align 8, !tbaa !16
  call void @sqlite3_mutex_leave(ptr noundef %90)
  %91 = load i32, ptr %3, align 4, !tbaa !15
  %92 = call i32 @hasHighPrecisionDouble(i32 noundef %91)
  %93 = trunc i32 %92 to i8
  store i8 %93, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 7), align 2, !tbaa !27
  %94 = load i32, ptr %3, align 4, !tbaa !15
  store i32 %94, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %95

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

; 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 i32 @sqlite3MemdbInit() #1

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

; Function Attrs: noinline nounwind uwtable
declare hidden i32 @hasHighPrecisionDouble(i32 noundef) #3

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 = { noinline 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, !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, !8, i64 10, !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, !14, i64 392, !11, i64 400, !7, i64 408, !11, i64 416, !7, i64 424, !7, i64 428, !7, i64 432}
!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}
!27 = !{!6, !8, i64 10}


; 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, 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, i64, ptr, i32, ptr, 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 %49

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

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
  %.not22 = icmp eq i32 %7, 0
  br i1 %.not22, label %8, label %.thread

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

.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
  %.not23 = icmp eq ptr %11, null
  br i1 %.not23, 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 %.thread31

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

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 %39

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 %.thread33

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

.thread33:                                        ; 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 %.thread38

32:                                               ; preds = %.thread33
  %33 = tail call i32 @sqlite3MemdbInit()
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %35, label %.thread38

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

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

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

44:                                               ; preds = %39
  %45 = load ptr, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 368), align 8, !tbaa !17
  tail call void @sqlite3_mutex_free(ptr noundef %45)
  store ptr null, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 368), align 8, !tbaa !17
  br label %46

46:                                               ; preds = %44, %39
  tail call void @sqlite3_mutex_leave(ptr noundef %6)
  %47 = tail call i32 @hasHighPrecisionDouble(i32 noundef %.5)
  %48 = trunc i32 %47 to i8
  store i8 %48, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 10), align 2, !tbaa !25
  br label %49

49:                                               ; preds = %.thread31, %3, %46, %2
  %.018 = phi i32 [ 0, %2 ], [ %.5, %46 ], [ %4, %3 ], [ %.128.ph, %.thread31 ]
  ret i32 %.018
}

; 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 i32 @sqlite3MemdbInit() local_unnamed_addr #0

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

; Function Attrs: noinline nounwind uwtable
declare hidden i32 @hasHighPrecisionDouble(i32 noundef) local_unnamed_addr #2

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) }
attributes #2 = { noinline 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" }

!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, !8, i64 10, !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, !14, i64 392, !11, i64 400, !7, i64 408, !11, i64 416, !7, i64 424, !7, i64 428, !7, i64 432}
!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}
!25 = !{!6, !8, i64 10}


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