; LLVM IR from jgaeddert/liquid-dsp :: sandbox (matrix_eig_test)

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

@__const.main.A = external hidden unnamed_addr constant [9 x float], align 16
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca [9 x float], align 16
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 8, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 3, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 36, ptr %4) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %4, ptr align 16 @__const.main.A, i64 36, i1 false)
  %12 = load i32, ptr %3, align 4, !tbaa !5
  %13 = zext i32 %12 to i64
  %14 = call ptr @llvm.stacksave.p0()
  store ptr %14, ptr %5, align 8
  %15 = alloca float, i64 %13, align 16
  store i64 %13, ptr %6, align 8
  %16 = load i32, ptr %3, align 4, !tbaa !5
  %17 = load i32, ptr %3, align 4, !tbaa !5
  %18 = mul i32 %16, %17
  %19 = zext i32 %18 to i64
  %20 = alloca float, i64 %19, align 16
  store i64 %19, ptr %7, align 8
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = mul i32 %21, %22
  %24 = zext i32 %23 to i64
  %25 = alloca float, i64 %24, align 16
  store i64 %24, ptr %8, align 8
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = mul i32 %26, %27
  %29 = zext i32 %28 to i64
  %30 = alloca float, i64 %29, align 16
  store i64 %29, ptr %9, align 8
  %31 = getelementptr inbounds [9 x float], ptr %4, i64 0, i64 0
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = mul i32 %32, %33
  %35 = zext i32 %34 to i64
  %36 = mul i64 %35, 4
  call void @llvm.memmove.p0.p0.i64(ptr align 16 %20, ptr align 16 %31, i64 %36, i1 false)
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  %39 = getelementptr inbounds [9 x float], ptr %4, i64 0, i64 0
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = call i32 @matrixf_qrdecomp_gramschmidt(ptr noundef %39, i32 noundef %40, i32 noundef %41, ptr noundef %25, ptr noundef %30)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %61, %0
  %44 = load i32, ptr %10, align 4, !tbaa !5
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = icmp ult i32 %44, %45
  br i1 %46, label %47, label %64

47:                                               ; preds = %43
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = call i32 @matrixf_qrdecomp_gramschmidt(ptr noundef %20, i32 noundef %48, i32 noundef %49, ptr noundef %25, ptr noundef %30)
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = call i32 @matrixf_mul(ptr noundef %30, i32 noundef %51, i32 noundef %52, ptr noundef %25, i32 noundef %53, i32 noundef %54, ptr noundef %20, i32 noundef %55, i32 noundef %56)
  %58 = load i32, ptr %3, align 4, !tbaa !5
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = call i32 @matrixf_print(ptr noundef %20, i32 noundef %58, i32 noundef %59)
  br label %61

61:                                               ; preds = %47
  %62 = load i32, ptr %10, align 4, !tbaa !5
  %63 = add i32 %62, 1
  store i32 %63, ptr %10, align 4, !tbaa !5
  br label %43, !llvm.loop !9

64:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %81, %64
  %66 = load i32, ptr %11, align 4, !tbaa !5
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = icmp ult i32 %66, %67
  br i1 %68, label %69, label %84

69:                                               ; preds = %65
  %70 = load i32, ptr %11, align 4, !tbaa !5
  %71 = load i32, ptr %3, align 4, !tbaa !5
  %72 = mul i32 %70, %71
  %73 = load i32, ptr %11, align 4, !tbaa !5
  %74 = add i32 %72, %73
  %75 = zext i32 %74 to i64
  %76 = getelementptr inbounds float, ptr %20, i64 %75
  %77 = load float, ptr %76, align 4, !tbaa !11
  %78 = load i32, ptr %11, align 4, !tbaa !5
  %79 = zext i32 %78 to i64
  %80 = getelementptr inbounds float, ptr %15, i64 %79
  store float %77, ptr %80, align 4, !tbaa !11
  br label %81

81:                                               ; preds = %69
  %82 = load i32, ptr %11, align 4, !tbaa !5
  %83 = add i32 %82, 1
  store i32 %83, ptr %11, align 4, !tbaa !5
  br label %65, !llvm.loop !13

84:                                               ; preds = %65
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %97, %84
  %86 = load i32, ptr %11, align 4, !tbaa !5
  %87 = load i32, ptr %3, align 4, !tbaa !5
  %88 = icmp ult i32 %86, %87
  br i1 %88, label %89, label %100

89:                                               ; preds = %85
  %90 = load i32, ptr %11, align 4, !tbaa !5
  %91 = load i32, ptr %11, align 4, !tbaa !5
  %92 = zext i32 %91 to i64
  %93 = getelementptr inbounds float, ptr %15, i64 %92
  %94 = load float, ptr %93, align 4, !tbaa !11
  %95 = fpext float %94 to double
  %96 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %90, double noundef %95)
  br label %97

97:                                               ; preds = %89
  %98 = load i32, ptr %11, align 4, !tbaa !5
  %99 = add i32 %98, 1
  store i32 %99, ptr %11, align 4, !tbaa !5
  br label %85, !llvm.loop !14

100:                                              ; preds = %85
  %101 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %102 = load ptr, ptr %5, align 8
  call void @llvm.stackrestore.p0(ptr %102)
  call void @llvm.lifetime.end.p0(i64 36, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %103 = load i32, ptr %1, align 4
  ret i32 %103
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #2

declare i32 @printf(ptr noundef, ...) #4

declare i32 @matrixf_qrdecomp_gramschmidt(ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) #4

declare i32 @matrixf_mul(ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) #4

declare i32 @matrixf_print(ptr noundef, i32 noundef, i32 noundef) #4

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nosync nounwind willreturn }
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 }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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

@__const.main.A = external hidden unnamed_addr constant [9 x float], align 16
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
.preheader38.preheader:
  %0 = alloca [9 x float], align 16
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %0) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(36) %0, ptr noundef nonnull align 16 dereferenceable(36) @__const.main.A, i64 36, i1 false)
  %1 = tail call ptr @llvm.stacksave.p0()
  %2 = alloca [9 x float], align 16
  %3 = alloca [9 x float], align 16
  %4 = alloca [9 x float], align 16
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(36) %2, ptr noundef nonnull align 16 dereferenceable(36) @__const.main.A, i64 36, i1 false)
  %5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %7 = call i32 @matrixf_qrdecomp_gramschmidt(ptr noundef nonnull %0, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %3, ptr noundef nonnull %4) #6
  %8 = call i32 @matrixf_qrdecomp_gramschmidt(ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %3, ptr noundef nonnull %4) #6
  %9 = call i32 @matrixf_mul(ptr noundef nonnull %4, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %3, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3) #6
  %10 = call i32 @matrixf_print(ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3) #6
  %11 = call i32 @matrixf_qrdecomp_gramschmidt(ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %3, ptr noundef nonnull %4) #6
  %12 = call i32 @matrixf_mul(ptr noundef nonnull %4, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %3, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3) #6
  %13 = call i32 @matrixf_print(ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3) #6
  %14 = call i32 @matrixf_qrdecomp_gramschmidt(ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %3, ptr noundef nonnull %4) #6
  %15 = call i32 @matrixf_mul(ptr noundef nonnull %4, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %3, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3) #6
  %16 = call i32 @matrixf_print(ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3) #6
  %17 = call i32 @matrixf_qrdecomp_gramschmidt(ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %3, ptr noundef nonnull %4) #6
  %18 = call i32 @matrixf_mul(ptr noundef nonnull %4, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %3, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3) #6
  %19 = call i32 @matrixf_print(ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3) #6
  %20 = call i32 @matrixf_qrdecomp_gramschmidt(ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %3, ptr noundef nonnull %4) #6
  %21 = call i32 @matrixf_mul(ptr noundef nonnull %4, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %3, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3) #6
  %22 = call i32 @matrixf_print(ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3) #6
  %23 = call i32 @matrixf_qrdecomp_gramschmidt(ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %3, ptr noundef nonnull %4) #6
  %24 = call i32 @matrixf_mul(ptr noundef nonnull %4, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %3, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3) #6
  %25 = call i32 @matrixf_print(ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3) #6
  %26 = call i32 @matrixf_qrdecomp_gramschmidt(ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %3, ptr noundef nonnull %4) #6
  %27 = call i32 @matrixf_mul(ptr noundef nonnull %4, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %3, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3) #6
  %28 = call i32 @matrixf_print(ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3) #6
  %29 = call i32 @matrixf_qrdecomp_gramschmidt(ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %3, ptr noundef nonnull %4) #6
  %30 = call i32 @matrixf_mul(ptr noundef nonnull %4, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %3, i32 noundef 3, i32 noundef 3, ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3) #6
  %31 = call i32 @matrixf_print(ptr noundef nonnull %2, i32 noundef 3, i32 noundef 3) #6
  %32 = load float, ptr %2, align 16, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %2, i64 16
  %34 = load float, ptr %33, align 16, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %2, i64 32
  %36 = load float, ptr %35, align 16, !tbaa !5
  %37 = fpext float %32 to double
  %38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 0, double noundef %37)
  %39 = fpext float %34 to double
  %40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 1, double noundef %39)
  %41 = fpext float %36 to double
  %42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 2, double noundef %41)
  %43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  call void @llvm.stackrestore.p0(ptr %1)
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %0) #6
  ret i32 0
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

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

declare i32 @matrixf_qrdecomp_gramschmidt(ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

declare i32 @matrixf_mul(ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #5

declare i32 @matrixf_print(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { 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 #5 = { "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 #6 = { 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass