; LLVM IR from goldest-star/seawave-animation :: src/vcl/wrapper/glfw/events (events)

; 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.vcl::buffer_stack" = type { float, float }

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_ZN3vcl30glfw_cursor_coordinates_windowEP10GLFWwindow(ptr noundef %0) #0 {
  %2 = alloca %"struct.vcl::buffer_stack", align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 0, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  call void @glfwGetWindowSize(ptr noundef %10, ptr noundef %4, ptr noundef %5)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store double 0.000000e+00, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store double 0.000000e+00, ptr %7, align 8, !tbaa !11
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  call void @glfwGetCursorPos(ptr noundef %11, ptr noundef %6, ptr noundef %7)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %12 = load double, ptr %6, align 8, !tbaa !11
  %13 = fptrunc double %12 to float
  %14 = fmul float 2.000000e+00, %13
  %15 = load i32, ptr %4, align 4, !tbaa !9
  %16 = sitofp i32 %15 to float
  %17 = fdiv float %14, %16
  %18 = fsub float %17, 1.000000e+00
  store float %18, ptr %8, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %19 = load double, ptr %7, align 8, !tbaa !11
  %20 = fptrunc double %19 to float
  %21 = fmul float 2.000000e+00, %20
  %22 = load i32, ptr %5, align 4, !tbaa !9
  %23 = sitofp i32 %22 to float
  %24 = fdiv float %21, %23
  %25 = fsub float 1.000000e+00, %24
  store float %25, ptr %9, align 4, !tbaa !13
  %26 = load float, ptr %8, align 4, !tbaa !13
  %27 = load float, ptr %9, align 4, !tbaa !13
  call void @_ZN3vcl12buffer_stackIfLm2EEC1Eff(ptr noundef nonnull align 4 dereferenceable(8) %2, float noundef %26, float noundef %27)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  %28 = load <2 x float>, ptr %2, align 4
  ret <2 x float> %28
}

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

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

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

declare void @_ZN3vcl12buffer_stackIfLm2EEC1Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #2

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="64" "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 = { "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 }

!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}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !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"

%"struct.vcl::buffer_stack" = type { float, float }

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_ZN3vcl30glfw_cursor_coordinates_windowEP10GLFWwindow(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca %"struct.vcl::buffer_stack", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #3
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #3
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @glfwGetWindowSize(ptr noundef %0, ptr noundef nonnull %3, ptr noundef nonnull %4)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  store double 0.000000e+00, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  store double 0.000000e+00, ptr %6, align 8, !tbaa !9
  call void @glfwGetCursorPos(ptr noundef %0, ptr noundef nonnull %5, ptr noundef nonnull %6)
  %7 = load double, ptr %5, align 8, !tbaa !9
  %8 = fptrunc double %7 to float
  %9 = fmul float %8, 2.000000e+00
  %10 = load i32, ptr %3, align 4, !tbaa !5
  %11 = sitofp i32 %10 to float
  %12 = fdiv float %9, %11
  %13 = fadd float %12, -1.000000e+00
  %14 = load double, ptr %6, align 8, !tbaa !9
  %15 = fptrunc double %14 to float
  %16 = fmul float %15, 2.000000e+00
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = sitofp i32 %17 to float
  %19 = fdiv float %16, %18
  %20 = fsub float 1.000000e+00, %19
  call void @_ZN3vcl12buffer_stackIfLm2EEC1Eff(ptr noundef nonnull align 4 dereferenceable(8) %2, float noundef %13, float noundef %20)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #3
  %21 = load <2 x float>, ptr %2, align 8
  ret <2 x float> %21
}

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

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

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

declare void @_ZN3vcl12buffer_stackIfLm2EEC1Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #2

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="64" "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 = { "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 }

!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 = !{!"double", !7, i64 0}


; Effective O3 passes: GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SROAPass