; LLVM IR from cvra/robot-software :: uwb-beacon-firmware/src (uwb_protocol)

; 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.uwb_protocol_handler_t = type { i16, i16, ptr, ptr, ptr, ptr, i8 }

; Function Attrs: nounwind uwtable
declare dso_local i64 @uwb_mac_encapsulate_frame(i16 noundef zeroext, i16 noundef zeroext, i16 noundef zeroext, i8 noundef zeroext, ptr noundef, i64 noundef) #0

; 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

; Function Attrs: nounwind uwtable
declare dso_local i64 @uwb_mac_decapsulate_frame(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @write_40bit_int(i64 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @uwb_send_measurement_advertisement(ptr noundef, ptr noundef) #0

declare void @uwb_transmit_frame(i64 noundef, ptr noundef, i64 noundef) #2

; 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: nounwind uwtable
define dso_local void @uwb_process_incoming_frame(ptr noundef %0, ptr noundef %1, i64 noundef %2, i64 noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i16, align 2
  %10 = alloca i16, align 2
  %11 = alloca i16, align 2
  %12 = alloca i8, align 1
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca [2 x i64], align 16
  %24 = alloca [2 x i64], align 16
  %25 = alloca float, align 4
  %26 = alloca float, align 4
  %27 = alloca float, align 4
  %28 = alloca float, align 4
  %29 = alloca float, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  store i64 %3, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #4
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = load i64, ptr %7, align 8, !tbaa !9
  %32 = call i64 @uwb_mac_decapsulate_frame(ptr noundef %9, ptr noundef %10, ptr noundef %11, ptr noundef %12, ptr noundef %30, i64 noundef %31)
  store i64 %32, ptr %7, align 8, !tbaa !9
  %33 = load i16, ptr %9, align 2, !tbaa !11
  %34 = zext i16 %33 to i32
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.uwb_protocol_handler_t, ptr %35, i32 0, i32 0
  %37 = load i16, ptr %36, align 8, !tbaa !13
  %38 = zext i16 %37 to i32
  %39 = icmp ne i32 %34, %38
  br i1 %39, label %40, label %41

40:                                               ; preds = %4
  store i32 1, ptr %13, align 4
  br label %260

41:                                               ; preds = %4
  %42 = load i16, ptr %11, align 2, !tbaa !11
  %43 = zext i16 %42 to i32
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.uwb_protocol_handler_t, ptr %44, i32 0, i32 1
  %46 = load i16, ptr %45, align 2, !tbaa !16
  %47 = zext i16 %46 to i32
  %48 = icmp ne i32 %43, %47
  br i1 %48, label %49, label %54

49:                                               ; preds = %41
  %50 = load i16, ptr %11, align 2, !tbaa !11
  %51 = zext i16 %50 to i32
  %52 = icmp ne i32 %51, 65535
  br i1 %52, label %53, label %54

53:                                               ; preds = %49
  store i32 1, ptr %13, align 4
  br label %260

54:                                               ; preds = %49, %41
  %55 = load i8, ptr %12, align 1, !tbaa !17
  %56 = zext i8 %55 to i32
  call void @trace_integer(i8 noundef zeroext 4, i32 noundef %56)
  %57 = load i8, ptr %12, align 1, !tbaa !17
  %58 = zext i8 %57 to i32
  %59 = icmp eq i32 %58, 0
  br i1 %59, label %60, label %94

60:                                               ; preds = %54
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.uwb_protocol_handler_t, ptr %61, i32 0, i32 6
  %63 = load i8, ptr %62, align 8, !tbaa !18, !range !19, !noundef !20
  %64 = trunc i8 %63 to i1
  %65 = zext i1 %64 to i32
  %66 = icmp eq i32 %65, 0
  br i1 %66, label %67, label %93

67:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %68 = load i64, ptr %8, align 8, !tbaa !9
  %69 = add i64 %68, 52428800
  store i64 %69, ptr %14, align 8, !tbaa !9
  %70 = load i64, ptr %14, align 8, !tbaa !9
  %71 = and i64 %70, 1099511627264
  store i64 %71, ptr %14, align 8, !tbaa !9
  %72 = load i64, ptr %8, align 8, !tbaa !9
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds i8, ptr %73, i64 5
  call void @write_40bit_int(i64 noundef %72, ptr noundef %74)
  %75 = load i64, ptr %14, align 8, !tbaa !9
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds i8, ptr %76, i64 10
  call void @write_40bit_int(i64 noundef %75, ptr noundef %77)
  %78 = load i64, ptr %7, align 8, !tbaa !9
  %79 = add i64 %78, 10
  store i64 %79, ptr %7, align 8, !tbaa !9
  %80 = load i16, ptr %10, align 2, !tbaa !11
  store i16 %80, ptr %11, align 2, !tbaa !11
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.uwb_protocol_handler_t, ptr %81, i32 0, i32 1
  %83 = load i16, ptr %82, align 2, !tbaa !16
  store i16 %83, ptr %10, align 2, !tbaa !11
  %84 = load i16, ptr %9, align 2, !tbaa !11
  %85 = load i16, ptr %10, align 2, !tbaa !11
  %86 = load i16, ptr %11, align 2, !tbaa !11
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = load i64, ptr %7, align 8, !tbaa !9
  %89 = call i64 @uwb_mac_encapsulate_frame(i16 noundef zeroext %84, i16 noundef zeroext %85, i16 noundef zeroext %86, i8 noundef zeroext 1, ptr noundef %87, i64 noundef %88)
  store i64 %89, ptr %7, align 8, !tbaa !9
  %90 = load i64, ptr %14, align 8, !tbaa !9
  %91 = load ptr, ptr %6, align 8, !tbaa !5
  %92 = load i64, ptr %7, align 8, !tbaa !9
  call void @uwb_transmit_frame(i64 noundef %90, ptr noundef %91, i64 noundef %92)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %93

93:                                               ; preds = %67, %60
  br label %259

94:                                               ; preds = %54
  %95 = load i8, ptr %12, align 1, !tbaa !17
  %96 = zext i8 %95 to i32
  %97 = icmp eq i32 %96, 1
  br i1 %97, label %98, label %124

98:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %99 = load i64, ptr %8, align 8, !tbaa !9
  %100 = add i64 %99, 52428800
  store i64 %100, ptr %15, align 8, !tbaa !9
  %101 = load i64, ptr %15, align 8, !tbaa !9
  %102 = and i64 %101, 1099511627264
  store i64 %102, ptr %15, align 8, !tbaa !9
  %103 = load i64, ptr %8, align 8, !tbaa !9
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  %105 = getelementptr inbounds i8, ptr %104, i64 15
  call void @write_40bit_int(i64 noundef %103, ptr noundef %105)
  %106 = load i64, ptr %15, align 8, !tbaa !9
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  %108 = getelementptr inbounds i8, ptr %107, i64 20
  call void @write_40bit_int(i64 noundef %106, ptr noundef %108)
  %109 = load i64, ptr %7, align 8, !tbaa !9
  %110 = add i64 %109, 10
  store i64 %110, ptr %7, align 8, !tbaa !9
  %111 = load i16, ptr %10, align 2, !tbaa !11
  store i16 %111, ptr %11, align 2, !tbaa !11
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.uwb_protocol_handler_t, ptr %112, i32 0, i32 1
  %114 = load i16, ptr %113, align 2, !tbaa !16
  store i16 %114, ptr %10, align 2, !tbaa !11
  %115 = load i16, ptr %9, align 2, !tbaa !11
  %116 = load i16, ptr %10, align 2, !tbaa !11
  %117 = load i16, ptr %11, align 2, !tbaa !11
  %118 = load ptr, ptr %6, align 8, !tbaa !5
  %119 = load i64, ptr %7, align 8, !tbaa !9
  %120 = call i64 @uwb_mac_encapsulate_frame(i16 noundef zeroext %115, i16 noundef zeroext %116, i16 noundef zeroext %117, i8 noundef zeroext 2, ptr noundef %118, i64 noundef %119)
  store i64 %120, ptr %7, align 8, !tbaa !9
  %121 = load i64, ptr %15, align 8, !tbaa !9
  %122 = load ptr, ptr %6, align 8, !tbaa !5
  %123 = load i64, ptr %7, align 8, !tbaa !9
  call void @uwb_transmit_frame(i64 noundef %121, ptr noundef %122, i64 noundef %123)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  br label %258

124:                                              ; preds = %94
  %125 = load i8, ptr %12, align 1, !tbaa !17
  %126 = zext i8 %125 to i32
  %127 = icmp eq i32 %126, 2
  br i1 %127, label %128, label %195

128:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %129 = load ptr, ptr %6, align 8, !tbaa !5
  %130 = getelementptr inbounds i8, ptr %129, i64 0
  %131 = call i64 @read_40bit_int(ptr noundef %130)
  store i64 %131, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %132 = load ptr, ptr %6, align 8, !tbaa !5
  %133 = getelementptr inbounds i8, ptr %132, i64 5
  %134 = call i64 @read_40bit_int(ptr noundef %133)
  store i64 %134, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %135 = load ptr, ptr %6, align 8, !tbaa !5
  %136 = getelementptr inbounds i8, ptr %135, i64 10
  %137 = call i64 @read_40bit_int(ptr noundef %136)
  store i64 %137, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %138 = load ptr, ptr %6, align 8, !tbaa !5
  %139 = getelementptr inbounds i8, ptr %138, i64 15
  %140 = call i64 @read_40bit_int(ptr noundef %139)
  store i64 %140, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %141 = load ptr, ptr %6, align 8, !tbaa !5
  %142 = getelementptr inbounds i8, ptr %141, i64 20
  %143 = call i64 @read_40bit_int(ptr noundef %142)
  store i64 %143, ptr %20, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  %144 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %144, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %24) #4
  %145 = load i64, ptr %19, align 8, !tbaa !9
  %146 = load i64, ptr %16, align 8, !tbaa !9
  %147 = call i64 @substract_40bit_int(i64 noundef %145, i64 noundef %146)
  %148 = getelementptr inbounds [2 x i64], ptr %23, i64 0, i64 0
  store i64 %147, ptr %148, align 16, !tbaa !9
  %149 = load i64, ptr %21, align 8, !tbaa !9
  %150 = load i64, ptr %18, align 8, !tbaa !9
  %151 = call i64 @substract_40bit_int(i64 noundef %149, i64 noundef %150)
  %152 = getelementptr inbounds [2 x i64], ptr %23, i64 0, i64 1
  store i64 %151, ptr %152, align 8, !tbaa !9
  %153 = load i64, ptr %18, align 8, !tbaa !9
  %154 = load i64, ptr %17, align 8, !tbaa !9
  %155 = call i64 @substract_40bit_int(i64 noundef %153, i64 noundef %154)
  %156 = getelementptr inbounds [2 x i64], ptr %24, i64 0, i64 0
  store i64 %155, ptr %156, align 16, !tbaa !9
  %157 = load i64, ptr %20, align 8, !tbaa !9
  %158 = load i64, ptr %19, align 8, !tbaa !9
  %159 = call i64 @substract_40bit_int(i64 noundef %157, i64 noundef %158)
  %160 = getelementptr inbounds [2 x i64], ptr %24, i64 0, i64 1
  store i64 %159, ptr %160, align 8, !tbaa !9
  %161 = getelementptr inbounds [2 x i64], ptr %23, i64 0, i64 0
  %162 = load i64, ptr %161, align 16, !tbaa !9
  %163 = getelementptr inbounds [2 x i64], ptr %23, i64 0, i64 1
  %164 = load i64, ptr %163, align 8, !tbaa !9
  %165 = mul i64 %162, %164
  %166 = getelementptr inbounds [2 x i64], ptr %24, i64 0, i64 0
  %167 = load i64, ptr %166, align 16, !tbaa !9
  %168 = getelementptr inbounds [2 x i64], ptr %24, i64 0, i64 1
  %169 = load i64, ptr %168, align 8, !tbaa !9
  %170 = mul i64 %167, %169
  %171 = sub i64 %165, %170
  %172 = getelementptr inbounds [2 x i64], ptr %23, i64 0, i64 0
  %173 = load i64, ptr %172, align 16, !tbaa !9
  %174 = getelementptr inbounds [2 x i64], ptr %23, i64 0, i64 1
  %175 = load i64, ptr %174, align 8, !tbaa !9
  %176 = add i64 %173, %175
  %177 = getelementptr inbounds [2 x i64], ptr %24, i64 0, i64 0
  %178 = load i64, ptr %177, align 16, !tbaa !9
  %179 = add i64 %176, %178
  %180 = getelementptr inbounds [2 x i64], ptr %24, i64 0, i64 1
  %181 = load i64, ptr %180, align 8, !tbaa !9
  %182 = add i64 %179, %181
  %183 = udiv i64 %171, %182
  store i64 %183, ptr %22, align 8, !tbaa !9
  %184 = load ptr, ptr %5, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.uwb_protocol_handler_t, ptr %184, i32 0, i32 2
  %186 = load ptr, ptr %185, align 8, !tbaa !21
  %187 = icmp ne ptr %186, null
  br i1 %187, label %188, label %194

188:                                              ; preds = %128
  %189 = load ptr, ptr %5, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.uwb_protocol_handler_t, ptr %189, i32 0, i32 2
  %191 = load ptr, ptr %190, align 8, !tbaa !21
  %192 = load i16, ptr %10, align 2, !tbaa !11
  %193 = load i64, ptr %22, align 8, !tbaa !9
  call void %191(i16 noundef zeroext %192, i64 noundef %193)
  br label %194

194:                                              ; preds = %188, %128
  call void @llvm.lifetime.end.p0(i64 16, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  br label %257

195:                                              ; preds = %124
  %196 = load i8, ptr %12, align 1, !tbaa !17
  %197 = zext i8 %196 to i32
  %198 = icmp eq i32 %197, 3
  br i1 %198, label %199, label %213

199:                                              ; preds = %195
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #4
  %200 = load ptr, ptr %6, align 8, !tbaa !5
  %201 = getelementptr inbounds i8, ptr %200, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %25, ptr align 1 %201, i64 4, i1 false)
  %202 = load ptr, ptr %6, align 8, !tbaa !5
  %203 = getelementptr inbounds i8, ptr %202, i64 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 1 %203, i64 4, i1 false)
  %204 = load ptr, ptr %6, align 8, !tbaa !5
  %205 = getelementptr inbounds i8, ptr %204, i64 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 1 %205, i64 4, i1 false)
  %206 = load ptr, ptr %5, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.uwb_protocol_handler_t, ptr %206, i32 0, i32 3
  %208 = load ptr, ptr %207, align 8, !tbaa !22
  %209 = load i16, ptr %10, align 2, !tbaa !11
  %210 = load float, ptr %25, align 4, !tbaa !23
  %211 = load float, ptr %26, align 4, !tbaa !23
  %212 = load float, ptr %27, align 4, !tbaa !23
  call void %208(i16 noundef zeroext %209, float noundef %210, float noundef %211, float noundef %212)
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #4
  br label %256

213:                                              ; preds = %195
  %214 = load i8, ptr %12, align 1, !tbaa !17
  %215 = zext i8 %214 to i32
  %216 = icmp eq i32 %215, 4
  br i1 %216, label %217, label %228

217:                                              ; preds = %213
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #4
  %218 = load ptr, ptr %6, align 8, !tbaa !5
  %219 = getelementptr inbounds i8, ptr %218, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %28, ptr align 1 %219, i64 4, i1 false)
  %220 = load ptr, ptr %6, align 8, !tbaa !5
  %221 = getelementptr inbounds i8, ptr %220, i64 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %29, ptr align 1 %221, i64 4, i1 false)
  %222 = load ptr, ptr %5, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.uwb_protocol_handler_t, ptr %222, i32 0, i32 4
  %224 = load ptr, ptr %223, align 8, !tbaa !25
  %225 = load i16, ptr %10, align 2, !tbaa !11
  %226 = load float, ptr %28, align 4, !tbaa !23
  %227 = load float, ptr %29, align 4, !tbaa !23
  call void %224(i16 noundef zeroext %225, float noundef %226, float noundef %227)
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #4
  br label %255

228:                                              ; preds = %213
  %229 = load i8, ptr %12, align 1, !tbaa !17
  %230 = zext i8 %229 to i32
  %231 = icmp eq i32 %230, 5
  br i1 %231, label %232, label %235

232:                                              ; preds = %228
  %233 = load ptr, ptr %5, align 8, !tbaa !5
  %234 = load ptr, ptr %6, align 8, !tbaa !5
  call void @uwb_send_measurement_advertisement(ptr noundef %233, ptr noundef %234)
  br label %254

235:                                              ; preds = %228
  %236 = load i8, ptr %12, align 1, !tbaa !17
  %237 = zext i8 %236 to i32
  %238 = icmp eq i32 %237, 100
  br i1 %238, label %239, label %253

239:                                              ; preds = %235
  %240 = load ptr, ptr %5, align 8, !tbaa !5
  %241 = getelementptr inbounds %struct.uwb_protocol_handler_t, ptr %240, i32 0, i32 5
  %242 = load ptr, ptr %241, align 8, !tbaa !26
  %243 = icmp ne ptr %242, null
  br i1 %243, label %244, label %252

244:                                              ; preds = %239
  %245 = load ptr, ptr %5, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct.uwb_protocol_handler_t, ptr %245, i32 0, i32 5
  %247 = load ptr, ptr %246, align 8, !tbaa !26
  %248 = load ptr, ptr %6, align 8, !tbaa !5
  %249 = load i64, ptr %7, align 8, !tbaa !9
  %250 = load i16, ptr %10, align 2, !tbaa !11
  %251 = load i16, ptr %11, align 2, !tbaa !11
  call void %247(ptr noundef %248, i64 noundef %249, i16 noundef zeroext %250, i16 noundef zeroext %251)
  br label %252

252:                                              ; preds = %244, %239
  br label %253

253:                                              ; preds = %252, %235
  br label %254

254:                                              ; preds = %253, %232
  br label %255

255:                                              ; preds = %254, %217
  br label %256

256:                                              ; preds = %255, %199
  br label %257

257:                                              ; preds = %256, %194
  br label %258

258:                                              ; preds = %257, %98
  br label %259

259:                                              ; preds = %258, %93
  store i32 0, ptr %13, align 4
  br label %260

260:                                              ; preds = %259, %53, %40
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %9) #4
  %261 = load i32, ptr %13, align 4
  switch i32 %261, label %263 [
    i32 0, label %262
    i32 1, label %262
  ]

262:                                              ; preds = %260, %260
  ret void

263:                                              ; preds = %260
  unreachable
}

declare void @trace_integer(i8 noundef zeroext, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i64 @read_40bit_int(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i64 @substract_40bit_int(i64 noundef, i64 noundef) #0

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { 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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"", !12, i64 0, !12, i64 2, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !15, i64 40}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{!14, !12, i64 2}
!17 = !{!7, !7, i64 0}
!18 = !{!14, !15, i64 40}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!14, !6, i64 8}
!22 = !{!14, !6, i64 16}
!23 = !{!24, !24, i64 0}
!24 = !{!"float", !7, i64 0}
!25 = !{!14, !6, i64 24}
!26 = !{!14, !6, i64 32}


; 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: nounwind uwtable
declare dso_local i64 @uwb_mac_encapsulate_frame(i16 noundef zeroext, i16 noundef zeroext, i16 noundef zeroext, i8 noundef zeroext, ptr noundef, i64 noundef) local_unnamed_addr #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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @uwb_mac_decapsulate_frame(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @write_40bit_int(i64 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @uwb_send_measurement_advertisement(ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @uwb_transmit_frame(i64 noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @uwb_process_incoming_frame(ptr noundef %0, ptr noundef %1, i64 noundef %2, i64 noundef %3) local_unnamed_addr #0 {
  %5 = alloca i16, align 2
  %6 = alloca i16, align 2
  %7 = alloca i16, align 2
  %8 = alloca i8, align 1
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %8) #3
  %9 = call i64 @uwb_mac_decapsulate_frame(ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef %1, i64 noundef %2)
  %10 = load i16, ptr %5, align 2, !tbaa !5
  %11 = load i16, ptr %0, align 8, !tbaa !9
  %.not = icmp eq i16 %10, %11
  br i1 %.not, label %12, label %89

12:                                               ; preds = %4
  %13 = load i16, ptr %7, align 2
  %14 = getelementptr inbounds i8, ptr %0, i64 2
  %15 = load i16, ptr %14, align 2, !tbaa !13
  %16 = icmp ne i16 %13, %15
  %17 = icmp ne i16 %13, -1
  %or.cond = and i1 %17, %16
  br i1 %or.cond, label %89, label %18

18:                                               ; preds = %12
  %19 = load i8, ptr %8, align 1, !tbaa !14
  %20 = zext i8 %19 to i32
  call void @trace_integer(i8 noundef zeroext 4, i32 noundef %20) #3
  %21 = load i8, ptr %8, align 1, !tbaa !14
  switch i8 %21, label %89 [
    i8 0, label %22
    i8 1, label %36
    i8 2, label %46
    i8 3, label %71
    i8 4, label %77
    i8 5, label %82
    i8 100, label %83
  ]

22:                                               ; preds = %18
  %23 = getelementptr inbounds i8, ptr %0, i64 40
  %24 = load i8, ptr %23, align 8, !tbaa !15, !range !16, !noundef !17
  %25 = icmp eq i8 %24, 0
  br i1 %25, label %26, label %89

26:                                               ; preds = %22
  %27 = add i64 %3, 52428800
  %28 = and i64 %27, 1099511627264
  %29 = getelementptr inbounds i8, ptr %1, i64 5
  call void @write_40bit_int(i64 noundef %3, ptr noundef nonnull %29)
  %30 = getelementptr inbounds i8, ptr %1, i64 10
  call void @write_40bit_int(i64 noundef %28, ptr noundef nonnull %30)
  %31 = add i64 %9, 10
  %32 = load i16, ptr %6, align 2, !tbaa !5
  store i16 %32, ptr %7, align 2, !tbaa !5
  %33 = load i16, ptr %14, align 2, !tbaa !13
  store i16 %33, ptr %6, align 2, !tbaa !5
  %34 = load i16, ptr %5, align 2, !tbaa !5
  %35 = call i64 @uwb_mac_encapsulate_frame(i16 noundef zeroext %34, i16 noundef zeroext %33, i16 noundef zeroext %32, i8 noundef zeroext 1, ptr noundef %1, i64 noundef %31)
  call void @uwb_transmit_frame(i64 noundef %28, ptr noundef %1, i64 noundef %35) #3
  br label %89

36:                                               ; preds = %18
  %37 = add i64 %3, 52428800
  %38 = and i64 %37, 1099511627264
  %39 = getelementptr inbounds i8, ptr %1, i64 15
  call void @write_40bit_int(i64 noundef %3, ptr noundef nonnull %39)
  %40 = getelementptr inbounds i8, ptr %1, i64 20
  call void @write_40bit_int(i64 noundef %38, ptr noundef nonnull %40)
  %41 = add i64 %9, 10
  %42 = load i16, ptr %6, align 2, !tbaa !5
  store i16 %42, ptr %7, align 2, !tbaa !5
  %43 = load i16, ptr %14, align 2, !tbaa !13
  store i16 %43, ptr %6, align 2, !tbaa !5
  %44 = load i16, ptr %5, align 2, !tbaa !5
  %45 = call i64 @uwb_mac_encapsulate_frame(i16 noundef zeroext %44, i16 noundef zeroext %43, i16 noundef zeroext %42, i8 noundef zeroext 2, ptr noundef %1, i64 noundef %41)
  call void @uwb_transmit_frame(i64 noundef %38, ptr noundef %1, i64 noundef %45) #3
  br label %89

46:                                               ; preds = %18
  %47 = call i64 @read_40bit_int(ptr noundef %1)
  %48 = getelementptr inbounds i8, ptr %1, i64 5
  %49 = call i64 @read_40bit_int(ptr noundef nonnull %48)
  %50 = getelementptr inbounds i8, ptr %1, i64 10
  %51 = call i64 @read_40bit_int(ptr noundef nonnull %50)
  %52 = getelementptr inbounds i8, ptr %1, i64 15
  %53 = call i64 @read_40bit_int(ptr noundef nonnull %52)
  %54 = getelementptr inbounds i8, ptr %1, i64 20
  %55 = call i64 @read_40bit_int(ptr noundef nonnull %54)
  %56 = call i64 @substract_40bit_int(i64 noundef %53, i64 noundef %47)
  %57 = call i64 @substract_40bit_int(i64 noundef %3, i64 noundef %51)
  %58 = call i64 @substract_40bit_int(i64 noundef %51, i64 noundef %49)
  %59 = call i64 @substract_40bit_int(i64 noundef %55, i64 noundef %53)
  %60 = getelementptr inbounds i8, ptr %0, i64 8
  %61 = load ptr, ptr %60, align 8, !tbaa !18
  %.not80 = icmp eq ptr %61, null
  br i1 %.not80, label %89, label %62

62:                                               ; preds = %46
  %63 = mul i64 %57, %56
  %64 = mul i64 %59, %58
  %65 = sub i64 %63, %64
  %66 = add i64 %57, %56
  %67 = add i64 %66, %58
  %68 = add i64 %67, %59
  %69 = udiv i64 %65, %68
  %70 = load i16, ptr %6, align 2, !tbaa !5
  call void %61(i16 noundef zeroext %70, i64 noundef %69) #3
  br label %89

71:                                               ; preds = %18
  %.0.copyload10 = load float, ptr %1, align 1
  %72 = getelementptr inbounds i8, ptr %1, i64 4
  %.0.copyload8 = load float, ptr %72, align 1
  %73 = getelementptr inbounds i8, ptr %1, i64 8
  %.0.copyload6 = load float, ptr %73, align 1
  %74 = getelementptr inbounds i8, ptr %0, i64 16
  %75 = load ptr, ptr %74, align 8, !tbaa !19
  %76 = load i16, ptr %6, align 2, !tbaa !5
  call void %75(i16 noundef zeroext %76, float noundef %.0.copyload10, float noundef %.0.copyload8, float noundef %.0.copyload6) #3
  br label %89

77:                                               ; preds = %18
  %.0.copyload4 = load float, ptr %1, align 1
  %78 = getelementptr inbounds i8, ptr %1, i64 4
  %.0.copyload = load float, ptr %78, align 1
  %79 = getelementptr inbounds i8, ptr %0, i64 24
  %80 = load ptr, ptr %79, align 8, !tbaa !20
  %81 = load i16, ptr %6, align 2, !tbaa !5
  call void %80(i16 noundef zeroext %81, float noundef %.0.copyload4, float noundef %.0.copyload) #3
  br label %89

82:                                               ; preds = %18
  call void @uwb_send_measurement_advertisement(ptr noundef nonnull %0, ptr noundef %1)
  br label %89

83:                                               ; preds = %18
  %84 = getelementptr inbounds i8, ptr %0, i64 32
  %85 = load ptr, ptr %84, align 8, !tbaa !21
  %.not79 = icmp eq ptr %85, null
  br i1 %.not79, label %89, label %86

86:                                               ; preds = %83
  %87 = load i16, ptr %6, align 2, !tbaa !5
  %88 = load i16, ptr %7, align 2, !tbaa !5
  call void %85(ptr noundef %1, i64 noundef %9, i16 noundef zeroext %87, i16 noundef zeroext %88) #3
  br label %89

89:                                               ; preds = %26, %22, %77, %86, %83, %82, %71, %36, %62, %46, %18, %12, %4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %5) #3
  ret void
}

declare void @trace_integer(i8 noundef zeroext, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i64 @read_40bit_int(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i64 @substract_40bit_int(i64 noundef, i64 noundef) local_unnamed_addr #0

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 = { 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 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"", !6, i64 0, !6, i64 2, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !12, i64 40}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!10, !6, i64 2}
!14 = !{!7, !7, i64 0}
!15 = !{!10, !12, i64 40}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!10, !11, i64 8}
!19 = !{!10, !11, i64 16}
!20 = !{!10, !11, i64 24}
!21 = !{!10, !11, i64 32}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass