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

; 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_maxp = type { 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_maxp = type { i32, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16 }

@table_iMaxp = external dso_local constant %struct.__caryll_elementinterface_table_maxp, align 8
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [17 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

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

declare ptr @sdsempty() #1

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

; Function Attrs: nounwind uwtable
define dso_local ptr @otfcc_parseMaxp(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
  %8 = load ptr, ptr getelementptr inbounds (%struct.__caryll_elementinterface_table_maxp, ptr @table_iMaxp, i32 0, i32 6), align 8, !tbaa !9
  %9 = call ptr (...) %8()
  store ptr %9, 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
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = call ptr @json_obj_get_type(ptr noundef %10, ptr noundef @.str.1, i32 noundef 1)
  store ptr %11, ptr %6, align 8, !tbaa !5
  %12 = icmp ne ptr %11, null
  br i1 %12, label %13, label %79

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

24:                                               ; preds = %69, %13
  %25 = load i8, ptr %7, align 1, !tbaa !16, !range !17, !noundef !18
  %26 = trunc i8 %25 to i1
  br i1 %26, label %28, label %27

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

28:                                               ; preds = %24
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = call double @json_obj_getnum(ptr noundef %29, ptr noundef @.str.2)
  %31 = call i32 @otfcc_to_fixed(double noundef %30)
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.table_maxp, ptr %32, i32 0, i32 0
  store i32 %31, ptr %33, align 4, !tbaa !19
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = call double @json_obj_getnum(ptr noundef %34, ptr noundef @.str.3)
  %36 = fptoui double %35 to i16
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.table_maxp, ptr %37, i32 0, i32 1
  store i16 %36, ptr %38, align 4, !tbaa !23
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = call double @json_obj_getnum(ptr noundef %39, ptr noundef @.str.8)
  %41 = fptoui double %40 to i16
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.table_maxp, ptr %42, i32 0, i32 6
  store i16 %41, ptr %43, align 2, !tbaa !24
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = call double @json_obj_getnum(ptr noundef %44, ptr noundef @.str.9)
  %46 = fptoui double %45 to i16
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.table_maxp, ptr %47, i32 0, i32 7
  store i16 %46, ptr %48, align 4, !tbaa !25
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = call double @json_obj_getnum(ptr noundef %49, ptr noundef @.str.10)
  %51 = fptoui double %50 to i16
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.table_maxp, ptr %52, i32 0, i32 8
  store i16 %51, ptr %53, align 2, !tbaa !26
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = call double @json_obj_getnum(ptr noundef %54, ptr noundef @.str.11)
  %56 = fptoui double %55 to i16
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.table_maxp, ptr %57, i32 0, i32 9
  store i16 %56, ptr %58, align 4, !tbaa !27
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = call double @json_obj_getnum(ptr noundef %59, ptr noundef @.str.12)
  %61 = fptoui double %60 to i16
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.table_maxp, ptr %62, i32 0, i32 10
  store i16 %61, ptr %63, align 2, !tbaa !28
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = call double @json_obj_getnum(ptr noundef %64, ptr noundef @.str.13)
  %66 = fptoui double %65 to i16
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.table_maxp, ptr %67, i32 0, i32 11
  store i16 %66, ptr %68, align 4, !tbaa !29
  br label %69

69:                                               ; preds = %28
  store i8 0, ptr %7, align 1, !tbaa !16
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.otfcc_Options, ptr %70, i32 0, i32 24
  %72 = load ptr, ptr %71, align 8, !tbaa !11
  %73 = getelementptr inbounds %struct.otfcc_ILogger, ptr %72, i32 0, i32 8
  %74 = load ptr, ptr %73, align 8, !tbaa !30
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.otfcc_Options, ptr %75, i32 0, i32 24
  %77 = load ptr, ptr %76, align 8, !tbaa !11
  call void %74(ptr noundef %77)
  br label %24, !llvm.loop !31

78:                                               ; preds = %27
  br label %79

79:                                               ; preds = %78, %2
  %80 = 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 %80
}

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

declare i32 @otfcc_to_fixed(double noundef) #1

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

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 48}
!10 = !{!"__caryll_elementinterface_table_maxp", !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, !6, i64 32}
!12 = !{!"", !13, i64 0, !13, i64 1, !13, i64 2, !13, i64 3, !13, i64 4, !13, i64 5, !13, i64 6, !13, i64 7, !13, i64 8, !13, i64 9, !13, i64 10, !13, i64 11, !13, i64 12, !13, i64 13, !13, i64 14, !13, i64 15, !13, i64 16, !13, i64 17, !13, i64 18, !13, i64 19, !13, i64 20, !13, i64 21, !13, i64 22, !6, i64 24, !6, i64 32}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!15, !6, i64 32}
!15 = !{!"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}
!16 = !{!13, !13, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!20, !21, i64 0}
!20 = !{!"", !21, i64 0, !22, i64 4, !22, i64 6, !22, i64 8, !22, i64 10, !22, i64 12, !22, i64 14, !22, i64 16, !22, i64 18, !22, i64 20, !22, i64 22, !22, i64 24, !22, i64 26, !22, i64 28, !22, i64 30}
!21 = !{!"int", !7, i64 0}
!22 = !{!"short", !7, i64 0}
!23 = !{!20, !22, i64 4}
!24 = !{!20, !22, i64 14}
!25 = !{!20, !22, i64 16}
!26 = !{!20, !22, i64 18}
!27 = !{!20, !22, i64 20}
!28 = !{!20, !22, i64 22}
!29 = !{!20, !22, i64 24}
!30 = !{!15, !6, i64 64}
!31 = distinct !{!31, !32}
!32 = !{!"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_maxp = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@table_iMaxp = external dso_local local_unnamed_addr constant %struct.__caryll_elementinterface_table_maxp, align 8
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [17 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_parseMaxp(ptr noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #1 {
  %3 = load ptr, ptr getelementptr inbounds (i8, ptr @table_iMaxp, i64 48), align 8, !tbaa !5
  %4 = tail call ptr (...) %3() #3
  %5 = tail call ptr @json_obj_get_type(ptr noundef %0, ptr noundef nonnull @.str.1, i32 noundef 1)
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %38, label %.critedge

.critedge:                                        ; preds = %2
  %6 = getelementptr inbounds i8, ptr %1, i64 32
  %7 = load ptr, ptr %6, align 8, !tbaa !10
  %8 = getelementptr inbounds i8, ptr %7, i64 32
  %9 = load ptr, ptr %8, align 8, !tbaa !13
  %10 = tail call ptr @sdsempty() #3
  %11 = tail call ptr (ptr, ptr, ...) @sdscatprintf(ptr noundef %10, ptr noundef nonnull @.str.1) #3
  tail call void %9(ptr noundef %7, ptr noundef %11) #3
  %12 = tail call double @json_obj_getnum(ptr noundef nonnull %5, ptr noundef nonnull @.str.2)
  %13 = tail call i32 @otfcc_to_fixed(double noundef %12) #3
  store i32 %13, ptr %4, align 4, !tbaa !15
  %14 = tail call double @json_obj_getnum(ptr noundef nonnull %5, ptr noundef nonnull @.str.3)
  %15 = fptoui double %14 to i16
  %16 = getelementptr inbounds i8, ptr %4, i64 4
  store i16 %15, ptr %16, align 4, !tbaa !19
  %17 = tail call double @json_obj_getnum(ptr noundef nonnull %5, ptr noundef nonnull @.str.8)
  %18 = fptoui double %17 to i16
  %19 = getelementptr inbounds i8, ptr %4, i64 14
  store i16 %18, ptr %19, align 2, !tbaa !20
  %20 = tail call double @json_obj_getnum(ptr noundef nonnull %5, ptr noundef nonnull @.str.9)
  %21 = fptoui double %20 to i16
  %22 = getelementptr inbounds i8, ptr %4, i64 16
  store i16 %21, ptr %22, align 4, !tbaa !21
  %23 = tail call double @json_obj_getnum(ptr noundef nonnull %5, ptr noundef nonnull @.str.10)
  %24 = fptoui double %23 to i16
  %25 = getelementptr inbounds i8, ptr %4, i64 18
  store i16 %24, ptr %25, align 2, !tbaa !22
  %26 = tail call double @json_obj_getnum(ptr noundef nonnull %5, ptr noundef nonnull @.str.11)
  %27 = fptoui double %26 to i16
  %28 = getelementptr inbounds i8, ptr %4, i64 20
  store i16 %27, ptr %28, align 4, !tbaa !23
  %29 = tail call double @json_obj_getnum(ptr noundef nonnull %5, ptr noundef nonnull @.str.12)
  %30 = fptoui double %29 to i16
  %31 = getelementptr inbounds i8, ptr %4, i64 22
  store i16 %30, ptr %31, align 2, !tbaa !24
  %32 = tail call double @json_obj_getnum(ptr noundef nonnull %5, ptr noundef nonnull @.str.13)
  %33 = fptoui double %32 to i16
  %34 = getelementptr inbounds i8, ptr %4, i64 24
  store i16 %33, ptr %34, align 4, !tbaa !25
  %35 = load ptr, ptr %6, align 8, !tbaa !10
  %36 = getelementptr inbounds i8, ptr %35, i64 64
  %37 = load ptr, ptr %36, align 8, !tbaa !26
  tail call void %37(ptr noundef %35) #3
  br label %38

38:                                               ; preds = %.critedge, %2
  ret ptr %4
}

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

declare i32 @otfcc_to_fixed(double noundef) local_unnamed_addr #0

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

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, !7, i64 48}
!6 = !{!"__caryll_elementinterface_table_maxp", !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, !7, i64 32}
!11 = !{!"", !12, i64 0, !12, i64 1, !12, i64 2, !12, i64 3, !12, i64 4, !12, i64 5, !12, i64 6, !12, i64 7, !12, i64 8, !12, i64 9, !12, i64 10, !12, i64 11, !12, i64 12, !12, i64 13, !12, i64 14, !12, i64 15, !12, i64 16, !12, i64 17, !12, i64 18, !12, i64 19, !12, i64 20, !12, i64 21, !12, i64 22, !7, i64 24, !7, i64 32}
!12 = !{!"_Bool", !8, i64 0}
!13 = !{!14, !7, i64 32}
!14 = !{!"otfcc_ILogger", !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}
!15 = !{!16, !17, i64 0}
!16 = !{!"", !17, i64 0, !18, i64 4, !18, i64 6, !18, i64 8, !18, i64 10, !18, i64 12, !18, i64 14, !18, i64 16, !18, i64 18, !18, i64 20, !18, i64 22, !18, i64 24, !18, i64 26, !18, i64 28, !18, i64 30}
!17 = !{!"int", !8, i64 0}
!18 = !{!"short", !8, i64 0}
!19 = !{!16, !18, i64 4}
!20 = !{!16, !18, i64 14}
!21 = !{!16, !18, i64 16}
!22 = !{!16, !18, i64 18}
!23 = !{!16, !18, i64 20}
!24 = !{!16, !18, i64 22}
!25 = !{!16, !18, i64 24}
!26 = !{!14, !7, i64 64}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass