; LLVM IR from IOsonata/IOsonata :: src/bluetooth (bt_hci_host)

; 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.__Bt_HciLe_Evt_Packet = type { i8, [1 x i8] }
%struct.__Bt_HciLe_Evt_ConnComplete = type <{ i8, i16, i8, i8, [6 x i8], i16, i16, i16, i8 }>
%struct.__Bt_Hci_Device = type { ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.__Bt_HciLe_Evt_Adv_Report = type { i8, [1 x %struct.__Bt_Adv_Report] }
%struct.__Bt_Adv_Report = type { i8, i8, [6 x i8], i8, [1 x i8] }
%struct.__Bt_HciLe_Evt_Data_Len_Change = type { i16, i16, i16, i16, i16 }
%struct.__Bt_HciLe_Evt_Enhence_ConnComplete = type <{ i8, i16, i8, i8, [6 x i8], [6 x i8], [6 x i8], i16, i16, i16, i8 }>
%struct.__Bt_HciLe_Evt_ExtAdv_Report = type { i8, [1 x %struct.__Bt_ExtAdv_Report] }
%struct.__Bt_ExtAdv_Report = type <{ i16, i8, [6 x i8], i8, i8, i8, i8, i8, i16, i8, [6 x i8], i8, [1 x i8] }>

; Function Attrs: mustprogress uwtable
define dso_local void @_Z19BtHciProcessLeEventP15__Bt_Hci_DeviceP21__Bt_HciLe_Evt_Packet(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i8, align 1
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Packet, ptr %20, i32 0, i32 0
  %22 = load i8, ptr %21, align 1, !tbaa !9
  %23 = zext i8 %22 to i32
  switch i32 %23, label %232 [
    i32 1, label %24
    i32 2, label %50
    i32 3, label %113
    i32 4, label %117
    i32 5, label %232
    i32 6, label %121
    i32 7, label %125
    i32 8, label %232
    i32 9, label %232
    i32 10, label %141
    i32 41, label %141
    i32 11, label %232
    i32 12, label %167
    i32 13, label %171
    i32 14, label %225
    i32 36, label %225
    i32 15, label %226
    i32 37, label %226
    i32 16, label %232
    i32 17, label %232
    i32 18, label %232
    i32 19, label %232
    i32 20, label %227
    i32 21, label %232
    i32 22, label %232
    i32 23, label %232
    i32 24, label %231
    i32 38, label %231
    i32 25, label %232
    i32 26, label %232
    i32 27, label %232
    i32 28, label %232
    i32 29, label %232
    i32 30, label %232
    i32 31, label %232
    i32 32, label %232
    i32 33, label %232
    i32 34, label %232
    i32 35, label %232
  ]

24:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Packet, ptr %25, i32 0, i32 1
  %27 = getelementptr inbounds [1 x i8], ptr %26, i64 0, i64 0
  store ptr %27, ptr %5, align 8, !tbaa !5
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.__Bt_HciLe_Evt_ConnComplete, ptr %28, i32 0, i32 0
  %30 = load i8, ptr %29, align 1, !tbaa !11
  %31 = zext i8 %30 to i32
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %33, label %49

33:                                               ; preds = %24
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.__Bt_Hci_Device, ptr %34, i32 0, i32 5
  %36 = load ptr, ptr %35, align 8, !tbaa !14
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.__Bt_HciLe_Evt_ConnComplete, ptr %37, i32 0, i32 1
  %39 = load i16, ptr %38, align 1, !tbaa !17
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.__Bt_HciLe_Evt_ConnComplete, ptr %40, i32 0, i32 2
  %42 = load i8, ptr %41, align 1, !tbaa !18
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.__Bt_HciLe_Evt_ConnComplete, ptr %43, i32 0, i32 3
  %45 = load i8, ptr %44, align 1, !tbaa !19
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.__Bt_HciLe_Evt_ConnComplete, ptr %46, i32 0, i32 4
  %48 = getelementptr inbounds [6 x i8], ptr %47, i64 0, i64 0
  call void %36(i16 noundef zeroext %39, i8 noundef zeroext %42, i8 noundef zeroext %45, ptr noundef %48)
  br label %49

49:                                               ; preds = %33, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  br label %232

50:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Packet, ptr %51, i32 0, i32 1
  %53 = getelementptr inbounds [1 x i8], ptr %52, i64 0, i64 0
  store ptr %53, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Adv_Report, ptr %54, i32 0, i32 1
  %56 = getelementptr inbounds [1 x %struct.__Bt_Adv_Report], ptr %55, i64 0, i64 0
  store ptr %56, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #2
  store i32 0, ptr %8, align 4, !tbaa !20
  br label %57

57:                                               ; preds = %109, %50
  %58 = load i32, ptr %8, align 4, !tbaa !20
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Adv_Report, ptr %59, i32 0, i32 0
  %61 = load i8, ptr %60, align 1, !tbaa !21
  %62 = zext i8 %61 to i32
  %63 = icmp slt i32 %58, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #2
  br label %112

65:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #2
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = load i32, ptr %8, align 4, !tbaa !20
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds %struct.__Bt_Adv_Report, ptr %66, i64 %68
  %70 = getelementptr inbounds %struct.__Bt_Adv_Report, ptr %69, i32 0, i32 4
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = load i32, ptr %8, align 4, !tbaa !20
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds %struct.__Bt_Adv_Report, ptr %71, i64 %73
  %75 = getelementptr inbounds %struct.__Bt_Adv_Report, ptr %74, i32 0, i32 3
  %76 = load i8, ptr %75, align 1, !tbaa !23
  %77 = zext i8 %76 to i64
  %78 = getelementptr inbounds [1 x i8], ptr %70, i64 0, i64 %77
  %79 = load i8, ptr %78, align 1, !tbaa !25
  store i8 %79, ptr %9, align 1, !tbaa !25
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.__Bt_Hci_Device, ptr %80, i32 0, i32 8
  %82 = load ptr, ptr %81, align 8, !tbaa !26
  %83 = load i8, ptr %9, align 1, !tbaa !25
  %84 = load ptr, ptr %7, align 8, !tbaa !5
  %85 = load i32, ptr %8, align 4, !tbaa !20
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds %struct.__Bt_Adv_Report, ptr %84, i64 %86
  %88 = getelementptr inbounds %struct.__Bt_Adv_Report, ptr %87, i32 0, i32 1
  %89 = load i8, ptr %88, align 1, !tbaa !27
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = load i32, ptr %8, align 4, !tbaa !20
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds %struct.__Bt_Adv_Report, ptr %90, i64 %92
  %94 = getelementptr inbounds %struct.__Bt_Adv_Report, ptr %93, i32 0, i32 2
  %95 = getelementptr inbounds [6 x i8], ptr %94, i64 0, i64 0
  %96 = load ptr, ptr %7, align 8, !tbaa !5
  %97 = load i32, ptr %8, align 4, !tbaa !20
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds %struct.__Bt_Adv_Report, ptr %96, i64 %98
  %100 = getelementptr inbounds %struct.__Bt_Adv_Report, ptr %99, i32 0, i32 3
  %101 = load i8, ptr %100, align 1, !tbaa !23
  %102 = zext i8 %101 to i64
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = load i32, ptr %8, align 4, !tbaa !20
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds %struct.__Bt_Adv_Report, ptr %103, i64 %105
  %107 = getelementptr inbounds %struct.__Bt_Adv_Report, ptr %106, i32 0, i32 4
  %108 = getelementptr inbounds [1 x i8], ptr %107, i64 0, i64 0
  call void %82(i8 noundef signext %83, i8 noundef zeroext %89, ptr noundef %95, i64 noundef %102, ptr noundef %108)
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #2
  br label %109

109:                                              ; preds = %65
  %110 = load i32, ptr %8, align 4, !tbaa !20
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %8, align 4, !tbaa !20
  br label %57, !llvm.loop !28

112:                                              ; preds = %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  br label %232

113:                                              ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Packet, ptr %114, i32 0, i32 1
  %116 = getelementptr inbounds [1 x i8], ptr %115, i64 0, i64 0
  store ptr %116, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  br label %232

117:                                              ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #2
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Packet, ptr %118, i32 0, i32 1
  %120 = getelementptr inbounds [1 x i8], ptr %119, i64 0, i64 0
  store ptr %120, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #2
  br label %232

121:                                              ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #2
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Packet, ptr %122, i32 0, i32 1
  %124 = getelementptr inbounds [1 x i8], ptr %123, i64 0, i64 0
  store ptr %124, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #2
  br label %232

125:                                              ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #2
  %126 = load ptr, ptr %4, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Packet, ptr %126, i32 0, i32 1
  %128 = getelementptr inbounds [1 x i8], ptr %127, i64 0, i64 0
  store ptr %128, ptr %13, align 8, !tbaa !5
  %129 = load ptr, ptr %13, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Data_Len_Change, ptr %129, i32 0, i32 3
  %131 = load i16, ptr %130, align 1, !tbaa !30
  %132 = zext i16 %131 to i32
  %133 = load ptr, ptr %3, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.__Bt_Hci_Device, ptr %133, i32 0, i32 1
  store i32 %132, ptr %134, align 8, !tbaa !32
  %135 = load ptr, ptr %13, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Data_Len_Change, ptr %135, i32 0, i32 1
  %137 = load i16, ptr %136, align 1, !tbaa !33
  %138 = zext i16 %137 to i32
  %139 = load ptr, ptr %3, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.__Bt_Hci_Device, ptr %139, i32 0, i32 2
  store i32 %138, ptr %140, align 4, !tbaa !34
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #2
  br label %232

141:                                              ; preds = %2, %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #2
  %142 = load ptr, ptr %4, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Packet, ptr %142, i32 0, i32 1
  %144 = getelementptr inbounds [1 x i8], ptr %143, i64 0, i64 0
  store ptr %144, ptr %14, align 8, !tbaa !5
  %145 = load ptr, ptr %14, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Enhence_ConnComplete, ptr %145, i32 0, i32 0
  %147 = load i8, ptr %146, align 1, !tbaa !35
  %148 = zext i8 %147 to i32
  %149 = icmp eq i32 %148, 0
  br i1 %149, label %150, label %166

150:                                              ; preds = %141
  %151 = load ptr, ptr %3, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.__Bt_Hci_Device, ptr %151, i32 0, i32 5
  %153 = load ptr, ptr %152, align 8, !tbaa !14
  %154 = load ptr, ptr %14, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Enhence_ConnComplete, ptr %154, i32 0, i32 1
  %156 = load i16, ptr %155, align 1, !tbaa !37
  %157 = load ptr, ptr %14, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Enhence_ConnComplete, ptr %157, i32 0, i32 2
  %159 = load i8, ptr %158, align 1, !tbaa !38
  %160 = load ptr, ptr %14, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Enhence_ConnComplete, ptr %160, i32 0, i32 3
  %162 = load i8, ptr %161, align 1, !tbaa !39
  %163 = load ptr, ptr %14, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Enhence_ConnComplete, ptr %163, i32 0, i32 4
  %165 = getelementptr inbounds [6 x i8], ptr %164, i64 0, i64 0
  call void %153(i16 noundef zeroext %156, i8 noundef zeroext %159, i8 noundef zeroext %162, ptr noundef %165)
  br label %166

166:                                              ; preds = %150, %141
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #2
  br label %232

167:                                              ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #2
  %168 = load ptr, ptr %4, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Packet, ptr %168, i32 0, i32 1
  %170 = getelementptr inbounds [1 x i8], ptr %169, i64 0, i64 0
  store ptr %170, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #2
  br label %232

171:                                              ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #2
  %172 = load ptr, ptr %4, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Packet, ptr %172, i32 0, i32 1
  %174 = getelementptr inbounds [1 x i8], ptr %173, i64 0, i64 0
  store ptr %174, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #2
  %175 = load ptr, ptr %16, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.__Bt_HciLe_Evt_ExtAdv_Report, ptr %175, i32 0, i32 1
  %177 = getelementptr inbounds [1 x %struct.__Bt_ExtAdv_Report], ptr %176, i64 0, i64 0
  store ptr %177, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #2
  store i32 0, ptr %18, align 4, !tbaa !20
  br label %178

178:                                              ; preds = %221, %171
  %179 = load i32, ptr %18, align 4, !tbaa !20
  %180 = load ptr, ptr %16, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.__Bt_HciLe_Evt_ExtAdv_Report, ptr %180, i32 0, i32 0
  %182 = load i8, ptr %181, align 1, !tbaa !40
  %183 = zext i8 %182 to i32
  %184 = icmp slt i32 %179, %183
  br i1 %184, label %186, label %185

185:                                              ; preds = %178
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #2
  br label %224

186:                                              ; preds = %178
  %187 = load ptr, ptr %3, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.__Bt_Hci_Device, ptr %187, i32 0, i32 8
  %189 = load ptr, ptr %188, align 8, !tbaa !26
  %190 = load ptr, ptr %17, align 8, !tbaa !5
  %191 = load i32, ptr %18, align 4, !tbaa !20
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds %struct.__Bt_ExtAdv_Report, ptr %190, i64 %192
  %194 = getelementptr inbounds %struct.__Bt_ExtAdv_Report, ptr %193, i32 0, i32 7
  %195 = load i8, ptr %194, align 1, !tbaa !42
  %196 = load ptr, ptr %17, align 8, !tbaa !5
  %197 = load i32, ptr %18, align 4, !tbaa !20
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds %struct.__Bt_ExtAdv_Report, ptr %196, i64 %198
  %200 = getelementptr inbounds %struct.__Bt_ExtAdv_Report, ptr %199, i32 0, i32 1
  %201 = load i8, ptr %200, align 1, !tbaa !44
  %202 = load ptr, ptr %17, align 8, !tbaa !5
  %203 = load i32, ptr %18, align 4, !tbaa !20
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds %struct.__Bt_ExtAdv_Report, ptr %202, i64 %204
  %206 = getelementptr inbounds %struct.__Bt_ExtAdv_Report, ptr %205, i32 0, i32 2
  %207 = getelementptr inbounds [6 x i8], ptr %206, i64 0, i64 0
  %208 = load ptr, ptr %17, align 8, !tbaa !5
  %209 = load i32, ptr %18, align 4, !tbaa !20
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds %struct.__Bt_ExtAdv_Report, ptr %208, i64 %210
  %212 = getelementptr inbounds %struct.__Bt_ExtAdv_Report, ptr %211, i32 0, i32 11
  %213 = load i8, ptr %212, align 1, !tbaa !45
  %214 = zext i8 %213 to i64
  %215 = load ptr, ptr %17, align 8, !tbaa !5
  %216 = load i32, ptr %18, align 4, !tbaa !20
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds %struct.__Bt_ExtAdv_Report, ptr %215, i64 %217
  %219 = getelementptr inbounds %struct.__Bt_ExtAdv_Report, ptr %218, i32 0, i32 12
  %220 = getelementptr inbounds [1 x i8], ptr %219, i64 0, i64 0
  call void %189(i8 noundef signext %195, i8 noundef zeroext %201, ptr noundef %207, i64 noundef %214, ptr noundef %220)
  br label %221

221:                                              ; preds = %186
  %222 = load i32, ptr %18, align 4, !tbaa !20
  %223 = add nsw i32 %222, 1
  store i32 %223, ptr %18, align 4, !tbaa !20
  br label %178, !llvm.loop !46

224:                                              ; preds = %185
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #2
  br label %232

225:                                              ; preds = %2, %2
  br label %232

226:                                              ; preds = %2, %2
  br label %232

227:                                              ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #2
  %228 = load ptr, ptr %4, align 8, !tbaa !5
  %229 = getelementptr inbounds %struct.__Bt_HciLe_Evt_Packet, ptr %228, i32 0, i32 1
  %230 = getelementptr inbounds [1 x i8], ptr %229, i64 0, i64 0
  store ptr %230, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #2
  br label %232

231:                                              ; preds = %2, %2
  br label %232

232:                                              ; preds = %231, %227, %226, %225, %224, %167, %166, %125, %121, %117, %113, %112, %49, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2, %2
  ret void
}

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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++ TBAA"}
!9 = !{!10, !7, i64 0}
!10 = !{!"_ZTS21__Bt_HciLe_Evt_Packet", !7, i64 0, !7, i64 1}
!11 = !{!12, !7, i64 0}
!12 = !{!"_ZTS27__Bt_HciLe_Evt_ConnComplete", !7, i64 0, !13, i64 1, !7, i64 3, !7, i64 4, !7, i64 5, !13, i64 11, !13, i64 13, !13, i64 15, !7, i64 17}
!13 = !{!"short", !7, i64 0}
!14 = !{!15, !6, i64 32}
!15 = !{!"_ZTS15__Bt_Hci_Device", !6, i64 0, !16, i64 8, !16, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64}
!16 = !{!"int", !7, i64 0}
!17 = !{!12, !13, i64 1}
!18 = !{!12, !7, i64 3}
!19 = !{!12, !7, i64 4}
!20 = !{!16, !16, i64 0}
!21 = !{!22, !7, i64 0}
!22 = !{!"_ZTS25__Bt_HciLe_Evt_Adv_Report", !7, i64 0, !7, i64 1}
!23 = !{!24, !7, i64 8}
!24 = !{!"_ZTS15__Bt_Adv_Report", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 8, !7, i64 9}
!25 = !{!7, !7, i64 0}
!26 = !{!15, !6, i64 56}
!27 = !{!24, !7, i64 1}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!31, !13, i64 6}
!31 = !{!"_ZTS30__Bt_HciLe_Evt_Data_Len_Change", !13, i64 0, !13, i64 2, !13, i64 4, !13, i64 6, !13, i64 8}
!32 = !{!15, !16, i64 8}
!33 = !{!31, !13, i64 2}
!34 = !{!15, !16, i64 12}
!35 = !{!36, !7, i64 0}
!36 = !{!"_ZTS35__Bt_HciLe_Evt_Enhence_ConnComplete", !7, i64 0, !13, i64 1, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 11, !7, i64 17, !13, i64 23, !13, i64 25, !13, i64 27, !7, i64 29}
!37 = !{!36, !13, i64 1}
!38 = !{!36, !7, i64 3}
!39 = !{!36, !7, i64 4}
!40 = !{!41, !7, i64 0}
!41 = !{!"_ZTS28__Bt_HciLe_Evt_ExtAdv_Report", !7, i64 0, !7, i64 1}
!42 = !{!43, !7, i64 13}
!43 = !{!"_ZTS18__Bt_ExtAdv_Report", !13, i64 0, !7, i64 2, !7, i64 3, !7, i64 9, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !13, i64 14, !7, i64 16, !7, i64 17, !7, i64 23, !7, i64 24}
!44 = !{!43, !7, i64 2}
!45 = !{!43, !7, i64 23}
!46 = distinct !{!46, !29}


; 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.__Bt_Adv_Report = type { i8, i8, [6 x i8], i8, [1 x i8] }
%struct.__Bt_ExtAdv_Report = type <{ i16, i8, [6 x i8], i8, i8, i8, i8, i8, i16, i8, [6 x i8], i8, [1 x i8] }>

; Function Attrs: mustprogress uwtable
define dso_local void @_Z19BtHciProcessLeEventP15__Bt_Hci_DeviceP21__Bt_HciLe_Evt_Packet(ptr nocapture noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = load i8, ptr %1, align 1, !tbaa !5
  switch i8 %3, label %.loopexit [
    i8 1, label %4
    i8 2, label %18
    i8 41, label %47
    i8 10, label %47
    i8 13, label %61
    i8 7, label %38
  ]

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %1, i64 1
  %6 = load i8, ptr %5, align 1, !tbaa !9
  %7 = icmp eq i8 %6, 0
  br i1 %7, label %8, label %.loopexit

8:                                                ; preds = %4
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = load ptr, ptr %9, align 8, !tbaa !12
  %11 = getelementptr inbounds i8, ptr %1, i64 2
  %12 = load i16, ptr %11, align 1, !tbaa !16
  %13 = getelementptr inbounds i8, ptr %1, i64 4
  %14 = load i8, ptr %13, align 1, !tbaa !17
  %15 = getelementptr inbounds i8, ptr %1, i64 5
  %16 = load i8, ptr %15, align 1, !tbaa !18
  %17 = getelementptr inbounds i8, ptr %1, i64 6
  tail call void %10(i16 noundef zeroext %12, i8 noundef zeroext %14, i8 noundef zeroext %16, ptr noundef nonnull %17)
  br label %.loopexit

18:                                               ; preds = %2
  %19 = getelementptr inbounds i8, ptr %1, i64 1
  %20 = getelementptr inbounds i8, ptr %1, i64 2
  %21 = load i8, ptr %19, align 1, !tbaa !19
  %.not64 = icmp eq i8 %21, 0
  br i1 %.not64, label %.loopexit, label %.lr.ph63

.lr.ph63:                                         ; preds = %18
  %22 = getelementptr inbounds i8, ptr %0, i64 56
  br label %23

23:                                               ; preds = %.lr.ph63, %23
  %indvars.iv67 = phi i64 [ 0, %.lr.ph63 ], [ %indvars.iv.next68, %23 ]
  %24 = getelementptr inbounds %struct.__Bt_Adv_Report, ptr %20, i64 %indvars.iv67
  %25 = getelementptr inbounds i8, ptr %24, i64 9
  %26 = getelementptr inbounds i8, ptr %24, i64 8
  %27 = load i8, ptr %26, align 1, !tbaa !21
  %28 = zext i8 %27 to i64
  %29 = getelementptr inbounds [1 x i8], ptr %25, i64 0, i64 %28
  %30 = load i8, ptr %29, align 1, !tbaa !23
  %31 = load ptr, ptr %22, align 8, !tbaa !24
  %32 = getelementptr inbounds i8, ptr %24, i64 1
  %33 = load i8, ptr %32, align 1, !tbaa !25
  %34 = getelementptr inbounds i8, ptr %24, i64 2
  tail call void %31(i8 noundef signext %30, i8 noundef zeroext %33, ptr noundef nonnull %34, i64 noundef %28, ptr noundef nonnull %25)
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %35 = load i8, ptr %19, align 1, !tbaa !19
  %36 = zext i8 %35 to i64
  %37 = icmp ult i64 %indvars.iv.next68, %36
  br i1 %37, label %23, label %.loopexit, !llvm.loop !26

38:                                               ; preds = %2
  %39 = getelementptr inbounds i8, ptr %1, i64 7
  %40 = load i16, ptr %39, align 1, !tbaa !28
  %41 = zext i16 %40 to i32
  %42 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %41, ptr %42, align 8, !tbaa !30
  %43 = getelementptr inbounds i8, ptr %1, i64 3
  %44 = load i16, ptr %43, align 1, !tbaa !31
  %45 = zext i16 %44 to i32
  %46 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %45, ptr %46, align 4, !tbaa !32
  br label %.loopexit

47:                                               ; preds = %2, %2
  %48 = getelementptr inbounds i8, ptr %1, i64 1
  %49 = load i8, ptr %48, align 1, !tbaa !33
  %50 = icmp eq i8 %49, 0
  br i1 %50, label %51, label %.loopexit

51:                                               ; preds = %47
  %52 = getelementptr inbounds i8, ptr %0, i64 32
  %53 = load ptr, ptr %52, align 8, !tbaa !12
  %54 = getelementptr inbounds i8, ptr %1, i64 2
  %55 = load i16, ptr %54, align 1, !tbaa !35
  %56 = getelementptr inbounds i8, ptr %1, i64 4
  %57 = load i8, ptr %56, align 1, !tbaa !36
  %58 = getelementptr inbounds i8, ptr %1, i64 5
  %59 = load i8, ptr %58, align 1, !tbaa !37
  %60 = getelementptr inbounds i8, ptr %1, i64 6
  tail call void %53(i16 noundef zeroext %55, i8 noundef zeroext %57, i8 noundef zeroext %59, ptr noundef nonnull %60)
  br label %.loopexit

61:                                               ; preds = %2
  %62 = getelementptr inbounds i8, ptr %1, i64 1
  %63 = getelementptr inbounds i8, ptr %1, i64 2
  %64 = load i8, ptr %62, align 1, !tbaa !38
  %.not = icmp eq i8 %64, 0
  br i1 %.not, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %61
  %65 = getelementptr inbounds i8, ptr %0, i64 56
  br label %66

66:                                               ; preds = %.lr.ph, %66
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %66 ]
  %67 = load ptr, ptr %65, align 8, !tbaa !24
  %68 = getelementptr inbounds %struct.__Bt_ExtAdv_Report, ptr %63, i64 %indvars.iv
  %69 = getelementptr inbounds i8, ptr %68, i64 13
  %70 = load i8, ptr %69, align 1, !tbaa !40
  %71 = getelementptr inbounds i8, ptr %68, i64 2
  %72 = load i8, ptr %71, align 1, !tbaa !42
  %73 = getelementptr inbounds i8, ptr %68, i64 3
  %74 = getelementptr inbounds i8, ptr %68, i64 23
  %75 = load i8, ptr %74, align 1, !tbaa !43
  %76 = zext i8 %75 to i64
  %77 = getelementptr inbounds i8, ptr %68, i64 24
  tail call void %67(i8 noundef signext %70, i8 noundef zeroext %72, ptr noundef nonnull %73, i64 noundef %76, ptr noundef nonnull %77)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %78 = load i8, ptr %62, align 1, !tbaa !38
  %79 = zext i8 %78 to i64
  %80 = icmp ult i64 %indvars.iv.next, %79
  br i1 %80, label %66, label %.loopexit, !llvm.loop !44

.loopexit:                                        ; preds = %66, %23, %61, %18, %47, %51, %4, %8, %38, %2
  ret void
}

attributes #0 = { 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" }

!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 = !{!"_ZTS21__Bt_HciLe_Evt_Packet", !7, i64 0, !7, i64 1}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !7, i64 0}
!10 = !{!"_ZTS27__Bt_HciLe_Evt_ConnComplete", !7, i64 0, !11, i64 1, !7, i64 3, !7, i64 4, !7, i64 5, !11, i64 11, !11, i64 13, !11, i64 15, !7, i64 17}
!11 = !{!"short", !7, i64 0}
!12 = !{!13, !14, i64 32}
!13 = !{!"_ZTS15__Bt_Hci_Device", !14, i64 0, !15, i64 8, !15, i64 12, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !14, i64 48, !14, i64 56, !14, i64 64}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!10, !11, i64 1}
!17 = !{!10, !7, i64 3}
!18 = !{!10, !7, i64 4}
!19 = !{!20, !7, i64 0}
!20 = !{!"_ZTS25__Bt_HciLe_Evt_Adv_Report", !7, i64 0, !7, i64 1}
!21 = !{!22, !7, i64 8}
!22 = !{!"_ZTS15__Bt_Adv_Report", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 8, !7, i64 9}
!23 = !{!7, !7, i64 0}
!24 = !{!13, !14, i64 56}
!25 = !{!22, !7, i64 1}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!29, !11, i64 6}
!29 = !{!"_ZTS30__Bt_HciLe_Evt_Data_Len_Change", !11, i64 0, !11, i64 2, !11, i64 4, !11, i64 6, !11, i64 8}
!30 = !{!13, !15, i64 8}
!31 = !{!29, !11, i64 2}
!32 = !{!13, !15, i64 12}
!33 = !{!34, !7, i64 0}
!34 = !{!"_ZTS35__Bt_HciLe_Evt_Enhence_ConnComplete", !7, i64 0, !11, i64 1, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 11, !7, i64 17, !11, i64 23, !11, i64 25, !11, i64 27, !7, i64 29}
!35 = !{!34, !11, i64 1}
!36 = !{!34, !7, i64 3}
!37 = !{!34, !7, i64 4}
!38 = !{!39, !7, i64 0}
!39 = !{!"_ZTS28__Bt_HciLe_Evt_ExtAdv_Report", !7, i64 0, !7, i64 1}
!40 = !{!41, !7, i64 13}
!41 = !{!"_ZTS18__Bt_ExtAdv_Report", !11, i64 0, !7, i64 2, !7, i64 3, !7, i64 9, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !11, i64 14, !7, i64 16, !7, i64 17, !7, i64 23, !7, i64 24}
!42 = !{!41, !7, i64 2}
!43 = !{!41, !7, i64 23}
!44 = distinct !{!44, !27}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass