; LLVM IR from pixelsdb/mini-pixels :: pixels-core/lib/vector/ColumnVector.ll (ZN12ColumnVectorC2Emb)

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

%class.ColumnVector = type { ptr, i64, i64, i64, i64, i8, i8, ptr, i8, ptr }

@_ZTV12ColumnVector = external dso_local unnamed_addr constant { [11 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN12ColumnVectorC2Emb(ptr noundef nonnull align 8 dereferenceable(72) %0, i64 noundef %1, i1 noundef zeroext %2) unnamed_addr #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i8, align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  %7 = zext i1 %2 to i8
  store i8 %7, ptr %6, align 1, !tbaa !11
  %8 = load ptr, ptr %4, align 8
  store ptr getelementptr inbounds inrange(-16, 72) ({ [11 x ptr] }, ptr @_ZTV12ColumnVector, i32 0, i32 0, i32 2), ptr %8, align 8, !tbaa !13
  %9 = getelementptr inbounds %class.ColumnVector, ptr %8, i32 0, i32 2
  store i64 0, ptr %9, align 8, !tbaa !15
  %10 = getelementptr inbounds %class.ColumnVector, ptr %8, i32 0, i32 3
  store i64 0, ptr %10, align 8, !tbaa !17
  %11 = load i64, ptr %5, align 8, !tbaa !9
  %12 = getelementptr inbounds %class.ColumnVector, ptr %8, i32 0, i32 1
  store i64 %11, ptr %12, align 8, !tbaa !18
  %13 = load i8, ptr %6, align 1, !tbaa !11, !range !19, !noundef !20
  %14 = trunc i8 %13 to i1
  %15 = getelementptr inbounds %class.ColumnVector, ptr %8, i32 0, i32 6
  %16 = zext i1 %14 to i8
  store i8 %16, ptr %15, align 1, !tbaa !21
  %17 = load i64, ptr %5, align 8, !tbaa !9
  %18 = add i64 %17, 12
  %19 = add i64 %18, 4
  %20 = getelementptr inbounds %class.ColumnVector, ptr %8, i32 0, i32 4
  store i64 %19, ptr %20, align 8, !tbaa !22
  %21 = getelementptr inbounds %class.ColumnVector, ptr %8, i32 0, i32 5
  store i8 0, ptr %21, align 8, !tbaa !23
  %22 = getelementptr inbounds %class.ColumnVector, ptr %8, i32 0, i32 1
  %23 = load i64, ptr %22, align 8, !tbaa !18
  %24 = call noalias noundef nonnull ptr @_Znam(i64 noundef %23) #5
  call void @llvm.memset.p0.i64(ptr align 1 %24, i8 0, i64 %23, i1 false)
  %25 = getelementptr inbounds %class.ColumnVector, ptr %8, i32 0, i32 7
  store ptr %24, ptr %25, align 8, !tbaa !24
  %26 = getelementptr inbounds %class.ColumnVector, ptr %8, i32 0, i32 8
  store i8 1, ptr %26, align 8, !tbaa !25
  %27 = getelementptr inbounds %class.ColumnVector, ptr %8, i32 0, i32 9
  %28 = load i64, ptr %5, align 8, !tbaa !9
  %29 = uitofp i64 %28 to double
  %30 = fmul double 1.000000e+00, %29
  %31 = fdiv double %30, 6.400000e+01
  %32 = call double @llvm.ceil.f64(double %31)
  %33 = fmul double %32, 8.000000e+00
  %34 = fptoui double %33 to i64
  %35 = call i32 @posix_memalign(ptr noundef %27, i64 noundef 64, i64 noundef %34) #6
  ret void
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #1

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

; Function Attrs: nounwind
declare i32 @posix_memalign(ptr noundef, i64 noundef, i64 noundef) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #4

attributes #0 = { mustprogress 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 #1 = { nobuiltin allocsize(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: write) }
attributes #3 = { nounwind "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { builtin allocsize(0) }
attributes #6 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"vtable pointer", !8, i64 0}
!15 = !{!16, !10, i64 16}
!16 = !{!"_ZTS12ColumnVector", !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !12, i64 40, !12, i64 41, !6, i64 48, !12, i64 56, !6, i64 64}
!17 = !{!16, !10, i64 24}
!18 = !{!16, !10, i64 8}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!16, !12, i64 41}
!22 = !{!16, !10, i64 32}
!23 = !{!16, !12, i64 40}
!24 = !{!16, !6, i64 48}
!25 = !{!16, !12, i64 56}


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

@_ZTV12ColumnVector = external dso_local unnamed_addr constant { [11 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN12ColumnVectorC2Emb(ptr noundef nonnull align 8 dereferenceable(72) %0, i64 noundef %1, i1 noundef zeroext %2) unnamed_addr #0 align 2 {
  %4 = zext i1 %2 to i8
  store ptr getelementptr inbounds inrange(-16, 72) (i8, ptr @_ZTV12ColumnVector, i64 16), ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, i8 0, i64 16, i1 false)
  store i64 %1, ptr %6, align 8, !tbaa !8
  %7 = getelementptr inbounds i8, ptr %0, i64 41
  store i8 %4, ptr %7, align 1, !tbaa !14
  %8 = add i64 %1, 16
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  store i64 %8, ptr %9, align 8, !tbaa !15
  %10 = getelementptr inbounds i8, ptr %0, i64 40
  store i8 0, ptr %10, align 8, !tbaa !16
  %11 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %1) #5
  tail call void @llvm.memset.p0.i64(ptr nonnull align 1 %11, i8 0, i64 %1, i1 false)
  %12 = getelementptr inbounds i8, ptr %0, i64 48
  store ptr %11, ptr %12, align 8, !tbaa !17
  %13 = getelementptr inbounds i8, ptr %0, i64 56
  store i8 1, ptr %13, align 8, !tbaa !18
  %14 = getelementptr inbounds i8, ptr %0, i64 64
  %15 = uitofp i64 %1 to double
  %16 = fmul double %15, 1.562500e-02
  %17 = tail call double @llvm.ceil.f64(double %16)
  %18 = fmul double %17, 8.000000e+00
  %19 = fptoui double %18 to i64
  %20 = tail call i32 @posix_memalign(ptr noundef nonnull %14, i64 noundef 64, i64 noundef %19) #6
  ret void
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #1

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

; Function Attrs: nofree nounwind
declare i32 @posix_memalign(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #4

attributes #0 = { mustprogress 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 #1 = { nobuiltin allocsize(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: write) }
attributes #3 = { nofree nounwind "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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { builtin allocsize(0) }
attributes #6 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 8}
!9 = !{!"_ZTS12ColumnVector", !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !12, i64 40, !12, i64 41, !13, i64 48, !12, i64 56, !13, i64 64}
!10 = !{!"long", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"bool", !11, i64 0}
!13 = !{!"any pointer", !11, i64 0}
!14 = !{!9, !12, i64 41}
!15 = !{!9, !10, i64 32}
!16 = !{!9, !12, i64 40}
!17 = !{!9, !13, i64 48}
!18 = !{!9, !12, i64 56}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,TailCallElimPass