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

; 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
declare dso_local i32 @nk_input_is_mouse_click_in_rect(ptr noundef, i32 noundef, <2 x float>, <2 x float>) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @nk_input_any_mouse_click_in_rect(ptr noundef %0, <2 x float> %1, <2 x float> %2) #1 {
  %4 = alloca %struct.nk_rect, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %4, i32 0, i32 0
  store <2 x float> %1, ptr %8, align 4
  %9 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %4, i32 0, i32 1
  store <2 x float> %2, ptr %9, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  store i32 0, ptr %7, align 4, !tbaa !9
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %10

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

13:                                               ; preds = %10
  %14 = load i32, ptr %7, align 4, !tbaa !9
  %15 = icmp ne i32 %14, 0
  br i1 %15, label %25, label %16

16:                                               ; preds = %13
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = load i32, ptr %6, align 4, !tbaa !9
  %19 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %4, i32 0, i32 0
  %20 = load <2 x float>, ptr %19, align 4
  %21 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %4, i32 0, i32 1
  %22 = load <2 x float>, ptr %21, align 4
  %23 = call i32 @nk_input_is_mouse_click_in_rect(ptr noundef %17, i32 noundef %18, <2 x float> %20, <2 x float> %22)
  %24 = icmp ne i32 %23, 0
  br label %25

25:                                               ; preds = %16, %13
  %26 = phi i1 [ true, %13 ], [ %24, %16 ]
  %27 = zext i1 %26 to i32
  store i32 %27, ptr %7, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %25
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %6, align 4, !tbaa !9
  br label %10, !llvm.loop !11

31:                                               ; preds = %10
  %32 = load i32, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  ret i32 %32
}

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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; 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: nounwind uwtable
declare dso_local i32 @nk_input_is_mouse_click_in_rect(ptr noundef, i32 noundef, <2 x float>, <2 x float>) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @nk_input_any_mouse_click_in_rect(ptr noundef %0, <2 x float> %1, <2 x float> %2) local_unnamed_addr #0 {
  %4 = tail call i32 @nk_input_is_mouse_click_in_rect(ptr noundef %0, i32 noundef 0, <2 x float> %1, <2 x float> %2)
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %5, label %.thread11

5:                                                ; preds = %3
  %6 = tail call i32 @nk_input_is_mouse_click_in_rect(ptr noundef %0, i32 noundef 1, <2 x float> %1, <2 x float> %2)
  %.not8 = icmp eq i32 %6, 0
  br i1 %.not8, label %7, label %.thread11

7:                                                ; preds = %5
  %8 = tail call i32 @nk_input_is_mouse_click_in_rect(ptr noundef %0, i32 noundef 2, <2 x float> %1, <2 x float> %2)
  %.not9 = icmp eq i32 %8, 0
  br i1 %.not9, label %9, label %.thread11

9:                                                ; preds = %7
  %10 = tail call i32 @nk_input_is_mouse_click_in_rect(ptr noundef %0, i32 noundef 3, <2 x float> %1, <2 x float> %2)
  %11 = icmp ne i32 %10, 0
  %12 = zext i1 %11 to i32
  br label %.thread11

.thread11:                                        ; preds = %3, %5, %9, %7
  %13 = phi i32 [ 1, %7 ], [ %12, %9 ], [ 1, %5 ], [ 1, %3 ]
  ret i32 %13
}

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)"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopRotatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass