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

; 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.6 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.202 = external hidden unnamed_addr constant [3 x i8], align 1
@__func__.testMinimumRotationAngle = external hidden unnamed_addr constant [25 x i8], align 1

; 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
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #2

declare void @Mat3d_setRandomRotation(ptr noundef) #3

declare double @Mat3d_getAxisAngleSelf(ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local zeroext i1 @testMinimumRotationAngle(i32 noundef %0, ptr noundef %1) #4 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca [3 x [3 x double]], align 16
  %7 = alloca [3 x [3 x double]], align 16
  %8 = alloca [3 x [3 x double]], align 16
  %9 = alloca [3 x double], align 16
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  store i32 %0, ptr %3, align 4, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #5
  store i8 1, ptr %5, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 72, ptr %6) #5
  %12 = getelementptr inbounds [3 x [3 x double]], ptr %6, i64 0, i64 0
  call void @Mat3d_setRandomRotation(ptr noundef %12)
  call void @llvm.lifetime.start.p0(i64 72, ptr %7) #5
  %13 = getelementptr inbounds [3 x [3 x double]], ptr %7, i64 0, i64 0
  call void @Mat3d_setRandomRotation(ptr noundef %13)
  call void @llvm.lifetime.start.p0(i64 72, ptr %8) #5
  %14 = getelementptr inbounds [3 x [3 x double]], ptr %8, i64 0, i64 0
  %15 = getelementptr inbounds [3 x [3 x double]], ptr %7, i64 0, i64 0
  %16 = getelementptr inbounds [3 x [3 x double]], ptr %6, i64 0, i64 0
  call void @Mat3d_mulTranspose(ptr noundef %14, ptr noundef %15, ptr noundef %16)
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %17 = getelementptr inbounds [3 x double], ptr %9, i64 0, i64 0
  %18 = getelementptr inbounds [3 x [3 x double]], ptr %8, i64 0, i64 0
  %19 = call double @Mat3d_getAxisAngleSelf(ptr noundef %17, ptr noundef %18)
  store double %19, ptr %10, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %20 = getelementptr inbounds [3 x [3 x double]], ptr %6, i64 0, i64 0
  %21 = getelementptr inbounds [3 x [3 x double]], ptr %7, i64 0, i64 0
  %22 = getelementptr inbounds [3 x double], ptr %9, i64 0, i64 0
  %23 = call double @Mat3d_getMinimumRotationAngle(ptr noundef %20, ptr noundef %21, ptr noundef %22)
  store double %23, ptr %11, align 8, !tbaa !13
  %24 = load double, ptr %11, align 8, !tbaa !13
  %25 = load double, ptr %10, align 8, !tbaa !13
  %26 = fsub double %24, %25
  %27 = call double @llvm.fabs.f64(double %26)
  %28 = fcmp oge double %27, 1.000000e-05
  br i1 %28, label %29, label %30

29:                                               ; preds = %2
  store i8 0, ptr %5, align 1, !tbaa !11
  br label %30

30:                                               ; preds = %29, %2
  br label %31

31:                                               ; preds = %30
  %32 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %43

34:                                               ; preds = %31
  %35 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  %36 = load i8, ptr %5, align 1, !tbaa !11, !range !15, !noundef !16
  %37 = trunc i8 %36 to i1
  br i1 %37, label %38, label %39

38:                                               ; preds = %34
  br label %40

39:                                               ; preds = %34
  br label %40

40:                                               ; preds = %39, %38
  %41 = phi ptr [ @.str.20, %38 ], [ @.str.21, %39 ]
  %42 = getelementptr inbounds [8 x i8], ptr %41, i64 0, i64 0
  call void (i32, ptr, ptr, i32, ptr, ...) %35(i32 noundef 1, ptr noundef @.str.18, ptr noundef @__func__.testMinimumRotationAngle, i32 noundef 3028, ptr noundef @.str.202, ptr noundef %42)
  br label %43

43:                                               ; preds = %40, %31
  %44 = load i32, ptr @RcsLogLevel, align 4, !tbaa !5
  %45 = icmp sle i32 1, %44
  br i1 %45, label %46, label %60

46:                                               ; preds = %43
  %47 = load ptr, ptr @stderr, align 8, !tbaa !9
  %48 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef @.str.22, ptr noundef @__func__.testMinimumRotationAngle, i32 noundef 3028) #5
  %49 = load ptr, ptr @stderr, align 8, !tbaa !9
  %50 = load i8, ptr %5, align 1, !tbaa !11, !range !15, !noundef !16
  %51 = trunc i8 %50 to i1
  br i1 %51, label %52, label %53

52:                                               ; preds = %46
  br label %54

53:                                               ; preds = %46
  br label %54

54:                                               ; preds = %53, %52
  %55 = phi ptr [ @.str.20, %52 ], [ @.str.21, %53 ]
  %56 = getelementptr inbounds [8 x i8], ptr %55, i64 0, i64 0
  %57 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef @.str.202, ptr noundef %56) #5
  %58 = load ptr, ptr @stderr, align 8, !tbaa !9
  %59 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %58, ptr noundef @.str.6) #5
  br label %60

60:                                               ; preds = %54, %43
  br label %61

61:                                               ; preds = %60
  br label %62

62:                                               ; preds = %61
  %63 = load i8, ptr %5, align 1, !tbaa !11, !range !15, !noundef !16
  %64 = trunc i8 %63 to i1
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 72, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 72, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 72, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #5
  ret i1 %64
}

declare void @Mat3d_mulTranspose(ptr noundef, ptr noundef, ptr noundef) #3

declare double @Mat3d_getMinimumRotationAngle(ptr noundef, ptr noundef, ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { "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 #4 = { mustprogress 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 #5 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}


; 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.6 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.202 = external hidden unnamed_addr constant [3 x i8], align 1
@__func__.testMinimumRotationAngle = external hidden unnamed_addr constant [25 x i8], align 1

; 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: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #2

declare void @Mat3d_setRandomRotation(ptr noundef) local_unnamed_addr #3

declare double @Mat3d_getAxisAngleSelf(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local zeroext i1 @testMinimumRotationAngle(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #4 {
  %3 = alloca [3 x [3 x double]], align 16
  %4 = alloca [3 x [3 x double]], align 16
  %5 = alloca [3 x [3 x double]], align 16
  %6 = alloca [3 x double], align 16
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %3) #5
  call void @Mat3d_setRandomRotation(ptr noundef nonnull %3)
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %4) #5
  call void @Mat3d_setRandomRotation(ptr noundef nonnull %4)
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %5) #5
  call void @Mat3d_mulTranspose(ptr noundef nonnull %5, ptr noundef nonnull %4, ptr noundef nonnull %3)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #5
  %7 = call double @Mat3d_getAxisAngleSelf(ptr noundef nonnull %6, ptr noundef nonnull %5)
  %8 = call double @Mat3d_getMinimumRotationAngle(ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %6)
  %9 = fsub double %8, %7
  %10 = call double @llvm.fabs.f64(double %9)
  %11 = fcmp ult double %10, 1.000000e-05
  %12 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %14, label %13

13:                                               ; preds = %2
  %.str.20..str.21 = select i1 %11, ptr @.str.20, ptr @.str.21
  call void (i32, ptr, ptr, i32, ptr, ...) %12(i32 noundef 1, ptr noundef nonnull @.str.18, ptr noundef nonnull @__func__.testMinimumRotationAngle, i32 noundef 3028, ptr noundef nonnull @.str.202, ptr noundef nonnull %.str.20..str.21)
  br label %14

14:                                               ; preds = %13, %2
  %15 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %17, label %24

17:                                               ; preds = %14
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str.22, ptr noundef nonnull @__func__.testMinimumRotationAngle, i32 noundef 3028) #6
  %20 = load ptr, ptr @stderr, align 8, !tbaa !5
  %.str.20..str.211 = select i1 %11, ptr @.str.20, ptr @.str.21
  %21 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef nonnull @.str.202, ptr noundef nonnull %.str.20..str.211) #6
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef nonnull @.str.6) #6
  br label %24

24:                                               ; preds = %17, %14
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %3) #5
  ret i1 %11
}

declare void @Mat3d_mulTranspose(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare double @Mat3d_getMinimumRotationAngle(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { "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 #4 = { mustprogress 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 #5 = { nounwind }
attributes #6 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


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