; LLVM IR from HRI-EU/Rcs :: src/RcsCore (Rcs_mesh)

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

@Rcs_calloc = external global ptr, align 8
@__const.RcsMesh_createPyramid.vertexIndex = external hidden unnamed_addr constant [18 x i32], align 16

; 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: 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) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @RcsMesh_createPyramid(double noundef %0, double noundef %1, double noundef %2) #2 {
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca [18 x i32], align 16
  %8 = alloca [15 x double], align 16
  %9 = alloca ptr, align 8
  store double %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !5
  store double %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 72, ptr %7) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %7, ptr align 16 @__const.RcsMesh_createPyramid.vertexIndex, i64 72, i1 false)
  %10 = load double, ptr %4, align 8, !tbaa !5
  %11 = fmul double %10, 5.000000e-01
  store double %11, ptr %4, align 8, !tbaa !5
  %12 = load double, ptr %5, align 8, !tbaa !5
  %13 = fmul double %12, 5.000000e-01
  store double %13, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 120, ptr %8) #3
  %14 = load double, ptr %4, align 8, !tbaa !5
  store double %14, ptr %8, align 8, !tbaa !5
  %15 = getelementptr inbounds double, ptr %8, i64 1
  %16 = load double, ptr %5, align 8, !tbaa !5
  store double %16, ptr %15, align 8, !tbaa !5
  %17 = getelementptr inbounds double, ptr %8, i64 2
  store double 0.000000e+00, ptr %17, align 8, !tbaa !5
  %18 = getelementptr inbounds double, ptr %8, i64 3
  %19 = load double, ptr %4, align 8, !tbaa !5
  %20 = fneg double %19
  store double %20, ptr %18, align 8, !tbaa !5
  %21 = getelementptr inbounds double, ptr %8, i64 4
  %22 = load double, ptr %5, align 8, !tbaa !5
  store double %22, ptr %21, align 8, !tbaa !5
  %23 = getelementptr inbounds double, ptr %8, i64 5
  store double 0.000000e+00, ptr %23, align 8, !tbaa !5
  %24 = getelementptr inbounds double, ptr %8, i64 6
  %25 = load double, ptr %4, align 8, !tbaa !5
  %26 = fneg double %25
  store double %26, ptr %24, align 8, !tbaa !5
  %27 = getelementptr inbounds double, ptr %8, i64 7
  %28 = load double, ptr %5, align 8, !tbaa !5
  %29 = fneg double %28
  store double %29, ptr %27, align 8, !tbaa !5
  %30 = getelementptr inbounds double, ptr %8, i64 8
  store double 0.000000e+00, ptr %30, align 8, !tbaa !5
  %31 = getelementptr inbounds double, ptr %8, i64 9
  %32 = load double, ptr %4, align 8, !tbaa !5
  store double %32, ptr %31, align 8, !tbaa !5
  %33 = getelementptr inbounds double, ptr %8, i64 10
  %34 = load double, ptr %5, align 8, !tbaa !5
  %35 = fneg double %34
  store double %35, ptr %33, align 8, !tbaa !5
  %36 = getelementptr inbounds double, ptr %8, i64 11
  store double 0.000000e+00, ptr %36, align 8, !tbaa !5
  %37 = getelementptr inbounds double, ptr %8, i64 12
  store double 0.000000e+00, ptr %37, align 8, !tbaa !5
  %38 = getelementptr inbounds double, ptr %8, i64 13
  store double 0.000000e+00, ptr %38, align 8, !tbaa !5
  %39 = getelementptr inbounds double, ptr %8, i64 14
  %40 = load double, ptr %6, align 8, !tbaa !5
  store double %40, ptr %39, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %41 = load ptr, ptr @Rcs_calloc, align 8, !tbaa !9
  %42 = call ptr %41(i64 noundef 1, i64 noundef 32)
  store ptr %42, ptr %9, align 8, !tbaa !9
  %43 = load ptr, ptr %9, align 8, !tbaa !9
  %44 = getelementptr inbounds %struct.RcsMeshData, ptr %43, i32 0, i32 2
  store i32 6, ptr %44, align 8, !tbaa !11
  %45 = load ptr, ptr %9, align 8, !tbaa !9
  %46 = getelementptr inbounds %struct.RcsMeshData, ptr %45, i32 0, i32 0
  store i32 5, ptr %46, align 8, !tbaa !14
  %47 = load ptr, ptr @Rcs_calloc, align 8, !tbaa !9
  %48 = load ptr, ptr %9, align 8, !tbaa !9
  %49 = getelementptr inbounds %struct.RcsMeshData, ptr %48, i32 0, i32 2
  %50 = load i32, ptr %49, align 8, !tbaa !11
  %51 = mul i32 %50, 3
  %52 = zext i32 %51 to i64
  %53 = call ptr %47(i64 noundef %52, i64 noundef 4)
  %54 = load ptr, ptr %9, align 8, !tbaa !9
  %55 = getelementptr inbounds %struct.RcsMeshData, ptr %54, i32 0, i32 3
  store ptr %53, ptr %55, align 8, !tbaa !15
  %56 = load ptr, ptr @Rcs_calloc, align 8, !tbaa !9
  %57 = load ptr, ptr %9, align 8, !tbaa !9
  %58 = getelementptr inbounds %struct.RcsMeshData, ptr %57, i32 0, i32 0
  %59 = load i32, ptr %58, align 8, !tbaa !14
  %60 = mul i32 %59, 3
  %61 = zext i32 %60 to i64
  %62 = call ptr %56(i64 noundef %61, i64 noundef 8)
  %63 = load ptr, ptr %9, align 8, !tbaa !9
  %64 = getelementptr inbounds %struct.RcsMeshData, ptr %63, i32 0, i32 1
  store ptr %62, ptr %64, align 8, !tbaa !16
  %65 = load ptr, ptr %9, align 8, !tbaa !9
  %66 = getelementptr inbounds %struct.RcsMeshData, ptr %65, i32 0, i32 3
  %67 = load ptr, ptr %66, align 8, !tbaa !15
  %68 = getelementptr inbounds [18 x i32], ptr %7, i64 0, i64 0
  %69 = load ptr, ptr %9, align 8, !tbaa !9
  %70 = getelementptr inbounds %struct.RcsMeshData, ptr %69, i32 0, i32 2
  %71 = load i32, ptr %70, align 8, !tbaa !11
  %72 = mul i32 3, %71
  %73 = zext i32 %72 to i64
  %74 = mul i64 %73, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %67, ptr align 16 %68, i64 %74, i1 false)
  %75 = load ptr, ptr %9, align 8, !tbaa !9
  %76 = getelementptr inbounds %struct.RcsMeshData, ptr %75, i32 0, i32 1
  %77 = load ptr, ptr %76, align 8, !tbaa !16
  %78 = getelementptr inbounds [15 x double], ptr %8, i64 0, i64 0
  %79 = load ptr, ptr %9, align 8, !tbaa !9
  %80 = getelementptr inbounds %struct.RcsMeshData, ptr %79, i32 0, i32 0
  %81 = load i32, ptr %80, align 8, !tbaa !14
  %82 = mul i32 3, %81
  %83 = zext i32 %82 to i64
  %84 = mul i64 %83, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %77, ptr align 16 %78, i64 %84, i1 false)
  %85 = load ptr, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 120, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 72, ptr %7) #3
  ret ptr %85
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !13, i64 16}
!12 = !{!"", !13, i64 0, !10, i64 8, !13, i64 16, !10, i64 24}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !13, i64 0}
!15 = !{!12, !10, i64 24}
!16 = !{!12, !10, i64 8}


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

@Rcs_calloc = external local_unnamed_addr global ptr, align 8
@__const.RcsMesh_createPyramid.vertexIndex = external hidden unnamed_addr constant [18 x i32], align 16

; 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 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) #1

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @RcsMesh_createPyramid(double noundef %0, double noundef %1, double noundef %2) local_unnamed_addr #2 {
  %4 = alloca [15 x double], align 16
  %5 = insertelement <2 x double> poison, double %0, i64 0
  %6 = insertelement <2 x double> %5, double %1, i64 1
  %7 = fmul <2 x double> %6, <double 5.000000e-01, double 5.000000e-01>
  call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %4)
  store <2 x double> %7, ptr %4, align 16, !tbaa !5
  %.16.sroa_idx36 = getelementptr inbounds i8, ptr %4, i64 16
  store double 0.000000e+00, ptr %.16.sroa_idx36, align 16, !tbaa !5
  %8 = extractelement <2 x double> %7, i64 1
  %.32.sroa_idx38 = getelementptr inbounds i8, ptr %4, i64 32
  store double %8, ptr %.32.sroa_idx38, align 16, !tbaa !5
  %.40.sroa_idx39 = getelementptr inbounds i8, ptr %4, i64 40
  store double 0.000000e+00, ptr %.40.sroa_idx39, align 8, !tbaa !5
  %9 = fneg <2 x double> %7
  %10 = extractelement <2 x double> %9, i64 0
  %.24.sroa_idx37 = getelementptr inbounds i8, ptr %4, i64 24
  store double %10, ptr %.24.sroa_idx37, align 8, !tbaa !5
  %.48.sroa_idx40 = getelementptr inbounds i8, ptr %4, i64 48
  store <2 x double> %9, ptr %.48.sroa_idx40, align 16, !tbaa !5
  %.64.sroa_idx41 = getelementptr inbounds i8, ptr %4, i64 64
  store double 0.000000e+00, ptr %.64.sroa_idx41, align 16, !tbaa !5
  %11 = extractelement <2 x double> %7, i64 0
  %.72.sroa_idx42 = getelementptr inbounds i8, ptr %4, i64 72
  store double %11, ptr %.72.sroa_idx42, align 8, !tbaa !5
  %12 = extractelement <2 x double> %9, i64 1
  %.80.sroa_idx43 = getelementptr inbounds i8, ptr %4, i64 80
  store double %12, ptr %.80.sroa_idx43, align 16, !tbaa !5
  %.88.sroa_idx44 = getelementptr inbounds i8, ptr %4, i64 88
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %.88.sroa_idx44, i8 0, i64 24, i1 false)
  %.112.sroa_idx45 = getelementptr inbounds i8, ptr %4, i64 112
  store double %2, ptr %.112.sroa_idx45, align 16, !tbaa !5
  %13 = load ptr, ptr @Rcs_calloc, align 8, !tbaa !9
  %14 = tail call ptr %13(i64 noundef 1, i64 noundef 32) #4
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  store i32 6, ptr %15, align 8, !tbaa !11
  store i32 5, ptr %14, align 8, !tbaa !14
  %16 = load ptr, ptr @Rcs_calloc, align 8, !tbaa !9
  %17 = tail call ptr %16(i64 noundef 18, i64 noundef 4) #4
  %18 = getelementptr inbounds i8, ptr %14, i64 24
  store ptr %17, ptr %18, align 8, !tbaa !15
  %19 = load ptr, ptr @Rcs_calloc, align 8, !tbaa !9
  %20 = load i32, ptr %14, align 8, !tbaa !14
  %21 = mul i32 %20, 3
  %22 = zext i32 %21 to i64
  %23 = tail call ptr %19(i64 noundef %22, i64 noundef 8) #4
  %24 = getelementptr inbounds i8, ptr %14, i64 8
  store ptr %23, ptr %24, align 8, !tbaa !16
  %25 = load ptr, ptr %18, align 8, !tbaa !15
  %26 = load i32, ptr %15, align 8, !tbaa !11
  %27 = mul i32 %26, 3
  %28 = zext i32 %27 to i64
  %29 = shl nuw nsw i64 %28, 2
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %25, ptr nonnull align 16 @__const.RcsMesh_createPyramid.vertexIndex, i64 %29, i1 false)
  %30 = load ptr, ptr %24, align 8, !tbaa !16
  %31 = load i32, ptr %14, align 8, !tbaa !14
  %32 = mul i32 %31, 3
  %33 = zext i32 %32 to i64
  %34 = shl nuw nsw i64 %33, 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %30, ptr nonnull align 16 %4, i64 %34, i1 false)
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %4)
  ret ptr %14
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !13, i64 16}
!12 = !{!"", !13, i64 0, !10, i64 8, !13, i64 16, !10, i64 24}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !13, i64 0}
!15 = !{!12, !10, i64 24}
!16 = !{!12, !10, i64 8}


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