; LLVM IR from caryll/otfcc :: lib/table (GDEF)

; 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_table_GDEF = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.__otfcc_IClassDef = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.otfcc_Options = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, ptr, ptr }
%struct.otfcc_ILogger = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.table_GDEF = type { ptr, ptr, %struct.otl_LigCaretTable }
%struct.otl_LigCaretTable = type { i64, i64, ptr }

@table_iGDEF = external dso_local constant %struct.__caryll_elementinterface_table_GDEF, align 8
@otl_iClassDef = external constant %struct.__otfcc_IClassDef, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1

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

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

declare ptr @sdscatprintf(ptr noundef, ptr noundef, ...) #1

declare ptr @sdsempty() #1

; Function Attrs: nounwind uwtable
define dso_local ptr @otfcc_parseGDEF(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store ptr null, ptr %6, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = call ptr @json_obj_get_type(ptr noundef %8, ptr noundef @.str, i32 noundef 1)
  store ptr %9, ptr %6, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %11, label %55

11:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #4
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.otfcc_Options, ptr %12, i32 0, i32 24
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  %15 = getelementptr inbounds %struct.otfcc_ILogger, ptr %14, i32 0, i32 4
  %16 = load ptr, ptr %15, align 8, !tbaa !12
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.otfcc_Options, ptr %17, i32 0, i32 24
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = call ptr @sdsempty()
  %21 = call ptr (ptr, ptr, ...) @sdscatprintf(ptr noundef %20, ptr noundef @.str)
  call void %16(ptr noundef %19, ptr noundef %21)
  store i8 1, ptr %7, align 1, !tbaa !14
  br label %22

22:                                               ; preds = %45, %11
  %23 = load i8, ptr %7, align 1, !tbaa !14, !range !15, !noundef !16
  %24 = trunc i8 %23 to i1
  br i1 %24, label %26, label %25

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

26:                                               ; preds = %22
  %27 = load ptr, ptr getelementptr inbounds (%struct.__caryll_elementinterface_table_GDEF, ptr @table_iGDEF, i32 0, i32 6), align 8, !tbaa !17
  %28 = call ptr (...) %27()
  store ptr %28, ptr %5, align 8, !tbaa !5
  %29 = load ptr, ptr getelementptr inbounds (%struct.__otfcc_IClassDef, ptr @otl_iClassDef, i32 0, i32 12), align 8, !tbaa !19
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = call ptr @json_obj_get(ptr noundef %30, ptr noundef @.str.1)
  %32 = call ptr %29(ptr noundef %31)
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.table_GDEF, ptr %33, i32 0, i32 0
  store ptr %32, ptr %34, align 8, !tbaa !21
  %35 = load ptr, ptr getelementptr inbounds (%struct.__otfcc_IClassDef, ptr @otl_iClassDef, i32 0, i32 12), align 8, !tbaa !19
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = call ptr @json_obj_get(ptr noundef %36, ptr noundef @.str.2)
  %38 = call ptr %35(ptr noundef %37)
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.table_GDEF, ptr %39, i32 0, i32 1
  store ptr %38, ptr %40, align 8, !tbaa !25
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = call ptr @json_obj_get(ptr noundef %41, ptr noundef @.str.3)
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.table_GDEF, ptr %43, i32 0, i32 2
  call void @ligCaretFromJson(ptr noundef %42, ptr noundef %44)
  br label %45

45:                                               ; preds = %26
  store i8 0, ptr %7, align 1, !tbaa !14
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.otfcc_Options, ptr %46, i32 0, i32 24
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  %49 = getelementptr inbounds %struct.otfcc_ILogger, ptr %48, i32 0, i32 8
  %50 = load ptr, ptr %49, align 8, !tbaa !26
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.otfcc_Options, ptr %51, i32 0, i32 24
  %53 = load ptr, ptr %52, align 8, !tbaa !9
  call void %50(ptr noundef %53)
  br label %22, !llvm.loop !27

54:                                               ; preds = %25
  br label %55

55:                                               ; preds = %54, %2
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret ptr %56
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @json_obj_get(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @ligCaretFromJson(ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind 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 = { 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 #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, !6, i64 32}
!10 = !{!"", !11, i64 0, !11, i64 1, !11, i64 2, !11, i64 3, !11, i64 4, !11, i64 5, !11, i64 6, !11, i64 7, !11, i64 8, !11, i64 9, !11, i64 10, !11, i64 11, !11, i64 12, !11, i64 13, !11, i64 14, !11, i64 15, !11, i64 16, !11, i64 17, !11, i64 18, !11, i64 19, !11, i64 20, !11, i64 21, !11, i64 22, !6, i64 24, !6, i64 32}
!11 = !{!"_Bool", !7, i64 0}
!12 = !{!13, !6, i64 32}
!13 = !{!"otfcc_ILogger", !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}
!14 = !{!11, !11, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!18, !6, i64 48}
!18 = !{!"__caryll_elementinterface_table_GDEF", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!19 = !{!20, !6, i64 96}
!20 = !{!"__otfcc_IClassDef", !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}
!21 = !{!22, !6, i64 0}
!22 = !{!"", !6, i64 0, !6, i64 8, !23, i64 16}
!23 = !{!"", !24, i64 0, !24, i64 8, !6, i64 16}
!24 = !{!"long", !7, i64 0}
!25 = !{!22, !6, i64 8}
!26 = !{!13, !6, i64 64}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}


; 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_table_GDEF = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.__otfcc_IClassDef = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@table_iGDEF = external dso_local local_unnamed_addr constant %struct.__caryll_elementinterface_table_GDEF, align 8
@otl_iClassDef = external local_unnamed_addr constant %struct.__otfcc_IClassDef, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1

declare ptr @sdscatprintf(ptr noundef, ptr noundef, ...) local_unnamed_addr #0

declare ptr @sdsempty() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local ptr @otfcc_parseGDEF(ptr noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #1 {
  %3 = tail call ptr @json_obj_get_type(ptr noundef %0, ptr noundef nonnull @.str, i32 noundef 1)
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %23, label %.loopexit

.loopexit:                                        ; preds = %2
  %4 = getelementptr inbounds i8, ptr %1, i64 32
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %5, i64 32
  %7 = load ptr, ptr %6, align 8, !tbaa !11
  %8 = tail call ptr @sdsempty() #3
  %9 = tail call ptr (ptr, ptr, ...) @sdscatprintf(ptr noundef %8, ptr noundef nonnull @.str) #3
  tail call void %7(ptr noundef %5, ptr noundef %9) #3
  %10 = load ptr, ptr getelementptr inbounds (i8, ptr @table_iGDEF, i64 48), align 8, !tbaa !13
  %11 = load ptr, ptr getelementptr inbounds (i8, ptr @otl_iClassDef, i64 96), align 8
  %12 = tail call ptr (...) %10() #3
  %13 = tail call ptr @json_obj_get(ptr noundef nonnull %3, ptr noundef nonnull @.str.1)
  %14 = tail call ptr %11(ptr noundef %13) #3
  store ptr %14, ptr %12, align 8, !tbaa !15
  %15 = tail call ptr @json_obj_get(ptr noundef nonnull %3, ptr noundef nonnull @.str.2)
  %16 = tail call ptr %11(ptr noundef %15) #3
  %17 = getelementptr inbounds i8, ptr %12, i64 8
  store ptr %16, ptr %17, align 8, !tbaa !19
  %18 = tail call ptr @json_obj_get(ptr noundef nonnull %3, ptr noundef nonnull @.str.3)
  %19 = getelementptr inbounds i8, ptr %12, i64 16
  tail call void @ligCaretFromJson(ptr noundef %18, ptr noundef nonnull %19)
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %20, i64 64
  %22 = load ptr, ptr %21, align 8, !tbaa !20
  tail call void %22(ptr noundef %20) #3
  br label %23

23:                                               ; preds = %.loopexit, %2
  %.1 = phi ptr [ null, %2 ], [ %12, %.loopexit ]
  ret ptr %.1
}

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

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

; Function Attrs: nounwind uwtable
declare hidden void @ligCaretFromJson(ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #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 = { 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 = { 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, !10, i64 32}
!6 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19, !7, i64 20, !7, i64 21, !7, i64 22, !10, i64 24, !10, i64 32}
!7 = !{!"_Bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!12, !10, i64 32}
!12 = !{!"otfcc_ILogger", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88}
!13 = !{!14, !10, i64 48}
!14 = !{!"__caryll_elementinterface_table_GDEF", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56}
!15 = !{!16, !10, i64 0}
!16 = !{!"", !10, i64 0, !10, i64 8, !17, i64 16}
!17 = !{!"", !18, i64 0, !18, i64 8, !10, i64 16}
!18 = !{!"long", !8, i64 0}
!19 = !{!16, !10, i64 8}
!20 = !{!12, !10, i64 64}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass