; LLVM IR from MRPT/mrpt :: 3rdparty/xspublic/xstypes (xsglovedata)

; 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.XsGloveData = type { i16, i16, i16, i8, [12 x %struct.XsFingerData] }
%struct.XsFingerData = type { %struct.XsQuaternion, %struct.XsVector3, %struct.XsVector3, i16, i8, i8 }
%struct.XsQuaternion = type { %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { double, double, double, double }
%struct.XsVector3 = type { %struct.XsVector, [3 x double] }
%struct.XsVector = type { ptr, i64, i64 }

; Function Attrs: nounwind uwtable
define dso_local void @XsGloveData_construct(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %4, i8 0, i64 1640, i1 false)
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.XsGloveData, ptr %5, i32 0, i32 0
  store i16 0, ptr %6, align 8, !tbaa !9
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.XsGloveData, ptr %7, i32 0, i32 1
  store i16 0, ptr %8, align 2, !tbaa !12
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.XsGloveData, ptr %9, i32 0, i32 2
  store i16 0, ptr %10, align 4, !tbaa !13
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.XsGloveData, ptr %11, i32 0, i32 3
  store i8 0, ptr %12, align 2, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !15
  br label %13

13:                                               ; preds = %22, %1
  %14 = load i32, ptr %3, align 4, !tbaa !15
  %15 = icmp slt i32 %14, 12
  br i1 %15, label %16, label %25

16:                                               ; preds = %13
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.XsGloveData, ptr %17, i32 0, i32 4
  %19 = load i32, ptr %3, align 4, !tbaa !15
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [12 x %struct.XsFingerData], ptr %18, i64 0, i64 %20
  call void @XsFingerData_construct(ptr noundef %21)
  br label %22

22:                                               ; preds = %16
  %23 = load i32, ptr %3, align 4, !tbaa !15
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %3, align 4, !tbaa !15
  br label %13, !llvm.loop !17

25:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @XsFingerData_construct(ptr noundef) #0

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

attributes #0 = { 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 #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nosync 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 = !{!10, !11, i64 0}
!10 = !{!"XsGloveData", !11, i64 0, !11, i64 2, !11, i64 4, !7, i64 6, !7, i64 8}
!11 = !{!"short", !7, i64 0}
!12 = !{!10, !11, i64 2}
!13 = !{!10, !11, i64 4}
!14 = !{!10, !7, i64 6}
!15 = !{!16, !16, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


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

; Function Attrs: nounwind uwtable
define dso_local void @XsGloveData_construct(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(1640) %0, i8 0, i64 1640, i1 false)
  tail call void @XsFingerData_construct(ptr noundef nonnull %2)
  %3 = getelementptr inbounds i8, ptr %0, i64 144
  tail call void @XsFingerData_construct(ptr noundef nonnull %3)
  %4 = getelementptr inbounds i8, ptr %0, i64 280
  tail call void @XsFingerData_construct(ptr noundef nonnull %4)
  %5 = getelementptr inbounds i8, ptr %0, i64 416
  tail call void @XsFingerData_construct(ptr noundef nonnull %5)
  %6 = getelementptr inbounds i8, ptr %0, i64 552
  tail call void @XsFingerData_construct(ptr noundef nonnull %6)
  %7 = getelementptr inbounds i8, ptr %0, i64 688
  tail call void @XsFingerData_construct(ptr noundef nonnull %7)
  %8 = getelementptr inbounds i8, ptr %0, i64 824
  tail call void @XsFingerData_construct(ptr noundef nonnull %8)
  %9 = getelementptr inbounds i8, ptr %0, i64 960
  tail call void @XsFingerData_construct(ptr noundef nonnull %9)
  %10 = getelementptr inbounds i8, ptr %0, i64 1096
  tail call void @XsFingerData_construct(ptr noundef nonnull %10)
  %11 = getelementptr inbounds i8, ptr %0, i64 1232
  tail call void @XsFingerData_construct(ptr noundef nonnull %11)
  %12 = getelementptr inbounds i8, ptr %0, i64 1368
  tail call void @XsFingerData_construct(ptr noundef nonnull %12)
  %13 = getelementptr inbounds i8, ptr %0, i64 1504
  tail call void @XsFingerData_construct(ptr noundef nonnull %13)
  ret void
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @XsFingerData_construct(ptr noundef) local_unnamed_addr #0

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

!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)"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass