; LLVM IR from sh1l0h/ZINC :: src (transformation)

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

%struct.anon = type { float, float, float }

declare void @zinc_mat4_eye(ptr noundef) #0

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

; Function Attrs: nounwind
declare float @sinf(float noundef) #2

; Function Attrs: nounwind
declare float @cosf(float noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local void @zinc_rotate(ptr noundef %0, float noundef %1, ptr noundef %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca ptr, align 8
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store float %1, ptr %5, align 4, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %13 = load float, ptr %5, align 4, !tbaa !9
  %14 = call float @sinf(float noundef %13) #5
  store float %14, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %15 = load float, ptr %5, align 4, !tbaa !9
  %16 = call float @cosf(float noundef %15) #5
  store float %16, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %17 = load float, ptr %8, align 4, !tbaa !9
  %18 = fsub float 1.000000e+00, %17
  store float %18, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.anon, ptr %19, i32 0, i32 0
  %21 = load float, ptr %20, align 4, !tbaa !11
  store float %21, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.anon, ptr %22, i32 0, i32 1
  %24 = load float, ptr %23, align 4, !tbaa !11
  store float %24, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.anon, ptr %25, i32 0, i32 2
  %27 = load float, ptr %26, align 4, !tbaa !11
  store float %27, ptr %12, align 4, !tbaa !9
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  call void @zinc_mat4_eye(ptr noundef %28)
  %29 = load float, ptr %8, align 4, !tbaa !9
  %30 = load float, ptr %10, align 4, !tbaa !9
  %31 = load float, ptr %10, align 4, !tbaa !9
  %32 = fmul float %30, %31
  %33 = load float, ptr %9, align 4, !tbaa !9
  %34 = call float @llvm.fmuladd.f32(float %32, float %33, float %29)
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds [4 x float], ptr %35, i64 0
  %37 = getelementptr inbounds [4 x float], ptr %36, i64 0, i64 0
  store float %34, ptr %37, align 4, !tbaa !9
  %38 = load float, ptr %10, align 4, !tbaa !9
  %39 = load float, ptr %11, align 4, !tbaa !9
  %40 = fmul float %38, %39
  %41 = load float, ptr %9, align 4, !tbaa !9
  %42 = load float, ptr %12, align 4, !tbaa !9
  %43 = load float, ptr %7, align 4, !tbaa !9
  %44 = fmul float %42, %43
  %45 = fneg float %44
  %46 = call float @llvm.fmuladd.f32(float %40, float %41, float %45)
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds [4 x float], ptr %47, i64 0
  %49 = getelementptr inbounds [4 x float], ptr %48, i64 0, i64 1
  store float %46, ptr %49, align 4, !tbaa !9
  %50 = load float, ptr %11, align 4, !tbaa !9
  %51 = load float, ptr %7, align 4, !tbaa !9
  %52 = load float, ptr %10, align 4, !tbaa !9
  %53 = load float, ptr %12, align 4, !tbaa !9
  %54 = fmul float %52, %53
  %55 = load float, ptr %9, align 4, !tbaa !9
  %56 = fmul float %54, %55
  %57 = call float @llvm.fmuladd.f32(float %50, float %51, float %56)
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds [4 x float], ptr %58, i64 0
  %60 = getelementptr inbounds [4 x float], ptr %59, i64 0, i64 2
  store float %57, ptr %60, align 4, !tbaa !9
  %61 = load float, ptr %12, align 4, !tbaa !9
  %62 = load float, ptr %7, align 4, !tbaa !9
  %63 = load float, ptr %10, align 4, !tbaa !9
  %64 = load float, ptr %11, align 4, !tbaa !9
  %65 = fmul float %63, %64
  %66 = load float, ptr %9, align 4, !tbaa !9
  %67 = fmul float %65, %66
  %68 = call float @llvm.fmuladd.f32(float %61, float %62, float %67)
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds [4 x float], ptr %69, i64 1
  %71 = getelementptr inbounds [4 x float], ptr %70, i64 0, i64 0
  store float %68, ptr %71, align 4, !tbaa !9
  %72 = load float, ptr %8, align 4, !tbaa !9
  %73 = load float, ptr %11, align 4, !tbaa !9
  %74 = load float, ptr %11, align 4, !tbaa !9
  %75 = fmul float %73, %74
  %76 = load float, ptr %9, align 4, !tbaa !9
  %77 = call float @llvm.fmuladd.f32(float %75, float %76, float %72)
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = getelementptr inbounds [4 x float], ptr %78, i64 1
  %80 = getelementptr inbounds [4 x float], ptr %79, i64 0, i64 1
  store float %77, ptr %80, align 4, !tbaa !9
  %81 = load float, ptr %10, align 4, !tbaa !9
  %82 = fneg float %81
  %83 = load float, ptr %7, align 4, !tbaa !9
  %84 = load float, ptr %11, align 4, !tbaa !9
  %85 = load float, ptr %12, align 4, !tbaa !9
  %86 = fmul float %84, %85
  %87 = load float, ptr %9, align 4, !tbaa !9
  %88 = fmul float %86, %87
  %89 = call float @llvm.fmuladd.f32(float %82, float %83, float %88)
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds [4 x float], ptr %90, i64 1
  %92 = getelementptr inbounds [4 x float], ptr %91, i64 0, i64 2
  store float %89, ptr %92, align 4, !tbaa !9
  %93 = load float, ptr %11, align 4, !tbaa !9
  %94 = fneg float %93
  %95 = load float, ptr %7, align 4, !tbaa !9
  %96 = load float, ptr %10, align 4, !tbaa !9
  %97 = load float, ptr %11, align 4, !tbaa !9
  %98 = fmul float %96, %97
  %99 = load float, ptr %9, align 4, !tbaa !9
  %100 = fmul float %98, %99
  %101 = call float @llvm.fmuladd.f32(float %94, float %95, float %100)
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = getelementptr inbounds [4 x float], ptr %102, i64 2
  %104 = getelementptr inbounds [4 x float], ptr %103, i64 0, i64 0
  store float %101, ptr %104, align 4, !tbaa !9
  %105 = load float, ptr %10, align 4, !tbaa !9
  %106 = load float, ptr %7, align 4, !tbaa !9
  %107 = load float, ptr %11, align 4, !tbaa !9
  %108 = load float, ptr %12, align 4, !tbaa !9
  %109 = fmul float %107, %108
  %110 = load float, ptr %9, align 4, !tbaa !9
  %111 = fmul float %109, %110
  %112 = call float @llvm.fmuladd.f32(float %105, float %106, float %111)
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  %114 = getelementptr inbounds [4 x float], ptr %113, i64 2
  %115 = getelementptr inbounds [4 x float], ptr %114, i64 0, i64 1
  store float %112, ptr %115, align 4, !tbaa !9
  %116 = load float, ptr %8, align 4, !tbaa !9
  %117 = load float, ptr %12, align 4, !tbaa !9
  %118 = load float, ptr %12, align 4, !tbaa !9
  %119 = fmul float %117, %118
  %120 = load float, ptr %9, align 4, !tbaa !9
  %121 = call float @llvm.fmuladd.f32(float %119, float %120, float %116)
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds [4 x float], ptr %122, i64 2
  %124 = getelementptr inbounds [4 x float], ptr %123, i64 0, i64 2
  store float %121, ptr %124, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #4

attributes #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 = { 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 #3 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!7, !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"

declare void @zinc_mat4_eye(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @sinf(float noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @cosf(float noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @zinc_rotate(ptr noundef %0, float noundef %1, ptr nocapture noundef readonly %2) local_unnamed_addr #2 {
  %4 = tail call float @sinf(float noundef %1) #5
  %5 = tail call float @cosf(float noundef %1) #5
  %6 = fsub float 1.000000e+00, %5
  %7 = getelementptr inbounds i8, ptr %2, i64 8
  %8 = load float, ptr %7, align 4, !tbaa !5
  %9 = fneg float %8
  %10 = fmul float %4, %9
  %11 = load <2 x float>, ptr %2, align 4, !tbaa !5
  tail call void @zinc_mat4_eye(ptr noundef %0) #5
  %12 = shufflevector <2 x float> %11, <2 x float> poison, <2 x i32> zeroinitializer
  %13 = fmul <2 x float> %12, %11
  %14 = insertelement <2 x float> poison, float %6, i64 0
  %15 = shufflevector <2 x float> %14, <2 x float> poison, <2 x i32> zeroinitializer
  %16 = insertelement <2 x float> poison, float %5, i64 0
  %17 = insertelement <2 x float> %16, float %10, i64 1
  %18 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %13, <2 x float> %15, <2 x float> %17)
  store <2 x float> %18, ptr %0, align 4, !tbaa !8
  %19 = extractelement <2 x float> %11, i64 0
  %20 = fmul float %19, %8
  %21 = fmul float %6, %20
  %22 = extractelement <2 x float> %11, i64 1
  %23 = tail call float @llvm.fmuladd.f32(float %22, float %4, float %21)
  %24 = getelementptr inbounds i8, ptr %0, i64 8
  store float %23, ptr %24, align 4, !tbaa !8
  %25 = extractelement <2 x float> %13, i64 1
  %26 = fmul float %6, %25
  %27 = getelementptr inbounds i8, ptr %0, i64 16
  %28 = fmul float %22, %22
  %29 = insertelement <2 x float> poison, float %8, i64 0
  %30 = insertelement <2 x float> %29, float %28, i64 1
  %31 = insertelement <2 x float> poison, float %4, i64 0
  %32 = insertelement <2 x float> %31, float %6, i64 1
  %33 = insertelement <2 x float> poison, float %26, i64 0
  %34 = insertelement <2 x float> %33, float %5, i64 1
  %35 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %30, <2 x float> %32, <2 x float> %34)
  store <2 x float> %35, ptr %27, align 4, !tbaa !8
  %36 = fneg float %19
  %37 = fmul float %22, %8
  %38 = fmul float %6, %37
  %39 = tail call float @llvm.fmuladd.f32(float %36, float %4, float %38)
  %40 = getelementptr inbounds i8, ptr %0, i64 24
  store float %39, ptr %40, align 4, !tbaa !8
  %41 = fneg float %22
  %42 = tail call float @llvm.fmuladd.f32(float %41, float %4, float %26)
  %43 = getelementptr inbounds i8, ptr %0, i64 32
  store float %42, ptr %43, align 4, !tbaa !8
  %44 = getelementptr inbounds i8, ptr %0, i64 36
  %45 = fmul float %8, %8
  %46 = insertelement <2 x float> %11, float %45, i64 1
  %47 = insertelement <2 x float> poison, float %38, i64 0
  %48 = insertelement <2 x float> %47, float %5, i64 1
  %49 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %46, <2 x float> %32, <2 x float> %48)
  store <2 x float> %49, ptr %44, align 4, !tbaa !8
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x float> @llvm.fmuladd.v2f32(<2 x float>, <2 x float>, <2 x float>) #4

attributes #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 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"float", !6, i64 0}


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