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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.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, i16, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, i32, [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, %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 }
%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 }
%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 }

@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
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 %490, 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 %148

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

143:                                              ; preds = %140
  %144 = load i32, ptr %7, align 4, !tbaa !9
  %145 = load i32, ptr %8, align 4, !tbaa !9
  %146 = icmp ne i32 %144, %145
  br i1 %146, label %147, label %148

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

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

153:                                              ; preds = %207, %148
  %154 = load i32, ptr %4, align 4, !tbaa !9
  %155 = icmp slt i32 %154, 0
  br i1 %155, label %160, label %156

156:                                              ; preds = %153
  %157 = load i32, ptr %11, align 4, !tbaa !9
  %158 = load i32, ptr %4, align 4, !tbaa !9
  %159 = icmp slt i32 %157, %158
  br i1 %159, label %160, label %170

160:                                              ; preds = %156, %153
  %161 = load ptr, ptr %3, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.sqlite3_backup, ptr %161, i32 0, i32 4
  %163 = load i32, ptr %162, align 8, !tbaa !31
  %164 = load i32, ptr %12, align 4, !tbaa !9
  %165 = icmp ule i32 %163, %164
  br i1 %165, label %166, label %170

166:                                              ; preds = %160
  %167 = load i32, ptr %5, align 4, !tbaa !9
  %168 = icmp ne i32 %167, 0
  %169 = xor i1 %168, true
  br label %170

170:                                              ; preds = %166, %160, %156
  %171 = phi i1 [ false, %160 ], [ false, %156 ], [ %169, %166 ]
  br i1 %171, label %172, label %210

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

188:                                              ; preds = %172
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #2
  %189 = load ptr, ptr %9, align 8, !tbaa !5
  %190 = load i32, ptr %14, align 4, !tbaa !9
  %191 = call i32 @sqlite3PagerGet(ptr noundef %189, i32 noundef %190, ptr noundef %15, i32 noundef 2)
  store i32 %191, ptr %5, align 4, !tbaa !9
  %192 = load i32, ptr %5, align 4, !tbaa !9
  %193 = icmp eq i32 %192, 0
  br i1 %193, label %194, label %201

194:                                              ; preds = %188
  %195 = load ptr, ptr %3, align 8, !tbaa !5
  %196 = load i32, ptr %14, align 4, !tbaa !9
  %197 = load ptr, ptr %15, align 8, !tbaa !5
  %198 = call ptr @sqlite3PagerGetData(ptr noundef %197)
  %199 = call i32 @backupOnePage(ptr noundef %195, i32 noundef %196, ptr noundef %198, i32 noundef 0)
  store i32 %199, ptr %5, align 4, !tbaa !9
  %200 = load ptr, ptr %15, align 8, !tbaa !5
  call void @sqlite3PagerUnref(ptr noundef %200)
  br label %201

201:                                              ; preds = %194, %188
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #2
  br label %202

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

207:                                              ; preds = %202
  %208 = load i32, ptr %11, align 4, !tbaa !9
  %209 = add nsw i32 %208, 1
  store i32 %209, ptr %11, align 4, !tbaa !9
  br label %153, !llvm.loop !33

210:                                              ; preds = %170
  %211 = load i32, ptr %5, align 4, !tbaa !9
  %212 = icmp eq i32 %211, 0
  br i1 %212, label %213, label %240

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

230:                                              ; preds = %213
  store i32 101, ptr %5, align 4, !tbaa !9
  br label %239

231:                                              ; preds = %213
  %232 = load ptr, ptr %3, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.sqlite3_backup, ptr %232, i32 0, i32 10
  %234 = load i32, ptr %233, align 4, !tbaa !37
  %235 = icmp ne i32 %234, 0
  br i1 %235, label %238, label %236

236:                                              ; preds = %231
  %237 = load ptr, ptr %3, align 8, !tbaa !5
  call void @attachBackupObject(ptr noundef %237)
  br label %238

238:                                              ; preds = %236, %231
  br label %239

239:                                              ; preds = %238, %230
  br label %240

240:                                              ; preds = %239, %210
  %241 = load i32, ptr %5, align 4, !tbaa !9
  %242 = icmp eq i32 %241, 101
  br i1 %242, label %243, label %470

243:                                              ; preds = %240
  %244 = load i32, ptr %12, align 4, !tbaa !9
  %245 = icmp eq i32 %244, 0
  br i1 %245, label %246, label %251

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

251:                                              ; preds = %246, %243
  %252 = load i32, ptr %5, align 4, !tbaa !9
  %253 = icmp eq i32 %252, 0
  br i1 %253, label %257, label %254

254:                                              ; preds = %251
  %255 = load i32, ptr %5, align 4, !tbaa !9
  %256 = icmp eq i32 %255, 101
  br i1 %256, label %257, label %266

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

266:                                              ; preds = %257, %254
  %267 = load i32, ptr %5, align 4, !tbaa !9
  %268 = icmp eq i32 %267, 0
  br i1 %268, label %269, label %287

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

274:                                              ; preds = %269
  %275 = load ptr, ptr %3, align 8, !tbaa !5
  %276 = getelementptr inbounds %struct.sqlite3_backup, ptr %275, i32 0, i32 0
  %277 = load ptr, ptr %276, align 8, !tbaa !22
  call void @sqlite3ResetAllSchemasOfConnection(ptr noundef %277)
  br label %278

278:                                              ; preds = %274, %269
  %279 = load i32, ptr %6, align 4, !tbaa !9
  %280 = icmp eq i32 %279, 5
  br i1 %280, label %281, label %286

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

286:                                              ; preds = %281, %278
  br label %287

287:                                              ; preds = %286, %266
  %288 = load i32, ptr %5, align 4, !tbaa !9
  %289 = icmp eq i32 %288, 0
  br i1 %289, label %290, label %469

290:                                              ; preds = %287
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #2
  %291 = load i32, ptr %7, align 4, !tbaa !9
  %292 = load i32, ptr %8, align 4, !tbaa !9
  %293 = icmp slt i32 %291, %292
  br i1 %293, label %294, label %320

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

316:                                              ; preds = %294
  %317 = load i32, ptr %16, align 4, !tbaa !9
  %318 = add nsw i32 %317, -1
  store i32 %318, ptr %16, align 4, !tbaa !9
  br label %319

319:                                              ; preds = %316, %294
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #2
  br label %326

320:                                              ; preds = %290
  %321 = load i32, ptr %12, align 4, !tbaa !9
  %322 = load i32, ptr %7, align 4, !tbaa !9
  %323 = load i32, ptr %8, align 4, !tbaa !9
  %324 = sdiv i32 %322, %323
  %325 = mul nsw i32 %321, %324
  store i32 %325, ptr %16, align 4, !tbaa !9
  br label %326

326:                                              ; preds = %320, %319
  %327 = load i32, ptr %7, align 4, !tbaa !9
  %328 = load i32, ptr %8, align 4, !tbaa !9
  %329 = icmp slt i32 %327, %328
  br i1 %329, label %330, label %453

330:                                              ; preds = %326
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #2
  %331 = load i32, ptr %7, align 4, !tbaa !9
  %332 = sext i32 %331 to i64
  %333 = load i32, ptr %12, align 4, !tbaa !9
  %334 = sext i32 %333 to i64
  %335 = mul nsw i64 %332, %334
  store i64 %335, ptr %18, align 8, !tbaa !39
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #2
  %336 = load ptr, ptr %10, align 8, !tbaa !5
  %337 = call ptr @sqlite3PagerFile(ptr noundef %336)
  store ptr %337, 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
  %338 = load ptr, ptr %10, align 8, !tbaa !5
  call void @sqlite3PagerPagecount(ptr noundef %338, ptr noundef %21)
  %339 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %339, ptr %20, align 4, !tbaa !9
  br label %340

340:                                              ; preds = %374, %330
  %341 = load i32, ptr %5, align 4, !tbaa !9
  %342 = icmp eq i32 %341, 0
  br i1 %342, label %343, label %347

343:                                              ; preds = %340
  %344 = load i32, ptr %20, align 4, !tbaa !9
  %345 = load i32, ptr %21, align 4, !tbaa !9
  %346 = icmp ule i32 %344, %345
  br label %347

347:                                              ; preds = %343, %340
  %348 = phi i1 [ false, %340 ], [ %346, %343 ]
  br i1 %348, label %349, label %377

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

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

368:                                              ; preds = %362
  %369 = load ptr, ptr %24, align 8, !tbaa !5
  %370 = call i32 @sqlite3PagerWrite(ptr noundef %369)
  store i32 %370, ptr %5, align 4, !tbaa !9
  %371 = load ptr, ptr %24, align 8, !tbaa !5
  call void @sqlite3PagerUnref(ptr noundef %371)
  br label %372

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

373:                                              ; preds = %372, %349
  br label %374

374:                                              ; preds = %373
  %375 = load i32, ptr %20, align 4, !tbaa !9
  %376 = add i32 %375, 1
  store i32 %376, ptr %20, align 4, !tbaa !9
  br label %340, !llvm.loop !40

377:                                              ; preds = %347
  %378 = load i32, ptr %5, align 4, !tbaa !9
  %379 = icmp eq i32 %378, 0
  br i1 %379, label %380, label %383

380:                                              ; preds = %377
  %381 = load ptr, ptr %10, align 8, !tbaa !5
  %382 = call i32 @sqlite3PagerCommitPhaseOne(ptr noundef %381, ptr noundef null, i32 noundef 1)
  store i32 %382, ptr %5, align 4, !tbaa !9
  br label %383

383:                                              ; preds = %380, %377
  %384 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !9
  %385 = load i32, ptr %8, align 4, !tbaa !9
  %386 = add nsw i32 %384, %385
  %387 = sext i32 %386 to i64
  %388 = load i64, ptr %18, align 8, !tbaa !39
  %389 = icmp slt i64 %387, %388
  br i1 %389, label %390, label %395

390:                                              ; preds = %383
  %391 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !9
  %392 = load i32, ptr %8, align 4, !tbaa !9
  %393 = add nsw i32 %391, %392
  %394 = sext i32 %393 to i64
  br label %397

395:                                              ; preds = %383
  %396 = load i64, ptr %18, align 8, !tbaa !39
  br label %397

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

403:                                              ; preds = %434, %397
  %404 = load i32, ptr %5, align 4, !tbaa !9
  %405 = icmp eq i32 %404, 0
  br i1 %405, label %406, label %410

406:                                              ; preds = %403
  %407 = load i64, ptr %22, align 8, !tbaa !39
  %408 = load i64, ptr %23, align 8, !tbaa !39
  %409 = icmp slt i64 %407, %408
  br label %410

410:                                              ; preds = %406, %403
  %411 = phi i1 [ false, %403 ], [ %409, %406 ]
  br i1 %411, label %412, label %439

412:                                              ; preds = %410
  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
  %413 = load i64, ptr %22, align 8, !tbaa !39
  %414 = load i32, ptr %7, align 4, !tbaa !9
  %415 = sext i32 %414 to i64
  %416 = sdiv i64 %413, %415
  %417 = add nsw i64 %416, 1
  %418 = trunc i64 %417 to i32
  store i32 %418, ptr %26, align 4, !tbaa !9
  %419 = load ptr, ptr %9, align 8, !tbaa !5
  %420 = load i32, ptr %26, align 4, !tbaa !9
  %421 = call i32 @sqlite3PagerGet(ptr noundef %419, i32 noundef %420, ptr noundef %25, i32 noundef 0)
  store i32 %421, ptr %5, align 4, !tbaa !9
  %422 = load i32, ptr %5, align 4, !tbaa !9
  %423 = icmp eq i32 %422, 0
  br i1 %423, label %424, label %432

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

432:                                              ; preds = %424, %412
  %433 = load ptr, ptr %25, align 8, !tbaa !5
  call void @sqlite3PagerUnref(ptr noundef %433)
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #2
  br label %434

434:                                              ; preds = %432
  %435 = load i32, ptr %7, align 4, !tbaa !9
  %436 = sext i32 %435 to i64
  %437 = load i64, ptr %22, align 8, !tbaa !39
  %438 = add nsw i64 %437, %436
  store i64 %438, ptr %22, align 8, !tbaa !39
  br label %403, !llvm.loop !41

439:                                              ; preds = %410
  %440 = load i32, ptr %5, align 4, !tbaa !9
  %441 = icmp eq i32 %440, 0
  br i1 %441, label %442, label %446

442:                                              ; preds = %439
  %443 = load ptr, ptr %19, align 8, !tbaa !5
  %444 = load i64, ptr %18, align 8, !tbaa !39
  %445 = call i32 @backupTruncateFile(ptr noundef %443, i64 noundef %444)
  store i32 %445, ptr %5, align 4, !tbaa !9
  br label %446

446:                                              ; preds = %442, %439
  %447 = load i32, ptr %5, align 4, !tbaa !9
  %448 = icmp eq i32 %447, 0
  br i1 %448, label %449, label %452

449:                                              ; preds = %446
  %450 = load ptr, ptr %10, align 8, !tbaa !5
  %451 = call i32 @sqlite3PagerSync(ptr noundef %450, ptr noundef null)
  store i32 %451, ptr %5, align 4, !tbaa !9
  br label %452

452:                                              ; preds = %449, %446
  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 %458

453:                                              ; preds = %326
  %454 = load ptr, ptr %10, align 8, !tbaa !5
  %455 = load i32, ptr %16, align 4, !tbaa !9
  call void @sqlite3PagerTruncateImage(ptr noundef %454, i32 noundef %455)
  %456 = load ptr, ptr %10, align 8, !tbaa !5
  %457 = call i32 @sqlite3PagerCommitPhaseOne(ptr noundef %456, ptr noundef null, i32 noundef 0)
  store i32 %457, ptr %5, align 4, !tbaa !9
  br label %458

458:                                              ; preds = %453, %452
  %459 = load i32, ptr %5, align 4, !tbaa !9
  %460 = icmp eq i32 0, %459
  br i1 %460, label %461, label %468

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

467:                                              ; preds = %461
  store i32 101, ptr %5, align 4, !tbaa !9
  br label %468

468:                                              ; preds = %467, %461, %458
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #2
  br label %469

469:                                              ; preds = %468, %287
  br label %470

470:                                              ; preds = %469, %240
  %471 = load i32, ptr %13, align 4, !tbaa !9
  %472 = icmp ne i32 %471, 0
  br i1 %472, label %473, label %482

473:                                              ; preds = %470
  %474 = load ptr, ptr %3, align 8, !tbaa !5
  %475 = getelementptr inbounds %struct.sqlite3_backup, ptr %474, i32 0, i32 6
  %476 = load ptr, ptr %475, align 8, !tbaa !21
  %477 = call i32 @sqlite3BtreeCommitPhaseOne(ptr noundef %476, ptr noundef null)
  %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 @sqlite3BtreeCommitPhaseTwo(ptr noundef %480, i32 noundef 0)
  br label %482

482:                                              ; preds = %473, %470
  %483 = load i32, ptr %5, align 4, !tbaa !9
  %484 = icmp eq i32 %483, 3082
  br i1 %484, label %485, label %486

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

486:                                              ; preds = %485, %482
  %487 = load i32, ptr %5, align 4, !tbaa !9
  %488 = load ptr, ptr %3, align 8, !tbaa !5
  %489 = getelementptr inbounds %struct.sqlite3_backup, ptr %488, i32 0, i32 7
  store i32 %487, ptr %489, 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 %490

490:                                              ; preds = %486, %46
  %491 = load ptr, ptr %3, align 8, !tbaa !5
  %492 = getelementptr inbounds %struct.sqlite3_backup, ptr %491, i32 0, i32 0
  %493 = load ptr, ptr %492, align 8, !tbaa !22
  %494 = icmp ne ptr %493, null
  br i1 %494, label %495, label %501

495:                                              ; preds = %490
  %496 = load ptr, ptr %3, align 8, !tbaa !5
  %497 = getelementptr inbounds %struct.sqlite3_backup, ptr %496, i32 0, i32 0
  %498 = load ptr, ptr %497, align 8, !tbaa !22
  %499 = getelementptr inbounds %struct.sqlite3, ptr %498, i32 0, i32 3
  %500 = load ptr, ptr %499, align 8, !tbaa !13
  call void @sqlite3_mutex_leave(ptr noundef %500)
  br label %501

501:                                              ; preds = %495, %490
  %502 = load ptr, ptr %3, align 8, !tbaa !5
  %503 = getelementptr inbounds %struct.sqlite3_backup, ptr %502, i32 0, i32 6
  %504 = load ptr, ptr %503, align 8, !tbaa !21
  call void @sqlite3BtreeLeave(ptr noundef %504)
  %505 = load ptr, ptr %3, align 8, !tbaa !5
  %506 = getelementptr inbounds %struct.sqlite3_backup, ptr %505, i32 0, i32 5
  %507 = load ptr, ptr %506, align 8, !tbaa !11
  %508 = getelementptr inbounds %struct.sqlite3, ptr %507, i32 0, i32 3
  %509 = load ptr, ptr %508, align 8, !tbaa !13
  call void @sqlite3_mutex_leave(ptr noundef %509)
  %510 = 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 %510
}

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @sqlite3BtreeLastPage(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 i32 @backupOnePage(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
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, !16, i64 92, !7, i64 94, !7, i64 95, !7, i64 96, !7, i64 97, !7, i64 98, !7, i64 99, !7, i64 100, !7, i64 101, !7, i64 102, !7, i64 103, !7, i64 104, !7, i64 105, !7, i64 106, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !7, i64 124, !10, i64 172, !17, i64 176, !10, i64 192, !10, i64 196, !10, i64 200, !10, i64 204, !10, i64 208, !10, i64 212, !6, i64 216, !7, i64 224, !6, i64 232, !6, 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, !7, i64 360, !18, i64 368, !6, i64 456, !6, i64 464, !6, i64 472, !6, i64 480, !10, i64 488, !10, i64 492, !19, i64 496, !6, i64 520, !6, i64 528, !6, i64 536, !19, i64 544, !19, i64 568, !20, i64 592, !7, i64 616, !6, i64 680, !10, i64 688, !10, i64 692, !10, i64 696, !10, i64 700, !15, i64 704, !15, i64 712, !6, i64 720}
!15 = !{!"long long", !7, i64 0}
!16 = !{!"short", !7, i64 0}
!17 = !{!"sqlite3InitInfo", !10, i64 0, !7, i64 4, !7, i64 5, !10, i64 6, !10, i64 6, !10, i64 6, !6, i64 8}
!18 = !{!"Lookaside", !10, i64 0, !16, i64 4, !16, 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}
!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, !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, !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}
!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
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)
  %.not171 = icmp eq i32 %20, 0
  br i1 %.not171, label %21, label %236

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
  %.not172 = icmp eq ptr %27, null
  %.pre = load ptr, ptr %11, align 8, !tbaa !19
  br i1 %.not172, 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
  %65 = icmp eq i32 %63, 5
  %or.cond3 = select i1 %64, i1 %65, i1 false
  %.not173 = icmp eq i32 %58, %60
  %spec.select182 = select i1 %.not173, i32 0, i32 8
  %.4 = select i1 %or.cond3, i32 %spec.select182, i32 %.3
  %66 = load ptr, ptr %11, align 8, !tbaa !19
  %67 = tail call i32 @sqlite3BtreeLastPage(ptr noundef %66)
  %or.cond183228.not = icmp eq i32 %1, 0
  br i1 %or.cond183228.not, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %.thread192
  %68 = icmp slt i32 %1, 0
  %69 = getelementptr inbounds i8, ptr %0, i64 24
  %70 = load i32, ptr %69, align 8, !tbaa !29
  br i1 %68, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph
  %.not174.us233 = icmp ule i32 %70, %67
  %.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, %89
  %71 = phi i32 [ %91, %89 ], [ %70, %.lr.ph.split.us ]
  %72 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !30
  %73 = load ptr, ptr %11, align 8, !tbaa !19
  %74 = getelementptr inbounds i8, ptr %73, i64 8
  %75 = load ptr, ptr %74, align 8, !tbaa !23
  %76 = getelementptr inbounds i8, ptr %75, i64 52
  %77 = load i32, ptr %76, align 4, !tbaa !31
  %78 = udiv i32 %72, %77
  %79 = add i32 %78, 1
  %.not180.us = icmp eq i32 %71, %79
  br i1 %.not180.us, label %89, label %80

80:                                               ; preds = %.lr.ph237
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %81 = call i32 @sqlite3PagerGet(ptr noundef %23, i32 noundef %71, ptr noundef nonnull %3, i32 noundef 2)
  %82 = icmp eq i32 %81, 0
  br i1 %82, label %83, label %88

83:                                               ; preds = %80
  %84 = load ptr, ptr %3, align 8, !tbaa !32
  %85 = call ptr @sqlite3PagerGetData(ptr noundef %84)
  %86 = call i32 @backupOnePage(ptr noundef nonnull %0, i32 noundef %71, ptr noundef %85, i32 noundef 0)
  %87 = load ptr, ptr %3, align 8, !tbaa !32
  call void @sqlite3PagerUnref(ptr noundef %87)
  br label %88

88:                                               ; preds = %83, %80
  %.6.us = phi i32 [ %86, %83 ], [ %81, %80 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  %.pre256 = load i32, ptr %69, align 8, !tbaa !29
  br label %89

89:                                               ; preds = %88, %.lr.ph237
  %90 = phi i32 [ %.pre256, %88 ], [ %71, %.lr.ph237 ]
  %.7.us = phi i32 [ %.6.us, %88 ], [ 0, %.lr.ph237 ]
  %91 = add i32 %90, 1
  store i32 %91, ptr %69, align 8, !tbaa !29
  %.not174.us = icmp ule i32 %91, %67
  %.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, %111
  %92 = phi i32 [ %113, %111 ], [ %70, %.lr.ph ]
  %.5230 = phi i32 [ %.7, %111 ], [ %.4, %.lr.ph ]
  %.0145229 = phi i32 [ %114, %111 ], [ 0, %.lr.ph ]
  %.not174 = icmp ule i32 %92, %67
  %.not175 = icmp eq i32 %.5230, 0
  %or.cond184 = select i1 %.not174, i1 %.not175, i1 false
  br i1 %or.cond184, label %93, label %.critedge

93:                                               ; preds = %.lr.ph.split
  %94 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !30
  %95 = load ptr, ptr %11, align 8, !tbaa !19
  %96 = getelementptr inbounds i8, ptr %95, i64 8
  %97 = load ptr, ptr %96, align 8, !tbaa !23
  %98 = getelementptr inbounds i8, ptr %97, i64 52
  %99 = load i32, ptr %98, align 4, !tbaa !31
  %100 = udiv i32 %94, %99
  %101 = add i32 %100, 1
  %.not180 = icmp eq i32 %92, %101
  br i1 %.not180, label %111, label %102

102:                                              ; preds = %93
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %103 = call i32 @sqlite3PagerGet(ptr noundef %23, i32 noundef %92, ptr noundef nonnull %3, i32 noundef 2)
  %104 = icmp eq i32 %103, 0
  br i1 %104, label %105, label %110

105:                                              ; preds = %102
  %106 = load ptr, ptr %3, align 8, !tbaa !32
  %107 = call ptr @sqlite3PagerGetData(ptr noundef %106)
  %108 = call i32 @backupOnePage(ptr noundef nonnull %0, i32 noundef %92, ptr noundef %107, i32 noundef 0)
  %109 = load ptr, ptr %3, align 8, !tbaa !32
  call void @sqlite3PagerUnref(ptr noundef %109)
  br label %110

110:                                              ; preds = %105, %102
  %.6 = phi i32 [ %108, %105 ], [ %103, %102 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  %.pre255 = load i32, ptr %69, align 8, !tbaa !29
  br label %111

111:                                              ; preds = %110, %93
  %112 = phi i32 [ %.pre255, %110 ], [ %92, %93 ]
  %.7 = phi i32 [ %.6, %110 ], [ 0, %93 ]
  %113 = add i32 %112, 1
  store i32 %113, ptr %69, align 8, !tbaa !29
  %114 = add nuw nsw i32 %.0145229, 1
  %exitcond.not = icmp eq i32 %114, %1
  br i1 %exitcond.not, label %.critedge, label %.lr.ph.split, !llvm.loop !33

.critedge:                                        ; preds = %.lr.ph.split, %111, %89, %.lr.ph.split.us, %.thread192
  %.5.lcssa = phi i32 [ %.4, %.thread192 ], [ %.4, %.lr.ph.split.us ], [ %.7.us, %89 ], [ %.7, %111 ], [ %.5230, %.lr.ph.split ]
  switch i32 %.5.lcssa, label %.thread201 [
    i32 0, label %115
    i32 101, label %.thread203
  ]

115:                                              ; preds = %.critedge
  %116 = getelementptr inbounds i8, ptr %0, i64 56
  store i32 %67, ptr %116, align 8, !tbaa !35
  %117 = add nsw i32 %67, 1
  %118 = getelementptr inbounds i8, ptr %0, i64 24
  %119 = load i32, ptr %118, align 8, !tbaa !29
  %120 = sub i32 %117, %119
  %121 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 %120, ptr %121, align 4, !tbaa !36
  %122 = icmp ugt i32 %119, %67
  br i1 %122, label %.thread203, label %123

123:                                              ; preds = %115
  %124 = getelementptr inbounds i8, ptr %0, i64 60
  %125 = load i32, ptr %124, align 4, !tbaa !37
  %.not176 = icmp eq i32 %125, 0
  br i1 %.not176, label %126, label %.thread201

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

.thread203:                                       ; preds = %.critedge, %115
  %127 = icmp eq i32 %67, 0
  br i1 %127, label %128, label %.thread205

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

.thread205:                                       ; preds = %.thread203, %128, %128
  %.0146208 = phi i32 [ 1, %128 ], [ 1, %128 ], [ %67, %.thread203 ]
  %131 = load ptr, ptr %24, align 8, !tbaa !22
  %132 = getelementptr inbounds i8, ptr %0, i64 16
  %133 = load i32, ptr %132, align 8, !tbaa !38
  %134 = add i32 %133, 1
  %135 = call i32 @sqlite3BtreeUpdateMeta(ptr noundef %131, i32 noundef 1, i32 noundef %134)
  %136 = icmp eq i32 %135, 0
  br i1 %136, label %137, label %.thread201

137:                                              ; preds = %.thread205
  %138 = load ptr, ptr %0, align 8, !tbaa !20
  %.not177 = icmp eq ptr %138, null
  br i1 %.not177, label %140, label %139

139:                                              ; preds = %137
  call void @sqlite3ResetAllSchemasOfConnection(ptr noundef nonnull %138)
  br label %140

140:                                              ; preds = %139, %137
  br i1 %65, label %141, label %.thread218

141:                                              ; preds = %140
  %142 = load ptr, ptr %24, align 8, !tbaa !22
  %143 = call i32 @sqlite3BtreeSetVersion(ptr noundef %142, i32 noundef 2)
  %144 = icmp eq i32 %143, 0
  br i1 %144, label %.thread218, label %.thread201

.thread218:                                       ; preds = %140, %141
  %145 = icmp slt i32 %58, %60
  br i1 %145, label %146, label %219

146:                                              ; preds = %.thread218
  %147 = sdiv i32 %60, %58
  %148 = add i32 %.0146208, -1
  %149 = add i32 %148, %147
  %150 = sdiv i32 %149, %147
  %151 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !30
  %152 = load ptr, ptr %24, align 8, !tbaa !22
  %153 = getelementptr inbounds i8, ptr %152, i64 8
  %154 = load ptr, ptr %153, align 8, !tbaa !23
  %155 = getelementptr inbounds i8, ptr %154, i64 52
  %156 = load i32, ptr %155, align 4, !tbaa !31
  %157 = udiv i32 %151, %156
  %158 = add i32 %157, 1
  %159 = icmp eq i32 %150, %158
  %160 = sext i1 %159 to i32
  %spec.select185 = add nsw i32 %150, %160
  %161 = sext i32 %58 to i64
  %162 = sext i32 %.0146208 to i64
  %163 = mul nsw i64 %162, %161
  %164 = 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)
  %165 = load i32, ptr %4, align 4
  %.not249 = icmp ugt i32 %spec.select185, %165
  br i1 %.not249, label %._crit_edge.thread, label %.lr.ph240

.lr.ph240:                                        ; preds = %146, %183
  %166 = phi i32 [ %184, %183 ], [ %165, %146 ]
  %.0144239 = phi i32 [ %185, %183 ], [ %spec.select185, %146 ]
  %167 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !30
  %168 = load ptr, ptr %24, align 8, !tbaa !22
  %169 = getelementptr inbounds i8, ptr %168, i64 8
  %170 = load ptr, ptr %169, align 8, !tbaa !23
  %171 = getelementptr inbounds i8, ptr %170, i64 52
  %172 = load i32, ptr %171, align 4, !tbaa !31
  %173 = udiv i32 %167, %172
  %174 = add i32 %173, 1
  %.not179 = icmp eq i32 %.0144239, %174
  br i1 %.not179, label %183, label %175

175:                                              ; preds = %.lr.ph240
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %176 = call i32 @sqlite3PagerGet(ptr noundef %26, i32 noundef %.0144239, ptr noundef nonnull %5, i32 noundef 0)
  %177 = icmp eq i32 %176, 0
  br i1 %177, label %178, label %182

178:                                              ; preds = %175
  %179 = load ptr, ptr %5, align 8, !tbaa !32
  %180 = call i32 @sqlite3PagerWrite(ptr noundef %179)
  %181 = load ptr, ptr %5, align 8, !tbaa !32
  call void @sqlite3PagerUnref(ptr noundef %181)
  br label %182

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

183:                                              ; preds = %.lr.ph240, %182
  %184 = phi i32 [ %.pre257, %182 ], [ %166, %.lr.ph240 ]
  %.14 = phi i32 [ %.13, %182 ], [ 0, %.lr.ph240 ]
  %185 = add i32 %.0144239, 1
  %186 = icmp eq i32 %.14, 0
  %187 = icmp ule i32 %185, %184
  %188 = select i1 %186, i1 %187, i1 false
  br i1 %188, label %.lr.ph240, label %._crit_edge, !llvm.loop !39

._crit_edge:                                      ; preds = %183
  br i1 %186, label %._crit_edge.thread, label %190

._crit_edge.thread:                               ; preds = %146, %._crit_edge
  %189 = call i32 @sqlite3PagerCommitPhaseOne(ptr noundef %26, ptr noundef null, i32 noundef 1)
  br label %190

190:                                              ; preds = %._crit_edge.thread, %._crit_edge
  %.15 = phi i32 [ %189, %._crit_edge.thread ], [ %.14, %._crit_edge ]
  %191 = load i32, ptr @sqlite3PendingByte, align 4, !tbaa !30
  %192 = add nsw i32 %191, %60
  %193 = sext i32 %192 to i64
  %. = call i64 @llvm.smin.i64(i64 %163, i64 %193)
  %194 = add nsw i32 %191, %58
  %195 = sext i32 %194 to i64
  %196 = icmp eq i32 %.15, 0
  %197 = icmp sgt i64 %., %195
  %198 = select i1 %196, i1 %197, i1 false
  br i1 %198, label %.lr.ph245, label %._crit_edge246

.lr.ph245:                                        ; preds = %190, %208
  %.0143243 = phi i64 [ %210, %208 ], [ %195, %190 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  store ptr null, ptr %6, align 8, !tbaa !32
  %199 = sdiv i64 %.0143243, %161
  %200 = trunc i64 %199 to i32
  %201 = add i32 %200, 1
  %202 = call i32 @sqlite3PagerGet(ptr noundef %23, i32 noundef %201, ptr noundef nonnull %6, i32 noundef 0)
  %203 = icmp eq i32 %202, 0
  br i1 %203, label %204, label %208

204:                                              ; preds = %.lr.ph245
  %205 = load ptr, ptr %6, align 8, !tbaa !32
  %206 = call ptr @sqlite3PagerGetData(ptr noundef %205)
  %207 = call i32 @sqlite3OsWrite(ptr noundef %164, ptr noundef %206, i32 noundef %58, i64 noundef %.0143243)
  br label %208

208:                                              ; preds = %204, %.lr.ph245
  %.17 = phi i32 [ %207, %204 ], [ %202, %.lr.ph245 ]
  %209 = load ptr, ptr %6, align 8, !tbaa !32
  call void @sqlite3PagerUnref(ptr noundef %209)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  %210 = add nsw i64 %.0143243, %161
  %211 = icmp eq i32 %.17, 0
  %212 = icmp slt i64 %210, %.
  %213 = select i1 %211, i1 %212, i1 false
  br i1 %213, label %.lr.ph245, label %._crit_edge246, !llvm.loop !40

._crit_edge246:                                   ; preds = %208, %190
  %.16.lcssa = phi i32 [ %.15, %190 ], [ %.17, %208 ]
  %.lcssa = phi i1 [ %196, %190 ], [ %211, %208 ]
  br i1 %.lcssa, label %214, label %.thread225

214:                                              ; preds = %._crit_edge246
  %215 = call i32 @backupTruncateFile(ptr noundef %164, i64 noundef %163)
  %216 = icmp eq i32 %215, 0
  br i1 %216, label %217, label %.thread225

217:                                              ; preds = %214
  %218 = call i32 @sqlite3PagerSync(ptr noundef %26, ptr noundef null)
  br label %.thread225

.thread225:                                       ; preds = %._crit_edge246, %217, %214
  %.19 = phi i32 [ %218, %217 ], [ %215, %214 ], [ %.16.lcssa, %._crit_edge246 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #3
  br label %223

219:                                              ; preds = %.thread218
  %220 = sdiv i32 %58, %60
  %221 = mul nsw i32 %220, %.0146208
  call void @sqlite3PagerTruncateImage(ptr noundef %26, i32 noundef %221)
  %222 = call i32 @sqlite3PagerCommitPhaseOne(ptr noundef %26, ptr noundef null, i32 noundef 0)
  br label %223

223:                                              ; preds = %219, %.thread225
  %.20 = phi i32 [ %.19, %.thread225 ], [ %222, %219 ]
  %224 = icmp eq i32 %.20, 0
  br i1 %224, label %225, label %.thread201

225:                                              ; preds = %223
  %226 = load ptr, ptr %24, align 8, !tbaa !22
  %227 = call i32 @sqlite3BtreeCommitPhaseTwo(ptr noundef %226, i32 noundef 0)
  %228 = icmp eq i32 %227, 0
  %spec.store.select = select i1 %228, i32 101, i32 %227
  br label %.thread201

.thread201:                                       ; preds = %.critedge, %128, %.thread205, %126, %123, %223, %225, %141
  %.22 = phi i32 [ %143, %141 ], [ %spec.store.select, %225 ], [ %.20, %223 ], [ 0, %123 ], [ 0, %126 ], [ %135, %.thread205 ], [ %130, %128 ], [ %.5.lcssa, %.critedge ]
  br i1 %.not178191195, label %234, label %229

229:                                              ; preds = %.thread201
  %230 = load ptr, ptr %11, align 8, !tbaa !19
  %231 = call i32 @sqlite3BtreeCommitPhaseOne(ptr noundef %230, ptr noundef null)
  %232 = load ptr, ptr %11, align 8, !tbaa !19
  %233 = call i32 @sqlite3BtreeCommitPhaseTwo(ptr noundef %232, i32 noundef 0)
  br label %234

234:                                              ; preds = %229, %.thread201
  %235 = icmp eq i32 %.22, 3082
  %spec.store.select6 = select i1 %235, i32 7, i32 %.22
  store i32 %spec.store.select6, ptr %18, align 8, !tbaa !21
  br label %236

236:                                              ; preds = %234, %17
  %.23 = phi i32 [ %19, %17 ], [ %spec.store.select6, %234 ]
  %237 = load ptr, ptr %0, align 8, !tbaa !20
  %.not181 = icmp eq ptr %237, null
  br i1 %.not181, label %241, label %238

238:                                              ; preds = %236
  %239 = getelementptr inbounds i8, ptr %237, i64 24
  %240 = load ptr, ptr %239, align 8, !tbaa !11
  call void @sqlite3_mutex_leave(ptr noundef %240)
  br label %241

241:                                              ; preds = %238, %236
  %242 = load ptr, ptr %11, align 8, !tbaa !19
  call void @sqlite3BtreeLeave(ptr noundef %242)
  %243 = load ptr, ptr %7, align 8, !tbaa !5
  %244 = getelementptr inbounds i8, ptr %243, i64 24
  %245 = load ptr, ptr %244, align 8, !tbaa !11
  call void @sqlite3_mutex_leave(ptr noundef %245)
  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 @sqlite3BtreeGetPageSize(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 @sqlite3BtreeLastPage(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 i32 @backupOnePage(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
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, !14, i64 92, !8, i64 94, !8, i64 95, !8, i64 96, !8, i64 97, !8, i64 98, !8, i64 99, !8, i64 100, !8, i64 101, !8, i64 102, !8, i64 103, !8, i64 104, !8, i64 105, !8, i64 106, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !8, i64 124, !10, i64 172, !15, i64 176, !10, i64 192, !10, i64 196, !10, i64 200, !10, i64 204, !10, i64 208, !10, i64 212, !7, i64 216, !8, i64 224, !7, i64 232, !7, 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, !8, i64 360, !16, i64 368, !7, i64 456, !7, i64 464, !7, i64 472, !7, i64 480, !10, i64 488, !10, i64 492, !17, i64 496, !7, i64 520, !7, i64 528, !7, i64 536, !17, i64 544, !17, i64 568, !18, i64 592, !8, i64 616, !7, i64 680, !10, i64 688, !10, i64 692, !10, i64 696, !10, i64 700, !13, i64 704, !13, i64 712, !7, i64 720}
!13 = !{!"long long", !8, i64 0}
!14 = !{!"short", !8, i64 0}
!15 = !{!"sqlite3InitInfo", !10, i64 0, !8, i64 4, !8, i64 5, !10, i64 6, !10, i64 6, !10, i64 6, !7, i64 8}
!16 = !{!"Lookaside", !10, i64 0, !14, i64 4, !14, 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}
!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, !14, i64 40, !14, i64 42, !14, i64 44, !14, i64 46, !14, 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}
!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