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

@iSubtable_gsub_single = external dso_local constant %struct.__caryll_vectorinterface_subtable_gsub_single, 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_single(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 ptr, align 8
  %15 = alloca i16, align 2
  %16 = alloca i16, align 2
  %17 = alloca i16, align 2
  %18 = alloca %struct.otfcc_Handle, align 8
  %19 = alloca i16, align 2
  %20 = alloca i16, align 2
  %21 = alloca %struct.otfcc_Handle, align 8
  %22 = alloca i32, align 4
  %23 = alloca i16, align 2
  %24 = alloca %struct.otl_GsubSingleEntry, 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) #4
  %25 = load ptr, ptr getelementptr inbounds (%struct.__caryll_vectorinterface_subtable_gsub_single, ptr @iSubtable_gsub_single, i32 0, i32 6), align 8, !tbaa !13
  %26 = call ptr (...) %25()
  store ptr %26, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store ptr null, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  store ptr null, ptr %14, align 8, !tbaa !5
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = load i32, ptr %9, align 4, !tbaa !9
  %29 = add i32 %28, 6
  %30 = icmp ult i32 %27, %29
  br i1 %30, label %31, label %32

31:                                               ; preds = %5
  br label %202

32:                                               ; preds = %5
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = load i32, ptr %9, align 4, !tbaa !9
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds i8, ptr %33, i64 %35
  %37 = call zeroext i16 @read_16u(ptr noundef %36)
  store i16 %37, ptr %15, align 2, !tbaa !11
  %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 %53, label %59

53:                                               ; preds = %32
  %54 = load ptr, ptr %13, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.otl_Coverage, ptr %54, i32 0, i32 0
  %56 = load i16, ptr %55, align 8, !tbaa !17
  %57 = zext i16 %56 to i32
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %60

59:                                               ; preds = %53, %32
  br label %202

60:                                               ; preds = %53
  %61 = load i16, ptr %15, align 2, !tbaa !11
  %62 = zext i16 %61 to i32
  %63 = icmp eq i32 %62, 1
  br i1 %63, label %64, label %124

64:                                               ; preds = %60
  %65 = call ptr @__caryll_allocate_clean(i64 noundef 16, i64 noundef 36)
  store ptr %65, ptr %14, align 8, !tbaa !5
  %66 = load ptr, ptr %13, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.otl_Coverage, ptr %66, i32 0, i32 0
  %68 = load i16, ptr %67, align 8, !tbaa !17
  %69 = load ptr, ptr %14, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.otl_Coverage, ptr %69, i32 0, i32 0
  store i16 %68, ptr %70, align 8, !tbaa !17
  %71 = load ptr, ptr %14, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.otl_Coverage, ptr %71, i32 0, i32 0
  %73 = load i16, ptr %72, align 8, !tbaa !17
  %74 = zext i16 %73 to i64
  %75 = mul i64 16, %74
  %76 = call ptr @__caryll_allocate_clean(i64 noundef %75, i64 noundef 38)
  %77 = load ptr, ptr %14, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.otl_Coverage, ptr %77, i32 0, i32 2
  store ptr %76, ptr %78, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 2, ptr %16) #4
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = load i32, ptr %9, align 4, !tbaa !9
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds i8, ptr %79, i64 %81
  %83 = getelementptr inbounds i8, ptr %82, i64 4
  %84 = call zeroext i16 @read_16u(ptr noundef %83)
  store i16 %84, ptr %16, align 2, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 2, ptr %17) #4
  store i16 0, ptr %17, align 2, !tbaa !11
  br label %85

85:                                               ; preds = %120, %64
  %86 = load i16, ptr %17, align 2, !tbaa !11
  %87 = zext i16 %86 to i32
  %88 = load ptr, ptr %13, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.otl_Coverage, ptr %88, i32 0, i32 0
  %90 = load i16, ptr %89, align 8, !tbaa !17
  %91 = zext i16 %90 to i32
  %92 = icmp slt i32 %87, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 2, ptr %17) #4
  br label %123

94:                                               ; preds = %85
  %95 = load ptr, ptr %14, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.otl_Coverage, ptr %95, i32 0, i32 2
  %97 = load ptr, ptr %96, align 8, !tbaa !19
  %98 = load i16, ptr %17, align 2, !tbaa !11
  %99 = zext i16 %98 to i64
  %100 = getelementptr inbounds %struct.otfcc_Handle, ptr %97, i64 %99
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #4
  %101 = load ptr, ptr getelementptr inbounds (%struct.otfcc_HandlePackage, ptr @otfcc_iHandle, i32 0, i32 8), align 8, !tbaa !20
  %102 = load ptr, ptr %13, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.otl_Coverage, ptr %102, i32 0, i32 2
  %104 = load ptr, ptr %103, align 8, !tbaa !19
  %105 = load i16, ptr %17, align 2, !tbaa !11
  %106 = zext i16 %105 to i64
  %107 = getelementptr inbounds %struct.otfcc_Handle, ptr %104, i64 %106
  %108 = getelementptr inbounds %struct.otfcc_Handle, ptr %107, i32 0, i32 1
  %109 = load i16, ptr %108, align 4, !tbaa !22
  %110 = zext i16 %109 to i32
  %111 = load i16, ptr %16, align 2, !tbaa !11
  %112 = zext i16 %111 to i32
  %113 = add nsw i32 %110, %112
  %114 = trunc i32 %113 to i16
  %115 = call { i64, ptr } %101(i16 noundef zeroext %114)
  %116 = getelementptr inbounds { i64, ptr }, ptr %18, i32 0, i32 0
  %117 = extractvalue { i64, ptr } %115, 0
  store i64 %117, ptr %116, align 8
  %118 = getelementptr inbounds { i64, ptr }, ptr %18, i32 0, i32 1
  %119 = extractvalue { i64, ptr } %115, 1
  store ptr %119, ptr %118, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %100, ptr align 8 %18, i64 16, i1 false), !tbaa.struct !24
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #4
  br label %120

120:                                              ; preds = %94
  %121 = load i16, ptr %17, align 2, !tbaa !11
  %122 = add i16 %121, 1
  store i16 %122, ptr %17, align 2, !tbaa !11
  br label %85, !llvm.loop !25

123:                                              ; preds = %93
  call void @llvm.lifetime.end.p0(i64 2, ptr %16) #4
  br label %201

124:                                              ; preds = %60
  call void @llvm.lifetime.start.p0(i64 2, ptr %19) #4
  %125 = load ptr, ptr %7, align 8, !tbaa !5
  %126 = load i32, ptr %9, align 4, !tbaa !9
  %127 = zext i32 %126 to i64
  %128 = getelementptr inbounds i8, ptr %125, i64 %127
  %129 = getelementptr inbounds i8, ptr %128, i64 4
  %130 = call zeroext i16 @read_16u(ptr noundef %129)
  store i16 %130, ptr %19, align 2, !tbaa !11
  %131 = load i32, ptr %8, align 4, !tbaa !9
  %132 = load i32, ptr %9, align 4, !tbaa !9
  %133 = add i32 %132, 6
  %134 = load i16, ptr %19, align 2, !tbaa !11
  %135 = zext i16 %134 to i32
  %136 = mul nsw i32 %135, 2
  %137 = add i32 %133, %136
  %138 = icmp ult i32 %131, %137
  br i1 %138, label %147, label %139

139:                                              ; preds = %124
  %140 = load i16, ptr %19, align 2, !tbaa !11
  %141 = zext i16 %140 to i32
  %142 = load ptr, ptr %13, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.otl_Coverage, ptr %142, i32 0, i32 0
  %144 = load i16, ptr %143, align 8, !tbaa !17
  %145 = zext i16 %144 to i32
  %146 = icmp ne i32 %141, %145
  br i1 %146, label %147, label %148

147:                                              ; preds = %139, %124
  store i32 2, ptr %22, align 4
  br label %198

148:                                              ; preds = %139
  %149 = call ptr @__caryll_allocate_clean(i64 noundef 16, i64 noundef 48)
  store ptr %149, ptr %14, align 8, !tbaa !5
  %150 = load i16, ptr %19, align 2, !tbaa !11
  %151 = load ptr, ptr %14, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.otl_Coverage, ptr %151, i32 0, i32 0
  store i16 %150, ptr %152, align 8, !tbaa !17
  %153 = load ptr, ptr %14, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.otl_Coverage, ptr %153, i32 0, i32 0
  %155 = load i16, ptr %154, align 8, !tbaa !17
  %156 = zext i16 %155 to i64
  %157 = mul i64 16, %156
  %158 = call ptr @__caryll_allocate_clean(i64 noundef %157, i64 noundef 50)
  %159 = load ptr, ptr %14, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.otl_Coverage, ptr %159, i32 0, i32 2
  store ptr %158, ptr %160, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 2, ptr %20) #4
  store i16 0, ptr %20, align 2, !tbaa !11
  br label %161

161:                                              ; preds = %194, %148
  %162 = load i16, ptr %20, align 2, !tbaa !11
  %163 = zext i16 %162 to i32
  %164 = load ptr, ptr %14, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.otl_Coverage, ptr %164, i32 0, i32 0
  %166 = load i16, ptr %165, align 8, !tbaa !17
  %167 = zext i16 %166 to i32
  %168 = icmp slt i32 %163, %167
  br i1 %168, label %170, label %169

169:                                              ; preds = %161
  call void @llvm.lifetime.end.p0(i64 2, ptr %20) #4
  br label %197

170:                                              ; preds = %161
  %171 = load ptr, ptr %14, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.otl_Coverage, ptr %171, i32 0, i32 2
  %173 = load ptr, ptr %172, align 8, !tbaa !19
  %174 = load i16, ptr %20, align 2, !tbaa !11
  %175 = zext i16 %174 to i64
  %176 = getelementptr inbounds %struct.otfcc_Handle, ptr %173, i64 %175
  call void @llvm.lifetime.start.p0(i64 16, ptr %21) #4
  %177 = load ptr, ptr getelementptr inbounds (%struct.otfcc_HandlePackage, ptr @otfcc_iHandle, i32 0, i32 8), align 8, !tbaa !20
  %178 = load ptr, ptr %7, align 8, !tbaa !5
  %179 = load i32, ptr %9, align 4, !tbaa !9
  %180 = zext i32 %179 to i64
  %181 = getelementptr inbounds i8, ptr %178, i64 %180
  %182 = getelementptr inbounds i8, ptr %181, i64 6
  %183 = load i16, ptr %20, align 2, !tbaa !11
  %184 = zext i16 %183 to i32
  %185 = mul nsw i32 %184, 2
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds i8, ptr %182, i64 %186
  %188 = call zeroext i16 @read_16u(ptr noundef %187)
  %189 = call { i64, ptr } %177(i16 noundef zeroext %188)
  %190 = getelementptr inbounds { i64, ptr }, ptr %21, i32 0, i32 0
  %191 = extractvalue { i64, ptr } %189, 0
  store i64 %191, ptr %190, align 8
  %192 = getelementptr inbounds { i64, ptr }, ptr %21, i32 0, i32 1
  %193 = extractvalue { i64, ptr } %189, 1
  store ptr %193, ptr %192, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %176, ptr align 8 %21, i64 16, i1 false), !tbaa.struct !24
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #4
  br label %194

194:                                              ; preds = %170
  %195 = load i16, ptr %20, align 2, !tbaa !11
  %196 = add i16 %195, 1
  store i16 %196, ptr %20, align 2, !tbaa !11
  br label %161, !llvm.loop !27

197:                                              ; preds = %169
  store i32 0, ptr %22, align 4
  br label %198

198:                                              ; preds = %197, %147
  call void @llvm.lifetime.end.p0(i64 2, ptr %19) #4
  %199 = load i32, ptr %22, align 4
  switch i32 %199, label %281 [
    i32 0, label %200
    i32 2, label %202
  ]

200:                                              ; preds = %198
  br label %201

201:                                              ; preds = %200, %123
  br label %217

202:                                              ; preds = %198, %59, %31
  %203 = load ptr, ptr getelementptr inbounds (%struct.__caryll_vectorinterface_subtable_gsub_single, ptr @iSubtable_gsub_single, i32 0, i32 7), align 8, !tbaa !28
  %204 = load ptr, ptr %12, align 8, !tbaa !5
  call void %203(ptr noundef %204)
  %205 = load ptr, ptr %13, align 8, !tbaa !5
  %206 = icmp ne ptr %205, null
  br i1 %206, label %207, label %210

207:                                              ; preds = %202
  %208 = load ptr, ptr getelementptr inbounds (%struct.__otfcc_ICoverage, ptr @otl_iCoverage, i32 0, i32 7), align 8, !tbaa !29
  %209 = load ptr, ptr %13, align 8, !tbaa !5
  call void %208(ptr noundef %209)
  br label %210

210:                                              ; preds = %207, %202
  %211 = load ptr, ptr %14, align 8, !tbaa !5
  %212 = icmp ne ptr %211, null
  br i1 %212, label %213, label %216

213:                                              ; preds = %210
  %214 = load ptr, ptr getelementptr inbounds (%struct.__otfcc_ICoverage, ptr @otl_iCoverage, i32 0, i32 7), align 8, !tbaa !29
  %215 = load ptr, ptr %14, align 8, !tbaa !5
  call void %214(ptr noundef %215)
  br label %216

216:                                              ; preds = %213, %210
  store ptr null, ptr %6, align 8
  store i32 1, ptr %22, align 4
  br label %281

217:                                              ; preds = %201
  call void @llvm.lifetime.start.p0(i64 2, ptr %23) #4
  store i16 0, ptr %23, align 2, !tbaa !11
  br label %218

218:                                              ; preds = %264, %217
  %219 = load i16, ptr %23, align 2, !tbaa !11
  %220 = zext i16 %219 to i32
  %221 = load ptr, ptr %13, align 8, !tbaa !5
  %222 = getelementptr inbounds %struct.otl_Coverage, ptr %221, i32 0, i32 0
  %223 = load i16, ptr %222, align 8, !tbaa !17
  %224 = zext i16 %223 to i32
  %225 = icmp slt i32 %220, %224
  br i1 %225, label %227, label %226

226:                                              ; preds = %218
  store i32 10, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 2, ptr %23) #4
  br label %267

227:                                              ; preds = %218
  %228 = load ptr, ptr getelementptr inbounds (%struct.__caryll_vectorinterface_subtable_gsub_single, ptr @iSubtable_gsub_single, i32 0, i32 13), align 8, !tbaa !30
  %229 = load ptr, ptr %12, align 8, !tbaa !5
  %230 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %24, i32 0, i32 0
  %231 = load ptr, ptr getelementptr inbounds (%struct.otfcc_HandlePackage, ptr @otfcc_iHandle, i32 0, i32 7), align 8, !tbaa !31
  %232 = load ptr, ptr %13, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.otl_Coverage, ptr %232, i32 0, i32 2
  %234 = load ptr, ptr %233, align 8, !tbaa !19
  %235 = load i16, ptr %23, align 2, !tbaa !11
  %236 = zext i16 %235 to i64
  %237 = getelementptr inbounds %struct.otfcc_Handle, ptr %234, i64 %236
  %238 = getelementptr inbounds { i64, ptr }, ptr %237, i32 0, i32 0
  %239 = load i64, ptr %238, align 8
  %240 = getelementptr inbounds { i64, ptr }, ptr %237, i32 0, i32 1
  %241 = load ptr, ptr %240, align 8
  %242 = call { i64, ptr } %231(i64 %239, ptr %241)
  %243 = getelementptr inbounds { i64, ptr }, ptr %230, i32 0, i32 0
  %244 = extractvalue { i64, ptr } %242, 0
  store i64 %244, ptr %243, align 8
  %245 = getelementptr inbounds { i64, ptr }, ptr %230, i32 0, i32 1
  %246 = extractvalue { i64, ptr } %242, 1
  store ptr %246, ptr %245, align 8
  %247 = getelementptr inbounds %struct.otl_GsubSingleEntry, ptr %24, i32 0, i32 1
  %248 = load ptr, ptr getelementptr inbounds (%struct.otfcc_HandlePackage, ptr @otfcc_iHandle, i32 0, i32 7), align 8, !tbaa !31
  %249 = load ptr, ptr %14, align 8, !tbaa !5
  %250 = getelementptr inbounds %struct.otl_Coverage, ptr %249, i32 0, i32 2
  %251 = load ptr, ptr %250, align 8, !tbaa !19
  %252 = load i16, ptr %23, align 2, !tbaa !11
  %253 = zext i16 %252 to i64
  %254 = getelementptr inbounds %struct.otfcc_Handle, ptr %251, i64 %253
  %255 = getelementptr inbounds { i64, ptr }, ptr %254, i32 0, i32 0
  %256 = load i64, ptr %255, align 8
  %257 = getelementptr inbounds { i64, ptr }, ptr %254, i32 0, i32 1
  %258 = load ptr, ptr %257, align 8
  %259 = call { i64, ptr } %248(i64 %256, ptr %258)
  %260 = getelementptr inbounds { i64, ptr }, ptr %247, i32 0, i32 0
  %261 = extractvalue { i64, ptr } %259, 0
  store i64 %261, ptr %260, align 8
  %262 = getelementptr inbounds { i64, ptr }, ptr %247, i32 0, i32 1
  %263 = extractvalue { i64, ptr } %259, 1
  store ptr %263, ptr %262, align 8
  call void %228(ptr noundef %229, ptr noundef byval(%struct.otl_GsubSingleEntry) align 8 %24)
  br label %264

264:                                              ; preds = %227
  %265 = load i16, ptr %23, align 2, !tbaa !11
  %266 = add i16 %265, 1
  store i16 %266, ptr %23, align 2, !tbaa !11
  br label %218, !llvm.loop !32

267:                                              ; preds = %226
  %268 = load ptr, ptr %13, align 8, !tbaa !5
  %269 = icmp ne ptr %268, null
  br i1 %269, label %270, label %273

270:                                              ; preds = %267
  %271 = load ptr, ptr getelementptr inbounds (%struct.__otfcc_ICoverage, ptr @otl_iCoverage, i32 0, i32 7), align 8, !tbaa !29
  %272 = load ptr, ptr %13, align 8, !tbaa !5
  call void %271(ptr noundef %272)
  br label %273

273:                                              ; preds = %270, %267
  %274 = load ptr, ptr %14, align 8, !tbaa !5
  %275 = icmp ne ptr %274, null
  br i1 %275, label %276, label %279

276:                                              ; preds = %273
  %277 = load ptr, ptr getelementptr inbounds (%struct.__otfcc_ICoverage, ptr @otl_iCoverage, i32 0, i32 7), align 8, !tbaa !29
  %278 = load ptr, ptr %14, align 8, !tbaa !5
  call void %277(ptr noundef %278)
  br label %279

279:                                              ; preds = %276, %273
  %280 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %280, ptr %6, align 8
  store i32 1, ptr %22, align 4
  br label %281

281:                                              ; preds = %279, %216, %198
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %282 = load ptr, ptr %6, align 8
  ret ptr %282
}

; 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: inlinehint nounwind uwtable
declare hidden ptr @__caryll_allocate_clean(i64 noundef, i64 noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!14, !6, i64 48}
!14 = !{!"__caryll_vectorinterface_subtable_gsub_single", !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 = !{!18, !6, i64 8}
!20 = !{!21, !6, i64 64}
!21 = !{!"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}
!22 = !{!23, !12, i64 4}
!23 = !{!"otfcc_Handle", !10, i64 0, !12, i64 4, !6, i64 8}
!24 = !{i64 0, i64 4, !9, i64 4, i64 2, !11, i64 8, i64 8, !5}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = distinct !{!27, !26}
!28 = !{!14, !6, i64 56}
!29 = !{!16, !6, i64 56}
!30 = !{!14, !6, i64 104}
!31 = !{!21, !6, i64 56}
!32 = distinct !{!32, !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.__caryll_vectorinterface_subtable_gsub_single = 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_GsubSingleEntry = type { %struct.otfcc_Handle, %struct.otfcc_Handle }
%struct.otfcc_Handle = type { i32, i16, ptr }

@iSubtable_gsub_single = external dso_local local_unnamed_addr constant %struct.__caryll_vectorinterface_subtable_gsub_single, 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_single(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_GsubSingleEntry, align 8
  %7 = load ptr, ptr getelementptr inbounds (i8, ptr @iSubtable_gsub_single, 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 %.thread86, label %11

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

21:                                               ; preds = %11
  %22 = load i16, ptr %20, align 8, !tbaa !12
  %23 = icmp eq i16 %22, 0
  br i1 %23, label %.thread, label %24

24:                                               ; preds = %21
  %25 = icmp eq i16 %14, 1
  br i1 %25, label %26, label %51

26:                                               ; preds = %24
  %27 = tail call ptr @__caryll_allocate_clean(i64 noundef 16, i64 noundef 36)
  %28 = load i16, ptr %20, align 8, !tbaa !12
  store i16 %28, ptr %27, align 8, !tbaa !12
  %29 = zext i16 %28 to i64
  %30 = shl nuw nsw i64 %29, 4
  %31 = tail call ptr @__caryll_allocate_clean(i64 noundef %30, i64 noundef 38)
  %32 = getelementptr inbounds i8, ptr %27, i64 8
  store ptr %31, ptr %32, align 8, !tbaa !16
  %33 = getelementptr inbounds i8, ptr %13, i64 4
  %34 = tail call zeroext i16 @read_16u(ptr noundef nonnull %33)
  %35 = load i16, ptr %20, align 8, !tbaa !12
  %.not96 = icmp eq i16 %35, 0
  br i1 %.not96, label %._crit_edge, label %.lr.ph92

.lr.ph92:                                         ; preds = %26
  %36 = load ptr, ptr getelementptr inbounds (i8, ptr @otfcc_iHandle, i64 64), align 8, !tbaa !17
  %37 = getelementptr inbounds i8, ptr %20, i64 8
  br label %38

38:                                               ; preds = %.lr.ph92, %38
  %indvars.iv100 = phi i64 [ 0, %.lr.ph92 ], [ %indvars.iv.next101, %38 ]
  %39 = load ptr, ptr %32, align 8, !tbaa !16
  %40 = getelementptr inbounds %struct.otfcc_Handle, ptr %39, i64 %indvars.iv100
  %41 = load ptr, ptr %37, align 8, !tbaa !16
  %42 = getelementptr inbounds %struct.otfcc_Handle, ptr %41, i64 %indvars.iv100, i32 1
  %43 = load i16, ptr %42, align 4, !tbaa !19
  %44 = add i16 %43, %34
  %45 = tail call { i64, ptr } %36(i16 noundef zeroext %44) #2
  %46 = extractvalue { i64, ptr } %45, 0
  %47 = extractvalue { i64, ptr } %45, 1
  store i64 %46, ptr %40, align 8
  %.sroa.413.0..sroa_idx = getelementptr inbounds i8, ptr %40, i64 8
  store ptr %47, ptr %.sroa.413.0..sroa_idx, align 8, !tbaa !21
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %48 = load i16, ptr %20, align 8, !tbaa !12
  %49 = zext i16 %48 to i64
  %50 = icmp ult i64 %indvars.iv.next101, %49
  br i1 %50, label %38, label %.loopexit, !llvm.loop !22

51:                                               ; preds = %24
  %52 = getelementptr inbounds i8, ptr %13, i64 4
  %53 = tail call zeroext i16 @read_16u(ptr noundef nonnull %52)
  %54 = zext i16 %53 to i32
  %55 = shl nuw nsw i32 %54, 1
  %56 = add i32 %55, %9
  %57 = icmp ugt i32 %56, %1
  br i1 %57, label %.thread, label %58

58:                                               ; preds = %51
  %59 = load i16, ptr %20, align 8, !tbaa !12
  %.not77 = icmp eq i16 %53, %59
  br i1 %.not77, label %60, label %.thread

60:                                               ; preds = %58
  %61 = tail call ptr @__caryll_allocate_clean(i64 noundef 16, i64 noundef 48)
  store i16 %53, ptr %61, align 8, !tbaa !12
  %62 = zext i16 %53 to i64
  %63 = shl nuw nsw i64 %62, 4
  %64 = tail call ptr @__caryll_allocate_clean(i64 noundef %63, i64 noundef 50)
  %65 = getelementptr inbounds i8, ptr %61, i64 8
  store ptr %64, ptr %65, align 8, !tbaa !16
  %66 = load i16, ptr %61, align 8, !tbaa !12
  %.not95 = icmp eq i16 %66, 0
  br i1 %.not95, label %.loopexitthread-pre-split, label %.lr.ph

.lr.ph:                                           ; preds = %60
  %67 = load ptr, ptr getelementptr inbounds (i8, ptr @otfcc_iHandle, i64 64), align 8, !tbaa !17
  %68 = getelementptr inbounds i8, ptr %13, i64 6
  br label %69

69:                                               ; preds = %.lr.ph, %69
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %69 ]
  %70 = load ptr, ptr %65, align 8, !tbaa !16
  %71 = getelementptr inbounds %struct.otfcc_Handle, ptr %70, i64 %indvars.iv
  %72 = shl nuw nsw i64 %indvars.iv, 1
  %73 = getelementptr inbounds i8, ptr %68, i64 %72
  %74 = tail call zeroext i16 @read_16u(ptr noundef nonnull %73)
  %75 = tail call { i64, ptr } %67(i16 noundef zeroext %74) #2
  %76 = extractvalue { i64, ptr } %75, 0
  %77 = extractvalue { i64, ptr } %75, 1
  store i64 %76, ptr %71, align 8
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %71, i64 8
  store ptr %77, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !21
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %78 = load i16, ptr %61, align 8, !tbaa !12
  %79 = zext i16 %78 to i64
  %80 = icmp ult i64 %indvars.iv.next, %79
  br i1 %80, label %69, label %.loopexitthread-pre-split, !llvm.loop !24

.thread86:                                        ; preds = %5, %11
  %81 = load ptr, ptr getelementptr inbounds (i8, ptr @iSubtable_gsub_single, i64 56), align 8, !tbaa !25
  tail call void %81(ptr noundef %8) #2
  br label %113

.thread:                                          ; preds = %51, %58, %21
  %82 = load ptr, ptr getelementptr inbounds (i8, ptr @iSubtable_gsub_single, i64 56), align 8, !tbaa !25
  tail call void %82(ptr noundef %8) #2
  %83 = load ptr, ptr getelementptr inbounds (i8, ptr @otl_iCoverage, i64 56), align 8, !tbaa !26
  tail call void %83(ptr noundef nonnull %20) #2
  br label %113

.loopexitthread-pre-split:                        ; preds = %69, %60
  %.pr = load i16, ptr %20, align 8, !tbaa !12
  br label %.loopexit

.loopexit:                                        ; preds = %38, %.loopexitthread-pre-split
  %84 = phi i16 [ %.pr, %.loopexitthread-pre-split ], [ %48, %38 ]
  %.2 = phi ptr [ %61, %.loopexitthread-pre-split ], [ %27, %38 ]
  %.not97 = icmp eq i16 %84, 0
  br i1 %.not97, label %._crit_edge, label %.lr.ph94

.lr.ph94:                                         ; preds = %.loopexit
  %85 = load ptr, ptr getelementptr inbounds (i8, ptr @iSubtable_gsub_single, i64 104), align 8, !tbaa !27
  %86 = load ptr, ptr getelementptr inbounds (i8, ptr @otfcc_iHandle, i64 56), align 8, !tbaa !28
  %87 = getelementptr inbounds i8, ptr %20, i64 8
  %88 = getelementptr inbounds i8, ptr %6, i64 8
  %89 = getelementptr inbounds i8, ptr %6, i64 16
  %90 = getelementptr inbounds i8, ptr %.2, i64 8
  %91 = getelementptr inbounds i8, ptr %6, i64 24
  br label %92

92:                                               ; preds = %.lr.ph94, %92
  %indvars.iv103 = phi i64 [ 0, %.lr.ph94 ], [ %indvars.iv.next104, %92 ]
  %93 = load ptr, ptr %87, align 8, !tbaa !16
  %94 = getelementptr inbounds %struct.otfcc_Handle, ptr %93, i64 %indvars.iv103
  %95 = load i64, ptr %94, align 8
  %96 = getelementptr inbounds i8, ptr %94, i64 8
  %97 = load ptr, ptr %96, align 8
  %98 = tail call { i64, ptr } %86(i64 %95, ptr %97) #2
  %99 = extractvalue { i64, ptr } %98, 0
  store i64 %99, ptr %6, align 8
  %100 = extractvalue { i64, ptr } %98, 1
  store ptr %100, ptr %88, align 8
  %101 = load ptr, ptr %90, align 8, !tbaa !16
  %102 = getelementptr inbounds %struct.otfcc_Handle, ptr %101, i64 %indvars.iv103
  %103 = load i64, ptr %102, align 8
  %104 = getelementptr inbounds i8, ptr %102, i64 8
  %105 = load ptr, ptr %104, align 8
  %106 = tail call { i64, ptr } %86(i64 %103, ptr %105) #2
  %107 = extractvalue { i64, ptr } %106, 0
  store i64 %107, ptr %89, align 8
  %108 = extractvalue { i64, ptr } %106, 1
  store ptr %108, ptr %91, align 8
  tail call void %85(ptr noundef %8, ptr noundef nonnull byval(%struct.otl_GsubSingleEntry) align 8 %6) #2
  %indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
  %109 = load i16, ptr %20, align 8, !tbaa !12
  %110 = zext i16 %109 to i64
  %111 = icmp ult i64 %indvars.iv.next104, %110
  br i1 %111, label %92, label %._crit_edge, !llvm.loop !29

._crit_edge:                                      ; preds = %92, %26, %.loopexit
  %.2108 = phi ptr [ %.2, %.loopexit ], [ %27, %26 ], [ %.2, %92 ]
  %112 = load ptr, ptr getelementptr inbounds (i8, ptr @otl_iCoverage, i64 56), align 8, !tbaa !26
  tail call void %112(ptr noundef nonnull %20) #2
  tail call void %112(ptr noundef nonnull %.2108) #2
  br label %113

113:                                              ; preds = %.thread, %.thread86, %._crit_edge
  %.067 = phi ptr [ %8, %._crit_edge ], [ null, %.thread86 ], [ null, %.thread ]
  ret ptr %.067
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @__caryll_allocate_clean(i64 noundef, i64 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_single", !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 = !{!13, !7, i64 8}
!17 = !{!18, !7, i64 64}
!18 = !{!"otfcc_HandlePackage", !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}
!19 = !{!20, !14, i64 4}
!20 = !{!"otfcc_Handle", !15, i64 0, !14, i64 4, !7, i64 8}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}
!25 = !{!6, !7, i64 56}
!26 = !{!11, !7, i64 56}
!27 = !{!6, !7, i64 104}
!28 = !{!18, !7, i64 56}
!29 = distinct !{!29, !23}


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