; LLVM IR from caryll/otfcc :: lib/table/otl/subtables (gsub-single)

; 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.__otfcc_ICoverage = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.otfcc_HandlePackage = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.otfcc_Handle = type { i32, i16, ptr }
%struct.subtable_gsub_single = type { i64, i64, ptr }
%struct.otl_GsubSingleEntry = type { %struct.otfcc_Handle, %struct.otfcc_Handle }

@otl_iCoverage = external constant %struct.__otfcc_ICoverage, align 8
@otfcc_iHandle = external constant %struct.otfcc_HandlePackage, align 8

; 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
define dso_local ptr @otfcc_build_gsub_single_subtable(ptr noundef %0, i32 noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca i16, align 2
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i16, align 2
  %13 = alloca %struct.otfcc_Handle, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i16, align 2
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %19, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #3
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.subtable_gsub_single, ptr %20, i32 0, i32 0
  %22 = load i64, ptr %21, align 8, !tbaa !11
  %23 = icmp ugt i64 %22, 0
  %24 = zext i1 %23 to i8
  store i8 %24, ptr %7, align 1, !tbaa !14
  %25 = load i8, ptr %7, align 1, !tbaa !14, !range !16, !noundef !17
  %26 = trunc i8 %25 to i1
  br i1 %26, label %27, label %105

27:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.subtable_gsub_single, ptr %28, i32 0, i32 2
  %30 = load ptr, ptr %29, align 8, !tbaa !18
  %31 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %30, i64 0
  %32 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %31, i32 0, i32 1
  %33 = getelementptr inbounds %struct.otfcc_Handle, ptr %32, i32 0, i32 1
  %34 = load i16, ptr %33, align 4, !tbaa !19
  %35 = zext i16 %34 to i32
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.subtable_gsub_single, ptr %36, i32 0, i32 2
  %38 = load ptr, ptr %37, align 8, !tbaa !18
  %39 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %38, i64 0
  %40 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %39, i32 0, i32 0
  %41 = getelementptr inbounds %struct.otfcc_Handle, ptr %40, i32 0, i32 1
  %42 = load i16, ptr %41, align 4, !tbaa !23
  %43 = zext i16 %42 to i32
  %44 = sub nsw i32 %35, %43
  store i32 %44, ptr %8, align 4, !tbaa !9
  %45 = load i8, ptr %7, align 1, !tbaa !14, !range !16, !noundef !17
  %46 = trunc i8 %45 to i1
  br i1 %46, label %47, label %53

47:                                               ; preds = %27
  %48 = load i32, ptr %8, align 4, !tbaa !9
  %49 = icmp slt i32 %48, 32768
  br i1 %49, label %50, label %53

50:                                               ; preds = %47
  %51 = load i32, ptr %8, align 4, !tbaa !9
  %52 = icmp sgt i32 %51, -32768
  br label %53

53:                                               ; preds = %50, %47, %27
  %54 = phi i1 [ false, %47 ], [ false, %27 ], [ %52, %50 ]
  %55 = zext i1 %54 to i8
  store i8 %55, ptr %7, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 2, ptr %9) #3
  store i16 1, ptr %9, align 2, !tbaa !24
  br label %56

56:                                               ; preds = %101, %53
  %57 = load i16, ptr %9, align 2, !tbaa !24
  %58 = zext i16 %57 to i64
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.subtable_gsub_single, ptr %59, i32 0, i32 0
  %61 = load i64, ptr %60, align 8, !tbaa !11
  %62 = icmp ult i64 %58, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %56
  call void @llvm.lifetime.end.p0(i64 2, ptr %9) #3
  br label %104

64:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.subtable_gsub_single, ptr %65, i32 0, i32 2
  %67 = load ptr, ptr %66, align 8, !tbaa !18
  %68 = load i16, ptr %9, align 2, !tbaa !24
  %69 = zext i16 %68 to i64
  %70 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %67, i64 %69
  %71 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %70, i32 0, i32 1
  %72 = getelementptr inbounds %struct.otfcc_Handle, ptr %71, i32 0, i32 1
  %73 = load i16, ptr %72, align 4, !tbaa !19
  %74 = zext i16 %73 to i32
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.subtable_gsub_single, ptr %75, i32 0, i32 2
  %77 = load ptr, ptr %76, align 8, !tbaa !18
  %78 = load i16, ptr %9, align 2, !tbaa !24
  %79 = zext i16 %78 to i64
  %80 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %77, i64 %79
  %81 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %80, i32 0, i32 0
  %82 = getelementptr inbounds %struct.otfcc_Handle, ptr %81, i32 0, i32 1
  %83 = load i16, ptr %82, align 4, !tbaa !23
  %84 = zext i16 %83 to i32
  %85 = sub nsw i32 %74, %84
  store i32 %85, ptr %10, align 4, !tbaa !9
  %86 = load i8, ptr %7, align 1, !tbaa !14, !range !16, !noundef !17
  %87 = trunc i8 %86 to i1
  br i1 %87, label %88, label %98

88:                                               ; preds = %64
  %89 = load i32, ptr %10, align 4, !tbaa !9
  %90 = load i32, ptr %8, align 4, !tbaa !9
  %91 = icmp eq i32 %89, %90
  br i1 %91, label %92, label %98

92:                                               ; preds = %88
  %93 = load i32, ptr %10, align 4, !tbaa !9
  %94 = icmp slt i32 %93, 32768
  br i1 %94, label %95, label %98

95:                                               ; preds = %92
  %96 = load i32, ptr %10, align 4, !tbaa !9
  %97 = icmp sgt i32 %96, -32768
  br label %98

98:                                               ; preds = %95, %92, %88, %64
  %99 = phi i1 [ false, %92 ], [ false, %88 ], [ false, %64 ], [ %97, %95 ]
  %100 = zext i1 %99 to i8
  store i8 %100, ptr %7, align 1, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %101

101:                                              ; preds = %98
  %102 = load i16, ptr %9, align 2, !tbaa !24
  %103 = add i16 %102, 1
  store i16 %103, ptr %9, align 2, !tbaa !24
  br label %56, !llvm.loop !25

104:                                              ; preds = %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %105

105:                                              ; preds = %104, %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %106 = load ptr, ptr getelementptr inbounds (%struct.__otfcc_ICoverage, ptr @otl_iCoverage, i32 0, i32 6), align 8, !tbaa !27
  %107 = call ptr (...) %106()
  store ptr %107, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr %12) #3
  store i16 0, ptr %12, align 2, !tbaa !24
  br label %108

108:                                              ; preds = %140, %105
  %109 = load i16, ptr %12, align 2, !tbaa !24
  %110 = zext i16 %109 to i64
  %111 = load ptr, ptr %6, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.subtable_gsub_single, ptr %111, i32 0, i32 0
  %113 = load i64, ptr %112, align 8, !tbaa !11
  %114 = icmp ult i64 %110, %113
  br i1 %114, label %116, label %115

115:                                              ; preds = %108
  call void @llvm.lifetime.end.p0(i64 2, ptr %12) #3
  br label %143

116:                                              ; preds = %108
  %117 = load ptr, ptr getelementptr inbounds (%struct.__otfcc_ICoverage, ptr @otl_iCoverage, i32 0, i32 15), align 8, !tbaa !29
  %118 = load ptr, ptr %11, align 8, !tbaa !5
  %119 = load ptr, ptr getelementptr inbounds (%struct.otfcc_HandlePackage, ptr @otfcc_iHandle, i32 0, i32 7), align 8, !tbaa !30
  %120 = load ptr, ptr %6, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.subtable_gsub_single, ptr %120, i32 0, i32 2
  %122 = load ptr, ptr %121, align 8, !tbaa !18
  %123 = load i16, ptr %12, align 2, !tbaa !24
  %124 = zext i16 %123 to i64
  %125 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %122, i64 %124
  %126 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %125, i32 0, i32 0
  %127 = getelementptr inbounds { i64, ptr }, ptr %126, i32 0, i32 0
  %128 = load i64, ptr %127, align 8
  %129 = getelementptr inbounds { i64, ptr }, ptr %126, i32 0, i32 1
  %130 = load ptr, ptr %129, align 8
  %131 = call { i64, ptr } %119(i64 %128, ptr %130)
  %132 = getelementptr inbounds { i64, ptr }, ptr %13, i32 0, i32 0
  %133 = extractvalue { i64, ptr } %131, 0
  store i64 %133, ptr %132, align 8
  %134 = getelementptr inbounds { i64, ptr }, ptr %13, i32 0, i32 1
  %135 = extractvalue { i64, ptr } %131, 1
  store ptr %135, ptr %134, align 8
  %136 = getelementptr inbounds { i64, ptr }, ptr %13, i32 0, i32 0
  %137 = load i64, ptr %136, align 8
  %138 = getelementptr inbounds { i64, ptr }, ptr %13, i32 0, i32 1
  %139 = load ptr, ptr %138, align 8
  call void %117(ptr noundef %118, i64 %137, ptr %139)
  br label %140

140:                                              ; preds = %116
  %141 = load i16, ptr %12, align 2, !tbaa !24
  %142 = add i16 %141, 1
  store i16 %142, ptr %12, align 2, !tbaa !24
  br label %108, !llvm.loop !32

143:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %144 = load ptr, ptr getelementptr inbounds (%struct.__otfcc_ICoverage, ptr @otl_iCoverage, i32 0, i32 13), align 8, !tbaa !33
  %145 = load ptr, ptr %11, align 8, !tbaa !5
  %146 = load i32, ptr %5, align 4, !tbaa !9
  %147 = and i32 %146, 1
  %148 = icmp ne i32 %147, 0
  %149 = zext i1 %148 to i64
  %150 = select i1 %148, i32 1, i32 0
  %151 = trunc i32 %150 to i16
  %152 = call ptr %144(ptr noundef %145, i16 noundef zeroext %151)
  store ptr %152, ptr %14, align 8, !tbaa !5
  %153 = load i8, ptr %7, align 1, !tbaa !14, !range !16, !noundef !17
  %154 = trunc i8 %153 to i1
  br i1 %154, label %155, label %184

155:                                              ; preds = %143
  %156 = load i32, ptr %5, align 4, !tbaa !9
  %157 = and i32 %156, 1
  %158 = icmp ne i32 %157, 0
  br i1 %158, label %184, label %159

159:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %160 = load ptr, ptr %14, align 8, !tbaa !5
  %161 = call ptr @bk_newBlockFromBuffer(ptr noundef %160)
  %162 = load ptr, ptr %6, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.subtable_gsub_single, ptr %162, i32 0, i32 2
  %164 = load ptr, ptr %163, align 8, !tbaa !18
  %165 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %164, i64 0
  %166 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %165, i32 0, i32 1
  %167 = getelementptr inbounds %struct.otfcc_Handle, ptr %166, i32 0, i32 1
  %168 = load i16, ptr %167, align 4, !tbaa !19
  %169 = zext i16 %168 to i32
  %170 = load ptr, ptr %6, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.subtable_gsub_single, ptr %170, i32 0, i32 2
  %172 = load ptr, ptr %171, align 8, !tbaa !18
  %173 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %172, i64 0
  %174 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %173, i32 0, i32 0
  %175 = getelementptr inbounds %struct.otfcc_Handle, ptr %174, i32 0, i32 1
  %176 = load i16, ptr %175, align 4, !tbaa !23
  %177 = zext i16 %176 to i32
  %178 = sub nsw i32 %169, %177
  %179 = call ptr (i32, ...) @bk_new_Block(i32 noundef 2, i32 noundef 1, i32 noundef 16, ptr noundef %161, i32 noundef 2, i32 noundef %178, i32 noundef 0)
  store ptr %179, ptr %15, align 8, !tbaa !5
  %180 = load ptr, ptr getelementptr inbounds (%struct.__otfcc_ICoverage, ptr @otl_iCoverage, i32 0, i32 7), align 8, !tbaa !34
  %181 = load ptr, ptr %11, align 8, !tbaa !5
  call void %180(ptr noundef %181)
  %182 = load ptr, ptr %15, align 8, !tbaa !5
  %183 = call ptr @bk_build_Block(ptr noundef %182)
  store ptr %183, ptr %3, align 8
  store i32 1, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  br label %220

184:                                              ; preds = %155, %143
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %185 = load ptr, ptr %14, align 8, !tbaa !5
  %186 = call ptr @bk_newBlockFromBuffer(ptr noundef %185)
  %187 = load ptr, ptr %6, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.subtable_gsub_single, ptr %187, i32 0, i32 0
  %189 = load i64, ptr %188, align 8, !tbaa !11
  %190 = call ptr (i32, ...) @bk_new_Block(i32 noundef 2, i32 noundef 2, i32 noundef 16, ptr noundef %186, i32 noundef 2, i64 noundef %189, i32 noundef 0)
  store ptr %190, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr %18) #3
  store i16 0, ptr %18, align 2, !tbaa !24
  br label %191

191:                                              ; preds = %212, %184
  %192 = load i16, ptr %18, align 2, !tbaa !24
  %193 = zext i16 %192 to i64
  %194 = load ptr, ptr %6, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.subtable_gsub_single, ptr %194, i32 0, i32 0
  %196 = load i64, ptr %195, align 8, !tbaa !11
  %197 = icmp ult i64 %193, %196
  br i1 %197, label %199, label %198

198:                                              ; preds = %191
  store i32 8, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 2, ptr %18) #3
  br label %215

199:                                              ; preds = %191
  %200 = load ptr, ptr %17, align 8, !tbaa !5
  %201 = load ptr, ptr %6, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.subtable_gsub_single, ptr %201, i32 0, i32 2
  %203 = load ptr, ptr %202, align 8, !tbaa !18
  %204 = load i16, ptr %18, align 2, !tbaa !24
  %205 = zext i16 %204 to i64
  %206 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %203, i64 %205
  %207 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %206, i32 0, i32 1
  %208 = getelementptr inbounds %struct.otfcc_Handle, ptr %207, i32 0, i32 1
  %209 = load i16, ptr %208, align 4, !tbaa !19
  %210 = zext i16 %209 to i32
  %211 = call ptr (ptr, i32, ...) @bk_push(ptr noundef %200, i32 noundef 2, i32 noundef %210, i32 noundef 0)
  br label %212

212:                                              ; preds = %199
  %213 = load i16, ptr %18, align 2, !tbaa !24
  %214 = add i16 %213, 1
  store i16 %214, ptr %18, align 2, !tbaa !24
  br label %191, !llvm.loop !35

215:                                              ; preds = %198
  %216 = load ptr, ptr getelementptr inbounds (%struct.__otfcc_ICoverage, ptr @otl_iCoverage, i32 0, i32 7), align 8, !tbaa !34
  %217 = load ptr, ptr %11, align 8, !tbaa !5
  call void %216(ptr noundef %217)
  %218 = load ptr, ptr %17, align 8, !tbaa !5
  %219 = call ptr @bk_build_Block(ptr noundef %218)
  store ptr %219, ptr %3, align 8
  store i32 1, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  br label %220

220:                                              ; preds = %215, %159
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %221 = load ptr, ptr %3, align 8
  ret ptr %221
}

declare ptr @bk_new_Block(i32 noundef, ...) #2

declare ptr @bk_newBlockFromBuffer(ptr noundef) #2

declare ptr @bk_build_Block(ptr noundef) #2

declare ptr @bk_push(ptr noundef, i32 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 = { "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 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"", !13, i64 0, !13, i64 8, !6, i64 16}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!12, !6, i64 16}
!19 = !{!20, !22, i64 20}
!20 = !{!"", !21, i64 0, !21, i64 16}
!21 = !{!"otfcc_Handle", !10, i64 0, !22, i64 4, !6, i64 8}
!22 = !{!"short", !7, i64 0}
!23 = !{!20, !22, i64 4}
!24 = !{!22, !22, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!28, !6, i64 48}
!28 = !{!"__otfcc_ICoverage", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120}
!29 = !{!28, !6, i64 120}
!30 = !{!31, !6, i64 56}
!31 = !{!"otfcc_HandlePackage", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88}
!32 = distinct !{!32, !26}
!33 = !{!28, !6, i64 104}
!34 = !{!28, !6, i64 56}
!35 = distinct !{!35, !26}


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

%struct.__otfcc_ICoverage = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.otfcc_HandlePackage = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.otl_GsubSingleEntry = type { %struct.otfcc_Handle, %struct.otfcc_Handle }
%struct.otfcc_Handle = type { i32, i16, ptr }

@otl_iCoverage = external local_unnamed_addr constant %struct.__otfcc_ICoverage, align 8
@otfcc_iHandle = external local_unnamed_addr constant %struct.otfcc_HandlePackage, align 8

; Function Attrs: nounwind uwtable
define dso_local ptr @otfcc_build_gsub_single_subtable(ptr nocapture noundef readonly %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = load i64, ptr %0, align 8, !tbaa !5
  %.not = icmp eq i64 %3, 0
  br i1 %.not, label %.loopexit, label %4

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load ptr, ptr %5, align 8, !tbaa !11
  %7 = getelementptr inbounds i8, ptr %6, i64 20
  %8 = load i16, ptr %7, align 4, !tbaa !12
  %9 = zext i16 %8 to i32
  %10 = getelementptr inbounds i8, ptr %6, i64 4
  %11 = load i16, ptr %10, align 4, !tbaa !17
  %12 = zext i16 %11 to i32
  %13 = sub nsw i32 %9, %12
  %14 = add nsw i32 %13, 32767
  %spec.select = icmp ult i32 %14, 65535
  %.not66 = icmp eq i64 %3, 1
  br i1 %.not66, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %4, %28
  %15 = phi i64 [ %31, %28 ], [ 1, %4 ]
  %.04959 = phi i1 [ %29, %28 ], [ %spec.select, %4 ]
  %.05058 = phi i16 [ %30, %28 ], [ 1, %4 ]
  br i1 %.04959, label %16, label %28

16:                                               ; preds = %.lr.ph
  %17 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %6, i64 %15
  %18 = getelementptr inbounds i8, ptr %17, i64 20
  %19 = load i16, ptr %18, align 4, !tbaa !12
  %20 = zext i16 %19 to i32
  %21 = getelementptr inbounds i8, ptr %17, i64 4
  %22 = load i16, ptr %21, align 4, !tbaa !17
  %23 = zext i16 %22 to i32
  %24 = sub nsw i32 %20, %23
  %25 = icmp eq i32 %24, %13
  %26 = add nsw i32 %24, 32767
  %27 = icmp ult i32 %26, 65535
  %spec.select57 = and i1 %25, %27
  br label %28

28:                                               ; preds = %16, %.lr.ph
  %29 = phi i1 [ false, %.lr.ph ], [ %spec.select57, %16 ]
  %30 = add i16 %.05058, 1
  %31 = zext i16 %30 to i64
  %32 = icmp ugt i64 %3, %31
  br i1 %32, label %.lr.ph, label %.loopexit, !llvm.loop !18

.loopexit:                                        ; preds = %28, %4, %2
  %.1 = phi i1 [ false, %2 ], [ %spec.select, %4 ], [ %29, %28 ]
  %33 = load ptr, ptr getelementptr inbounds (i8, ptr @otl_iCoverage, i64 48), align 8, !tbaa !20
  %34 = tail call ptr (...) %33() #2
  %35 = load i64, ptr %0, align 8, !tbaa !5
  %.not67 = icmp eq i64 %35, 0
  br i1 %.not67, label %._crit_edge, label %.lr.ph61

.lr.ph61:                                         ; preds = %.loopexit
  %36 = load ptr, ptr getelementptr inbounds (i8, ptr @otl_iCoverage, i64 120), align 8, !tbaa !22
  %37 = load ptr, ptr getelementptr inbounds (i8, ptr @otfcc_iHandle, i64 56), align 8, !tbaa !23
  %38 = getelementptr inbounds i8, ptr %0, i64 16
  br label %44

._crit_edge:                                      ; preds = %44, %.loopexit
  %39 = load ptr, ptr getelementptr inbounds (i8, ptr @otl_iCoverage, i64 104), align 8, !tbaa !25
  %40 = and i32 %1, 1
  %41 = trunc nuw nsw i32 %40 to i16
  %42 = tail call ptr %39(ptr noundef %34, i16 noundef zeroext %41) #2
  %.not.not = icmp eq i32 %40, 0
  %or.cond = and i1 %.not.not, %.1
  %43 = tail call ptr @bk_newBlockFromBuffer(ptr noundef %42) #2
  br i1 %or.cond, label %58, label %69

44:                                               ; preds = %.lr.ph61, %44
  %45 = phi i64 [ 0, %.lr.ph61 ], [ %55, %44 ]
  %.05160 = phi i16 [ 0, %.lr.ph61 ], [ %54, %44 ]
  %46 = load ptr, ptr %38, align 8, !tbaa !11
  %47 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %46, i64 %45
  %48 = load i64, ptr %47, align 8
  %49 = getelementptr inbounds i8, ptr %47, i64 8
  %50 = load ptr, ptr %49, align 8
  %51 = tail call { i64, ptr } %37(i64 %48, ptr %50) #2
  %52 = extractvalue { i64, ptr } %51, 0
  %53 = extractvalue { i64, ptr } %51, 1
  tail call void %36(ptr noundef %34, i64 %52, ptr %53) #2
  %54 = add i16 %.05160, 1
  %55 = zext i16 %54 to i64
  %56 = load i64, ptr %0, align 8, !tbaa !5
  %57 = icmp ugt i64 %56, %55
  br i1 %57, label %44, label %._crit_edge, !llvm.loop !26

58:                                               ; preds = %._crit_edge
  %59 = getelementptr inbounds i8, ptr %0, i64 16
  %60 = load ptr, ptr %59, align 8, !tbaa !11
  %61 = getelementptr inbounds i8, ptr %60, i64 20
  %62 = load i16, ptr %61, align 4, !tbaa !12
  %63 = zext i16 %62 to i32
  %64 = getelementptr inbounds i8, ptr %60, i64 4
  %65 = load i16, ptr %64, align 4, !tbaa !17
  %66 = zext i16 %65 to i32
  %67 = sub nsw i32 %63, %66
  %68 = tail call ptr (i32, ...) @bk_new_Block(i32 noundef 2, i32 noundef 1, i32 noundef 16, ptr noundef %43, i32 noundef 2, i32 noundef %67, i32 noundef 0) #2
  br label %._crit_edge65

69:                                               ; preds = %._crit_edge
  %70 = load i64, ptr %0, align 8, !tbaa !5
  %71 = tail call ptr (i32, ...) @bk_new_Block(i32 noundef 2, i32 noundef 2, i32 noundef 16, ptr noundef %43, i32 noundef 2, i64 noundef %70, i32 noundef 0) #2
  %72 = load i64, ptr %0, align 8, !tbaa !5
  %.not68 = icmp eq i64 %72, 0
  br i1 %.not68, label %._crit_edge65, label %.lr.ph64

.lr.ph64:                                         ; preds = %69
  %73 = getelementptr inbounds i8, ptr %0, i64 16
  br label %74

74:                                               ; preds = %.lr.ph64, %74
  %75 = phi i64 [ 0, %.lr.ph64 ], [ %82, %74 ]
  %.062 = phi i16 [ 0, %.lr.ph64 ], [ %81, %74 ]
  %76 = load ptr, ptr %73, align 8, !tbaa !11
  %77 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %76, i64 %75, i32 1, i32 1
  %78 = load i16, ptr %77, align 4, !tbaa !12
  %79 = zext i16 %78 to i32
  %80 = tail call ptr (ptr, i32, ...) @bk_push(ptr noundef %71, i32 noundef 2, i32 noundef %79, i32 noundef 0) #2
  %81 = add i16 %.062, 1
  %82 = zext i16 %81 to i64
  %83 = load i64, ptr %0, align 8, !tbaa !5
  %84 = icmp ugt i64 %83, %82
  br i1 %84, label %74, label %._crit_edge65, !llvm.loop !27

._crit_edge65:                                    ; preds = %74, %69, %58
  %.sink = phi ptr [ %68, %58 ], [ %71, %69 ], [ %71, %74 ]
  %85 = load ptr, ptr getelementptr inbounds (i8, ptr @otl_iCoverage, i64 56), align 8, !tbaa !28
  tail call void %85(ptr noundef %34) #2
  %86 = tail call ptr @bk_build_Block(ptr noundef %.sink) #2
  ret ptr %86
}

declare ptr @bk_new_Block(i32 noundef, ...) local_unnamed_addr #1

declare ptr @bk_newBlockFromBuffer(ptr noundef) local_unnamed_addr #1

declare ptr @bk_build_Block(ptr noundef) local_unnamed_addr #1

declare ptr @bk_push(ptr noundef, i32 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 = { "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 }

!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, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 8, !10, i64 16}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 16}
!12 = !{!13, !16, i64 20}
!13 = !{!"", !14, i64 0, !14, i64 16}
!14 = !{!"otfcc_Handle", !15, i64 0, !16, i64 4, !10, i64 8}
!15 = !{!"int", !8, i64 0}
!16 = !{!"short", !8, i64 0}
!17 = !{!13, !16, i64 4}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!21, !10, i64 48}
!21 = !{!"__otfcc_ICoverage", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120}
!22 = !{!21, !10, i64 120}
!23 = !{!24, !10, i64 56}
!24 = !{!"otfcc_HandlePackage", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88}
!25 = !{!21, !10, i64 104}
!26 = distinct !{!26, !19}
!27 = distinct !{!27, !19}
!28 = !{!21, !10, i64 56}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass