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

@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
@RcsShapeDistFunc = external hidden global [14 x [14 x ptr]], align 16
@__func__.RcsShape_setDistanceFunction = external hidden unnamed_addr constant [29 x i8], align 1
@.str.89 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.90 = external hidden unnamed_addr constant [48 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @RcsShape_setDistanceFunction(i32 noundef %0, i32 noundef %1, ptr noundef %2) #1 {
  %4 = alloca i1, align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !9
  %8 = load i32, ptr %5, align 4, !tbaa !5
  %9 = icmp ugt i32 %8, 13
  br i1 %9, label %10, label %30

10:                                               ; preds = %3
  br label %11

11:                                               ; preds = %10
  %12 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %17

14:                                               ; preds = %11
  %15 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  %16 = load i32, ptr %5, align 4, !tbaa !5
  call void (i32, ptr, ptr, i32, ptr, ...) %15(i32 noundef 4, ptr noundef @.str.7, ptr noundef @__func__.RcsShape_setDistanceFunction, i32 noundef 1865, ptr noundef @.str.89, i32 noundef %16, i32 noundef 13)
  br label %17

17:                                               ; preds = %14, %11
  %18 = load i32, ptr @RcsLogLevel, align 4, !tbaa !5
  %19 = icmp sle i32 4, %18
  br i1 %19, label %20, label %28

20:                                               ; preds = %17
  %21 = load ptr, ptr @stderr, align 8, !tbaa !9
  %22 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef @.str.9, ptr noundef @.str.7, ptr noundef @__func__.RcsShape_setDistanceFunction, i32 noundef 1865) #2
  %23 = load ptr, ptr @stderr, align 8, !tbaa !9
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef @.str.89, i32 noundef %24, i32 noundef 13) #2
  %26 = load ptr, ptr @stderr, align 8, !tbaa !9
  %27 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef @.str.3) #2
  br label %28

28:                                               ; preds = %20, %17
  br label %29

29:                                               ; preds = %28
  store i1 false, ptr %4, align 1
  br label %61

30:                                               ; preds = %3
  %31 = load i32, ptr %6, align 4, !tbaa !5
  %32 = icmp ugt i32 %31, 13
  br i1 %32, label %33, label %53

33:                                               ; preds = %30
  br label %34

34:                                               ; preds = %33
  %35 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %40

37:                                               ; preds = %34
  %38 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  %39 = load i32, ptr %6, align 4, !tbaa !5
  call void (i32, ptr, ptr, i32, ptr, ...) %38(i32 noundef 4, ptr noundef @.str.7, ptr noundef @__func__.RcsShape_setDistanceFunction, i32 noundef 1872, ptr noundef @.str.90, i32 noundef %39, i32 noundef 13)
  br label %40

40:                                               ; preds = %37, %34
  %41 = load i32, ptr @RcsLogLevel, align 4, !tbaa !5
  %42 = icmp sle i32 4, %41
  br i1 %42, label %43, label %51

43:                                               ; preds = %40
  %44 = load ptr, ptr @stderr, align 8, !tbaa !9
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef @.str.9, ptr noundef @.str.7, ptr noundef @__func__.RcsShape_setDistanceFunction, i32 noundef 1872) #2
  %46 = load ptr, ptr @stderr, align 8, !tbaa !9
  %47 = load i32, ptr %6, align 4, !tbaa !5
  %48 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef @.str.90, i32 noundef %47, i32 noundef 13) #2
  %49 = load ptr, ptr @stderr, align 8, !tbaa !9
  %50 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef @.str.3) #2
  br label %51

51:                                               ; preds = %43, %40
  br label %52

52:                                               ; preds = %51
  store i1 false, ptr %4, align 1
  br label %61

53:                                               ; preds = %30
  %54 = load ptr, ptr %7, align 8, !tbaa !9
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = zext i32 %55 to i64
  %57 = getelementptr inbounds [14 x [14 x ptr]], ptr @RcsShapeDistFunc, i64 0, i64 %56
  %58 = load i32, ptr %6, align 4, !tbaa !5
  %59 = zext i32 %58 to i64
  %60 = getelementptr inbounds [14 x ptr], ptr %57, i64 0, i64 %59
  store ptr %54, ptr %60, align 8, !tbaa !9
  store i1 true, ptr %4, align 1
  br label %61

61:                                               ; preds = %53, %52, %29
  %62 = load i1, ptr %4, align 1
  ret i1 %62
}

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 = !{!"int", !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}


; 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
@RcsShapeDistFunc = external hidden local_unnamed_addr global [14 x [14 x ptr]], align 16
@__func__.RcsShape_setDistanceFunction = external hidden unnamed_addr constant [29 x i8], align 1
@.str.89 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.90 = external hidden unnamed_addr constant [48 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
define dso_local noundef zeroext i1 @RcsShape_setDistanceFunction(i32 noundef %0, i32 noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = icmp ugt i32 %0, 13
  br i1 %4, label %5, label %18

5:                                                ; preds = %3
  %6 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %.not14 = icmp eq ptr %6, null
  br i1 %.not14, label %8, label %7

7:                                                ; preds = %5
  tail call void (i32, ptr, ptr, i32, ptr, ...) %6(i32 noundef 4, ptr noundef nonnull @.str.7, ptr noundef nonnull @__func__.RcsShape_setDistanceFunction, i32 noundef 1865, ptr noundef nonnull @.str.89, i32 noundef %0, i32 noundef 13) #2
  br label %8

8:                                                ; preds = %7, %5
  %9 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %10 = icmp sgt i32 %9, 3
  br i1 %10, label %11, label %37

11:                                               ; preds = %8
  %12 = load ptr, ptr @stderr, align 8, !tbaa !5
  %13 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.7, ptr noundef nonnull @__func__.RcsShape_setDistanceFunction, i32 noundef 1865) #3
  %14 = load ptr, ptr @stderr, align 8, !tbaa !5
  %15 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef nonnull @.str.89, i32 noundef %0, i32 noundef 13) #3
  %16 = load ptr, ptr @stderr, align 8, !tbaa !5
  %17 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef nonnull @.str.3) #3
  br label %37

18:                                               ; preds = %3
  %19 = icmp ugt i32 %1, 13
  br i1 %19, label %20, label %33

20:                                               ; preds = %18
  %21 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %.not = icmp eq ptr %21, null
  br i1 %.not, label %23, label %22

22:                                               ; preds = %20
  tail call void (i32, ptr, ptr, i32, ptr, ...) %21(i32 noundef 4, ptr noundef nonnull @.str.7, ptr noundef nonnull @__func__.RcsShape_setDistanceFunction, i32 noundef 1872, ptr noundef nonnull @.str.90, i32 noundef %1, i32 noundef 13) #2
  br label %23

23:                                               ; preds = %22, %20
  %24 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %25 = icmp sgt i32 %24, 3
  br i1 %25, label %26, label %37

26:                                               ; preds = %23
  %27 = load ptr, ptr @stderr, align 8, !tbaa !5
  %28 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.7, ptr noundef nonnull @__func__.RcsShape_setDistanceFunction, i32 noundef 1872) #3
  %29 = load ptr, ptr @stderr, align 8, !tbaa !5
  %30 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %29, ptr noundef nonnull @.str.90, i32 noundef %1, i32 noundef 13) #3
  %31 = load ptr, ptr @stderr, align 8, !tbaa !5
  %32 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef nonnull @.str.3) #3
  br label %37

33:                                               ; preds = %18
  %34 = zext nneg i32 %0 to i64
  %35 = zext nneg i32 %1 to i64
  %36 = getelementptr inbounds [14 x [14 x ptr]], ptr @RcsShapeDistFunc, i64 0, i64 %34, i64 %35
  store ptr %2, ptr %36, align 8, !tbaa !5
  br label %37

37:                                               ; preds = %26, %23, %11, %8, %33
  %.0 = phi i1 [ true, %33 ], [ false, %8 ], [ false, %11 ], [ false, %23 ], [ false, %26 ]
  ret i1 %.0
}

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, !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}


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