; LLVM IR from vectozavr/3dzavr :: engine/io/microui (microui)

; 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.mu_Rect = type { i32, i32, i32, i32 }
%struct.mu_Context = type { ptr, ptr, ptr, %struct.mu_Style, ptr, i32, i32, i32, %struct.mu_Rect, i32, i32, i32, ptr, ptr, ptr, [127 x i8], i32, %struct.anon, %struct.anon.0, %struct.anon.1, %struct.anon.2, %struct.anon.3, %struct.anon.4, [48 x %struct.mu_PoolItem], [48 x %struct.mu_Container], [48 x %struct.mu_PoolItem], %struct.mu_Vec2, %struct.mu_Vec2, %struct.mu_Vec2, %struct.mu_Vec2, i32, i32, i32, i32, [32 x i8] }
%struct.mu_Style = type { ptr, %struct.mu_Vec2, i32, i32, i32, i32, i32, i32, [14 x %struct.mu_Color] }
%struct.mu_Color = type { i8, i8, i8, i8 }
%struct.anon = type { i32, [262144 x i8] }
%struct.anon.0 = type { i32, [32 x ptr] }
%struct.anon.1 = type { i32, [32 x ptr] }
%struct.anon.2 = type { i32, [32 x %struct.mu_Rect] }
%struct.anon.3 = type { i32, [32 x i32] }
%struct.anon.4 = type { i32, [16 x %struct.mu_Layout] }
%struct.mu_Layout = type { %struct.mu_Rect, %struct.mu_Rect, %struct.mu_Vec2, %struct.mu_Vec2, %struct.mu_Vec2, [16 x i32], i32, i32, i32, i32, i32 }
%struct.mu_Container = type { ptr, ptr, %struct.mu_Rect, %struct.mu_Rect, %struct.mu_Vec2, %struct.mu_Vec2, i32, i32 }
%struct.mu_PoolItem = type { i32, i32 }
%struct.mu_Vec2 = type { i32, i32 }

; Function Attrs: nounwind uwtable
declare dso_local { i64, i64 } @mu_get_clip_rect(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @mu_mouse_over(ptr noundef %0, i64 %1, i64 %2) #0 {
  %4 = alloca %struct.mu_Rect, align 4
  %5 = alloca ptr, align 8
  %6 = alloca %struct.mu_Rect, align 4
  %7 = getelementptr inbounds { i64, i64 }, ptr %4, i32 0, i32 0
  store i64 %1, ptr %7, align 4
  %8 = getelementptr inbounds { i64, i64 }, ptr %4, i32 0, i32 1
  store i64 %2, ptr %8, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.mu_Context, ptr %9, i32 0, i32 26
  %11 = getelementptr inbounds { i64, i64 }, ptr %4, i32 0, i32 0
  %12 = load i64, ptr %11, align 4
  %13 = getelementptr inbounds { i64, i64 }, ptr %4, i32 0, i32 1
  %14 = load i64, ptr %13, align 4
  %15 = load i64, ptr %10, align 8
  %16 = call i32 @rect_overlaps_vec2(i64 %12, i64 %14, i64 %15)
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %18, label %38

18:                                               ; preds = %3
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = call { i64, i64 } @mu_get_clip_rect(ptr noundef %19)
  %21 = getelementptr inbounds { i64, i64 }, ptr %6, i32 0, i32 0
  %22 = extractvalue { i64, i64 } %20, 0
  store i64 %22, ptr %21, align 4
  %23 = getelementptr inbounds { i64, i64 }, ptr %6, i32 0, i32 1
  %24 = extractvalue { i64, i64 } %20, 1
  store i64 %24, ptr %23, align 4
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.mu_Context, ptr %25, i32 0, i32 26
  %27 = getelementptr inbounds { i64, i64 }, ptr %6, i32 0, i32 0
  %28 = load i64, ptr %27, align 4
  %29 = getelementptr inbounds { i64, i64 }, ptr %6, i32 0, i32 1
  %30 = load i64, ptr %29, align 4
  %31 = load i64, ptr %26, align 8
  %32 = call i32 @rect_overlaps_vec2(i64 %28, i64 %30, i64 %31)
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %34, label %38

34:                                               ; preds = %18
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = call i32 @in_hover_root(ptr noundef %35)
  %37 = icmp ne i32 %36, 0
  br label %38

38:                                               ; preds = %34, %18, %3
  %39 = phi i1 [ false, %18 ], [ false, %3 ], [ %37, %34 ]
  %40 = zext i1 %39 to i32
  ret i32 %40
}

; Function Attrs: nounwind uwtable
declare hidden i32 @rect_overlaps_vec2(i64, i64, i64) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @in_hover_root(ptr noundef) #0

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

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


; 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 { i64, i64 } @mu_get_clip_rect(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @mu_mouse_over(ptr noundef %0, i64 %1, i64 %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 270120
  %5 = load i64, ptr %4, align 8
  %6 = tail call i32 @rect_overlaps_vec2(i64 %1, i64 %2, i64 %5)
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %17, label %7

7:                                                ; preds = %3
  %8 = tail call { i64, i64 } @mu_get_clip_rect(ptr noundef nonnull %0)
  %9 = extractvalue { i64, i64 } %8, 0
  %10 = extractvalue { i64, i64 } %8, 1
  %11 = load i64, ptr %4, align 8
  %12 = tail call i32 @rect_overlaps_vec2(i64 %9, i64 %10, i64 %11)
  %.not6 = icmp eq i32 %12, 0
  br i1 %.not6, label %17, label %13

13:                                               ; preds = %7
  %14 = tail call i32 @in_hover_root(ptr noundef nonnull %0)
  %15 = icmp ne i32 %14, 0
  %16 = zext i1 %15 to i32
  br label %17

17:                                               ; preds = %13, %7, %3
  %18 = phi i32 [ 0, %7 ], [ 0, %3 ], [ %16, %13 ]
  ret i32 %18
}

; Function Attrs: nounwind uwtable
declare hidden i32 @rect_overlaps_vec2(i64, i64, i64) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @in_hover_root(ptr noundef) local_unnamed_addr #0

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

!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: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,SROAPass,TailCallElimPass