; LLVM IR from unitreerobotics/kinect_teleoperate :: src/extern/glfw/src/tests (gamma)

; 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.nk_rect = type { float, float, float, float }
%struct.nk_input = type { %struct.nk_keyboard, %struct.nk_mouse }
%struct.nk_keyboard = type { [30 x %struct.nk_key], [16 x i8], i32 }
%struct.nk_key = type { i32, i32 }
%struct.nk_mouse = type { [4 x %struct.nk_mouse_button], %struct.nk_vec2, %struct.nk_vec2, %struct.nk_vec2, %struct.nk_vec2, i8, i8, i8 }
%struct.nk_mouse_button = type { i32, i32, %struct.nk_vec2 }
%struct.nk_vec2 = type { float, float }

; Function Attrs: nounwind uwtable
define dso_local i32 @nk_input_is_mouse_hovering_rect(ptr noundef %0, <2 x float> %1, <2 x float> %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca %struct.nk_rect, align 4
  %6 = alloca ptr, align 8
  %7 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %5, i32 0, i32 0
  store <2 x float> %1, ptr %7, align 4
  %8 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %5, i32 0, i32 1
  store <2 x float> %2, ptr %8, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  %9 = load ptr, ptr %6, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %12, label %11

11:                                               ; preds = %3
  store i32 0, ptr %4, align 4
  br label %59

12:                                               ; preds = %3
  %13 = getelementptr inbounds %struct.nk_rect, ptr %5, i32 0, i32 0
  %14 = load float, ptr %13, align 4, !tbaa !9
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.nk_input, ptr %15, i32 0, i32 1
  %17 = getelementptr inbounds %struct.nk_mouse, ptr %16, i32 0, i32 1
  %18 = getelementptr inbounds %struct.nk_vec2, ptr %17, i32 0, i32 0
  %19 = load float, ptr %18, align 4, !tbaa !12
  %20 = fcmp ole float %14, %19
  br i1 %20, label %21, label %56

21:                                               ; preds = %12
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.nk_input, ptr %22, i32 0, i32 1
  %24 = getelementptr inbounds %struct.nk_mouse, ptr %23, i32 0, i32 1
  %25 = getelementptr inbounds %struct.nk_vec2, ptr %24, i32 0, i32 0
  %26 = load float, ptr %25, align 4, !tbaa !12
  %27 = getelementptr inbounds %struct.nk_rect, ptr %5, i32 0, i32 0
  %28 = load float, ptr %27, align 4, !tbaa !9
  %29 = getelementptr inbounds %struct.nk_rect, ptr %5, i32 0, i32 2
  %30 = load float, ptr %29, align 4, !tbaa !18
  %31 = fadd float %28, %30
  %32 = fcmp olt float %26, %31
  br i1 %32, label %33, label %56

33:                                               ; preds = %21
  %34 = getelementptr inbounds %struct.nk_rect, ptr %5, i32 0, i32 1
  %35 = load float, ptr %34, align 4, !tbaa !19
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.nk_input, ptr %36, i32 0, i32 1
  %38 = getelementptr inbounds %struct.nk_mouse, ptr %37, i32 0, i32 1
  %39 = getelementptr inbounds %struct.nk_vec2, ptr %38, i32 0, i32 1
  %40 = load float, ptr %39, align 4, !tbaa !20
  %41 = fcmp ole float %35, %40
  br i1 %41, label %42, label %54

42:                                               ; preds = %33
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.nk_input, ptr %43, i32 0, i32 1
  %45 = getelementptr inbounds %struct.nk_mouse, ptr %44, i32 0, i32 1
  %46 = getelementptr inbounds %struct.nk_vec2, ptr %45, i32 0, i32 1
  %47 = load float, ptr %46, align 4, !tbaa !20
  %48 = getelementptr inbounds %struct.nk_rect, ptr %5, i32 0, i32 1
  %49 = load float, ptr %48, align 4, !tbaa !19
  %50 = getelementptr inbounds %struct.nk_rect, ptr %5, i32 0, i32 3
  %51 = load float, ptr %50, align 4, !tbaa !21
  %52 = fadd float %49, %51
  %53 = fcmp olt float %47, %52
  br label %54

54:                                               ; preds = %42, %33
  %55 = phi i1 [ false, %33 ], [ %53, %42 ]
  br label %56

56:                                               ; preds = %54, %21, %12
  %57 = phi i1 [ false, %21 ], [ false, %12 ], [ %55, %54 ]
  %58 = zext i1 %57 to i32
  store i32 %58, ptr %4, align 4
  br label %59

59:                                               ; preds = %56, %11
  %60 = load i32, ptr %4, align 4
  ret i32 %60
}

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

!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, !11, i64 0}
!10 = !{!"nk_rect", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!11 = !{!"float", !7, i64 0}
!12 = !{!13, !11, i64 324}
!13 = !{!"nk_input", !14, i64 0, !16, i64 260}
!14 = !{!"nk_keyboard", !7, i64 0, !7, i64 240, !15, i64 256}
!15 = !{!"int", !7, i64 0}
!16 = !{!"nk_mouse", !7, i64 0, !17, i64 64, !17, i64 72, !17, i64 80, !17, i64 88, !7, i64 96, !7, i64 97, !7, i64 98}
!17 = !{!"nk_vec2", !11, i64 0, !11, i64 4}
!18 = !{!10, !11, i64 8}
!19 = !{!10, !11, i64 4}
!20 = !{!13, !11, i64 328}
!21 = !{!10, !11, i64 12}


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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local range(i32 0, 2) i32 @nk_input_is_mouse_hovering_rect(ptr noundef readonly %0, <2 x float> %1, <2 x float> %2) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %20, label %4

4:                                                ; preds = %3
  %.sroa.0.0.vec.extract = extractelement <2 x float> %1, i64 0
  %5 = getelementptr inbounds i8, ptr %0, i64 324
  %6 = load float, ptr %5, align 4, !tbaa !5
  %7 = fcmp ole float %.sroa.0.0.vec.extract, %6
  %8 = fadd <2 x float> %1, %2
  %9 = extractelement <2 x float> %8, i64 0
  %10 = fcmp olt float %6, %9
  %or.cond = select i1 %7, i1 %10, i1 false
  br i1 %or.cond, label %11, label %20

11:                                               ; preds = %4
  %.sroa.0.4.vec.extract = extractelement <2 x float> %1, i64 1
  %12 = getelementptr inbounds i8, ptr %0, i64 328
  %13 = load float, ptr %12, align 4, !tbaa !14
  %14 = fcmp ugt float %.sroa.0.4.vec.extract, %13
  br i1 %14, label %20, label %15

15:                                               ; preds = %11
  %16 = fadd <2 x float> %1, %2
  %17 = extractelement <2 x float> %16, i64 1
  %18 = fcmp olt float %13, %17
  %19 = zext i1 %18 to i32
  br label %20

20:                                               ; preds = %4, %15, %11, %3
  %.0 = phi i32 [ 0, %3 ], [ 0, %4 ], [ 0, %11 ], [ %19, %15 ]
  ret i32 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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" }

!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, !13, i64 324}
!6 = !{!"nk_input", !7, i64 0, !11, i64 260}
!7 = !{!"nk_keyboard", !8, i64 0, !8, i64 240, !10, i64 256}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"nk_mouse", !8, i64 0, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !8, i64 96, !8, i64 97, !8, i64 98}
!12 = !{!"nk_vec2", !13, i64 0, !13, i64 4}
!13 = !{!"float", !8, i64 0}
!14 = !{!6, !13, i64 328}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,VectorCombinePass