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

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

@RcsLogLevel = external global i32, align 4
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [73 x i8], align 1
@__func__.Quat_fromRotationMatrix = external hidden unnamed_addr constant [24 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 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 double @sqrt(double noundef) #1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @Quat_fromRotationMatrix(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca [4 x double], align 16
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store double 0.000000e+00, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #4
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds [3 x double], ptr %9, i64 2
  %11 = getelementptr inbounds [3 x double], ptr %10, i64 0, i64 2
  %12 = load double, ptr %11, align 8, !tbaa !9
  %13 = fcmp olt double %12, 0.000000e+00
  br i1 %13, label %14, label %121

14:                                               ; preds = %2
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds [3 x double], ptr %15, i64 0
  %17 = getelementptr inbounds [3 x double], ptr %16, i64 0, i64 0
  %18 = load double, ptr %17, align 8, !tbaa !9
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds [3 x double], ptr %19, i64 1
  %21 = getelementptr inbounds [3 x double], ptr %20, i64 0, i64 1
  %22 = load double, ptr %21, align 8, !tbaa !9
  %23 = fcmp ogt double %18, %22
  br i1 %23, label %24, label %72

24:                                               ; preds = %14
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds [3 x double], ptr %25, i64 0
  %27 = getelementptr inbounds [3 x double], ptr %26, i64 0, i64 0
  %28 = load double, ptr %27, align 8, !tbaa !9
  %29 = fadd double 1.000000e+00, %28
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds [3 x double], ptr %30, i64 1
  %32 = getelementptr inbounds [3 x double], ptr %31, i64 0, i64 1
  %33 = load double, ptr %32, align 8, !tbaa !9
  %34 = fsub double %29, %33
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds [3 x double], ptr %35, i64 2
  %37 = getelementptr inbounds [3 x double], ptr %36, i64 0, i64 2
  %38 = load double, ptr %37, align 8, !tbaa !9
  %39 = fsub double %34, %38
  store double %39, ptr %6, align 8, !tbaa !9
  %40 = load double, ptr %6, align 8, !tbaa !9
  %41 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 1
  store double %40, ptr %41, align 8, !tbaa !9
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds [3 x double], ptr %42, i64 0
  %44 = getelementptr inbounds [3 x double], ptr %43, i64 0, i64 1
  %45 = load double, ptr %44, align 8, !tbaa !9
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds [3 x double], ptr %46, i64 1
  %48 = getelementptr inbounds [3 x double], ptr %47, i64 0, i64 0
  %49 = load double, ptr %48, align 8, !tbaa !9
  %50 = fadd double %45, %49
  %51 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 2
  store double %50, ptr %51, align 16, !tbaa !9
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds [3 x double], ptr %52, i64 2
  %54 = getelementptr inbounds [3 x double], ptr %53, i64 0, i64 0
  %55 = load double, ptr %54, align 8, !tbaa !9
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds [3 x double], ptr %56, i64 0
  %58 = getelementptr inbounds [3 x double], ptr %57, i64 0, i64 2
  %59 = load double, ptr %58, align 8, !tbaa !9
  %60 = fadd double %55, %59
  %61 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 3
  store double %60, ptr %61, align 8, !tbaa !9
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds [3 x double], ptr %62, i64 1
  %64 = getelementptr inbounds [3 x double], ptr %63, i64 0, i64 2
  %65 = load double, ptr %64, align 8, !tbaa !9
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = getelementptr inbounds [3 x double], ptr %66, i64 2
  %68 = getelementptr inbounds [3 x double], ptr %67, i64 0, i64 1
  %69 = load double, ptr %68, align 8, !tbaa !9
  %70 = fsub double %65, %69
  %71 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 0
  store double %70, ptr %71, align 16, !tbaa !9
  br label %120

72:                                               ; preds = %14
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds [3 x double], ptr %73, i64 0
  %75 = getelementptr inbounds [3 x double], ptr %74, i64 0, i64 0
  %76 = load double, ptr %75, align 8, !tbaa !9
  %77 = fsub double 1.000000e+00, %76
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = getelementptr inbounds [3 x double], ptr %78, i64 1
  %80 = getelementptr inbounds [3 x double], ptr %79, i64 0, i64 1
  %81 = load double, ptr %80, align 8, !tbaa !9
  %82 = fadd double %77, %81
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds [3 x double], ptr %83, i64 2
  %85 = getelementptr inbounds [3 x double], ptr %84, i64 0, i64 2
  %86 = load double, ptr %85, align 8, !tbaa !9
  %87 = fsub double %82, %86
  store double %87, ptr %6, align 8, !tbaa !9
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds [3 x double], ptr %88, i64 0
  %90 = getelementptr inbounds [3 x double], ptr %89, i64 0, i64 1
  %91 = load double, ptr %90, align 8, !tbaa !9
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds [3 x double], ptr %92, i64 1
  %94 = getelementptr inbounds [3 x double], ptr %93, i64 0, i64 0
  %95 = load double, ptr %94, align 8, !tbaa !9
  %96 = fadd double %91, %95
  %97 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 1
  store double %96, ptr %97, align 8, !tbaa !9
  %98 = load double, ptr %6, align 8, !tbaa !9
  %99 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 2
  store double %98, ptr %99, align 16, !tbaa !9
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = getelementptr inbounds [3 x double], ptr %100, i64 1
  %102 = getelementptr inbounds [3 x double], ptr %101, i64 0, i64 2
  %103 = load double, ptr %102, align 8, !tbaa !9
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = getelementptr inbounds [3 x double], ptr %104, i64 2
  %106 = getelementptr inbounds [3 x double], ptr %105, i64 0, i64 1
  %107 = load double, ptr %106, align 8, !tbaa !9
  %108 = fadd double %103, %107
  %109 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 3
  store double %108, ptr %109, align 8, !tbaa !9
  %110 = load ptr, ptr %5, align 8, !tbaa !5
  %111 = getelementptr inbounds [3 x double], ptr %110, i64 2
  %112 = getelementptr inbounds [3 x double], ptr %111, i64 0, i64 0
  %113 = load double, ptr %112, align 8, !tbaa !9
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = getelementptr inbounds [3 x double], ptr %114, i64 0
  %116 = getelementptr inbounds [3 x double], ptr %115, i64 0, i64 2
  %117 = load double, ptr %116, align 8, !tbaa !9
  %118 = fsub double %113, %117
  %119 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 0
  store double %118, ptr %119, align 16, !tbaa !9
  br label %120

120:                                              ; preds = %72, %24
  br label %229

121:                                              ; preds = %2
  %122 = load ptr, ptr %5, align 8, !tbaa !5
  %123 = getelementptr inbounds [3 x double], ptr %122, i64 0
  %124 = getelementptr inbounds [3 x double], ptr %123, i64 0, i64 0
  %125 = load double, ptr %124, align 8, !tbaa !9
  %126 = load ptr, ptr %5, align 8, !tbaa !5
  %127 = getelementptr inbounds [3 x double], ptr %126, i64 1
  %128 = getelementptr inbounds [3 x double], ptr %127, i64 0, i64 1
  %129 = load double, ptr %128, align 8, !tbaa !9
  %130 = fneg double %129
  %131 = fcmp olt double %125, %130
  br i1 %131, label %132, label %180

132:                                              ; preds = %121
  %133 = load ptr, ptr %5, align 8, !tbaa !5
  %134 = getelementptr inbounds [3 x double], ptr %133, i64 0
  %135 = getelementptr inbounds [3 x double], ptr %134, i64 0, i64 0
  %136 = load double, ptr %135, align 8, !tbaa !9
  %137 = fsub double 1.000000e+00, %136
  %138 = load ptr, ptr %5, align 8, !tbaa !5
  %139 = getelementptr inbounds [3 x double], ptr %138, i64 1
  %140 = getelementptr inbounds [3 x double], ptr %139, i64 0, i64 1
  %141 = load double, ptr %140, align 8, !tbaa !9
  %142 = fsub double %137, %141
  %143 = load ptr, ptr %5, align 8, !tbaa !5
  %144 = getelementptr inbounds [3 x double], ptr %143, i64 2
  %145 = getelementptr inbounds [3 x double], ptr %144, i64 0, i64 2
  %146 = load double, ptr %145, align 8, !tbaa !9
  %147 = fadd double %142, %146
  store double %147, ptr %6, align 8, !tbaa !9
  %148 = load ptr, ptr %5, align 8, !tbaa !5
  %149 = getelementptr inbounds [3 x double], ptr %148, i64 2
  %150 = getelementptr inbounds [3 x double], ptr %149, i64 0, i64 0
  %151 = load double, ptr %150, align 8, !tbaa !9
  %152 = load ptr, ptr %5, align 8, !tbaa !5
  %153 = getelementptr inbounds [3 x double], ptr %152, i64 0
  %154 = getelementptr inbounds [3 x double], ptr %153, i64 0, i64 2
  %155 = load double, ptr %154, align 8, !tbaa !9
  %156 = fadd double %151, %155
  %157 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 1
  store double %156, ptr %157, align 8, !tbaa !9
  %158 = load ptr, ptr %5, align 8, !tbaa !5
  %159 = getelementptr inbounds [3 x double], ptr %158, i64 1
  %160 = getelementptr inbounds [3 x double], ptr %159, i64 0, i64 2
  %161 = load double, ptr %160, align 8, !tbaa !9
  %162 = load ptr, ptr %5, align 8, !tbaa !5
  %163 = getelementptr inbounds [3 x double], ptr %162, i64 2
  %164 = getelementptr inbounds [3 x double], ptr %163, i64 0, i64 1
  %165 = load double, ptr %164, align 8, !tbaa !9
  %166 = fadd double %161, %165
  %167 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 2
  store double %166, ptr %167, align 16, !tbaa !9
  %168 = load double, ptr %6, align 8, !tbaa !9
  %169 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 3
  store double %168, ptr %169, align 8, !tbaa !9
  %170 = load ptr, ptr %5, align 8, !tbaa !5
  %171 = getelementptr inbounds [3 x double], ptr %170, i64 0
  %172 = getelementptr inbounds [3 x double], ptr %171, i64 0, i64 1
  %173 = load double, ptr %172, align 8, !tbaa !9
  %174 = load ptr, ptr %5, align 8, !tbaa !5
  %175 = getelementptr inbounds [3 x double], ptr %174, i64 1
  %176 = getelementptr inbounds [3 x double], ptr %175, i64 0, i64 0
  %177 = load double, ptr %176, align 8, !tbaa !9
  %178 = fsub double %173, %177
  %179 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 0
  store double %178, ptr %179, align 16, !tbaa !9
  br label %228

180:                                              ; preds = %121
  %181 = load ptr, ptr %5, align 8, !tbaa !5
  %182 = getelementptr inbounds [3 x double], ptr %181, i64 0
  %183 = getelementptr inbounds [3 x double], ptr %182, i64 0, i64 0
  %184 = load double, ptr %183, align 8, !tbaa !9
  %185 = fadd double 1.000000e+00, %184
  %186 = load ptr, ptr %5, align 8, !tbaa !5
  %187 = getelementptr inbounds [3 x double], ptr %186, i64 1
  %188 = getelementptr inbounds [3 x double], ptr %187, i64 0, i64 1
  %189 = load double, ptr %188, align 8, !tbaa !9
  %190 = fadd double %185, %189
  %191 = load ptr, ptr %5, align 8, !tbaa !5
  %192 = getelementptr inbounds [3 x double], ptr %191, i64 2
  %193 = getelementptr inbounds [3 x double], ptr %192, i64 0, i64 2
  %194 = load double, ptr %193, align 8, !tbaa !9
  %195 = fadd double %190, %194
  store double %195, ptr %6, align 8, !tbaa !9
  %196 = load ptr, ptr %5, align 8, !tbaa !5
  %197 = getelementptr inbounds [3 x double], ptr %196, i64 1
  %198 = getelementptr inbounds [3 x double], ptr %197, i64 0, i64 2
  %199 = load double, ptr %198, align 8, !tbaa !9
  %200 = load ptr, ptr %5, align 8, !tbaa !5
  %201 = getelementptr inbounds [3 x double], ptr %200, i64 2
  %202 = getelementptr inbounds [3 x double], ptr %201, i64 0, i64 1
  %203 = load double, ptr %202, align 8, !tbaa !9
  %204 = fsub double %199, %203
  %205 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 1
  store double %204, ptr %205, align 8, !tbaa !9
  %206 = load ptr, ptr %5, align 8, !tbaa !5
  %207 = getelementptr inbounds [3 x double], ptr %206, i64 2
  %208 = getelementptr inbounds [3 x double], ptr %207, i64 0, i64 0
  %209 = load double, ptr %208, align 8, !tbaa !9
  %210 = load ptr, ptr %5, align 8, !tbaa !5
  %211 = getelementptr inbounds [3 x double], ptr %210, i64 0
  %212 = getelementptr inbounds [3 x double], ptr %211, i64 0, i64 2
  %213 = load double, ptr %212, align 8, !tbaa !9
  %214 = fsub double %209, %213
  %215 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 2
  store double %214, ptr %215, align 16, !tbaa !9
  %216 = load ptr, ptr %5, align 8, !tbaa !5
  %217 = getelementptr inbounds [3 x double], ptr %216, i64 0
  %218 = getelementptr inbounds [3 x double], ptr %217, i64 0, i64 1
  %219 = load double, ptr %218, align 8, !tbaa !9
  %220 = load ptr, ptr %5, align 8, !tbaa !5
  %221 = getelementptr inbounds [3 x double], ptr %220, i64 1
  %222 = getelementptr inbounds [3 x double], ptr %221, i64 0, i64 0
  %223 = load double, ptr %222, align 8, !tbaa !9
  %224 = fsub double %219, %223
  %225 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 3
  store double %224, ptr %225, align 8, !tbaa !9
  %226 = load double, ptr %6, align 8, !tbaa !9
  %227 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 0
  store double %226, ptr %227, align 16, !tbaa !9
  br label %228

228:                                              ; preds = %180, %132
  br label %229

229:                                              ; preds = %228, %120
  %230 = load double, ptr %6, align 8, !tbaa !9
  %231 = fcmp ole double %230, 0.000000e+00
  br i1 %231, label %232, label %265

232:                                              ; preds = %229
  %233 = load i32, ptr @RcsLogLevel, align 4, !tbaa !11
  %234 = icmp sle i32 1, %233
  br i1 %234, label %235, label %264

235:                                              ; preds = %232
  br label %236

236:                                              ; preds = %235
  %237 = load ptr, ptr @stderr, align 8, !tbaa !5
  %238 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %237, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @__func__.Quat_fromRotationMatrix, i32 noundef 210) #4
  %239 = load ptr, ptr @stderr, align 8, !tbaa !5
  %240 = load double, ptr %6, align 8, !tbaa !9
  %241 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %239, ptr noundef @.str.2, double noundef %240) #4
  %242 = load ptr, ptr @stderr, align 8, !tbaa !5
  %243 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %242, ptr noundef @.str.3) #4
  %244 = load ptr, ptr @stderr, align 8, !tbaa !5
  %245 = call i32 @fflush(ptr noundef %244)
  br label %246

246:                                              ; preds = %236
  br label %247

247:                                              ; preds = %246
  br label %248

248:                                              ; preds = %247
  %249 = load ptr, ptr @stderr, align 8, !tbaa !5
  %250 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %249, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @__func__.Quat_fromRotationMatrix, i32 noundef 211) #4
  %251 = load ptr, ptr @stderr, align 8, !tbaa !5
  %252 = load ptr, ptr %5, align 8, !tbaa !5
  %253 = call zeroext i1 @Mat3d_isValid(ptr noundef %252)
  %254 = zext i1 %253 to i64
  %255 = select i1 %253, ptr @.str.5, ptr @.str.6
  %256 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %251, ptr noundef @.str.4, ptr noundef %255) #4
  %257 = load ptr, ptr @stderr, align 8, !tbaa !5
  %258 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %257, ptr noundef @.str.3) #4
  %259 = load ptr, ptr @stderr, align 8, !tbaa !5
  %260 = call i32 @fflush(ptr noundef %259)
  br label %261

261:                                              ; preds = %248
  br label %262

262:                                              ; preds = %261
  %263 = load ptr, ptr %5, align 8, !tbaa !5
  call void @Mat3d_printFormatted(ptr noundef @.str.7, ptr noundef @.str.8, ptr noundef %263)
  br label %264

264:                                              ; preds = %262, %232
  store i1 false, ptr %3, align 1
  store i32 1, ptr %8, align 4
  br label %271

265:                                              ; preds = %229
  %266 = load ptr, ptr %4, align 8, !tbaa !5
  %267 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 0
  %268 = load double, ptr %6, align 8, !tbaa !9
  %269 = call double @sqrt(double noundef %268) #4
  %270 = fdiv double 5.000000e-01, %269
  call void @VecNd_constMul(ptr noundef %266, ptr noundef %267, double noundef %270, i32 noundef 4)
  store i1 true, ptr %3, align 1
  store i32 1, ptr %8, align 4
  br label %271

271:                                              ; preds = %265, %264
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %272 = load i1, ptr %3, align 1
  ret i1 %272
}

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

declare i32 @fflush(ptr noundef) #3

declare zeroext i1 @Mat3d_isValid(ptr noundef) #3

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

declare void @VecNd_constMul(ptr noundef, ptr noundef, double noundef, i32 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 = { 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 #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 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !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"

@RcsLogLevel = external local_unnamed_addr global i32, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [73 x i8], align 1
@__func__.Quat_fromRotationMatrix = external hidden unnamed_addr constant [24 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 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: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @Quat_fromRotationMatrix(ptr noundef %0, ptr noundef %1) local_unnamed_addr #2 {
  %3 = alloca [4 x double], align 16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #5
  %4 = getelementptr inbounds i8, ptr %1, i64 48
  %5 = getelementptr inbounds i8, ptr %1, i64 64
  %6 = load double, ptr %5, align 8, !tbaa !5
  %7 = fcmp olt double %6, 0.000000e+00
  %8 = load double, ptr %1, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %1, i64 24
  %10 = getelementptr inbounds i8, ptr %1, i64 32
  %11 = load double, ptr %10, align 8, !tbaa !5
  br i1 %7, label %12, label %53

12:                                               ; preds = %2
  %13 = fcmp ogt double %8, %11
  %14 = getelementptr inbounds i8, ptr %3, i64 16
  br i1 %13, label %15, label %34

15:                                               ; preds = %12
  %16 = fadd double %8, 1.000000e+00
  %17 = fsub double %16, %11
  %18 = fsub double %17, %6
  %19 = getelementptr inbounds i8, ptr %3, i64 8
  store double %18, ptr %19, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %1, i64 8
  %21 = load double, ptr %20, align 8, !tbaa !5
  %22 = load double, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %1, i64 16
  %24 = load <2 x double>, ptr %23, align 8, !tbaa !5
  %25 = insertelement <2 x double> poison, double %22, i64 0
  %26 = insertelement <2 x double> %25, double %21, i64 1
  %27 = fadd <2 x double> %26, %24
  %28 = shufflevector <2 x double> %27, <2 x double> poison, <2 x i32> <i32 1, i32 0>
  store <2 x double> %28, ptr %14, align 16, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %1, i64 40
  %30 = load double, ptr %29, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %1, i64 56
  %32 = load double, ptr %31, align 8, !tbaa !5
  %33 = fsub double %30, %32
  store double %33, ptr %3, align 16, !tbaa !5
  br label %95

34:                                               ; preds = %12
  %35 = fsub double 1.000000e+00, %8
  %36 = fadd double %35, %11
  %37 = fsub double %36, %6
  %38 = getelementptr inbounds i8, ptr %1, i64 8
  %39 = load double, ptr %38, align 8, !tbaa !5
  %40 = load double, ptr %9, align 8, !tbaa !5
  %41 = fadd double %39, %40
  %42 = getelementptr inbounds i8, ptr %3, i64 8
  store double %41, ptr %42, align 8, !tbaa !5
  store double %37, ptr %14, align 16, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %1, i64 40
  %44 = load double, ptr %43, align 8, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %1, i64 56
  %46 = load double, ptr %45, align 8, !tbaa !5
  %47 = fadd double %44, %46
  %48 = getelementptr inbounds i8, ptr %3, i64 24
  store double %47, ptr %48, align 8, !tbaa !5
  %49 = load double, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds i8, ptr %1, i64 16
  %51 = load double, ptr %50, align 8, !tbaa !5
  %52 = fsub double %49, %51
  store double %52, ptr %3, align 16, !tbaa !5
  br label %95

53:                                               ; preds = %2
  %54 = fneg double %11
  %55 = fcmp olt double %8, %54
  br i1 %55, label %56, label %76

56:                                               ; preds = %53
  %57 = fsub double 1.000000e+00, %8
  %58 = fsub double %57, %11
  %59 = fadd double %6, %58
  %60 = getelementptr inbounds i8, ptr %1, i64 16
  %61 = load double, ptr %60, align 8, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %3, i64 8
  %63 = getelementptr inbounds i8, ptr %1, i64 40
  %64 = getelementptr inbounds i8, ptr %1, i64 56
  %65 = load double, ptr %64, align 8, !tbaa !5
  %66 = load <2 x double>, ptr %63, align 8, !tbaa !5
  %67 = insertelement <2 x double> poison, double %65, i64 0
  %68 = insertelement <2 x double> %67, double %61, i64 1
  %69 = fadd <2 x double> %66, %68
  %70 = shufflevector <2 x double> %69, <2 x double> poison, <2 x i32> <i32 1, i32 0>
  store <2 x double> %70, ptr %62, align 8, !tbaa !5
  %71 = getelementptr inbounds i8, ptr %3, i64 24
  store double %59, ptr %71, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %1, i64 8
  %73 = load double, ptr %72, align 8, !tbaa !5
  %74 = load double, ptr %9, align 8, !tbaa !5
  %75 = fsub double %73, %74
  store double %75, ptr %3, align 16, !tbaa !5
  br label %95

76:                                               ; preds = %53
  %77 = fadd double %8, 1.000000e+00
  %78 = fadd double %77, %11
  %79 = fadd double %6, %78
  %80 = getelementptr inbounds i8, ptr %1, i64 40
  %81 = getelementptr inbounds i8, ptr %1, i64 56
  %82 = load double, ptr %81, align 8, !tbaa !5
  %83 = getelementptr inbounds i8, ptr %3, i64 8
  %84 = getelementptr inbounds i8, ptr %1, i64 16
  %85 = load double, ptr %84, align 8, !tbaa !5
  %86 = load <2 x double>, ptr %80, align 8, !tbaa !5
  %87 = insertelement <2 x double> poison, double %82, i64 0
  %88 = insertelement <2 x double> %87, double %85, i64 1
  %89 = fsub <2 x double> %86, %88
  store <2 x double> %89, ptr %83, align 8, !tbaa !5
  %90 = getelementptr inbounds i8, ptr %1, i64 8
  %91 = load double, ptr %90, align 8, !tbaa !5
  %92 = load double, ptr %9, align 8, !tbaa !5
  %93 = fsub double %91, %92
  %94 = getelementptr inbounds i8, ptr %3, i64 24
  store double %93, ptr %94, align 8, !tbaa !5
  store double %79, ptr %3, align 16, !tbaa !5
  br label %95

95:                                               ; preds = %56, %76, %15, %34
  %.0 = phi double [ %18, %15 ], [ %37, %34 ], [ %59, %56 ], [ %79, %76 ]
  %96 = fcmp ugt double %.0, 0.000000e+00
  br i1 %96, label %119, label %97

97:                                               ; preds = %95
  %98 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %99 = icmp sgt i32 %98, 0
  br i1 %99, label %100, label %122

100:                                              ; preds = %97
  %101 = load ptr, ptr @stderr, align 8, !tbaa !11
  %102 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %101, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.Quat_fromRotationMatrix, i32 noundef 210) #6
  %103 = load ptr, ptr @stderr, align 8, !tbaa !11
  %104 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %103, ptr noundef nonnull @.str.2, double noundef %.0) #6
  %105 = load ptr, ptr @stderr, align 8, !tbaa !11
  %106 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %105, ptr noundef nonnull @.str.3) #6
  %107 = load ptr, ptr @stderr, align 8, !tbaa !11
  %108 = tail call i32 @fflush(ptr noundef %107)
  %109 = load ptr, ptr @stderr, align 8, !tbaa !11
  %110 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %109, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.Quat_fromRotationMatrix, i32 noundef 211) #6
  %111 = load ptr, ptr @stderr, align 8, !tbaa !11
  %112 = tail call zeroext i1 @Mat3d_isValid(ptr noundef nonnull %1) #5
  %113 = select i1 %112, ptr @.str.5, ptr @.str.6
  %114 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %111, ptr noundef nonnull @.str.4, ptr noundef nonnull %113) #6
  %115 = load ptr, ptr @stderr, align 8, !tbaa !11
  %116 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %115, ptr noundef nonnull @.str.3) #6
  %117 = load ptr, ptr @stderr, align 8, !tbaa !11
  %118 = tail call i32 @fflush(ptr noundef %117)
  tail call void @Mat3d_printFormatted(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.8, ptr noundef nonnull %1) #5
  br label %122

119:                                              ; preds = %95
  %120 = tail call double @sqrt(double noundef %.0) #5
  %121 = fdiv double 5.000000e-01, %120
  call void @VecNd_constMul(ptr noundef %0, ptr noundef nonnull %3, double noundef %121, i32 noundef 4) #5
  br label %122

122:                                              ; preds = %97, %100, %119
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #5
  ret i1 %96
}

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

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

declare zeroext i1 @Mat3d_isValid(ptr noundef) local_unnamed_addr #4

declare void @Mat3d_printFormatted(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @VecNd_constMul(ptr noundef, ptr noundef, double noundef, i32 noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree nounwind willreturn memory(write) "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 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 #3 = { 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 #4 = { "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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}


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