; LLVM IR from ClementineAccount/Albuquerque :: src/HelloSDL (main)

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local i32 @nk_input_is_mouse_click_in_rect(ptr noundef, i32 noundef, <2 x float>, <2 x float>) #2

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

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

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

17:                                               ; preds = %14
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = load i32, ptr %6, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %4, i64 16, i1 false), !tbaa.struct !11
  %20 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 0
  %21 = load <2 x float>, ptr %20, align 4
  %22 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 1
  %23 = load <2 x float>, ptr %22, align 4
  %24 = call i32 @nk_input_is_mouse_click_in_rect(ptr noundef %18, i32 noundef %19, <2 x float> %21, <2 x float> %23)
  %25 = icmp ne i32 %24, 0
  br label %26

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

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

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

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress 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 #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 = !{i64 0, i64 4, !12, i64 4, i64 4, !12, i64 8, i64 4, !12, i64 12, i64 4, !12}
!12 = !{!13, !13, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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: mustprogress 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: mustprogress 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 %.thread13

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)
  %.not10 = icmp eq i32 %6, 0
  br i1 %.not10, label %7, label %.thread13

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)
  %.not11 = icmp eq i32 %8, 0
  br i1 %.not11, label %9, label %.thread13

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 %.thread13

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

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