; LLVM IR from flomar/sqlmemdb :: sqlite (shell)

; 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.IdxHash = type { ptr, [1023 x ptr] }
%struct.sqlite3expert = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, i32, %struct.IdxHash, ptr }
%struct.IdxStatement = type { i32, ptr, ptr, ptr, ptr }
%struct.IdxHashEntry = type { ptr, ptr, ptr, ptr, ptr }

@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [5 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 uwtable
define dso_local i32 @idxFindIndexes(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %struct.IdxHash, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.sqlite3expert, ptr %19, i32 0, i32 2
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  store ptr %21, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8192, ptr %9) #4
  call void @idxHashInit(ptr noundef %9)
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.sqlite3expert, ptr %22, i32 0, i32 7
  %24 = load ptr, ptr %23, align 8, !tbaa !14
  store ptr %24, ptr %6, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %189, %2
  %26 = load i32, ptr %8, align 4, !tbaa !13
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %31

28:                                               ; preds = %25
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = icmp ne ptr %29, null
  br label %31

31:                                               ; preds = %28, %25
  %32 = phi i1 [ false, %25 ], [ %30, %28 ]
  br i1 %32, label %33, label %193

33:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store ptr null, ptr %11, align 8, !tbaa !5
  call void @idxHashClear(ptr noundef %9)
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.IdxStatement, ptr %36, i32 0, i32 1
  %38 = load ptr, ptr %37, align 8, !tbaa !15
  %39 = call i32 (ptr, ptr, ptr, ptr, ...) @idxPrintfPrepareStmt(ptr noundef %34, ptr noundef %11, ptr noundef %35, ptr noundef @.str.6, ptr noundef %38)
  store i32 %39, ptr %8, align 4, !tbaa !13
  br label %40

40:                                               ; preds = %163, %33
  %41 = load i32, ptr %8, align 4, !tbaa !13
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %47

43:                                               ; preds = %40
  %44 = load ptr, ptr %11, align 8, !tbaa !5
  %45 = call i32 @sqlite3_step(ptr noundef %44)
  %46 = icmp eq i32 %45, 100
  br label %47

47:                                               ; preds = %43, %40
  %48 = phi i1 [ false, %40 ], [ %46, %43 ]
  br i1 %48, label %49, label %164

49:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %50 = load ptr, ptr %11, align 8, !tbaa !5
  %51 = call ptr @sqlite3_column_text(ptr noundef %50, i32 noundef 3)
  store ptr %51, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = call i64 @strlen(ptr noundef %52) #5
  %54 = trunc i64 %53 to i32
  store i32 %54, ptr %13, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !13
  br label %55

55:                                               ; preds = %143, %49
  %56 = load i32, ptr %14, align 4, !tbaa !13
  %57 = load i32, ptr %13, align 4, !tbaa !13
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %59, label %146

59:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  store ptr null, ptr %15, align 8, !tbaa !5
  %60 = load ptr, ptr %12, align 8, !tbaa !5
  %61 = load i32, ptr %14, align 4, !tbaa !13
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds i8, ptr %60, i64 %62
  %64 = call i32 @memcmp(ptr noundef %63, ptr noundef @.str.7, i64 noundef 13) #5
  %65 = icmp eq i32 %64, 0
  br i1 %65, label %66, label %72

66:                                               ; preds = %59
  %67 = load ptr, ptr %12, align 8, !tbaa !5
  %68 = load i32, ptr %14, align 4, !tbaa !13
  %69 = add nsw i32 %68, 13
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds i8, ptr %67, i64 %70
  store ptr %71, ptr %15, align 8, !tbaa !5
  br label %86

72:                                               ; preds = %59
  %73 = load ptr, ptr %12, align 8, !tbaa !5
  %74 = load i32, ptr %14, align 4, !tbaa !13
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds i8, ptr %73, i64 %75
  %77 = call i32 @memcmp(ptr noundef %76, ptr noundef @.str.8, i64 noundef 22) #5
  %78 = icmp eq i32 %77, 0
  br i1 %78, label %79, label %85

79:                                               ; preds = %72
  %80 = load ptr, ptr %12, align 8, !tbaa !5
  %81 = load i32, ptr %14, align 4, !tbaa !13
  %82 = add nsw i32 %81, 22
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds i8, ptr %80, i64 %83
  store ptr %84, ptr %15, align 8, !tbaa !5
  br label %85

85:                                               ; preds = %79, %72
  br label %86

86:                                               ; preds = %85, %66
  %87 = load ptr, ptr %15, align 8, !tbaa !5
  %88 = icmp ne ptr %87, null
  br i1 %88, label %89, label %139

89:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 0, ptr %17, align 4, !tbaa !13
  br label %90

90:                                               ; preds = %119, %89
  %91 = load ptr, ptr %15, align 8, !tbaa !5
  %92 = load i32, ptr %17, align 4, !tbaa !13
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds i8, ptr %91, i64 %93
  %95 = load i8, ptr %94, align 1, !tbaa !17
  %96 = sext i8 %95 to i32
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %98, label %117

98:                                               ; preds = %90
  %99 = load ptr, ptr %15, align 8, !tbaa !5
  %100 = load i32, ptr %17, align 4, !tbaa !13
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds i8, ptr %99, i64 %101
  %103 = load i8, ptr %102, align 1, !tbaa !17
  %104 = sext i8 %103 to i32
  %105 = icmp ne i32 %104, 32
  br i1 %105, label %115, label %106

106:                                              ; preds = %98
  %107 = load ptr, ptr %15, align 8, !tbaa !5
  %108 = load i32, ptr %17, align 4, !tbaa !13
  %109 = add nsw i32 %108, 1
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds i8, ptr %107, i64 %110
  %112 = load i8, ptr %111, align 1, !tbaa !17
  %113 = sext i8 %112 to i32
  %114 = icmp ne i32 %113, 40
  br label %115

115:                                              ; preds = %106, %98
  %116 = phi i1 [ true, %98 ], [ %114, %106 ]
  br label %117

117:                                              ; preds = %115, %90
  %118 = phi i1 [ false, %90 ], [ %116, %115 ]
  br i1 %118, label %119, label %122

119:                                              ; preds = %117
  %120 = load i32, ptr %17, align 4, !tbaa !13
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %17, align 4, !tbaa !13
  br label %90, !llvm.loop !18

122:                                              ; preds = %117
  %123 = load ptr, ptr %4, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.sqlite3expert, ptr %123, i32 0, i32 11
  %125 = load ptr, ptr %15, align 8, !tbaa !5
  %126 = load i32, ptr %17, align 4, !tbaa !13
  %127 = call ptr @idxHashSearch(ptr noundef %124, ptr noundef %125, i32 noundef %126)
  store ptr %127, ptr %16, align 8, !tbaa !5
  %128 = load ptr, ptr %16, align 8, !tbaa !5
  %129 = icmp ne ptr %128, null
  br i1 %129, label %130, label %137

130:                                              ; preds = %122
  %131 = load ptr, ptr %16, align 8, !tbaa !5
  %132 = call i32 @idxHashAdd(ptr noundef %8, ptr noundef %9, ptr noundef %131, ptr noundef null)
  %133 = load i32, ptr %8, align 4, !tbaa !13
  %134 = icmp ne i32 %133, 0
  br i1 %134, label %135, label %136

135:                                              ; preds = %130
  store i32 12, ptr %18, align 4
  br label %138

136:                                              ; preds = %130
  br label %137

137:                                              ; preds = %136, %122
  store i32 7, ptr %18, align 4
  br label %138

138:                                              ; preds = %137, %135
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  br label %140

139:                                              ; preds = %86
  store i32 0, ptr %18, align 4
  br label %140

140:                                              ; preds = %139, %138
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  %141 = load i32, ptr %18, align 4
  switch i32 %141, label %161 [
    i32 0, label %142
    i32 7, label %146
  ]

142:                                              ; preds = %140
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %14, align 4, !tbaa !13
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %14, align 4, !tbaa !13
  br label %55, !llvm.loop !20

146:                                              ; preds = %140, %55
  %147 = load ptr, ptr %12, align 8, !tbaa !5
  %148 = getelementptr inbounds i8, ptr %147, i64 0
  %149 = load i8, ptr %148, align 1, !tbaa !17
  %150 = sext i8 %149 to i32
  %151 = icmp ne i32 %150, 45
  br i1 %151, label %152, label %160

152:                                              ; preds = %146
  %153 = load ptr, ptr %6, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.IdxStatement, ptr %153, i32 0, i32 3
  %155 = load ptr, ptr %154, align 8, !tbaa !21
  %156 = load ptr, ptr %12, align 8, !tbaa !5
  %157 = call ptr (ptr, ptr, ptr, ...) @idxAppendText(ptr noundef %8, ptr noundef %155, ptr noundef @.str.9, ptr noundef %156)
  %158 = load ptr, ptr %6, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.IdxStatement, ptr %158, i32 0, i32 3
  store ptr %157, ptr %159, align 8, !tbaa !21
  br label %160

160:                                              ; preds = %152, %146
  store i32 0, ptr %18, align 4
  br label %161

161:                                              ; preds = %160, %140
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %162 = load i32, ptr %18, align 4
  switch i32 %162, label %186 [
    i32 0, label %163
  ]

163:                                              ; preds = %161
  br label %40, !llvm.loop !22

164:                                              ; preds = %47
  %165 = getelementptr inbounds %struct.IdxHash, ptr %9, i32 0, i32 0
  %166 = load ptr, ptr %165, align 8, !tbaa !23
  store ptr %166, ptr %10, align 8, !tbaa !5
  br label %167

167:                                              ; preds = %180, %164
  %168 = load ptr, ptr %10, align 8, !tbaa !5
  %169 = icmp ne ptr %168, null
  br i1 %169, label %170, label %184

170:                                              ; preds = %167
  %171 = load ptr, ptr %6, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.IdxStatement, ptr %171, i32 0, i32 2
  %173 = load ptr, ptr %172, align 8, !tbaa !24
  %174 = load ptr, ptr %10, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.IdxHashEntry, ptr %174, i32 0, i32 0
  %176 = load ptr, ptr %175, align 8, !tbaa !25
  %177 = call ptr (ptr, ptr, ptr, ...) @idxAppendText(ptr noundef %8, ptr noundef %173, ptr noundef @.str.10, ptr noundef %176)
  %178 = load ptr, ptr %6, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.IdxStatement, ptr %178, i32 0, i32 2
  store ptr %177, ptr %179, align 8, !tbaa !24
  br label %180

180:                                              ; preds = %170
  %181 = load ptr, ptr %10, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.IdxHashEntry, ptr %181, i32 0, i32 4
  %183 = load ptr, ptr %182, align 8, !tbaa !27
  store ptr %183, ptr %10, align 8, !tbaa !5
  br label %167, !llvm.loop !28

184:                                              ; preds = %167
  %185 = load ptr, ptr %11, align 8, !tbaa !5
  call void @idxFinalize(ptr noundef %8, ptr noundef %185)
  store i32 0, ptr %18, align 4
  br label %186

186:                                              ; preds = %184, %161
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %187 = load i32, ptr %18, align 4
  switch i32 %187, label %196 [
    i32 0, label %188
    i32 12, label %194
  ]

188:                                              ; preds = %186
  br label %189

189:                                              ; preds = %188
  %190 = load ptr, ptr %6, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.IdxStatement, ptr %190, i32 0, i32 4
  %192 = load ptr, ptr %191, align 8, !tbaa !29
  store ptr %192, ptr %6, align 8, !tbaa !5
  br label %25, !llvm.loop !30

193:                                              ; preds = %31
  br label %194

194:                                              ; preds = %193, %186
  call void @idxHashClear(ptr noundef %9)
  %195 = load i32, ptr %8, align 4, !tbaa !13
  store i32 %195, ptr %3, align 4
  store i32 1, ptr %18, align 4
  br label %196

196:                                              ; preds = %194, %186
  call void @llvm.lifetime.end.p0(i64 8192, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %197 = load i32, ptr %3, align 4
  ret i32 %197
}

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

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

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

declare i32 @sqlite3_step(ptr noundef) #2

declare ptr @sqlite3_column_text(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #3

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @idxFinalize(ptr noundef, ptr 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 = { "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 = { nounwind willreturn memory(read) "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 }
attributes #5 = { nounwind willreturn memory(read) }

!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 16}
!10 = !{!"sqlite3expert", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !11, i64 64, !6, i64 72, !11, i64 80, !12, i64 88, !6, i64 8280}
!11 = !{!"int", !7, i64 0}
!12 = !{!"IdxHash", !6, i64 0, !7, i64 8}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !6, i64 56}
!15 = !{!16, !6, i64 8}
!16 = !{!"IdxStatement", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}
!21 = !{!16, !6, i64 24}
!22 = distinct !{!22, !19}
!23 = !{!12, !6, i64 0}
!24 = !{!16, !6, i64 16}
!25 = !{!26, !6, i64 0}
!26 = !{!"IdxHashEntry", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!27 = !{!26, !6, i64 32}
!28 = distinct !{!28, !19}
!29 = !{!16, !6, i64 32}
!30 = distinct !{!30, !19}


; 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.IdxHash = type { ptr, [1023 x ptr] }

@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [5 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: nounwind uwtable
define dso_local i32 @idxFindIndexes(ptr noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = alloca i32, align 4
  %4 = alloca %struct.IdxHash, align 8
  %5 = alloca ptr, align 8
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 0, ptr %3, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8192, ptr nonnull %4) #5
  call void @idxHashInit(ptr noundef nonnull %4)
  %8 = getelementptr inbounds i8, ptr %0, i64 56
  %.05284 = load ptr, ptr %8, align 8, !tbaa !13
  %.not95 = icmp eq ptr %.05284, null
  br i1 %.not95, label %.loopexit75, label %.lr.ph87

.lr.ph87:                                         ; preds = %2
  %9 = getelementptr inbounds i8, ptr %0, i64 88
  br label %10

10:                                               ; preds = %.lr.ph87, %._crit_edge
  %.05285 = phi ptr [ %.05284, %.lr.ph87 ], [ %.052, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  store ptr null, ptr %5, align 8, !tbaa !13
  call void @idxHashClear(ptr noundef nonnull %4)
  %11 = getelementptr inbounds i8, ptr %.05285, i64 8
  %12 = load ptr, ptr %11, align 8, !tbaa !14
  %13 = call i32 (ptr, ptr, ptr, ptr, ...) @idxPrintfPrepareStmt(ptr noundef %7, ptr noundef nonnull %5, ptr noundef %1, ptr noundef nonnull @.str.6, ptr noundef %12)
  store i32 %13, ptr %3, align 4, !tbaa !12
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %.lr.ph78, label %.critedge

.lr.ph78:                                         ; preds = %10
  %15 = getelementptr inbounds i8, ptr %.05285, i64 24
  br label %17

thread-pre-split:                                 ; preds = %46, %.loopexit
  %.pr = load i32, ptr %3, align 4, !tbaa !12
  %16 = icmp eq i32 %.pr, 0
  br i1 %16, label %17, label %.critedge

17:                                               ; preds = %.lr.ph78, %thread-pre-split
  %18 = load ptr, ptr %5, align 8, !tbaa !13
  %19 = call i32 @sqlite3_step(ptr noundef %18) #5
  %20 = icmp eq i32 %19, 100
  br i1 %20, label %21, label %.critedge

21:                                               ; preds = %17
  %22 = load ptr, ptr %5, align 8, !tbaa !13
  %23 = call ptr @sqlite3_column_text(ptr noundef %22, i32 noundef 3) #5
  %24 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %23) #6
  %25 = trunc i64 %24 to i32
  %26 = icmp sgt i32 %25, 0
  br i1 %26, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %21
  %wide.trip.count = and i64 %24, 2147483647
  br label %.lr.ph

27:                                               ; preds = %30
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph, !llvm.loop !16

.lr.ph:                                           ; preds = %.lr.ph.preheader, %27
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %27 ]
  %28 = getelementptr inbounds i8, ptr %23, i64 %indvars.iv
  %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(13) %28, ptr noundef nonnull dereferenceable(13) @.str.7, i64 13)
  %29 = icmp eq i32 %bcmp, 0
  br i1 %29, label %32, label %30

30:                                               ; preds = %.lr.ph
  %bcmp56 = call i32 @bcmp(ptr noundef nonnull dereferenceable(22) %28, ptr noundef nonnull dereferenceable(22) @.str.8, i64 22)
  %31 = icmp eq i32 %bcmp56, 0
  br i1 %31, label %32, label %27

32:                                               ; preds = %30, %.lr.ph
  %.sink = phi i64 [ 13, %.lr.ph ], [ 22, %30 ]
  %33 = getelementptr inbounds i8, ptr %28, i64 %.sink
  br label %.critedge4

.critedge4:                                       ; preds = %.critedge4.backedge, %32
  %indvars.iv91 = phi i64 [ 0, %32 ], [ %indvars.iv91.be, %.critedge4.backedge ]
  %34 = getelementptr inbounds i8, ptr %33, i64 %indvars.iv91
  %35 = load i8, ptr %34, align 1, !tbaa !18
  switch i8 %35, label %..critedge4_crit_edge [
    i8 0, label %.critedge2
    i8 32, label %36
  ]

..critedge4_crit_edge:                            ; preds = %.critedge4
  %.pre94 = add nuw nsw i64 %indvars.iv91, 1
  br label %.critedge4.backedge

.critedge4.backedge:                              ; preds = %..critedge4_crit_edge, %36
  %indvars.iv91.be = phi i64 [ %.pre94, %..critedge4_crit_edge ], [ %37, %36 ]
  br label %.critedge4, !llvm.loop !19

36:                                               ; preds = %.critedge4
  %37 = add nuw nsw i64 %indvars.iv91, 1
  %38 = getelementptr inbounds i8, ptr %33, i64 %37
  %39 = load i8, ptr %38, align 1, !tbaa !18
  %.not60 = icmp eq i8 %39, 40
  br i1 %.not60, label %.critedge2, label %.critedge4.backedge

.critedge2:                                       ; preds = %.critedge4, %36
  %40 = trunc nuw nsw i64 %indvars.iv91 to i32
  %41 = call ptr @idxHashSearch(ptr noundef nonnull %9, ptr noundef nonnull %33, i32 noundef %40)
  %.not61 = icmp eq ptr %41, null
  br i1 %.not61, label %.loopexit, label %42

42:                                               ; preds = %.critedge2
  %43 = call i32 @idxHashAdd(ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %41, ptr noundef null)
  %44 = load i32, ptr %3, align 4, !tbaa !12
  %.not62 = icmp eq i32 %44, 0
  br i1 %.not62, label %.loopexit, label %55, !llvm.loop !20

.loopexit:                                        ; preds = %27, %21, %42, %.critedge2
  %45 = load i8, ptr %23, align 1, !tbaa !18
  %.not63 = icmp eq i8 %45, 45
  br i1 %.not63, label %thread-pre-split, label %46

46:                                               ; preds = %.loopexit
  %47 = load ptr, ptr %15, align 8, !tbaa !21
  %48 = call ptr (ptr, ptr, ptr, ...) @idxAppendText(ptr noundef nonnull %3, ptr noundef %47, ptr noundef nonnull @.str.9, ptr noundef nonnull %23)
  store ptr %48, ptr %15, align 8, !tbaa !21
  br label %thread-pre-split

.critedge:                                        ; preds = %17, %thread-pre-split, %10
  %.05380 = load ptr, ptr %4, align 8, !tbaa !13
  %.not81 = icmp eq ptr %.05380, null
  br i1 %.not81, label %._crit_edge, label %.lr.ph83

.lr.ph83:                                         ; preds = %.critedge
  %49 = getelementptr inbounds i8, ptr %.05285, i64 16
  %.pre = load ptr, ptr %49, align 8, !tbaa !22
  br label %50

50:                                               ; preds = %.lr.ph83, %50
  %51 = phi ptr [ %.pre, %.lr.ph83 ], [ %53, %50 ]
  %.05382 = phi ptr [ %.05380, %.lr.ph83 ], [ %.053, %50 ]
  %52 = load ptr, ptr %.05382, align 8, !tbaa !23
  %53 = call ptr (ptr, ptr, ptr, ...) @idxAppendText(ptr noundef nonnull %3, ptr noundef %51, ptr noundef nonnull @.str.10, ptr noundef %52)
  store ptr %53, ptr %49, align 8, !tbaa !22
  %54 = getelementptr inbounds i8, ptr %.05382, i64 32
  %.053 = load ptr, ptr %54, align 8, !tbaa !13
  %.not = icmp eq ptr %.053, null
  br i1 %.not, label %._crit_edge, label %50, !llvm.loop !25

55:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br label %.loopexit75

._crit_edge:                                      ; preds = %50, %.critedge
  %56 = load ptr, ptr %5, align 8, !tbaa !13
  call void @idxFinalize(ptr noundef nonnull %3, ptr noundef %56)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  %57 = getelementptr inbounds i8, ptr %.05285, i64 32
  %.052 = load ptr, ptr %57, align 8, !tbaa !13
  %58 = load i32, ptr %3, align 4, !tbaa !12
  %59 = icmp eq i32 %58, 0
  %60 = icmp ne ptr %.052, null
  %61 = select i1 %59, i1 %60, i1 false
  br i1 %61, label %10, label %.loopexit75, !llvm.loop !26

.loopexit75:                                      ; preds = %._crit_edge, %2, %55
  call void @idxHashClear(ptr noundef nonnull %4)
  %62 = load i32, ptr %3, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8192, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  ret i32 %62
}

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

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

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

declare i32 @sqlite3_step(ptr noundef) local_unnamed_addr #2

declare ptr @sqlite3_column_text(ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3

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

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

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

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

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #4

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { nofree nounwind willreturn memory(argmem: read) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

!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, !10, i64 16}
!6 = !{!"sqlite3expert", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !7, i64 64, !10, i64 72, !7, i64 80, !11, i64 88, !10, i64 8280}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"IdxHash", !10, i64 0, !8, i64 8}
!12 = !{!7, !7, i64 0}
!13 = !{!10, !10, i64 0}
!14 = !{!15, !10, i64 8}
!15 = !{!"IdxStatement", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!8, !8, i64 0}
!19 = distinct !{!19, !17}
!20 = distinct !{!20, !17}
!21 = !{!15, !10, i64 24}
!22 = !{!15, !10, i64 16}
!23 = !{!24, !10, i64 0}
!24 = !{!"IdxHashEntry", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!25 = distinct !{!25, !17}
!26 = distinct !{!26, !17}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass