; LLVM IR from caryll/otfcc :: lib/table/otl/subtables/chaining (parse)

; 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_elementinterface_subtable_chaining = type { 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.subtable_chaining = type { i32, %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { i16, ptr, ptr, ptr, ptr }
%struct._json_value = type { ptr, i32, %union.anon.0, %union.anon.4 }
%union.anon.0 = type { %struct.anon.1 }
%struct.anon.1 = type { i32, ptr }
%union.anon.4 = type { ptr }
%struct.anon.3 = type { i32, ptr }
%struct.otl_ChainingRule = type { i16, i16, i16, ptr, i16, ptr }
%struct.otl_ChainLookupApplication = type { i16, %struct.otfcc_Handle }

@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@iSubtable_chaining = external constant %struct.__caryll_elementinterface_subtable_chaining, align 8
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1
@otl_iCoverage = external constant %struct.__otfcc_ICoverage, align 8
@otfcc_iHandle = external constant %struct.otfcc_HandlePackage, align 8
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @otl_parse_chaining(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i16, align 2
  %12 = alloca i16, align 2
  %13 = alloca %struct.otfcc_Handle, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca %struct.otfcc_Handle, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = call ptr @json_obj_get_type(ptr noundef %17, ptr noundef @.str, i32 noundef 2)
  store ptr %18, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = call ptr @json_obj_get_type(ptr noundef %19, ptr noundef @.str.1, i32 noundef 2)
  store ptr %20, ptr %7, align 8, !tbaa !5
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %26

23:                                               ; preds = %2
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %27, label %26

26:                                               ; preds = %23, %2
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %196

27:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %28 = load ptr, ptr getelementptr inbounds (%struct.__caryll_elementinterface_subtable_chaining, ptr @iSubtable_chaining, i32 0, i32 6), align 8, !tbaa !9
  %29 = call ptr (...) %28()
  store ptr %29, ptr %9, align 8, !tbaa !5
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.subtable_chaining, ptr %30, i32 0, i32 0
  store i32 0, ptr %31, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.subtable_chaining, ptr %32, i32 0, i32 1
  store ptr %33, ptr %10, align 8, !tbaa !5
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct._json_value, ptr %34, i32 0, i32 2
  %36 = getelementptr inbounds %struct.anon.3, ptr %35, i32 0, i32 0
  %37 = load i32, ptr %36, align 8, !tbaa !14
  %38 = trunc i32 %37 to i16
  %39 = load ptr, ptr %10, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.otl_ChainingRule, ptr %39, i32 0, i32 0
  store i16 %38, ptr %40, align 8, !tbaa !15
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.otl_ChainingRule, ptr %41, i32 0, i32 0
  %43 = load i16, ptr %42, align 8, !tbaa !15
  %44 = zext i16 %43 to i64
  %45 = mul i64 8, %44
  %46 = call ptr @__caryll_allocate_clean(i64 noundef %45, i64 noundef 14)
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.otl_ChainingRule, ptr %47, i32 0, i32 3
  store ptr %46, ptr %48, align 8, !tbaa !18
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct._json_value, ptr %49, i32 0, i32 2
  %51 = getelementptr inbounds %struct.anon.3, ptr %50, i32 0, i32 0
  %52 = load i32, ptr %51, align 8, !tbaa !14
  %53 = trunc i32 %52 to i16
  %54 = load ptr, ptr %10, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.otl_ChainingRule, ptr %54, i32 0, i32 4
  store i16 %53, ptr %55, align 8, !tbaa !19
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.otl_ChainingRule, ptr %56, i32 0, i32 4
  %58 = load i16, ptr %57, align 8, !tbaa !19
  %59 = zext i16 %58 to i64
  %60 = mul i64 24, %59
  %61 = call ptr @__caryll_allocate_clean(i64 noundef %60, i64 noundef 16)
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.otl_ChainingRule, ptr %62, i32 0, i32 5
  store ptr %61, ptr %63, align 8, !tbaa !20
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = call double @json_obj_getnum_fallback(ptr noundef %64, ptr noundef @.str.2, double noundef 0.000000e+00)
  %66 = fptoui double %65 to i16
  %67 = load ptr, ptr %10, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.otl_ChainingRule, ptr %67, i32 0, i32 1
  store i16 %66, ptr %68, align 2, !tbaa !21
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = load ptr, ptr %10, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.otl_ChainingRule, ptr %70, i32 0, i32 0
  %72 = load i16, ptr %71, align 8, !tbaa !15
  %73 = uitofp i16 %72 to double
  %74 = call double @json_obj_getnum_fallback(ptr noundef %69, ptr noundef @.str.3, double noundef %73)
  %75 = fptoui double %74 to i16
  %76 = load ptr, ptr %10, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.otl_ChainingRule, ptr %76, i32 0, i32 2
  store i16 %75, ptr %77, align 4, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 2, ptr %11) #5
  store i16 0, ptr %11, align 2, !tbaa !23
  br label %78

78:                                               ; preds = %104, %27
  %79 = load i16, ptr %11, align 2, !tbaa !23
  %80 = zext i16 %79 to i32
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.otl_ChainingRule, ptr %81, i32 0, i32 0
  %83 = load i16, ptr %82, align 8, !tbaa !15
  %84 = zext i16 %83 to i32
  %85 = icmp slt i32 %80, %84
  br i1 %85, label %87, label %86

86:                                               ; preds = %78
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 2, ptr %11) #5
  br label %107

87:                                               ; preds = %78
  %88 = load ptr, ptr getelementptr inbounds (%struct.__otfcc_ICoverage, ptr @otl_iCoverage, i32 0, i32 11), align 8, !tbaa !24
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct._json_value, ptr %89, i32 0, i32 2
  %91 = getelementptr inbounds %struct.anon.3, ptr %90, i32 0, i32 1
  %92 = load ptr, ptr %91, align 8, !tbaa !14
  %93 = load i16, ptr %11, align 2, !tbaa !23
  %94 = zext i16 %93 to i64
  %95 = getelementptr inbounds ptr, ptr %92, i64 %94
  %96 = load ptr, ptr %95, align 8, !tbaa !5
  %97 = call ptr %88(ptr noundef %96)
  %98 = load ptr, ptr %10, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.otl_ChainingRule, ptr %98, i32 0, i32 3
  %100 = load ptr, ptr %99, align 8, !tbaa !18
  %101 = load i16, ptr %11, align 2, !tbaa !23
  %102 = zext i16 %101 to i64
  %103 = getelementptr inbounds ptr, ptr %100, i64 %102
  store ptr %97, ptr %103, align 8, !tbaa !5
  br label %104

104:                                              ; preds = %87
  %105 = load i16, ptr %11, align 2, !tbaa !23
  %106 = add i16 %105, 1
  store i16 %106, ptr %11, align 2, !tbaa !23
  br label %78, !llvm.loop !26

107:                                              ; preds = %86
  call void @llvm.lifetime.start.p0(i64 2, ptr %12) #5
  store i16 0, ptr %12, align 2, !tbaa !23
  br label %108

108:                                              ; preds = %191, %107
  %109 = load i16, ptr %12, align 2, !tbaa !23
  %110 = zext i16 %109 to i32
  %111 = load ptr, ptr %10, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.otl_ChainingRule, ptr %111, i32 0, i32 4
  %113 = load i16, ptr %112, align 8, !tbaa !19
  %114 = zext i16 %113 to i32
  %115 = icmp slt i32 %110, %114
  br i1 %115, label %117, label %116

116:                                              ; preds = %108
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 2, ptr %12) #5
  br label %194

117:                                              ; preds = %108
  %118 = load ptr, ptr %10, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.otl_ChainingRule, ptr %118, i32 0, i32 5
  %120 = load ptr, ptr %119, align 8, !tbaa !20
  %121 = load i16, ptr %12, align 2, !tbaa !23
  %122 = zext i16 %121 to i64
  %123 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %120, i64 %122
  %124 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %123, i32 0, i32 0
  store i16 0, ptr %124, align 8, !tbaa !28
  %125 = load ptr, ptr %10, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.otl_ChainingRule, ptr %125, i32 0, i32 5
  %127 = load ptr, ptr %126, align 8, !tbaa !20
  %128 = load i16, ptr %12, align 2, !tbaa !23
  %129 = zext i16 %128 to i64
  %130 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %127, i64 %129
  %131 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %130, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #5
  %132 = load ptr, ptr getelementptr inbounds (%struct.otfcc_HandlePackage, ptr @otfcc_iHandle, i32 0, i32 6), align 8, !tbaa !31
  %133 = call { i64, ptr } (...) %132()
  %134 = getelementptr inbounds { i64, ptr }, ptr %13, i32 0, i32 0
  %135 = extractvalue { i64, ptr } %133, 0
  store i64 %135, ptr %134, align 8
  %136 = getelementptr inbounds { i64, ptr }, ptr %13, i32 0, i32 1
  %137 = extractvalue { i64, ptr } %133, 1
  store ptr %137, ptr %136, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %131, ptr align 8 %13, i64 16, i1 false), !tbaa.struct !33
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %138 = load ptr, ptr %7, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct._json_value, ptr %138, i32 0, i32 2
  %140 = getelementptr inbounds %struct.anon.3, ptr %139, i32 0, i32 1
  %141 = load ptr, ptr %140, align 8, !tbaa !14
  %142 = load i16, ptr %12, align 2, !tbaa !23
  %143 = zext i16 %142 to i64
  %144 = getelementptr inbounds ptr, ptr %141, i64 %143
  %145 = load ptr, ptr %144, align 8, !tbaa !5
  store ptr %145, ptr %14, align 8, !tbaa !5
  %146 = load ptr, ptr %14, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct._json_value, ptr %146, i32 0, i32 1
  %148 = load i32, ptr %147, align 8, !tbaa !35
  %149 = icmp eq i32 %148, 1
  br i1 %149, label %150, label %190

150:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %151 = load ptr, ptr %14, align 8, !tbaa !5
  %152 = call ptr @json_obj_get_type(ptr noundef %151, ptr noundef @.str.4, i32 noundef 5)
  store ptr %152, ptr %15, align 8, !tbaa !5
  %153 = load ptr, ptr %15, align 8, !tbaa !5
  %154 = icmp ne ptr %153, null
  br i1 %154, label %155, label %189

155:                                              ; preds = %150
  %156 = load ptr, ptr %10, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.otl_ChainingRule, ptr %156, i32 0, i32 5
  %158 = load ptr, ptr %157, align 8, !tbaa !20
  %159 = load i16, ptr %12, align 2, !tbaa !23
  %160 = zext i16 %159 to i64
  %161 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %158, i64 %160
  %162 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %161, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #5
  %163 = load ptr, ptr getelementptr inbounds (%struct.otfcc_HandlePackage, ptr @otfcc_iHandle, i32 0, i32 9), align 8, !tbaa !37
  %164 = load ptr, ptr %15, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct._json_value, ptr %164, i32 0, i32 2
  %166 = getelementptr inbounds %struct.anon.1, ptr %165, i32 0, i32 1
  %167 = load ptr, ptr %166, align 8, !tbaa !14
  %168 = load ptr, ptr %15, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct._json_value, ptr %168, i32 0, i32 2
  %170 = getelementptr inbounds %struct.anon.1, ptr %169, i32 0, i32 0
  %171 = load i32, ptr %170, align 8, !tbaa !14
  %172 = zext i32 %171 to i64
  %173 = call ptr @sdsnewlen(ptr noundef %167, i64 noundef %172)
  %174 = call { i64, ptr } %163(ptr noundef %173)
  %175 = getelementptr inbounds { i64, ptr }, ptr %16, i32 0, i32 0
  %176 = extractvalue { i64, ptr } %174, 0
  store i64 %176, ptr %175, align 8
  %177 = getelementptr inbounds { i64, ptr }, ptr %16, i32 0, i32 1
  %178 = extractvalue { i64, ptr } %174, 1
  store ptr %178, ptr %177, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %162, ptr align 8 %16, i64 16, i1 false), !tbaa.struct !33
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #5
  %179 = load ptr, ptr %14, align 8, !tbaa !5
  %180 = call double @json_obj_getnum(ptr noundef %179, ptr noundef @.str.5)
  %181 = fptoui double %180 to i16
  %182 = load ptr, ptr %10, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.otl_ChainingRule, ptr %182, i32 0, i32 5
  %184 = load ptr, ptr %183, align 8, !tbaa !20
  %185 = load i16, ptr %12, align 2, !tbaa !23
  %186 = zext i16 %185 to i64
  %187 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %184, i64 %186
  %188 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %187, i32 0, i32 0
  store i16 %181, ptr %188, align 8, !tbaa !28
  br label %189

189:                                              ; preds = %155, %150
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %190

190:                                              ; preds = %189, %117
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %191

191:                                              ; preds = %190
  %192 = load i16, ptr %12, align 2, !tbaa !23
  %193 = add i16 %192, 1
  store i16 %193, ptr %12, align 2, !tbaa !23
  br label %108, !llvm.loop !38

194:                                              ; preds = %116
  %195 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %195, ptr %3, align 8
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %196

196:                                              ; preds = %194, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %197 = load ptr, ptr %3, align 8
  ret ptr %197
}

; 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 ptr @json_obj_get_type(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @__caryll_allocate_clean(i64 noundef, i64 noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden double @json_obj_getnum_fallback(ptr noundef, ptr noundef, double noundef) #2

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

; 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

declare ptr @sdsnewlen(ptr noundef, i64 noundef) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden double @json_obj_getnum(ptr noundef, ptr noundef) #2

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 = { "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 #5 = { 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, !6, i64 48}
!10 = !{!"__caryll_elementinterface_subtable_chaining", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!11 = !{!12, !13, i64 0}
!12 = !{!"", !13, i64 0, !7, i64 8}
!13 = !{!"int", !7, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !17, i64 0}
!16 = !{!"", !17, i64 0, !17, i64 2, !17, i64 4, !6, i64 8, !17, i64 16, !6, i64 24}
!17 = !{!"short", !7, i64 0}
!18 = !{!16, !6, i64 8}
!19 = !{!16, !17, i64 16}
!20 = !{!16, !6, i64 24}
!21 = !{!16, !17, i64 2}
!22 = !{!16, !17, i64 4}
!23 = !{!17, !17, i64 0}
!24 = !{!25, !6, i64 88}
!25 = !{!"__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}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!29, !17, i64 0}
!29 = !{!"", !17, i64 0, !30, i64 8}
!30 = !{!"otfcc_Handle", !13, i64 0, !17, i64 4, !6, i64 8}
!31 = !{!32, !6, i64 48}
!32 = !{!"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}
!33 = !{i64 0, i64 4, !34, i64 4, i64 2, !23, i64 8, i64 8, !5}
!34 = !{!13, !13, i64 0}
!35 = !{!36, !13, i64 8}
!36 = !{!"_json_value", !6, i64 0, !13, i64 8, !7, i64 16, !7, i64 32}
!37 = !{!32, !6, i64 72}
!38 = distinct !{!38, !27}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@iSubtable_chaining = external local_unnamed_addr constant %struct.__caryll_elementinterface_subtable_chaining, align 8
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1
@otl_iCoverage = external local_unnamed_addr constant %struct.__otfcc_ICoverage, align 8
@otfcc_iHandle = external local_unnamed_addr constant %struct.otfcc_HandlePackage, align 8
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @otl_parse_chaining(ptr noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = tail call ptr @json_obj_get_type(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 2)
  %4 = tail call ptr @json_obj_get_type(ptr noundef %0, ptr noundef nonnull @.str.1, i32 noundef 2)
  %5 = icmp ne ptr %3, null
  %6 = icmp ne ptr %4, null
  %or.cond = select i1 %5, i1 %6, i1 false
  br i1 %or.cond, label %7, label %.loopexit

7:                                                ; preds = %2
  %8 = load ptr, ptr getelementptr inbounds (i8, ptr @iSubtable_chaining, i64 48), align 8, !tbaa !5
  %9 = tail call ptr (...) %8() #3
  store i32 0, ptr %9, align 8, !tbaa !10
  %10 = getelementptr inbounds i8, ptr %9, i64 8
  %11 = getelementptr inbounds i8, ptr %3, i64 16
  %12 = load i32, ptr %11, align 8, !tbaa !13
  %13 = trunc i32 %12 to i16
  store i16 %13, ptr %10, align 8, !tbaa !14
  %.mask = shl i32 %12, 3
  %14 = and i32 %.mask, 524280
  %15 = zext nneg i32 %14 to i64
  %16 = tail call ptr @__caryll_allocate_clean(i64 noundef %15, i64 noundef 14)
  %17 = getelementptr inbounds i8, ptr %9, i64 16
  store ptr %16, ptr %17, align 8, !tbaa !17
  %18 = getelementptr inbounds i8, ptr %4, i64 16
  %19 = load i32, ptr %18, align 8, !tbaa !13
  %20 = trunc i32 %19 to i16
  %21 = getelementptr inbounds i8, ptr %9, i64 24
  store i16 %20, ptr %21, align 8, !tbaa !18
  %.mask54 = and i32 %19, 65535
  %narrow = mul nuw nsw i32 %.mask54, 24
  %22 = zext nneg i32 %narrow to i64
  %23 = tail call ptr @__caryll_allocate_clean(i64 noundef %22, i64 noundef 16)
  %24 = getelementptr inbounds i8, ptr %9, i64 32
  store ptr %23, ptr %24, align 8, !tbaa !19
  %25 = tail call double @json_obj_getnum_fallback(ptr noundef %0, ptr noundef nonnull @.str.2, double noundef 0.000000e+00)
  %26 = fptoui double %25 to i16
  %27 = getelementptr inbounds i8, ptr %9, i64 10
  store i16 %26, ptr %27, align 2, !tbaa !20
  %28 = load i16, ptr %10, align 8, !tbaa !14
  %29 = uitofp i16 %28 to double
  %30 = tail call double @json_obj_getnum_fallback(ptr noundef %0, ptr noundef nonnull @.str.3, double noundef %29)
  %31 = fptoui double %30 to i16
  %32 = getelementptr inbounds i8, ptr %9, i64 12
  store i16 %31, ptr %32, align 4, !tbaa !21
  %33 = load i16, ptr %10, align 8, !tbaa !14
  %.not58 = icmp eq i16 %33, 0
  br i1 %.not58, label %.preheader, label %.lr.ph

.lr.ph:                                           ; preds = %7
  %34 = load ptr, ptr getelementptr inbounds (i8, ptr @otl_iCoverage, i64 88), align 8, !tbaa !22
  %35 = getelementptr inbounds i8, ptr %3, i64 24
  br label %40

.preheader:                                       ; preds = %40, %7
  %36 = load i16, ptr %21, align 8, !tbaa !18
  %.not59 = icmp eq i16 %36, 0
  br i1 %.not59, label %.loopexit, label %.lr.ph57

.lr.ph57:                                         ; preds = %.preheader
  %37 = load ptr, ptr getelementptr inbounds (i8, ptr @otfcc_iHandle, i64 48), align 8, !tbaa !24
  %38 = getelementptr inbounds i8, ptr %4, i64 24
  %39 = load ptr, ptr getelementptr inbounds (i8, ptr @otfcc_iHandle, i64 72), align 8
  br label %50

40:                                               ; preds = %.lr.ph, %40
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %40 ]
  %41 = load ptr, ptr %35, align 8, !tbaa !13
  %42 = getelementptr inbounds ptr, ptr %41, i64 %indvars.iv
  %43 = load ptr, ptr %42, align 8, !tbaa !26
  %44 = tail call ptr %34(ptr noundef %43) #3
  %45 = load ptr, ptr %17, align 8, !tbaa !17
  %46 = getelementptr inbounds ptr, ptr %45, i64 %indvars.iv
  store ptr %44, ptr %46, align 8, !tbaa !26
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %47 = load i16, ptr %10, align 8, !tbaa !14
  %48 = zext i16 %47 to i64
  %49 = icmp ult i64 %indvars.iv.next, %48
  br i1 %49, label %40, label %.preheader, !llvm.loop !27

50:                                               ; preds = %.lr.ph57, %81
  %indvars.iv61 = phi i64 [ 0, %.lr.ph57 ], [ %indvars.iv.next62, %81 ]
  %51 = load ptr, ptr %24, align 8, !tbaa !19
  %52 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %51, i64 %indvars.iv61
  store i16 0, ptr %52, align 8, !tbaa !29
  %53 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %51, i64 %indvars.iv61, i32 1
  %54 = tail call { i64, ptr } (...) %37() #3
  %55 = extractvalue { i64, ptr } %54, 0
  %56 = extractvalue { i64, ptr } %54, 1
  store i64 %55, ptr %53, align 8
  %.sroa.48.0..sroa_idx = getelementptr inbounds i8, ptr %53, i64 8
  store ptr %56, ptr %.sroa.48.0..sroa_idx, align 8, !tbaa !26
  %57 = load ptr, ptr %38, align 8, !tbaa !13
  %58 = getelementptr inbounds ptr, ptr %57, i64 %indvars.iv61
  %59 = load ptr, ptr %58, align 8, !tbaa !26
  %60 = getelementptr inbounds i8, ptr %59, i64 8
  %61 = load i32, ptr %60, align 8, !tbaa !32
  %62 = icmp eq i32 %61, 1
  br i1 %62, label %63, label %81

63:                                               ; preds = %50
  %64 = tail call ptr @json_obj_get_type(ptr noundef nonnull %59, ptr noundef nonnull @.str.4, i32 noundef 5)
  %.not = icmp eq ptr %64, null
  br i1 %.not, label %81, label %65

65:                                               ; preds = %63
  %66 = load ptr, ptr %24, align 8, !tbaa !19
  %67 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %66, i64 %indvars.iv61, i32 1
  %68 = getelementptr inbounds i8, ptr %64, i64 16
  %69 = getelementptr inbounds i8, ptr %64, i64 24
  %70 = load ptr, ptr %69, align 8, !tbaa !13
  %71 = load i32, ptr %68, align 8, !tbaa !13
  %72 = zext i32 %71 to i64
  %73 = tail call ptr @sdsnewlen(ptr noundef %70, i64 noundef %72) #3
  %74 = tail call { i64, ptr } %39(ptr noundef %73) #3
  %75 = extractvalue { i64, ptr } %74, 0
  %76 = extractvalue { i64, ptr } %74, 1
  store i64 %75, ptr %67, align 8
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %67, i64 8
  store ptr %76, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !26
  %77 = tail call double @json_obj_getnum(ptr noundef nonnull %59, ptr noundef nonnull @.str.5)
  %78 = fptoui double %77 to i16
  %79 = load ptr, ptr %24, align 8, !tbaa !19
  %80 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %79, i64 %indvars.iv61
  store i16 %78, ptr %80, align 8, !tbaa !29
  br label %81

81:                                               ; preds = %63, %65, %50
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %82 = load i16, ptr %21, align 8, !tbaa !18
  %83 = zext i16 %82 to i64
  %84 = icmp ult i64 %indvars.iv.next62, %83
  br i1 %84, label %50, label %.loopexit, !llvm.loop !34

.loopexit:                                        ; preds = %81, %.preheader, %2
  %.0 = phi ptr [ null, %2 ], [ %9, %.preheader ], [ %9, %81 ]
  ret ptr %.0
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @json_obj_get_type(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @__caryll_allocate_clean(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden double @json_obj_getnum_fallback(ptr noundef, ptr noundef, double noundef) local_unnamed_addr #1

declare ptr @sdsnewlen(ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden double @json_obj_getnum(ptr noundef, 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 = { "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, !7, i64 48}
!6 = !{!"__caryll_elementinterface_subtable_chaining", !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 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !12, i64 0}
!11 = !{!"", !12, i64 0, !8, i64 8}
!12 = !{!"int", !8, i64 0}
!13 = !{!8, !8, i64 0}
!14 = !{!15, !16, i64 0}
!15 = !{!"", !16, i64 0, !16, i64 2, !16, i64 4, !7, i64 8, !16, i64 16, !7, i64 24}
!16 = !{!"short", !8, i64 0}
!17 = !{!15, !7, i64 8}
!18 = !{!15, !16, i64 16}
!19 = !{!15, !7, i64 24}
!20 = !{!15, !16, i64 2}
!21 = !{!15, !16, i64 4}
!22 = !{!23, !7, i64 88}
!23 = !{!"__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}
!24 = !{!25, !7, i64 48}
!25 = !{!"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}
!26 = !{!7, !7, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!30, !16, i64 0}
!30 = !{!"", !16, i64 0, !31, i64 8}
!31 = !{!"otfcc_Handle", !12, i64 0, !16, i64 4, !7, i64 8}
!32 = !{!33, !12, i64 8}
!33 = !{!"_json_value", !7, i64 0, !12, i64 8, !8, i64 16, !8, i64 32}
!34 = distinct !{!34, !28}


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