; 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
@.str.3 = external hidden unnamed_addr constant [74 x i8], align 1
@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.22 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.93 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.119 = external hidden unnamed_addr constant [15 x i8], align 1
@__func__.testQuaternionConversion = external hidden unnamed_addr constant [25 x i8], align 1
@.str.385 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.386 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.387 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.388 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.389 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.390 = external hidden unnamed_addr constant [9 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

declare void @Vec3d_setRandom(ptr noundef, double noundef, double noundef) #2

declare void @Mat3d_fromEulerAngles(ptr noundef, ptr noundef) #2

declare void @Mat3d_sub(ptr noundef, ptr noundef, ptr noundef) #2

declare void @Mat3d_printCommentDigits(ptr noundef, ptr noundef, i32 noundef) #2

declare i32 @fflush(ptr noundef) #2

declare void @VecNd_printComment(ptr noundef, ptr noundef, i32 noundef) #2

declare double @VecNd_sqrLength(ptr noundef, i32 noundef) #2

declare void @Mat3d_setRandomRotation(ptr noundef) #2

declare double @Mat3d_getFrobeniusnorm(ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local zeroext i1 @testQuaternionConversion(i32 noundef %0, ptr noundef %1) #3 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca [4 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 [3 x double]], align 16
  %10 = alloca double, align 8
  %11 = alloca [4 x double], align 16
  %12 = alloca [4 x double], align 16
  %13 = alloca [3 x double], align 16
  %14 = alloca [3 x [3 x double]], align 16
  %15 = alloca [4 x double], align 16
  %16 = 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) #4
  store i8 1, ptr %5, align 1, !tbaa !11
  br label %17

17:                                               ; preds = %2
  %18 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %22

20:                                               ; preds = %17
  %21 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  call void (i32, ptr, ptr, i32, ptr, ...) %21(i32 noundef 2, ptr noundef @.str.18, ptr noundef @__func__.testQuaternionConversion, i32 noundef 3832, ptr noundef @.str.24)
  br label %22

22:                                               ; preds = %20, %17
  %23 = load i32, ptr @RcsLogLevel, align 4, !tbaa !5
  %24 = icmp sle i32 2, %23
  br i1 %24, label %25, label %32

25:                                               ; preds = %22
  %26 = load ptr, ptr @stderr, align 8, !tbaa !9
  %27 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef @.str.22, ptr noundef @__func__.testQuaternionConversion, i32 noundef 3832) #4
  %28 = load ptr, ptr @stderr, align 8, !tbaa !9
  %29 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef @.str.24) #4
  %30 = load ptr, ptr @stderr, align 8, !tbaa !9
  %31 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef @.str.6) #4
  br label %32

32:                                               ; preds = %25, %22
  br label %33

33:                                               ; preds = %32
  br label %34

34:                                               ; preds = %33
  br label %35

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

38:                                               ; preds = %35
  %39 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  call void (i32, ptr, ptr, i32, ptr, ...) %39(i32 noundef 2, ptr noundef @.str.18, ptr noundef @__func__.testQuaternionConversion, i32 noundef 3833, ptr noundef @.str.385)
  br label %40

40:                                               ; preds = %38, %35
  %41 = load i32, ptr @RcsLogLevel, align 4, !tbaa !5
  %42 = icmp sle i32 2, %41
  br i1 %42, label %43, label %50

43:                                               ; preds = %40
  %44 = load ptr, ptr @stderr, align 8, !tbaa !9
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef @.str.22, ptr noundef @__func__.testQuaternionConversion, i32 noundef 3833) #4
  %46 = load ptr, ptr @stderr, align 8, !tbaa !9
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef @.str.385) #4
  %48 = load ptr, ptr @stderr, align 8, !tbaa !9
  %49 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef @.str.6) #4
  br label %50

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

51:                                               ; preds = %50
  br label %52

52:                                               ; preds = %51
  br label %53

53:                                               ; preds = %52
  %54 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  %55 = icmp ne ptr %54, null
  br i1 %55, label %56, label %58

56:                                               ; preds = %53
  %57 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  call void (i32, ptr, ptr, i32, ptr, ...) %57(i32 noundef 2, ptr noundef @.str.18, ptr noundef @__func__.testQuaternionConversion, i32 noundef 3834, ptr noundef @.str.24)
  br label %58

58:                                               ; preds = %56, %53
  %59 = load i32, ptr @RcsLogLevel, align 4, !tbaa !5
  %60 = icmp sle i32 2, %59
  br i1 %60, label %61, label %68

61:                                               ; preds = %58
  %62 = load ptr, ptr @stderr, align 8, !tbaa !9
  %63 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %62, ptr noundef @.str.22, ptr noundef @__func__.testQuaternionConversion, i32 noundef 3834) #4
  %64 = load ptr, ptr @stderr, align 8, !tbaa !9
  %65 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %64, ptr noundef @.str.24) #4
  %66 = load ptr, ptr @stderr, align 8, !tbaa !9
  %67 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %66, ptr noundef @.str.6) #4
  br label %68

68:                                               ; preds = %61, %58
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr %9) #4
  %71 = getelementptr inbounds [3 x [3 x double]], ptr %7, i64 0, i64 0
  call void @Mat3d_setRandomRotation(ptr noundef %71)
  %72 = getelementptr inbounds [4 x double], ptr %6, i64 0, i64 0
  %73 = getelementptr inbounds [3 x [3 x double]], ptr %7, i64 0, i64 0
  %74 = call zeroext i1 @Quat_fromRotationMatrix(ptr noundef %72, ptr noundef %73)
  %75 = getelementptr inbounds [3 x [3 x double]], ptr %8, i64 0, i64 0
  %76 = getelementptr inbounds [4 x double], ptr %6, i64 0, i64 0
  call void @Quat_toRotationMatrix(ptr noundef %75, ptr noundef %76)
  %77 = getelementptr inbounds [3 x [3 x double]], ptr %9, i64 0, i64 0
  %78 = getelementptr inbounds [3 x [3 x double]], ptr %8, i64 0, i64 0
  %79 = getelementptr inbounds [3 x [3 x double]], ptr %7, i64 0, i64 0
  call void @Mat3d_sub(ptr noundef %77, ptr noundef %78, ptr noundef %79)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %80 = getelementptr inbounds [3 x [3 x double]], ptr %9, i64 0, i64 0
  %81 = call double @Mat3d_getFrobeniusnorm(ptr noundef %80)
  store double %81, ptr %10, align 8, !tbaa !13
  %82 = load double, ptr %10, align 8, !tbaa !13
  %83 = fcmp ogt double %82, 1.000000e-08
  br i1 %83, label %84, label %97

84:                                               ; preds = %70
  store i8 0, ptr %5, align 1, !tbaa !11
  %85 = load i32, ptr @RcsLogLevel, align 4, !tbaa !5
  %86 = icmp sle i32 1, %85
  br i1 %86, label %87, label %96

87:                                               ; preds = %84
  %88 = load i32, ptr @RcsLogLevel, align 4, !tbaa !5
  %89 = icmp sle i32 2, %88
  br i1 %89, label %90, label %94

90:                                               ; preds = %87
  %91 = getelementptr inbounds [3 x [3 x double]], ptr %7, i64 0, i64 0
  call void @Mat3d_printCommentDigits(ptr noundef @.str.386, ptr noundef %91, i32 noundef 6)
  %92 = getelementptr inbounds [4 x double], ptr %6, i64 0, i64 0
  call void @VecNd_printComment(ptr noundef @.str.387, ptr noundef %92, i32 noundef 4)
  %93 = getelementptr inbounds [3 x [3 x double]], ptr %8, i64 0, i64 0
  call void @Mat3d_printCommentDigits(ptr noundef @.str.388, ptr noundef %93, i32 noundef 6)
  br label %94

94:                                               ; preds = %90, %87
  %95 = getelementptr inbounds [3 x [3 x double]], ptr %9, i64 0, i64 0
  call void @Mat3d_printCommentDigits(ptr noundef @.str.93, ptr noundef %95, i32 noundef 12)
  br label %96

96:                                               ; preds = %94, %84
  br label %97

97:                                               ; preds = %96, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #4
  br label %98

98:                                               ; preds = %97
  %99 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  %100 = icmp ne ptr %99, null
  br i1 %100, label %101, label %103

101:                                              ; preds = %98
  %102 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  call void (i32, ptr, ptr, i32, ptr, ...) %102(i32 noundef 2, ptr noundef @.str.18, ptr noundef @__func__.testQuaternionConversion, i32 noundef 3863, ptr noundef @.str.24)
  br label %103

103:                                              ; preds = %101, %98
  %104 = load i32, ptr @RcsLogLevel, align 4, !tbaa !5
  %105 = icmp sle i32 2, %104
  br i1 %105, label %106, label %113

106:                                              ; preds = %103
  %107 = load ptr, ptr @stderr, align 8, !tbaa !9
  %108 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %107, ptr noundef @.str.22, ptr noundef @__func__.testQuaternionConversion, i32 noundef 3863) #4
  %109 = load ptr, ptr @stderr, align 8, !tbaa !9
  %110 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %109, ptr noundef @.str.24) #4
  %111 = load ptr, ptr @stderr, align 8, !tbaa !9
  %112 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %111, ptr noundef @.str.6) #4
  br label %113

113:                                              ; preds = %106, %103
  br label %114

114:                                              ; preds = %113
  br label %115

115:                                              ; preds = %114
  br label %116

116:                                              ; preds = %115
  %117 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  %118 = icmp ne ptr %117, null
  br i1 %118, label %119, label %121

119:                                              ; preds = %116
  %120 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  call void (i32, ptr, ptr, i32, ptr, ...) %120(i32 noundef 2, ptr noundef @.str.18, ptr noundef @__func__.testQuaternionConversion, i32 noundef 3864, ptr noundef @.str.389)
  br label %121

121:                                              ; preds = %119, %116
  %122 = load i32, ptr @RcsLogLevel, align 4, !tbaa !5
  %123 = icmp sle i32 2, %122
  br i1 %123, label %124, label %131

124:                                              ; preds = %121
  %125 = load ptr, ptr @stderr, align 8, !tbaa !9
  %126 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %125, ptr noundef @.str.22, ptr noundef @__func__.testQuaternionConversion, i32 noundef 3864) #4
  %127 = load ptr, ptr @stderr, align 8, !tbaa !9
  %128 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %127, ptr noundef @.str.389) #4
  %129 = load ptr, ptr @stderr, align 8, !tbaa !9
  %130 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %129, ptr noundef @.str.6) #4
  br label %131

131:                                              ; preds = %124, %121
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132
  br label %134

134:                                              ; preds = %133
  %135 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  %136 = icmp ne ptr %135, null
  br i1 %136, label %137, label %139

137:                                              ; preds = %134
  %138 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  call void (i32, ptr, ptr, i32, ptr, ...) %138(i32 noundef 2, ptr noundef @.str.18, ptr noundef @__func__.testQuaternionConversion, i32 noundef 3865, ptr noundef @.str.24)
  br label %139

139:                                              ; preds = %137, %134
  %140 = load i32, ptr @RcsLogLevel, align 4, !tbaa !5
  %141 = icmp sle i32 2, %140
  br i1 %141, label %142, label %149

142:                                              ; preds = %139
  %143 = load ptr, ptr @stderr, align 8, !tbaa !9
  %144 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %143, ptr noundef @.str.22, ptr noundef @__func__.testQuaternionConversion, i32 noundef 3865) #4
  %145 = load ptr, ptr @stderr, align 8, !tbaa !9
  %146 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %145, ptr noundef @.str.24) #4
  %147 = load ptr, ptr @stderr, align 8, !tbaa !9
  %148 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %147, ptr noundef @.str.6) #4
  br label %149

149:                                              ; preds = %142, %139
  br label %150

150:                                              ; preds = %149
  br label %151

151:                                              ; preds = %150
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 72, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #4
  %152 = getelementptr inbounds [3 x double], ptr %13, i64 0, i64 0
  call void @Vec3d_setRandom(ptr noundef %152, double noundef 0xC022D97C7F3321D2, double noundef 0x4022D97C7F3321D2)
  %153 = getelementptr inbounds [4 x double], ptr %11, i64 0, i64 0
  %154 = getelementptr inbounds [3 x double], ptr %13, i64 0, i64 0
  call void @Quat_fromEulerAngles(ptr noundef %153, ptr noundef %154)
  %155 = getelementptr inbounds [3 x [3 x double]], ptr %14, i64 0, i64 0
  %156 = getelementptr inbounds [3 x double], ptr %13, i64 0, i64 0
  call void @Mat3d_fromEulerAngles(ptr noundef %155, ptr noundef %156)
  %157 = getelementptr inbounds [4 x double], ptr %12, i64 0, i64 0
  %158 = getelementptr inbounds [3 x [3 x double]], ptr %14, i64 0, i64 0
  %159 = call zeroext i1 @Quat_fromRotationMatrix(ptr noundef %157, ptr noundef %158)
  %160 = getelementptr inbounds [4 x double], ptr %11, i64 0, i64 0
  %161 = load double, ptr %160, align 16, !tbaa !13
  %162 = fcmp olt double %161, 0.000000e+00
  br i1 %162, label %163, label %165

163:                                              ; preds = %151
  %164 = getelementptr inbounds [4 x double], ptr %11, i64 0, i64 0
  call void @VecNd_constMulSelf(ptr noundef %164, double noundef -1.000000e+00, i32 noundef 4)
  br label %165

165:                                              ; preds = %163, %151
  %166 = getelementptr inbounds [4 x double], ptr %12, i64 0, i64 0
  %167 = load double, ptr %166, align 16, !tbaa !13
  %168 = fcmp olt double %167, 0.000000e+00
  br i1 %168, label %169, label %171

169:                                              ; preds = %165
  %170 = getelementptr inbounds [4 x double], ptr %12, i64 0, i64 0
  call void @VecNd_constMulSelf(ptr noundef %170, double noundef -1.000000e+00, i32 noundef 4)
  br label %171

171:                                              ; preds = %169, %165
  %172 = getelementptr inbounds [4 x double], ptr %15, i64 0, i64 0
  %173 = getelementptr inbounds [4 x double], ptr %11, i64 0, i64 0
  %174 = getelementptr inbounds [4 x double], ptr %12, i64 0, i64 0
  call void @VecNd_sub(ptr noundef %172, ptr noundef %173, ptr noundef %174, i32 noundef 4)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %175 = getelementptr inbounds [4 x double], ptr %15, i64 0, i64 0
  %176 = call double @VecNd_sqrLength(ptr noundef %175, i32 noundef 4)
  store double %176, ptr %16, align 8, !tbaa !13
  %177 = load double, ptr %16, align 8, !tbaa !13
  %178 = fcmp ogt double %177, 1.000000e-08
  br i1 %178, label %179, label %198

179:                                              ; preds = %171
  store i8 0, ptr %5, align 1, !tbaa !11
  %180 = load i32, ptr @RcsLogLevel, align 4, !tbaa !5
  %181 = icmp sle i32 1, %180
  br i1 %181, label %182, label %197

182:                                              ; preds = %179
  br label %183

183:                                              ; preds = %182
  %184 = load ptr, ptr @stderr, align 8, !tbaa !9
  %185 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %184, ptr noundef @.str.119, ptr noundef @.str.3, ptr noundef @__func__.testQuaternionConversion, i32 noundef 3895) #4
  %186 = load ptr, ptr @stderr, align 8, !tbaa !9
  %187 = load double, ptr %16, align 8, !tbaa !13
  %188 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %186, ptr noundef @.str.390, double noundef %187) #4
  %189 = load ptr, ptr @stderr, align 8, !tbaa !9
  %190 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %189, ptr noundef @.str.6) #4
  %191 = load ptr, ptr @stderr, align 8, !tbaa !9
  %192 = call i32 @fflush(ptr noundef %191)
  br label %193

193:                                              ; preds = %183
  br label %194

194:                                              ; preds = %193
  %195 = getelementptr inbounds [4 x double], ptr %11, i64 0, i64 0
  %196 = getelementptr inbounds [4 x double], ptr %12, i64 0, i64 0
  call void @VecNd_printTwoArraysDiff(ptr noundef %195, ptr noundef %196, i32 noundef 4)
  br label %197

197:                                              ; preds = %194, %179
  br label %198

198:                                              ; preds = %197, %171
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #4
  %199 = load i8, ptr %5, align 1, !tbaa !11, !range !15, !noundef !16
  %200 = trunc i8 %199 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #4
  ret i1 %200
}

declare zeroext i1 @Quat_fromRotationMatrix(ptr noundef, ptr noundef) #2

declare void @Quat_toRotationMatrix(ptr noundef, ptr noundef) #2

declare void @Quat_fromEulerAngles(ptr noundef, ptr noundef) #2

declare void @VecNd_constMulSelf(ptr noundef, double noundef, i32 noundef) #2

declare void @VecNd_sub(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #2

declare void @VecNd_printTwoArraysDiff(ptr noundef, ptr noundef, i32 noundef) #2

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 = { "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 = { 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 #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 = !{!"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
@.str.3 = external hidden unnamed_addr constant [74 x i8], align 1
@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.22 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.93 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.119 = external hidden unnamed_addr constant [15 x i8], align 1
@__func__.testQuaternionConversion = external hidden unnamed_addr constant [25 x i8], align 1
@.str.385 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.386 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.387 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.388 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.389 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.390 = external hidden unnamed_addr constant [9 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

declare void @Vec3d_setRandom(ptr noundef, double noundef, double noundef) local_unnamed_addr #2

declare void @Mat3d_fromEulerAngles(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @Mat3d_sub(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @Mat3d_printCommentDigits(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #1

declare void @VecNd_printComment(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare double @VecNd_sqrLength(ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @Mat3d_setRandomRotation(ptr noundef) local_unnamed_addr #2

declare double @Mat3d_getFrobeniusnorm(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @testQuaternionConversion(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #3 {
  %3 = alloca [4 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 [3 x double]], align 16
  %7 = alloca [4 x double], align 16
  %8 = alloca [4 x double], align 16
  %9 = alloca [3 x double], align 16
  %10 = alloca [3 x [3 x double]], align 16
  %11 = alloca [4 x double], align 16
  %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
  tail call void (i32, ptr, ptr, i32, ptr, ...) %12(i32 noundef 2, ptr noundef nonnull @.str.18, ptr noundef nonnull @__func__.testQuaternionConversion, i32 noundef 3832, ptr noundef nonnull @.str.24)
  br label %14

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

17:                                               ; preds = %14
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str.22, ptr noundef nonnull @__func__.testQuaternionConversion, i32 noundef 3832) #4
  %20 = load ptr, ptr @stderr, align 8, !tbaa !5
  %21 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef nonnull @.str.24) #4
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef nonnull @.str.6) #4
  br label %24

24:                                               ; preds = %14, %17
  %25 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %.not11 = icmp eq ptr %25, null
  br i1 %.not11, label %27, label %26

26:                                               ; preds = %24
  tail call void (i32, ptr, ptr, i32, ptr, ...) %25(i32 noundef 2, ptr noundef nonnull @.str.18, ptr noundef nonnull @__func__.testQuaternionConversion, i32 noundef 3833, ptr noundef nonnull @.str.385)
  br label %27

27:                                               ; preds = %26, %24
  %28 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %29 = icmp sgt i32 %28, 1
  br i1 %29, label %30, label %37

30:                                               ; preds = %27
  %31 = load ptr, ptr @stderr, align 8, !tbaa !5
  %32 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef nonnull @.str.22, ptr noundef nonnull @__func__.testQuaternionConversion, i32 noundef 3833) #4
  %33 = load ptr, ptr @stderr, align 8, !tbaa !5
  %34 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef nonnull @.str.385) #4
  %35 = load ptr, ptr @stderr, align 8, !tbaa !5
  %36 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef nonnull @.str.6) #4
  br label %37

37:                                               ; preds = %27, %30
  %38 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %.not12 = icmp eq ptr %38, null
  br i1 %.not12, label %40, label %39

39:                                               ; preds = %37
  tail call void (i32, ptr, ptr, i32, ptr, ...) %38(i32 noundef 2, ptr noundef nonnull @.str.18, ptr noundef nonnull @__func__.testQuaternionConversion, i32 noundef 3834, ptr noundef nonnull @.str.24)
  br label %40

40:                                               ; preds = %39, %37
  %41 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %42 = icmp sgt i32 %41, 1
  br i1 %42, label %43, label %50

43:                                               ; preds = %40
  %44 = load ptr, ptr @stderr, align 8, !tbaa !5
  %45 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef nonnull @.str.22, ptr noundef nonnull @__func__.testQuaternionConversion, i32 noundef 3834) #4
  %46 = load ptr, ptr @stderr, align 8, !tbaa !5
  %47 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef nonnull @.str.24) #4
  %48 = load ptr, ptr @stderr, align 8, !tbaa !5
  %49 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef nonnull @.str.6) #4
  br label %50

50:                                               ; preds = %43, %40
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %6) #5
  call void @Mat3d_setRandomRotation(ptr noundef nonnull %4)
  %51 = call zeroext i1 @Quat_fromRotationMatrix(ptr noundef nonnull %3, ptr noundef nonnull %4)
  call void @Quat_toRotationMatrix(ptr noundef nonnull %5, ptr noundef nonnull %3)
  call void @Mat3d_sub(ptr noundef nonnull %6, ptr noundef nonnull %5, ptr noundef nonnull %4)
  %52 = call double @Mat3d_getFrobeniusnorm(ptr noundef nonnull %6)
  %53 = fcmp ule double %52, 1.000000e-08
  br i1 %53, label %60, label %54

54:                                               ; preds = %50
  %55 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %57, label %60

57:                                               ; preds = %54
  %.not13 = icmp eq i32 %55, 1
  br i1 %.not13, label %59, label %58

58:                                               ; preds = %57
  call void @Mat3d_printCommentDigits(ptr noundef nonnull @.str.386, ptr noundef nonnull %4, i32 noundef 6)
  call void @VecNd_printComment(ptr noundef nonnull @.str.387, ptr noundef nonnull %3, i32 noundef 4)
  call void @Mat3d_printCommentDigits(ptr noundef nonnull @.str.388, ptr noundef nonnull %5, i32 noundef 6)
  br label %59

59:                                               ; preds = %58, %57
  call void @Mat3d_printCommentDigits(ptr noundef nonnull @.str.93, ptr noundef nonnull %6, i32 noundef 12)
  br label %60

60:                                               ; preds = %54, %59, %50
  call void @llvm.lifetime.end.p0(i64 72, 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 32, ptr nonnull %3) #5
  %61 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %.not14 = icmp eq ptr %61, null
  br i1 %.not14, label %63, label %62

62:                                               ; preds = %60
  call void (i32, ptr, ptr, i32, ptr, ...) %61(i32 noundef 2, ptr noundef nonnull @.str.18, ptr noundef nonnull @__func__.testQuaternionConversion, i32 noundef 3863, ptr noundef nonnull @.str.24)
  br label %63

63:                                               ; preds = %62, %60
  %64 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %65 = icmp sgt i32 %64, 1
  br i1 %65, label %66, label %73

66:                                               ; preds = %63
  %67 = load ptr, ptr @stderr, align 8, !tbaa !5
  %68 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef nonnull @.str.22, ptr noundef nonnull @__func__.testQuaternionConversion, i32 noundef 3863) #4
  %69 = load ptr, ptr @stderr, align 8, !tbaa !5
  %70 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %69, ptr noundef nonnull @.str.24) #4
  %71 = load ptr, ptr @stderr, align 8, !tbaa !5
  %72 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %71, ptr noundef nonnull @.str.6) #4
  br label %73

73:                                               ; preds = %63, %66
  %74 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %.not15 = icmp eq ptr %74, null
  br i1 %.not15, label %76, label %75

75:                                               ; preds = %73
  call void (i32, ptr, ptr, i32, ptr, ...) %74(i32 noundef 2, ptr noundef nonnull @.str.18, ptr noundef nonnull @__func__.testQuaternionConversion, i32 noundef 3864, ptr noundef nonnull @.str.389)
  br label %76

76:                                               ; preds = %75, %73
  %77 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %78 = icmp sgt i32 %77, 1
  br i1 %78, label %79, label %86

79:                                               ; preds = %76
  %80 = load ptr, ptr @stderr, align 8, !tbaa !5
  %81 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %80, ptr noundef nonnull @.str.22, ptr noundef nonnull @__func__.testQuaternionConversion, i32 noundef 3864) #4
  %82 = load ptr, ptr @stderr, align 8, !tbaa !5
  %83 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef nonnull @.str.389) #4
  %84 = load ptr, ptr @stderr, align 8, !tbaa !5
  %85 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %84, ptr noundef nonnull @.str.6) #4
  br label %86

86:                                               ; preds = %76, %79
  %87 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %.not16 = icmp eq ptr %87, null
  br i1 %.not16, label %89, label %88

88:                                               ; preds = %86
  call void (i32, ptr, ptr, i32, ptr, ...) %87(i32 noundef 2, ptr noundef nonnull @.str.18, ptr noundef nonnull @__func__.testQuaternionConversion, i32 noundef 3865, ptr noundef nonnull @.str.24)
  br label %89

89:                                               ; preds = %88, %86
  %90 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %91 = icmp sgt i32 %90, 1
  br i1 %91, label %92, label %99

92:                                               ; preds = %89
  %93 = load ptr, ptr @stderr, align 8, !tbaa !5
  %94 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %93, ptr noundef nonnull @.str.22, ptr noundef nonnull @__func__.testQuaternionConversion, i32 noundef 3865) #4
  %95 = load ptr, ptr @stderr, align 8, !tbaa !5
  %96 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %95, ptr noundef nonnull @.str.24) #4
  %97 = load ptr, ptr @stderr, align 8, !tbaa !5
  %98 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %97, ptr noundef nonnull @.str.6) #4
  br label %99

99:                                               ; preds = %92, %89
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #5
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %11) #5
  call void @Vec3d_setRandom(ptr noundef nonnull %9, double noundef 0xC022D97C7F3321D2, double noundef 0x4022D97C7F3321D2)
  call void @Quat_fromEulerAngles(ptr noundef nonnull %7, ptr noundef nonnull %9)
  call void @Mat3d_fromEulerAngles(ptr noundef nonnull %10, ptr noundef nonnull %9)
  %100 = call zeroext i1 @Quat_fromRotationMatrix(ptr noundef nonnull %8, ptr noundef nonnull %10)
  %101 = load double, ptr %7, align 16, !tbaa !11
  %102 = fcmp olt double %101, 0.000000e+00
  br i1 %102, label %103, label %104

103:                                              ; preds = %99
  call void @VecNd_constMulSelf(ptr noundef nonnull %7, double noundef -1.000000e+00, i32 noundef 4)
  br label %104

104:                                              ; preds = %103, %99
  %105 = load double, ptr %8, align 16, !tbaa !11
  %106 = fcmp olt double %105, 0.000000e+00
  br i1 %106, label %107, label %108

107:                                              ; preds = %104
  call void @VecNd_constMulSelf(ptr noundef nonnull %8, double noundef -1.000000e+00, i32 noundef 4)
  br label %108

108:                                              ; preds = %107, %104
  call void @VecNd_sub(ptr noundef nonnull %11, ptr noundef nonnull %7, ptr noundef nonnull %8, i32 noundef 4)
  %109 = call double @VecNd_sqrLength(ptr noundef nonnull %11, i32 noundef 4)
  %110 = fcmp ogt double %109, 1.000000e-08
  br i1 %110, label %111, label %123

111:                                              ; preds = %108
  %112 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %113 = icmp sgt i32 %112, 0
  br i1 %113, label %114, label %123

114:                                              ; preds = %111
  %115 = load ptr, ptr @stderr, align 8, !tbaa !5
  %116 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %115, ptr noundef nonnull @.str.119, ptr noundef nonnull @.str.3, ptr noundef nonnull @__func__.testQuaternionConversion, i32 noundef 3895) #4
  %117 = load ptr, ptr @stderr, align 8, !tbaa !5
  %118 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %117, ptr noundef nonnull @.str.390, double noundef %109) #4
  %119 = load ptr, ptr @stderr, align 8, !tbaa !5
  %120 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %119, ptr noundef nonnull @.str.6) #4
  %121 = load ptr, ptr @stderr, align 8, !tbaa !5
  %122 = call i32 @fflush(ptr noundef %121)
  call void @VecNd_printTwoArraysDiff(ptr noundef nonnull %7, ptr noundef nonnull %8, i32 noundef 4)
  br label %123

123:                                              ; preds = %111, %114, %108
  %.1 = phi i1 [ false, %114 ], [ false, %111 ], [ %53, %108 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #5
  ret i1 %.1
}

declare zeroext i1 @Quat_fromRotationMatrix(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @Quat_toRotationMatrix(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @Quat_fromEulerAngles(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @VecNd_constMulSelf(ptr noundef, double noundef, i32 noundef) local_unnamed_addr #2

declare void @VecNd_sub(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @VecNd_printTwoArraysDiff(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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 = { "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 = { 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 #4 = { cold nounwind }
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 = !{!"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}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}


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