; LLVM IR from ronan-kerviche/glip-lib :: GLIP-Lib/src/Core/HdlDynamicData.ll (ZN4Glip6CoreGL14HdlDynamicDataC2ERKjii)

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

%"class.Glip::CoreGL::HdlDynamicData" = type <{ ptr, i32, i32, i32, i32, i8, i8, i8, i8, [4 x i8] }>

@_ZTVN4Glip6CoreGL14HdlDynamicDataE = external dso_local unnamed_addr constant { [11 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Glip6CoreGL14HdlDynamicDataC2ERKjii(ptr noundef nonnull align 8 dereferenceable(28) %0, ptr noundef nonnull align 4 dereferenceable(4) %1, i32 noundef %2, i32 noundef %3) unnamed_addr #0 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  %9 = load ptr, ptr %5, align 8
  store ptr getelementptr inbounds inrange(-16, 72) ({ [11 x ptr] }, ptr @_ZTVN4Glip6CoreGL14HdlDynamicDataE, i32 0, i32 0, i32 2), ptr %9, align 8, !tbaa !11
  %10 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 1
  %11 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %11, ptr %10, align 8, !tbaa !13
  %12 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 2
  %13 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %13, ptr %12, align 4, !tbaa !16
  %14 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 3
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = load i32, ptr %15, align 4, !tbaa !9
  store i32 %16, ptr %14, align 8, !tbaa !17
  %17 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 4
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = call noundef i32 @_ZN4Glip6CoreGL14HdlDynamicData26getRelatedGLSupportingTypeERKj(ptr noundef nonnull align 4 dereferenceable(4) %18)
  store i32 %19, ptr %17, align 4, !tbaa !18
  %20 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 5
  %21 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 4
  %22 = load i32, ptr %21, align 4, !tbaa !18
  %23 = icmp eq i32 %22, 5126
  br i1 %23, label %28, label %24

24:                                               ; preds = %4
  %25 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 4
  %26 = load i32, ptr %25, align 4, !tbaa !18
  %27 = icmp eq i32 %26, 5130
  br label %28

28:                                               ; preds = %24, %4
  %29 = phi i1 [ true, %4 ], [ %27, %24 ]
  %30 = zext i1 %29 to i8
  store i8 %30, ptr %20, align 8, !tbaa !19
  %31 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 6
  %32 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 4
  %33 = load i32, ptr %32, align 4, !tbaa !18
  %34 = icmp eq i32 %33, 5120
  br i1 %34, label %55, label %35

35:                                               ; preds = %28
  %36 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 4
  %37 = load i32, ptr %36, align 4, !tbaa !18
  %38 = icmp eq i32 %37, 5121
  br i1 %38, label %55, label %39

39:                                               ; preds = %35
  %40 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 4
  %41 = load i32, ptr %40, align 4, !tbaa !18
  %42 = icmp eq i32 %41, 5122
  br i1 %42, label %55, label %43

43:                                               ; preds = %39
  %44 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 4
  %45 = load i32, ptr %44, align 4, !tbaa !18
  %46 = icmp eq i32 %45, 5123
  br i1 %46, label %55, label %47

47:                                               ; preds = %43
  %48 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 4
  %49 = load i32, ptr %48, align 4, !tbaa !18
  %50 = icmp eq i32 %49, 5124
  br i1 %50, label %55, label %51

51:                                               ; preds = %47
  %52 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 4
  %53 = load i32, ptr %52, align 4, !tbaa !18
  %54 = icmp eq i32 %53, 5125
  br label %55

55:                                               ; preds = %51, %47, %43, %39, %35, %28
  %56 = phi i1 [ true, %47 ], [ true, %43 ], [ true, %39 ], [ true, %35 ], [ true, %28 ], [ %54, %51 ]
  %57 = zext i1 %56 to i8
  store i8 %57, ptr %31, align 1, !tbaa !20
  %58 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 7
  %59 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 4
  %60 = load i32, ptr %59, align 4, !tbaa !18
  %61 = icmp eq i32 %60, 35670
  %62 = zext i1 %61 to i8
  store i8 %62, ptr %58, align 2, !tbaa !21
  %63 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 8
  %64 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 4
  %65 = load i32, ptr %64, align 4, !tbaa !18
  %66 = icmp eq i32 %65, 5121
  br i1 %66, label %75, label %67

67:                                               ; preds = %55
  %68 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 4
  %69 = load i32, ptr %68, align 4, !tbaa !18
  %70 = icmp eq i32 %69, 5123
  br i1 %70, label %75, label %71

71:                                               ; preds = %67
  %72 = getelementptr inbounds %"class.Glip::CoreGL::HdlDynamicData", ptr %9, i32 0, i32 4
  %73 = load i32, ptr %72, align 4, !tbaa !18
  %74 = icmp eq i32 %73, 5125
  br label %75

75:                                               ; preds = %71, %67, %55
  %76 = phi i1 [ true, %67 ], [ true, %55 ], [ %74, %71 ]
  %77 = zext i1 %76 to i8
  store i8 %77, ptr %63, align 1, !tbaa !22
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4Glip6CoreGL14HdlDynamicData26getRelatedGLSupportingTypeERKj(ptr noundef nonnull align 4 dereferenceable(4)) #0 align 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" }

!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 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !10, i64 8}
!14 = !{!"_ZTSN4Glip6CoreGL14HdlDynamicDataE", !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !15, i64 24, !15, i64 25, !15, i64 26, !15, i64 27}
!15 = !{!"bool", !7, i64 0}
!16 = !{!14, !10, i64 12}
!17 = !{!14, !10, i64 16}
!18 = !{!14, !10, i64 20}
!19 = !{!14, !15, i64 24}
!20 = !{!14, !15, i64 25}
!21 = !{!14, !15, i64 26}
!22 = !{!14, !15, i64 27}


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

@_ZTVN4Glip6CoreGL14HdlDynamicDataE = external dso_local unnamed_addr constant { [11 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Glip6CoreGL14HdlDynamicDataC2ERKjii(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(28) %0, ptr noundef nonnull align 4 dereferenceable(4) %1, i32 noundef %2, i32 noundef %3) unnamed_addr #0 align 2 {
  store ptr getelementptr inbounds inrange(-16, 72) (i8, ptr @_ZTVN4Glip6CoreGL14HdlDynamicDataE, i64 16), ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %2, ptr %5, align 8, !tbaa !8
  %6 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %3, ptr %6, align 4, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = load i32, ptr %1, align 4, !tbaa !14
  store i32 %8, ptr %7, align 8, !tbaa !15
  %9 = getelementptr inbounds i8, ptr %0, i64 20
  %10 = tail call noundef i32 @_ZN4Glip6CoreGL14HdlDynamicData26getRelatedGLSupportingTypeERKj(ptr noundef nonnull align 4 dereferenceable(4) %1)
  store i32 %10, ptr %9, align 4, !tbaa !16
  %11 = getelementptr inbounds i8, ptr %0, i64 24
  %12 = icmp eq i32 %10, 5126
  %13 = icmp eq i32 %10, 5130
  %narrow = or i1 %12, %13
  %14 = zext i1 %narrow to i8
  store i8 %14, ptr %11, align 8, !tbaa !17
  %15 = getelementptr inbounds i8, ptr %0, i64 25
  %.off = add i32 %10, -5120
  %switch = icmp ult i32 %.off, 5
  %16 = icmp eq i32 %10, 5125
  %17 = zext i1 %16 to i8
  %18 = select i1 %switch, i8 1, i8 %17
  store i8 %18, ptr %15, align 1, !tbaa !18
  %19 = getelementptr inbounds i8, ptr %0, i64 26
  %20 = icmp eq i32 %10, 35670
  %21 = zext i1 %20 to i8
  store i8 %21, ptr %19, align 2, !tbaa !19
  switch i32 %10, label %22 [
    i32 5121, label %23
    i32 5123, label %23
  ]

22:                                               ; preds = %4
  br label %23

23:                                               ; preds = %4, %4, %22
  %24 = phi i8 [ 1, %4 ], [ %17, %22 ], [ 1, %4 ]
  %25 = getelementptr inbounds i8, ptr %0, i64 27
  store i8 %24, ptr %25, align 1, !tbaa !20
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4Glip6CoreGL14HdlDynamicData26getRelatedGLSupportingTypeERKj(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 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" }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 8}
!9 = !{!"_ZTSN4Glip6CoreGL14HdlDynamicDataE", !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !12, i64 24, !12, i64 25, !12, i64 26, !12, i64 27}
!10 = !{!"int", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"bool", !11, i64 0}
!13 = !{!9, !10, i64 12}
!14 = !{!10, !10, i64 0}
!15 = !{!9, !10, i64 16}
!16 = !{!9, !10, i64 20}
!17 = !{!9, !12, i64 24}
!18 = !{!9, !12, i64 25}
!19 = !{!9, !12, i64 26}
!20 = !{!9, !12, i64 27}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass