; 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]] }

@RCS_GLOBAL_RLOG_CB = external global ptr, align 8
@RcsLogLevel = external global i32, align 4
@stderr = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [5 x i8], align 1
@__func__.RcsShape_addOctree = external hidden unnamed_addr constant [19 x i8], align 1
@.str.97 = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @Rcs_loadOctree(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @RcsShape_addOctree(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct._RcsShape, ptr %5, i32 0, i32 6
  %7 = load ptr, ptr %6, align 8, !tbaa !9
  %8 = call ptr @Rcs_loadOctree(ptr noundef %7)
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct._RcsShape, ptr %9, i32 0, i32 10
  store ptr %8, ptr %10, align 8, !tbaa !15
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct._RcsShape, ptr %11, i32 0, i32 10
  %13 = load ptr, ptr %12, align 8, !tbaa !15
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %55

15:                                               ; preds = %2
  br label %16

16:                                               ; preds = %15
  %17 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %32

19:                                               ; preds = %16
  %20 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._RcsShape, ptr %21, i32 0, i32 6
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %29

25:                                               ; preds = %19
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct._RcsShape, ptr %26, i32 0, i32 6
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  br label %30

29:                                               ; preds = %19
  br label %30

30:                                               ; preds = %29, %25
  %31 = phi ptr [ %28, %25 ], [ @.str.34, %29 ]
  call void (i32, ptr, ptr, i32, ptr, ...) %20(i32 noundef 1, ptr noundef @.str.7, ptr noundef @__func__.RcsShape_addOctree, i32 noundef 1983, ptr noundef @.str.97, ptr noundef %31)
  br label %32

32:                                               ; preds = %30, %16
  %33 = load i32, ptr @RcsLogLevel, align 4, !tbaa !16
  %34 = icmp sle i32 1, %33
  br i1 %34, label %35, label %53

35:                                               ; preds = %32
  %36 = load ptr, ptr @stderr, align 8, !tbaa !5
  %37 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef @.str.9, ptr noundef @.str.7, ptr noundef @__func__.RcsShape_addOctree, i32 noundef 1983) #2
  %38 = load ptr, ptr @stderr, align 8, !tbaa !5
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct._RcsShape, ptr %39, i32 0, i32 6
  %41 = load ptr, ptr %40, align 8, !tbaa !9
  %42 = icmp ne ptr %41, null
  br i1 %42, label %43, label %47

43:                                               ; preds = %35
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct._RcsShape, ptr %44, i32 0, i32 6
  %46 = load ptr, ptr %45, align 8, !tbaa !9
  br label %48

47:                                               ; preds = %35
  br label %48

48:                                               ; preds = %47, %43
  %49 = phi ptr [ %46, %43 ], [ @.str.34, %47 ]
  %50 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef @.str.97, ptr noundef %49) #2
  %51 = load ptr, ptr @stderr, align 8, !tbaa !5
  %52 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %51, ptr noundef @.str.3) #2
  br label %53

53:                                               ; preds = %48, %32
  br label %54

54:                                               ; preds = %53
  br label %55

55:                                               ; preds = %54, %2
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._RcsShape, ptr %56, i32 0, i32 10
  %58 = load ptr, ptr %57, align 8, !tbaa !15
  ret ptr %58
}

attributes #0 = { 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 #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, !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 176}
!16 = !{!11, !11, i64 0}


; 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_GLOBAL_RLOG_CB = external local_unnamed_addr global ptr, align 8
@RcsLogLevel = external local_unnamed_addr global i32, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [5 x i8], align 1
@__func__.RcsShape_addOctree = external hidden unnamed_addr constant [19 x i8], align 1
@.str.97 = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @Rcs_loadOctree(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @RcsShape_addOctree(ptr nocapture noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #1 {
  %3 = getelementptr inbounds i8, ptr %0, i64 144
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = tail call ptr @Rcs_loadOctree(ptr noundef %4)
  %6 = getelementptr inbounds i8, ptr %0, i64 176
  store ptr %5, ptr %6, align 8, !tbaa !14
  %7 = icmp eq ptr %5, null
  br i1 %7, label %8, label %23

8:                                                ; preds = %2
  %9 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !15
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %12, label %10

10:                                               ; preds = %8
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %.not10 = icmp eq ptr %11, null
  %spec.select = select i1 %.not10, ptr @.str.34, ptr %11
  tail call void (i32, ptr, ptr, i32, ptr, ...) %9(i32 noundef 1, ptr noundef nonnull @.str.7, ptr noundef nonnull @__func__.RcsShape_addOctree, i32 noundef 1983, ptr noundef nonnull @.str.97, ptr noundef nonnull %spec.select) #2
  br label %12

12:                                               ; preds = %10, %8
  %13 = load i32, ptr @RcsLogLevel, align 4, !tbaa !16
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %15, label %23

15:                                               ; preds = %12
  %16 = load ptr, ptr @stderr, align 8, !tbaa !15
  %17 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.7, ptr noundef nonnull @__func__.RcsShape_addOctree, i32 noundef 1983) #3
  %18 = load ptr, ptr @stderr, align 8, !tbaa !15
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %.not11 = icmp eq ptr %19, null
  %spec.select12 = select i1 %.not11, ptr @.str.34, ptr %19
  %20 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str.97, ptr noundef nonnull %spec.select12) #3
  %21 = load ptr, ptr @stderr, align 8, !tbaa !15
  %22 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef nonnull @.str.3) #3
  br label %23

23:                                               ; preds = %15, %12, %2
  %24 = load ptr, ptr %6, align 8, !tbaa !14
  ret ptr %24
}

attributes #0 = { 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 #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 }
attributes #3 = { cold 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 176}
!15 = !{!13, !13, i64 0}
!16 = !{!7, !7, i64 0}


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