; LLVM IR from HRI-EU/Rcs :: external (EulerAngles)

; 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.EulerAngles = type { double, double, double, i32 }

; 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
declare dso_local void @Eul_FromEuler(ptr dead_on_unwind noalias writable sret(%struct.EulerAngles) align 8, ptr noundef byval(%struct.EulerAngles) align 8, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @convertEulerAngles(ptr noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %struct.EulerAngles, align 8
  %10 = alloca %struct.EulerAngles, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #2
  %11 = getelementptr inbounds %struct.EulerAngles, ptr %9, i32 0, i32 0
  %12 = load ptr, ptr %7, align 8, !tbaa !5
  %13 = getelementptr inbounds double, ptr %12, i64 0
  %14 = load double, ptr %13, align 8, !tbaa !11
  store double %14, ptr %11, align 8, !tbaa !13
  %15 = getelementptr inbounds %struct.EulerAngles, ptr %9, i32 0, i32 1
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = getelementptr inbounds double, ptr %16, i64 1
  %18 = load double, ptr %17, align 8, !tbaa !11
  store double %18, ptr %15, align 8, !tbaa !15
  %19 = getelementptr inbounds %struct.EulerAngles, ptr %9, i32 0, i32 2
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = getelementptr inbounds double, ptr %20, i64 2
  %22 = load double, ptr %21, align 8, !tbaa !11
  store double %22, ptr %19, align 8, !tbaa !16
  %23 = getelementptr inbounds %struct.EulerAngles, ptr %9, i32 0, i32 3
  %24 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %24, ptr %23, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #2
  %25 = load i32, ptr %6, align 4, !tbaa !9
  call void @Eul_FromEuler(ptr dead_on_unwind writable sret(%struct.EulerAngles) align 8 %10, ptr noundef byval(%struct.EulerAngles) align 8 %9, i32 noundef %25)
  %26 = getelementptr inbounds %struct.EulerAngles, ptr %10, i32 0, i32 0
  %27 = load double, ptr %26, align 8, !tbaa !13
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds double, ptr %28, i64 0
  store double %27, ptr %29, align 8, !tbaa !11
  %30 = getelementptr inbounds %struct.EulerAngles, ptr %10, i32 0, i32 1
  %31 = load double, ptr %30, align 8, !tbaa !15
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds double, ptr %32, i64 1
  store double %31, ptr %33, align 8, !tbaa !11
  %34 = getelementptr inbounds %struct.EulerAngles, ptr %10, i32 0, i32 2
  %35 = load double, ptr %34, align 8, !tbaa !16
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds double, ptr %36, i64 2
  store double %35, ptr %37, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #2
  ret void
}

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 = { 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, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16, !10, i64 24}
!15 = !{!14, !12, i64 8}
!16 = !{!14, !12, i64 16}
!17 = !{!14, !10, i64 24}


; 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.EulerAngles = type { double, double, double, i32 }

; 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: nounwind uwtable
declare dso_local void @Eul_FromEuler(ptr dead_on_unwind noalias writable sret(%struct.EulerAngles) align 8, ptr noundef byval(%struct.EulerAngles) align 8, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @convertEulerAngles(ptr nocapture noundef writeonly %0, i32 noundef %1, ptr nocapture noundef readonly %2, i32 noundef %3) local_unnamed_addr #1 {
  %5 = alloca %struct.EulerAngles, align 16
  %6 = alloca %struct.EulerAngles, align 16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #2
  %7 = load <2 x double>, ptr %2, align 8, !tbaa !5
  store <2 x double> %7, ptr %5, align 16, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %5, i64 16
  %9 = getelementptr inbounds i8, ptr %2, i64 16
  %10 = load double, ptr %9, align 8, !tbaa !5
  store double %10, ptr %8, align 16, !tbaa !9
  %11 = getelementptr inbounds i8, ptr %5, i64 24
  store i32 %3, ptr %11, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #2
  call void @Eul_FromEuler(ptr dead_on_unwind nonnull writable sret(%struct.EulerAngles) align 8 %6, ptr noundef nonnull byval(%struct.EulerAngles) align 8 %5, i32 noundef %1)
  %12 = load <2 x double>, ptr %6, align 16, !tbaa !5
  store <2 x double> %12, ptr %0, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %6, i64 16
  %14 = load double, ptr %13, align 16, !tbaa !9
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  store double %14, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #2
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #2
  ret void
}

attributes #0 = { mustprogress 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 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 16}
!10 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 24}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass