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

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

@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [12 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 @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 void @otfcc_dumpPost(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %12, label %11

11:                                               ; preds = %3
  br label %104

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

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

26:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #3
  br label %104

27:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %28 = call ptr @json_object_new(i64 noundef 10)
  store ptr %28, ptr %8, align 8, !tbaa !5
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.table_post, ptr %30, i32 0, i32 0
  %32 = load i32, ptr %31, align 8, !tbaa !17
  %33 = call double @otfcc_from_fixed(i32 noundef %32)
  %34 = call ptr @json_double_new(double noundef %33)
  %35 = call ptr @json_object_push(ptr noundef %29, ptr noundef @.str.1, ptr noundef %34)
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.table_post, ptr %37, i32 0, i32 1
  %39 = load i32, ptr %38, align 4, !tbaa !21
  %40 = call double @otfcc_from_fixed(i32 noundef %39)
  %41 = fptosi double %40 to i64
  %42 = call ptr @json_integer_new(i64 noundef %41)
  %43 = call ptr @json_object_push(ptr noundef %36, ptr noundef @.str.2, ptr noundef %42)
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.table_post, ptr %45, i32 0, i32 2
  %47 = load i16, ptr %46, align 8, !tbaa !22
  %48 = sext i16 %47 to i64
  %49 = call ptr @json_integer_new(i64 noundef %48)
  %50 = call ptr @json_object_push(ptr noundef %44, ptr noundef @.str.3, ptr noundef %49)
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.table_post, ptr %52, i32 0, i32 3
  %54 = load i16, ptr %53, align 2, !tbaa !23
  %55 = sext i16 %54 to i64
  %56 = call ptr @json_integer_new(i64 noundef %55)
  %57 = call ptr @json_object_push(ptr noundef %51, ptr noundef @.str.4, ptr noundef %56)
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.table_post, ptr %59, i32 0, i32 4
  %61 = load i32, ptr %60, align 4, !tbaa !24
  %62 = call ptr @json_boolean_new(i32 noundef %61)
  %63 = call ptr @json_object_push(ptr noundef %58, ptr noundef @.str.5, ptr noundef %62)
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.table_post, ptr %65, i32 0, i32 5
  %67 = load i32, ptr %66, align 8, !tbaa !25
  %68 = zext i32 %67 to i64
  %69 = call ptr @json_integer_new(i64 noundef %68)
  %70 = call ptr @json_object_push(ptr noundef %64, ptr noundef @.str.6, ptr noundef %69)
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.table_post, ptr %72, i32 0, i32 6
  %74 = load i32, ptr %73, align 4, !tbaa !26
  %75 = zext i32 %74 to i64
  %76 = call ptr @json_integer_new(i64 noundef %75)
  %77 = call ptr @json_object_push(ptr noundef %71, ptr noundef @.str.7, ptr noundef %76)
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.table_post, ptr %79, i32 0, i32 7
  %81 = load i32, ptr %80, align 8, !tbaa !27
  %82 = zext i32 %81 to i64
  %83 = call ptr @json_integer_new(i64 noundef %82)
  %84 = call ptr @json_object_push(ptr noundef %78, ptr noundef @.str.8, ptr noundef %83)
  %85 = load ptr, ptr %8, align 8, !tbaa !5
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.table_post, ptr %86, i32 0, i32 8
  %88 = load i32, ptr %87, align 4, !tbaa !28
  %89 = zext i32 %88 to i64
  %90 = call ptr @json_integer_new(i64 noundef %89)
  %91 = call ptr @json_object_push(ptr noundef %85, ptr noundef @.str.9, ptr noundef %90)
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  %94 = call ptr @json_object_push(ptr noundef %92, ptr noundef @.str, ptr noundef %93)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %95

95:                                               ; preds = %27
  store i8 0, ptr %7, align 1, !tbaa !14
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.otfcc_Options, ptr %96, i32 0, i32 24
  %98 = load ptr, ptr %97, align 8, !tbaa !9
  %99 = getelementptr inbounds %struct.otfcc_ILogger, ptr %98, i32 0, i32 8
  %100 = load ptr, ptr %99, align 8, !tbaa !29
  %101 = load ptr, ptr %6, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.otfcc_Options, ptr %101, i32 0, i32 24
  %103 = load ptr, ptr %102, align 8, !tbaa !9
  call void %100(ptr noundef %103)
  br label %23, !llvm.loop !30

104:                                              ; preds = %26, %11
  ret void
}

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

declare ptr @json_object_new(i64 noundef) #1

declare ptr @json_object_push(ptr noundef, ptr noundef, ptr noundef) #1

declare ptr @json_double_new(double noundef) #1

declare double @otfcc_from_fixed(i32 noundef) #1

declare ptr @json_integer_new(i64 noundef) #1

declare ptr @json_boolean_new(i32 noundef) #1

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 = { 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, !19, i64 0}
!18 = !{!"", !19, i64 0, !19, i64 4, !20, i64 8, !20, i64 10, !19, i64 12, !19, i64 16, !19, i64 20, !19, i64 24, !19, i64 28, !6, i64 32}
!19 = !{!"int", !7, i64 0}
!20 = !{!"short", !7, i64 0}
!21 = !{!18, !19, i64 4}
!22 = !{!18, !20, i64 8}
!23 = !{!18, !20, i64 10}
!24 = !{!18, !19, i64 12}
!25 = !{!18, !19, i64 16}
!26 = !{!18, !19, i64 20}
!27 = !{!18, !19, i64 24}
!28 = !{!18, !19, i64 28}
!29 = !{!13, !6, i64 64}
!30 = distinct !{!30, !31}
!31 = !{!"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"

@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [12 x i8], align 1

declare ptr @sdsempty() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @otfcc_dumpPost(ptr noundef readonly %0, ptr noundef %1, ptr nocapture noundef readonly %2) local_unnamed_addr #1 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %59, label %.critedge

.critedge:                                        ; preds = %3
  %4 = getelementptr inbounds i8, ptr %2, 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() #2
  %9 = tail call ptr (ptr, ptr, ...) @sdscatprintf(ptr noundef %8, ptr noundef nonnull @.str) #2
  tail call void %7(ptr noundef %5, ptr noundef %9) #2
  %10 = tail call ptr @json_object_new(i64 noundef 10) #2
  %11 = load i32, ptr %0, align 8, !tbaa !13
  %12 = tail call double @otfcc_from_fixed(i32 noundef %11) #2
  %13 = tail call ptr @json_double_new(double noundef %12) #2
  %14 = tail call ptr @json_object_push(ptr noundef %10, ptr noundef nonnull @.str.1, ptr noundef %13) #2
  %15 = getelementptr inbounds i8, ptr %0, i64 4
  %16 = load i32, ptr %15, align 4, !tbaa !17
  %17 = tail call double @otfcc_from_fixed(i32 noundef %16) #2
  %18 = fptosi double %17 to i64
  %19 = tail call ptr @json_integer_new(i64 noundef %18) #2
  %20 = tail call ptr @json_object_push(ptr noundef %10, ptr noundef nonnull @.str.2, ptr noundef %19) #2
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  %22 = load i16, ptr %21, align 8, !tbaa !18
  %23 = sext i16 %22 to i64
  %24 = tail call ptr @json_integer_new(i64 noundef %23) #2
  %25 = tail call ptr @json_object_push(ptr noundef %10, ptr noundef nonnull @.str.3, ptr noundef %24) #2
  %26 = getelementptr inbounds i8, ptr %0, i64 10
  %27 = load i16, ptr %26, align 2, !tbaa !19
  %28 = sext i16 %27 to i64
  %29 = tail call ptr @json_integer_new(i64 noundef %28) #2
  %30 = tail call ptr @json_object_push(ptr noundef %10, ptr noundef nonnull @.str.4, ptr noundef %29) #2
  %31 = getelementptr inbounds i8, ptr %0, i64 12
  %32 = load i32, ptr %31, align 4, !tbaa !20
  %33 = tail call ptr @json_boolean_new(i32 noundef %32) #2
  %34 = tail call ptr @json_object_push(ptr noundef %10, ptr noundef nonnull @.str.5, ptr noundef %33) #2
  %35 = getelementptr inbounds i8, ptr %0, i64 16
  %36 = load i32, ptr %35, align 8, !tbaa !21
  %37 = zext i32 %36 to i64
  %38 = tail call ptr @json_integer_new(i64 noundef %37) #2
  %39 = tail call ptr @json_object_push(ptr noundef %10, ptr noundef nonnull @.str.6, ptr noundef %38) #2
  %40 = getelementptr inbounds i8, ptr %0, i64 20
  %41 = load i32, ptr %40, align 4, !tbaa !22
  %42 = zext i32 %41 to i64
  %43 = tail call ptr @json_integer_new(i64 noundef %42) #2
  %44 = tail call ptr @json_object_push(ptr noundef %10, ptr noundef nonnull @.str.7, ptr noundef %43) #2
  %45 = getelementptr inbounds i8, ptr %0, i64 24
  %46 = load i32, ptr %45, align 8, !tbaa !23
  %47 = zext i32 %46 to i64
  %48 = tail call ptr @json_integer_new(i64 noundef %47) #2
  %49 = tail call ptr @json_object_push(ptr noundef %10, ptr noundef nonnull @.str.8, ptr noundef %48) #2
  %50 = getelementptr inbounds i8, ptr %0, i64 28
  %51 = load i32, ptr %50, align 4, !tbaa !24
  %52 = zext i32 %51 to i64
  %53 = tail call ptr @json_integer_new(i64 noundef %52) #2
  %54 = tail call ptr @json_object_push(ptr noundef %10, ptr noundef nonnull @.str.9, ptr noundef %53) #2
  %55 = tail call ptr @json_object_push(ptr noundef %1, ptr noundef nonnull @.str, ptr noundef %10) #2
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds i8, ptr %56, i64 64
  %58 = load ptr, ptr %57, align 8, !tbaa !25
  tail call void %58(ptr noundef %56) #2
  br label %59

59:                                               ; preds = %3, %.critedge
  ret void
}

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

declare ptr @json_object_new(i64 noundef) local_unnamed_addr #0

declare ptr @json_object_push(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare ptr @json_double_new(double noundef) local_unnamed_addr #0

declare double @otfcc_from_fixed(i32 noundef) local_unnamed_addr #0

declare ptr @json_integer_new(i64 noundef) local_unnamed_addr #0

declare ptr @json_boolean_new(i32 noundef) local_unnamed_addr #0

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 = { 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, !15, i64 0}
!14 = !{!"", !15, i64 0, !15, i64 4, !16, i64 8, !16, i64 10, !15, i64 12, !15, i64 16, !15, i64 20, !15, i64 24, !15, i64 28, !10, i64 32}
!15 = !{!"int", !8, i64 0}
!16 = !{!"short", !8, i64 0}
!17 = !{!14, !15, i64 4}
!18 = !{!14, !16, i64 8}
!19 = !{!14, !16, i64 10}
!20 = !{!14, !15, i64 12}
!21 = !{!14, !15, i64 16}
!22 = !{!14, !15, i64 20}
!23 = !{!14, !15, i64 24}
!24 = !{!14, !15, i64 28}
!25 = !{!12, !10, i64 64}


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