; LLVM IR from ibr-ds/STANlite :: Enclave/sqlite (alter)

; 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.Parse = type { ptr, ptr, ptr, i32, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, %struct.Token, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i8, i8, i8, [10 x %struct.yColCache], [8 x i32], %struct.Token, %struct.Token, i16, i8, i8, i8, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, %struct.Token, ptr, ptr, ptr, ptr, ptr }
%struct.yColCache = type { i32, i16, i8, i32, i32, i32 }
%struct.Token = type { ptr, i32 }
%struct.sqlite3 = type { ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i64, 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, 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, i64, i64, ptr }
%struct.sqlite3InitInfo = type { i32, i8, i8, i8, i8 }
%union.anon.0 = type { double }
%struct.Lookaside = type { i32, i16, i8, i32, i32, [3 x i32], 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.SrcList = type { i32, i32, [1 x %struct.SrcList_item] }
%struct.SrcList_item = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, %struct.anon, i8, i32, ptr, ptr, i64, %union.anon.1, ptr }
%struct.anon = type { i8, i8, [2 x i8] }
%union.anon.1 = type { ptr }
%struct.Table = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i16, i16, i16, i16, i8, i32, i32, ptr, ptr, ptr, ptr, ptr }
%struct.Column = type { ptr, ptr, ptr, i8, i8, i8, i8 }

@.str.17 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [19 x i8], align 1

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

declare ptr @sqlite3LocateTableItem(ptr noundef, i32 noundef, ptr noundef) #1

declare i32 @sqlite3SchemaToIndex(ptr noundef, ptr noundef) #1

declare void @sqlite3ErrorMsg(ptr noundef, ptr noundef, ...) #1

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

declare ptr @sqlite3GetVdbe(ptr noundef) #1

declare void @sqlite3BeginWriteOperation(ptr noundef, i32 noundef, i32 noundef) #1

declare void @sqlite3ChangeCookie(ptr noundef, i32 noundef) #1

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

declare void @sqlite3SrcListDelete(ptr noundef, ptr noundef) #1

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

20:                                               ; preds = %2
  br label %174

21:                                               ; preds = %2
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.SrcList, ptr %23, i32 0, i32 2
  %25 = getelementptr inbounds [1 x %struct.SrcList_item], ptr %24, i64 0, i64 0
  %26 = call ptr @sqlite3LocateTableItem(ptr noundef %22, i32 noundef 0, ptr noundef %25)
  store ptr %26, ptr %6, align 8, !tbaa !5
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %30, label %29

29:                                               ; preds = %21
  br label %174

30:                                               ; preds = %21
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.Table, ptr %31, i32 0, i32 16
  %33 = load i32, ptr %32, align 4, !tbaa !21
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %37

35:                                               ; preds = %30
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  call void (ptr, ptr, ...) @sqlite3ErrorMsg(ptr noundef %36, ptr noundef @.str.17)
  br label %174

37:                                               ; preds = %30
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.Table, ptr %38, i32 0, i32 3
  %40 = load ptr, ptr %39, align 8, !tbaa !23
  %41 = icmp ne ptr %40, null
  br i1 %41, label %42, label %44

42:                                               ; preds = %37
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  call void (ptr, ptr, ...) @sqlite3ErrorMsg(ptr noundef %43, ptr noundef @.str.18)
  br label %174

44:                                               ; preds = %37
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.Table, ptr %46, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !24
  %49 = call i32 @isSystemTable(ptr noundef %45, ptr noundef %48)
  %50 = icmp ne i32 0, %49
  br i1 %50, label %51, label %52

51:                                               ; preds = %44
  br label %174

52:                                               ; preds = %44
  %53 = load ptr, ptr %11, align 8, !tbaa !5
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.Table, ptr %54, i32 0, i32 20
  %56 = load ptr, ptr %55, align 8, !tbaa !25
  %57 = call i32 @sqlite3SchemaToIndex(ptr noundef %53, ptr noundef %56)
  store i32 %57, ptr %8, align 4, !tbaa !26
  %58 = load ptr, ptr %11, align 8, !tbaa !5
  %59 = call ptr @sqlite3DbMallocZero(ptr noundef %58, i64 noundef 128)
  store ptr %59, ptr %5, align 8, !tbaa !5
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = icmp ne ptr %60, null
  br i1 %61, label %63, label %62

62:                                               ; preds = %52
  br label %174

63:                                               ; preds = %52
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.Parse, ptr %65, i32 0, i32 61
  store ptr %64, ptr %66, align 8, !tbaa !27
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.Table, ptr %67, i32 0, i32 8
  store i32 1, ptr %68, align 4, !tbaa !28
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.Table, ptr %69, i32 0, i32 11
  %71 = load i16, ptr %70, align 2, !tbaa !29
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.Table, ptr %72, i32 0, i32 11
  store i16 %71, ptr %73, align 2, !tbaa !29
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.Table, ptr %74, i32 0, i32 11
  %76 = load i16, ptr %75, align 2, !tbaa !29
  %77 = sext i16 %76 to i32
  %78 = sub nsw i32 %77, 1
  %79 = sdiv i32 %78, 8
  %80 = mul nsw i32 %79, 8
  %81 = add nsw i32 %80, 8
  store i32 %81, ptr %10, align 4, !tbaa !26
  %82 = load ptr, ptr %11, align 8, !tbaa !5
  %83 = load i32, ptr %10, align 4, !tbaa !26
  %84 = sext i32 %83 to i64
  %85 = mul i64 32, %84
  %86 = call ptr @sqlite3DbMallocZero(ptr noundef %82, i64 noundef %85)
  %87 = load ptr, ptr %5, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.Table, ptr %87, i32 0, i32 1
  store ptr %86, ptr %88, align 8, !tbaa !30
  %89 = load ptr, ptr %11, align 8, !tbaa !5
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.Table, ptr %90, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8, !tbaa !24
  %93 = call ptr (ptr, ptr, ...) @sqlite3MPrintf(ptr noundef %89, ptr noundef @.str.19, ptr noundef %92)
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.Table, ptr %94, i32 0, i32 0
  store ptr %93, ptr %95, align 8, !tbaa !24
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.Table, ptr %96, i32 0, i32 1
  %98 = load ptr, ptr %97, align 8, !tbaa !30
  %99 = icmp ne ptr %98, null
  br i1 %99, label %100, label %105

100:                                              ; preds = %63
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.Table, ptr %101, i32 0, i32 0
  %103 = load ptr, ptr %102, align 8, !tbaa !24
  %104 = icmp ne ptr %103, null
  br i1 %104, label %106, label %105

105:                                              ; preds = %100, %63
  br label %174

106:                                              ; preds = %100
  %107 = load ptr, ptr %5, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.Table, ptr %107, i32 0, i32 1
  %109 = load ptr, ptr %108, align 8, !tbaa !30
  %110 = load ptr, ptr %6, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.Table, ptr %110, i32 0, i32 1
  %112 = load ptr, ptr %111, align 8, !tbaa !30
  %113 = load ptr, ptr %5, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.Table, ptr %113, i32 0, i32 11
  %115 = load i16, ptr %114, align 2, !tbaa !29
  %116 = sext i16 %115 to i64
  %117 = mul i64 32, %116
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %109, ptr align 8 %112, i64 %117, i1 false)
  store i32 0, ptr %9, align 4, !tbaa !26
  br label %118

118:                                              ; preds = %143, %106
  %119 = load i32, ptr %9, align 4, !tbaa !26
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.Table, ptr %120, i32 0, i32 11
  %122 = load i16, ptr %121, align 2, !tbaa !29
  %123 = sext i16 %122 to i32
  %124 = icmp slt i32 %119, %123
  br i1 %124, label %125, label %146

125:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %126 = load ptr, ptr %5, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.Table, ptr %126, i32 0, i32 1
  %128 = load ptr, ptr %127, align 8, !tbaa !30
  %129 = load i32, ptr %9, align 4, !tbaa !26
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds %struct.Column, ptr %128, i64 %130
  store ptr %131, ptr %12, align 8, !tbaa !5
  %132 = load ptr, ptr %11, align 8, !tbaa !5
  %133 = load ptr, ptr %12, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.Column, ptr %133, i32 0, i32 0
  %135 = load ptr, ptr %134, align 8, !tbaa !31
  %136 = call ptr @sqlite3DbStrDup(ptr noundef %132, ptr noundef %135)
  %137 = load ptr, ptr %12, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.Column, ptr %137, i32 0, i32 0
  store ptr %136, ptr %138, align 8, !tbaa !31
  %139 = load ptr, ptr %12, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.Column, ptr %139, i32 0, i32 2
  store ptr null, ptr %140, align 8, !tbaa !33
  %141 = load ptr, ptr %12, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.Column, ptr %141, i32 0, i32 1
  store ptr null, ptr %142, align 8, !tbaa !34
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %143

143:                                              ; preds = %125
  %144 = load i32, ptr %9, align 4, !tbaa !26
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %9, align 4, !tbaa !26
  br label %118, !llvm.loop !35

146:                                              ; preds = %118
  %147 = load ptr, ptr %11, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.sqlite3, ptr %147, i32 0, i32 4
  %149 = load ptr, ptr %148, align 8, !tbaa !37
  %150 = load i32, ptr %8, align 4, !tbaa !26
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds %struct.Db, ptr %149, i64 %151
  %153 = getelementptr inbounds %struct.Db, ptr %152, i32 0, i32 4
  %154 = load ptr, ptr %153, align 8, !tbaa !38
  %155 = load ptr, ptr %5, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.Table, ptr %155, i32 0, i32 20
  store ptr %154, ptr %156, align 8, !tbaa !25
  %157 = load ptr, ptr %6, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.Table, ptr %157, i32 0, i32 15
  %159 = load i32, ptr %158, align 8, !tbaa !40
  %160 = load ptr, ptr %5, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.Table, ptr %160, i32 0, i32 15
  store i32 %159, ptr %161, align 8, !tbaa !40
  %162 = load ptr, ptr %5, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.Table, ptr %162, i32 0, i32 8
  store i32 1, ptr %163, align 4, !tbaa !28
  %164 = load ptr, ptr %3, align 8, !tbaa !5
  %165 = load i32, ptr %8, align 4, !tbaa !26
  call void @sqlite3BeginWriteOperation(ptr noundef %164, i32 noundef 0, i32 noundef %165)
  %166 = load ptr, ptr %3, align 8, !tbaa !5
  %167 = call ptr @sqlite3GetVdbe(ptr noundef %166)
  store ptr %167, ptr %7, align 8, !tbaa !5
  %168 = load ptr, ptr %7, align 8, !tbaa !5
  %169 = icmp ne ptr %168, null
  br i1 %169, label %171, label %170

170:                                              ; preds = %146
  br label %174

171:                                              ; preds = %146
  %172 = load ptr, ptr %3, align 8, !tbaa !5
  %173 = load i32, ptr %8, align 4, !tbaa !26
  call void @sqlite3ChangeCookie(ptr noundef %172, i32 noundef %173)
  br label %174

174:                                              ; preds = %171, %170, %105, %62, %51, %42, %35, %29, %20
  %175 = load ptr, ptr %11, align 8, !tbaa !5
  %176 = load ptr, ptr %4, align 8, !tbaa !5
  call void @sqlite3SrcListDelete(ptr noundef %175, ptr noundef %176)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret void
}

declare ptr @sqlite3DbMallocZero(ptr noundef, i64 noundef) #1

declare ptr @sqlite3MPrintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

declare ptr @sqlite3DbStrDup(ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"Parse", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !7, i64 28, !7, i64 29, !7, i64 30, !7, i64 31, !7, i64 32, !7, i64 33, !7, i64 34, !7, i64 35, !7, i64 36, !7, i64 37, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !6, i64 88, !6, i64 96, !12, i64 104, !11, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !11, i64 136, !11, i64 140, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !11, i64 176, !11, i64 180, !11, i64 184, !11, i64 188, !7, i64 192, !7, i64 193, !7, i64 194, !7, i64 196, !7, i64 396, !12, i64 432, !12, i64 448, !13, i64 464, !7, i64 466, !7, i64 467, !7, i64 468, !11, i64 472, !11, i64 476, !11, i64 480, !11, i64 484, !6, i64 488, !6, i64 496, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !12, i64 536, !6, i64 552, !6, i64 560, !6, i64 568, !6, i64 576, !6, i64 584}
!11 = !{!"int", !7, i64 0}
!12 = !{!"Token", !6, i64 0, !11, i64 8}
!13 = !{!"short", !7, i64 0}
!14 = !{!15, !7, i64 85}
!15 = !{!"sqlite3", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !11, i64 44, !16, i64 48, !16, i64 56, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !13, i64 80, !7, i64 82, !7, i64 83, !7, i64 84, !7, i64 85, !7, i64 86, !7, i64 87, !7, i64 88, !7, i64 89, !7, i64 90, !7, i64 91, !7, i64 92, !7, i64 93, !7, i64 94, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !7, i64 112, !11, i64 160, !17, i64 164, !11, i64 172, !11, i64 176, !11, i64 180, !11, i64 184, !11, i64 188, !11, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, 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, !7, i64 336, !18, i64 344, !6, i64 400, !6, i64 408, !6, i64 416, !6, i64 424, !11, i64 432, !11, i64 436, !19, i64 440, !6, i64 464, !6, i64 472, !6, i64 480, !19, i64 488, !19, i64 512, !20, i64 536, !7, i64 560, !6, i64 624, !11, i64 632, !11, i64 636, !11, i64 640, !16, i64 648, !16, i64 656, !6, i64 664}
!16 = !{!"long long", !7, i64 0}
!17 = !{!"sqlite3InitInfo", !11, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7}
!18 = !{!"Lookaside", !11, i64 0, !13, i64 4, !7, i64 6, !11, i64 8, !11, i64 12, !7, i64 16, !6, i64 32, !6, i64 40, !6, i64 48}
!19 = !{!"Hash", !11, i64 0, !11, i64 4, !6, i64 8, !6, i64 16}
!20 = !{!"BusyHandler", !6, i64 0, !6, i64 8, !11, i64 16}
!21 = !{!22, !11, i64 84}
!22 = !{!"Table", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !11, i64 56, !11, i64 60, !11, i64 64, !13, i64 68, !13, i64 70, !13, i64 72, !13, i64 74, !7, i64 76, !11, i64 80, !11, i64 84, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120}
!23 = !{!22, !6, i64 24}
!24 = !{!22, !6, i64 0}
!25 = !{!22, !6, i64 112}
!26 = !{!11, !11, i64 0}
!27 = !{!10, !6, i64 512}
!28 = !{!22, !11, i64 60}
!29 = !{!22, !13, i64 70}
!30 = !{!22, !6, i64 8}
!31 = !{!32, !6, i64 0}
!32 = !{!"Column", !6, i64 0, !6, i64 8, !6, i64 16, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27}
!33 = !{!32, !6, i64 16}
!34 = !{!32, !6, i64 8}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}
!37 = !{!15, !6, i64 32}
!38 = !{!39, !6, i64 24}
!39 = !{!"Db", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 17, !6, i64 24}
!40 = !{!22, !11, i64 80}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Column = type { ptr, ptr, ptr, i8, i8, i8, i8 }
%struct.Db = type { ptr, ptr, i8, i8, ptr }

@.str.17 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [19 x i8], align 1

declare ptr @sqlite3LocateTableItem(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

declare i32 @sqlite3SchemaToIndex(ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @sqlite3ErrorMsg(ptr noundef, ptr noundef, ...) local_unnamed_addr #0

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

declare ptr @sqlite3GetVdbe(ptr noundef) local_unnamed_addr #0

declare void @sqlite3BeginWriteOperation(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

declare void @sqlite3ChangeCookie(ptr noundef, i32 noundef) local_unnamed_addr #0

declare void @sqlite3SrcListDelete(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @sqlite3AlterBeginAddColumn(ptr noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = load ptr, ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 85
  %5 = load i8, ptr %4, align 1, !tbaa !13
  %.not = icmp eq i8 %5, 0
  br i1 %.not, label %6, label %70

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %1, i64 8
  %8 = tail call ptr @sqlite3LocateTableItem(ptr noundef nonnull %0, i32 noundef 0, ptr noundef nonnull %7) #4
  %.not58 = icmp eq ptr %8, null
  br i1 %.not58, label %70, label %9

9:                                                ; preds = %6
  %10 = getelementptr inbounds i8, ptr %8, i64 84
  %11 = load i32, ptr %10, align 4, !tbaa !20
  %.not59 = icmp eq i32 %11, 0
  br i1 %.not59, label %13, label %12

12:                                               ; preds = %9
  tail call void (ptr, ptr, ...) @sqlite3ErrorMsg(ptr noundef nonnull %0, ptr noundef nonnull @.str.17) #4
  br label %70

13:                                               ; preds = %9
  %14 = getelementptr inbounds i8, ptr %8, i64 24
  %15 = load ptr, ptr %14, align 8, !tbaa !22
  %.not60 = icmp eq ptr %15, null
  br i1 %.not60, label %17, label %16

16:                                               ; preds = %13
  tail call void (ptr, ptr, ...) @sqlite3ErrorMsg(ptr noundef nonnull %0, ptr noundef nonnull @.str.18) #4
  br label %70

17:                                               ; preds = %13
  %18 = load ptr, ptr %8, align 8, !tbaa !23
  %19 = tail call i32 @isSystemTable(ptr noundef nonnull %0, ptr noundef %18)
  %.not61 = icmp eq i32 %19, 0
  br i1 %.not61, label %20, label %70

20:                                               ; preds = %17
  %21 = getelementptr inbounds i8, ptr %8, i64 112
  %22 = load ptr, ptr %21, align 8, !tbaa !24
  %23 = tail call i32 @sqlite3SchemaToIndex(ptr noundef nonnull %3, ptr noundef %22) #4
  %24 = tail call ptr @sqlite3DbMallocZero(ptr noundef nonnull %3, i64 noundef 128) #4
  %.not62 = icmp eq ptr %24, null
  br i1 %.not62, label %70, label %25

25:                                               ; preds = %20
  %26 = getelementptr inbounds i8, ptr %0, i64 512
  store ptr %24, ptr %26, align 8, !tbaa !25
  %27 = getelementptr inbounds i8, ptr %24, i64 60
  store i32 1, ptr %27, align 4, !tbaa !26
  %28 = getelementptr inbounds i8, ptr %8, i64 70
  %29 = load i16, ptr %28, align 2, !tbaa !27
  %30 = getelementptr inbounds i8, ptr %24, i64 70
  store i16 %29, ptr %30, align 2, !tbaa !27
  %31 = sext i16 %29 to i32
  %32 = add nsw i32 %31, -1
  %33 = sdiv i32 %32, 8
  %34 = shl nsw i32 %33, 3
  %35 = add nsw i32 %34, 8
  %36 = sext i32 %35 to i64
  %37 = shl nsw i64 %36, 5
  %38 = tail call ptr @sqlite3DbMallocZero(ptr noundef nonnull %3, i64 noundef %37) #4
  %39 = getelementptr inbounds i8, ptr %24, i64 8
  store ptr %38, ptr %39, align 8, !tbaa !28
  %40 = load ptr, ptr %8, align 8, !tbaa !23
  %41 = tail call ptr (ptr, ptr, ...) @sqlite3MPrintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.19, ptr noundef %40) #4
  store ptr %41, ptr %24, align 8, !tbaa !23
  %42 = load ptr, ptr %39, align 8, !tbaa !28
  %.not63 = icmp eq ptr %42, null
  %.not64 = icmp eq ptr %41, null
  %or.cond = select i1 %.not63, i1 true, i1 %.not64
  br i1 %or.cond, label %70, label %43

43:                                               ; preds = %25
  %44 = getelementptr inbounds i8, ptr %8, i64 8
  %45 = load ptr, ptr %44, align 8, !tbaa !28
  %46 = load i16, ptr %30, align 2, !tbaa !27
  %47 = sext i16 %46 to i64
  %48 = shl nsw i64 %47, 5
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 %42, ptr align 8 %45, i64 %48, i1 false)
  %49 = load i16, ptr %30, align 2, !tbaa !27
  %50 = icmp sgt i16 %49, 0
  br i1 %50, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %43, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %43 ]
  %51 = load ptr, ptr %39, align 8, !tbaa !28
  %52 = getelementptr inbounds %struct.Column, ptr %51, i64 %indvars.iv
  %53 = load ptr, ptr %52, align 8, !tbaa !29
  %54 = tail call ptr @sqlite3DbStrDup(ptr noundef %3, ptr noundef %53) #4
  store ptr %54, ptr %52, align 8, !tbaa !29
  %55 = getelementptr inbounds i8, ptr %52, i64 8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %55, i8 0, i64 16, i1 false)
  %56 = load i16, ptr %30, align 2, !tbaa !27
  %57 = sext i16 %56 to i64
  %58 = icmp slt i64 %indvars.iv.next, %57
  br i1 %58, label %.lr.ph, label %._crit_edge, !llvm.loop !31

._crit_edge:                                      ; preds = %.lr.ph, %43
  %59 = getelementptr inbounds i8, ptr %3, i64 32
  %60 = load ptr, ptr %59, align 8, !tbaa !33
  %61 = sext i32 %23 to i64
  %62 = getelementptr inbounds %struct.Db, ptr %60, i64 %61, i32 4
  %63 = load ptr, ptr %62, align 8, !tbaa !34
  %64 = getelementptr inbounds i8, ptr %24, i64 112
  store ptr %63, ptr %64, align 8, !tbaa !24
  %65 = getelementptr inbounds i8, ptr %8, i64 80
  %66 = load i32, ptr %65, align 8, !tbaa !36
  %67 = getelementptr inbounds i8, ptr %24, i64 80
  store i32 %66, ptr %67, align 8, !tbaa !36
  store i32 1, ptr %27, align 4, !tbaa !26
  tail call void @sqlite3BeginWriteOperation(ptr noundef nonnull %0, i32 noundef 0, i32 noundef %23) #4
  %68 = tail call ptr @sqlite3GetVdbe(ptr noundef nonnull %0) #4
  %.not65 = icmp eq ptr %68, null
  br i1 %.not65, label %70, label %69

69:                                               ; preds = %._crit_edge
  tail call void @sqlite3ChangeCookie(ptr noundef nonnull %0, i32 noundef %23) #4
  br label %70

70:                                               ; preds = %._crit_edge, %25, %20, %17, %6, %2, %69, %16, %12
  tail call void @sqlite3SrcListDelete(ptr noundef nonnull %3, ptr noundef %1) #4
  ret void
}

declare ptr @sqlite3DbMallocZero(ptr noundef, i64 noundef) local_unnamed_addr #0

declare ptr @sqlite3MPrintf(ptr noundef, ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

declare ptr @sqlite3DbStrDup(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"Parse", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !8, i64 28, !8, i64 29, !8, i64 30, !8, i64 31, !8, i64 32, !8, i64 33, !8, i64 34, !8, i64 35, !8, i64 36, !8, i64 37, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !7, i64 88, !7, i64 96, !11, i64 104, !10, i64 120, !10, i64 124, !10, i64 128, !10, i64 132, !10, i64 136, !10, i64 140, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !10, i64 176, !10, i64 180, !10, i64 184, !10, i64 188, !8, i64 192, !8, i64 193, !8, i64 194, !8, i64 196, !8, i64 396, !11, i64 432, !11, i64 448, !12, i64 464, !8, i64 466, !8, i64 467, !8, i64 468, !10, i64 472, !10, i64 476, !10, i64 480, !10, i64 484, !7, i64 488, !7, i64 496, !7, i64 504, !7, i64 512, !7, i64 520, !7, i64 528, !11, i64 536, !7, i64 552, !7, i64 560, !7, i64 568, !7, i64 576, !7, i64 584}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"Token", !7, i64 0, !10, i64 8}
!12 = !{!"short", !8, i64 0}
!13 = !{!14, !8, i64 85}
!14 = !{!"sqlite3", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40, !10, i64 44, !15, i64 48, !15, i64 56, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !12, i64 80, !8, i64 82, !8, i64 83, !8, i64 84, !8, i64 85, !8, i64 86, !8, i64 87, !8, i64 88, !8, i64 89, !8, i64 90, !8, i64 91, !8, i64 92, !8, i64 93, !8, i64 94, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !8, i64 112, !10, i64 160, !16, i64 164, !10, i64 172, !10, i64 176, !10, i64 180, !10, i64 184, !10, i64 188, !10, i64 192, !7, i64 200, !7, i64 208, !7, i64 216, !7, 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, !8, i64 336, !17, i64 344, !7, i64 400, !7, i64 408, !7, i64 416, !7, i64 424, !10, i64 432, !10, i64 436, !18, i64 440, !7, i64 464, !7, i64 472, !7, i64 480, !18, i64 488, !18, i64 512, !19, i64 536, !8, i64 560, !7, i64 624, !10, i64 632, !10, i64 636, !10, i64 640, !15, i64 648, !15, i64 656, !7, i64 664}
!15 = !{!"long long", !8, i64 0}
!16 = !{!"sqlite3InitInfo", !10, i64 0, !8, i64 4, !8, i64 5, !8, i64 6, !8, i64 7}
!17 = !{!"Lookaside", !10, i64 0, !12, i64 4, !8, i64 6, !10, i64 8, !10, i64 12, !8, i64 16, !7, i64 32, !7, i64 40, !7, i64 48}
!18 = !{!"Hash", !10, i64 0, !10, i64 4, !7, i64 8, !7, i64 16}
!19 = !{!"BusyHandler", !7, i64 0, !7, i64 8, !10, i64 16}
!20 = !{!21, !10, i64 84}
!21 = !{!"Table", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !10, i64 56, !10, i64 60, !10, i64 64, !12, i64 68, !12, i64 70, !12, i64 72, !12, i64 74, !8, i64 76, !10, i64 80, !10, i64 84, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120}
!22 = !{!21, !7, i64 24}
!23 = !{!21, !7, i64 0}
!24 = !{!21, !7, i64 112}
!25 = !{!6, !7, i64 512}
!26 = !{!21, !10, i64 60}
!27 = !{!21, !12, i64 70}
!28 = !{!21, !7, i64 8}
!29 = !{!30, !7, i64 0}
!30 = !{!"Column", !7, i64 0, !7, i64 8, !7, i64 16, !8, i64 24, !8, i64 25, !8, i64 26, !8, i64 27}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = !{!14, !7, i64 32}
!34 = !{!35, !7, i64 24}
!35 = !{!"Db", !7, i64 0, !7, i64 8, !8, i64 16, !8, i64 17, !7, i64 24}
!36 = !{!21, !10, i64 80}


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