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

; 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.__caryll_vectorinterface_subtable_gsub_ligature = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%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.otl_GsubLigatureEntry = type { ptr, %struct.otfcc_Handle }
%struct.otl_Coverage = type { i16, i32, ptr }

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

; Function Attrs: nounwind uwtable
define dso_local ptr @otl_read_gsub_ligature(ptr noundef %0, i32 noundef %1, i32 noundef %2, i16 noundef zeroext %3, ptr noundef %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i16, align 2
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i16, align 2
  %15 = alloca i32, align 4
  %16 = alloca i16, align 2
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i16, align 2
  %20 = alloca i32, align 4
  %21 = alloca i16, align 2
  %22 = alloca i16, align 2
  %23 = alloca i32, align 4
  %24 = alloca i16, align 2
  %25 = alloca ptr, align 8
  %26 = alloca %struct.otfcc_Handle, align 8
  %27 = alloca i16, align 2
  %28 = alloca %struct.otfcc_Handle, align 8
  %29 = alloca %struct.otl_GsubLigatureEntry, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !9
  store i16 %3, ptr %10, align 2, !tbaa !11
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %30 = load ptr, ptr getelementptr inbounds (%struct.__caryll_vectorinterface_subtable_gsub_ligature, ptr @iSubtable_gsub_ligature, i32 0, i32 6), align 8, !tbaa !13
  %31 = call ptr (...) %30()
  store ptr %31, ptr %12, align 8, !tbaa !5
  %32 = load i32, ptr %8, align 4, !tbaa !9
  %33 = load i32, ptr %9, align 4, !tbaa !9
  %34 = add i32 %33, 6
  %35 = icmp ult i32 %32, %34
  br i1 %35, label %36, label %37

36:                                               ; preds = %5
  br label %305

37:                                               ; preds = %5
  %38 = load ptr, ptr getelementptr inbounds (%struct.__otfcc_ICoverage, ptr @otl_iCoverage, i32 0, i32 9), align 8, !tbaa !15
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = load i32, ptr %8, align 4, !tbaa !9
  %41 = load i32, ptr %9, align 4, !tbaa !9
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = load i32, ptr %9, align 4, !tbaa !9
  %44 = zext i32 %43 to i64
  %45 = getelementptr inbounds i8, ptr %42, i64 %44
  %46 = getelementptr inbounds i8, ptr %45, i64 2
  %47 = call zeroext i16 @read_16u(ptr noundef %46)
  %48 = zext i16 %47 to i32
  %49 = add i32 %41, %48
  %50 = call ptr %38(ptr noundef %39, i32 noundef %40, i32 noundef %49)
  store ptr %50, ptr %13, align 8, !tbaa !5
  %51 = load ptr, ptr %13, align 8, !tbaa !5
  %52 = icmp ne ptr %51, null
  br i1 %52, label %54, label %53

53:                                               ; preds = %37
  br label %305

54:                                               ; preds = %37
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = load i32, ptr %9, align 4, !tbaa !9
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds i8, ptr %55, i64 %57
  %59 = getelementptr inbounds i8, ptr %58, i64 4
  %60 = call zeroext i16 @read_16u(ptr noundef %59)
  store i16 %60, ptr %14, align 2, !tbaa !11
  %61 = load i16, ptr %14, align 2, !tbaa !11
  %62 = zext i16 %61 to i32
  %63 = load ptr, ptr %13, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.otl_Coverage, ptr %63, i32 0, i32 0
  %65 = load i16, ptr %64, align 8, !tbaa !17
  %66 = zext i16 %65 to i32
  %67 = icmp ne i32 %62, %66
  br i1 %67, label %68, label %69

68:                                               ; preds = %54
  br label %305

69:                                               ; preds = %54
  %70 = load i32, ptr %8, align 4, !tbaa !9
  %71 = load i32, ptr %9, align 4, !tbaa !9
  %72 = add i32 %71, 6
  %73 = load i16, ptr %14, align 2, !tbaa !11
  %74 = zext i16 %73 to i32
  %75 = mul nsw i32 %74, 2
  %76 = add i32 %72, %75
  %77 = icmp ult i32 %70, %76
  br i1 %77, label %78, label %79

78:                                               ; preds = %69
  br label %305

79:                                               ; preds = %69
  store i32 0, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %16) #3
  store i16 0, ptr %16, align 2, !tbaa !11
  br label %80

80:                                               ; preds = %133, %79
  %81 = load i16, ptr %16, align 2, !tbaa !11
  %82 = zext i16 %81 to i32
  %83 = load i16, ptr %14, align 2, !tbaa !11
  %84 = zext i16 %83 to i32
  %85 = icmp slt i32 %82, %84
  br i1 %85, label %87, label %86

86:                                               ; preds = %80
  store i32 3, ptr %17, align 4
  br label %136

87:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %88 = load i32, ptr %9, align 4, !tbaa !9
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = load i32, ptr %9, align 4, !tbaa !9
  %91 = zext i32 %90 to i64
  %92 = getelementptr inbounds i8, ptr %89, i64 %91
  %93 = getelementptr inbounds i8, ptr %92, i64 6
  %94 = load i16, ptr %16, align 2, !tbaa !11
  %95 = zext i16 %94 to i32
  %96 = mul nsw i32 %95, 2
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds i8, ptr %93, i64 %97
  %99 = call zeroext i16 @read_16u(ptr noundef %98)
  %100 = zext i16 %99 to i32
  %101 = add i32 %88, %100
  store i32 %101, ptr %18, align 4, !tbaa !9
  %102 = load i32, ptr %8, align 4, !tbaa !9
  %103 = load i32, ptr %18, align 4, !tbaa !9
  %104 = add i32 %103, 2
  %105 = icmp ult i32 %102, %104
  br i1 %105, label %106, label %107

106:                                              ; preds = %87
  store i32 2, ptr %17, align 4
  br label %130

107:                                              ; preds = %87
  %108 = load ptr, ptr %7, align 8, !tbaa !5
  %109 = load i32, ptr %18, align 4, !tbaa !9
  %110 = zext i32 %109 to i64
  %111 = getelementptr inbounds i8, ptr %108, i64 %110
  %112 = call zeroext i16 @read_16u(ptr noundef %111)
  %113 = zext i16 %112 to i32
  %114 = load i32, ptr %15, align 4, !tbaa !9
  %115 = add i32 %114, %113
  store i32 %115, ptr %15, align 4, !tbaa !9
  %116 = load i32, ptr %8, align 4, !tbaa !9
  %117 = load i32, ptr %18, align 4, !tbaa !9
  %118 = add i32 %117, 2
  %119 = load ptr, ptr %7, align 8, !tbaa !5
  %120 = load i32, ptr %18, align 4, !tbaa !9
  %121 = zext i32 %120 to i64
  %122 = getelementptr inbounds i8, ptr %119, i64 %121
  %123 = call zeroext i16 @read_16u(ptr noundef %122)
  %124 = zext i16 %123 to i32
  %125 = mul nsw i32 %124, 2
  %126 = add i32 %118, %125
  %127 = icmp ult i32 %116, %126
  br i1 %127, label %128, label %129

128:                                              ; preds = %107
  store i32 2, ptr %17, align 4
  br label %130

129:                                              ; preds = %107
  store i32 0, ptr %17, align 4
  br label %130

130:                                              ; preds = %129, %128, %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  %131 = load i32, ptr %17, align 4
  switch i32 %131, label %136 [
    i32 0, label %132
  ]

132:                                              ; preds = %130
  br label %133

133:                                              ; preds = %132
  %134 = load i16, ptr %16, align 2, !tbaa !11
  %135 = add i16 %134, 1
  store i16 %135, ptr %16, align 2, !tbaa !11
  br label %80, !llvm.loop !19

136:                                              ; preds = %130, %86
  call void @llvm.lifetime.end.p0(i64 2, ptr %16) #3
  %137 = load i32, ptr %17, align 4
  switch i32 %137, label %308 [
    i32 3, label %138
    i32 2, label %305
  ]

138:                                              ; preds = %136
  call void @llvm.lifetime.start.p0(i64 2, ptr %19) #3
  store i16 0, ptr %19, align 2, !tbaa !11
  br label %139

139:                                              ; preds = %296, %138
  %140 = load i16, ptr %19, align 2, !tbaa !11
  %141 = zext i16 %140 to i32
  %142 = load i16, ptr %14, align 2, !tbaa !11
  %143 = zext i16 %142 to i32
  %144 = icmp slt i32 %141, %143
  br i1 %144, label %146, label %145

145:                                              ; preds = %139
  store i32 6, ptr %17, align 4
  br label %299

146:                                              ; preds = %139
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  %147 = load i32, ptr %9, align 4, !tbaa !9
  %148 = load ptr, ptr %7, align 8, !tbaa !5
  %149 = load i32, ptr %9, align 4, !tbaa !9
  %150 = zext i32 %149 to i64
  %151 = getelementptr inbounds i8, ptr %148, i64 %150
  %152 = getelementptr inbounds i8, ptr %151, i64 6
  %153 = load i16, ptr %19, align 2, !tbaa !11
  %154 = zext i16 %153 to i32
  %155 = mul nsw i32 %154, 2
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds i8, ptr %152, i64 %156
  %158 = call zeroext i16 @read_16u(ptr noundef %157)
  %159 = zext i16 %158 to i32
  %160 = add i32 %147, %159
  store i32 %160, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %21) #3
  %161 = load ptr, ptr %7, align 8, !tbaa !5
  %162 = load i32, ptr %20, align 4, !tbaa !9
  %163 = zext i32 %162 to i64
  %164 = getelementptr inbounds i8, ptr %161, i64 %163
  %165 = call zeroext i16 @read_16u(ptr noundef %164)
  store i16 %165, ptr %21, align 2, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 2, ptr %22) #3
  store i16 0, ptr %22, align 2, !tbaa !11
  br label %166

166:                                              ; preds = %287, %146
  %167 = load i16, ptr %22, align 2, !tbaa !11
  %168 = zext i16 %167 to i32
  %169 = load i16, ptr %21, align 2, !tbaa !11
  %170 = zext i16 %169 to i32
  %171 = icmp slt i32 %168, %170
  br i1 %171, label %173, label %172

172:                                              ; preds = %166
  store i32 9, ptr %17, align 4
  br label %290

173:                                              ; preds = %166
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  %174 = load i32, ptr %20, align 4, !tbaa !9
  %175 = load ptr, ptr %7, align 8, !tbaa !5
  %176 = load i32, ptr %20, align 4, !tbaa !9
  %177 = zext i32 %176 to i64
  %178 = getelementptr inbounds i8, ptr %175, i64 %177
  %179 = getelementptr inbounds i8, ptr %178, i64 2
  %180 = load i16, ptr %22, align 2, !tbaa !11
  %181 = zext i16 %180 to i32
  %182 = mul nsw i32 %181, 2
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds i8, ptr %179, i64 %183
  %185 = call zeroext i16 @read_16u(ptr noundef %184)
  %186 = zext i16 %185 to i32
  %187 = add i32 %174, %186
  store i32 %187, ptr %23, align 4, !tbaa !9
  %188 = load i32, ptr %8, align 4, !tbaa !9
  %189 = load i32, ptr %23, align 4, !tbaa !9
  %190 = add i32 %189, 4
  %191 = icmp ult i32 %188, %190
  br i1 %191, label %192, label %193

192:                                              ; preds = %173
  store i32 2, ptr %17, align 4
  br label %284

193:                                              ; preds = %173
  call void @llvm.lifetime.start.p0(i64 2, ptr %24) #3
  %194 = load ptr, ptr %7, align 8, !tbaa !5
  %195 = load i32, ptr %23, align 4, !tbaa !9
  %196 = zext i32 %195 to i64
  %197 = getelementptr inbounds i8, ptr %194, i64 %196
  %198 = getelementptr inbounds i8, ptr %197, i64 2
  %199 = call zeroext i16 @read_16u(ptr noundef %198)
  store i16 %199, ptr %24, align 2, !tbaa !11
  %200 = load i32, ptr %8, align 4, !tbaa !9
  %201 = load i32, ptr %23, align 4, !tbaa !9
  %202 = add i32 %201, 2
  %203 = load i16, ptr %24, align 2, !tbaa !11
  %204 = zext i16 %203 to i32
  %205 = mul nsw i32 %204, 2
  %206 = add i32 %202, %205
  %207 = icmp ult i32 %200, %206
  br i1 %207, label %208, label %209

208:                                              ; preds = %193
  store i32 2, ptr %17, align 4
  br label %283

209:                                              ; preds = %193
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #3
  %210 = load ptr, ptr getelementptr inbounds (%struct.__otfcc_ICoverage, ptr @otl_iCoverage, i32 0, i32 6), align 8, !tbaa !21
  %211 = call ptr (...) %210()
  store ptr %211, ptr %25, align 8, !tbaa !5
  %212 = load ptr, ptr getelementptr inbounds (%struct.__otfcc_ICoverage, ptr @otl_iCoverage, i32 0, i32 15), align 8, !tbaa !22
  %213 = load ptr, ptr %25, align 8, !tbaa !5
  %214 = load ptr, ptr getelementptr inbounds (%struct.otfcc_HandlePackage, ptr @otfcc_iHandle, i32 0, i32 8), align 8, !tbaa !23
  %215 = load ptr, ptr %13, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.otl_Coverage, ptr %215, i32 0, i32 2
  %217 = load ptr, ptr %216, align 8, !tbaa !25
  %218 = load i16, ptr %19, align 2, !tbaa !11
  %219 = zext i16 %218 to i64
  %220 = getelementptr inbounds %struct.otfcc_Handle, ptr %217, i64 %219
  %221 = getelementptr inbounds %struct.otfcc_Handle, ptr %220, i32 0, i32 1
  %222 = load i16, ptr %221, align 4, !tbaa !26
  %223 = call { i64, ptr } %214(i16 noundef zeroext %222)
  %224 = getelementptr inbounds { i64, ptr }, ptr %26, i32 0, i32 0
  %225 = extractvalue { i64, ptr } %223, 0
  store i64 %225, ptr %224, align 8
  %226 = getelementptr inbounds { i64, ptr }, ptr %26, i32 0, i32 1
  %227 = extractvalue { i64, ptr } %223, 1
  store ptr %227, ptr %226, align 8
  %228 = getelementptr inbounds { i64, ptr }, ptr %26, i32 0, i32 0
  %229 = load i64, ptr %228, align 8
  %230 = getelementptr inbounds { i64, ptr }, ptr %26, i32 0, i32 1
  %231 = load ptr, ptr %230, align 8
  call void %212(ptr noundef %213, i64 %229, ptr %231)
  call void @llvm.lifetime.start.p0(i64 2, ptr %27) #3
  store i16 1, ptr %27, align 2, !tbaa !11
  br label %232

232:                                              ; preds = %263, %209
  %233 = load i16, ptr %27, align 2, !tbaa !11
  %234 = zext i16 %233 to i32
  %235 = load i16, ptr %24, align 2, !tbaa !11
  %236 = zext i16 %235 to i32
  %237 = icmp slt i32 %234, %236
  br i1 %237, label %239, label %238

238:                                              ; preds = %232
  store i32 12, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 2, ptr %27) #3
  br label %266

239:                                              ; preds = %232
  %240 = load ptr, ptr getelementptr inbounds (%struct.__otfcc_ICoverage, ptr @otl_iCoverage, i32 0, i32 15), align 8, !tbaa !22
  %241 = load ptr, ptr %25, align 8, !tbaa !5
  %242 = load ptr, ptr getelementptr inbounds (%struct.otfcc_HandlePackage, ptr @otfcc_iHandle, i32 0, i32 8), align 8, !tbaa !23
  %243 = load ptr, ptr %7, align 8, !tbaa !5
  %244 = load i32, ptr %23, align 4, !tbaa !9
  %245 = zext i32 %244 to i64
  %246 = getelementptr inbounds i8, ptr %243, i64 %245
  %247 = getelementptr inbounds i8, ptr %246, i64 2
  %248 = load i16, ptr %27, align 2, !tbaa !11
  %249 = zext i16 %248 to i32
  %250 = mul nsw i32 %249, 2
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds i8, ptr %247, i64 %251
  %253 = call zeroext i16 @read_16u(ptr noundef %252)
  %254 = call { i64, ptr } %242(i16 noundef zeroext %253)
  %255 = getelementptr inbounds { i64, ptr }, ptr %28, i32 0, i32 0
  %256 = extractvalue { i64, ptr } %254, 0
  store i64 %256, ptr %255, align 8
  %257 = getelementptr inbounds { i64, ptr }, ptr %28, i32 0, i32 1
  %258 = extractvalue { i64, ptr } %254, 1
  store ptr %258, ptr %257, align 8
  %259 = getelementptr inbounds { i64, ptr }, ptr %28, i32 0, i32 0
  %260 = load i64, ptr %259, align 8
  %261 = getelementptr inbounds { i64, ptr }, ptr %28, i32 0, i32 1
  %262 = load ptr, ptr %261, align 8
  call void %240(ptr noundef %241, i64 %260, ptr %262)
  br label %263

263:                                              ; preds = %239
  %264 = load i16, ptr %27, align 2, !tbaa !11
  %265 = add i16 %264, 1
  store i16 %265, ptr %27, align 2, !tbaa !11
  br label %232, !llvm.loop !28

266:                                              ; preds = %238
  %267 = load ptr, ptr getelementptr inbounds (%struct.__caryll_vectorinterface_subtable_gsub_ligature, ptr @iSubtable_gsub_ligature, i32 0, i32 13), align 8, !tbaa !29
  %268 = load ptr, ptr %12, align 8, !tbaa !5
  %269 = getelementptr inbounds %struct.otl_GsubLigatureEntry, ptr %29, i32 0, i32 0
  %270 = load ptr, ptr %25, align 8, !tbaa !5
  store ptr %270, ptr %269, align 8, !tbaa !30
  %271 = getelementptr inbounds %struct.otl_GsubLigatureEntry, ptr %29, i32 0, i32 1
  %272 = load ptr, ptr getelementptr inbounds (%struct.otfcc_HandlePackage, ptr @otfcc_iHandle, i32 0, i32 8), align 8, !tbaa !23
  %273 = load ptr, ptr %7, align 8, !tbaa !5
  %274 = load i32, ptr %23, align 4, !tbaa !9
  %275 = zext i32 %274 to i64
  %276 = getelementptr inbounds i8, ptr %273, i64 %275
  %277 = call zeroext i16 @read_16u(ptr noundef %276)
  %278 = call { i64, ptr } %272(i16 noundef zeroext %277)
  %279 = getelementptr inbounds { i64, ptr }, ptr %271, i32 0, i32 0
  %280 = extractvalue { i64, ptr } %278, 0
  store i64 %280, ptr %279, align 8
  %281 = getelementptr inbounds { i64, ptr }, ptr %271, i32 0, i32 1
  %282 = extractvalue { i64, ptr } %278, 1
  store ptr %282, ptr %281, align 8
  call void %267(ptr noundef %268, ptr noundef byval(%struct.otl_GsubLigatureEntry) align 8 %29)
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #3
  store i32 0, ptr %17, align 4
  br label %283

283:                                              ; preds = %266, %208
  call void @llvm.lifetime.end.p0(i64 2, ptr %24) #3
  br label %284

284:                                              ; preds = %283, %192
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  %285 = load i32, ptr %17, align 4
  switch i32 %285, label %290 [
    i32 0, label %286
  ]

286:                                              ; preds = %284
  br label %287

287:                                              ; preds = %286
  %288 = load i16, ptr %22, align 2, !tbaa !11
  %289 = add i16 %288, 1
  store i16 %289, ptr %22, align 2, !tbaa !11
  br label %166, !llvm.loop !32

290:                                              ; preds = %284, %172
  call void @llvm.lifetime.end.p0(i64 2, ptr %22) #3
  %291 = load i32, ptr %17, align 4
  switch i32 %291, label %293 [
    i32 9, label %292
  ]

292:                                              ; preds = %290
  store i32 0, ptr %17, align 4
  br label %293

293:                                              ; preds = %292, %290
  call void @llvm.lifetime.end.p0(i64 2, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  %294 = load i32, ptr %17, align 4
  switch i32 %294, label %299 [
    i32 0, label %295
  ]

295:                                              ; preds = %293
  br label %296

296:                                              ; preds = %295
  %297 = load i16, ptr %19, align 2, !tbaa !11
  %298 = add i16 %297, 1
  store i16 %298, ptr %19, align 2, !tbaa !11
  br label %139, !llvm.loop !33

299:                                              ; preds = %293, %145
  call void @llvm.lifetime.end.p0(i64 2, ptr %19) #3
  %300 = load i32, ptr %17, align 4
  switch i32 %300, label %308 [
    i32 6, label %301
    i32 2, label %305
  ]

301:                                              ; preds = %299
  %302 = load ptr, ptr getelementptr inbounds (%struct.__otfcc_ICoverage, ptr @otl_iCoverage, i32 0, i32 7), align 8, !tbaa !34
  %303 = load ptr, ptr %13, align 8, !tbaa !5
  call void %302(ptr noundef %303)
  %304 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %304, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %308

305:                                              ; preds = %299, %136, %78, %68, %53, %36
  %306 = load ptr, ptr getelementptr inbounds (%struct.__caryll_vectorinterface_subtable_gsub_ligature, ptr @iSubtable_gsub_ligature, i32 0, i32 7), align 8, !tbaa !35
  %307 = load ptr, ptr %12, align 8, !tbaa !5
  call void %306(ptr noundef %307)
  store ptr null, ptr %6, align 8
  store i32 1, ptr %17, align 4
  br label %308

308:                                              ; preds = %305, %301, %299, %136
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  %309 = load ptr, ptr %6, align 8
  ret ptr %309
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @read_16u(ptr noundef) #2

; 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 = { inlinehint 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 #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, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!14, !6, i64 48}
!14 = !{!"__caryll_vectorinterface_subtable_gsub_ligature", !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, !6, i64 128, !6, i64 136, !6, i64 144}
!15 = !{!16, !6, i64 72}
!16 = !{!"__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}
!17 = !{!18, !12, i64 0}
!18 = !{!"", !12, i64 0, !10, i64 4, !6, i64 8}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!16, !6, i64 48}
!22 = !{!16, !6, i64 120}
!23 = !{!24, !6, i64 64}
!24 = !{!"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}
!25 = !{!18, !6, i64 8}
!26 = !{!27, !12, i64 4}
!27 = !{!"otfcc_Handle", !10, i64 0, !12, i64 4, !6, i64 8}
!28 = distinct !{!28, !20}
!29 = !{!14, !6, i64 104}
!30 = !{!31, !6, i64 0}
!31 = !{!"", !6, i64 0, !27, i64 8}
!32 = distinct !{!32, !20}
!33 = distinct !{!33, !20}
!34 = !{!16, !6, i64 56}
!35 = !{!14, !6, i64 56}


; 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.__caryll_vectorinterface_subtable_gsub_ligature = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%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_GsubLigatureEntry = type { ptr, %struct.otfcc_Handle }
%struct.otfcc_Handle = type { i32, i16, ptr }

@iSubtable_gsub_ligature = external dso_local local_unnamed_addr constant %struct.__caryll_vectorinterface_subtable_gsub_ligature, align 8
@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 @otl_read_gsub_ligature(ptr noundef %0, i32 noundef %1, i32 noundef %2, i16 noundef zeroext %3, ptr nocapture noundef readnone %4) local_unnamed_addr #0 {
  %6 = alloca %struct.otl_GsubLigatureEntry, align 8
  %7 = load ptr, ptr getelementptr inbounds (i8, ptr @iSubtable_gsub_ligature, i64 48), align 8, !tbaa !5
  %8 = tail call ptr (...) %7() #2
  %9 = add i32 %2, 6
  %10 = icmp ugt i32 %9, %1
  br i1 %10, label %.thread103, label %11

11:                                               ; preds = %5
  %12 = load ptr, ptr getelementptr inbounds (i8, ptr @otl_iCoverage, i64 72), align 8, !tbaa !10
  %13 = zext i32 %2 to i64
  %14 = getelementptr inbounds i8, ptr %0, i64 %13
  %15 = getelementptr inbounds i8, ptr %14, i64 2
  %16 = tail call zeroext i16 @read_16u(ptr noundef nonnull %15)
  %17 = zext i16 %16 to i32
  %18 = add i32 %17, %2
  %19 = tail call ptr %12(ptr noundef %0, i32 noundef %1, i32 noundef %18) #2
  %.not = icmp eq ptr %19, null
  br i1 %.not, label %.thread103, label %20

20:                                               ; preds = %11
  %21 = getelementptr inbounds i8, ptr %14, i64 4
  %22 = tail call zeroext i16 @read_16u(ptr noundef nonnull %21)
  %23 = load i16, ptr %19, align 8, !tbaa !12
  %.not98 = icmp eq i16 %22, %23
  br i1 %.not98, label %24, label %.thread103

24:                                               ; preds = %20
  %25 = zext i16 %22 to i32
  %26 = shl nuw nsw i32 %25, 1
  %27 = add i32 %26, %9
  %28 = icmp ugt i32 %27, %1
  br i1 %28, label %.thread103, label %.preheader117

.preheader117:                                    ; preds = %24
  %.not131 = icmp eq i16 %22, 0
  br i1 %.not131, label %._crit_edge130, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader117
  %29 = getelementptr inbounds i8, ptr %14, i64 6
  %wide.trip.count = zext i16 %22 to i64
  br label %31

30:                                               ; preds = %39
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %31, !llvm.loop !16

31:                                               ; preds = %.lr.ph, %30
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %30 ]
  %32 = shl nuw nsw i64 %indvars.iv, 1
  %33 = getelementptr inbounds i8, ptr %29, i64 %32
  %34 = tail call zeroext i16 @read_16u(ptr noundef nonnull %33)
  %35 = zext i16 %34 to i32
  %36 = add i32 %35, %2
  %37 = add i32 %36, 2
  %38 = icmp ugt i32 %37, %1
  br i1 %38, label %.thread103, label %39

39:                                               ; preds = %31
  %40 = zext i32 %36 to i64
  %41 = getelementptr inbounds i8, ptr %0, i64 %40
  %42 = tail call zeroext i16 @read_16u(ptr noundef %41)
  %43 = tail call zeroext i16 @read_16u(ptr noundef %41)
  %44 = zext i16 %43 to i32
  %45 = shl nuw nsw i32 %44, 1
  %46 = add i32 %45, %37
  %.not116 = icmp ugt i32 %46, %1
  br i1 %.not116, label %.thread103, label %30

.preheader:                                       ; preds = %30
  br i1 %.not131, label %._crit_edge130, label %.lr.ph129

.lr.ph129:                                        ; preds = %.preheader
  %47 = getelementptr inbounds i8, ptr %14, i64 6
  %48 = load ptr, ptr getelementptr inbounds (i8, ptr @otl_iCoverage, i64 48), align 8
  %49 = load ptr, ptr getelementptr inbounds (i8, ptr @otl_iCoverage, i64 120), align 8
  %50 = load ptr, ptr getelementptr inbounds (i8, ptr @otfcc_iHandle, i64 64), align 8
  %51 = getelementptr inbounds i8, ptr %19, i64 8
  %52 = load ptr, ptr getelementptr inbounds (i8, ptr @iSubtable_gsub_ligature, i64 104), align 8
  %53 = getelementptr inbounds i8, ptr %6, i64 8
  %54 = getelementptr inbounds i8, ptr %6, i64 16
  %wide.trip.count149 = zext i16 %22 to i64
  br label %55

55:                                               ; preds = %.lr.ph129, %._crit_edge127
  %indvars.iv146 = phi i64 [ 0, %.lr.ph129 ], [ %indvars.iv.next147, %._crit_edge127 ]
  %56 = shl nuw nsw i64 %indvars.iv146, 1
  %57 = getelementptr inbounds i8, ptr %47, i64 %56
  %58 = tail call zeroext i16 @read_16u(ptr noundef nonnull %57)
  %59 = zext i16 %58 to i32
  %60 = add i32 %59, %2
  %61 = zext i32 %60 to i64
  %62 = getelementptr inbounds i8, ptr %0, i64 %61
  %63 = tail call zeroext i16 @read_16u(ptr noundef %62)
  %.not133 = icmp eq i16 %63, 0
  br i1 %.not133, label %._crit_edge127, label %.lr.ph126

.lr.ph126:                                        ; preds = %55
  %64 = getelementptr inbounds i8, ptr %62, i64 2
  %wide.trip.count144 = zext i16 %63 to i64
  br label %65

65:                                               ; preds = %.lr.ph126, %._crit_edge
  %indvars.iv141 = phi i64 [ 0, %.lr.ph126 ], [ %indvars.iv.next142, %._crit_edge ]
  %66 = shl nuw nsw i64 %indvars.iv141, 1
  %67 = getelementptr inbounds i8, ptr %64, i64 %66
  %68 = tail call zeroext i16 @read_16u(ptr noundef nonnull %67)
  %69 = zext i16 %68 to i32
  %70 = add i32 %60, %69
  %71 = add i32 %70, 4
  %72 = icmp ugt i32 %71, %1
  br i1 %72, label %.thread103, label %73

73:                                               ; preds = %65
  %74 = zext i32 %70 to i64
  %75 = getelementptr inbounds i8, ptr %0, i64 %74
  %76 = getelementptr inbounds i8, ptr %75, i64 2
  %77 = tail call zeroext i16 @read_16u(ptr noundef nonnull %76)
  %78 = add i32 %70, 2
  %79 = zext i16 %77 to i32
  %80 = shl nuw nsw i32 %79, 1
  %81 = add i32 %78, %80
  %82 = icmp ugt i32 %81, %1
  br i1 %82, label %.thread103, label %83

83:                                               ; preds = %73
  %84 = tail call ptr (...) %48() #2
  %85 = load ptr, ptr %51, align 8, !tbaa !18
  %86 = getelementptr inbounds %struct.otfcc_Handle, ptr %85, i64 %indvars.iv146, i32 1
  %87 = load i16, ptr %86, align 4, !tbaa !19
  %88 = tail call { i64, ptr } %50(i16 noundef zeroext %87) #2
  %89 = extractvalue { i64, ptr } %88, 0
  %90 = extractvalue { i64, ptr } %88, 1
  tail call void %49(ptr noundef %84, i64 %89, ptr %90) #2
  %91 = icmp ugt i16 %77, 1
  br i1 %91, label %.lr.ph123.preheader, label %._crit_edge

.lr.ph123.preheader:                              ; preds = %83
  %wide.trip.count139 = zext i16 %77 to i64
  br label %.lr.ph123

.lr.ph123:                                        ; preds = %.lr.ph123.preheader, %.lr.ph123
  %indvars.iv136 = phi i64 [ 1, %.lr.ph123.preheader ], [ %indvars.iv.next137, %.lr.ph123 ]
  %92 = shl nuw nsw i64 %indvars.iv136, 1
  %93 = getelementptr inbounds i8, ptr %76, i64 %92
  %94 = tail call zeroext i16 @read_16u(ptr noundef nonnull %93)
  %95 = tail call { i64, ptr } %50(i16 noundef zeroext %94) #2
  %96 = extractvalue { i64, ptr } %95, 0
  %97 = extractvalue { i64, ptr } %95, 1
  tail call void %49(ptr noundef %84, i64 %96, ptr %97) #2
  %indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
  %exitcond140.not = icmp eq i64 %indvars.iv.next137, %wide.trip.count139
  br i1 %exitcond140.not, label %._crit_edge, label %.lr.ph123, !llvm.loop !21

._crit_edge:                                      ; preds = %.lr.ph123, %83
  store ptr %84, ptr %6, align 8, !tbaa !22
  %98 = tail call zeroext i16 @read_16u(ptr noundef %75)
  %99 = tail call { i64, ptr } %50(i16 noundef zeroext %98) #2
  %100 = extractvalue { i64, ptr } %99, 0
  store i64 %100, ptr %53, align 8
  %101 = extractvalue { i64, ptr } %99, 1
  store ptr %101, ptr %54, align 8
  tail call void %52(ptr noundef %8, ptr noundef nonnull byval(%struct.otl_GsubLigatureEntry) align 8 %6) #2
  %indvars.iv.next142 = add nuw nsw i64 %indvars.iv141, 1
  %exitcond145.not = icmp eq i64 %indvars.iv.next142, %wide.trip.count144
  br i1 %exitcond145.not, label %._crit_edge127, label %65, !llvm.loop !24

._crit_edge127:                                   ; preds = %._crit_edge, %55
  %indvars.iv.next147 = add nuw nsw i64 %indvars.iv146, 1
  %exitcond150.not = icmp eq i64 %indvars.iv.next147, %wide.trip.count149
  br i1 %exitcond150.not, label %._crit_edge130, label %55, !llvm.loop !25

._crit_edge130:                                   ; preds = %._crit_edge127, %.preheader117, %.preheader
  %102 = load ptr, ptr getelementptr inbounds (i8, ptr @otl_iCoverage, i64 56), align 8, !tbaa !26
  tail call void %102(ptr noundef nonnull %19) #2
  br label %104

.thread103:                                       ; preds = %31, %39, %73, %65, %24, %20, %11, %5
  %103 = load ptr, ptr getelementptr inbounds (i8, ptr @iSubtable_gsub_ligature, i64 56), align 8, !tbaa !27
  tail call void %103(ptr noundef %8) #2
  br label %104

104:                                              ; preds = %.thread103, %._crit_edge130
  %.0 = phi ptr [ null, %.thread103 ], [ %8, %._crit_edge130 ]
  ret ptr %.0
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @read_16u(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 = { inlinehint 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 }

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


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