; LLVM IR from caryll/otfcc :: lib/libcff (cff-parser)

; 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_cff_Index = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.cff_File = type { ptr, i32, i16, %struct.cff_Header, %struct.cff_Index, %struct.cff_Index, %struct.cff_Index, %struct.cff_Index, %struct.cff_Encoding, %struct.cff_Charset, %struct.cff_FDSelect, %struct.cff_Index, %struct.cff_Index, %struct.cff_Index }
%struct.cff_Header = type { i8, i8, i8, i8 }
%struct.cff_Encoding = type { i32, %union.anon }
%union.anon = type { %struct.cff_EncodingFormat0 }
%struct.cff_EncodingFormat0 = type { i8, i8, ptr }
%struct.cff_Charset = type { i32, i32, %union.anon.0 }
%union.anon.0 = type { %struct.cff_CharsetFormat0 }
%struct.cff_CharsetFormat0 = type { i8, ptr }
%struct.cff_FDSelect = type { i32, i32, %union.anon.1 }
%union.anon.1 = type { %struct.cff_FDSelectFormat3 }
%struct.cff_FDSelectFormat3 = type { i8, i16, ptr, i16 }
%struct.cff_Index = type { i32, i32, i8, ptr, ptr }
%struct.cff_EncodingFormat1 = type { i8, i8, ptr }
%struct.cff_EncodingNS = type { i8, ptr }

@cff_iIndex = external constant %struct.__caryll_elementinterface_cff_Index, align 8

; Function Attrs: nounwind uwtable
define dso_local void @cff_close(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = icmp ne ptr %3, null
  br i1 %4, label %5, label %103

5:                                                ; preds = %1
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.cff_File, ptr %6, i32 0, i32 0
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = icmp ne ptr %8, null
  br i1 %9, label %10, label %16

10:                                               ; preds = %5
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.cff_File, ptr %11, i32 0, i32 0
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  call void @free(ptr noundef %13) #3
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.cff_File, ptr %14, i32 0, i32 0
  store ptr null, ptr %15, align 8, !tbaa !9
  br label %16

16:                                               ; preds = %10, %5
  %17 = load ptr, ptr getelementptr inbounds (%struct.__caryll_elementinterface_cff_Index, ptr @cff_iIndex, i32 0, i32 3), align 8, !tbaa !17
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.cff_File, ptr %18, i32 0, i32 4
  call void %17(ptr noundef %19)
  %20 = load ptr, ptr getelementptr inbounds (%struct.__caryll_elementinterface_cff_Index, ptr @cff_iIndex, i32 0, i32 3), align 8, !tbaa !17
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.cff_File, ptr %21, i32 0, i32 5
  call void %20(ptr noundef %22)
  %23 = load ptr, ptr getelementptr inbounds (%struct.__caryll_elementinterface_cff_Index, ptr @cff_iIndex, i32 0, i32 3), align 8, !tbaa !17
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.cff_File, ptr %24, i32 0, i32 6
  call void %23(ptr noundef %25)
  %26 = load ptr, ptr getelementptr inbounds (%struct.__caryll_elementinterface_cff_Index, ptr @cff_iIndex, i32 0, i32 3), align 8, !tbaa !17
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.cff_File, ptr %27, i32 0, i32 7
  call void %26(ptr noundef %28)
  %29 = load ptr, ptr getelementptr inbounds (%struct.__caryll_elementinterface_cff_Index, ptr @cff_iIndex, i32 0, i32 3), align 8, !tbaa !17
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.cff_File, ptr %30, i32 0, i32 11
  call void %29(ptr noundef %31)
  %32 = load ptr, ptr getelementptr inbounds (%struct.__caryll_elementinterface_cff_Index, ptr @cff_iIndex, i32 0, i32 3), align 8, !tbaa !17
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.cff_File, ptr %33, i32 0, i32 12
  call void %32(ptr noundef %34)
  %35 = load ptr, ptr getelementptr inbounds (%struct.__caryll_elementinterface_cff_Index, ptr @cff_iIndex, i32 0, i32 3), align 8, !tbaa !17
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.cff_File, ptr %36, i32 0, i32 13
  call void %35(ptr noundef %37)
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.cff_File, ptr %38, i32 0, i32 8
  %40 = getelementptr inbounds %struct.cff_Encoding, ptr %39, i32 0, i32 0
  %41 = load i32, ptr %40, align 8, !tbaa !19
  switch i32 %41, label %97 [
    i32 0, label %42
    i32 1, label %42
    i32 5, label %42
    i32 2, label %43
    i32 3, label %61
    i32 4, label %79
  ]

42:                                               ; preds = %16, %16, %16
  br label %97

43:                                               ; preds = %16
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.cff_File, ptr %44, i32 0, i32 8
  %46 = getelementptr inbounds %struct.cff_Encoding, ptr %45, i32 0, i32 1
  %47 = getelementptr inbounds %struct.cff_EncodingFormat0, ptr %46, i32 0, i32 2
  %48 = load ptr, ptr %47, align 8, !tbaa !20
  %49 = icmp ne ptr %48, null
  br i1 %49, label %50, label %60

50:                                               ; preds = %43
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.cff_File, ptr %51, i32 0, i32 8
  %53 = getelementptr inbounds %struct.cff_Encoding, ptr %52, i32 0, i32 1
  %54 = getelementptr inbounds %struct.cff_EncodingFormat0, ptr %53, i32 0, i32 2
  %55 = load ptr, ptr %54, align 8, !tbaa !20
  call void @free(ptr noundef %55) #3
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.cff_File, ptr %56, i32 0, i32 8
  %58 = getelementptr inbounds %struct.cff_Encoding, ptr %57, i32 0, i32 1
  %59 = getelementptr inbounds %struct.cff_EncodingFormat0, ptr %58, i32 0, i32 2
  store ptr null, ptr %59, align 8, !tbaa !20
  br label %60

60:                                               ; preds = %50, %43
  br label %97

61:                                               ; preds = %16
  %62 = load ptr, ptr %2, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.cff_File, ptr %62, i32 0, i32 8
  %64 = getelementptr inbounds %struct.cff_Encoding, ptr %63, i32 0, i32 1
  %65 = getelementptr inbounds %struct.cff_EncodingFormat1, ptr %64, i32 0, i32 2
  %66 = load ptr, ptr %65, align 8, !tbaa !20
  %67 = icmp ne ptr %66, null
  br i1 %67, label %68, label %78

68:                                               ; preds = %61
  %69 = load ptr, ptr %2, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.cff_File, ptr %69, i32 0, i32 8
  %71 = getelementptr inbounds %struct.cff_Encoding, ptr %70, i32 0, i32 1
  %72 = getelementptr inbounds %struct.cff_EncodingFormat1, ptr %71, i32 0, i32 2
  %73 = load ptr, ptr %72, align 8, !tbaa !20
  call void @free(ptr noundef %73) #3
  %74 = load ptr, ptr %2, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.cff_File, ptr %74, i32 0, i32 8
  %76 = getelementptr inbounds %struct.cff_Encoding, ptr %75, i32 0, i32 1
  %77 = getelementptr inbounds %struct.cff_EncodingFormat1, ptr %76, i32 0, i32 2
  store ptr null, ptr %77, align 8, !tbaa !20
  br label %78

78:                                               ; preds = %68, %61
  br label %97

79:                                               ; preds = %16
  %80 = load ptr, ptr %2, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.cff_File, ptr %80, i32 0, i32 8
  %82 = getelementptr inbounds %struct.cff_Encoding, ptr %81, i32 0, i32 1
  %83 = getelementptr inbounds %struct.cff_EncodingNS, ptr %82, i32 0, i32 1
  %84 = load ptr, ptr %83, align 8, !tbaa !20
  %85 = icmp ne ptr %84, null
  br i1 %85, label %86, label %96

86:                                               ; preds = %79
  %87 = load ptr, ptr %2, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.cff_File, ptr %87, i32 0, i32 8
  %89 = getelementptr inbounds %struct.cff_Encoding, ptr %88, i32 0, i32 1
  %90 = getelementptr inbounds %struct.cff_EncodingNS, ptr %89, i32 0, i32 1
  %91 = load ptr, ptr %90, align 8, !tbaa !20
  call void @free(ptr noundef %91) #3
  %92 = load ptr, ptr %2, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.cff_File, ptr %92, i32 0, i32 8
  %94 = getelementptr inbounds %struct.cff_Encoding, ptr %93, i32 0, i32 1
  %95 = getelementptr inbounds %struct.cff_EncodingNS, ptr %94, i32 0, i32 1
  store ptr null, ptr %95, align 8, !tbaa !20
  br label %96

96:                                               ; preds = %86, %79
  br label %97

97:                                               ; preds = %96, %78, %60, %42, %16
  %98 = load ptr, ptr %2, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.cff_File, ptr %98, i32 0, i32 9
  call void @cff_close_Charset(ptr noundef byval(%struct.cff_Charset) align 8 %99)
  %100 = load ptr, ptr %2, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.cff_File, ptr %100, i32 0, i32 10
  call void @cff_close_FDSelect(ptr noundef byval(%struct.cff_FDSelect) align 8 %101)
  %102 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %102) #3
  store ptr null, ptr %2, align 8, !tbaa !5
  br label %103

103:                                              ; preds = %97, %1
  ret void
}

; Function Attrs: nounwind
declare void @free(ptr noundef) #1

declare void @cff_close_Charset(ptr noundef byval(%struct.cff_Charset) align 8) #2

declare void @cff_close_FDSelect(ptr noundef byval(%struct.cff_FDSelect) align 8) #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 = { nounwind "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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"", !6, i64 0, !11, i64 8, !12, i64 12, !13, i64 14, !14, i64 24, !14, i64 56, !14, i64 88, !14, i64 120, !15, i64 152, !16, i64 176, !16, i64 200, !14, i64 232, !14, i64 264, !14, i64 296}
!11 = !{!"int", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3}
!14 = !{!"", !11, i64 0, !11, i64 4, !7, i64 8, !6, i64 16, !6, i64 24}
!15 = !{!"", !11, i64 0, !7, i64 8}
!16 = !{!"", !11, i64 0, !11, i64 4, !7, i64 8}
!17 = !{!18, !6, i64 24}
!18 = !{!"__caryll_elementinterface_cff_Index", !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}
!19 = !{!10, !11, i64 152}
!20 = !{!7, !7, i64 0}


; 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_cff_Index = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.cff_Charset = type { i32, i32, %union.anon.0 }
%union.anon.0 = type { %struct.cff_CharsetFormat0 }
%struct.cff_CharsetFormat0 = type { i8, ptr }
%struct.cff_FDSelect = type { i32, i32, %union.anon.1 }
%union.anon.1 = type { %struct.cff_FDSelectFormat3 }
%struct.cff_FDSelectFormat3 = type { i8, i16, ptr, i16 }

@cff_iIndex = external local_unnamed_addr constant %struct.__caryll_elementinterface_cff_Index, align 8

; Function Attrs: nounwind uwtable
define dso_local void @cff_close(ptr noundef %0) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %28, label %2

2:                                                ; preds = %1
  %3 = load ptr, ptr %0, align 8, !tbaa !5
  %.not28 = icmp eq ptr %3, null
  br i1 %.not28, label %5, label %4

4:                                                ; preds = %2
  tail call void @free(ptr noundef nonnull %3) #3
  store ptr null, ptr %0, align 8, !tbaa !5
  br label %5

5:                                                ; preds = %4, %2
  %6 = load ptr, ptr getelementptr inbounds (i8, ptr @cff_iIndex, i64 24), align 8, !tbaa !16
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void %6(ptr noundef nonnull %7) #3
  %8 = getelementptr inbounds i8, ptr %0, i64 56
  tail call void %6(ptr noundef nonnull %8) #3
  %9 = getelementptr inbounds i8, ptr %0, i64 88
  tail call void %6(ptr noundef nonnull %9) #3
  %10 = getelementptr inbounds i8, ptr %0, i64 120
  tail call void %6(ptr noundef nonnull %10) #3
  %11 = getelementptr inbounds i8, ptr %0, i64 232
  tail call void %6(ptr noundef nonnull %11) #3
  %12 = getelementptr inbounds i8, ptr %0, i64 264
  tail call void %6(ptr noundef nonnull %12) #3
  %13 = getelementptr inbounds i8, ptr %0, i64 296
  tail call void %6(ptr noundef nonnull %13) #3
  %14 = getelementptr inbounds i8, ptr %0, i64 152
  %15 = load i32, ptr %14, align 8, !tbaa !18
  switch i32 %15, label %25 [
    i32 4, label %22
    i32 3, label %19
    i32 2, label %16
  ]

16:                                               ; preds = %5
  %17 = getelementptr inbounds i8, ptr %0, i64 168
  %18 = load ptr, ptr %17, align 8, !tbaa !19
  %.not29 = icmp eq ptr %18, null
  br i1 %.not29, label %25, label %.sink.split

19:                                               ; preds = %5
  %20 = getelementptr inbounds i8, ptr %0, i64 168
  %21 = load ptr, ptr %20, align 8, !tbaa !19
  %.not30 = icmp eq ptr %21, null
  br i1 %.not30, label %25, label %.sink.split

22:                                               ; preds = %5
  %23 = getelementptr inbounds i8, ptr %0, i64 168
  %24 = load ptr, ptr %23, align 8, !tbaa !19
  %.not31 = icmp eq ptr %24, null
  br i1 %.not31, label %25, label %.sink.split

.sink.split:                                      ; preds = %22, %19, %16
  %.sink32 = phi ptr [ %18, %16 ], [ %21, %19 ], [ %24, %22 ]
  %.sink = phi ptr [ %17, %16 ], [ %20, %19 ], [ %23, %22 ]
  tail call void @free(ptr noundef nonnull %.sink32) #3
  store ptr null, ptr %.sink, align 8, !tbaa !19
  br label %25

25:                                               ; preds = %.sink.split, %22, %19, %16, %5
  %26 = getelementptr inbounds i8, ptr %0, i64 176
  tail call void @cff_close_Charset(ptr noundef nonnull byval(%struct.cff_Charset) align 8 %26) #3
  %27 = getelementptr inbounds i8, ptr %0, i64 200
  tail call void @cff_close_FDSelect(ptr noundef nonnull byval(%struct.cff_FDSelect) align 8 %27) #3
  tail call void @free(ptr noundef nonnull %0) #3
  br label %28

28:                                               ; preds = %25, %1
  ret void
}

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

declare void @cff_close_Charset(ptr noundef byval(%struct.cff_Charset) align 8) local_unnamed_addr #2

declare void @cff_close_FDSelect(ptr noundef byval(%struct.cff_FDSelect) align 8) local_unnamed_addr #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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 0}
!6 = !{!"", !7, i64 0, !10, i64 8, !11, i64 12, !12, i64 14, !13, i64 24, !13, i64 56, !13, i64 88, !13, i64 120, !14, i64 152, !15, i64 176, !15, i64 200, !13, i64 232, !13, i64 264, !13, i64 296}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"short", !8, i64 0}
!12 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3}
!13 = !{!"", !10, i64 0, !10, i64 4, !8, i64 8, !7, i64 16, !7, i64 24}
!14 = !{!"", !10, i64 0, !8, i64 8}
!15 = !{!"", !10, i64 0, !10, i64 4, !8, i64 8}
!16 = !{!17, !7, i64 24}
!17 = !{!"__caryll_elementinterface_cff_Index", !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}
!18 = !{!6, !10, i64 152}
!19 = !{!8, !8, i64 0}


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