; LLVM IR from NotManyIdeasDev/double-pendulum-sim :: double-pendulum-sim/Libraries/raygui-2.8/examples/controls_test_suite (GuiWindowBox)

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

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

40:                                               ; preds = %3
  %41 = load i32, ptr %7, align 4, !tbaa !11
  %42 = mul nsw i32 %41, 2
  %43 = sitofp i32 %42 to float
  %44 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 3
  store float %43, ptr %44, align 4, !tbaa !18
  br label %45

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @GuiIconText(i32 noundef, 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" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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/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 = !{!"Rectangle", !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 = !{i8 0, i8 2}
!20 = !{}


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

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

; Function Attrs: nounwind 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
  %.sroa.528.12.vec.extract = extractelement <2 x float> %1, i64 1
  %7 = shl nsw i32 %6, 1
  %8 = sitofp i32 %7 to float
  %9 = fcmp olt float %.sroa.528.12.vec.extract, %8
  %.sroa.528.12.vec.insert = insertelement <2 x float> %1, float %8, i64 1
  %.sroa.528.0 = select i1 %9, <2 x float> %.sroa.528.12.vec.insert, <2 x float> %1
  %10 = sitofp i32 %6 to float
  %.sroa.7.12.vec.insert = insertelement <2 x float> %1, float %10, i64 1
  %.sroa.023.4.vec.extract = extractelement <2 x float> %0, i64 1
  %11 = fadd float %.sroa.023.4.vec.extract, %10
  %12 = fadd float %11, -1.000000e+00
  %.sroa.04.4.vec.insert = insertelement <2 x float> %0, float %12, i64 1
  %.sroa.528.12.vec.extract33 = extractelement <2 x float> %.sroa.528.0, i64 1
  %13 = fsub float %.sroa.528.12.vec.extract33, %10
  %.sroa.56.12.vec.insert = insertelement <2 x float> %.sroa.528.0, float %13, i64 1
  %14 = fadd <2 x float> %0, %1
  %15 = extractelement <2 x float> %14, i64 0
  %16 = tail call i32 @GuiGetStyle(i32 noundef 15, i32 noundef 12)
  %17 = sitofp i32 %16 to float
  %18 = fsub float %15, %17
  %19 = ashr exact i32 %6, 1
  %20 = sitofp i32 %19 to float
  %21 = fadd float %.sroa.023.4.vec.extract, %20
  %22 = insertelement <2 x float> poison, float %18, i64 0
  %23 = insertelement <2 x float> %22, float %21, i64 1
  %24 = fadd <2 x float> %23, <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.04.4.vec.insert, <2 x float> %.sroa.56.12.vec.insert)
  %25 = tail call i32 @GuiGetStyle(i32 noundef 2, i32 noundef 12)
  %26 = 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)
  %27 = tail call ptr @GuiIconText(i32 noundef 128, ptr noundef null)
  %28 = tail call zeroext i1 @GuiButton(<2 x float> %24, <2 x float> <float 1.800000e+01, float 1.800000e+01>, ptr noundef %27)
  tail call void @GuiSetStyle(i32 noundef 2, i32 noundef 12, i32 noundef %25)
  tail call void @GuiSetStyle(i32 noundef 2, i32 noundef 14, i32 noundef %26)
  ret i1 %28
}

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @GuiIconText(i32 noundef, 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" }
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" }

!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,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass