; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: nounwind uwtable
define dso_local i32 @nk_input_has_mouse_click_in_rect(ptr noundef %0, i32 noundef %1, <2 x float> %2, <2 x float> %3) #1 {
  %5 = alloca i32, align 4
  %6 = alloca %struct.nk_rect, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %6, i32 0, i32 0
  store <2 x float> %2, ptr %11, align 4
  %12 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %6, i32 0, i32 1
  store <2 x float> %3, ptr %12, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  %13 = load ptr, ptr %7, align 8, !tbaa !5
  %14 = icmp ne ptr %13, null
  br i1 %14, label %16, label %15

15:                                               ; preds = %4
  store i32 0, ptr %5, align 4
  store i32 1, ptr %10, align 4
  br label %62

16:                                               ; preds = %4
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.nk_input, ptr %17, i32 0, i32 1
  %19 = getelementptr inbounds %struct.nk_mouse, ptr %18, i32 0, i32 0
  %20 = load i32, ptr %8, align 4, !tbaa !9
  %21 = zext i32 %20 to i64
  %22 = getelementptr inbounds [4 x %struct.nk_mouse_button], ptr %19, i64 0, i64 %21
  store ptr %22, ptr %9, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 0
  %24 = load float, ptr %23, align 4, !tbaa !11
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.nk_mouse_button, ptr %25, i32 0, i32 2
  %27 = getelementptr inbounds %struct.nk_vec2, ptr %26, i32 0, i32 0
  %28 = load float, ptr %27, align 4, !tbaa !14
  %29 = fcmp ole float %24, %28
  br i1 %29, label %30, label %60

30:                                               ; preds = %16
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.nk_mouse_button, ptr %31, i32 0, i32 2
  %33 = getelementptr inbounds %struct.nk_vec2, ptr %32, i32 0, i32 0
  %34 = load float, ptr %33, align 4, !tbaa !14
  %35 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 0
  %36 = load float, ptr %35, align 4, !tbaa !11
  %37 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 2
  %38 = load float, ptr %37, align 4, !tbaa !17
  %39 = fadd float %36, %38
  %40 = fcmp olt float %34, %39
  br i1 %40, label %41, label %60

41:                                               ; preds = %30
  %42 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 1
  %43 = load float, ptr %42, align 4, !tbaa !18
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.nk_mouse_button, ptr %44, i32 0, i32 2
  %46 = getelementptr inbounds %struct.nk_vec2, ptr %45, i32 0, i32 1
  %47 = load float, ptr %46, align 4, !tbaa !19
  %48 = fcmp ole float %43, %47
  br i1 %48, label %49, label %60

49:                                               ; preds = %41
  %50 = load ptr, ptr %9, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.nk_mouse_button, ptr %50, i32 0, i32 2
  %52 = getelementptr inbounds %struct.nk_vec2, ptr %51, i32 0, i32 1
  %53 = load float, ptr %52, align 4, !tbaa !19
  %54 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 1
  %55 = load float, ptr %54, align 4, !tbaa !18
  %56 = getelementptr inbounds %struct.nk_rect, ptr %6, i32 0, i32 3
  %57 = load float, ptr %56, align 4, !tbaa !20
  %58 = fadd float %55, %57
  %59 = fcmp olt float %53, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %49, %41, %30, %16
  store i32 0, ptr %5, align 4
  store i32 1, ptr %10, align 4
  br label %62

61:                                               ; preds = %49
  store i32 1, ptr %5, align 4
  store i32 1, ptr %10, align 4
  br label %62

62:                                               ; preds = %61, %60, %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  %63 = load i32, ptr %5, align 4
  ret i32 %63
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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" }
attributes #2 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"nk_rect", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!13 = !{!"float", !7, i64 0}
!14 = !{!15, !13, i64 8}
!15 = !{!"nk_mouse_button", !10, i64 0, !10, i64 4, !16, i64 8}
!16 = !{!"nk_vec2", !13, i64 0, !13, i64 4}
!17 = !{!12, !13, i64 8}
!18 = !{!12, !13, i64 4}
!19 = !{!15, !13, i64 12}
!20 = !{!12, !13, 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"

%struct.nk_mouse_button = type { i32, i32, %struct.nk_vec2 }
%struct.nk_vec2 = type { float, float }

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

5:                                                ; preds = %4
  %6 = getelementptr inbounds i8, ptr %0, i64 260
  %7 = zext i32 %1 to i64
  %.sroa.0.0.vec.extract = extractelement <2 x float> %2, i64 0
  %8 = getelementptr inbounds [4 x %struct.nk_mouse_button], ptr %6, i64 0, i64 %7, i32 2
  %9 = load float, ptr %8, align 4, !tbaa !5
  %10 = fcmp ole float %.sroa.0.0.vec.extract, %9
  %11 = fadd <2 x float> %2, %3
  %12 = extractelement <2 x float> %11, i64 0
  %13 = fcmp olt float %9, %12
  %or.cond = select i1 %10, i1 %13, i1 false
  br i1 %or.cond, label %14, label %21

14:                                               ; preds = %5
  %.sroa.0.4.vec.extract = extractelement <2 x float> %2, i64 1
  %15 = getelementptr inbounds i8, ptr %8, i64 4
  %16 = load float, ptr %15, align 4, !tbaa !12
  %17 = fcmp ole float %.sroa.0.4.vec.extract, %16
  %18 = fadd <2 x float> %2, %3
  %19 = extractelement <2 x float> %18, i64 1
  %20 = fcmp olt float %16, %19
  %or.cond16 = select i1 %17, i1 %20, i1 false
  %spec.select = zext i1 %or.cond16 to i32
  br label %21

21:                                               ; preds = %14, %5, %4
  %.0 = phi i32 [ 0, %4 ], [ 0, %5 ], [ %spec.select, %14 ]
  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, !11, i64 8}
!6 = !{!"nk_mouse_button", !7, i64 0, !7, i64 4, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"nk_vec2", !11, i64 0, !11, i64 4}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !11, i64 12}


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