; LLVM IR from eProsima/Fast-DDS :: src/cpp/rtps/persistence (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, 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.sqlite3 = type { ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i64, i64, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i64, i64, [12 x i32], i32, %struct.sqlite3InitInfo, i32, i32, i32, i32, i32, i32, ptr, %union.anon, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %union.anon.0, %struct.Lookaside, ptr, ptr, ptr, ptr, i32, i32, %struct.Hash, ptr, ptr, ptr, %struct.Hash, %struct.Hash, %struct.BusyHandler, [2 x %struct.Db], ptr, i32, i32, i32, i32, i64, i64, ptr, ptr }
%struct.sqlite3InitInfo = type { i32, i8, i8, i8, ptr }
%union.anon = type { ptr }
%union.anon.0 = type { double }
%struct.Lookaside = type { i32, i16, i16, i8, i32, [3 x i32], ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.Hash = type { i32, i32, ptr, ptr }
%struct.BusyHandler = type { ptr, ptr, i32 }
%struct.Db = type { ptr, ptr, i8, i8, ptr }
%struct.MemFile = type { %struct.sqlite3_file, ptr, i32 }
%struct.sqlite3_file = type { ptr }
%struct.MemStore = type { i64, i64, i64, ptr, ptr, i32, i32, i32, i32, i32, ptr }

@sqlite3Config = external hidden global %struct.Sqlite3Config, align 8
@.str.17 = external hidden unnamed_addr constant [15 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: 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
declare dso_local void @sqlite3_free(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @sqlite3_mprintf(ptr noundef, ...) #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @sqlite3_prepare_v2(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @sqlite3_step(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @sqlite3_finalize(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @sqlite3_deserialize(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3, i64 noundef %4, i32 noundef %5) #1 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i64 %3, ptr %10, align 8, !tbaa !9
  store i64 %4, ptr %11, align 8, !tbaa !9
  store i32 %5, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #2
  store ptr null, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #2
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.sqlite3, ptr %19, i32 0, i32 3
  %21 = load ptr, ptr %20, align 8, !tbaa !13
  call void @sqlite3_mutex_enter(ptr noundef %21)
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = icmp eq ptr %22, null
  br i1 %23, label %24, label %31

24:                                               ; preds = %6
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.sqlite3, ptr %25, i32 0, i32 4
  %27 = load ptr, ptr %26, align 8, !tbaa !20
  %28 = getelementptr inbounds %struct.Db, ptr %27, i64 0
  %29 = getelementptr inbounds %struct.Db, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !21
  store ptr %30, ptr %8, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %24, %6
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = call i32 @sqlite3FindDbName(ptr noundef %32, ptr noundef %33)
  store i32 %34, ptr %17, align 4, !tbaa !11
  %35 = load i32, ptr %17, align 4, !tbaa !11
  %36 = icmp slt i32 %35, 2
  br i1 %36, label %37, label %41

37:                                               ; preds = %31
  %38 = load i32, ptr %17, align 4, !tbaa !11
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %41

40:                                               ; preds = %37
  store i32 1, ptr %16, align 4, !tbaa !11
  br label %116

41:                                               ; preds = %37, %31
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = call ptr (ptr, ...) @sqlite3_mprintf(ptr noundef @.str.17, ptr noundef %42)
  store ptr %43, ptr %14, align 8, !tbaa !5
  %44 = load ptr, ptr %14, align 8, !tbaa !5
  %45 = icmp eq ptr %44, null
  br i1 %45, label %46, label %47

46:                                               ; preds = %41
  store i32 7, ptr %16, align 4, !tbaa !11
  br label %52

47:                                               ; preds = %41
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = load ptr, ptr %14, align 8, !tbaa !5
  %50 = call i32 @sqlite3_prepare_v2(ptr noundef %48, ptr noundef %49, i32 noundef -1, ptr noundef %15, ptr noundef null)
  store i32 %50, ptr %16, align 4, !tbaa !11
  %51 = load ptr, ptr %14, align 8, !tbaa !5
  call void @sqlite3_free(ptr noundef %51)
  br label %52

52:                                               ; preds = %47, %46
  %53 = load i32, ptr %16, align 4, !tbaa !11
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %56

55:                                               ; preds = %52
  br label %116

56:                                               ; preds = %52
  %57 = load i32, ptr %17, align 4, !tbaa !11
  %58 = trunc i32 %57 to i8
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.sqlite3, ptr %59, i32 0, i32 36
  %61 = getelementptr inbounds %struct.sqlite3InitInfo, ptr %60, i32 0, i32 1
  store i8 %58, ptr %61, align 4, !tbaa !23
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.sqlite3, ptr %62, i32 0, i32 36
  %64 = getelementptr inbounds %struct.sqlite3InitInfo, ptr %63, i32 0, i32 3
  %65 = load i8, ptr %64, align 2
  %66 = and i8 %65, -5
  %67 = or i8 %66, 4
  store i8 %67, ptr %64, align 2
  %68 = load ptr, ptr %15, align 8, !tbaa !5
  %69 = call i32 @sqlite3_step(ptr noundef %68)
  store i32 %69, ptr %16, align 4, !tbaa !11
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.sqlite3, ptr %70, i32 0, i32 36
  %72 = getelementptr inbounds %struct.sqlite3InitInfo, ptr %71, i32 0, i32 3
  %73 = load i8, ptr %72, align 2
  %74 = and i8 %73, -5
  %75 = or i8 %74, 0
  store i8 %75, ptr %72, align 2
  %76 = load i32, ptr %16, align 4, !tbaa !11
  %77 = icmp ne i32 %76, 101
  br i1 %77, label %78, label %79

78:                                               ; preds = %56
  store i32 1, ptr %16, align 4, !tbaa !11
  br label %116

79:                                               ; preds = %56
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = call ptr @memdbFromDbSchema(ptr noundef %80, ptr noundef %81)
  store ptr %82, ptr %13, align 8, !tbaa !5
  %83 = load ptr, ptr %13, align 8, !tbaa !5
  %84 = icmp eq ptr %83, null
  br i1 %84, label %85, label %86

85:                                               ; preds = %79
  store i32 1, ptr %16, align 4, !tbaa !11
  br label %115

86:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #2
  %87 = load ptr, ptr %13, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.MemFile, ptr %87, i32 0, i32 1
  %89 = load ptr, ptr %88, align 8, !tbaa !24
  store ptr %89, ptr %18, align 8, !tbaa !5
  %90 = load ptr, ptr %9, align 8, !tbaa !5
  %91 = load ptr, ptr %18, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.MemStore, ptr %91, i32 0, i32 3
  store ptr %90, ptr %92, align 8, !tbaa !27
  store ptr null, ptr %9, align 8, !tbaa !5
  %93 = load i64, ptr %10, align 8, !tbaa !9
  %94 = load ptr, ptr %18, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.MemStore, ptr %94, i32 0, i32 0
  store i64 %93, ptr %95, align 8, !tbaa !29
  %96 = load i64, ptr %11, align 8, !tbaa !9
  %97 = load ptr, ptr %18, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.MemStore, ptr %97, i32 0, i32 1
  store i64 %96, ptr %98, align 8, !tbaa !30
  %99 = load i64, ptr %11, align 8, !tbaa !9
  %100 = load ptr, ptr %18, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.MemStore, ptr %100, i32 0, i32 2
  store i64 %99, ptr %101, align 8, !tbaa !31
  %102 = load ptr, ptr %18, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.MemStore, ptr %102, i32 0, i32 2
  %104 = load i64, ptr %103, align 8, !tbaa !31
  %105 = load i64, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 36), align 8, !tbaa !32
  %106 = icmp slt i64 %104, %105
  br i1 %106, label %107, label %111

107:                                              ; preds = %86
  %108 = load i64, ptr getelementptr inbounds (%struct.Sqlite3Config, ptr @sqlite3Config, i32 0, i32 36), align 8, !tbaa !32
  %109 = load ptr, ptr %18, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.MemStore, ptr %109, i32 0, i32 2
  store i64 %108, ptr %110, align 8, !tbaa !31
  br label %111

111:                                              ; preds = %107, %86
  %112 = load i32, ptr %12, align 4, !tbaa !11
  %113 = load ptr, ptr %18, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.MemStore, ptr %113, i32 0, i32 6
  store i32 %112, ptr %114, align 4, !tbaa !37
  store i32 0, ptr %16, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #2
  br label %115

115:                                              ; preds = %111, %85
  br label %116

116:                                              ; preds = %115, %78, %55, %40
  %117 = load ptr, ptr %15, align 8, !tbaa !5
  %118 = call i32 @sqlite3_finalize(ptr noundef %117)
  %119 = load ptr, ptr %9, align 8, !tbaa !5
  %120 = icmp ne ptr %119, null
  br i1 %120, label %121, label %127

121:                                              ; preds = %116
  %122 = load i32, ptr %12, align 4, !tbaa !11
  %123 = and i32 %122, 1
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %125, label %127

125:                                              ; preds = %121
  %126 = load ptr, ptr %9, align 8, !tbaa !5
  call void @sqlite3_free(ptr noundef %126)
  br label %127

127:                                              ; preds = %125, %121, %116
  %128 = load ptr, ptr %7, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.sqlite3, ptr %128, i32 0, i32 3
  %130 = load ptr, ptr %129, align 8, !tbaa !13
  call void @sqlite3_mutex_leave(ptr noundef %130)
  %131 = load i32, ptr %16, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #2
  ret i32 %131
}

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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 24}
!14 = !{!"sqlite3", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !12, i64 40, !12, i64 44, !10, i64 48, !10, i64 56, !10, i64 64, !12, i64 72, !12, i64 76, !12, i64 80, !12, i64 84, !12, i64 88, !12, i64 92, !12, i64 96, !7, i64 100, !7, i64 101, !7, i64 102, !7, i64 103, !7, i64 104, !7, i64 105, !7, i64 106, !7, i64 107, !7, i64 108, !7, i64 109, !7, i64 110, !7, i64 111, !7, i64 112, !7, i64 113, !12, i64 116, !10, i64 120, !10, i64 128, !7, i64 136, !12, i64 184, !15, i64 192, !12, i64 208, !12, i64 212, !12, i64 216, !12, i64 220, !12, i64 224, !12, i64 228, !6, i64 232, !7, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !6, i64 392, !7, i64 400, !16, i64 408, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !12, i64 536, !12, i64 540, !18, i64 544, !6, i64 568, !6, i64 576, !6, i64 584, !18, i64 592, !18, i64 616, !19, i64 640, !7, i64 664, !6, i64 728, !12, i64 736, !12, i64 740, !12, i64 744, !12, i64 748, !10, i64 752, !10, i64 760, !6, i64 768, !6, i64 776}
!15 = !{!"sqlite3InitInfo", !12, i64 0, !7, i64 4, !7, i64 5, !12, i64 6, !12, i64 6, !12, i64 6, !6, i64 8}
!16 = !{!"Lookaside", !12, i64 0, !17, i64 4, !17, i64 6, !7, i64 8, !12, i64 12, !7, i64 16, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88}
!17 = !{!"short", !7, i64 0}
!18 = !{!"Hash", !12, i64 0, !12, i64 4, !6, i64 8, !6, i64 16}
!19 = !{!"BusyHandler", !6, i64 0, !6, i64 8, !12, i64 16}
!20 = !{!14, !6, i64 32}
!21 = !{!22, !6, i64 0}
!22 = !{!"Db", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 17, !6, i64 24}
!23 = !{!14, !7, i64 196}
!24 = !{!25, !6, i64 8}
!25 = !{!"MemFile", !26, i64 0, !6, i64 8, !12, i64 16}
!26 = !{!"sqlite3_file", !6, i64 0}
!27 = !{!28, !6, i64 24}
!28 = !{!"MemStore", !10, i64 0, !10, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !6, i64 64}
!29 = !{!28, !10, i64 0}
!30 = !{!28, !10, i64 8}
!31 = !{!28, !10, i64 16}
!32 = !{!33, !10, i64 392}
!33 = !{!"Sqlite3Config", !12, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !7, i64 9, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !34, i64 32, !35, i64 96, !36, i64 168, !6, i64 272, !12, i64 280, !12, i64 284, !12, i64 288, !10, i64 296, !10, i64 304, !6, i64 312, !12, i64 320, !12, i64 324, !12, i64 328, !12, i64 332, !12, i64 336, !12, i64 340, !12, i64 344, !12, i64 348, !12, i64 352, !12, i64 356, !12, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !10, i64 392, !6, i64 400, !12, i64 408, !6, i64 416, !12, i64 424, !12, i64 428, !12, i64 432}
!34 = !{!"sqlite3_mem_methods", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!35 = !{!"sqlite3_mutex_methods", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64}
!36 = !{!"sqlite3_pcache_methods2", !12, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}
!37 = !{!28, !12, i64 44}


; 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, 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 }

@sqlite3Config = external hidden local_unnamed_addr global %struct.Sqlite3Config, align 8
@.str.17 = external hidden unnamed_addr constant [15 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: nounwind uwtable
declare dso_local void @sqlite3_mutex_enter(ptr noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @sqlite3_mprintf(ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden ptr @memdbFromDbSchema(ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @sqlite3_prepare_v2(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @sqlite3_step(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @sqlite3_finalize(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @sqlite3_deserialize(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3, i64 noundef %4, i32 noundef %5) local_unnamed_addr #1 {
  %7 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #3
  store ptr null, ptr %7, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  tail call void @sqlite3_mutex_enter(ptr noundef %9)
  %10 = icmp eq ptr %1, null
  br i1 %10, label %11, label %15

11:                                               ; preds = %6
  %12 = getelementptr inbounds i8, ptr %0, i64 32
  %13 = load ptr, ptr %12, align 8, !tbaa !18
  %14 = load ptr, ptr %13, align 8, !tbaa !19
  br label %15

15:                                               ; preds = %11, %6
  %.0 = phi ptr [ %14, %11 ], [ %1, %6 ]
  %16 = tail call i32 @sqlite3FindDbName(ptr noundef nonnull %0, ptr noundef %.0)
  %17 = icmp slt i32 %16, 2
  %18 = icmp ne i32 %16, 0
  %or.cond = and i1 %17, %18
  br i1 %or.cond, label %.thread, label %19

19:                                               ; preds = %15
  %20 = tail call ptr (ptr, ...) @sqlite3_mprintf(ptr noundef nonnull @.str.17, ptr noundef %.0)
  %21 = icmp eq ptr %20, null
  br i1 %21, label %.thread, label %22

22:                                               ; preds = %19
  %23 = call i32 @sqlite3_prepare_v2(ptr noundef nonnull %0, ptr noundef nonnull %20, i32 noundef -1, ptr noundef nonnull %7, ptr noundef null)
  call void @sqlite3_free(ptr noundef nonnull %20)
  %.not = icmp eq i32 %23, 0
  br i1 %.not, label %24, label %.thread

24:                                               ; preds = %22
  %25 = trunc i32 %16 to i8
  %26 = getelementptr inbounds i8, ptr %0, i64 196
  store i8 %25, ptr %26, align 4, !tbaa !21
  %27 = getelementptr inbounds i8, ptr %0, i64 198
  %28 = load i8, ptr %27, align 2
  %29 = or i8 %28, 4
  store i8 %29, ptr %27, align 2
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = call i32 @sqlite3_step(ptr noundef %30)
  %32 = load i8, ptr %27, align 2
  %33 = and i8 %32, -5
  store i8 %33, ptr %27, align 2
  %.not45 = icmp eq i32 %31, 101
  br i1 %.not45, label %34, label %.thread

34:                                               ; preds = %24
  %35 = call ptr @memdbFromDbSchema(ptr noundef nonnull %0, ptr noundef %.0)
  %36 = icmp eq ptr %35, null
  br i1 %36, label %.thread, label %37

37:                                               ; preds = %34
  %38 = getelementptr inbounds i8, ptr %35, i64 8
  %39 = load ptr, ptr %38, align 8, !tbaa !22
  %40 = getelementptr inbounds i8, ptr %39, i64 24
  store ptr %2, ptr %40, align 8, !tbaa !25
  store i64 %3, ptr %39, align 8, !tbaa !27
  %41 = getelementptr inbounds i8, ptr %39, i64 8
  store i64 %4, ptr %41, align 8, !tbaa !28
  %42 = getelementptr inbounds i8, ptr %39, i64 16
  %43 = load i64, ptr getelementptr inbounds (i8, ptr @sqlite3Config, i64 392), align 8, !tbaa !29
  %spec.store.select = call i64 @llvm.smax.i64(i64 %43, i64 %4)
  store i64 %spec.store.select, ptr %42, align 8
  %44 = getelementptr inbounds i8, ptr %39, i64 44
  store i32 %5, ptr %44, align 4, !tbaa !34
  br label %.thread

.thread:                                          ; preds = %19, %34, %24, %15, %37, %22
  %.1 = phi i32 [ %23, %22 ], [ 0, %37 ], [ 1, %15 ], [ 1, %24 ], [ 1, %34 ], [ 7, %19 ]
  %.039 = phi ptr [ %2, %22 ], [ null, %37 ], [ %2, %15 ], [ %2, %24 ], [ %2, %34 ], [ %2, %19 ]
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = call i32 @sqlite3_finalize(ptr noundef %45)
  %.not46 = icmp eq ptr %.039, null
  %47 = and i32 %5, 1
  %.not47 = icmp eq i32 %47, 0
  %or.cond48 = or i1 %.not47, %.not46
  br i1 %or.cond48, label %49, label %48

48:                                               ; preds = %.thread
  call void @sqlite3_free(ptr noundef nonnull %.039)
  br label %49

49:                                               ; preds = %48, %.thread
  %50 = load ptr, ptr %8, align 8, !tbaa !9
  call void @sqlite3_mutex_leave(ptr noundef %50)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  ret i32 %.1
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #2

attributes #0 = { mustprogress 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 nosync nounwind speculatable willreturn memory(none) }
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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 24}
!10 = !{!"sqlite3", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !11, i64 44, !12, i64 48, !12, i64 56, !12, i64 64, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !7, i64 100, !7, i64 101, !7, i64 102, !7, i64 103, !7, i64 104, !7, i64 105, !7, i64 106, !7, i64 107, !7, i64 108, !7, i64 109, !7, i64 110, !7, i64 111, !7, i64 112, !7, i64 113, !11, i64 116, !12, i64 120, !12, i64 128, !7, i64 136, !11, i64 184, !13, i64 192, !11, i64 208, !11, i64 212, !11, i64 216, !11, i64 220, !11, i64 224, !11, i64 228, !6, i64 232, !7, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !6, i64 392, !7, i64 400, !14, i64 408, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !11, i64 536, !11, i64 540, !16, i64 544, !6, i64 568, !6, i64 576, !6, i64 584, !16, i64 592, !16, i64 616, !17, i64 640, !7, i64 664, !6, i64 728, !11, i64 736, !11, i64 740, !11, i64 744, !11, i64 748, !12, i64 752, !12, i64 760, !6, i64 768, !6, i64 776}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"sqlite3InitInfo", !11, i64 0, !7, i64 4, !7, i64 5, !11, i64 6, !11, i64 6, !11, i64 6, !6, i64 8}
!14 = !{!"Lookaside", !11, i64 0, !15, i64 4, !15, i64 6, !7, i64 8, !11, i64 12, !7, i64 16, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88}
!15 = !{!"short", !7, i64 0}
!16 = !{!"Hash", !11, i64 0, !11, i64 4, !6, i64 8, !6, i64 16}
!17 = !{!"BusyHandler", !6, i64 0, !6, i64 8, !11, i64 16}
!18 = !{!10, !6, i64 32}
!19 = !{!20, !6, i64 0}
!20 = !{!"Db", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 17, !6, i64 24}
!21 = !{!10, !7, i64 196}
!22 = !{!23, !6, i64 8}
!23 = !{!"MemFile", !24, i64 0, !6, i64 8, !11, i64 16}
!24 = !{!"sqlite3_file", !6, i64 0}
!25 = !{!26, !6, i64 24}
!26 = !{!"MemStore", !12, i64 0, !12, i64 8, !12, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !6, i64 64}
!27 = !{!26, !12, i64 0}
!28 = !{!26, !12, i64 8}
!29 = !{!30, !12, i64 392}
!30 = !{!"Sqlite3Config", !11, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !7, i64 9, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !31, i64 32, !32, i64 96, !33, i64 168, !6, i64 272, !11, i64 280, !11, i64 284, !11, i64 288, !12, i64 296, !12, i64 304, !6, i64 312, !11, i64 320, !11, i64 324, !11, i64 328, !11, i64 332, !11, i64 336, !11, i64 340, !11, i64 344, !11, i64 348, !11, i64 352, !11, i64 356, !11, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !12, i64 392, !6, i64 400, !11, i64 408, !6, i64 416, !11, i64 424, !11, i64 428, !11, i64 432}
!31 = !{!"sqlite3_mem_methods", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!32 = !{!"sqlite3_mutex_methods", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64}
!33 = !{!"sqlite3_pcache_methods2", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}
!34 = !{!26, !11, i64 44}


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