; LLVM IR from aws/s2n-tls :: tls/extensions (s2n_extension_type)

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

@s2n_extension_ianas_to_ids = external dso_local global [60 x i8], align 16
@s2n_supported_extensions = external hidden constant [21 x i16], align 16

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_extension_type_init() #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i16, align 2
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #2
  store i64 0, ptr %1, align 8, !tbaa !5
  br label %4

4:                                                ; preds = %11, %0
  %5 = load i64, ptr %1, align 8, !tbaa !5
  %6 = icmp ult i64 %5, 60
  br i1 %6, label %8, label %7

7:                                                ; preds = %4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #2
  br label %14

8:                                                ; preds = %4
  %9 = load i64, ptr %1, align 8, !tbaa !5
  %10 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %9
  store i8 21, ptr %10, align 1, !tbaa !9
  br label %11

11:                                               ; preds = %8
  %12 = load i64, ptr %1, align 8, !tbaa !5
  %13 = add i64 %12, 1
  store i64 %13, ptr %1, align 8, !tbaa !5
  br label %4, !llvm.loop !10

14:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #2
  store i64 0, ptr %2, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %33, %14
  %16 = load i64, ptr %2, align 8, !tbaa !5
  %17 = icmp ult i64 %16, 21
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #2
  br label %36

19:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 2, ptr %3) #2
  %20 = load i64, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds [21 x i16], ptr @s2n_supported_extensions, i64 0, i64 %20
  %22 = load i16, ptr %21, align 2, !tbaa !12
  store i16 %22, ptr %3, align 2, !tbaa !12
  %23 = load i16, ptr %3, align 2, !tbaa !12
  %24 = zext i16 %23 to i32
  %25 = icmp slt i32 %24, 60
  br i1 %25, label %26, label %32

26:                                               ; preds = %19
  %27 = load i64, ptr %2, align 8, !tbaa !5
  %28 = trunc i64 %27 to i8
  %29 = load i16, ptr %3, align 2, !tbaa !12
  %30 = zext i16 %29 to i64
  %31 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %30
  store i8 %28, ptr %31, align 1, !tbaa !9
  br label %32

32:                                               ; preds = %26, %19
  call void @llvm.lifetime.end.p0(i64 2, ptr %3) #2
  br label %33

33:                                               ; preds = %32
  %34 = load i64, ptr %2, align 8, !tbaa !5
  %35 = add i64 %34, 1
  store i64 %35, ptr %2, align 8, !tbaa !5
  br label %15, !llvm.loop !14

36:                                               ; preds = %18
  ret i32 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

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 }

!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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !13, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = distinct !{!14, !11}


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

@s2n_extension_ianas_to_ids = external dso_local local_unnamed_addr global [60 x i8], align 16
@s2n_supported_extensions = external hidden local_unnamed_addr constant [21 x i16], align 16

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local noundef i32 @s2n_extension_type_init() local_unnamed_addr #0 {
.preheader.preheader:
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @s2n_extension_ianas_to_ids, i8 21, i64 60, i1 false), !tbaa !5
  %0 = load i16, ptr @s2n_supported_extensions, align 16, !tbaa !8
  %1 = icmp ult i16 %0, 60
  br i1 %1, label %2, label %.preheader.1

2:                                                ; preds = %.preheader.preheader
  %3 = zext nneg i16 %0 to i64
  %4 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %3
  store i8 0, ptr %4, align 1, !tbaa !5
  br label %.preheader.1

.preheader.1:                                     ; preds = %2, %.preheader.preheader
  %5 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 2), align 2, !tbaa !8
  %6 = icmp ult i16 %5, 60
  br i1 %6, label %7, label %.preheader.2

7:                                                ; preds = %.preheader.1
  %8 = zext nneg i16 %5 to i64
  %9 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %8
  store i8 1, ptr %9, align 1, !tbaa !5
  br label %.preheader.2

.preheader.2:                                     ; preds = %7, %.preheader.1
  %10 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 4), align 4, !tbaa !8
  %11 = icmp ult i16 %10, 60
  br i1 %11, label %12, label %.preheader.3

12:                                               ; preds = %.preheader.2
  %13 = zext nneg i16 %10 to i64
  %14 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %13
  store i8 2, ptr %14, align 1, !tbaa !5
  br label %.preheader.3

.preheader.3:                                     ; preds = %12, %.preheader.2
  %15 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 6), align 2, !tbaa !8
  %16 = icmp ult i16 %15, 60
  br i1 %16, label %17, label %.preheader.4

17:                                               ; preds = %.preheader.3
  %18 = zext nneg i16 %15 to i64
  %19 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %18
  store i8 3, ptr %19, align 1, !tbaa !5
  br label %.preheader.4

.preheader.4:                                     ; preds = %17, %.preheader.3
  %20 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 8), align 8, !tbaa !8
  %21 = icmp ult i16 %20, 60
  br i1 %21, label %22, label %.preheader.5

22:                                               ; preds = %.preheader.4
  %23 = zext nneg i16 %20 to i64
  %24 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %23
  store i8 4, ptr %24, align 1, !tbaa !5
  br label %.preheader.5

.preheader.5:                                     ; preds = %22, %.preheader.4
  %25 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 10), align 2, !tbaa !8
  %26 = icmp ult i16 %25, 60
  br i1 %26, label %27, label %.preheader.6

27:                                               ; preds = %.preheader.5
  %28 = zext nneg i16 %25 to i64
  %29 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %28
  store i8 5, ptr %29, align 1, !tbaa !5
  br label %.preheader.6

.preheader.6:                                     ; preds = %27, %.preheader.5
  %30 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 12), align 4, !tbaa !8
  %31 = icmp ult i16 %30, 60
  br i1 %31, label %32, label %.preheader.7

32:                                               ; preds = %.preheader.6
  %33 = zext nneg i16 %30 to i64
  %34 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %33
  store i8 6, ptr %34, align 1, !tbaa !5
  br label %.preheader.7

.preheader.7:                                     ; preds = %32, %.preheader.6
  %35 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 14), align 2, !tbaa !8
  %36 = icmp ult i16 %35, 60
  br i1 %36, label %37, label %.preheader.8

37:                                               ; preds = %.preheader.7
  %38 = zext nneg i16 %35 to i64
  %39 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %38
  store i8 7, ptr %39, align 1, !tbaa !5
  br label %.preheader.8

.preheader.8:                                     ; preds = %37, %.preheader.7
  %40 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 16), align 16, !tbaa !8
  %41 = icmp ult i16 %40, 60
  br i1 %41, label %42, label %.preheader.9

42:                                               ; preds = %.preheader.8
  %43 = zext nneg i16 %40 to i64
  %44 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %43
  store i8 8, ptr %44, align 1, !tbaa !5
  br label %.preheader.9

.preheader.9:                                     ; preds = %42, %.preheader.8
  %45 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 18), align 2, !tbaa !8
  %46 = icmp ult i16 %45, 60
  br i1 %46, label %47, label %.preheader.10

47:                                               ; preds = %.preheader.9
  %48 = zext nneg i16 %45 to i64
  %49 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %48
  store i8 9, ptr %49, align 1, !tbaa !5
  br label %.preheader.10

.preheader.10:                                    ; preds = %47, %.preheader.9
  %50 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 20), align 4, !tbaa !8
  %51 = icmp ult i16 %50, 60
  br i1 %51, label %52, label %.preheader.11

52:                                               ; preds = %.preheader.10
  %53 = zext nneg i16 %50 to i64
  %54 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %53
  store i8 10, ptr %54, align 1, !tbaa !5
  br label %.preheader.11

.preheader.11:                                    ; preds = %52, %.preheader.10
  %55 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 22), align 2, !tbaa !8
  %56 = icmp ult i16 %55, 60
  br i1 %56, label %57, label %.preheader.12

57:                                               ; preds = %.preheader.11
  %58 = zext nneg i16 %55 to i64
  %59 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %58
  store i8 11, ptr %59, align 1, !tbaa !5
  br label %.preheader.12

.preheader.12:                                    ; preds = %57, %.preheader.11
  %60 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 24), align 8, !tbaa !8
  %61 = icmp ult i16 %60, 60
  br i1 %61, label %62, label %.preheader.13

62:                                               ; preds = %.preheader.12
  %63 = zext nneg i16 %60 to i64
  %64 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %63
  store i8 12, ptr %64, align 1, !tbaa !5
  br label %.preheader.13

.preheader.13:                                    ; preds = %62, %.preheader.12
  %65 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 26), align 2, !tbaa !8
  %66 = icmp ult i16 %65, 60
  br i1 %66, label %67, label %.preheader.14

67:                                               ; preds = %.preheader.13
  %68 = zext nneg i16 %65 to i64
  %69 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %68
  store i8 13, ptr %69, align 1, !tbaa !5
  br label %.preheader.14

.preheader.14:                                    ; preds = %67, %.preheader.13
  %70 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 28), align 4, !tbaa !8
  %71 = icmp ult i16 %70, 60
  br i1 %71, label %72, label %.preheader.15

72:                                               ; preds = %.preheader.14
  %73 = zext nneg i16 %70 to i64
  %74 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %73
  store i8 14, ptr %74, align 1, !tbaa !5
  br label %.preheader.15

.preheader.15:                                    ; preds = %72, %.preheader.14
  %75 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 30), align 2, !tbaa !8
  %76 = icmp ult i16 %75, 60
  br i1 %76, label %77, label %.preheader.16

77:                                               ; preds = %.preheader.15
  %78 = zext nneg i16 %75 to i64
  %79 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %78
  store i8 15, ptr %79, align 1, !tbaa !5
  br label %.preheader.16

.preheader.16:                                    ; preds = %77, %.preheader.15
  %80 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 32), align 16, !tbaa !8
  %81 = icmp ult i16 %80, 60
  br i1 %81, label %82, label %.preheader.17

82:                                               ; preds = %.preheader.16
  %83 = zext nneg i16 %80 to i64
  %84 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %83
  store i8 16, ptr %84, align 1, !tbaa !5
  br label %.preheader.17

.preheader.17:                                    ; preds = %82, %.preheader.16
  %85 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 34), align 2, !tbaa !8
  %86 = icmp ult i16 %85, 60
  br i1 %86, label %87, label %.preheader.18

87:                                               ; preds = %.preheader.17
  %88 = zext nneg i16 %85 to i64
  %89 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %88
  store i8 17, ptr %89, align 1, !tbaa !5
  br label %.preheader.18

.preheader.18:                                    ; preds = %87, %.preheader.17
  %90 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 36), align 4, !tbaa !8
  %91 = icmp ult i16 %90, 60
  br i1 %91, label %92, label %.preheader.19

92:                                               ; preds = %.preheader.18
  %93 = zext nneg i16 %90 to i64
  %94 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %93
  store i8 18, ptr %94, align 1, !tbaa !5
  br label %.preheader.19

.preheader.19:                                    ; preds = %92, %.preheader.18
  %95 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 38), align 2, !tbaa !8
  %96 = icmp ult i16 %95, 60
  br i1 %96, label %97, label %.preheader.20

97:                                               ; preds = %.preheader.19
  %98 = zext nneg i16 %95 to i64
  %99 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %98
  store i8 19, ptr %99, align 1, !tbaa !5
  br label %.preheader.20

.preheader.20:                                    ; preds = %97, %.preheader.19
  %100 = load i16, ptr getelementptr inbounds (i8, ptr @s2n_supported_extensions, i64 40), align 8, !tbaa !8
  %101 = icmp ult i16 %100, 60
  br i1 %101, label %102, label %105

102:                                              ; preds = %.preheader.20
  %103 = zext nneg i16 %100 to i64
  %104 = getelementptr inbounds [60 x i8], ptr @s2n_extension_ianas_to_ids, i64 0, i64 %103
  store i8 20, ptr %104, align 1, !tbaa !5
  br label %105

105:                                              ; preds = %102, %.preheader.20
  ret i32 0
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) 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 nounwind willreturn memory(argmem: write) }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"short", !6, i64 0}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass