; 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.sqlite3_backup = type { ptr, ptr, i32, i32, i32, ptr, ptr, i32, i32, i32, i32, 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.Btree = type { ptr, ptr, i8, i8, i8, i8, i32, i32, i32, ptr, ptr, %struct.BtLock }
%struct.BtLock = type { ptr, i32, i8, ptr }
%struct.BtShared = type { ptr, ptr, ptr, ptr, i8, i8, i8, i8, i8, i8, i8, i16, i16, i16, i16, i16, i32, i32, i32, i32, ptr, ptr, ptr, ptr, i32, ptr, ptr, ptr, ptr, i32 }

@sqlite3PendingByte = external hidden global i32, align 4

; 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 hidden ptr @sqlite3BtreePager(ptr noundef) #1

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @sqlite3_backup_step(ptr noundef %0, i32 noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  %26 = alloca i32, align 4
  %27 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #2
  store i32 0, ptr %8, align 4, !tbaa !9
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.sqlite3_backup, ptr %28, i32 0, i32 5
  %30 = load ptr, ptr %29, align 8, !tbaa !11
  %31 = getelementptr inbounds %struct.sqlite3, ptr %30, i32 0, i32 3
  %32 = load ptr, ptr %31, align 8, !tbaa !13
  call void @sqlite3_mutex_enter(ptr noundef %32)
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.sqlite3_backup, ptr %33, i32 0, i32 6
  %35 = load ptr, ptr %34, align 8, !tbaa !21
  call void @sqlite3BtreeEnter(ptr noundef %35)
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.sqlite3_backup, ptr %36, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !22
  %39 = icmp ne ptr %38, null
  br i1 %39, label %40, label %46

40:                                               ; preds = %2
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.sqlite3_backup, ptr %41, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !22
  %44 = getelementptr inbounds %struct.sqlite3, ptr %43, i32 0, i32 3
  %45 = load ptr, ptr %44, align 8, !tbaa !13
  call void @sqlite3_mutex_enter(ptr noundef %45)
  br label %46

46:                                               ; preds = %40, %2
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.sqlite3_backup, ptr %47, i32 0, i32 7
  %49 = load i32, ptr %48, align 8, !tbaa !23
  store i32 %49, ptr %5, align 4, !tbaa !9
  %50 = load i32, ptr %5, align 4, !tbaa !9
  %51 = call i32 @isFatalError(i32 noundef %50)
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %494, label %53

53:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.sqlite3_backup, ptr %54, i32 0, i32 6
  %56 = load ptr, ptr %55, align 8, !tbaa !21
  %57 = call ptr @sqlite3BtreePager(ptr noundef %56)
  store ptr %57, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.sqlite3_backup, ptr %58, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8, !tbaa !24
  %61 = call ptr @sqlite3BtreePager(ptr noundef %60)
  store ptr %61, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #2
  store i32 -1, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #2
  store i32 0, ptr %13, align 4, !tbaa !9
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.sqlite3_backup, ptr %62, i32 0, i32 0
  %64 = load ptr, ptr %63, align 8, !tbaa !22
  %65 = icmp ne ptr %64, null
  br i1 %65, label %66, label %77

66:                                               ; preds = %53
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.sqlite3_backup, ptr %67, i32 0, i32 6
  %69 = load ptr, ptr %68, align 8, !tbaa !21
  %70 = getelementptr inbounds %struct.Btree, ptr %69, i32 0, i32 1
  %71 = load ptr, ptr %70, align 8, !tbaa !25
  %72 = getelementptr inbounds %struct.BtShared, ptr %71, i32 0, i32 8
  %73 = load i8, ptr %72, align 4, !tbaa !28
  %74 = zext i8 %73 to i32
  %75 = icmp eq i32 %74, 2
  br i1 %75, label %76, label %77

76:                                               ; preds = %66
  store i32 5, ptr %5, align 4, !tbaa !9
  br label %78

77:                                               ; preds = %66, %53
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %78

78:                                               ; preds = %77, %76
  %79 = load i32, ptr %5, align 4, !tbaa !9
  %80 = icmp eq i32 %79, 0
  br i1 %80, label %81, label %92

81:                                               ; preds = %78
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.sqlite3_backup, ptr %82, i32 0, i32 6
  %84 = load ptr, ptr %83, align 8, !tbaa !21
  %85 = call i32 @sqlite3BtreeTxnState(ptr noundef %84)
  %86 = icmp eq i32 0, %85
  br i1 %86, label %87, label %92

87:                                               ; preds = %81
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.sqlite3_backup, ptr %88, i32 0, i32 6
  %90 = load ptr, ptr %89, align 8, !tbaa !21
  %91 = call i32 @sqlite3BtreeBeginTrans(ptr noundef %90, i32 noundef 0, ptr noundef null)
  store i32 %91, ptr %5, align 4, !tbaa !9
  store i32 1, ptr %13, align 4, !tbaa !9
  br label %92

92:                                               ; preds = %87, %81, %78
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.sqlite3_backup, ptr %93, i32 0, i32 3
  %95 = load i32, ptr %94, align 4, !tbaa !30
  %96 = icmp eq i32 %95, 0
  br i1 %96, label %97, label %105

97:                                               ; preds = %92
  %98 = load i32, ptr %5, align 4, !tbaa !9
  %99 = icmp eq i32 %98, 0
  br i1 %99, label %100, label %105

100:                                              ; preds = %97
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = call i32 @setDestPgsz(ptr noundef %101)
  %103 = icmp eq i32 %102, 7
  br i1 %103, label %104, label %105

104:                                              ; preds = %100
  store i32 7, ptr %5, align 4, !tbaa !9
  br label %105

105:                                              ; preds = %104, %100, %97, %92
  %106 = load i32, ptr %5, align 4, !tbaa !9
  %107 = icmp eq i32 0, %106
  br i1 %107, label %108, label %124

108:                                              ; preds = %105
  %109 = load ptr, ptr %3, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.sqlite3_backup, ptr %109, i32 0, i32 3
  %111 = load i32, ptr %110, align 4, !tbaa !30
  %112 = icmp eq i32 %111, 0
  br i1 %112, label %113, label %124

113:                                              ; preds = %108
  %114 = load ptr, ptr %3, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.sqlite3_backup, ptr %114, i32 0, i32 1
  %116 = load ptr, ptr %115, align 8, !tbaa !24
  %117 = load ptr, ptr %3, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.sqlite3_backup, ptr %117, i32 0, i32 2
  %119 = call i32 @sqlite3BtreeBeginTrans(ptr noundef %116, i32 noundef 2, ptr noundef %118)
  store i32 %119, ptr %5, align 4, !tbaa !9
  %120 = icmp eq i32 0, %119
  br i1 %120, label %121, label %124

121:                                              ; preds = %113
  %122 = load ptr, ptr %3, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.sqlite3_backup, ptr %122, i32 0, i32 3
  store i32 1, ptr %123, align 4, !tbaa !30
  br label %124

124:                                              ; preds = %121, %113, %108, %105
  %125 = load ptr, ptr %3, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.sqlite3_backup, ptr %125, i32 0, i32 6
  %127 = load ptr, ptr %126, align 8, !tbaa !21
  %128 = call i32 @sqlite3BtreeGetPageSize(ptr noundef %127)
  store i32 %128, ptr %7, align 4, !tbaa !9
  %129 = load ptr, ptr %3, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.sqlite3_backup, ptr %129, i32 0, i32 1
  %131 = load ptr, ptr %130, align 8, !tbaa !24
  %132 = call i32 @sqlite3BtreeGetPageSize(ptr noundef %131)
  store i32 %132, ptr %8, align 4, !tbaa !9
  %133 = load ptr, ptr %3, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.sqlite3_backup, ptr %133, i32 0, i32 1
  %135 = load ptr, ptr %134, align 8, !tbaa !24
  %136 = call ptr @sqlite3BtreePager(ptr noundef %135)
  %137 = call i32 @sqlite3PagerGetJournalMode(ptr noundef %136)
  store i32 %137, ptr %6, align 4, !tbaa !9
  %138 = load i32, ptr %5, align 4, !tbaa !9
  %139 = icmp eq i32 0, %138
  br i1 %139, label %140, label %152

140:                                              ; preds = %124
  %141 = load i32, ptr %6, align 4, !tbaa !9
  %142 = icmp eq i32 %141, 5
  br i1 %142, label %147, label %143

143:                                              ; preds = %140
  %144 = load ptr, ptr %10, align 8, !tbaa !5
  %145 = call i32 @sqlite3PagerIsMemdb(ptr noundef %144)
  %146 = icmp ne i32 %145, 0
  br i1 %146, label %147, label %152

147:                                              ; preds = %143, %140
  %148 = load i32, ptr %7, align 4, !tbaa !9
  %149 = load i32, ptr %8, align 4, !tbaa !9
  %150 = icmp ne i32 %148, %149
  br i1 %150, label %151, label %152

151:                                              ; preds = %147
  store i32 8, ptr %5, align 4, !tbaa !9
  br label %152

152:                                              ; preds = %151, %147, %143, %124
  %153 = load ptr, ptr %3, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.sqlite3_backup, ptr %153, i32 0, i32 6
  %155 = load ptr, ptr %154, align 8, !tbaa !21
  %156 = call i32 @sqlite3BtreeLastPage(ptr noundef %155)
  store i32 %156, ptr %12, align 4, !tbaa !9
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %157

157:                                              ; preds = %211, %152
  %158 = load i32, ptr %4, align 4, !tbaa !9
  %159 = icmp slt i32 %158, 0
  br i1 %159, label %164, label %160

160:                                              ; preds = %157
  %161 = load i32, ptr %11, align 4, !tbaa !9
  %162 = load i32, ptr %4, align 4, !tbaa !9
  %163 = icmp slt i32 %161, %162
  br i1 %163, label %164, label %174

164:                                              ; preds = %160, %157
  %165 = load ptr, ptr %3, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.sqlite3_backup, ptr %165, i32 0, i32 4
  %167 = load i32, ptr %166, align 8, !tbaa !31
  %168 = load i32, ptr %12, align 4, !tbaa !9
  %169 = icmp ule i32 %167, %168
  br i1 %169, label %170, label %174

170:                                              ; preds = %164
  %171 = load i32, ptr %5, align 4, !tbaa !9
  %172 = icmp ne i32 %171, 0
  %173 = xor i1 %172, true
  br label %174

174:                                              ; preds = %170, %164, %160
  %175 = phi i1 [ false, %164 ], [ false, %160 ], [ %173, %170 ]
  br i1 %175, label %176, label %214

176:                                              ; preds = %174
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #2
  %177 = load ptr, ptr %3, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.sqlite3_backup, ptr %177, i32 0, i32 4
  %179 = load i32, ptr %178, align 8, !tbaa !31
  store i32 %179, ptr %14, align 4, !tbaa !9
  %180 = load i32, ptr %14, align 4, !tbaa !9
  %181 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !9
  %182 = load ptr, ptr %3, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.sqlite3_backup, ptr %182, i32 0, i32 6
  %184 = load ptr, ptr %183, align 8, !tbaa !21
  %185 = getelementptr inbounds %struct.Btree, ptr %184, i32 0, i32 1
  %186 = load ptr, ptr %185, align 8, !tbaa !25
  %187 = getelementptr inbounds %struct.BtShared, ptr %186, i32 0, i32 16
  %188 = load i32, ptr %187, align 4, !tbaa !32
  %189 = udiv i32 %181, %188
  %190 = add i32 %189, 1
  %191 = icmp ne i32 %180, %190
  br i1 %191, label %192, label %206

192:                                              ; preds = %176
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #2
  %193 = load ptr, ptr %9, align 8, !tbaa !5
  %194 = load i32, ptr %14, align 4, !tbaa !9
  %195 = call i32 @sqlite3PagerGet(ptr noundef %193, i32 noundef %194, ptr noundef %15, i32 noundef 2)
  store i32 %195, ptr %5, align 4, !tbaa !9
  %196 = load i32, ptr %5, align 4, !tbaa !9
  %197 = icmp eq i32 %196, 0
  br i1 %197, label %198, label %205

198:                                              ; preds = %192
  %199 = load ptr, ptr %3, align 8, !tbaa !5
  %200 = load i32, ptr %14, align 4, !tbaa !9
  %201 = load ptr, ptr %15, align 8, !tbaa !5
  %202 = call ptr @sqlite3PagerGetData(ptr noundef %201)
  %203 = call i32 @backupOnePage(ptr noundef %199, i32 noundef %200, ptr noundef %202, i32 noundef 0)
  store i32 %203, ptr %5, align 4, !tbaa !9
  %204 = load ptr, ptr %15, align 8, !tbaa !5
  call void @sqlite3PagerUnref(ptr noundef %204)
  br label %205

205:                                              ; preds = %198, %192
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #2
  br label %206

206:                                              ; preds = %205, %176
  %207 = load ptr, ptr %3, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.sqlite3_backup, ptr %207, i32 0, i32 4
  %209 = load i32, ptr %208, align 8, !tbaa !31
  %210 = add i32 %209, 1
  store i32 %210, ptr %208, align 8, !tbaa !31
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #2
  br label %211

211:                                              ; preds = %206
  %212 = load i32, ptr %11, align 4, !tbaa !9
  %213 = add nsw i32 %212, 1
  store i32 %213, ptr %11, align 4, !tbaa !9
  br label %157, !llvm.loop !33

214:                                              ; preds = %174
  %215 = load i32, ptr %5, align 4, !tbaa !9
  %216 = icmp eq i32 %215, 0
  br i1 %216, label %217, label %244

217:                                              ; preds = %214
  %218 = load i32, ptr %12, align 4, !tbaa !9
  %219 = load ptr, ptr %3, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.sqlite3_backup, ptr %219, i32 0, i32 9
  store i32 %218, ptr %220, align 8, !tbaa !35
  %221 = load i32, ptr %12, align 4, !tbaa !9
  %222 = add nsw i32 %221, 1
  %223 = load ptr, ptr %3, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct.sqlite3_backup, ptr %223, i32 0, i32 4
  %225 = load i32, ptr %224, align 8, !tbaa !31
  %226 = sub i32 %222, %225
  %227 = load ptr, ptr %3, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.sqlite3_backup, ptr %227, i32 0, i32 8
  store i32 %226, ptr %228, align 4, !tbaa !36
  %229 = load ptr, ptr %3, align 8, !tbaa !5
  %230 = getelementptr inbounds %struct.sqlite3_backup, ptr %229, i32 0, i32 4
  %231 = load i32, ptr %230, align 8, !tbaa !31
  %232 = load i32, ptr %12, align 4, !tbaa !9
  %233 = icmp ugt i32 %231, %232
  br i1 %233, label %234, label %235

234:                                              ; preds = %217
  store i32 101, ptr %5, align 4, !tbaa !9
  br label %243

235:                                              ; preds = %217
  %236 = load ptr, ptr %3, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct.sqlite3_backup, ptr %236, i32 0, i32 10
  %238 = load i32, ptr %237, align 4, !tbaa !37
  %239 = icmp ne i32 %238, 0
  br i1 %239, label %242, label %240

240:                                              ; preds = %235
  %241 = load ptr, ptr %3, align 8, !tbaa !5
  call void @attachBackupObject(ptr noundef %241)
  br label %242

242:                                              ; preds = %240, %235
  br label %243

243:                                              ; preds = %242, %234
  br label %244

244:                                              ; preds = %243, %214
  %245 = load i32, ptr %5, align 4, !tbaa !9
  %246 = icmp eq i32 %245, 101
  br i1 %246, label %247, label %474

247:                                              ; preds = %244
  %248 = load i32, ptr %12, align 4, !tbaa !9
  %249 = icmp eq i32 %248, 0
  br i1 %249, label %250, label %255

250:                                              ; preds = %247
  %251 = load ptr, ptr %3, align 8, !tbaa !5
  %252 = getelementptr inbounds %struct.sqlite3_backup, ptr %251, i32 0, i32 1
  %253 = load ptr, ptr %252, align 8, !tbaa !24
  %254 = call i32 @sqlite3BtreeNewDb(ptr noundef %253)
  store i32 %254, ptr %5, align 4, !tbaa !9
  store i32 1, ptr %12, align 4, !tbaa !9
  br label %255

255:                                              ; preds = %250, %247
  %256 = load i32, ptr %5, align 4, !tbaa !9
  %257 = icmp eq i32 %256, 0
  br i1 %257, label %261, label %258

258:                                              ; preds = %255
  %259 = load i32, ptr %5, align 4, !tbaa !9
  %260 = icmp eq i32 %259, 101
  br i1 %260, label %261, label %270

261:                                              ; preds = %258, %255
  %262 = load ptr, ptr %3, align 8, !tbaa !5
  %263 = getelementptr inbounds %struct.sqlite3_backup, ptr %262, i32 0, i32 1
  %264 = load ptr, ptr %263, align 8, !tbaa !24
  %265 = load ptr, ptr %3, align 8, !tbaa !5
  %266 = getelementptr inbounds %struct.sqlite3_backup, ptr %265, i32 0, i32 2
  %267 = load i32, ptr %266, align 8, !tbaa !38
  %268 = add i32 %267, 1
  %269 = call i32 @sqlite3BtreeUpdateMeta(ptr noundef %264, i32 noundef 1, i32 noundef %268)
  store i32 %269, ptr %5, align 4, !tbaa !9
  br label %270

270:                                              ; preds = %261, %258
  %271 = load i32, ptr %5, align 4, !tbaa !9
  %272 = icmp eq i32 %271, 0
  br i1 %272, label %273, label %291

273:                                              ; preds = %270
  %274 = load ptr, ptr %3, align 8, !tbaa !5
  %275 = getelementptr inbounds %struct.sqlite3_backup, ptr %274, i32 0, i32 0
  %276 = load ptr, ptr %275, align 8, !tbaa !22
  %277 = icmp ne ptr %276, null
  br i1 %277, label %278, label %282

278:                                              ; preds = %273
  %279 = load ptr, ptr %3, align 8, !tbaa !5
  %280 = getelementptr inbounds %struct.sqlite3_backup, ptr %279, i32 0, i32 0
  %281 = load ptr, ptr %280, align 8, !tbaa !22
  call void @sqlite3ResetAllSchemasOfConnection(ptr noundef %281)
  br label %282

282:                                              ; preds = %278, %273
  %283 = load i32, ptr %6, align 4, !tbaa !9
  %284 = icmp eq i32 %283, 5
  br i1 %284, label %285, label %290

285:                                              ; preds = %282
  %286 = load ptr, ptr %3, align 8, !tbaa !5
  %287 = getelementptr inbounds %struct.sqlite3_backup, ptr %286, i32 0, i32 1
  %288 = load ptr, ptr %287, align 8, !tbaa !24
  %289 = call i32 @sqlite3BtreeSetVersion(ptr noundef %288, i32 noundef 2)
  store i32 %289, ptr %5, align 4, !tbaa !9
  br label %290

290:                                              ; preds = %285, %282
  br label %291

291:                                              ; preds = %290, %270
  %292 = load i32, ptr %5, align 4, !tbaa !9
  %293 = icmp eq i32 %292, 0
  br i1 %293, label %294, label %473

294:                                              ; preds = %291
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #2
  %295 = load i32, ptr %7, align 4, !tbaa !9
  %296 = load i32, ptr %8, align 4, !tbaa !9
  %297 = icmp slt i32 %295, %296
  br i1 %297, label %298, label %324

298:                                              ; preds = %294
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #2
  %299 = load i32, ptr %8, align 4, !tbaa !9
  %300 = load i32, ptr %7, align 4, !tbaa !9
  %301 = sdiv i32 %299, %300
  store i32 %301, ptr %17, align 4, !tbaa !9
  %302 = load i32, ptr %12, align 4, !tbaa !9
  %303 = load i32, ptr %17, align 4, !tbaa !9
  %304 = add nsw i32 %302, %303
  %305 = sub nsw i32 %304, 1
  %306 = load i32, ptr %17, align 4, !tbaa !9
  %307 = sdiv i32 %305, %306
  store i32 %307, ptr %16, align 4, !tbaa !9
  %308 = load i32, ptr %16, align 4, !tbaa !9
  %309 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !9
  %310 = load ptr, ptr %3, align 8, !tbaa !5
  %311 = getelementptr inbounds %struct.sqlite3_backup, ptr %310, i32 0, i32 1
  %312 = load ptr, ptr %311, align 8, !tbaa !24
  %313 = getelementptr inbounds %struct.Btree, ptr %312, i32 0, i32 1
  %314 = load ptr, ptr %313, align 8, !tbaa !25
  %315 = getelementptr inbounds %struct.BtShared, ptr %314, i32 0, i32 16
  %316 = load i32, ptr %315, align 4, !tbaa !32
  %317 = udiv i32 %309, %316
  %318 = add i32 %317, 1
  %319 = icmp eq i32 %308, %318
  br i1 %319, label %320, label %323

320:                                              ; preds = %298
  %321 = load i32, ptr %16, align 4, !tbaa !9
  %322 = add nsw i32 %321, -1
  store i32 %322, ptr %16, align 4, !tbaa !9
  br label %323

323:                                              ; preds = %320, %298
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #2
  br label %330

324:                                              ; preds = %294
  %325 = load i32, ptr %12, align 4, !tbaa !9
  %326 = load i32, ptr %7, align 4, !tbaa !9
  %327 = load i32, ptr %8, align 4, !tbaa !9
  %328 = sdiv i32 %326, %327
  %329 = mul nsw i32 %325, %328
  store i32 %329, ptr %16, align 4, !tbaa !9
  br label %330

330:                                              ; preds = %324, %323
  %331 = load i32, ptr %7, align 4, !tbaa !9
  %332 = load i32, ptr %8, align 4, !tbaa !9
  %333 = icmp slt i32 %331, %332
  br i1 %333, label %334, label %457

334:                                              ; preds = %330
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #2
  %335 = load i32, ptr %7, align 4, !tbaa !9
  %336 = sext i32 %335 to i64
  %337 = load i32, ptr %12, align 4, !tbaa !9
  %338 = sext i32 %337 to i64
  %339 = mul nsw i64 %336, %338
  store i64 %339, ptr %18, align 8, !tbaa !39
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #2
  %340 = load ptr, ptr %10, align 8, !tbaa !5
  %341 = call ptr @sqlite3PagerFile(ptr noundef %340)
  store ptr %341, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #2
  %342 = load ptr, ptr %10, align 8, !tbaa !5
  call void @sqlite3PagerPagecount(ptr noundef %342, ptr noundef %21)
  %343 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %343, ptr %20, align 4, !tbaa !9
  br label %344

344:                                              ; preds = %378, %334
  %345 = load i32, ptr %5, align 4, !tbaa !9
  %346 = icmp eq i32 %345, 0
  br i1 %346, label %347, label %351

347:                                              ; preds = %344
  %348 = load i32, ptr %20, align 4, !tbaa !9
  %349 = load i32, ptr %21, align 4, !tbaa !9
  %350 = icmp ule i32 %348, %349
  br label %351

351:                                              ; preds = %347, %344
  %352 = phi i1 [ false, %344 ], [ %350, %347 ]
  br i1 %352, label %353, label %381

353:                                              ; preds = %351
  %354 = load i32, ptr %20, align 4, !tbaa !9
  %355 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !9
  %356 = load ptr, ptr %3, align 8, !tbaa !5
  %357 = getelementptr inbounds %struct.sqlite3_backup, ptr %356, i32 0, i32 1
  %358 = load ptr, ptr %357, align 8, !tbaa !24
  %359 = getelementptr inbounds %struct.Btree, ptr %358, i32 0, i32 1
  %360 = load ptr, ptr %359, align 8, !tbaa !25
  %361 = getelementptr inbounds %struct.BtShared, ptr %360, i32 0, i32 16
  %362 = load i32, ptr %361, align 4, !tbaa !32
  %363 = udiv i32 %355, %362
  %364 = add i32 %363, 1
  %365 = icmp ne i32 %354, %364
  br i1 %365, label %366, label %377

366:                                              ; preds = %353
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #2
  %367 = load ptr, ptr %10, align 8, !tbaa !5
  %368 = load i32, ptr %20, align 4, !tbaa !9
  %369 = call i32 @sqlite3PagerGet(ptr noundef %367, i32 noundef %368, ptr noundef %24, i32 noundef 0)
  store i32 %369, ptr %5, align 4, !tbaa !9
  %370 = load i32, ptr %5, align 4, !tbaa !9
  %371 = icmp eq i32 %370, 0
  br i1 %371, label %372, label %376

372:                                              ; preds = %366
  %373 = load ptr, ptr %24, align 8, !tbaa !5
  %374 = call i32 @sqlite3PagerWrite(ptr noundef %373)
  store i32 %374, ptr %5, align 4, !tbaa !9
  %375 = load ptr, ptr %24, align 8, !tbaa !5
  call void @sqlite3PagerUnref(ptr noundef %375)
  br label %376

376:                                              ; preds = %372, %366
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #2
  br label %377

377:                                              ; preds = %376, %353
  br label %378

378:                                              ; preds = %377
  %379 = load i32, ptr %20, align 4, !tbaa !9
  %380 = add i32 %379, 1
  store i32 %380, ptr %20, align 4, !tbaa !9
  br label %344, !llvm.loop !40

381:                                              ; preds = %351
  %382 = load i32, ptr %5, align 4, !tbaa !9
  %383 = icmp eq i32 %382, 0
  br i1 %383, label %384, label %387

384:                                              ; preds = %381
  %385 = load ptr, ptr %10, align 8, !tbaa !5
  %386 = call i32 @sqlite3PagerCommitPhaseOne(ptr noundef %385, ptr noundef null, i32 noundef 1)
  store i32 %386, ptr %5, align 4, !tbaa !9
  br label %387

387:                                              ; preds = %384, %381
  %388 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !9
  %389 = load i32, ptr %8, align 4, !tbaa !9
  %390 = add nsw i32 %388, %389
  %391 = sext i32 %390 to i64
  %392 = load i64, ptr %18, align 8, !tbaa !39
  %393 = icmp slt i64 %391, %392
  br i1 %393, label %394, label %399

394:                                              ; preds = %387
  %395 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !9
  %396 = load i32, ptr %8, align 4, !tbaa !9
  %397 = add nsw i32 %395, %396
  %398 = sext i32 %397 to i64
  br label %401

399:                                              ; preds = %387
  %400 = load i64, ptr %18, align 8, !tbaa !39
  br label %401

401:                                              ; preds = %399, %394
  %402 = phi i64 [ %398, %394 ], [ %400, %399 ]
  store i64 %402, ptr %23, align 8, !tbaa !39
  %403 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !9
  %404 = load i32, ptr %7, align 4, !tbaa !9
  %405 = add nsw i32 %403, %404
  %406 = sext i32 %405 to i64
  store i64 %406, ptr %22, align 8, !tbaa !39
  br label %407

407:                                              ; preds = %438, %401
  %408 = load i32, ptr %5, align 4, !tbaa !9
  %409 = icmp eq i32 %408, 0
  br i1 %409, label %410, label %414

410:                                              ; preds = %407
  %411 = load i64, ptr %22, align 8, !tbaa !39
  %412 = load i64, ptr %23, align 8, !tbaa !39
  %413 = icmp slt i64 %411, %412
  br label %414

414:                                              ; preds = %410, %407
  %415 = phi i1 [ false, %407 ], [ %413, %410 ]
  br i1 %415, label %416, label %443

416:                                              ; preds = %414
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #2
  store ptr null, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #2
  %417 = load i64, ptr %22, align 8, !tbaa !39
  %418 = load i32, ptr %7, align 4, !tbaa !9
  %419 = sext i32 %418 to i64
  %420 = sdiv i64 %417, %419
  %421 = add nsw i64 %420, 1
  %422 = trunc i64 %421 to i32
  store i32 %422, ptr %26, align 4, !tbaa !9
  %423 = load ptr, ptr %9, align 8, !tbaa !5
  %424 = load i32, ptr %26, align 4, !tbaa !9
  %425 = call i32 @sqlite3PagerGet(ptr noundef %423, i32 noundef %424, ptr noundef %25, i32 noundef 0)
  store i32 %425, ptr %5, align 4, !tbaa !9
  %426 = load i32, ptr %5, align 4, !tbaa !9
  %427 = icmp eq i32 %426, 0
  br i1 %427, label %428, label %436

428:                                              ; preds = %416
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #2
  %429 = load ptr, ptr %25, align 8, !tbaa !5
  %430 = call ptr @sqlite3PagerGetData(ptr noundef %429)
  store ptr %430, ptr %27, align 8, !tbaa !5
  %431 = load ptr, ptr %19, align 8, !tbaa !5
  %432 = load ptr, ptr %27, align 8, !tbaa !5
  %433 = load i32, ptr %7, align 4, !tbaa !9
  %434 = load i64, ptr %22, align 8, !tbaa !39
  %435 = call i32 @sqlite3OsWrite(ptr noundef %431, ptr noundef %432, i32 noundef %433, i64 noundef %434)
  store i32 %435, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #2
  br label %436

436:                                              ; preds = %428, %416
  %437 = load ptr, ptr %25, align 8, !tbaa !5
  call void @sqlite3PagerUnref(ptr noundef %437)
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #2
  br label %438

438:                                              ; preds = %436
  %439 = load i32, ptr %7, align 4, !tbaa !9
  %440 = sext i32 %439 to i64
  %441 = load i64, ptr %22, align 8, !tbaa !39
  %442 = add nsw i64 %441, %440
  store i64 %442, ptr %22, align 8, !tbaa !39
  br label %407, !llvm.loop !41

443:                                              ; preds = %414
  %444 = load i32, ptr %5, align 4, !tbaa !9
  %445 = icmp eq i32 %444, 0
  br i1 %445, label %446, label %450

446:                                              ; preds = %443
  %447 = load ptr, ptr %19, align 8, !tbaa !5
  %448 = load i64, ptr %18, align 8, !tbaa !39
  %449 = call i32 @backupTruncateFile(ptr noundef %447, i64 noundef %448)
  store i32 %449, ptr %5, align 4, !tbaa !9
  br label %450

450:                                              ; preds = %446, %443
  %451 = load i32, ptr %5, align 4, !tbaa !9
  %452 = icmp eq i32 %451, 0
  br i1 %452, label %453, label %456

453:                                              ; preds = %450
  %454 = load ptr, ptr %10, align 8, !tbaa !5
  %455 = call i32 @sqlite3PagerSync(ptr noundef %454, ptr noundef null)
  store i32 %455, ptr %5, align 4, !tbaa !9
  br label %456

456:                                              ; preds = %453, %450
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #2
  br label %462

457:                                              ; preds = %330
  %458 = load ptr, ptr %10, align 8, !tbaa !5
  %459 = load i32, ptr %16, align 4, !tbaa !9
  call void @sqlite3PagerTruncateImage(ptr noundef %458, i32 noundef %459)
  %460 = load ptr, ptr %10, align 8, !tbaa !5
  %461 = call i32 @sqlite3PagerCommitPhaseOne(ptr noundef %460, ptr noundef null, i32 noundef 0)
  store i32 %461, ptr %5, align 4, !tbaa !9
  br label %462

462:                                              ; preds = %457, %456
  %463 = load i32, ptr %5, align 4, !tbaa !9
  %464 = icmp eq i32 0, %463
  br i1 %464, label %465, label %472

465:                                              ; preds = %462
  %466 = load ptr, ptr %3, align 8, !tbaa !5
  %467 = getelementptr inbounds %struct.sqlite3_backup, ptr %466, i32 0, i32 1
  %468 = load ptr, ptr %467, align 8, !tbaa !24
  %469 = call i32 @sqlite3BtreeCommitPhaseTwo(ptr noundef %468, i32 noundef 0)
  store i32 %469, ptr %5, align 4, !tbaa !9
  %470 = icmp eq i32 0, %469
  br i1 %470, label %471, label %472

471:                                              ; preds = %465
  store i32 101, ptr %5, align 4, !tbaa !9
  br label %472

472:                                              ; preds = %471, %465, %462
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #2
  br label %473

473:                                              ; preds = %472, %291
  br label %474

474:                                              ; preds = %473, %244
  %475 = load i32, ptr %13, align 4, !tbaa !9
  %476 = icmp ne i32 %475, 0
  br i1 %476, label %477, label %486

477:                                              ; preds = %474
  %478 = load ptr, ptr %3, align 8, !tbaa !5
  %479 = getelementptr inbounds %struct.sqlite3_backup, ptr %478, i32 0, i32 6
  %480 = load ptr, ptr %479, align 8, !tbaa !21
  %481 = call i32 @sqlite3BtreeCommitPhaseOne(ptr noundef %480, ptr noundef null)
  %482 = load ptr, ptr %3, align 8, !tbaa !5
  %483 = getelementptr inbounds %struct.sqlite3_backup, ptr %482, i32 0, i32 6
  %484 = load ptr, ptr %483, align 8, !tbaa !21
  %485 = call i32 @sqlite3BtreeCommitPhaseTwo(ptr noundef %484, i32 noundef 0)
  br label %486

486:                                              ; preds = %477, %474
  %487 = load i32, ptr %5, align 4, !tbaa !9
  %488 = icmp eq i32 %487, 3082
  br i1 %488, label %489, label %490

489:                                              ; preds = %486
  store i32 7, ptr %5, align 4, !tbaa !9
  br label %490

490:                                              ; preds = %489, %486
  %491 = load i32, ptr %5, align 4, !tbaa !9
  %492 = load ptr, ptr %3, align 8, !tbaa !5
  %493 = getelementptr inbounds %struct.sqlite3_backup, ptr %492, i32 0, i32 7
  store i32 %491, ptr %493, align 8, !tbaa !23
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  br label %494

494:                                              ; preds = %490, %46
  %495 = load ptr, ptr %3, align 8, !tbaa !5
  %496 = getelementptr inbounds %struct.sqlite3_backup, ptr %495, i32 0, i32 0
  %497 = load ptr, ptr %496, align 8, !tbaa !22
  %498 = icmp ne ptr %497, null
  br i1 %498, label %499, label %505

499:                                              ; preds = %494
  %500 = load ptr, ptr %3, align 8, !tbaa !5
  %501 = getelementptr inbounds %struct.sqlite3_backup, ptr %500, i32 0, i32 0
  %502 = load ptr, ptr %501, align 8, !tbaa !22
  %503 = getelementptr inbounds %struct.sqlite3, ptr %502, i32 0, i32 3
  %504 = load ptr, ptr %503, align 8, !tbaa !13
  call void @sqlite3_mutex_leave(ptr noundef %504)
  br label %505

505:                                              ; preds = %499, %494
  %506 = load ptr, ptr %3, align 8, !tbaa !5
  %507 = getelementptr inbounds %struct.sqlite3_backup, ptr %506, i32 0, i32 6
  %508 = load ptr, ptr %507, align 8, !tbaa !21
  call void @sqlite3BtreeLeave(ptr noundef %508)
  %509 = load ptr, ptr %3, align 8, !tbaa !5
  %510 = getelementptr inbounds %struct.sqlite3_backup, ptr %509, i32 0, i32 5
  %511 = load ptr, ptr %510, align 8, !tbaa !11
  %512 = getelementptr inbounds %struct.sqlite3, ptr %511, i32 0, i32 3
  %513 = load ptr, ptr %512, align 8, !tbaa !13
  call void @sqlite3_mutex_leave(ptr noundef %513)
  %514 = load i32, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  ret i32 %514
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @sqlite3BtreeLeave(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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 32}
!12 = !{!"sqlite3_backup", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !6, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !6, i64 64}
!13 = !{!14, !6, i64 24}
!14 = !{!"sqlite3", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !10, i64 40, !10, i64 44, !15, i64 48, !15, i64 56, !15, i64 64, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !10, 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, !10, i64 116, !15, i64 120, !15, i64 128, !7, i64 136, !10, i64 184, !16, i64 192, !10, i64 208, !10, i64 212, !10, i64 216, !10, i64 220, !10, i64 224, !10, 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, !17, i64 408, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !10, i64 536, !10, i64 540, !19, i64 544, !6, i64 568, !6, i64 576, !6, i64 584, !19, i64 592, !19, i64 616, !20, i64 640, !7, i64 664, !6, i64 728, !10, i64 736, !10, i64 740, !10, i64 744, !10, i64 748, !15, i64 752, !15, i64 760, !6, i64 768, !6, i64 776}
!15 = !{!"long long", !7, i64 0}
!16 = !{!"sqlite3InitInfo", !10, i64 0, !7, i64 4, !7, i64 5, !10, i64 6, !10, i64 6, !10, i64 6, !6, i64 8}
!17 = !{!"Lookaside", !10, i64 0, !18, i64 4, !18, i64 6, !7, i64 8, !10, 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}
!18 = !{!"short", !7, i64 0}
!19 = !{!"Hash", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16}
!20 = !{!"BusyHandler", !6, i64 0, !6, i64 8, !10, i64 16}
!21 = !{!12, !6, i64 40}
!22 = !{!12, !6, i64 0}
!23 = !{!12, !10, i64 48}
!24 = !{!12, !6, i64 8}
!25 = !{!26, !6, i64 8}
!26 = !{!"Btree", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19, !10, i64 20, !10, i64 24, !10, i64 28, !6, i64 32, !6, i64 40, !27, i64 48}
!27 = !{!"BtLock", !6, i64 0, !10, i64 8, !7, i64 12, !6, i64 16}
!28 = !{!29, !7, i64 36}
!29 = !{!"BtShared", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !7, i64 32, !7, i64 33, !7, i64 34, !7, i64 35, !7, i64 36, !7, i64 37, !7, i64 38, !18, i64 40, !18, i64 42, !18, i64 44, !18, i64 46, !18, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !10, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !10, i64 144}
!30 = !{!12, !10, i64 20}
!31 = !{!12, !10, i64 24}
!32 = !{!29, !10, i64 52}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = !{!12, !10, i64 56}
!36 = !{!12, !10, i64 52}
!37 = !{!12, !10, i64 60}
!38 = !{!12, !10, i64 16}
!39 = !{!15, !15, i64 0}
!40 = distinct !{!40, !34}
!41 = distinct !{!41, !34}


; 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"

@sqlite3PendingByte = external hidden local_unnamed_addr global i32, align 4

; 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 hidden ptr @sqlite3BtreePager(ptr noundef) local_unnamed_addr #1

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @sqlite3_backup_step(ptr noundef %0, i32 noundef %1) local_unnamed_addr #1 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = getelementptr inbounds i8, ptr %0, i64 32
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %8, i64 24
  %10 = load ptr, ptr %9, align 8, !tbaa !11
  tail call void @sqlite3_mutex_enter(ptr noundef %10)
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = load ptr, ptr %11, align 8, !tbaa !19
  tail call void @sqlite3BtreeEnter(ptr noundef %12)
  %13 = load ptr, ptr %0, align 8, !tbaa !20
  %.not = icmp eq ptr %13, null
  br i1 %.not, label %17, label %14

14:                                               ; preds = %2
  %15 = getelementptr inbounds i8, ptr %13, i64 24
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  tail call void @sqlite3_mutex_enter(ptr noundef %16)
  br label %17

17:                                               ; preds = %14, %2
  %18 = getelementptr inbounds i8, ptr %0, i64 48
  %19 = load i32, ptr %18, align 8, !tbaa !21
  %20 = tail call i32 @isFatalError(i32 noundef %19)
  %.not170 = icmp eq i32 %20, 0
  br i1 %.not170, label %21, label %243

21:                                               ; preds = %17
  %22 = load ptr, ptr %11, align 8, !tbaa !19
  %23 = tail call ptr @sqlite3BtreePager(ptr noundef %22)
  %24 = getelementptr inbounds i8, ptr %0, i64 8
  %25 = load ptr, ptr %24, align 8, !tbaa !22
  %26 = tail call ptr @sqlite3BtreePager(ptr noundef %25)
  %27 = load ptr, ptr %0, align 8, !tbaa !20
  %.not171 = icmp eq ptr %27, null
  %.pre = load ptr, ptr %11, align 8, !tbaa !19
  br i1 %.not171, label %34, label %28

28:                                               ; preds = %21
  %29 = getelementptr inbounds i8, ptr %.pre, i64 8
  %30 = load ptr, ptr %29, align 8, !tbaa !23
  %31 = getelementptr inbounds i8, ptr %30, i64 36
  %32 = load i8, ptr %31, align 4, !tbaa !26
  %33 = icmp eq i8 %32, 2
  br i1 %33, label %.thread192, label %34

34:                                               ; preds = %21, %28
  %35 = tail call i32 @sqlite3BtreeTxnState(ptr noundef %.pre)
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %40, label %37

37:                                               ; preds = %34
  %38 = load ptr, ptr %11, align 8, !tbaa !19
  %39 = tail call i32 @sqlite3BtreeBeginTrans(ptr noundef %38, i32 noundef 0, ptr noundef null)
  br label %40

40:                                               ; preds = %37, %34
  %.1 = phi i32 [ %39, %37 ], [ 0, %34 ]
  %41 = getelementptr inbounds i8, ptr %0, i64 20
  %42 = load i32, ptr %41, align 4, !tbaa !28
  %43 = icmp eq i32 %42, 0
  %44 = icmp eq i32 %.1, 0
  %or.cond = select i1 %43, i1 %44, i1 false
  br i1 %or.cond, label %45, label %48

45:                                               ; preds = %40
  %46 = tail call i32 @setDestPgsz(ptr noundef nonnull %0)
  %47 = icmp eq i32 %46, 7
  br i1 %47, label %.thread192, label %..thread196_crit_edge

..thread196_crit_edge:                            ; preds = %45
  %.pre253 = load i32, ptr %41, align 4, !tbaa !28
  br label %.thread196

48:                                               ; preds = %40
  br i1 %44, label %.thread196, label %.thread192

.thread196:                                       ; preds = %..thread196_crit_edge, %48
  %49 = phi i32 [ %.pre253, %..thread196_crit_edge ], [ %42, %48 ]
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %.thread192

51:                                               ; preds = %.thread196
  %52 = load ptr, ptr %24, align 8, !tbaa !22
  %53 = getelementptr inbounds i8, ptr %0, i64 16
  %54 = tail call i32 @sqlite3BtreeBeginTrans(ptr noundef %52, i32 noundef 2, ptr noundef nonnull %53)
  %55 = icmp eq i32 %54, 0
  br i1 %55, label %56, label %.thread192

56:                                               ; preds = %51
  store i32 1, ptr %41, align 4, !tbaa !28
  br label %.thread192

.thread192:                                       ; preds = %45, %28, %56, %51, %.thread196, %48
  %.not178191195 = phi i1 [ %36, %56 ], [ %36, %51 ], [ %36, %.thread196 ], [ %36, %48 ], [ true, %28 ], [ %36, %45 ]
  %.3 = phi i32 [ 0, %56 ], [ %54, %51 ], [ 0, %.thread196 ], [ %.1, %48 ], [ 5, %28 ], [ 7, %45 ]
  %57 = load ptr, ptr %11, align 8, !tbaa !19
  %58 = tail call i32 @sqlite3BtreeGetPageSize(ptr noundef %57)
  %59 = load ptr, ptr %24, align 8, !tbaa !22
  %60 = tail call i32 @sqlite3BtreeGetPageSize(ptr noundef %59)
  %61 = load ptr, ptr %24, align 8, !tbaa !22
  %62 = tail call ptr @sqlite3BtreePager(ptr noundef %61)
  %63 = tail call i32 @sqlite3PagerGetJournalMode(ptr noundef %62)
  %64 = icmp eq i32 %.3, 0
  br i1 %64, label %65, label %71

65:                                               ; preds = %.thread192
  %66 = icmp eq i32 %63, 5
  br i1 %66, label %69, label %67

67:                                               ; preds = %65
  %68 = tail call i32 @sqlite3PagerIsMemdb(ptr noundef %26)
  %.not172 = icmp eq i32 %68, 0
  %.not173 = icmp eq i32 %58, %60
  %or.cond182 = select i1 %.not172, i1 true, i1 %.not173
  br i1 %or.cond182, label %71, label %70

69:                                               ; preds = %65
  %.not173.old = icmp eq i32 %58, %60
  br i1 %.not173.old, label %71, label %70

70:                                               ; preds = %67, %69
  br label %71

71:                                               ; preds = %70, %69, %67, %.thread192
  %.4 = phi i32 [ 8, %70 ], [ 0, %69 ], [ 0, %67 ], [ %.3, %.thread192 ]
  %72 = load ptr, ptr %11, align 8, !tbaa !19
  %73 = tail call i32 @sqlite3BtreeLastPage(ptr noundef %72)
  %or.cond183228.not = icmp eq i32 %1, 0
  br i1 %or.cond183228.not, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %71
  %74 = icmp slt i32 %1, 0
  %75 = getelementptr inbounds i8, ptr %0, i64 24
  %76 = load i32, ptr %75, align 8, !tbaa !29
  br i1 %74, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph
  %.not174.us233 = icmp ule i32 %76, %73
  %.not175.us234 = icmp eq i32 %.4, 0
  %or.cond184.us235 = select i1 %.not174.us233, i1 %.not175.us234, i1 false
  br i1 %or.cond184.us235, label %.lr.ph237, label %.critedge

.lr.ph237:                                        ; preds = %.lr.ph.split.us, %95
  %77 = phi i32 [ %97, %95 ], [ %76, %.lr.ph.split.us ]
  %78 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !30
  %79 = load ptr, ptr %11, align 8, !tbaa !19
  %80 = getelementptr inbounds i8, ptr %79, i64 8
  %81 = load ptr, ptr %80, align 8, !tbaa !23
  %82 = getelementptr inbounds i8, ptr %81, i64 52
  %83 = load i32, ptr %82, align 4, !tbaa !31
  %84 = udiv i32 %78, %83
  %85 = add i32 %84, 1
  %.not180.us = icmp eq i32 %77, %85
  br i1 %.not180.us, label %95, label %86

86:                                               ; preds = %.lr.ph237
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %87 = call i32 @sqlite3PagerGet(ptr noundef %23, i32 noundef %77, ptr noundef nonnull %3, i32 noundef 2)
  %88 = icmp eq i32 %87, 0
  br i1 %88, label %89, label %94

89:                                               ; preds = %86
  %90 = load ptr, ptr %3, align 8, !tbaa !32
  %91 = call ptr @sqlite3PagerGetData(ptr noundef %90)
  %92 = call i32 @backupOnePage(ptr noundef nonnull %0, i32 noundef %77, ptr noundef %91, i32 noundef 0)
  %93 = load ptr, ptr %3, align 8, !tbaa !32
  call void @sqlite3PagerUnref(ptr noundef %93)
  br label %94

94:                                               ; preds = %89, %86
  %.6.us = phi i32 [ %92, %89 ], [ %87, %86 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  %.pre256 = load i32, ptr %75, align 8, !tbaa !29
  br label %95

95:                                               ; preds = %94, %.lr.ph237
  %96 = phi i32 [ %.pre256, %94 ], [ %77, %.lr.ph237 ]
  %.7.us = phi i32 [ %.6.us, %94 ], [ 0, %.lr.ph237 ]
  %97 = add i32 %96, 1
  store i32 %97, ptr %75, align 8, !tbaa !29
  %.not174.us = icmp ule i32 %97, %73
  %.not175.us = icmp eq i32 %.7.us, 0
  %or.cond184.us = select i1 %.not174.us, i1 %.not175.us, i1 false
  br i1 %or.cond184.us, label %.lr.ph237, label %.critedge

.lr.ph.split:                                     ; preds = %.lr.ph, %117
  %98 = phi i32 [ %119, %117 ], [ %76, %.lr.ph ]
  %.5230 = phi i32 [ %.7, %117 ], [ %.4, %.lr.ph ]
  %.0144229 = phi i32 [ %120, %117 ], [ 0, %.lr.ph ]
  %.not174 = icmp ule i32 %98, %73
  %.not175 = icmp eq i32 %.5230, 0
  %or.cond184 = select i1 %.not174, i1 %.not175, i1 false
  br i1 %or.cond184, label %99, label %.critedge

99:                                               ; preds = %.lr.ph.split
  %100 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !30
  %101 = load ptr, ptr %11, align 8, !tbaa !19
  %102 = getelementptr inbounds i8, ptr %101, i64 8
  %103 = load ptr, ptr %102, align 8, !tbaa !23
  %104 = getelementptr inbounds i8, ptr %103, i64 52
  %105 = load i32, ptr %104, align 4, !tbaa !31
  %106 = udiv i32 %100, %105
  %107 = add i32 %106, 1
  %.not180 = icmp eq i32 %98, %107
  br i1 %.not180, label %117, label %108

108:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %109 = call i32 @sqlite3PagerGet(ptr noundef %23, i32 noundef %98, ptr noundef nonnull %3, i32 noundef 2)
  %110 = icmp eq i32 %109, 0
  br i1 %110, label %111, label %116

111:                                              ; preds = %108
  %112 = load ptr, ptr %3, align 8, !tbaa !32
  %113 = call ptr @sqlite3PagerGetData(ptr noundef %112)
  %114 = call i32 @backupOnePage(ptr noundef nonnull %0, i32 noundef %98, ptr noundef %113, i32 noundef 0)
  %115 = load ptr, ptr %3, align 8, !tbaa !32
  call void @sqlite3PagerUnref(ptr noundef %115)
  br label %116

116:                                              ; preds = %111, %108
  %.6 = phi i32 [ %114, %111 ], [ %109, %108 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  %.pre255 = load i32, ptr %75, align 8, !tbaa !29
  br label %117

117:                                              ; preds = %116, %99
  %118 = phi i32 [ %.pre255, %116 ], [ %98, %99 ]
  %.7 = phi i32 [ %.6, %116 ], [ 0, %99 ]
  %119 = add i32 %118, 1
  store i32 %119, ptr %75, align 8, !tbaa !29
  %120 = add nuw nsw i32 %.0144229, 1
  %exitcond.not = icmp eq i32 %120, %1
  br i1 %exitcond.not, label %.critedge, label %.lr.ph.split, !llvm.loop !33

.critedge:                                        ; preds = %.lr.ph.split, %117, %95, %.lr.ph.split.us, %71
  %.5.lcssa = phi i32 [ %.4, %71 ], [ %.4, %.lr.ph.split.us ], [ %.7.us, %95 ], [ %.7, %117 ], [ %.5230, %.lr.ph.split ]
  switch i32 %.5.lcssa, label %.thread201 [
    i32 0, label %121
    i32 101, label %.thread203
  ]

121:                                              ; preds = %.critedge
  %122 = getelementptr inbounds i8, ptr %0, i64 56
  store i32 %73, ptr %122, align 8, !tbaa !35
  %123 = add nsw i32 %73, 1
  %124 = getelementptr inbounds i8, ptr %0, i64 24
  %125 = load i32, ptr %124, align 8, !tbaa !29
  %126 = sub i32 %123, %125
  %127 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 %126, ptr %127, align 4, !tbaa !36
  %128 = icmp ugt i32 %125, %73
  br i1 %128, label %.thread203, label %129

129:                                              ; preds = %121
  %130 = getelementptr inbounds i8, ptr %0, i64 60
  %131 = load i32, ptr %130, align 4, !tbaa !37
  %.not176 = icmp eq i32 %131, 0
  br i1 %.not176, label %132, label %.thread201

132:                                              ; preds = %129
  call void @attachBackupObject(ptr noundef nonnull %0)
  br label %.thread201

.thread203:                                       ; preds = %.critedge, %121
  %133 = icmp eq i32 %73, 0
  br i1 %133, label %134, label %.thread205

134:                                              ; preds = %.thread203
  %135 = load ptr, ptr %24, align 8, !tbaa !22
  %136 = call i32 @sqlite3BtreeNewDb(ptr noundef %135)
  switch i32 %136, label %.thread201 [
    i32 101, label %.thread205
    i32 0, label %.thread205
  ]

.thread205:                                       ; preds = %.thread203, %134, %134
  %.0145208 = phi i32 [ 1, %134 ], [ 1, %134 ], [ %73, %.thread203 ]
  %137 = load ptr, ptr %24, align 8, !tbaa !22
  %138 = getelementptr inbounds i8, ptr %0, i64 16
  %139 = load i32, ptr %138, align 8, !tbaa !38
  %140 = add i32 %139, 1
  %141 = call i32 @sqlite3BtreeUpdateMeta(ptr noundef %137, i32 noundef 1, i32 noundef %140)
  %142 = icmp eq i32 %141, 0
  br i1 %142, label %143, label %.thread201

143:                                              ; preds = %.thread205
  %144 = load ptr, ptr %0, align 8, !tbaa !20
  %.not177 = icmp eq ptr %144, null
  br i1 %.not177, label %146, label %145

145:                                              ; preds = %143
  call void @sqlite3ResetAllSchemasOfConnection(ptr noundef nonnull %144)
  br label %146

146:                                              ; preds = %145, %143
  %147 = icmp eq i32 %63, 5
  br i1 %147, label %148, label %.thread218

148:                                              ; preds = %146
  %149 = load ptr, ptr %24, align 8, !tbaa !22
  %150 = call i32 @sqlite3BtreeSetVersion(ptr noundef %149, i32 noundef 2)
  %151 = icmp eq i32 %150, 0
  br i1 %151, label %.thread218, label %.thread201

.thread218:                                       ; preds = %146, %148
  %152 = icmp slt i32 %58, %60
  br i1 %152, label %153, label %226

153:                                              ; preds = %.thread218
  %154 = sdiv i32 %60, %58
  %155 = add i32 %.0145208, -1
  %156 = add i32 %155, %154
  %157 = sdiv i32 %156, %154
  %158 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !30
  %159 = load ptr, ptr %24, align 8, !tbaa !22
  %160 = getelementptr inbounds i8, ptr %159, i64 8
  %161 = load ptr, ptr %160, align 8, !tbaa !23
  %162 = getelementptr inbounds i8, ptr %161, i64 52
  %163 = load i32, ptr %162, align 4, !tbaa !31
  %164 = udiv i32 %158, %163
  %165 = add i32 %164, 1
  %166 = icmp eq i32 %157, %165
  %167 = sext i1 %166 to i32
  %spec.select185 = add nsw i32 %157, %167
  %168 = sext i32 %58 to i64
  %169 = sext i32 %.0145208 to i64
  %170 = mul nsw i64 %169, %168
  %171 = call ptr @sqlite3PagerFile(ptr noundef %26)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #3
  call void @sqlite3PagerPagecount(ptr noundef %26, ptr noundef nonnull %4)
  %172 = load i32, ptr %4, align 4
  %.not249 = icmp ugt i32 %spec.select185, %172
  br i1 %.not249, label %._crit_edge.thread, label %.lr.ph240

.lr.ph240:                                        ; preds = %153, %190
  %173 = phi i32 [ %191, %190 ], [ %172, %153 ]
  %.0143239 = phi i32 [ %192, %190 ], [ %spec.select185, %153 ]
  %174 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !30
  %175 = load ptr, ptr %24, align 8, !tbaa !22
  %176 = getelementptr inbounds i8, ptr %175, i64 8
  %177 = load ptr, ptr %176, align 8, !tbaa !23
  %178 = getelementptr inbounds i8, ptr %177, i64 52
  %179 = load i32, ptr %178, align 4, !tbaa !31
  %180 = udiv i32 %174, %179
  %181 = add i32 %180, 1
  %.not179 = icmp eq i32 %.0143239, %181
  br i1 %.not179, label %190, label %182

182:                                              ; preds = %.lr.ph240
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %183 = call i32 @sqlite3PagerGet(ptr noundef %26, i32 noundef %.0143239, ptr noundef nonnull %5, i32 noundef 0)
  %184 = icmp eq i32 %183, 0
  br i1 %184, label %185, label %189

185:                                              ; preds = %182
  %186 = load ptr, ptr %5, align 8, !tbaa !32
  %187 = call i32 @sqlite3PagerWrite(ptr noundef %186)
  %188 = load ptr, ptr %5, align 8, !tbaa !32
  call void @sqlite3PagerUnref(ptr noundef %188)
  br label %189

189:                                              ; preds = %185, %182
  %.13 = phi i32 [ %187, %185 ], [ %183, %182 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  %.pre257 = load i32, ptr %4, align 4
  br label %190

190:                                              ; preds = %.lr.ph240, %189
  %191 = phi i32 [ %.pre257, %189 ], [ %173, %.lr.ph240 ]
  %.14 = phi i32 [ %.13, %189 ], [ 0, %.lr.ph240 ]
  %192 = add i32 %.0143239, 1
  %193 = icmp eq i32 %.14, 0
  %194 = icmp ule i32 %192, %191
  %195 = select i1 %193, i1 %194, i1 false
  br i1 %195, label %.lr.ph240, label %._crit_edge, !llvm.loop !39

._crit_edge:                                      ; preds = %190
  br i1 %193, label %._crit_edge.thread, label %197

._crit_edge.thread:                               ; preds = %153, %._crit_edge
  %196 = call i32 @sqlite3PagerCommitPhaseOne(ptr noundef %26, ptr noundef null, i32 noundef 1)
  br label %197

197:                                              ; preds = %._crit_edge.thread, %._crit_edge
  %.15 = phi i32 [ %196, %._crit_edge.thread ], [ %.14, %._crit_edge ]
  %198 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !30
  %199 = add nsw i32 %198, %60
  %200 = sext i32 %199 to i64
  %. = call i64 @llvm.smin.i64(i64 %170, i64 %200)
  %201 = add nsw i32 %198, %58
  %202 = sext i32 %201 to i64
  %203 = icmp eq i32 %.15, 0
  %204 = icmp sgt i64 %., %202
  %205 = select i1 %203, i1 %204, i1 false
  br i1 %205, label %.lr.ph245, label %._crit_edge246

.lr.ph245:                                        ; preds = %197, %215
  %.0142243 = phi i64 [ %217, %215 ], [ %202, %197 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  store ptr null, ptr %6, align 8, !tbaa !32
  %206 = sdiv i64 %.0142243, %168
  %207 = trunc i64 %206 to i32
  %208 = add i32 %207, 1
  %209 = call i32 @sqlite3PagerGet(ptr noundef %23, i32 noundef %208, ptr noundef nonnull %6, i32 noundef 0)
  %210 = icmp eq i32 %209, 0
  br i1 %210, label %211, label %215

211:                                              ; preds = %.lr.ph245
  %212 = load ptr, ptr %6, align 8, !tbaa !32
  %213 = call ptr @sqlite3PagerGetData(ptr noundef %212)
  %214 = call i32 @sqlite3OsWrite(ptr noundef %171, ptr noundef %213, i32 noundef %58, i64 noundef %.0142243)
  br label %215

215:                                              ; preds = %211, %.lr.ph245
  %.17 = phi i32 [ %214, %211 ], [ %209, %.lr.ph245 ]
  %216 = load ptr, ptr %6, align 8, !tbaa !32
  call void @sqlite3PagerUnref(ptr noundef %216)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  %217 = add nsw i64 %.0142243, %168
  %218 = icmp eq i32 %.17, 0
  %219 = icmp slt i64 %217, %.
  %220 = select i1 %218, i1 %219, i1 false
  br i1 %220, label %.lr.ph245, label %._crit_edge246, !llvm.loop !40

._crit_edge246:                                   ; preds = %215, %197
  %.16.lcssa = phi i32 [ %.15, %197 ], [ %.17, %215 ]
  %.lcssa = phi i1 [ %203, %197 ], [ %218, %215 ]
  br i1 %.lcssa, label %221, label %.thread225

221:                                              ; preds = %._crit_edge246
  %222 = call i32 @backupTruncateFile(ptr noundef %171, i64 noundef %170)
  %223 = icmp eq i32 %222, 0
  br i1 %223, label %224, label %.thread225

224:                                              ; preds = %221
  %225 = call i32 @sqlite3PagerSync(ptr noundef %26, ptr noundef null)
  br label %.thread225

.thread225:                                       ; preds = %._crit_edge246, %224, %221
  %.19 = phi i32 [ %225, %224 ], [ %222, %221 ], [ %.16.lcssa, %._crit_edge246 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #3
  br label %230

226:                                              ; preds = %.thread218
  %227 = sdiv i32 %58, %60
  %228 = mul nsw i32 %227, %.0145208
  call void @sqlite3PagerTruncateImage(ptr noundef %26, i32 noundef %228)
  %229 = call i32 @sqlite3PagerCommitPhaseOne(ptr noundef %26, ptr noundef null, i32 noundef 0)
  br label %230

230:                                              ; preds = %226, %.thread225
  %.20 = phi i32 [ %.19, %.thread225 ], [ %229, %226 ]
  %231 = icmp eq i32 %.20, 0
  br i1 %231, label %232, label %.thread201

232:                                              ; preds = %230
  %233 = load ptr, ptr %24, align 8, !tbaa !22
  %234 = call i32 @sqlite3BtreeCommitPhaseTwo(ptr noundef %233, i32 noundef 0)
  %235 = icmp eq i32 %234, 0
  %spec.store.select = select i1 %235, i32 101, i32 %234
  br label %.thread201

.thread201:                                       ; preds = %.critedge, %134, %.thread205, %132, %129, %230, %232, %148
  %.22 = phi i32 [ %150, %148 ], [ %spec.store.select, %232 ], [ %.20, %230 ], [ 0, %129 ], [ 0, %132 ], [ %141, %.thread205 ], [ %136, %134 ], [ %.5.lcssa, %.critedge ]
  br i1 %.not178191195, label %241, label %236

236:                                              ; preds = %.thread201
  %237 = load ptr, ptr %11, align 8, !tbaa !19
  %238 = call i32 @sqlite3BtreeCommitPhaseOne(ptr noundef %237, ptr noundef null)
  %239 = load ptr, ptr %11, align 8, !tbaa !19
  %240 = call i32 @sqlite3BtreeCommitPhaseTwo(ptr noundef %239, i32 noundef 0)
  br label %241

241:                                              ; preds = %236, %.thread201
  %242 = icmp eq i32 %.22, 3082
  %spec.store.select4 = select i1 %242, i32 7, i32 %.22
  store i32 %spec.store.select4, ptr %18, align 8, !tbaa !21
  br label %243

243:                                              ; preds = %241, %17
  %.23 = phi i32 [ %19, %17 ], [ %spec.store.select4, %241 ]
  %244 = load ptr, ptr %0, align 8, !tbaa !20
  %.not181 = icmp eq ptr %244, null
  br i1 %.not181, label %248, label %245

245:                                              ; preds = %243
  %246 = getelementptr inbounds i8, ptr %244, i64 24
  %247 = load ptr, ptr %246, align 8, !tbaa !11
  call void @sqlite3_mutex_leave(ptr noundef %247)
  br label %248

248:                                              ; preds = %245, %243
  %249 = load ptr, ptr %11, align 8, !tbaa !19
  call void @sqlite3BtreeLeave(ptr noundef %249)
  %250 = load ptr, ptr %7, align 8, !tbaa !5
  %251 = getelementptr inbounds i8, ptr %250, i64 24
  %252 = load ptr, ptr %251, align 8, !tbaa !11
  call void @sqlite3_mutex_leave(ptr noundef %252)
  ret i32 %.23
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.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, !7, i64 32}
!6 = !{!"sqlite3_backup", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !7, i64 32, !7, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !7, i64 64}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!12, !7, i64 24}
!12 = !{!"sqlite3", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40, !10, i64 44, !13, i64 48, !13, i64 56, !13, i64 64, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !10, i64 96, !8, i64 100, !8, i64 101, !8, i64 102, !8, i64 103, !8, i64 104, !8, i64 105, !8, i64 106, !8, i64 107, !8, i64 108, !8, i64 109, !8, i64 110, !8, i64 111, !8, i64 112, !8, i64 113, !10, i64 116, !13, i64 120, !13, i64 128, !8, i64 136, !10, i64 184, !14, i64 192, !10, i64 208, !10, i64 212, !10, i64 216, !10, i64 220, !10, i64 224, !10, i64 228, !7, i64 232, !8, i64 240, !7, i64 248, !7, i64 256, !7, i64 264, !7, i64 272, !7, i64 280, !7, i64 288, !7, i64 296, !7, i64 304, !7, i64 312, !7, i64 320, !7, i64 328, !7, i64 336, !7, i64 344, !7, i64 352, !7, i64 360, !7, i64 368, !7, i64 376, !7, i64 384, !7, i64 392, !8, i64 400, !15, i64 408, !7, i64 504, !7, i64 512, !7, i64 520, !7, i64 528, !10, i64 536, !10, i64 540, !17, i64 544, !7, i64 568, !7, i64 576, !7, i64 584, !17, i64 592, !17, i64 616, !18, i64 640, !8, i64 664, !7, i64 728, !10, i64 736, !10, i64 740, !10, i64 744, !10, i64 748, !13, i64 752, !13, i64 760, !7, i64 768, !7, i64 776}
!13 = !{!"long long", !8, i64 0}
!14 = !{!"sqlite3InitInfo", !10, i64 0, !8, i64 4, !8, i64 5, !10, i64 6, !10, i64 6, !10, i64 6, !7, i64 8}
!15 = !{!"Lookaside", !10, i64 0, !16, i64 4, !16, i64 6, !8, i64 8, !10, i64 12, !8, i64 16, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88}
!16 = !{!"short", !8, i64 0}
!17 = !{!"Hash", !10, i64 0, !10, i64 4, !7, i64 8, !7, i64 16}
!18 = !{!"BusyHandler", !7, i64 0, !7, i64 8, !10, i64 16}
!19 = !{!6, !7, i64 40}
!20 = !{!6, !7, i64 0}
!21 = !{!6, !10, i64 48}
!22 = !{!6, !7, i64 8}
!23 = !{!24, !7, i64 8}
!24 = !{!"Btree", !7, i64 0, !7, i64 8, !8, i64 16, !8, i64 17, !8, i64 18, !8, i64 19, !10, i64 20, !10, i64 24, !10, i64 28, !7, i64 32, !7, i64 40, !25, i64 48}
!25 = !{!"BtLock", !7, i64 0, !10, i64 8, !8, i64 12, !7, i64 16}
!26 = !{!27, !8, i64 36}
!27 = !{!"BtShared", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !8, i64 32, !8, i64 33, !8, i64 34, !8, i64 35, !8, i64 36, !8, i64 37, !8, i64 38, !16, i64 40, !16, i64 42, !16, i64 44, !16, i64 46, !16, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !10, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !10, i64 144}
!28 = !{!6, !10, i64 20}
!29 = !{!6, !10, i64 24}
!30 = !{!10, !10, i64 0}
!31 = !{!27, !10, i64 52}
!32 = !{!7, !7, i64 0}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = !{!6, !10, i64 56}
!36 = !{!6, !10, i64 52}
!37 = !{!6, !10, i64 60}
!38 = !{!6, !10, i64 16}
!39 = distinct !{!39, !34}
!40 = distinct !{!40, !34}


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