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

; 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.Vdbe = type { ptr, ptr, ptr, ptr, i16, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, i32, i16, i8, i8, i16, i32, i32, [5 x i32], ptr, ptr, ptr, ptr, i32, i32, ptr, ptr }

; 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

; Function Attrs: nounwind uwtable
define dso_local void @sqlite3VdbeSwap(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.Vdbe, align 8
  %6 = alloca ptr, align 8
  %7 = 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 280, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %5, ptr align 8 %8, i64 280, i1 false), !tbaa.struct !9
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %10, i64 280, i1 false), !tbaa.struct !9
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %5, i64 280, i1 false), !tbaa.struct !9
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.Vdbe, ptr %12, i32 0, i32 2
  %14 = load ptr, ptr %13, align 8, !tbaa !17
  store ptr %14, ptr %6, align 8, !tbaa !5
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.Vdbe, ptr %15, i32 0, i32 2
  %17 = load ptr, ptr %16, align 8, !tbaa !17
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.Vdbe, ptr %18, i32 0, i32 2
  store ptr %17, ptr %19, align 8, !tbaa !17
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.Vdbe, ptr %21, i32 0, i32 2
  store ptr %20, ptr %22, align 8, !tbaa !17
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.Vdbe, ptr %23, i32 0, i32 1
  %25 = load ptr, ptr %24, align 8, !tbaa !19
  store ptr %25, ptr %6, align 8, !tbaa !5
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.Vdbe, ptr %26, i32 0, i32 1
  %28 = load ptr, ptr %27, align 8, !tbaa !19
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.Vdbe, ptr %29, i32 0, i32 1
  store ptr %28, ptr %30, align 8, !tbaa !19
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.Vdbe, ptr %32, i32 0, i32 1
  store ptr %31, ptr %33, align 8, !tbaa !19
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.Vdbe, ptr %34, i32 0, i32 35
  %36 = load ptr, ptr %35, align 8, !tbaa !20
  store ptr %36, ptr %7, align 8, !tbaa !5
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.Vdbe, ptr %37, i32 0, i32 35
  %39 = load ptr, ptr %38, align 8, !tbaa !20
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.Vdbe, ptr %40, i32 0, i32 35
  store ptr %39, ptr %41, align 8, !tbaa !20
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.Vdbe, ptr %43, i32 0, i32 35
  store ptr %42, ptr %44, align 8, !tbaa !20
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.Vdbe, ptr %45, i32 0, i32 31
  %47 = load i16, ptr %46, align 8
  %48 = lshr i16 %47, 9
  %49 = and i16 %48, 1
  %50 = zext i16 %49 to i32
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.Vdbe, ptr %51, i32 0, i32 31
  %53 = trunc i32 %50 to i16
  %54 = load i16, ptr %52, align 8
  %55 = and i16 %53, 1
  %56 = shl i16 %55, 9
  %57 = and i16 %54, -513
  %58 = or i16 %57, %56
  store i16 %58, ptr %52, align 8
  %59 = zext i16 %55 to i32
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.Vdbe, ptr %60, i32 0, i32 40
  %62 = load i32, ptr %61, align 4, !tbaa !21
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.Vdbe, ptr %63, i32 0, i32 40
  store i32 %62, ptr %64, align 4, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 280, ptr %5) #3
  ret void
}

; 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

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{i64 0, i64 8, !5, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 8, !5, i64 32, i64 2, !10, i64 36, i64 4, !12, i64 40, i64 4, !12, i64 44, i64 4, !12, i64 48, i64 4, !12, i64 52, i64 4, !12, i64 56, i64 4, !12, i64 60, i64 4, !12, i64 64, i64 4, !12, i64 72, i64 8, !14, i64 80, i64 8, !14, i64 88, i64 8, !14, i64 96, i64 8, !14, i64 104, i64 8, !5, i64 112, i64 8, !5, i64 120, i64 8, !5, i64 128, i64 8, !5, i64 136, i64 8, !5, i64 144, i64 8, !5, i64 152, i64 8, !5, i64 160, i64 8, !5, i64 168, i64 8, !5, i64 176, i64 8, !14, i64 184, i64 4, !12, i64 188, i64 2, !10, i64 190, i64 1, !16, i64 191, i64 1, !16, i64 192, i64 2, !16, i64 196, i64 4, !12, i64 200, i64 4, !12, i64 204, i64 20, !16, i64 224, i64 8, !5, i64 232, i64 8, !5, i64 240, i64 8, !5, i64 248, i64 8, !5, i64 256, i64 4, !12, i64 260, i64 4, !12, i64 264, i64 8, !5, i64 272, i64 8, !5}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !6, i64 16}
!18 = !{!"Vdbe", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64, !15, i64 72, !15, i64 80, !15, i64 88, !15, 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, !15, i64 176, !13, i64 184, !11, i64 188, !7, i64 190, !7, i64 191, !13, i64 192, !13, i64 192, !13, i64 192, !13, i64 192, !13, i64 192, !13, i64 192, !13, i64 192, !13, i64 193, !13, i64 193, !13, i64 196, !13, i64 200, !7, i64 204, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !13, i64 256, !13, i64 260, !6, i64 264, !6, i64 272}
!19 = !{!18, !6, i64 8}
!20 = !{!18, !6, i64 224}
!21 = !{!18, !13, i64 260}


; 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.Vdbe = type { ptr, ptr, ptr, ptr, i16, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, i32, i16, i8, i8, i16, i32, i32, [5 x i32], ptr, ptr, ptr, ptr, i32, i32, ptr, ptr }

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

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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @sqlite3VdbeSwap(ptr nocapture noundef %0, ptr nocapture noundef %1) local_unnamed_addr #1 {
  %3 = alloca %struct.Vdbe, align 8
  call void @llvm.lifetime.start.p0(i64 280, ptr nonnull %3)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(280) %3, ptr noundef nonnull align 8 dereferenceable(280) %0, i64 280, i1 false), !tbaa.struct !5
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(280) %0, ptr noundef nonnull align 8 dereferenceable(280) %1, i64 280, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(280) %1, ptr noundef nonnull align 8 dereferenceable(280) %3, i64 280, i1 false), !tbaa.struct !5
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = getelementptr inbounds i8, ptr %1, i64 8
  %6 = load <2 x ptr>, ptr %5, align 8, !tbaa !6
  %7 = load <2 x ptr>, ptr %4, align 8, !tbaa !6
  store <2 x ptr> %6, ptr %4, align 8, !tbaa !6
  store <2 x ptr> %7, ptr %5, align 8, !tbaa !6
  %8 = getelementptr inbounds i8, ptr %0, i64 224
  %9 = load ptr, ptr %8, align 8, !tbaa !17
  %10 = getelementptr inbounds i8, ptr %1, i64 224
  %11 = load ptr, ptr %10, align 8, !tbaa !17
  store ptr %11, ptr %8, align 8, !tbaa !17
  store ptr %9, ptr %10, align 8, !tbaa !17
  %12 = getelementptr inbounds i8, ptr %0, i64 192
  %13 = load i16, ptr %12, align 8
  %14 = and i16 %13, 512
  %15 = getelementptr inbounds i8, ptr %1, i64 192
  %16 = load i16, ptr %15, align 8
  %17 = and i16 %16, -513
  %18 = or disjoint i16 %17, %14
  store i16 %18, ptr %15, align 8
  %19 = getelementptr inbounds i8, ptr %0, i64 260
  %20 = load i32, ptr %19, align 4, !tbaa !19
  %21 = getelementptr inbounds i8, ptr %1, i64 260
  store i32 %20, ptr %21, align 4, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 280, ptr nonnull %3)
  ret void
}

; 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

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

!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 = !{i64 0, i64 8, !6, i64 8, i64 8, !6, i64 16, i64 8, !6, i64 24, i64 8, !6, i64 32, i64 2, !10, i64 36, i64 4, !12, i64 40, i64 4, !12, i64 44, i64 4, !12, i64 48, i64 4, !12, i64 52, i64 4, !12, i64 56, i64 4, !12, i64 60, i64 4, !12, i64 64, i64 4, !12, i64 72, i64 8, !14, i64 80, i64 8, !14, i64 88, i64 8, !14, i64 96, i64 8, !14, i64 104, i64 8, !6, i64 112, i64 8, !6, i64 120, i64 8, !6, i64 128, i64 8, !6, i64 136, i64 8, !6, i64 144, i64 8, !6, i64 152, i64 8, !6, i64 160, i64 8, !6, i64 168, i64 8, !6, i64 176, i64 8, !14, i64 184, i64 4, !12, i64 188, i64 2, !10, i64 190, i64 1, !16, i64 191, i64 1, !16, i64 192, i64 2, !16, i64 196, i64 4, !12, i64 200, i64 4, !12, i64 204, i64 20, !16, i64 224, i64 8, !6, i64 232, i64 8, !6, i64 240, i64 8, !6, i64 248, i64 8, !6, i64 256, i64 4, !12, i64 260, i64 4, !12, i64 264, i64 8, !6, i64 272, i64 8, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !8, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !8, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !8, i64 0}
!16 = !{!8, !8, i64 0}
!17 = !{!18, !7, i64 224}
!18 = !{!"Vdbe", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !11, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64, !15, i64 72, !15, i64 80, !15, i64 88, !15, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !15, i64 176, !13, i64 184, !11, i64 188, !8, i64 190, !8, i64 191, !13, i64 192, !13, i64 192, !13, i64 192, !13, i64 192, !13, i64 192, !13, i64 192, !13, i64 192, !13, i64 193, !13, i64 193, !13, i64 196, !13, i64 200, !8, i64 204, !7, i64 224, !7, i64 232, !7, i64 240, !7, i64 248, !13, i64 256, !13, i64 260, !7, i64 264, !7, i64 272}
!19 = !{!18, !13, i64 260}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,TailCallElimPass