; LLVM IR from Angelo1211/SoftwareRenderer :: src/matrix.ll (ZN7Matrix45printEv)

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

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64), i64 noundef, i64 noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7Matrix45printEv(ptr noundef nonnull align 4 dereferenceable(64) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca float, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %8 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 4, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %9

9:                                                ; preds = %35, %1
  %10 = load i32, ptr %4, align 4, !tbaa !9
  %11 = load i32, ptr %3, align 4, !tbaa !9
  %12 = icmp slt i32 %10, %11
  br i1 %12, label %14, label %13

13:                                               ; preds = %9
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %38

14:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %30, %14
  %16 = load i32, ptr %6, align 4, !tbaa !9
  %17 = load i32, ptr %3, align 4, !tbaa !9
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %33

20:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %21 = load i32, ptr %4, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64) %8, i64 noundef %22, i64 noundef %24)
  %26 = load float, ptr %25, align 4, !tbaa !11
  store float %26, ptr %7, align 4, !tbaa !11
  %27 = load float, ptr %7, align 4, !tbaa !11
  %28 = fpext float %27 to double
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str, double noundef %28)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %30

30:                                               ; preds = %20
  %31 = load i32, ptr %6, align 4, !tbaa !9
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %6, align 4, !tbaa !9
  br label %15, !llvm.loop !13

33:                                               ; preds = %19
  %34 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  br label %35

35:                                               ; preds = %33
  %36 = load i32, ptr %4, align 4, !tbaa !9
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %4, align 4, !tbaa !9
  br label %9, !llvm.loop !15

38:                                               ; preds = %13
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret void
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64), i64 noundef, i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7Matrix45printEv(ptr noundef nonnull align 4 dereferenceable(64) %0) local_unnamed_addr #0 align 2 {
.preheader:
  %1 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64) %0, i64 noundef 0, i64 noundef 0)
  %2 = load float, ptr %1, align 4, !tbaa !5
  %3 = fpext float %2 to double
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %3)
  %5 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64) %0, i64 noundef 0, i64 noundef 1)
  %6 = load float, ptr %5, align 4, !tbaa !5
  %7 = fpext float %6 to double
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %7)
  %9 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64) %0, i64 noundef 0, i64 noundef 2)
  %10 = load float, ptr %9, align 4, !tbaa !5
  %11 = fpext float %10 to double
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %11)
  %13 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64) %0, i64 noundef 0, i64 noundef 3)
  %14 = load float, ptr %13, align 4, !tbaa !5
  %15 = fpext float %14 to double
  %16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %15)
  %17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %18 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64) %0, i64 noundef 1, i64 noundef 0)
  %19 = load float, ptr %18, align 4, !tbaa !5
  %20 = fpext float %19 to double
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %20)
  %22 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64) %0, i64 noundef 1, i64 noundef 1)
  %23 = load float, ptr %22, align 4, !tbaa !5
  %24 = fpext float %23 to double
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %24)
  %26 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64) %0, i64 noundef 1, i64 noundef 2)
  %27 = load float, ptr %26, align 4, !tbaa !5
  %28 = fpext float %27 to double
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %28)
  %30 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64) %0, i64 noundef 1, i64 noundef 3)
  %31 = load float, ptr %30, align 4, !tbaa !5
  %32 = fpext float %31 to double
  %33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %32)
  %34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %35 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64) %0, i64 noundef 2, i64 noundef 0)
  %36 = load float, ptr %35, align 4, !tbaa !5
  %37 = fpext float %36 to double
  %38 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %37)
  %39 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64) %0, i64 noundef 2, i64 noundef 1)
  %40 = load float, ptr %39, align 4, !tbaa !5
  %41 = fpext float %40 to double
  %42 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %41)
  %43 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64) %0, i64 noundef 2, i64 noundef 2)
  %44 = load float, ptr %43, align 4, !tbaa !5
  %45 = fpext float %44 to double
  %46 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %45)
  %47 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64) %0, i64 noundef 2, i64 noundef 3)
  %48 = load float, ptr %47, align 4, !tbaa !5
  %49 = fpext float %48 to double
  %50 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %49)
  %51 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %52 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64) %0, i64 noundef 3, i64 noundef 0)
  %53 = load float, ptr %52, align 4, !tbaa !5
  %54 = fpext float %53 to double
  %55 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %54)
  %56 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64) %0, i64 noundef 3, i64 noundef 1)
  %57 = load float, ptr %56, align 4, !tbaa !5
  %58 = fpext float %57 to double
  %59 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %58)
  %60 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64) %0, i64 noundef 3, i64 noundef 2)
  %61 = load float, ptr %60, align 4, !tbaa !5
  %62 = fpext float %61 to double
  %63 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %62)
  %64 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7Matrix4clEmm(ptr noundef nonnull align 4 dereferenceable(64) %0, i64 noundef 3, i64 noundef 3)
  %65 = load float, ptr %64, align 4, !tbaa !5
  %66 = fpext float %65 to double
  %67 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %66)
  %68 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %69 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  ret void
}

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

attributes #0 = { mustprogress 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 = { 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" }

!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++ TBAA"}


; Effective O3 passes: GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass