; LLVM IR from CerebusOSS/CereLink :: cbhwlib/CCFUtilsBinary.ll (ZN14CCFUtilsBinary13ReadAsPacketsEP8_IO_FILE)

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

%class.CCFUtils = type <{ ptr, ptr, i8, [7 x i8], ptr, i8, [7 x i8], ptr, i32, i32, i32, [4 x i8], ptr, i8, i8, [6 x i8] }>
%"struct.ccf::cbPKT_GENERIC_CB2003_10" = type { i32, i16, i8, i8, [254 x i32] }
%class.CCFUtilsBinary = type { %class.CCFUtils.base, [2 x i8], %"struct.ccf::ccfBinaryData" }
%class.CCFUtils.base = type <{ ptr, ptr, i8, [7 x i8], ptr, i8, [7 x i8], ptr, i32, i32, i32, [4 x i8], ptr, i8, i8 }>
%"struct.ccf::ccfBinaryData" = type <{ [160 x %struct.cbPKT_CHANINFO], %"struct.ccf::cbPKT_ADAPTFILTINFO_CB2005_37", %"struct.ccf::cbPKT_SS_DETECT_CB2005_37", %"struct.ccf::cbPKT_SS_ARTIF_REJECT_CB2005_37", [144 x %"struct.ccf::cbPKT_SS_NOISE_BOUNDARY_CB2005_37_type"], %"struct.ccf::cbPKT_SS_STATISTICS_CB2005_37_type", %"struct.ccf::cbPKT_SS_STATUS_CB2005_37", %"struct.ccf::cbPKT_SYSINFO_CB2005_37", [72 x %"struct.ccf::cbPKT_NTRODEINFO_CB2005_37"] }>
%struct.cbPKT_CHANINFO = type { %struct.cbPKT_HEADER, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.cbSCALING, %struct.cbFILTDESC, %struct.cbSCALING, %struct.cbFILTDESC, [16 x i8], i32, [4 x i32], %struct.cbSCALING, %struct.cbSCALING, i32, i32, i32, i32, %union.anon, i8, [2 x i8], i8, i16, i16, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i32, [5 x %struct.cbMANUALUNITMAPPING], [5 x [4 x %struct.cbHOOP]] }
%struct.cbPKT_HEADER = type { i64, i16, i16, i16, i8, i8 }
%struct.cbFILTDESC = type { [16 x i8], i32, i32, i32, i32, i32, i32 }
%struct.cbSCALING = type { i16, i16, i32, i32, i32, [8 x i8] }
%union.anon = type { %struct.anon }
%struct.anon = type { i16, i16, i32 }
%struct.cbMANUALUNITMAPPING = type { i16, [3 x i16], [3 x [3 x i16]], i16, i32 }
%struct.cbHOOP = type { i16, i16, i16, i16 }
%"struct.ccf::cbPKT_ADAPTFILTINFO_CB2005_37" = type { i32, i16, i8, i8, i32, i32, float, i32, i32 }
%"struct.ccf::cbPKT_SS_DETECT_CB2005_37" = type { i32, i16, i8, i8, float, float }
%"struct.ccf::cbPKT_SS_ARTIF_REJECT_CB2005_37" = type { i32, i16, i8, i8, i32, i32 }
%"struct.ccf::cbPKT_SS_NOISE_BOUNDARY_CB2005_37_type" = type { i32, i16, i8, i8, i32, [3 x float], [3 x [3 x float]] }
%"struct.ccf::cbPKT_SS_STATISTICS_CB2005_37_type" = type { i32, i16, i8, i8, i32, i32, i32, float, float, float, float, float, float, float, i32, i32 }
%"struct.ccf::cbPKT_SS_STATUS_CB2005_37" = type { i32, i16, i8, i8, %"struct.ccf::cbAdaptControl_37", %"struct.ccf::cbAdaptControl_37" }
%"struct.ccf::cbAdaptControl_37" = type { i32, float, float }
%"struct.ccf::cbPKT_SYSINFO_CB2005_37" = type { i32, i16, i8, i8, i32, i32, i32, i32, i32, i32 }
%"struct.ccf::cbPKT_NTRODEINFO_CB2005_37" = type { i32, i16, i8, i8, i32, [16 x i8], [6 x [5 x %"struct.ccf::cbMANUALUNITMAPPING_37"]], i16, i16, [4 x i16] }
%"struct.ccf::cbMANUALUNITMAPPING_37" = type { i16, [3 x i16], [3 x [3 x i16]], i16, i32 }

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

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

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14CCFUtilsBinary13ReadAsPacketsEP8_IO_FILE(ptr noundef nonnull align 8 dereferenceable(189696) %0, ptr noundef %1) #4 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [4096 x i8], align 16
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %15 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4096, ptr %5) #5
  call void @llvm.memset.p0.i64(ptr align 16 %5, i8 0, i64 4096, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %16 = getelementptr inbounds [4096 x i8], ptr %5, i64 0, i64 0
  store ptr %16, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 8, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %17 = getelementptr inbounds [4096 x i8], ptr %5, i64 0, i64 0
  %18 = getelementptr inbounds i8, ptr %17, i64 8
  store ptr %18, ptr %8, align 8, !tbaa !5
  %19 = getelementptr inbounds %class.CCFUtils, ptr %15, i32 0, i32 13
  store i8 0, ptr %19, align 8, !tbaa !11
  br label %20

20:                                               ; preds = %124, %2
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = call i64 @fread(ptr noundef %21, i64 noundef 8, i64 noundef 1, ptr noundef %22)
  %24 = icmp eq i64 1, %23
  br i1 %24, label %25, label %125

25:                                               ; preds = %20
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 1 %26, i8 0, i64 4088, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds %"struct.ccf::cbPKT_GENERIC_CB2003_10", ptr %27, i32 0, i32 3
  %29 = load i8, ptr %28, align 1, !tbaa !14
  %30 = zext i8 %29 to i32
  %31 = mul nsw i32 %30, 4
  store i32 %31, ptr %9, align 4, !tbaa !9
  %32 = load i32, ptr %9, align 4, !tbaa !9
  %33 = zext i32 %32 to i64
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = load i32, ptr %9, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = call i64 @fread(ptr noundef %34, i64 noundef 1, i64 noundef %36, ptr noundef %37)
  %39 = icmp ne i64 %33, %38
  br i1 %39, label %40, label %41

40:                                               ; preds = %25
  store i32 1, ptr %10, align 4
  br label %122

41:                                               ; preds = %25
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds %"struct.ccf::cbPKT_GENERIC_CB2003_10", ptr %42, i32 0, i32 2
  %44 = load i8, ptr %43, align 2, !tbaa !17
  %45 = zext i8 %44 to i32
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %41
  store i32 1, ptr %10, align 4
  br label %122

48:                                               ; preds = %41
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %"struct.ccf::cbPKT_GENERIC_CB2003_10", ptr %49, i32 0, i32 2
  %51 = load i8, ptr %50, align 2, !tbaa !17
  %52 = zext i8 %51 to i32
  %53 = or i32 %52, 128
  %54 = trunc i32 %53 to i8
  store i8 %54, ptr %50, align 2, !tbaa !17
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %"struct.ccf::cbPKT_GENERIC_CB2003_10", ptr %55, i32 0, i32 2
  %57 = load i8, ptr %56, align 2, !tbaa !17
  %58 = zext i8 %57 to i32
  %59 = and i32 %58, 216
  %60 = icmp eq i32 208, %59
  br i1 %60, label %61, label %64

61:                                               ; preds = %48
  %62 = getelementptr inbounds %class.CCFUtils, ptr %15, i32 0, i32 13
  store i8 1, ptr %62, align 8, !tbaa !11
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN14CCFUtilsBinary23ReadSpikeSortingPacketsEPN3ccf23cbPKT_GENERIC_CB2003_10E(ptr noundef nonnull align 8 dereferenceable(189696) %15, ptr noundef %63)
  br label %121

64:                                               ; preds = %48
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %"struct.ccf::cbPKT_GENERIC_CB2003_10", ptr %65, i32 0, i32 2
  %67 = load i8, ptr %66, align 2, !tbaa !17
  %68 = zext i8 %67 to i32
  %69 = and i32 %68, 240
  %70 = icmp eq i32 144, %69
  br i1 %70, label %71, label %78

71:                                               ; preds = %64
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = getelementptr inbounds %"struct.ccf::cbPKT_GENERIC_CB2003_10", ptr %72, i32 0, i32 2
  store i8 -111, ptr %73, align 2, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %74, ptr %11, align 8, !tbaa !5
  %75 = load ptr, ptr %11, align 8, !tbaa !5
  %76 = getelementptr inbounds %class.CCFUtilsBinary, ptr %15, i32 0, i32 2
  %77 = getelementptr inbounds %"struct.ccf::ccfBinaryData", ptr %76, i32 0, i32 7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %77, ptr align 4 %75, i64 32, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %120

78:                                               ; preds = %64
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %"struct.ccf::cbPKT_GENERIC_CB2003_10", ptr %79, i32 0, i32 2
  %81 = load i8, ptr %80, align 2, !tbaa !17
  %82 = zext i8 %81 to i32
  %83 = icmp eq i32 167, %82
  br i1 %83, label %84, label %107

84:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %85 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %85, ptr %12, align 8, !tbaa !5
  %86 = load ptr, ptr %12, align 8, !tbaa !5
  %87 = getelementptr inbounds %"struct.ccf::cbPKT_NTRODEINFO_CB2005_37", ptr %86, i32 0, i32 4
  %88 = load i32, ptr %87, align 4, !tbaa !21
  %89 = icmp ugt i32 %88, 0
  br i1 %89, label %90, label %106

90:                                               ; preds = %84
  %91 = load ptr, ptr %12, align 8, !tbaa !5
  %92 = getelementptr inbounds %"struct.ccf::cbPKT_NTRODEINFO_CB2005_37", ptr %91, i32 0, i32 4
  %93 = load i32, ptr %92, align 4, !tbaa !21
  %94 = icmp ule i32 %93, 72
  br i1 %94, label %95, label %106

95:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %96 = load ptr, ptr %12, align 8, !tbaa !5
  %97 = getelementptr inbounds %"struct.ccf::cbPKT_NTRODEINFO_CB2005_37", ptr %96, i32 0, i32 4
  %98 = load i32, ptr %97, align 4, !tbaa !21
  %99 = sub i32 %98, 1
  store i32 %99, ptr %13, align 4, !tbaa !9
  %100 = load ptr, ptr %12, align 8, !tbaa !5
  %101 = getelementptr inbounds %class.CCFUtilsBinary, ptr %15, i32 0, i32 2
  %102 = getelementptr inbounds %"struct.ccf::ccfBinaryData", ptr %101, i32 0, i32 8
  %103 = load i32, ptr %13, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [72 x %"struct.ccf::cbPKT_NTRODEINFO_CB2005_37"], ptr %102, i64 0, i64 %104
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %105, ptr align 4 %100, i64 1000, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %106

106:                                              ; preds = %95, %90, %84
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %119

107:                                              ; preds = %78
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = getelementptr inbounds %"struct.ccf::cbPKT_GENERIC_CB2003_10", ptr %108, i32 0, i32 2
  %110 = load i8, ptr %109, align 2, !tbaa !17
  %111 = zext i8 %110 to i32
  %112 = icmp eq i32 165, %111
  br i1 %112, label %113, label %118

113:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %114, ptr %14, align 8, !tbaa !5
  %115 = load ptr, ptr %14, align 8, !tbaa !5
  %116 = getelementptr inbounds %class.CCFUtilsBinary, ptr %15, i32 0, i32 2
  %117 = getelementptr inbounds %"struct.ccf::ccfBinaryData", ptr %116, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %117, ptr align 4 %115, i64 28, i1 false), !tbaa.struct !24
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %118

118:                                              ; preds = %113, %107
  br label %119

119:                                              ; preds = %118, %106
  br label %120

120:                                              ; preds = %119, %71
  br label %121

121:                                              ; preds = %120, %61
  store i32 0, ptr %10, align 4
  br label %122

122:                                              ; preds = %121, %47, %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  %123 = load i32, ptr %10, align 4
  switch i32 %123, label %149 [
    i32 0, label %124
  ]

124:                                              ; preds = %122
  br label %20, !llvm.loop !27

125:                                              ; preds = %20
  %126 = getelementptr inbounds %class.CCFUtils, ptr %15, i32 0, i32 9
  %127 = load i32, ptr %126, align 4, !tbaa !29
  %128 = icmp slt i32 %127, 8
  br i1 %128, label %129, label %148

129:                                              ; preds = %125
  %130 = getelementptr inbounds %class.CCFUtils, ptr %15, i32 0, i32 13
  %131 = load i8, ptr %130, align 8, !tbaa !11, !range !30, !noundef !31
  %132 = trunc i8 %131 to i1
  br i1 %132, label %148, label %133

133:                                              ; preds = %129
  %134 = getelementptr inbounds %class.CCFUtilsBinary, ptr %15, i32 0, i32 2
  %135 = getelementptr inbounds %"struct.ccf::ccfBinaryData", ptr %134, i32 0, i32 6
  %136 = getelementptr inbounds %"struct.ccf::cbPKT_SS_STATUS_CB2005_37", ptr %135, i32 0, i32 2
  store i8 -41, ptr %136, align 2, !tbaa !32
  %137 = getelementptr inbounds %class.CCFUtilsBinary, ptr %15, i32 0, i32 2
  %138 = getelementptr inbounds %"struct.ccf::ccfBinaryData", ptr %137, i32 0, i32 6
  %139 = getelementptr inbounds %"struct.ccf::cbPKT_SS_STATUS_CB2005_37", ptr %138, i32 0, i32 3
  store i8 6, ptr %139, align 1, !tbaa !42
  %140 = getelementptr inbounds %class.CCFUtilsBinary, ptr %15, i32 0, i32 2
  %141 = getelementptr inbounds %"struct.ccf::ccfBinaryData", ptr %140, i32 0, i32 6
  %142 = getelementptr inbounds %"struct.ccf::cbPKT_SS_STATUS_CB2005_37", ptr %141, i32 0, i32 5
  %143 = getelementptr inbounds %"struct.ccf::cbAdaptControl_37", ptr %142, i32 0, i32 2
  store float 9.900000e+01, ptr %143, align 4, !tbaa !43
  %144 = getelementptr inbounds %class.CCFUtilsBinary, ptr %15, i32 0, i32 2
  %145 = getelementptr inbounds %"struct.ccf::ccfBinaryData", ptr %144, i32 0, i32 6
  %146 = getelementptr inbounds %"struct.ccf::cbPKT_SS_STATUS_CB2005_37", ptr %145, i32 0, i32 4
  %147 = getelementptr inbounds %"struct.ccf::cbAdaptControl_37", ptr %146, i32 0, i32 2
  store float 9.900000e+01, ptr %147, align 4, !tbaa !44
  br label %148

148:                                              ; preds = %133, %129, %125
  store i32 0, ptr %10, align 4
  br label %149

149:                                              ; preds = %148, %122
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4096, ptr %5) #5
  %150 = load i32, ptr %10, align 4
  switch i32 %150, label %152 [
    i32 0, label %151
    i32 1, label %151
  ]

151:                                              ; preds = %149, %149
  ret void

152:                                              ; preds = %149
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN14CCFUtilsBinary23ReadSpikeSortingPacketsEPN3ccf23cbPKT_GENERIC_CB2003_10E(ptr noundef nonnull align 8 dereferenceable(189696), ptr noundef) #4 align 2

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress 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 #5 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 72}
!12 = !{!"_ZTS8CCFUtils", !6, i64 8, !13, i64 16, !6, i64 24, !13, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !6, i64 64, !13, i64 72, !13, i64 73}
!13 = !{!"bool", !7, i64 0}
!14 = !{!15, !7, i64 7}
!15 = !{!"_ZTSN3ccf23cbPKT_GENERIC_CB2003_10E", !10, i64 0, !16, i64 4, !7, i64 6, !7, i64 7, !7, i64 8}
!16 = !{!"short", !7, i64 0}
!17 = !{!15, !7, i64 6}
!18 = !{i64 0, i64 4, !9, i64 4, i64 2, !19, i64 6, i64 1, !20, i64 7, i64 1, !20, i64 8, i64 4, !9, i64 12, i64 4, !9, i64 16, i64 4, !9, i64 20, i64 4, !9, i64 24, i64 4, !9, i64 28, i64 4, !9}
!19 = !{!16, !16, i64 0}
!20 = !{!7, !7, i64 0}
!21 = !{!22, !10, i64 8}
!22 = !{!"_ZTSN3ccf26cbPKT_NTRODEINFO_CB2005_37E", !10, i64 0, !16, i64 4, !7, i64 6, !7, i64 7, !10, i64 8, !7, i64 12, !7, i64 28, !16, i64 988, !16, i64 990, !7, i64 992}
!23 = !{i64 0, i64 4, !9, i64 4, i64 2, !19, i64 6, i64 1, !20, i64 7, i64 1, !20, i64 8, i64 4, !9, i64 12, i64 16, !20, i64 28, i64 960, !20, i64 988, i64 2, !19, i64 990, i64 2, !19, i64 992, i64 8, !20}
!24 = !{i64 0, i64 4, !9, i64 4, i64 2, !19, i64 6, i64 1, !20, i64 7, i64 1, !20, i64 8, i64 4, !9, i64 12, i64 4, !9, i64 16, i64 4, !25, i64 20, i64 4, !9, i64 24, i64 4, !9}
!25 = !{!26, !26, i64 0}
!26 = !{!"float", !7, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!12, !10, i64 52}
!30 = !{i8 0, i8 2}
!31 = !{}
!32 = !{!33, !7, i64 117638}
!33 = !{!"_ZTS14CCFUtilsBinary", !12, i64 0, !34, i64 76}
!34 = !{!"_ZTSN3ccf13ccfBinaryDataE", !7, i64 0, !35, i64 108800, !36, i64 108828, !37, i64 108844, !7, i64 108860, !38, i64 117500, !39, i64 117556, !41, i64 117588, !7, i64 117620}
!35 = !{!"_ZTSN3ccf29cbPKT_ADAPTFILTINFO_CB2005_37E", !10, i64 0, !16, i64 4, !7, i64 6, !7, i64 7, !10, i64 8, !10, i64 12, !26, i64 16, !10, i64 20, !10, i64 24}
!36 = !{!"_ZTSN3ccf25cbPKT_SS_DETECT_CB2005_37E", !10, i64 0, !16, i64 4, !7, i64 6, !7, i64 7, !26, i64 8, !26, i64 12}
!37 = !{!"_ZTSN3ccf31cbPKT_SS_ARTIF_REJECT_CB2005_37E", !10, i64 0, !16, i64 4, !7, i64 6, !7, i64 7, !10, i64 8, !10, i64 12}
!38 = !{!"_ZTSN3ccf34cbPKT_SS_STATISTICS_CB2005_37_typeE", !10, i64 0, !16, i64 4, !7, i64 6, !7, i64 7, !10, i64 8, !10, i64 12, !10, i64 16, !26, i64 20, !26, i64 24, !26, i64 28, !26, i64 32, !26, i64 36, !26, i64 40, !26, i64 44, !10, i64 48, !10, i64 52}
!39 = !{!"_ZTSN3ccf25cbPKT_SS_STATUS_CB2005_37E", !10, i64 0, !16, i64 4, !7, i64 6, !7, i64 7, !40, i64 8, !40, i64 20}
!40 = !{!"_ZTSN3ccf17cbAdaptControl_37E", !10, i64 0, !26, i64 4, !26, i64 8}
!41 = !{!"_ZTSN3ccf23cbPKT_SYSINFO_CB2005_37E", !10, i64 0, !16, i64 4, !7, i64 6, !7, i64 7, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!42 = !{!33, !7, i64 117639}
!43 = !{!33, !26, i64 117660}
!44 = !{!33, !26, i64 117648}


; 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.ccf::cbPKT_NTRODEINFO_CB2005_37" = type { i32, i16, i8, i8, i32, [16 x i8], [6 x [5 x %"struct.ccf::cbMANUALUNITMAPPING_37"]], i16, i16, [4 x i16] }
%"struct.ccf::cbMANUALUNITMAPPING_37" = type { i16, [3 x i16], [3 x [3 x i16]], i16, i32 }

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

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

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14CCFUtilsBinary13ReadAsPacketsEP8_IO_FILE(ptr noundef nonnull align 8 dereferenceable(189696) %0, ptr nocapture noundef %1) local_unnamed_addr #4 align 2 {
  %3 = alloca [4096 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %3) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4096) %3, i8 0, i64 4096, i1 false)
  %4 = getelementptr inbounds i8, ptr %3, i64 8
  %5 = getelementptr inbounds i8, ptr %0, i64 72
  store i8 0, ptr %5, align 8, !tbaa !5
  %6 = call i64 @fread(ptr noundef nonnull %3, i64 noundef 8, i64 noundef 1, ptr noundef %1)
  %7 = icmp eq i64 %6, 1
  br i1 %7, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2
  %8 = getelementptr inbounds i8, ptr %3, i64 7
  %9 = getelementptr inbounds i8, ptr %3, i64 6
  %10 = getelementptr inbounds i8, ptr %0, i64 108876
  %11 = getelementptr inbounds i8, ptr %0, i64 117696
  %12 = getelementptr inbounds i8, ptr %0, i64 117664
  br label %13

13:                                               ; preds = %.lr.ph, %39
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(4088) %4, i8 0, i64 4088, i1 false)
  %14 = load i8, ptr %8, align 1, !tbaa !12
  %15 = zext i8 %14 to i64
  %16 = shl nuw nsw i64 %15, 2
  %17 = call i64 @fread(ptr noundef nonnull %4, i64 noundef 1, i64 noundef %16, ptr noundef %1)
  %.not = icmp eq i64 %16, %17
  br i1 %.not, label %18, label %.critedge

18:                                               ; preds = %13
  %19 = load i8, ptr %9, align 2, !tbaa !15
  %20 = icmp eq i8 %19, 0
  br i1 %20, label %.critedge, label %21

21:                                               ; preds = %18
  %22 = or i8 %19, -128
  store i8 %22, ptr %9, align 2, !tbaa !15
  %23 = zext i8 %22 to i32
  %24 = and i32 %23, 216
  %25 = icmp eq i32 %24, 208
  br i1 %25, label %26, label %27

26:                                               ; preds = %21
  store i8 1, ptr %5, align 8, !tbaa !5
  call void @_ZN14CCFUtilsBinary23ReadSpikeSortingPacketsEPN3ccf23cbPKT_GENERIC_CB2003_10E(ptr noundef nonnull align 8 dereferenceable(189696) %0, ptr noundef nonnull %3)
  br label %39

27:                                               ; preds = %21
  %28 = and i32 %23, 240
  %29 = icmp eq i32 %28, 144
  br i1 %29, label %30, label %31

30:                                               ; preds = %27
  store i8 -111, ptr %9, align 2, !tbaa !15
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull align 16 dereferenceable(32) %3, i64 32, i1 false), !tbaa.struct !16
  br label %39

31:                                               ; preds = %27
  switch i8 %22, label %39 [
    i8 -89, label %32
    i8 -91, label %38
  ]

32:                                               ; preds = %31
  %33 = load i32, ptr %4, align 8, !tbaa !20
  %34 = add i32 %33, -1
  %or.cond = icmp ult i32 %34, 72
  br i1 %or.cond, label %35, label %39

35:                                               ; preds = %32
  %36 = zext nneg i32 %34 to i64
  %37 = getelementptr inbounds [72 x %"struct.ccf::cbPKT_NTRODEINFO_CB2005_37"], ptr %11, i64 0, i64 %36
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(1000) %37, ptr noundef nonnull align 16 dereferenceable(1000) %3, i64 1000, i1 false), !tbaa.struct !22
  br label %39

38:                                               ; preds = %31
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(28) %10, ptr noundef nonnull align 16 dereferenceable(28) %3, i64 28, i1 false), !tbaa.struct !23
  br label %39

39:                                               ; preds = %26, %38, %30, %35, %32, %31
  %40 = call i64 @fread(ptr noundef nonnull %3, i64 noundef 8, i64 noundef 1, ptr noundef %1)
  %41 = icmp eq i64 %40, 1
  br i1 %41, label %13, label %._crit_edge, !llvm.loop !26

._crit_edge:                                      ; preds = %39, %2
  %42 = getelementptr inbounds i8, ptr %0, i64 52
  %43 = load i32, ptr %42, align 4, !tbaa !28
  %44 = icmp slt i32 %43, 8
  br i1 %44, label %45, label %.critedge

45:                                               ; preds = %._crit_edge
  %46 = load i8, ptr %5, align 8, !tbaa !5, !range !29, !noundef !30
  %47 = trunc nuw i8 %46 to i1
  br i1 %47, label %.critedge, label %48

48:                                               ; preds = %45
  %49 = getelementptr inbounds i8, ptr %0, i64 117638
  store i8 -41, ptr %49, align 2, !tbaa !31
  %50 = getelementptr inbounds i8, ptr %0, i64 117639
  store i8 6, ptr %50, align 1, !tbaa !41
  %51 = getelementptr inbounds i8, ptr %0, i64 117660
  store float 9.900000e+01, ptr %51, align 4, !tbaa !42
  %52 = getelementptr inbounds i8, ptr %0, i64 117648
  store float 9.900000e+01, ptr %52, align 8, !tbaa !43
  br label %.critedge

.critedge:                                        ; preds = %13, %18, %._crit_edge, %45, %48
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %3) #5
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN14CCFUtilsBinary23ReadSpikeSortingPacketsEPN3ccf23cbPKT_GENERIC_CB2003_10E(ptr noundef nonnull align 8 dereferenceable(189696), ptr noundef) local_unnamed_addr #4 align 2

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress 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 #5 = { 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 72}
!6 = !{!"_ZTS8CCFUtils", !7, i64 8, !10, i64 16, !7, i64 24, !10, i64 32, !7, i64 40, !11, i64 48, !11, i64 52, !11, i64 56, !7, i64 64, !10, i64 72, !10, i64 73}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!13, !8, i64 7}
!13 = !{!"_ZTSN3ccf23cbPKT_GENERIC_CB2003_10E", !11, i64 0, !14, i64 4, !8, i64 6, !8, i64 7, !8, i64 8}
!14 = !{!"short", !8, i64 0}
!15 = !{!13, !8, i64 6}
!16 = !{i64 0, i64 4, !17, i64 4, i64 2, !18, i64 6, i64 1, !19, i64 7, i64 1, !19, i64 8, i64 4, !17, i64 12, i64 4, !17, i64 16, i64 4, !17, i64 20, i64 4, !17, i64 24, i64 4, !17, i64 28, i64 4, !17}
!17 = !{!11, !11, i64 0}
!18 = !{!14, !14, i64 0}
!19 = !{!8, !8, i64 0}
!20 = !{!21, !11, i64 8}
!21 = !{!"_ZTSN3ccf26cbPKT_NTRODEINFO_CB2005_37E", !11, i64 0, !14, i64 4, !8, i64 6, !8, i64 7, !11, i64 8, !8, i64 12, !8, i64 28, !14, i64 988, !14, i64 990, !8, i64 992}
!22 = !{i64 0, i64 4, !17, i64 4, i64 2, !18, i64 6, i64 1, !19, i64 7, i64 1, !19, i64 8, i64 4, !17, i64 12, i64 16, !19, i64 28, i64 960, !19, i64 988, i64 2, !18, i64 990, i64 2, !18, i64 992, i64 8, !19}
!23 = !{i64 0, i64 4, !17, i64 4, i64 2, !18, i64 6, i64 1, !19, i64 7, i64 1, !19, i64 8, i64 4, !17, i64 12, i64 4, !17, i64 16, i64 4, !24, i64 20, i64 4, !17, i64 24, i64 4, !17}
!24 = !{!25, !25, i64 0}
!25 = !{!"float", !8, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!6, !11, i64 52}
!29 = !{i8 0, i8 2}
!30 = !{}
!31 = !{!32, !8, i64 117638}
!32 = !{!"_ZTS14CCFUtilsBinary", !6, i64 0, !33, i64 76}
!33 = !{!"_ZTSN3ccf13ccfBinaryDataE", !8, i64 0, !34, i64 108800, !35, i64 108828, !36, i64 108844, !8, i64 108860, !37, i64 117500, !38, i64 117556, !40, i64 117588, !8, i64 117620}
!34 = !{!"_ZTSN3ccf29cbPKT_ADAPTFILTINFO_CB2005_37E", !11, i64 0, !14, i64 4, !8, i64 6, !8, i64 7, !11, i64 8, !11, i64 12, !25, i64 16, !11, i64 20, !11, i64 24}
!35 = !{!"_ZTSN3ccf25cbPKT_SS_DETECT_CB2005_37E", !11, i64 0, !14, i64 4, !8, i64 6, !8, i64 7, !25, i64 8, !25, i64 12}
!36 = !{!"_ZTSN3ccf31cbPKT_SS_ARTIF_REJECT_CB2005_37E", !11, i64 0, !14, i64 4, !8, i64 6, !8, i64 7, !11, i64 8, !11, i64 12}
!37 = !{!"_ZTSN3ccf34cbPKT_SS_STATISTICS_CB2005_37_typeE", !11, i64 0, !14, i64 4, !8, i64 6, !8, i64 7, !11, i64 8, !11, i64 12, !11, i64 16, !25, i64 20, !25, i64 24, !25, i64 28, !25, i64 32, !25, i64 36, !25, i64 40, !25, i64 44, !11, i64 48, !11, i64 52}
!38 = !{!"_ZTSN3ccf25cbPKT_SS_STATUS_CB2005_37E", !11, i64 0, !14, i64 4, !8, i64 6, !8, i64 7, !39, i64 8, !39, i64 20}
!39 = !{!"_ZTSN3ccf17cbAdaptControl_37E", !11, i64 0, !25, i64 4, !25, i64 8}
!40 = !{!"_ZTSN3ccf23cbPKT_SYSINFO_CB2005_37E", !11, i64 0, !14, i64 4, !8, i64 6, !8, i64 7, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28}
!41 = !{!32, !8, i64 117639}
!42 = !{!32, !25, i64 117660}
!43 = !{!32, !25, i64 117648}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass