; LLVM IR from VTIvanov20/eight-ball-pool :: src (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.Rectangle = 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: mustprogress uwtable
declare dso_local void @GuiSetStyle(i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local i32 @GuiGetStyle(i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local zeroext i1 @GuiWindowBox(<2 x float> %0, <2 x float> %1, ptr noundef %2) #3 {
  %4 = alloca %struct.Rectangle, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca %struct.Rectangle, align 4
  %9 = alloca %struct.Rectangle, align 4
  %10 = alloca %struct.Rectangle, align 4
  %11 = alloca %struct.Rectangle, align 4
  %12 = alloca %struct.Rectangle, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %struct.Rectangle, align 4
  %16 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %4, i32 0, i32 0
  store <2 x float> %0, ptr %16, align 4
  %17 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %4, i32 0, i32 1
  store <2 x float> %1, ptr %17, align 4
  store ptr %2, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #5
  store i8 0, ptr %6, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %18 = call i32 @GuiGetStyle(i32 noundef 15, i32 noundef 12)
  %19 = mul nsw i32 2, %18
  %20 = add nsw i32 22, %19
  store i32 %20, ptr %7, align 4, !tbaa !11
  %21 = load i32, ptr %7, align 4, !tbaa !11
  %22 = srem i32 %21, 2
  %23 = load i32, ptr %7, align 4, !tbaa !11
  %24 = add nsw i32 %23, %22
  store i32 %24, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #5
  %25 = getelementptr inbounds %struct.Rectangle, ptr %8, i32 0, i32 0
  %26 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 0
  %27 = load float, ptr %26, align 4, !tbaa !13
  store float %27, ptr %25, align 4, !tbaa !13
  %28 = getelementptr inbounds %struct.Rectangle, ptr %8, i32 0, i32 1
  %29 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 1
  %30 = load float, ptr %29, align 4, !tbaa !16
  store float %30, ptr %28, align 4, !tbaa !16
  %31 = getelementptr inbounds %struct.Rectangle, ptr %8, i32 0, i32 2
  %32 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 2
  %33 = load float, ptr %32, align 4, !tbaa !17
  store float %33, ptr %31, align 4, !tbaa !17
  %34 = getelementptr inbounds %struct.Rectangle, ptr %8, i32 0, i32 3
  %35 = load i32, ptr %7, align 4, !tbaa !11
  %36 = sitofp i32 %35 to float
  store float %36, ptr %34, align 4, !tbaa !18
  %37 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 3
  %38 = load float, ptr %37, align 4, !tbaa !18
  %39 = load i32, ptr %7, align 4, !tbaa !11
  %40 = sitofp i32 %39 to float
  %41 = fmul float %40, 2.000000e+00
  %42 = fcmp olt float %38, %41
  br i1 %42, label %43, label %48

43:                                               ; preds = %3
  %44 = load i32, ptr %7, align 4, !tbaa !11
  %45 = sitofp i32 %44 to float
  %46 = fmul float %45, 2.000000e+00
  %47 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 3
  store float %46, ptr %47, align 4, !tbaa !18
  br label %48

48:                                               ; preds = %43, %3
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #5
  %49 = getelementptr inbounds %struct.Rectangle, ptr %9, i32 0, i32 0
  %50 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 0
  %51 = load float, ptr %50, align 4, !tbaa !13
  store float %51, ptr %49, align 4, !tbaa !13
  %52 = getelementptr inbounds %struct.Rectangle, ptr %9, i32 0, i32 1
  %53 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 1
  %54 = load float, ptr %53, align 4, !tbaa !16
  %55 = load i32, ptr %7, align 4, !tbaa !11
  %56 = sitofp i32 %55 to float
  %57 = fadd float %54, %56
  %58 = fsub float %57, 1.000000e+00
  store float %58, ptr %52, align 4, !tbaa !16
  %59 = getelementptr inbounds %struct.Rectangle, ptr %9, i32 0, i32 2
  %60 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 2
  %61 = load float, ptr %60, align 4, !tbaa !17
  store float %61, ptr %59, align 4, !tbaa !17
  %62 = getelementptr inbounds %struct.Rectangle, ptr %9, i32 0, i32 3
  %63 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 3
  %64 = load float, ptr %63, align 4, !tbaa !18
  %65 = load i32, ptr %7, align 4, !tbaa !11
  %66 = sitofp i32 %65 to float
  %67 = fsub float %64, %66
  store float %67, ptr %62, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #5
  %68 = getelementptr inbounds %struct.Rectangle, ptr %10, i32 0, i32 0
  %69 = getelementptr inbounds %struct.Rectangle, ptr %8, i32 0, i32 0
  %70 = load float, ptr %69, align 4, !tbaa !13
  %71 = getelementptr inbounds %struct.Rectangle, ptr %8, i32 0, i32 2
  %72 = load float, ptr %71, align 4, !tbaa !17
  %73 = fadd float %70, %72
  %74 = call i32 @GuiGetStyle(i32 noundef 15, i32 noundef 12)
  %75 = sitofp i32 %74 to float
  %76 = fsub float %73, %75
  %77 = fsub float %76, 2.000000e+01
  store float %77, ptr %68, align 4, !tbaa !13
  %78 = getelementptr inbounds %struct.Rectangle, ptr %10, i32 0, i32 1
  %79 = getelementptr inbounds %struct.Rectangle, ptr %8, i32 0, i32 1
  %80 = load float, ptr %79, align 4, !tbaa !16
  %81 = load i32, ptr %7, align 4, !tbaa !11
  %82 = sitofp i32 %81 to float
  %83 = fdiv float %82, 2.000000e+00
  %84 = fadd float %80, %83
  %85 = fsub float %84, 9.000000e+00
  store float %85, ptr %78, align 4, !tbaa !16
  %86 = getelementptr inbounds %struct.Rectangle, ptr %10, i32 0, i32 2
  store float 1.800000e+01, ptr %86, align 4, !tbaa !17
  %87 = getelementptr inbounds %struct.Rectangle, ptr %10, i32 0, i32 3
  store float 1.800000e+01, ptr %87, align 4, !tbaa !18
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %8, i64 16, i1 false), !tbaa.struct !19
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %11, i32 0, i32 0
  %90 = load <2 x float>, ptr %89, align 4
  %91 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %11, i32 0, i32 1
  %92 = load <2 x float>, ptr %91, align 4
  call void @GuiStatusBar(<2 x float> %90, <2 x float> %92, ptr noundef %88)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %9, i64 16, i1 false), !tbaa.struct !19
  %93 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %12, i32 0, i32 0
  %94 = load <2 x float>, ptr %93, align 4
  %95 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %12, i32 0, i32 1
  %96 = load <2 x float>, ptr %95, align 4
  call void @GuiPanel(<2 x float> %94, <2 x float> %96)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %97 = call i32 @GuiGetStyle(i32 noundef 2, i32 noundef 12)
  store i32 %97, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %98 = call i32 @GuiGetStyle(i32 noundef 2, i32 noundef 14)
  store i32 %98, ptr %14, align 4, !tbaa !11
  call void @GuiSetStyle(i32 noundef 2, i32 noundef 12, i32 noundef 1)
  call void @GuiSetStyle(i32 noundef 2, i32 noundef 14, i32 noundef 1)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %10, i64 16, i1 false), !tbaa.struct !19
  %99 = call ptr @GuiIconText(i32 noundef 128, ptr noundef null)
  %100 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %15, i32 0, i32 0
  %101 = load <2 x float>, ptr %100, align 4
  %102 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %15, i32 0, i32 1
  %103 = load <2 x float>, ptr %102, align 4
  %104 = call zeroext i1 @GuiButton(<2 x float> %101, <2 x float> %103, ptr noundef %99)
  %105 = zext i1 %104 to i8
  store i8 %105, ptr %6, align 1, !tbaa !9
  %106 = load i32, ptr %13, align 4, !tbaa !11
  call void @GuiSetStyle(i32 noundef 2, i32 noundef 12, i32 noundef %106)
  %107 = load i32, ptr %14, align 4, !tbaa !11
  call void @GuiSetStyle(i32 noundef 2, i32 noundef 14, i32 noundef %107)
  %108 = load i8, ptr %6, align 1, !tbaa !9, !range !21, !noundef !22
  %109 = trunc i8 %108 to i1
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  ret i1 %109
}

; Function Attrs: mustprogress uwtable
declare dso_local void @GuiStatusBar(<2 x float>, <2 x float>, ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @GuiPanel(<2 x float>, <2 x float>) #3

; Function Attrs: mustprogress uwtable
declare dso_local zeroext i1 @GuiButton(<2 x float>, <2 x float>, ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @GuiIconText(i32 noundef, ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress 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" }
attributes #3 = { mustprogress 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 #4 = { mustprogress 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" }
attributes #5 = { 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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !15, i64 0}
!14 = !{!"_ZTS9Rectangle", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12}
!15 = !{!"float", !7, i64 0}
!16 = !{!14, !15, i64 4}
!17 = !{!14, !15, i64 8}
!18 = !{!14, !15, i64 12}
!19 = !{i64 0, i64 4, !20, i64 4, i64 4, !20, i64 8, i64 4, !20, i64 12, i64 4, !20}
!20 = !{!15, !15, i64 0}
!21 = !{i8 0, i8 2}
!22 = !{}


; 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 uwtable
declare dso_local void @GuiSetStyle(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local i32 @GuiGetStyle(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local zeroext i1 @GuiWindowBox(<2 x float> %0, <2 x float> %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = tail call i32 @GuiGetStyle(i32 noundef 15, i32 noundef 12)
  %5 = shl nsw i32 %4, 1
  %6 = add nsw i32 %5, 22
  %7 = sitofp i32 %6 to float
  %.sroa.533.12.vec.extract = extractelement <2 x float> %1, i64 1
  %8 = fmul float %7, 2.000000e+00
  %9 = fcmp olt float %.sroa.533.12.vec.extract, %8
  %.sroa.533.12.vec.insert = insertelement <2 x float> %1, float %8, i64 1
  %.sroa.533.0 = select i1 %9, <2 x float> %.sroa.533.12.vec.insert, <2 x float> %1
  %.sroa.7.12.vec.insert = insertelement <2 x float> %1, float %7, i64 1
  %.sroa.028.4.vec.extract = extractelement <2 x float> %0, i64 1
  %10 = fadd float %.sroa.028.4.vec.extract, %7
  %11 = fadd float %10, -1.000000e+00
  %.sroa.09.4.vec.insert = insertelement <2 x float> %0, float %11, i64 1
  %.sroa.533.12.vec.extract38 = extractelement <2 x float> %.sroa.533.0, i64 1
  %12 = fsub float %.sroa.533.12.vec.extract38, %7
  %.sroa.511.12.vec.insert = insertelement <2 x float> %.sroa.533.0, float %12, i64 1
  %13 = fadd <2 x float> %0, %1
  %14 = extractelement <2 x float> %13, i64 0
  %15 = tail call i32 @GuiGetStyle(i32 noundef 15, i32 noundef 12)
  %16 = sitofp i32 %15 to float
  %17 = fsub float %14, %16
  %18 = fmul float %7, 5.000000e-01
  %19 = fadd float %.sroa.028.4.vec.extract, %18
  %20 = insertelement <2 x float> poison, float %17, i64 0
  %21 = insertelement <2 x float> %20, float %19, i64 1
  %22 = fadd <2 x float> %21, <float -2.000000e+01, float -9.000000e+00>
  tail call void @GuiStatusBar(<2 x float> %0, <2 x float> %.sroa.7.12.vec.insert, ptr noundef %2)
  tail call void @GuiPanel(<2 x float> %.sroa.09.4.vec.insert, <2 x float> %.sroa.511.12.vec.insert)
  %23 = tail call i32 @GuiGetStyle(i32 noundef 2, i32 noundef 12)
  %24 = tail call i32 @GuiGetStyle(i32 noundef 2, i32 noundef 14)
  tail call void @GuiSetStyle(i32 noundef 2, i32 noundef 12, i32 noundef 1)
  tail call void @GuiSetStyle(i32 noundef 2, i32 noundef 14, i32 noundef 1)
  %25 = tail call ptr @GuiIconText(i32 noundef 128, ptr noundef null)
  %26 = tail call zeroext i1 @GuiButton(<2 x float> %22, <2 x float> <float 1.800000e+01, float 1.800000e+01>, ptr noundef %25)
  tail call void @GuiSetStyle(i32 noundef 2, i32 noundef 12, i32 noundef %23)
  tail call void @GuiSetStyle(i32 noundef 2, i32 noundef 14, i32 noundef %24)
  ret i1 %26
}

; Function Attrs: mustprogress uwtable
declare dso_local void @GuiStatusBar(<2 x float>, <2 x float>, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @GuiPanel(<2 x float>, <2 x float>) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local zeroext i1 @GuiButton(<2 x float>, <2 x float>, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @GuiIconText(i32 noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress 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" }
attributes #1 = { mustprogress 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 = { mustprogress 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: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass