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

; 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 }
%struct.Color = type { i8, i8, i8, i8 }

@guiState = external hidden global i32, align 4
@guiAlpha = external hidden global float, align 4

; 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 @GuiGetStyle(i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @GuiGroupBox(<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 i32, align 4
  %7 = alloca %struct.Rectangle, align 4
  %8 = alloca %struct.Color, align 1
  %9 = alloca %struct.Color, align 1
  %10 = alloca %struct.Color, align 1
  %11 = alloca %struct.Rectangle, align 4
  %12 = alloca %struct.Color, align 1
  %13 = alloca %struct.Color, align 1
  %14 = alloca %struct.Color, align 1
  %15 = alloca %struct.Rectangle, align 4
  %16 = alloca %struct.Color, align 1
  %17 = alloca %struct.Color, align 1
  %18 = alloca %struct.Color, align 1
  %19 = alloca %struct.Rectangle, align 4
  %20 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %4, i32 0, i32 0
  store <2 x float> %0, ptr %20, align 4
  %21 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %4, i32 0, i32 1
  store <2 x float> %1, ptr %21, align 4
  store ptr %2, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %22 = load i32, ptr @guiState, align 4, !tbaa !9
  store i32 %22, ptr %6, align 4, !tbaa !9
  %23 = getelementptr inbounds %struct.Rectangle, ptr %7, i32 0, i32 0
  %24 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 0
  %25 = load float, ptr %24, align 4, !tbaa !11
  store float %25, ptr %23, align 4, !tbaa !11
  %26 = getelementptr inbounds %struct.Rectangle, ptr %7, i32 0, i32 1
  %27 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 1
  %28 = load float, ptr %27, align 4, !tbaa !14
  store float %28, ptr %26, align 4, !tbaa !14
  %29 = getelementptr inbounds %struct.Rectangle, ptr %7, i32 0, i32 2
  store float 1.000000e+00, ptr %29, align 4, !tbaa !15
  %30 = getelementptr inbounds %struct.Rectangle, ptr %7, i32 0, i32 3
  %31 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 3
  %32 = load float, ptr %31, align 4, !tbaa !16
  store float %32, ptr %30, align 4, !tbaa !16
  %33 = getelementptr inbounds %struct.Color, ptr %8, i32 0, i32 0
  store i8 0, ptr %33, align 1, !tbaa !17
  %34 = getelementptr inbounds %struct.Color, ptr %8, i32 0, i32 1
  store i8 0, ptr %34, align 1, !tbaa !19
  %35 = getelementptr inbounds %struct.Color, ptr %8, i32 0, i32 2
  store i8 0, ptr %35, align 1, !tbaa !20
  %36 = getelementptr inbounds %struct.Color, ptr %8, i32 0, i32 3
  store i8 0, ptr %36, align 1, !tbaa !21
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = icmp eq i32 %37, 3
  %39 = zext i1 %38 to i64
  %40 = select i1 %38, i32 9, i32 18
  %41 = call i32 @GuiGetStyle(i32 noundef 0, i32 noundef %40)
  %42 = call i32 @GetColor(i32 noundef %41)
  store i32 %42, ptr %10, align 1
  %43 = load float, ptr @guiAlpha, align 4, !tbaa !22
  %44 = load i32, ptr %10, align 1
  %45 = call i32 @Fade(i32 %44, float noundef %43)
  store i32 %45, ptr %9, align 1
  %46 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %7, i32 0, i32 0
  %47 = load <2 x float>, ptr %46, align 4
  %48 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %7, i32 0, i32 1
  %49 = load <2 x float>, ptr %48, align 4
  %50 = load i32, ptr %8, align 1
  %51 = load i32, ptr %9, align 1
  call void @GuiDrawRectangle(<2 x float> %47, <2 x float> %49, i32 noundef 0, i32 %50, i32 %51)
  %52 = getelementptr inbounds %struct.Rectangle, ptr %11, i32 0, i32 0
  %53 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 0
  %54 = load float, ptr %53, align 4, !tbaa !11
  store float %54, ptr %52, align 4, !tbaa !11
  %55 = getelementptr inbounds %struct.Rectangle, ptr %11, i32 0, i32 1
  %56 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 1
  %57 = load float, ptr %56, align 4, !tbaa !14
  %58 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 3
  %59 = load float, ptr %58, align 4, !tbaa !16
  %60 = fadd float %57, %59
  %61 = fsub float %60, 1.000000e+00
  store float %61, ptr %55, align 4, !tbaa !14
  %62 = getelementptr inbounds %struct.Rectangle, ptr %11, i32 0, i32 2
  %63 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 2
  %64 = load float, ptr %63, align 4, !tbaa !15
  store float %64, ptr %62, align 4, !tbaa !15
  %65 = getelementptr inbounds %struct.Rectangle, ptr %11, i32 0, i32 3
  store float 1.000000e+00, ptr %65, align 4, !tbaa !16
  %66 = getelementptr inbounds %struct.Color, ptr %12, i32 0, i32 0
  store i8 0, ptr %66, align 1, !tbaa !17
  %67 = getelementptr inbounds %struct.Color, ptr %12, i32 0, i32 1
  store i8 0, ptr %67, align 1, !tbaa !19
  %68 = getelementptr inbounds %struct.Color, ptr %12, i32 0, i32 2
  store i8 0, ptr %68, align 1, !tbaa !20
  %69 = getelementptr inbounds %struct.Color, ptr %12, i32 0, i32 3
  store i8 0, ptr %69, align 1, !tbaa !21
  %70 = load i32, ptr %6, align 4, !tbaa !9
  %71 = icmp eq i32 %70, 3
  %72 = zext i1 %71 to i64
  %73 = select i1 %71, i32 9, i32 18
  %74 = call i32 @GuiGetStyle(i32 noundef 0, i32 noundef %73)
  %75 = call i32 @GetColor(i32 noundef %74)
  store i32 %75, ptr %14, align 1
  %76 = load float, ptr @guiAlpha, align 4, !tbaa !22
  %77 = load i32, ptr %14, align 1
  %78 = call i32 @Fade(i32 %77, float noundef %76)
  store i32 %78, ptr %13, align 1
  %79 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %11, i32 0, i32 0
  %80 = load <2 x float>, ptr %79, align 4
  %81 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %11, i32 0, i32 1
  %82 = load <2 x float>, ptr %81, align 4
  %83 = load i32, ptr %12, align 1
  %84 = load i32, ptr %13, align 1
  call void @GuiDrawRectangle(<2 x float> %80, <2 x float> %82, i32 noundef 0, i32 %83, i32 %84)
  %85 = getelementptr inbounds %struct.Rectangle, ptr %15, i32 0, i32 0
  %86 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 0
  %87 = load float, ptr %86, align 4, !tbaa !11
  %88 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 2
  %89 = load float, ptr %88, align 4, !tbaa !15
  %90 = fadd float %87, %89
  %91 = fsub float %90, 1.000000e+00
  store float %91, ptr %85, align 4, !tbaa !11
  %92 = getelementptr inbounds %struct.Rectangle, ptr %15, i32 0, i32 1
  %93 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 1
  %94 = load float, ptr %93, align 4, !tbaa !14
  store float %94, ptr %92, align 4, !tbaa !14
  %95 = getelementptr inbounds %struct.Rectangle, ptr %15, i32 0, i32 2
  store float 1.000000e+00, ptr %95, align 4, !tbaa !15
  %96 = getelementptr inbounds %struct.Rectangle, ptr %15, i32 0, i32 3
  %97 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 3
  %98 = load float, ptr %97, align 4, !tbaa !16
  store float %98, ptr %96, align 4, !tbaa !16
  %99 = getelementptr inbounds %struct.Color, ptr %16, i32 0, i32 0
  store i8 0, ptr %99, align 1, !tbaa !17
  %100 = getelementptr inbounds %struct.Color, ptr %16, i32 0, i32 1
  store i8 0, ptr %100, align 1, !tbaa !19
  %101 = getelementptr inbounds %struct.Color, ptr %16, i32 0, i32 2
  store i8 0, ptr %101, align 1, !tbaa !20
  %102 = getelementptr inbounds %struct.Color, ptr %16, i32 0, i32 3
  store i8 0, ptr %102, align 1, !tbaa !21
  %103 = load i32, ptr %6, align 4, !tbaa !9
  %104 = icmp eq i32 %103, 3
  %105 = zext i1 %104 to i64
  %106 = select i1 %104, i32 9, i32 18
  %107 = call i32 @GuiGetStyle(i32 noundef 0, i32 noundef %106)
  %108 = call i32 @GetColor(i32 noundef %107)
  store i32 %108, ptr %18, align 1
  %109 = load float, ptr @guiAlpha, align 4, !tbaa !22
  %110 = load i32, ptr %18, align 1
  %111 = call i32 @Fade(i32 %110, float noundef %109)
  store i32 %111, ptr %17, align 1
  %112 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %15, i32 0, i32 0
  %113 = load <2 x float>, ptr %112, align 4
  %114 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %15, i32 0, i32 1
  %115 = load <2 x float>, ptr %114, align 4
  %116 = load i32, ptr %16, align 1
  %117 = load i32, ptr %17, align 1
  call void @GuiDrawRectangle(<2 x float> %113, <2 x float> %115, i32 noundef 0, i32 %116, i32 %117)
  %118 = getelementptr inbounds %struct.Rectangle, ptr %19, i32 0, i32 0
  %119 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 0
  %120 = load float, ptr %119, align 4, !tbaa !11
  store float %120, ptr %118, align 4, !tbaa !11
  %121 = getelementptr inbounds %struct.Rectangle, ptr %19, i32 0, i32 1
  %122 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 1
  %123 = load float, ptr %122, align 4, !tbaa !14
  store float %123, ptr %121, align 4, !tbaa !14
  %124 = getelementptr inbounds %struct.Rectangle, ptr %19, i32 0, i32 2
  %125 = getelementptr inbounds %struct.Rectangle, ptr %4, i32 0, i32 2
  %126 = load float, ptr %125, align 4, !tbaa !15
  store float %126, ptr %124, align 4, !tbaa !15
  %127 = getelementptr inbounds %struct.Rectangle, ptr %19, i32 0, i32 3
  store float 1.000000e+00, ptr %127, align 4, !tbaa !16
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %19, i32 0, i32 0
  %130 = load <2 x float>, ptr %129, align 4
  %131 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %19, i32 0, i32 1
  %132 = load <2 x float>, ptr %131, align 4
  call void @GuiLine(<2 x float> %130, <2 x float> %132, ptr noundef %128)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden void @GuiDrawRectangle(<2 x float>, <2 x float>, i32 noundef, i32, i32) #2

declare i32 @Fade(i32, float noundef) #3

declare i32 @GetColor(i32 noundef) #3

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

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


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

@guiState = external hidden local_unnamed_addr global i32, align 4
@guiAlpha = external hidden local_unnamed_addr global float, align 4

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

; Function Attrs: nounwind uwtable
define dso_local void @GuiGroupBox(<2 x float> %0, <2 x float> %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = load i32, ptr @guiState, align 4, !tbaa !5
  %.sroa.329.12.vec.insert55 = insertelement <2 x float> %1, float 1.000000e+00, i64 0
  %5 = icmp eq i32 %4, 3
  %6 = select i1 %5, i32 9, i32 18
  %7 = tail call i32 @GuiGetStyle(i32 noundef 0, i32 noundef %6)
  %8 = tail call i32 @GetColor(i32 noundef %7) #3
  %9 = load float, ptr @guiAlpha, align 4, !tbaa !9
  %10 = tail call i32 @Fade(i32 %8, float noundef %9) #3
  tail call void @GuiDrawRectangle(<2 x float> %0, <2 x float> %.sroa.329.12.vec.insert55, i32 noundef 0, i32 0, i32 %10)
  %11 = fadd <2 x float> %0, %1
  %12 = extractelement <2 x float> %11, i64 1
  %13 = fadd float %12, -1.000000e+00
  %.sroa.017.4.vec.insert = insertelement <2 x float> %0, float %13, i64 1
  %.sroa.319.12.vec.insert = insertelement <2 x float> %1, float 1.000000e+00, i64 1
  %14 = tail call i32 @GuiGetStyle(i32 noundef 0, i32 noundef %6)
  %15 = tail call i32 @GetColor(i32 noundef %14) #3
  %16 = load float, ptr @guiAlpha, align 4, !tbaa !9
  %17 = tail call i32 @Fade(i32 %15, float noundef %16) #3
  tail call void @GuiDrawRectangle(<2 x float> %.sroa.017.4.vec.insert, <2 x float> %.sroa.319.12.vec.insert, i32 noundef 0, i32 0, i32 %17)
  %18 = fadd <2 x float> %0, %1
  %19 = extractelement <2 x float> %18, i64 0
  %20 = fadd float %19, -1.000000e+00
  %.sroa.07.4.vec.insert = insertelement <2 x float> %0, float %20, i64 0
  %21 = tail call i32 @GuiGetStyle(i32 noundef 0, i32 noundef %6)
  %22 = tail call i32 @GetColor(i32 noundef %21) #3
  %23 = load float, ptr @guiAlpha, align 4, !tbaa !9
  %24 = tail call i32 @Fade(i32 %22, float noundef %23) #3
  tail call void @GuiDrawRectangle(<2 x float> %.sroa.07.4.vec.insert, <2 x float> %.sroa.329.12.vec.insert55, i32 noundef 0, i32 0, i32 %24)
  tail call void @GuiLine(<2 x float> %0, <2 x float> %.sroa.319.12.vec.insert, ptr noundef %2)
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden void @GuiDrawRectangle(<2 x float>, <2 x float>, i32 noundef, i32, i32) local_unnamed_addr #1

declare i32 @Fade(i32, float noundef) local_unnamed_addr #2

declare i32 @GetColor(i32 noundef) local_unnamed_addr #2

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

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" }
attributes #2 = { "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass,VectorCombinePass