; LLVM IR from CerebusOSS/CereLink :: cbhwlib/cbHwlibHi.ll (Z17cbIsChanUnitValidjij)

; 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.cbMANUALUNITMAPPING = type { i16, [3 x i16], [3 x [3 x i16]], i16, i32 }
%struct.cbCFGBUFF = type <{ i32, i32, %struct.cbOPTIONTABLE, %struct.cbCOLORTABLE, %struct.cbPKT_SYSINFO, [3 x %struct.cbPKT_PROCINFO], [3 x [22 x %struct.cbPKT_BANKINFO]], [3 x [8 x %struct.cbPKT_GROUPINFO]], [3 x [32 x %struct.cbPKT_FILTINFO]], [3 x %struct.cbPKT_ADAPTFILTINFO], [3 x %struct.cbPKT_REFELECFILTINFO], [596 x %struct.cbPKT_CHANINFO], %struct.cbSPIKE_SORTING, [280 x %struct.cbPKT_NTRODEINFO], [18 x [5 x %struct.cbPKT_AOUT_WAVEFORM]], [3 x %struct.cbPKT_LNC], %struct.cbPKT_NPLAY, [1 x %struct.cbVIDEOSOURCE], [20 x %struct.cbTRACKOBJ], %struct.cbPKT_FILECFG, ptr }>
%struct.cbOPTIONTABLE = type { float, [31 x i32] }
%struct.cbCOLORTABLE = type { [48 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, [16 x i32], i32, [3 x i32], [5 x i32], [14 x i32] }
%struct.cbPKT_SYSINFO = type { %struct.cbPKT_HEADER, i32, i32, i32, i32, i32, i32 }
%struct.cbPKT_HEADER = type { i64, i16, i16, i16, i8, i8 }
%struct.cbPKT_PROCINFO = type { %struct.cbPKT_HEADER, i32, i32, [64 x i8], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.cbPKT_BANKINFO = type <{ %struct.cbPKT_HEADER, i32, i32, i32, [64 x i8], [16 x i8], i32, i32 }>
%struct.cbPKT_GROUPINFO = type { %struct.cbPKT_HEADER, i32, i32, [16 x i8], i32, i32, [560 x i16] }
%struct.cbPKT_FILTINFO = type { %struct.cbPKT_HEADER, i32, i32, [16 x i8], i32, i32, i32, i32, i32, i32, double, double, double, double, double, double, double, double, double }
%struct.cbPKT_ADAPTFILTINFO = type <{ %struct.cbPKT_HEADER, i32, i32, float, i32, i32 }>
%struct.cbPKT_REFELECFILTINFO = type <{ %struct.cbPKT_HEADER, i32, i32, i32 }>
%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.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.cbHOOP = type { i16, i16, i16, i16 }
%struct.cbSPIKE_SORTING = type { [596 x %struct.cbPKT_FS_BASIS], [596 x [7 x %struct.cbPKT_SS_MODELSET]], %struct.cbPKT_SS_DETECT, %struct.cbPKT_SS_ARTIF_REJECT, [596 x %struct.cbPKT_SS_NOISE_BOUNDARY], %struct.cbPKT_SS_STATISTICS, %struct.cbPKT_SS_STATUS }
%struct.cbPKT_FS_BASIS = type <{ %struct.cbPKT_HEADER, i32, i32, i32, [128 x [3 x float]] }>
%struct.cbPKT_SS_MODELSET = type <{ %struct.cbPKT_HEADER, i32, i32, i32, i32, i32, [2 x float], [2 x [2 x float]], float, [2 x [2 x float]], float, float, float, float, float }>
%struct.cbPKT_SS_DETECT = type { %struct.cbPKT_HEADER, float, float }
%struct.cbPKT_SS_ARTIF_REJECT = type { %struct.cbPKT_HEADER, i32, i32 }
%struct.cbPKT_SS_NOISE_BOUNDARY = type <{ %struct.cbPKT_HEADER, i32, [3 x float], [3 x [3 x float]] }>
%struct.cbPKT_SS_STATISTICS = type { %struct.cbPKT_HEADER, i32, i32, i32, float, float, float, float, float, float, float, i32, i32 }
%struct.cbPKT_SS_STATUS = type { %struct.cbPKT_HEADER, %struct.cbAdaptControl, %struct.cbAdaptControl }
%struct.cbAdaptControl = type { i32, float, float }
%struct.cbPKT_NTRODEINFO = type { %struct.cbPKT_HEADER, i32, [16 x i8], [6 x [5 x %struct.cbMANUALUNITMAPPING]], i16, i16, [4 x i16] }
%struct.cbPKT_AOUT_WAVEFORM = type { %struct.cbPKT_HEADER, i16, i16, i32, i8, i8, i16, i16, i8, i8, %struct.cbWaveformData }
%struct.cbWaveformData = type { i16, %union.anon.1 }
%union.anon.1 = type { %struct.anon.3 }
%struct.anon.3 = type { i16, i16, i16, [246 x i16], [246 x i16] }
%struct.cbPKT_LNC = type <{ %struct.cbPKT_HEADER, i32, i32, i32 }>
%struct.cbPKT_NPLAY = type { %struct.cbPKT_HEADER, %union.anon.4, i64, i64, i64, i16, i16, float, [968 x i8] }
%union.anon.4 = type { i64 }
%struct.cbVIDEOSOURCE = type { [16 x i8], float }
%struct.cbTRACKOBJ = type { [16 x i8], i16, i16 }
%struct.cbPKT_FILECFG = type { %struct.cbPKT_HEADER, i32, i32, i32, i32, [256 x i8], %union.anon.5, [256 x i8] }
%union.anon.5 = type { [256 x i8] }

@.str.2 = external hidden unnamed_addr constant [75 x i8], align 1
@cb_library_index = external global [4 x i32], align 16
@cb_cfg_buffer_ptr = external global [4 x ptr], align 16
@.str.17 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [20 x i8], align 1
@__PRETTY_FUNCTION__._Z17cbIsChanUnitValidjij = external hidden unnamed_addr constant [56 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [20 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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z17cbIsChanUnitValidjij(i32 noundef %0, i32 noundef %1, i32 noundef %2) #2 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca [5 x %struct.cbMANUALUNITMAPPING], align 16
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %12 = load i32, ptr %6, align 4, !tbaa !5
  %13 = zext i32 %12 to i64
  %14 = getelementptr inbounds [4 x i32], ptr @cb_library_index, i64 0, i64 %13
  %15 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %15, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #4
  store i8 0, ptr %8, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 160, ptr %9) #4
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = icmp uge i32 %16, 1
  br i1 %17, label %18, label %19

18:                                               ; preds = %3
  br label %21

19:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str.17, ptr noundef @.str.2, i32 noundef 831, ptr noundef @__PRETTY_FUNCTION__._Z17cbIsChanUnitValidjij) #5
  unreachable

20:                                               ; No predecessors!
  br label %21

21:                                               ; preds = %20, %18
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = icmp ule i32 %22, 596
  br i1 %23, label %24, label %25

24:                                               ; preds = %21
  br label %27

25:                                               ; preds = %21
  call void @__assert_fail(ptr noundef @.str.18, ptr noundef @.str.2, i32 noundef 832, ptr noundef @__PRETTY_FUNCTION__._Z17cbIsChanUnitValidjij) #5
  unreachable

26:                                               ; No predecessors!
  br label %27

27:                                               ; preds = %26, %24
  %28 = load i32, ptr %5, align 4, !tbaa !5
  %29 = icmp sle i32 %28, 5
  br i1 %29, label %30, label %31

30:                                               ; preds = %27
  br label %33

31:                                               ; preds = %27
  call void @__assert_fail(ptr noundef @.str.19, ptr noundef @.str.2, i32 noundef 833, ptr noundef @__PRETTY_FUNCTION__._Z17cbIsChanUnitValidjij) #5
  unreachable

32:                                               ; No predecessors!
  br label %33

33:                                               ; preds = %32, %30
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = getelementptr inbounds [5 x %struct.cbMANUALUNITMAPPING], ptr %9, i64 0, i64 0
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = call noundef i32 @_Z20cbGetChanUnitMappingjP19cbMANUALUNITMAPPINGj(i32 noundef %34, ptr noundef %35, i32 noundef %36)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %85, %33
  %39 = load i32, ptr %10, align 4, !tbaa !5
  %40 = icmp slt i32 %39, 5
  br i1 %40, label %42, label %41

41:                                               ; preds = %38
  store i32 2, ptr %11, align 4
  br label %88

42:                                               ; preds = %38
  %43 = load i32, ptr %5, align 4, !tbaa !5
  %44 = load i32, ptr %10, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [5 x %struct.cbMANUALUNITMAPPING], ptr %9, i64 0, i64 %45
  %47 = getelementptr inbounds %struct.cbMANUALUNITMAPPING, ptr %46, i32 0, i32 0
  %48 = load i16, ptr %47, align 16, !tbaa !11
  %49 = sext i16 %48 to i32
  %50 = add nsw i32 %49, 1
  %51 = icmp eq i32 %43, %50
  br i1 %51, label %52, label %84

52:                                               ; preds = %42
  %53 = load i32, ptr %7, align 4, !tbaa !5
  %54 = zext i32 %53 to i64
  %55 = getelementptr inbounds [4 x ptr], ptr @cb_cfg_buffer_ptr, i64 0, i64 %54
  %56 = load ptr, ptr %55, align 8, !tbaa !14
  %57 = getelementptr inbounds %struct.cbCFGBUFF, ptr %56, i32 0, i32 12
  %58 = getelementptr inbounds %struct.cbSPIKE_SORTING, ptr %57, i32 0, i32 1
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = sub i32 %59, 1
  %61 = zext i32 %60 to i64
  %62 = getelementptr inbounds [596 x [7 x %struct.cbPKT_SS_MODELSET]], ptr %58, i64 0, i64 %61
  %63 = load i32, ptr %10, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [5 x %struct.cbMANUALUNITMAPPING], ptr %9, i64 0, i64 %64
  %66 = getelementptr inbounds %struct.cbMANUALUNITMAPPING, ptr %65, i32 0, i32 0
  %67 = load i16, ptr %66, align 16, !tbaa !11
  %68 = sext i16 %67 to i32
  %69 = add nsw i32 %68, 1
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [7 x %struct.cbPKT_SS_MODELSET], ptr %62, i64 0, i64 %70
  %72 = getelementptr inbounds %struct.cbPKT_SS_MODELSET, ptr %71, i32 0, i32 3
  %73 = load i32, ptr %72, align 1, !tbaa !16
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %82, label %75

75:                                               ; preds = %52
  %76 = load i32, ptr %10, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [5 x %struct.cbMANUALUNITMAPPING], ptr %9, i64 0, i64 %77
  %79 = getelementptr inbounds %struct.cbMANUALUNITMAPPING, ptr %78, i32 0, i32 4
  %80 = load i32, ptr %79, align 4, !tbaa !21
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %83

82:                                               ; preds = %75, %52
  store i8 1, ptr %8, align 1, !tbaa !9
  store i32 2, ptr %11, align 4
  br label %88

83:                                               ; preds = %75
  br label %84

84:                                               ; preds = %83, %42
  br label %85

85:                                               ; preds = %84
  %86 = load i32, ptr %10, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %10, align 4, !tbaa !5
  br label %38, !llvm.loop !22

88:                                               ; preds = %82, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %89

89:                                               ; preds = %88
  %90 = load i8, ptr %8, align 1, !tbaa !9, !range !24, !noundef !25
  %91 = trunc i8 %90 to i1
  %92 = zext i1 %91 to i32
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 160, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret i32 %92
}

declare noundef i32 @_Z20cbGetChanUnitMappingjP19cbMANUALUNITMAPPINGj(i32 noundef, ptr noundef, i32 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn 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 = { 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 #3 = { "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 }
attributes #5 = { noreturn 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTS19cbMANUALUNITMAPPING", !13, i64 0, !7, i64 2, !7, i64 8, !13, i64 26, !6, i64 28}
!13 = !{!"short", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !7, i64 0}
!16 = !{!17, !6, i64 24}
!17 = !{!"_ZTS17cbPKT_SS_MODELSET", !18, i64 0, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !7, i64 36, !7, i64 44, !20, i64 60, !7, i64 64, !20, i64 80, !20, i64 84, !20, i64 88, !20, i64 92, !20, i64 96}
!18 = !{!"_ZTS12cbPKT_HEADER", !19, i64 0, !13, i64 8, !13, i64 10, !13, i64 12, !7, i64 14, !7, i64 15}
!19 = !{!"long", !7, i64 0}
!20 = !{!"float", !7, i64 0}
!21 = !{!12, !6, i64 28}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{i8 0, i8 2}
!25 = !{}


; 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.cbMANUALUNITMAPPING = type { i16, [3 x i16], [3 x [3 x i16]], i16, i32 }
%struct.cbPKT_SS_MODELSET = type <{ %struct.cbPKT_HEADER, i32, i32, i32, i32, i32, [2 x float], [2 x [2 x float]], float, [2 x [2 x float]], float, float, float, float, float }>
%struct.cbPKT_HEADER = type { i64, i16, i16, i16, i8, i8 }

@.str.2 = external hidden unnamed_addr constant [75 x i8], align 1
@cb_library_index = external local_unnamed_addr global [4 x i32], align 16
@cb_cfg_buffer_ptr = external local_unnamed_addr global [4 x ptr], align 16
@.str.17 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [20 x i8], align 1
@__PRETTY_FUNCTION__._Z17cbIsChanUnitValidjij = external hidden unnamed_addr constant [56 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [20 x i8], align 1

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_Z17cbIsChanUnitValidjij(i32 noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = alloca [5 x %struct.cbMANUALUNITMAPPING], align 16
  %5 = zext i32 %2 to i64
  %6 = getelementptr inbounds [4 x i32], ptr @cb_library_index, i64 0, i64 %5
  %7 = load i32, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %4) #4
  %.not = icmp eq i32 %0, 0
  br i1 %.not, label %8, label %9

8:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.2, i32 noundef 831, ptr noundef nonnull @__PRETTY_FUNCTION__._Z17cbIsChanUnitValidjij) #5
  unreachable

9:                                                ; preds = %3
  %10 = icmp ult i32 %0, 597
  br i1 %10, label %12, label %11

11:                                               ; preds = %9
  tail call void @__assert_fail(ptr noundef nonnull @.str.18, ptr noundef nonnull @.str.2, i32 noundef 832, ptr noundef nonnull @__PRETTY_FUNCTION__._Z17cbIsChanUnitValidjij) #5
  unreachable

12:                                               ; preds = %9
  %13 = icmp slt i32 %1, 6
  br i1 %13, label %15, label %14

14:                                               ; preds = %12
  tail call void @__assert_fail(ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.2, i32 noundef 833, ptr noundef nonnull @__PRETTY_FUNCTION__._Z17cbIsChanUnitValidjij) #5
  unreachable

15:                                               ; preds = %12
  %16 = call noundef i32 @_Z20cbGetChanUnitMappingjP19cbMANUALUNITMAPPINGj(i32 noundef %0, ptr noundef nonnull %4, i32 noundef %2)
  %17 = zext i32 %7 to i64
  %18 = getelementptr inbounds [4 x ptr], ptr @cb_cfg_buffer_ptr, i64 0, i64 %17
  %19 = add nsw i32 %0, -1
  %20 = zext nneg i32 %19 to i64
  %21 = load i16, ptr %4, align 16, !tbaa !9
  %22 = sext i16 %21 to i32
  %23 = add nsw i32 %22, 1
  %24 = icmp eq i32 %23, %1
  br i1 %24, label %25, label %33

25:                                               ; preds = %15
  %26 = load ptr, ptr %18, align 8, !tbaa !12
  %27 = getelementptr inbounds i8, ptr %26, i64 1387304
  %28 = sext i32 %1 to i64
  %29 = getelementptr inbounds [596 x [7 x %struct.cbPKT_SS_MODELSET]], ptr %27, i64 0, i64 %20, i64 %28, i32 3
  %30 = load i32, ptr %29, align 1, !tbaa !14
  %.not19 = icmp eq i32 %30, 0
  %31 = getelementptr inbounds i8, ptr %4, i64 28
  %32 = load i32, ptr %31, align 4
  %.not20 = icmp eq i32 %32, 0
  %or.cond = select i1 %.not19, i1 %.not20, i1 false
  br i1 %or.cond, label %33, label %90

33:                                               ; preds = %25, %15
  %34 = getelementptr inbounds i8, ptr %4, i64 32
  %35 = load i16, ptr %34, align 16, !tbaa !9
  %36 = sext i16 %35 to i32
  %37 = add nsw i32 %36, 1
  %38 = icmp eq i32 %37, %1
  br i1 %38, label %39, label %47

39:                                               ; preds = %33
  %40 = load ptr, ptr %18, align 8, !tbaa !12
  %41 = getelementptr inbounds i8, ptr %40, i64 1387304
  %42 = sext i32 %1 to i64
  %43 = getelementptr inbounds [596 x [7 x %struct.cbPKT_SS_MODELSET]], ptr %41, i64 0, i64 %20, i64 %42, i32 3
  %44 = load i32, ptr %43, align 1, !tbaa !14
  %.not19.1 = icmp eq i32 %44, 0
  %45 = getelementptr inbounds i8, ptr %4, i64 60
  %46 = load i32, ptr %45, align 4
  %.not20.1 = icmp eq i32 %46, 0
  %or.cond24 = select i1 %.not19.1, i1 %.not20.1, i1 false
  br i1 %or.cond24, label %47, label %90

47:                                               ; preds = %39, %33
  %48 = getelementptr inbounds i8, ptr %4, i64 64
  %49 = load i16, ptr %48, align 16, !tbaa !9
  %50 = sext i16 %49 to i32
  %51 = add nsw i32 %50, 1
  %52 = icmp eq i32 %51, %1
  br i1 %52, label %53, label %61

53:                                               ; preds = %47
  %54 = load ptr, ptr %18, align 8, !tbaa !12
  %55 = getelementptr inbounds i8, ptr %54, i64 1387304
  %56 = sext i32 %1 to i64
  %57 = getelementptr inbounds [596 x [7 x %struct.cbPKT_SS_MODELSET]], ptr %55, i64 0, i64 %20, i64 %56, i32 3
  %58 = load i32, ptr %57, align 1, !tbaa !14
  %.not19.2 = icmp eq i32 %58, 0
  %59 = getelementptr inbounds i8, ptr %4, i64 92
  %60 = load i32, ptr %59, align 4
  %.not20.2 = icmp eq i32 %60, 0
  %or.cond26 = select i1 %.not19.2, i1 %.not20.2, i1 false
  br i1 %or.cond26, label %61, label %90

61:                                               ; preds = %53, %47
  %62 = getelementptr inbounds i8, ptr %4, i64 96
  %63 = load i16, ptr %62, align 16, !tbaa !9
  %64 = sext i16 %63 to i32
  %65 = add nsw i32 %64, 1
  %66 = icmp eq i32 %65, %1
  br i1 %66, label %67, label %75

67:                                               ; preds = %61
  %68 = load ptr, ptr %18, align 8, !tbaa !12
  %69 = getelementptr inbounds i8, ptr %68, i64 1387304
  %70 = sext i32 %1 to i64
  %71 = getelementptr inbounds [596 x [7 x %struct.cbPKT_SS_MODELSET]], ptr %69, i64 0, i64 %20, i64 %70, i32 3
  %72 = load i32, ptr %71, align 1, !tbaa !14
  %.not19.3 = icmp eq i32 %72, 0
  %73 = getelementptr inbounds i8, ptr %4, i64 124
  %74 = load i32, ptr %73, align 4
  %.not20.3 = icmp eq i32 %74, 0
  %or.cond28 = select i1 %.not19.3, i1 %.not20.3, i1 false
  br i1 %or.cond28, label %75, label %90

75:                                               ; preds = %67, %61
  %76 = getelementptr inbounds i8, ptr %4, i64 128
  %77 = load i16, ptr %76, align 16, !tbaa !9
  %78 = sext i16 %77 to i32
  %79 = add nsw i32 %78, 1
  %80 = icmp eq i32 %79, %1
  br i1 %80, label %81, label %89

81:                                               ; preds = %75
  %82 = load ptr, ptr %18, align 8, !tbaa !12
  %83 = getelementptr inbounds i8, ptr %82, i64 1387304
  %84 = sext i32 %1 to i64
  %85 = getelementptr inbounds [596 x [7 x %struct.cbPKT_SS_MODELSET]], ptr %83, i64 0, i64 %20, i64 %84, i32 3
  %86 = load i32, ptr %85, align 1, !tbaa !14
  %.not19.4 = icmp eq i32 %86, 0
  %87 = getelementptr inbounds i8, ptr %4, i64 156
  %88 = load i32, ptr %87, align 4
  %.not20.4 = icmp eq i32 %88, 0
  %or.cond30 = select i1 %.not19.4, i1 %.not20.4, i1 false
  br i1 %or.cond30, label %89, label %90

89:                                               ; preds = %81, %75
  br label %90

90:                                               ; preds = %89, %81, %67, %53, %39, %25
  %.lcssa = phi i32 [ 1, %25 ], [ 1, %39 ], [ 1, %53 ], [ 1, %67 ], [ 1, %81 ], [ 0, %89 ]
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %4) #4
  ret i32 %.lcssa
}

declare noundef i32 @_Z20cbGetChanUnitMappingjP19cbMANUALUNITMAPPINGj(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn 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 = { 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 #3 = { "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 }
attributes #5 = { noreturn 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTS19cbMANUALUNITMAPPING", !11, i64 0, !7, i64 2, !7, i64 8, !11, i64 26, !6, i64 28}
!11 = !{!"short", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!15, !6, i64 24}
!15 = !{!"_ZTS17cbPKT_SS_MODELSET", !16, i64 0, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !7, i64 36, !7, i64 44, !18, i64 60, !7, i64 64, !18, i64 80, !18, i64 84, !18, i64 88, !18, i64 92, !18, i64 96}
!16 = !{!"_ZTS12cbPKT_HEADER", !17, i64 0, !11, i64 8, !11, i64 10, !11, i64 12, !7, i64 14, !7, i64 15}
!17 = !{!"long", !7, i64 0}
!18 = !{!"float", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass,TailCallElimPass