; LLVM IR from sylefeb/Silixel :: src/fstapi (fstapi)

; 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.fstReaderContext = type { ptr, ptr, i64, i64, i64, i64, i64, i32, i64, i64, ptr, ptr, ptr, i32, ptr, i8, i8, i8, [129 x i8], [120 x i8], i64, ptr, ptr, i64, i32, ptr, ptr, i64, i64, i8, ptr, i64, i64, ptr, i64, ptr, ptr, i64, i64, ptr, i32, i32, ptr, i32, i32, i32, i64, i8, %struct.fstHier, ptr, i32, ptr, i32, i8, [513 x i8], [513 x i8], ptr, i8, i32, i32, [65536 x i8], ptr, ptr }
%struct.fstHier = type { i8, %union.anon }
%union.anon = type { %struct.fstHierAttr }
%struct.fstHierAttr = type { i8, i8, ptr, i64, i64, i32 }

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

; Function Attrs: nounwind
declare i32 @unlink(ptr noundef) #0

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

; Function Attrs: nounwind uwtable
define dso_local void @fstReaderClose(ptr noundef %0) #1 {
  %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 %87

5:                                                ; preds = %1
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  call void @fstReaderDeallocateScopeData(ptr noundef %6)
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  call void @fstReaderDeallocateRvatData(ptr noundef %7)
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.fstReaderContext, ptr %8, i32 0, i32 39
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  call void @free(ptr noundef %10) #2
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.fstReaderContext, ptr %11, i32 0, i32 39
  store ptr null, ptr %12, align 8, !tbaa !9
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.fstReaderContext, ptr %13, i32 0, i32 12
  %15 = load ptr, ptr %14, align 8, !tbaa !14
  call void @free(ptr noundef %15) #2
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.fstReaderContext, ptr %16, i32 0, i32 12
  store ptr null, ptr %17, align 8, !tbaa !14
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.fstReaderContext, ptr %18, i32 0, i32 25
  %20 = load ptr, ptr %19, align 8, !tbaa !15
  call void @free(ptr noundef %20) #2
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.fstReaderContext, ptr %21, i32 0, i32 25
  store ptr null, ptr %22, align 8, !tbaa !15
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.fstReaderContext, ptr %23, i32 0, i32 26
  %25 = load ptr, ptr %24, align 8, !tbaa !16
  call void @free(ptr noundef %25) #2
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.fstReaderContext, ptr %26, i32 0, i32 26
  store ptr null, ptr %27, align 8, !tbaa !16
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.fstReaderContext, ptr %28, i32 0, i32 14
  %30 = load ptr, ptr %29, align 8, !tbaa !17
  call void @free(ptr noundef %30) #2
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.fstReaderContext, ptr %31, i32 0, i32 14
  store ptr null, ptr %32, align 8, !tbaa !17
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.fstReaderContext, ptr %33, i32 0, i32 11
  %35 = load ptr, ptr %34, align 8, !tbaa !18
  call void @free(ptr noundef %35) #2
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.fstReaderContext, ptr %36, i32 0, i32 11
  store ptr null, ptr %37, align 8, !tbaa !18
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.fstReaderContext, ptr %38, i32 0, i32 10
  %40 = load ptr, ptr %39, align 8, !tbaa !19
  call void @free(ptr noundef %40) #2
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.fstReaderContext, ptr %41, i32 0, i32 10
  store ptr null, ptr %42, align 8, !tbaa !19
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.fstReaderContext, ptr %43, i32 0, i32 21
  %45 = load ptr, ptr %44, align 8, !tbaa !20
  call void @free(ptr noundef %45) #2
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.fstReaderContext, ptr %46, i32 0, i32 21
  store ptr null, ptr %47, align 8, !tbaa !20
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.fstReaderContext, ptr %48, i32 0, i32 56
  %50 = load ptr, ptr %49, align 8, !tbaa !21
  call void @free(ptr noundef %50) #2
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.fstReaderContext, ptr %51, i32 0, i32 56
  store ptr null, ptr %52, align 8, !tbaa !21
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.fstReaderContext, ptr %53, i32 0, i32 1
  %55 = load ptr, ptr %54, align 8, !tbaa !22
  %56 = icmp ne ptr %55, null
  br i1 %56, label %57, label %62

57:                                               ; preds = %5
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.fstReaderContext, ptr %58, i32 0, i32 1
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.fstReaderContext, ptr %60, i32 0, i32 62
  call void @tmpfile_close(ptr noundef %59, ptr noundef %61)
  br label %62

62:                                               ; preds = %57, %5
  %63 = load ptr, ptr %2, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.fstReaderContext, ptr %63, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8, !tbaa !23
  %66 = icmp ne ptr %65, null
  br i1 %66, label %67, label %85

67:                                               ; preds = %62
  %68 = load ptr, ptr %2, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.fstReaderContext, ptr %68, i32 0, i32 0
  %70 = load ptr, ptr %2, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.fstReaderContext, ptr %70, i32 0, i32 61
  call void @tmpfile_close(ptr noundef %69, ptr noundef %71)
  %72 = load ptr, ptr %2, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.fstReaderContext, ptr %72, i32 0, i32 22
  %74 = load ptr, ptr %73, align 8, !tbaa !24
  %75 = icmp ne ptr %74, null
  br i1 %75, label %76, label %84

76:                                               ; preds = %67
  %77 = load ptr, ptr %2, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.fstReaderContext, ptr %77, i32 0, i32 22
  %79 = load ptr, ptr %78, align 8, !tbaa !24
  %80 = call i32 @unlink(ptr noundef %79) #2
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.fstReaderContext, ptr %81, i32 0, i32 22
  %83 = load ptr, ptr %82, align 8, !tbaa !24
  call void @free(ptr noundef %83) #2
  br label %84

84:                                               ; preds = %76, %67
  br label %85

85:                                               ; preds = %84, %62
  %86 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %86) #2
  br label %87

87:                                               ; preds = %85, %1
  ret void
}

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

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

attributes #0 = { 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 #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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 528}
!10 = !{!"fstReaderContext", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !12, i64 56, !11, i64 64, !11, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !12, i64 104, !6, i64 112, !7, i64 120, !7, i64 121, !12, i64 122, !12, i64 122, !12, i64 122, !12, i64 122, !12, i64 122, !12, i64 122, !12, i64 122, !12, i64 122, !7, i64 123, !7, i64 252, !11, i64 376, !6, i64 384, !6, i64 392, !11, i64 400, !12, i64 408, !6, i64 416, !6, i64 424, !11, i64 432, !11, i64 440, !12, i64 448, !6, i64 456, !11, i64 464, !11, i64 472, !6, i64 480, !11, i64 488, !6, i64 496, !6, i64 504, !11, i64 512, !11, i64 520, !6, i64 528, !12, i64 536, !12, i64 540, !6, i64 544, !12, i64 552, !12, i64 556, !12, i64 560, !11, i64 568, !12, i64 576, !13, i64 584, !6, i64 632, !12, i64 640, !6, i64 648, !12, i64 656, !12, i64 660, !7, i64 661, !7, i64 1174, !6, i64 1688, !12, i64 1696, !12, i64 1700, !12, i64 1704, !7, i64 1708, !6, i64 67248, !6, i64 67256}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"fstHier", !7, i64 0, !7, i64 8}
!14 = !{!10, !6, i64 96}
!15 = !{!10, !6, i64 416}
!16 = !{!10, !6, i64 424}
!17 = !{!10, !6, i64 112}
!18 = !{!10, !6, i64 88}
!19 = !{!10, !6, i64 80}
!20 = !{!10, !6, i64 384}
!21 = !{!10, !6, i64 1688}
!22 = !{!10, !6, i64 8}
!23 = !{!10, !6, i64 0}
!24 = !{!10, !6, i64 392}


; 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"

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

; Function Attrs: nofree nounwind
declare noundef i32 @unlink(ptr nocapture noundef readonly) local_unnamed_addr #1

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

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

2:                                                ; preds = %1
  tail call void @fstReaderDeallocateScopeData(ptr noundef nonnull %0)
  tail call void @fstReaderDeallocateRvatData(ptr noundef nonnull %0)
  %3 = getelementptr inbounds i8, ptr %0, i64 528
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  tail call void @free(ptr noundef %4) #3
  store ptr null, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 96
  %6 = load ptr, ptr %5, align 8, !tbaa !13
  tail call void @free(ptr noundef %6) #3
  store ptr null, ptr %5, align 8, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %0, i64 416
  %8 = load ptr, ptr %7, align 8, !tbaa !14
  tail call void @free(ptr noundef %8) #3
  store ptr null, ptr %7, align 8, !tbaa !14
  %9 = getelementptr inbounds i8, ptr %0, i64 424
  %10 = load ptr, ptr %9, align 8, !tbaa !15
  tail call void @free(ptr noundef %10) #3
  store ptr null, ptr %9, align 8, !tbaa !15
  %11 = getelementptr inbounds i8, ptr %0, i64 112
  %12 = load ptr, ptr %11, align 8, !tbaa !16
  tail call void @free(ptr noundef %12) #3
  store ptr null, ptr %11, align 8, !tbaa !16
  %13 = getelementptr inbounds i8, ptr %0, i64 88
  %14 = load ptr, ptr %13, align 8, !tbaa !17
  tail call void @free(ptr noundef %14) #3
  store ptr null, ptr %13, align 8, !tbaa !17
  %15 = getelementptr inbounds i8, ptr %0, i64 80
  %16 = load ptr, ptr %15, align 8, !tbaa !18
  tail call void @free(ptr noundef %16) #3
  store ptr null, ptr %15, align 8, !tbaa !18
  %17 = getelementptr inbounds i8, ptr %0, i64 384
  %18 = load ptr, ptr %17, align 8, !tbaa !19
  tail call void @free(ptr noundef %18) #3
  store ptr null, ptr %17, align 8, !tbaa !19
  %19 = getelementptr inbounds i8, ptr %0, i64 1688
  %20 = load ptr, ptr %19, align 8, !tbaa !20
  tail call void @free(ptr noundef %20) #3
  store ptr null, ptr %19, align 8, !tbaa !20
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  %22 = load ptr, ptr %21, align 8, !tbaa !21
  %.not32 = icmp eq ptr %22, null
  br i1 %.not32, label %25, label %23

23:                                               ; preds = %2
  %24 = getelementptr inbounds i8, ptr %0, i64 67256
  tail call void @tmpfile_close(ptr noundef nonnull %21, ptr noundef nonnull %24)
  br label %25

25:                                               ; preds = %23, %2
  %26 = load ptr, ptr %0, align 8, !tbaa !22
  %.not33 = icmp eq ptr %26, null
  br i1 %.not33, label %34, label %27

27:                                               ; preds = %25
  %28 = getelementptr inbounds i8, ptr %0, i64 67248
  tail call void @tmpfile_close(ptr noundef nonnull %0, ptr noundef nonnull %28)
  %29 = getelementptr inbounds i8, ptr %0, i64 392
  %30 = load ptr, ptr %29, align 8, !tbaa !23
  %.not34 = icmp eq ptr %30, null
  br i1 %.not34, label %34, label %31

31:                                               ; preds = %27
  %32 = tail call i32 @unlink(ptr noundef nonnull %30) #3
  %33 = load ptr, ptr %29, align 8, !tbaa !23
  tail call void @free(ptr noundef %33) #3
  br label %34

34:                                               ; preds = %27, %31, %25
  tail call void @free(ptr noundef nonnull %0) #3
  br label %35

35:                                               ; preds = %34, %1
  ret void
}

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

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

attributes #0 = { 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 #1 = { nofree 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 = { 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 528}
!6 = !{!"fstReaderContext", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !11, i64 56, !10, i64 64, !10, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !11, i64 104, !7, i64 112, !8, i64 120, !8, i64 121, !11, i64 122, !11, i64 122, !11, i64 122, !11, i64 122, !11, i64 122, !11, i64 122, !11, i64 122, !11, i64 122, !8, i64 123, !8, i64 252, !10, i64 376, !7, i64 384, !7, i64 392, !10, i64 400, !11, i64 408, !7, i64 416, !7, i64 424, !10, i64 432, !10, i64 440, !11, i64 448, !7, i64 456, !10, i64 464, !10, i64 472, !7, i64 480, !10, i64 488, !7, i64 496, !7, i64 504, !10, i64 512, !10, i64 520, !7, i64 528, !11, i64 536, !11, i64 540, !7, i64 544, !11, i64 552, !11, i64 556, !11, i64 560, !10, i64 568, !11, i64 576, !12, i64 584, !7, i64 632, !11, i64 640, !7, i64 648, !11, i64 656, !11, i64 660, !8, i64 661, !8, i64 1174, !7, i64 1688, !11, i64 1696, !11, i64 1700, !11, i64 1704, !8, i64 1708, !7, i64 67248, !7, i64 67256}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"fstHier", !8, i64 0, !8, i64 8}
!13 = !{!6, !7, i64 96}
!14 = !{!6, !7, i64 416}
!15 = !{!6, !7, i64 424}
!16 = !{!6, !7, i64 112}
!17 = !{!6, !7, i64 88}
!18 = !{!6, !7, i64 80}
!19 = !{!6, !7, i64 384}
!20 = !{!6, !7, i64 1688}
!21 = !{!6, !7, i64 8}
!22 = !{!6, !7, i64 0}
!23 = !{!6, !7, i64 392}


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