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

; 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._RcsShape = type { i32, %struct.HTr, [3 x double], double, i8, i8, ptr, ptr, ptr, ptr, ptr }
%struct.HTr = type { [3 x double], [3 x [3 x double]] }

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

; Function Attrs: nounwind uwtable
define dso_local void @RcsShape_destroy(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = icmp eq ptr %3, null
  br i1 %4, label %5, label %6

5:                                                ; preds = %1
  br label %48

6:                                                ; preds = %1
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct._RcsShape, ptr %7, i32 0, i32 6
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  call void @free(ptr noundef %9) #4
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct._RcsShape, ptr %10, i32 0, i32 7
  %12 = load ptr, ptr %11, align 8, !tbaa !15
  call void @free(ptr noundef %12) #4
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct._RcsShape, ptr %13, i32 0, i32 8
  %15 = load ptr, ptr %14, align 8, !tbaa !16
  call void @free(ptr noundef %15) #4
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct._RcsShape, ptr %16, i32 0, i32 9
  %18 = load ptr, ptr %17, align 8, !tbaa !17
  call void @free(ptr noundef %18) #4
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct._RcsShape, ptr %19, i32 0, i32 0
  %21 = load i32, ptr %20, align 8, !tbaa !18
  %22 = icmp eq i32 %21, 11
  br i1 %22, label %23, label %27

23:                                               ; preds = %6
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._RcsShape, ptr %24, i32 0, i32 10
  %26 = load ptr, ptr %25, align 8, !tbaa !19
  call void @Rcs_destroyOctree(ptr noundef %26)
  br label %27

27:                                               ; preds = %23, %6
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._RcsShape, ptr %28, i32 0, i32 0
  %30 = load i32, ptr %29, align 8, !tbaa !18
  %31 = icmp eq i32 %30, 13
  br i1 %31, label %32, label %36

32:                                               ; preds = %27
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._RcsShape, ptr %33, i32 0, i32 10
  %35 = load ptr, ptr %34, align 8, !tbaa !19
  call void @free(ptr noundef %35) #4
  br label %36

36:                                               ; preds = %32, %27
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct._RcsShape, ptr %37, i32 0, i32 0
  %39 = load i32, ptr %38, align 8, !tbaa !18
  %40 = icmp eq i32 %39, 3
  br i1 %40, label %41, label %45

41:                                               ; preds = %36
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct._RcsShape, ptr %42, i32 0, i32 10
  %44 = load ptr, ptr %43, align 8, !tbaa !19
  call void @RcsMesh_destroy(ptr noundef %44)
  br label %45

45:                                               ; preds = %41, %36
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %46, i8 0, i64 184, i1 false)
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %47) #4
  br label %48

48:                                               ; preds = %45, %5
  ret void
}

; Function Attrs: nounwind
declare void @free(ptr noundef) #1

declare void @RcsMesh_destroy(ptr noundef) #2

; 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 = { 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 = { 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 #2 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 144}
!10 = !{!"_RcsShape", !11, i64 0, !12, i64 8, !7, i64 104, !13, i64 128, !14, i64 136, !7, i64 137, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176}
!11 = !{!"int", !7, i64 0}
!12 = !{!"", !7, i64 0, !7, i64 24}
!13 = !{!"double", !7, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!10, !6, i64 152}
!16 = !{!10, !6, i64 160}
!17 = !{!10, !6, i64 168}
!18 = !{!10, !11, i64 0}
!19 = !{!10, !6, i64 176}


; 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
declare dso_local void @Rcs_destroyOctree(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @RcsShape_destroy(ptr noundef %0) local_unnamed_addr #0 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %30, label %3

3:                                                ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 144
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  tail call void @free(ptr noundef %5) #3
  %6 = getelementptr inbounds i8, ptr %0, i64 152
  %7 = load ptr, ptr %6, align 8, !tbaa !14
  tail call void @free(ptr noundef %7) #3
  %8 = getelementptr inbounds i8, ptr %0, i64 160
  %9 = load ptr, ptr %8, align 8, !tbaa !15
  tail call void @free(ptr noundef %9) #3
  %10 = getelementptr inbounds i8, ptr %0, i64 168
  %11 = load ptr, ptr %10, align 8, !tbaa !16
  tail call void @free(ptr noundef %11) #3
  %12 = load i32, ptr %0, align 8, !tbaa !17
  %13 = icmp eq i32 %12, 11
  br i1 %13, label %14, label %17

14:                                               ; preds = %3
  %15 = getelementptr inbounds i8, ptr %0, i64 176
  %16 = load ptr, ptr %15, align 8, !tbaa !18
  tail call void @Rcs_destroyOctree(ptr noundef %16)
  %.pr = load i32, ptr %0, align 8, !tbaa !17
  br label %17

17:                                               ; preds = %14, %3
  %18 = phi i32 [ %.pr, %14 ], [ %12, %3 ]
  %19 = icmp eq i32 %18, 13
  br i1 %19, label %20, label %23

20:                                               ; preds = %17
  %21 = getelementptr inbounds i8, ptr %0, i64 176
  %22 = load ptr, ptr %21, align 8, !tbaa !18
  tail call void @free(ptr noundef %22) #3
  %.pre = load i32, ptr %0, align 8, !tbaa !17
  br label %23

23:                                               ; preds = %20, %17
  %24 = phi i32 [ %.pre, %20 ], [ %18, %17 ]
  %25 = icmp eq i32 %24, 3
  br i1 %25, label %26, label %29

26:                                               ; preds = %23
  %27 = getelementptr inbounds i8, ptr %0, i64 176
  %28 = load ptr, ptr %27, align 8, !tbaa !18
  tail call void @RcsMesh_destroy(ptr noundef %28) #3
  br label %29

29:                                               ; preds = %26, %23
  tail call void @free(ptr noundef nonnull %0) #3
  br label %30

30:                                               ; preds = %1, %29
  ret void
}

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

declare void @RcsMesh_destroy(ptr noundef) local_unnamed_addr #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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { "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, !13, i64 144}
!6 = !{!"_RcsShape", !7, i64 0, !10, i64 8, !8, i64 104, !11, i64 128, !12, i64 136, !8, i64 137, !13, i64 144, !13, i64 152, !13, i64 160, !13, i64 168, !13, i64 176}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !8, i64 0, !8, i64 24}
!11 = !{!"double", !8, i64 0}
!12 = !{!"_Bool", !8, i64 0}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!6, !13, i64 152}
!15 = !{!6, !13, i64 160}
!16 = !{!6, !13, i64 168}
!17 = !{!6, !7, i64 0}
!18 = !{!6, !13, i64 176}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass