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

; 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.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 }
%struct.ExprList = type { i32, ptr }
%struct.ExprList_item = type { ptr, ptr, ptr, i8, i8, %union.anon.0 }
%union.anon.0 = type { i32 }
%struct.Expr = type { i8, i8, i32, %union.anon.3, ptr, ptr, %union.anon.4, i32, i32, i16, i16, i16, i8, ptr, ptr }
%union.anon.3 = type { ptr }
%union.anon.4 = type { ptr }

@.str.19 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [56 x i8], align 1

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

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

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

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

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

23:                                               ; preds = %5
  br label %183

24:                                               ; preds = %5
  %25 = load ptr, ptr %11, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.Table, ptr %25, i32 0, i32 9
  %27 = load i32, ptr %26, align 8, !tbaa !15
  %28 = and i32 %27, 4
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %35

30:                                               ; preds = %24
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = load ptr, ptr %11, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.Table, ptr %32, i32 0, i32 0
  %34 = load ptr, ptr %33, align 8, !tbaa !17
  call void (ptr, ptr, ...) @sqlite3ErrorMsg(ptr noundef %31, ptr noundef @.str.19, ptr noundef %34)
  br label %183

35:                                               ; preds = %24
  %36 = load ptr, ptr %11, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.Table, ptr %36, i32 0, i32 9
  %38 = load i32, ptr %37, align 8, !tbaa !15
  %39 = or i32 %38, 4
  store i32 %39, ptr %37, align 8, !tbaa !15
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = icmp eq ptr %40, null
  br i1 %41, label %42, label %60

42:                                               ; preds = %35
  %43 = load ptr, ptr %11, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.Table, ptr %43, i32 0, i32 11
  %45 = load i16, ptr %44, align 2, !tbaa !18
  %46 = sext i16 %45 to i32
  %47 = sub nsw i32 %46, 1
  store i32 %47, ptr %13, align 4, !tbaa !9
  %48 = load ptr, ptr %11, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.Table, ptr %48, i32 0, i32 1
  %50 = load ptr, ptr %49, align 8, !tbaa !19
  %51 = load i32, ptr %13, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds %struct.Column, ptr %50, i64 %52
  store ptr %53, ptr %12, align 8, !tbaa !5
  %54 = load ptr, ptr %12, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.Column, ptr %54, i32 0, i32 6
  %56 = load i8, ptr %55, align 1, !tbaa !20
  %57 = zext i8 %56 to i32
  %58 = or i32 %57, 1
  %59 = trunc i32 %58 to i8
  store i8 %59, ptr %55, align 1, !tbaa !20
  store i32 1, ptr %15, align 4, !tbaa !9
  br label %130

60:                                               ; preds = %35
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.ExprList, ptr %61, i32 0, i32 0
  %63 = load i32, ptr %62, align 8, !tbaa !22
  store i32 %63, ptr %15, align 4, !tbaa !9
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %126, %60
  %65 = load i32, ptr %14, align 4, !tbaa !9
  %66 = load i32, ptr %15, align 4, !tbaa !9
  %67 = icmp slt i32 %65, %66
  br i1 %67, label %68, label %129

68:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.ExprList, ptr %69, i32 0, i32 1
  %71 = load ptr, ptr %70, align 8, !tbaa !24
  %72 = load i32, ptr %14, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds %struct.ExprList_item, ptr %71, i64 %73
  %75 = getelementptr inbounds %struct.ExprList_item, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !25
  %77 = call ptr @sqlite3ExprSkipCollate(ptr noundef %76)
  store ptr %77, ptr %16, align 8, !tbaa !5
  %78 = load ptr, ptr %16, align 8, !tbaa !5
  call void @sqlite3StringToId(ptr noundef %78)
  %79 = load ptr, ptr %16, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.Expr, ptr %79, i32 0, i32 0
  %81 = load i8, ptr %80, align 8, !tbaa !27
  %82 = zext i8 %81 to i32
  %83 = icmp eq i32 %82, 55
  br i1 %83, label %84, label %125

84:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %85 = load ptr, ptr %16, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.Expr, ptr %85, i32 0, i32 3
  %87 = load ptr, ptr %86, align 8, !tbaa !29
  store ptr %87, ptr %17, align 8, !tbaa !5
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %88

88:                                               ; preds = %121, %84
  %89 = load i32, ptr %13, align 4, !tbaa !9
  %90 = load ptr, ptr %11, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.Table, ptr %90, i32 0, i32 11
  %92 = load i16, ptr %91, align 2, !tbaa !18
  %93 = sext i16 %92 to i32
  %94 = icmp slt i32 %89, %93
  br i1 %94, label %95, label %124

95:                                               ; preds = %88
  %96 = load ptr, ptr %17, align 8, !tbaa !5
  %97 = load ptr, ptr %11, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.Table, ptr %97, i32 0, i32 1
  %99 = load ptr, ptr %98, align 8, !tbaa !19
  %100 = load i32, ptr %13, align 4, !tbaa !9
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds %struct.Column, ptr %99, i64 %101
  %103 = getelementptr inbounds %struct.Column, ptr %102, i32 0, i32 0
  %104 = load ptr, ptr %103, align 8, !tbaa !30
  %105 = call i32 @sqlite3StrICmp(ptr noundef %96, ptr noundef %104)
  %106 = icmp eq i32 %105, 0
  br i1 %106, label %107, label %120

107:                                              ; preds = %95
  %108 = load ptr, ptr %11, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.Table, ptr %108, i32 0, i32 1
  %110 = load ptr, ptr %109, align 8, !tbaa !19
  %111 = load i32, ptr %13, align 4, !tbaa !9
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds %struct.Column, ptr %110, i64 %112
  store ptr %113, ptr %12, align 8, !tbaa !5
  %114 = load ptr, ptr %12, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.Column, ptr %114, i32 0, i32 6
  %116 = load i8, ptr %115, align 1, !tbaa !20
  %117 = zext i8 %116 to i32
  %118 = or i32 %117, 1
  %119 = trunc i32 %118 to i8
  store i8 %119, ptr %115, align 1, !tbaa !20
  br label %124

120:                                              ; preds = %95
  br label %121

121:                                              ; preds = %120
  %122 = load i32, ptr %13, align 4, !tbaa !9
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %13, align 4, !tbaa !9
  br label %88, !llvm.loop !31

124:                                              ; preds = %107, %88
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  br label %125

125:                                              ; preds = %124, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  br label %126

126:                                              ; preds = %125
  %127 = load i32, ptr %14, align 4, !tbaa !9
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %14, align 4, !tbaa !9
  br label %64, !llvm.loop !33

129:                                              ; preds = %64
  br label %130

130:                                              ; preds = %129, %42
  %131 = load i32, ptr %15, align 4, !tbaa !9
  %132 = icmp eq i32 %131, 1
  br i1 %132, label %133, label %171

133:                                              ; preds = %130
  %134 = load ptr, ptr %12, align 8, !tbaa !5
  %135 = icmp ne ptr %134, null
  br i1 %135, label %136, label %171

136:                                              ; preds = %133
  %137 = load ptr, ptr %12, align 8, !tbaa !5
  %138 = call ptr @sqlite3ColumnType(ptr noundef %137, ptr noundef @.str.20)
  %139 = call i32 @sqlite3StrICmp(ptr noundef %138, ptr noundef @.str.21)
  %140 = icmp eq i32 %139, 0
  br i1 %140, label %141, label %171

141:                                              ; preds = %136
  %142 = load i32, ptr %10, align 4, !tbaa !9
  %143 = icmp ne i32 %142, 1
  br i1 %143, label %144, label %171

144:                                              ; preds = %141
  %145 = load i32, ptr %13, align 4, !tbaa !9
  %146 = trunc i32 %145 to i16
  %147 = load ptr, ptr %11, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.Table, ptr %147, i32 0, i32 10
  store i16 %146, ptr %148, align 4, !tbaa !34
  %149 = load i32, ptr %8, align 4, !tbaa !9
  %150 = trunc i32 %149 to i8
  %151 = load ptr, ptr %11, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.Table, ptr %151, i32 0, i32 14
  store i8 %150, ptr %152, align 4, !tbaa !35
  %153 = load i32, ptr %9, align 4, !tbaa !9
  %154 = mul nsw i32 %153, 8
  %155 = load ptr, ptr %11, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.Table, ptr %155, i32 0, i32 9
  %157 = load i32, ptr %156, align 8, !tbaa !15
  %158 = or i32 %157, %154
  store i32 %158, ptr %156, align 8, !tbaa !15
  %159 = load ptr, ptr %7, align 8, !tbaa !5
  %160 = icmp ne ptr %159, null
  br i1 %160, label %161, label %170

161:                                              ; preds = %144
  %162 = load ptr, ptr %7, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.ExprList, ptr %162, i32 0, i32 1
  %164 = load ptr, ptr %163, align 8, !tbaa !24
  %165 = getelementptr inbounds %struct.ExprList_item, ptr %164, i64 0
  %166 = getelementptr inbounds %struct.ExprList_item, ptr %165, i32 0, i32 3
  %167 = load i8, ptr %166, align 8, !tbaa !36
  %168 = load ptr, ptr %6, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.Parse, ptr %168, i32 0, i32 51
  store i8 %167, ptr %169, align 2, !tbaa !37
  br label %170

170:                                              ; preds = %161, %144
  br label %182

171:                                              ; preds = %141, %136, %133, %130
  %172 = load i32, ptr %9, align 4, !tbaa !9
  %173 = icmp ne i32 %172, 0
  br i1 %173, label %174, label %176

174:                                              ; preds = %171
  %175 = load ptr, ptr %6, align 8, !tbaa !5
  call void (ptr, ptr, ...) @sqlite3ErrorMsg(ptr noundef %175, ptr noundef @.str.22)
  br label %181

176:                                              ; preds = %171
  %177 = load ptr, ptr %6, align 8, !tbaa !5
  %178 = load ptr, ptr %7, align 8, !tbaa !5
  %179 = load i32, ptr %8, align 4, !tbaa !9
  %180 = load i32, ptr %10, align 4, !tbaa !9
  call void @sqlite3CreateIndex(ptr noundef %177, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef %178, i32 noundef %179, ptr noundef null, ptr noundef null, i32 noundef %180, i32 noundef 0, i8 noundef zeroext 2)
  store ptr null, ptr %7, align 8, !tbaa !5
  br label %181

181:                                              ; preds = %176, %174
  br label %182

182:                                              ; preds = %181, %170
  br label %183

183:                                              ; preds = %182, %30, %23
  %184 = load ptr, ptr %6, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.Parse, ptr %184, i32 0, i32 0
  %186 = load ptr, ptr %185, align 8, !tbaa !38
  %187 = load ptr, ptr %7, align 8, !tbaa !5
  call void @sqlite3ExprListDelete(ptr noundef %186, ptr noundef %187)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  ret void
}

declare ptr @sqlite3ExprSkipCollate(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @sqlite3StringToId(ptr noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local void @sqlite3CreateIndex(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i8 noundef zeroext) #2

declare void @sqlite3ExprListDelete(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 = { 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 512}
!12 = !{!"Parse", !6, i64 0, !6, i64 8, !6, i64 16, !10, 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, !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, !6, i64 88, !6, i64 96, !13, i64 104, !10, i64 120, !10, i64 124, !10, i64 128, !10, i64 132, !10, i64 136, !10, i64 140, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !10, i64 176, !10, i64 180, !10, i64 184, !10, i64 188, !7, i64 192, !7, i64 193, !7, i64 194, !7, i64 196, !7, i64 396, !13, i64 432, !13, i64 448, !14, i64 464, !7, i64 466, !7, i64 467, !7, i64 468, !10, i64 472, !10, i64 476, !10, i64 480, !10, i64 484, !6, i64 488, !6, i64 496, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !13, i64 536, !6, i64 552, !6, i64 560, !6, i64 568, !6, i64 576, !6, i64 584}
!13 = !{!"Token", !6, i64 0, !10, i64 8}
!14 = !{!"short", !7, i64 0}
!15 = !{!16, !10, i64 64}
!16 = !{!"Table", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !10, i64 56, !10, i64 60, !10, i64 64, !14, i64 68, !14, i64 70, !14, i64 72, !14, i64 74, !7, i64 76, !10, i64 80, !10, i64 84, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120}
!17 = !{!16, !6, i64 0}
!18 = !{!16, !14, i64 70}
!19 = !{!16, !6, i64 8}
!20 = !{!21, !7, i64 27}
!21 = !{!"Column", !6, i64 0, !6, i64 8, !6, i64 16, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27}
!22 = !{!23, !10, i64 0}
!23 = !{!"ExprList", !10, i64 0, !6, i64 8}
!24 = !{!23, !6, i64 8}
!25 = !{!26, !6, i64 0}
!26 = !{!"ExprList_item", !6, i64 0, !6, i64 8, !6, i64 16, !7, i64 24, !10, i64 25, !10, i64 25, !10, i64 25, !7, i64 28}
!27 = !{!28, !7, i64 0}
!28 = !{!"Expr", !7, i64 0, !7, i64 1, !10, i64 4, !7, i64 8, !6, i64 16, !6, i64 24, !7, i64 32, !10, i64 40, !10, i64 44, !14, i64 48, !14, i64 50, !14, i64 52, !7, i64 54, !6, i64 56, !6, i64 64}
!29 = !{!7, !7, i64 0}
!30 = !{!21, !6, i64 0}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = distinct !{!33, !32}
!34 = !{!16, !14, i64 68}
!35 = !{!16, !7, i64 76}
!36 = !{!26, !7, i64 24}
!37 = !{!12, !7, i64 466}
!38 = !{!12, !6, i64 0}


; 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.ExprList_item = type { ptr, ptr, ptr, i8, i8, %union.anon.0 }
%union.anon.0 = type { i32 }

@.str.19 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [56 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local void @sqlite3AddPrimaryKey(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #1 {
  %6 = getelementptr inbounds i8, ptr %0, i64 512
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = icmp eq ptr %7, null
  br i1 %8, label %88, label %9

9:                                                ; preds = %5
  %10 = getelementptr inbounds i8, ptr %7, i64 64
  %11 = load i32, ptr %10, align 8, !tbaa !13
  %12 = and i32 %11, 4
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %15, label %13

13:                                               ; preds = %9
  %14 = load ptr, ptr %7, align 8, !tbaa !15
  tail call void (ptr, ptr, ...) @sqlite3ErrorMsg(ptr noundef nonnull %0, ptr noundef nonnull @.str.19, ptr noundef %14) #2
  br label %88

15:                                               ; preds = %9
  %16 = or disjoint i32 %11, 4
  store i32 %16, ptr %10, align 8, !tbaa !13
  %17 = icmp eq ptr %1, null
  br i1 %17, label %18, label %30

18:                                               ; preds = %15
  %19 = getelementptr inbounds i8, ptr %7, i64 70
  %20 = load i16, ptr %19, align 2, !tbaa !16
  %21 = sext i16 %20 to i32
  %22 = add nsw i32 %21, -1
  %23 = getelementptr inbounds i8, ptr %7, i64 8
  %24 = load ptr, ptr %23, align 8, !tbaa !17
  %25 = sext i32 %22 to i64
  %26 = getelementptr inbounds %struct.Column, ptr %24, i64 %25
  %27 = getelementptr inbounds i8, ptr %26, i64 27
  %28 = load i8, ptr %27, align 1, !tbaa !18
  %29 = or i8 %28, 1
  store i8 %29, ptr %27, align 1, !tbaa !18
  br label %.loopexit66

30:                                               ; preds = %15
  %31 = load i32, ptr %1, align 8, !tbaa !20
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %.lr.ph73, label %.loopexit66.thread

.lr.ph73:                                         ; preds = %30
  %33 = getelementptr inbounds i8, ptr %1, i64 8
  %34 = getelementptr inbounds i8, ptr %7, i64 70
  %35 = getelementptr inbounds i8, ptr %7, i64 8
  %wide.trip.count = zext nneg i32 %31 to i64
  br label %36

36:                                               ; preds = %.lr.ph73, %.loopexit
  %indvars.iv80 = phi i64 [ 0, %.lr.ph73 ], [ %indvars.iv.next81, %.loopexit ]
  %.05272 = phi ptr [ null, %.lr.ph73 ], [ %.2, %.loopexit ]
  %.05570 = phi i32 [ -1, %.lr.ph73 ], [ %.257, %.loopexit ]
  %37 = load ptr, ptr %33, align 8, !tbaa !22
  %38 = getelementptr inbounds %struct.ExprList_item, ptr %37, i64 %indvars.iv80
  %39 = load ptr, ptr %38, align 8, !tbaa !23
  %40 = tail call ptr @sqlite3ExprSkipCollate(ptr noundef %39) #2
  tail call void @sqlite3StringToId(ptr noundef %40)
  %41 = load i8, ptr %40, align 8, !tbaa !25
  %42 = icmp eq i8 %41, 55
  br i1 %42, label %43, label %.loopexit

43:                                               ; preds = %36
  %44 = getelementptr inbounds i8, ptr %40, i64 8
  %45 = load ptr, ptr %44, align 8, !tbaa !27
  %46 = load i16, ptr %34, align 2, !tbaa !16
  %47 = icmp sgt i16 %46, 0
  br i1 %47, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %43, %60
  %indvars.iv = phi i64 [ %indvars.iv.next, %60 ], [ 0, %43 ]
  %48 = load ptr, ptr %35, align 8, !tbaa !17
  %49 = getelementptr inbounds %struct.Column, ptr %48, i64 %indvars.iv
  %50 = load ptr, ptr %49, align 8, !tbaa !28
  %51 = tail call i32 @sqlite3StrICmp(ptr noundef %45, ptr noundef %50) #2
  %52 = icmp eq i32 %51, 0
  br i1 %52, label %53, label %60

53:                                               ; preds = %.lr.ph
  %54 = trunc nuw nsw i64 %indvars.iv to i32
  %55 = load ptr, ptr %35, align 8, !tbaa !17
  %56 = getelementptr inbounds %struct.Column, ptr %55, i64 %indvars.iv
  %57 = getelementptr inbounds i8, ptr %56, i64 27
  %58 = load i8, ptr %57, align 1, !tbaa !18
  %59 = or i8 %58, 1
  store i8 %59, ptr %57, align 1, !tbaa !18
  br label %.loopexit

60:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %61 = load i16, ptr %34, align 2, !tbaa !16
  %62 = sext i16 %61 to i64
  %63 = icmp slt i64 %indvars.iv.next, %62
  br i1 %63, label %.lr.ph, label %.loopexit.loopexit, !llvm.loop !29

.loopexit.loopexit:                               ; preds = %60
  %64 = trunc nuw nsw i64 %indvars.iv.next to i32
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %43, %53, %36
  %.257 = phi i32 [ %.05570, %36 ], [ %54, %53 ], [ 0, %43 ], [ %64, %.loopexit.loopexit ]
  %.2 = phi ptr [ %.05272, %36 ], [ %56, %53 ], [ %.05272, %43 ], [ %.05272, %.loopexit.loopexit ]
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next81, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit66.loopexit, label %36, !llvm.loop !31

.loopexit66.loopexit:                             ; preds = %.loopexit
  %65 = icmp eq i32 %31, 1
  br label %.loopexit66

.loopexit66:                                      ; preds = %.loopexit66.loopexit, %18
  %.358 = phi i32 [ %22, %18 ], [ %.257, %.loopexit66.loopexit ]
  %.053 = phi i1 [ true, %18 ], [ %65, %.loopexit66.loopexit ]
  %.3 = phi ptr [ %26, %18 ], [ %.2, %.loopexit66.loopexit ]
  %66 = icmp ne ptr %.3, null
  %or.cond = select i1 %.053, i1 %66, i1 false
  br i1 %or.cond, label %67, label %.loopexit66.thread

67:                                               ; preds = %.loopexit66
  %68 = tail call ptr @sqlite3ColumnType(ptr noundef nonnull %.3, ptr noundef nonnull @.str.20) #2
  %69 = tail call i32 @sqlite3StrICmp(ptr noundef %68, ptr noundef nonnull @.str.21) #2
  %70 = icmp eq i32 %69, 0
  %71 = icmp ne i32 %4, 1
  %or.cond3 = and i1 %71, %70
  br i1 %or.cond3, label %72, label %.loopexit66.thread

72:                                               ; preds = %67
  %73 = trunc i32 %.358 to i16
  %74 = getelementptr inbounds i8, ptr %7, i64 68
  store i16 %73, ptr %74, align 4, !tbaa !32
  %75 = trunc i32 %2 to i8
  %76 = getelementptr inbounds i8, ptr %7, i64 76
  store i8 %75, ptr %76, align 4, !tbaa !33
  %77 = shl nsw i32 %3, 3
  %78 = load i32, ptr %10, align 8, !tbaa !13
  %79 = or i32 %78, %77
  store i32 %79, ptr %10, align 8, !tbaa !13
  br i1 %17, label %88, label %80

80:                                               ; preds = %72
  %81 = getelementptr inbounds i8, ptr %1, i64 8
  %82 = load ptr, ptr %81, align 8, !tbaa !22
  %83 = getelementptr inbounds i8, ptr %82, i64 24
  %84 = load i8, ptr %83, align 8, !tbaa !34
  %85 = getelementptr inbounds i8, ptr %0, i64 466
  store i8 %84, ptr %85, align 2, !tbaa !35
  br label %88

.loopexit66.thread:                               ; preds = %30, %67, %.loopexit66
  %.not64 = icmp eq i32 %3, 0
  br i1 %.not64, label %87, label %86

86:                                               ; preds = %.loopexit66.thread
  tail call void (ptr, ptr, ...) @sqlite3ErrorMsg(ptr noundef %0, ptr noundef nonnull @.str.22) #2
  br label %88

87:                                               ; preds = %.loopexit66.thread
  tail call void @sqlite3CreateIndex(ptr noundef %0, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef %1, i32 noundef %2, ptr noundef null, ptr noundef null, i32 noundef %4, i32 noundef 0, i8 noundef zeroext 2)
  br label %88

88:                                               ; preds = %80, %72, %87, %86, %5, %13
  %.0 = phi ptr [ %1, %5 ], [ %1, %13 ], [ %1, %80 ], [ null, %72 ], [ %1, %86 ], [ null, %87 ]
  %89 = load ptr, ptr %0, align 8, !tbaa !36
  tail call void @sqlite3ExprListDelete(ptr noundef %89, ptr noundef %.0) #2
  ret void
}

declare ptr @sqlite3ExprSkipCollate(ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @sqlite3CreateIndex(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i8 noundef zeroext) local_unnamed_addr #1

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

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 = { 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 512}
!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, !10, i64 64}
!14 = !{!"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}
!15 = !{!14, !7, i64 0}
!16 = !{!14, !12, i64 70}
!17 = !{!14, !7, i64 8}
!18 = !{!19, !8, i64 27}
!19 = !{!"Column", !7, i64 0, !7, i64 8, !7, i64 16, !8, i64 24, !8, i64 25, !8, i64 26, !8, i64 27}
!20 = !{!21, !10, i64 0}
!21 = !{!"ExprList", !10, i64 0, !7, i64 8}
!22 = !{!21, !7, i64 8}
!23 = !{!24, !7, i64 0}
!24 = !{!"ExprList_item", !7, i64 0, !7, i64 8, !7, i64 16, !8, i64 24, !10, i64 25, !10, i64 25, !10, i64 25, !8, i64 28}
!25 = !{!26, !8, i64 0}
!26 = !{!"Expr", !8, i64 0, !8, i64 1, !10, i64 4, !8, i64 8, !7, i64 16, !7, i64 24, !8, i64 32, !10, i64 40, !10, i64 44, !12, i64 48, !12, i64 50, !12, i64 52, !8, i64 54, !7, i64 56, !7, i64 64}
!27 = !{!8, !8, i64 0}
!28 = !{!19, !7, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = distinct !{!31, !30}
!32 = !{!14, !12, i64 68}
!33 = !{!14, !8, i64 76}
!34 = !{!24, !8, i64 24}
!35 = !{!6, !8, i64 466}
!36 = !{!6, !7, i64 0}


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