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

; 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.Expr = type { i8, i8, i32, %union.anon.0, ptr, ptr, %union.anon.1, i32, i32, i16, i16, i16, i8, ptr, ptr }
%union.anon.0 = type { ptr }
%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.VTable = type { ptr, ptr, ptr, i32, i8, i32, ptr }
%struct.sqlite3_vtab = type { ptr, i32, ptr }
%struct.sqlite3_module = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.FuncDef = type { i8, i16, ptr, ptr, ptr, ptr, ptr, %union.anon.2 }
%union.anon.2 = type { ptr }

@sqlite3UpperToLower = external constant [0 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 i32 @sqlite3Strlen30(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) #2

declare void @sqlite3DbFree(ptr noundef, 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 dso_local ptr @sqlite3GetVTable(ptr noundef, ptr noundef) #3

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

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

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

22:                                               ; preds = %4
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %23, ptr %5, align 8
  store i32 1, ptr %19, align 4
  br label %146

24:                                               ; preds = %4
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.Expr, ptr %25, i32 0, i32 0
  %27 = load i8, ptr %26, align 8, !tbaa !11
  %28 = zext i8 %27 to i32
  %29 = icmp ne i32 %28, 152
  br i1 %29, label %30, label %32

30:                                               ; preds = %24
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %31, ptr %5, align 8
  store i32 1, ptr %19, align 4
  br label %146

32:                                               ; preds = %24
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.Expr, ptr %33, i32 0, i32 14
  %35 = load ptr, ptr %34, align 8, !tbaa !14
  store ptr %35, ptr %10, align 8, !tbaa !5
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  %37 = icmp eq ptr %36, null
  br i1 %37, label %38, label %40

38:                                               ; preds = %32
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %39, ptr %5, align 8
  store i32 1, ptr %19, align 4
  br label %146

40:                                               ; preds = %32
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.Table, ptr %41, i32 0, i32 16
  %43 = load i32, ptr %42, align 4, !tbaa !15
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %47, label %45

45:                                               ; preds = %40
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %46, ptr %5, align 8
  store i32 1, ptr %19, align 4
  br label %146

47:                                               ; preds = %40
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = load ptr, ptr %10, align 8, !tbaa !5
  %50 = call ptr @sqlite3GetVTable(ptr noundef %48, ptr noundef %49)
  %51 = getelementptr inbounds %struct.VTable, ptr %50, i32 0, i32 2
  %52 = load ptr, ptr %51, align 8, !tbaa !17
  store ptr %52, ptr %11, align 8, !tbaa !5
  %53 = load ptr, ptr %11, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.sqlite3_vtab, ptr %53, i32 0, i32 0
  %55 = load ptr, ptr %54, align 8, !tbaa !19
  store ptr %55, ptr %12, align 8, !tbaa !5
  %56 = load ptr, ptr %12, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.sqlite3_module, ptr %56, i32 0, i32 18
  %58 = load ptr, ptr %57, align 8, !tbaa !21
  %59 = icmp eq ptr %58, null
  br i1 %59, label %60, label %62

60:                                               ; preds = %47
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %61, ptr %5, align 8
  store i32 1, ptr %19, align 4
  br label %146

62:                                               ; preds = %47
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.FuncDef, ptr %64, i32 0, i32 6
  %66 = load ptr, ptr %65, align 8, !tbaa !23
  %67 = call ptr @sqlite3DbStrDup(ptr noundef %63, ptr noundef %66)
  store ptr %67, ptr %17, align 8, !tbaa !5
  %68 = load ptr, ptr %17, align 8, !tbaa !5
  %69 = icmp ne ptr %68, null
  br i1 %69, label %70, label %96

70:                                               ; preds = %62
  %71 = load ptr, ptr %17, align 8, !tbaa !5
  store ptr %71, ptr %18, align 8, !tbaa !5
  br label %72

72:                                               ; preds = %83, %70
  %73 = load ptr, ptr %18, align 8, !tbaa !5
  %74 = load i8, ptr %73, align 1, !tbaa !25
  %75 = icmp ne i8 %74, 0
  br i1 %75, label %76, label %86

76:                                               ; preds = %72
  %77 = load ptr, ptr %18, align 8, !tbaa !5
  %78 = load i8, ptr %77, align 1, !tbaa !25
  %79 = zext i8 %78 to i64
  %80 = getelementptr inbounds [0 x i8], ptr @sqlite3UpperToLower, i64 0, i64 %79
  %81 = load i8, ptr %80, align 1, !tbaa !25
  %82 = load ptr, ptr %18, align 8, !tbaa !5
  store i8 %81, ptr %82, align 1, !tbaa !25
  br label %83

83:                                               ; preds = %76
  %84 = load ptr, ptr %18, align 8, !tbaa !5
  %85 = getelementptr inbounds i8, ptr %84, i32 1
  store ptr %85, ptr %18, align 8, !tbaa !5
  br label %72, !llvm.loop !26

86:                                               ; preds = %72
  %87 = load ptr, ptr %12, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.sqlite3_module, ptr %87, i32 0, i32 18
  %89 = load ptr, ptr %88, align 8, !tbaa !21
  %90 = load ptr, ptr %11, align 8, !tbaa !5
  %91 = load i32, ptr %8, align 4, !tbaa !9
  %92 = load ptr, ptr %17, align 8, !tbaa !5
  %93 = call i32 %89(ptr noundef %90, i32 noundef %91, ptr noundef %92, ptr noundef %13, ptr noundef %14)
  store i32 %93, ptr %16, align 4, !tbaa !9
  %94 = load ptr, ptr %6, align 8, !tbaa !5
  %95 = load ptr, ptr %17, align 8, !tbaa !5
  call void @sqlite3DbFree(ptr noundef %94, ptr noundef %95)
  br label %96

96:                                               ; preds = %86, %62
  %97 = load i32, ptr %16, align 4, !tbaa !9
  %98 = icmp eq i32 %97, 0
  br i1 %98, label %99, label %101

99:                                               ; preds = %96
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %100, ptr %5, align 8
  store i32 1, ptr %19, align 4
  br label %146

101:                                              ; preds = %96
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.FuncDef, ptr %103, i32 0, i32 6
  %105 = load ptr, ptr %104, align 8, !tbaa !23
  %106 = call i32 @sqlite3Strlen30(ptr noundef %105)
  %107 = sext i32 %106 to i64
  %108 = add i64 56, %107
  %109 = add i64 %108, 1
  %110 = call ptr @sqlite3DbMallocZero(ptr noundef %102, i64 noundef %109)
  store ptr %110, ptr %15, align 8, !tbaa !5
  %111 = load ptr, ptr %15, align 8, !tbaa !5
  %112 = icmp eq ptr %111, null
  br i1 %112, label %113, label %115

113:                                              ; preds = %101
  %114 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %114, ptr %5, align 8
  store i32 1, ptr %19, align 4
  br label %146

115:                                              ; preds = %101
  %116 = load ptr, ptr %15, align 8, !tbaa !5
  %117 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %116, ptr align 8 %117, i64 56, i1 false), !tbaa.struct !28
  %118 = load ptr, ptr %15, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.FuncDef, ptr %118, i64 1
  %120 = load ptr, ptr %15, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.FuncDef, ptr %120, i32 0, i32 6
  store ptr %119, ptr %121, align 8, !tbaa !23
  %122 = load ptr, ptr %15, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.FuncDef, ptr %122, i64 1
  %124 = load ptr, ptr %7, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.FuncDef, ptr %124, i32 0, i32 6
  %126 = load ptr, ptr %125, align 8, !tbaa !23
  %127 = load ptr, ptr %7, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.FuncDef, ptr %127, i32 0, i32 6
  %129 = load ptr, ptr %128, align 8, !tbaa !23
  %130 = call i32 @sqlite3Strlen30(ptr noundef %129)
  %131 = add nsw i32 %130, 1
  %132 = sext i32 %131 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %123, ptr align 1 %126, i64 %132, i1 false)
  %133 = load ptr, ptr %13, align 8, !tbaa !5
  %134 = load ptr, ptr %15, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.FuncDef, ptr %134, i32 0, i32 4
  store ptr %133, ptr %135, align 8, !tbaa !30
  %136 = load ptr, ptr %14, align 8, !tbaa !5
  %137 = load ptr, ptr %15, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.FuncDef, ptr %137, i32 0, i32 2
  store ptr %136, ptr %138, align 8, !tbaa !31
  %139 = load ptr, ptr %15, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.FuncDef, ptr %139, i32 0, i32 1
  %141 = load i16, ptr %140, align 2, !tbaa !32
  %142 = zext i16 %141 to i32
  %143 = or i32 %142, 16
  %144 = trunc i32 %143 to i16
  store i16 %144, ptr %140, align 2, !tbaa !32
  %145 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %145, ptr %5, align 8
  store i32 1, ptr %19, align 4
  br label %146

146:                                              ; preds = %115, %113, %99, %60, %45, %38, %30, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %147 = load ptr, ptr %5, align 8
  ret ptr %147
}

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !7, i64 0}
!12 = !{!"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, !13, i64 48, !13, i64 50, !13, i64 52, !7, i64 54, !6, i64 56, !6, i64 64}
!13 = !{!"short", !7, i64 0}
!14 = !{!12, !6, i64 64}
!15 = !{!16, !10, i64 84}
!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, !13, i64 68, !13, i64 70, !13, i64 72, !13, 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 = !{!18, !6, i64 16}
!18 = !{!"VTable", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !7, i64 28, !10, i64 32, !6, i64 40}
!19 = !{!20, !6, i64 0}
!20 = !{!"sqlite3_vtab", !6, i64 0, !10, i64 8, !6, i64 16}
!21 = !{!22, !6, i64 144}
!22 = !{!"sqlite3_module", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176}
!23 = !{!24, !6, i64 40}
!24 = !{!"FuncDef", !7, i64 0, !13, i64 2, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !7, i64 48}
!25 = !{!7, !7, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{i64 0, i64 1, !25, i64 2, i64 2, !29, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 8, !5, i64 32, i64 8, !5, i64 40, i64 8, !5, i64 48, i64 8, !25}
!29 = !{!13, !13, i64 0}
!30 = !{!24, !6, i64 24}
!31 = !{!24, !6, i64 8}
!32 = !{!24, !13, i64 2}


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

@sqlite3UpperToLower = external local_unnamed_addr constant [0 x i8], align 1

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

declare i32 @sqlite3Strlen30(ptr noundef) local_unnamed_addr #1

; 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 void @sqlite3DbFree(ptr noundef, 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 dso_local ptr @sqlite3GetVTable(ptr noundef, ptr noundef) local_unnamed_addr #3

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @sqlite3VtabOverloadFunction(ptr noundef %0, ptr noundef readonly %1, i32 noundef %2, ptr noundef readonly %3) local_unnamed_addr #3 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  store ptr null, ptr %6, align 8, !tbaa !5
  %7 = icmp eq ptr %3, null
  br i1 %7, label %.critedge, label %8

8:                                                ; preds = %4
  %9 = load i8, ptr %3, align 8, !tbaa !9
  %.not = icmp eq i8 %9, -104
  br i1 %.not, label %10, label %.critedge

10:                                               ; preds = %8
  %11 = getelementptr inbounds i8, ptr %3, i64 64
  %12 = load ptr, ptr %11, align 8, !tbaa !13
  %13 = icmp eq ptr %12, null
  br i1 %13, label %.critedge, label %14

14:                                               ; preds = %10
  %15 = getelementptr inbounds i8, ptr %12, i64 84
  %16 = load i32, ptr %15, align 4, !tbaa !14
  %.not52 = icmp eq i32 %16, 0
  br i1 %.not52, label %.critedge, label %17

17:                                               ; preds = %14
  %18 = tail call ptr @sqlite3GetVTable(ptr noundef %0, ptr noundef nonnull %12)
  %19 = getelementptr inbounds i8, ptr %18, i64 16
  %20 = load ptr, ptr %19, align 8, !tbaa !16
  %21 = load ptr, ptr %20, align 8, !tbaa !18
  %22 = getelementptr inbounds i8, ptr %21, i64 144
  %23 = load ptr, ptr %22, align 8, !tbaa !20
  %24 = icmp eq ptr %23, null
  br i1 %24, label %.critedge, label %25

25:                                               ; preds = %17
  %26 = getelementptr inbounds i8, ptr %1, i64 40
  %27 = load ptr, ptr %26, align 8, !tbaa !22
  %28 = tail call ptr @sqlite3DbStrDup(ptr noundef %0, ptr noundef %27) #4
  %.not53 = icmp eq ptr %28, null
  br i1 %.not53, label %.critedge, label %.preheader

.preheader:                                       ; preds = %25
  %29 = load i8, ptr %28, align 1, !tbaa !24
  %.not5455 = icmp eq i8 %29, 0
  br i1 %.not5455, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %30 = phi i8 [ %35, %.lr.ph ], [ %29, %.preheader ]
  %.056 = phi ptr [ %34, %.lr.ph ], [ %28, %.preheader ]
  %31 = zext i8 %30 to i64
  %32 = getelementptr inbounds [0 x i8], ptr @sqlite3UpperToLower, i64 0, i64 %31
  %33 = load i8, ptr %32, align 1, !tbaa !24
  store i8 %33, ptr %.056, align 1, !tbaa !24
  %34 = getelementptr inbounds i8, ptr %.056, i64 1
  %35 = load i8, ptr %34, align 1, !tbaa !24
  %.not54 = icmp eq i8 %35, 0
  br i1 %.not54, label %._crit_edge, label %.lr.ph, !llvm.loop !25

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %36 = load ptr, ptr %22, align 8, !tbaa !20
  %37 = call i32 %36(ptr noundef nonnull %20, i32 noundef %2, ptr noundef nonnull %28, ptr noundef nonnull %5, ptr noundef nonnull %6) #4
  call void @sqlite3DbFree(ptr noundef %0, ptr noundef nonnull %28) #4
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %.critedge, label %39

39:                                               ; preds = %._crit_edge
  %40 = load ptr, ptr %26, align 8, !tbaa !22
  %41 = call i32 @sqlite3Strlen30(ptr noundef %40) #4
  %42 = sext i32 %41 to i64
  %43 = add nsw i64 %42, 57
  %44 = call ptr @sqlite3DbMallocZero(ptr noundef %0, i64 noundef %43) #4
  %45 = icmp eq ptr %44, null
  br i1 %45, label %.critedge, label %46

46:                                               ; preds = %39
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %44, ptr noundef nonnull align 8 dereferenceable(56) %1, i64 56, i1 false), !tbaa.struct !27
  %47 = getelementptr inbounds i8, ptr %44, i64 56
  %48 = getelementptr inbounds i8, ptr %44, i64 40
  store ptr %47, ptr %48, align 8, !tbaa !22
  %49 = load ptr, ptr %26, align 8, !tbaa !22
  %50 = call i32 @sqlite3Strlen30(ptr noundef %49) #4
  %51 = add nsw i32 %50, 1
  %52 = sext i32 %51 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %47, ptr align 1 %49, i64 %52, i1 false)
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds i8, ptr %44, i64 24
  store ptr %53, ptr %54, align 8, !tbaa !29
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %44, i64 8
  store ptr %55, ptr %56, align 8, !tbaa !30
  %57 = getelementptr inbounds i8, ptr %44, i64 2
  %58 = load i16, ptr %57, align 2, !tbaa !31
  %59 = or i16 %58, 16
  store i16 %59, ptr %57, align 2, !tbaa !31
  br label %.critedge

.critedge:                                        ; preds = %25, %39, %._crit_edge, %17, %14, %10, %8, %4, %46
  %.045 = phi ptr [ %44, %46 ], [ %1, %4 ], [ %1, %8 ], [ %1, %10 ], [ %1, %14 ], [ %1, %17 ], [ %1, %._crit_edge ], [ %1, %39 ], [ %1, %25 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  ret ptr %.045
}

attributes #0 = { mustprogress 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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, !7, i64 0}
!10 = !{!"Expr", !7, i64 0, !7, i64 1, !11, i64 4, !7, i64 8, !6, i64 16, !6, i64 24, !7, i64 32, !11, i64 40, !11, i64 44, !12, i64 48, !12, i64 50, !12, i64 52, !7, i64 54, !6, i64 56, !6, i64 64}
!11 = !{!"int", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!10, !6, i64 64}
!14 = !{!15, !11, i64 84}
!15 = !{!"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, !12, i64 68, !12, i64 70, !12, i64 72, !12, 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}
!16 = !{!17, !6, i64 16}
!17 = !{!"VTable", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !7, i64 28, !11, i64 32, !6, i64 40}
!18 = !{!19, !6, i64 0}
!19 = !{!"sqlite3_vtab", !6, i64 0, !11, i64 8, !6, i64 16}
!20 = !{!21, !6, i64 144}
!21 = !{!"sqlite3_module", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176}
!22 = !{!23, !6, i64 40}
!23 = !{!"FuncDef", !7, i64 0, !12, i64 2, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !7, i64 48}
!24 = !{!7, !7, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{i64 0, i64 1, !24, i64 2, i64 2, !28, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 8, !5, i64 32, i64 8, !5, i64 40, i64 8, !5, i64 48, i64 8, !24}
!28 = !{!12, !12, i64 0}
!29 = !{!23, !6, i64 24}
!30 = !{!23, !6, i64 8}
!31 = !{!23, !12, i64 2}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass