; LLVM IR from ctlst-tech/catpilot :: bsp/mcu/periph/usart/stm32 (usart)

; 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.file_operations = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.usart_t = type { [32 x i8], [32 x i8], %struct.file_operations, %struct.__UART_HandleTypeDef, %struct.dma_t, %struct.dma_t, i32, ptr, ptr, i32, i32, i32, i32, i32, %struct.usart_private_t }
%struct.__UART_HandleTypeDef = type { ptr, %struct.UART_InitTypeDef, %struct.UART_AdvFeatureInitTypeDef, ptr, i16, i16, ptr, i16, i16, i16, i32, i16, i16, i32, ptr, ptr, ptr, ptr, i32, i32, i32, i32 }
%struct.UART_InitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.UART_AdvFeatureInitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.dma_t = type { %struct.__DMA_HandleTypeDef, i32, %struct.dma_private_t }
%struct.__DMA_HandleTypeDef = type { ptr, %struct.DMA_InitTypeDef, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i32, ptr, ptr, i32 }
%struct.DMA_InitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.dma_private_t = type { i32 }
%struct.usart_private_t = type { i32, ptr, ptr, ptr, ptr, i32, i32, i32, i32, ptr, ptr, ptr, ptr, i32, i8, i8, i8, i8, i8 }

@.str = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @usart_init(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %struct.file_operations, align 8
  %7 = alloca [32 x i8], align 16
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !9
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.usart_t, ptr %8, i32 0, i32 14
  %10 = getelementptr inbounds %struct.usart_private_t, ptr %9, i32 0, i32 14
  %11 = load i8, ptr %10, align 4, !tbaa !11, !range !24, !noundef !25
  %12 = trunc i8 %11 to i1
  br i1 %12, label %13, label %14

13:                                               ; preds = %1
  store i32 0, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %267

14:                                               ; preds = %1
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = call i32 @usart_id_init(ptr noundef %15)
  store i32 %16, ptr %4, align 4, !tbaa !9
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %18, label %20

18:                                               ; preds = %14
  %19 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %19, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %267

20:                                               ; preds = %14
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = call i32 @usart_clock_init(ptr noundef %21)
  store i32 %22, ptr %4, align 4, !tbaa !9
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %24, label %26

24:                                               ; preds = %20
  %25 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %25, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %267

26:                                               ; preds = %20
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.usart_t, ptr %27, i32 0, i32 8
  %29 = load ptr, ptr %28, align 8, !tbaa !26
  %30 = call i32 @gpio_init(ptr noundef %29)
  store i32 %30, ptr %4, align 4, !tbaa !9
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %34

32:                                               ; preds = %26
  %33 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %33, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %267

34:                                               ; preds = %26
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.usart_t, ptr %35, i32 0, i32 7
  %37 = load ptr, ptr %36, align 8, !tbaa !27
  %38 = call i32 @gpio_init(ptr noundef %37)
  store i32 %38, ptr %4, align 4, !tbaa !9
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %42

40:                                               ; preds = %34
  %41 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %41, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %267

42:                                               ; preds = %34
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.usart_t, ptr %43, i32 0, i32 5
  %45 = getelementptr inbounds %struct.dma_t, ptr %44, i32 0, i32 0
  %46 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %45, i32 0, i32 0
  %47 = load ptr, ptr %46, align 8, !tbaa !28
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %100

49:                                               ; preds = %42
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.usart_t, ptr %50, i32 0, i32 4
  %52 = getelementptr inbounds %struct.dma_t, ptr %51, i32 0, i32 0
  %53 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %52, i32 0, i32 0
  %54 = load ptr, ptr %53, align 8, !tbaa !29
  %55 = icmp ne ptr %54, null
  br i1 %55, label %56, label %100

56:                                               ; preds = %49
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.usart_t, ptr %57, i32 0, i32 4
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = call i32 @dma_init(ptr noundef %58, ptr noundef @usart_dma_tx_handler, ptr noundef %59)
  store i32 %60, ptr %4, align 4, !tbaa !9
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %62, label %64

62:                                               ; preds = %56
  %63 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %63, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %267

64:                                               ; preds = %56
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.usart_t, ptr %65, i32 0, i32 5
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = call i32 @dma_init(ptr noundef %66, ptr noundef @usart_dma_rx_handler, ptr noundef %67)
  store i32 %68, ptr %4, align 4, !tbaa !9
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %70, label %72

70:                                               ; preds = %64
  %71 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %71, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %267

72:                                               ; preds = %64
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.usart_t, ptr %73, i32 0, i32 3
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.usart_t, ptr %75, i32 0, i32 4
  %77 = getelementptr inbounds %struct.dma_t, ptr %76, i32 0, i32 0
  %78 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %77, i32 0, i32 4
  store ptr %74, ptr %78, align 8, !tbaa !30
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.usart_t, ptr %79, i32 0, i32 3
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.usart_t, ptr %81, i32 0, i32 5
  %83 = getelementptr inbounds %struct.dma_t, ptr %82, i32 0, i32 0
  %84 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %83, i32 0, i32 4
  store ptr %80, ptr %84, align 8, !tbaa !31
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.usart_t, ptr %85, i32 0, i32 4
  %87 = getelementptr inbounds %struct.dma_t, ptr %86, i32 0, i32 0
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.usart_t, ptr %88, i32 0, i32 3
  %90 = getelementptr inbounds %struct.__UART_HandleTypeDef, ptr %89, i32 0, i32 16
  store ptr %87, ptr %90, align 8, !tbaa !32
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.usart_t, ptr %91, i32 0, i32 5
  %93 = getelementptr inbounds %struct.dma_t, ptr %92, i32 0, i32 0
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.usart_t, ptr %94, i32 0, i32 3
  %96 = getelementptr inbounds %struct.__UART_HandleTypeDef, ptr %95, i32 0, i32 17
  store ptr %93, ptr %96, align 8, !tbaa !33
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.usart_t, ptr %97, i32 0, i32 14
  %99 = getelementptr inbounds %struct.usart_private_t, ptr %98, i32 0, i32 17
  store i8 1, ptr %99, align 1, !tbaa !34
  br label %104

100:                                              ; preds = %49, %42
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.usart_t, ptr %101, i32 0, i32 14
  %103 = getelementptr inbounds %struct.usart_private_t, ptr %102, i32 0, i32 17
  store i8 0, ptr %103, align 1, !tbaa !34
  br label %104

104:                                              ; preds = %100, %72
  %105 = load ptr, ptr %3, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.usart_t, ptr %105, i32 0, i32 14
  %107 = getelementptr inbounds %struct.usart_private_t, ptr %106, i32 0, i32 0
  %108 = load i32, ptr %107, align 8, !tbaa !35
  %109 = load ptr, ptr %3, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.usart_t, ptr %109, i32 0, i32 11
  %111 = load i32, ptr %110, align 8, !tbaa !36
  %112 = load ptr, ptr %3, align 8, !tbaa !5
  %113 = call i32 @irq_init(i32 noundef %108, i32 noundef %111, ptr noundef @usart_handler, ptr noundef %112)
  store i32 %113, ptr %4, align 4, !tbaa !9
  %114 = icmp ne i32 %113, 0
  br i1 %114, label %115, label %117

115:                                              ; preds = %104
  %116 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %116, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %267

117:                                              ; preds = %104
  %118 = load ptr, ptr %3, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.usart_t, ptr %118, i32 0, i32 14
  %120 = getelementptr inbounds %struct.usart_private_t, ptr %119, i32 0, i32 0
  %121 = load i32, ptr %120, align 8, !tbaa !35
  %122 = call i32 @irq_enable(i32 noundef %121)
  store i32 %122, ptr %4, align 4, !tbaa !9
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %126

124:                                              ; preds = %117
  %125 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %125, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %267

126:                                              ; preds = %117
  %127 = load ptr, ptr %3, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.usart_t, ptr %127, i32 0, i32 3
  %129 = call i32 @HAL_UART_Init(ptr noundef %128)
  store i32 %129, ptr %4, align 4, !tbaa !9
  %130 = icmp ne i32 %129, 0
  br i1 %130, label %131, label %133

131:                                              ; preds = %126
  %132 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %132, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %267

133:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 88, ptr %6) #5
  %134 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 0
  store ptr @usart_open, ptr %134, align 8, !tbaa !37
  %135 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 1
  store ptr @usart_write, ptr %135, align 8, !tbaa !38
  %136 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 2
  store ptr @usart_read, ptr %136, align 8, !tbaa !39
  %137 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 3
  store ptr @usart_close, ptr %137, align 8, !tbaa !40
  %138 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 4
  store ptr @usart_ioctl, ptr %138, align 8, !tbaa !41
  %139 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 5
  store ptr null, ptr %139, align 8, !tbaa !42
  %140 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 6
  store ptr null, ptr %140, align 8, !tbaa !43
  %141 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 7
  store ptr null, ptr %141, align 8, !tbaa !44
  %142 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 8
  store ptr null, ptr %142, align 8, !tbaa !45
  %143 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 9
  store ptr null, ptr %143, align 8, !tbaa !46
  %144 = getelementptr inbounds %struct.file_operations, ptr %6, i32 0, i32 10
  %145 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %145, ptr %144, align 8, !tbaa !47
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #5
  %146 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %147 = load ptr, ptr %3, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.usart_t, ptr %147, i32 0, i32 0
  %149 = getelementptr inbounds [32 x i8], ptr %148, i64 0, i64 0
  %150 = call i32 (ptr, ptr, ...) @sprintf_(ptr noundef %146, ptr noundef @.str, ptr noundef %149)
  %151 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %152 = call ptr @node_mount(ptr noundef %151, ptr noundef %6)
  %153 = icmp eq ptr %152, null
  br i1 %153, label %154, label %155

154:                                              ; preds = %133
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %266

155:                                              ; preds = %133
  %156 = load ptr, ptr %3, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.usart_t, ptr %156, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %157, ptr align 8 %6, i64 88, i1 false), !tbaa.struct !48
  %158 = call ptr @xQueueCreateMutex(i8 noundef zeroext 1)
  %159 = load ptr, ptr %3, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.usart_t, ptr %159, i32 0, i32 14
  %161 = getelementptr inbounds %struct.usart_private_t, ptr %160, i32 0, i32 3
  store ptr %158, ptr %161, align 8, !tbaa !49
  %162 = load ptr, ptr %3, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.usart_t, ptr %162, i32 0, i32 14
  %164 = getelementptr inbounds %struct.usart_private_t, ptr %163, i32 0, i32 3
  %165 = load ptr, ptr %164, align 8, !tbaa !49
  %166 = icmp eq ptr %165, null
  br i1 %166, label %167, label %168

167:                                              ; preds = %155
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %266

168:                                              ; preds = %155
  %169 = call ptr @xQueueCreateMutex(i8 noundef zeroext 1)
  %170 = load ptr, ptr %3, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.usart_t, ptr %170, i32 0, i32 14
  %172 = getelementptr inbounds %struct.usart_private_t, ptr %171, i32 0, i32 4
  store ptr %169, ptr %172, align 8, !tbaa !50
  %173 = load ptr, ptr %3, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.usart_t, ptr %173, i32 0, i32 14
  %175 = getelementptr inbounds %struct.usart_private_t, ptr %174, i32 0, i32 4
  %176 = load ptr, ptr %175, align 8, !tbaa !50
  %177 = icmp eq ptr %176, null
  br i1 %177, label %178, label %179

178:                                              ; preds = %168
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %266

179:                                              ; preds = %168
  %180 = call ptr @xQueueGenericCreate(i64 noundef 1, i64 noundef 0, i8 noundef zeroext 3)
  %181 = load ptr, ptr %3, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.usart_t, ptr %181, i32 0, i32 14
  %183 = getelementptr inbounds %struct.usart_private_t, ptr %182, i32 0, i32 1
  store ptr %180, ptr %183, align 8, !tbaa !51
  %184 = load ptr, ptr %3, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.usart_t, ptr %184, i32 0, i32 14
  %186 = getelementptr inbounds %struct.usart_private_t, ptr %185, i32 0, i32 1
  %187 = load ptr, ptr %186, align 8, !tbaa !51
  %188 = icmp eq ptr %187, null
  br i1 %188, label %189, label %190

189:                                              ; preds = %179
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %266

190:                                              ; preds = %179
  %191 = call ptr @xQueueGenericCreate(i64 noundef 1, i64 noundef 0, i8 noundef zeroext 3)
  %192 = load ptr, ptr %3, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.usart_t, ptr %192, i32 0, i32 14
  %194 = getelementptr inbounds %struct.usart_private_t, ptr %193, i32 0, i32 2
  store ptr %191, ptr %194, align 8, !tbaa !52
  %195 = load ptr, ptr %3, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.usart_t, ptr %195, i32 0, i32 14
  %197 = getelementptr inbounds %struct.usart_private_t, ptr %196, i32 0, i32 2
  %198 = load ptr, ptr %197, align 8, !tbaa !52
  %199 = icmp eq ptr %198, null
  br i1 %199, label %200, label %201

200:                                              ; preds = %190
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %266

201:                                              ; preds = %190
  %202 = load ptr, ptr %3, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.usart_t, ptr %202, i32 0, i32 9
  %204 = load i32, ptr %203, align 8, !tbaa !53
  %205 = trunc i32 %204 to i16
  %206 = call ptr @ring_buf_init(i16 noundef zeroext %205)
  %207 = load ptr, ptr %3, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.usart_t, ptr %207, i32 0, i32 14
  %209 = getelementptr inbounds %struct.usart_private_t, ptr %208, i32 0, i32 10
  store ptr %206, ptr %209, align 8, !tbaa !54
  %210 = load ptr, ptr %3, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.usart_t, ptr %210, i32 0, i32 14
  %212 = getelementptr inbounds %struct.usart_private_t, ptr %211, i32 0, i32 10
  %213 = load ptr, ptr %212, align 8, !tbaa !54
  %214 = icmp eq ptr %213, null
  br i1 %214, label %215, label %216

215:                                              ; preds = %201
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %266

216:                                              ; preds = %201
  %217 = load ptr, ptr %3, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct.usart_t, ptr %217, i32 0, i32 9
  %219 = load i32, ptr %218, align 8, !tbaa !53
  %220 = trunc i32 %219 to i16
  %221 = call ptr @ring_buf_init(i16 noundef zeroext %220)
  %222 = load ptr, ptr %3, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.usart_t, ptr %222, i32 0, i32 14
  %224 = getelementptr inbounds %struct.usart_private_t, ptr %223, i32 0, i32 9
  store ptr %221, ptr %224, align 8, !tbaa !55
  %225 = load ptr, ptr %3, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.usart_t, ptr %225, i32 0, i32 14
  %227 = getelementptr inbounds %struct.usart_private_t, ptr %226, i32 0, i32 9
  %228 = load ptr, ptr %227, align 8, !tbaa !55
  %229 = icmp eq ptr %228, null
  br i1 %229, label %230, label %231

230:                                              ; preds = %216
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %266

231:                                              ; preds = %216
  %232 = load ptr, ptr %3, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.usart_t, ptr %232, i32 0, i32 9
  %234 = load i32, ptr %233, align 8, !tbaa !53
  %235 = sext i32 %234 to i64
  %236 = call noalias ptr @calloc(i64 noundef %235, i64 noundef 1) #6
  %237 = load ptr, ptr %3, align 8, !tbaa !5
  %238 = getelementptr inbounds %struct.usart_t, ptr %237, i32 0, i32 14
  %239 = getelementptr inbounds %struct.usart_private_t, ptr %238, i32 0, i32 11
  store ptr %236, ptr %239, align 8, !tbaa !56
  %240 = load ptr, ptr %3, align 8, !tbaa !5
  %241 = getelementptr inbounds %struct.usart_t, ptr %240, i32 0, i32 14
  %242 = getelementptr inbounds %struct.usart_private_t, ptr %241, i32 0, i32 11
  %243 = load ptr, ptr %242, align 8, !tbaa !56
  %244 = icmp eq ptr %243, null
  br i1 %244, label %245, label %246

245:                                              ; preds = %231
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %266

246:                                              ; preds = %231
  %247 = load ptr, ptr %3, align 8, !tbaa !5
  %248 = getelementptr inbounds %struct.usart_t, ptr %247, i32 0, i32 9
  %249 = load i32, ptr %248, align 8, !tbaa !53
  %250 = sext i32 %249 to i64
  %251 = call noalias ptr @calloc(i64 noundef %250, i64 noundef 1) #6
  %252 = load ptr, ptr %3, align 8, !tbaa !5
  %253 = getelementptr inbounds %struct.usart_t, ptr %252, i32 0, i32 14
  %254 = getelementptr inbounds %struct.usart_private_t, ptr %253, i32 0, i32 12
  store ptr %251, ptr %254, align 8, !tbaa !57
  %255 = load ptr, ptr %3, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct.usart_t, ptr %255, i32 0, i32 14
  %257 = getelementptr inbounds %struct.usart_private_t, ptr %256, i32 0, i32 12
  %258 = load ptr, ptr %257, align 8, !tbaa !57
  %259 = icmp eq ptr %258, null
  br i1 %259, label %260, label %261

260:                                              ; preds = %246
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %266

261:                                              ; preds = %246
  %262 = load ptr, ptr %3, align 8, !tbaa !5
  %263 = getelementptr inbounds %struct.usart_t, ptr %262, i32 0, i32 14
  %264 = getelementptr inbounds %struct.usart_private_t, ptr %263, i32 0, i32 14
  store i8 1, ptr %264, align 4, !tbaa !11
  %265 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %265, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %266

266:                                              ; preds = %261, %260, %245, %230, %215, %200, %189, %178, %167, %154
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 88, ptr %6) #5
  br label %267

267:                                              ; preds = %266, %131, %124, %115, %70, %62, %40, %32, %24, %18, %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  %268 = load i32, ptr %2, align 4
  ret i32 %268
}

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

; Function Attrs: nounwind uwtable
declare hidden i32 @usart_id_init(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @usart_clock_init(ptr noundef) #0

declare i32 @gpio_init(ptr noundef) #2

declare i32 @dma_init(ptr noundef, ptr noundef, ptr noundef) #2

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

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

declare i32 @irq_init(i32 noundef, i32 noundef, ptr noundef, ptr noundef) #2

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

declare i32 @irq_enable(i32 noundef) #2

declare i32 @HAL_UART_Init(ptr noundef) #2

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @usart_close(ptr noundef) #0

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

declare i32 @sprintf_(ptr noundef, ptr noundef, ...) #2

declare ptr @node_mount(ptr noundef, ptr 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

declare ptr @xQueueCreateMutex(i8 noundef zeroext) #2

declare ptr @xQueueGenericCreate(i64 noundef, i64 noundef, i8 noundef zeroext) #2

declare ptr @ring_buf_init(i16 noundef zeroext) #2

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #4

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

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 allocsize(0,1) "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 }
attributes #6 = { nounwind allocsize(0,1) }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !23, i64 860}
!12 = !{!"", !7, i64 0, !7, i64 32, !13, i64 64, !14, i64 152, !18, i64 336, !18, i64 528, !10, i64 720, !6, i64 728, !6, i64 736, !10, i64 744, !10, i64 748, !10, i64 752, !10, i64 756, !10, i64 760, !22, i64 768}
!13 = !{!"file_operations", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80}
!14 = !{!"__UART_HandleTypeDef", !6, i64 0, !15, i64 8, !16, i64 44, !6, i64 88, !17, i64 96, !17, i64 98, !6, i64 104, !17, i64 112, !17, i64 114, !17, i64 116, !10, i64 120, !17, i64 124, !17, i64 126, !10, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !10, i64 168, !10, i64 172, !10, i64 176, !10, i64 180}
!15 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32}
!16 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36}
!17 = !{!"short", !7, i64 0}
!18 = !{!"", !19, i64 0, !10, i64 184, !21, i64 188}
!19 = !{!"__DMA_HandleTypeDef", !6, i64 0, !20, i64 8, !10, i64 56, !10, i64 60, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !10, i64 120, !10, i64 124, !10, i64 128, !6, i64 136, !6, i64 144, !10, i64 152, !6, i64 160, !6, i64 168, !10, i64 176}
!20 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44}
!21 = !{!"", !10, i64 0}
!22 = !{!"", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !23, i64 92, !23, i64 93, !23, i64 94, !23, i64 95, !23, i64 96}
!23 = !{!"_Bool", !7, i64 0}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = !{!12, !6, i64 736}
!27 = !{!12, !6, i64 728}
!28 = !{!12, !6, i64 528}
!29 = !{!12, !6, i64 336}
!30 = !{!12, !6, i64 400}
!31 = !{!12, !6, i64 592}
!32 = !{!12, !6, i64 304}
!33 = !{!12, !6, i64 312}
!34 = !{!12, !23, i64 863}
!35 = !{!12, !10, i64 768}
!36 = !{!12, !10, i64 752}
!37 = !{!13, !6, i64 0}
!38 = !{!13, !6, i64 8}
!39 = !{!13, !6, i64 16}
!40 = !{!13, !6, i64 24}
!41 = !{!13, !6, i64 32}
!42 = !{!13, !6, i64 40}
!43 = !{!13, !6, i64 48}
!44 = !{!13, !6, i64 56}
!45 = !{!13, !6, i64 64}
!46 = !{!13, !6, i64 72}
!47 = !{!13, !6, i64 80}
!48 = !{i64 0, i64 8, !5, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 8, !5, i64 32, i64 8, !5, i64 40, i64 8, !5, i64 48, i64 8, !5, i64 56, i64 8, !5, i64 64, i64 8, !5, i64 72, i64 8, !5, i64 80, i64 8, !5}
!49 = !{!12, !6, i64 792}
!50 = !{!12, !6, i64 800}
!51 = !{!12, !6, i64 776}
!52 = !{!12, !6, i64 784}
!53 = !{!12, !10, i64 744}
!54 = !{!12, !6, i64 832}
!55 = !{!12, !6, i64 824}
!56 = !{!12, !6, i64 840}
!57 = !{!12, !6, i64 848}


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

@.str = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @usart_init(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca %struct.file_operations, align 8
  %3 = alloca [32 x i8], align 16
  %4 = getelementptr inbounds i8, ptr %0, i64 768
  %5 = getelementptr inbounds i8, ptr %0, i64 860
  %6 = load i8, ptr %5, align 4, !tbaa !5, !range !22, !noundef !23
  %7 = trunc nuw i8 %6 to i1
  br i1 %7, label %100, label %8

8:                                                ; preds = %1
  %9 = tail call i32 @usart_id_init(ptr noundef nonnull %0)
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %10, label %100

10:                                               ; preds = %8
  %11 = tail call i32 @usart_clock_init(ptr noundef nonnull %0)
  %.not70 = icmp eq i32 %11, 0
  br i1 %.not70, label %12, label %100

12:                                               ; preds = %10
  %13 = getelementptr inbounds i8, ptr %0, i64 736
  %14 = load ptr, ptr %13, align 8, !tbaa !24
  %15 = tail call i32 @gpio_init(ptr noundef %14) #6
  %.not71 = icmp eq i32 %15, 0
  br i1 %.not71, label %16, label %100

16:                                               ; preds = %12
  %17 = getelementptr inbounds i8, ptr %0, i64 728
  %18 = load ptr, ptr %17, align 8, !tbaa !25
  %19 = tail call i32 @gpio_init(ptr noundef %18) #6
  %.not72 = icmp eq i32 %19, 0
  br i1 %.not72, label %20, label %100

20:                                               ; preds = %16
  %21 = getelementptr inbounds i8, ptr %0, i64 528
  %22 = load ptr, ptr %21, align 8, !tbaa !26
  %.not73 = icmp eq ptr %22, null
  br i1 %.not73, label %36, label %23

23:                                               ; preds = %20
  %24 = getelementptr inbounds i8, ptr %0, i64 336
  %25 = load ptr, ptr %24, align 8, !tbaa !27
  %.not74 = icmp eq ptr %25, null
  br i1 %.not74, label %36, label %26

26:                                               ; preds = %23
  %27 = tail call i32 @dma_init(ptr noundef nonnull %24, ptr noundef nonnull @usart_dma_tx_handler, ptr noundef nonnull %0) #6
  %.not75 = icmp eq i32 %27, 0
  br i1 %.not75, label %28, label %100

28:                                               ; preds = %26
  %29 = tail call i32 @dma_init(ptr noundef nonnull %21, ptr noundef nonnull @usart_dma_rx_handler, ptr noundef nonnull %0) #6
  %.not76 = icmp eq i32 %29, 0
  br i1 %.not76, label %30, label %100

30:                                               ; preds = %28
  %31 = getelementptr inbounds i8, ptr %0, i64 152
  %32 = getelementptr inbounds i8, ptr %0, i64 400
  store ptr %31, ptr %32, align 8, !tbaa !28
  %33 = getelementptr inbounds i8, ptr %0, i64 592
  store ptr %31, ptr %33, align 8, !tbaa !29
  %34 = getelementptr inbounds i8, ptr %0, i64 304
  store ptr %24, ptr %34, align 8, !tbaa !30
  %35 = getelementptr inbounds i8, ptr %0, i64 312
  store ptr %21, ptr %35, align 8, !tbaa !31
  br label %36

36:                                               ; preds = %20, %23, %30
  %.sink = phi i8 [ 1, %30 ], [ 0, %23 ], [ 0, %20 ]
  %37 = getelementptr inbounds i8, ptr %0, i64 863
  store i8 %.sink, ptr %37, align 1, !tbaa !32
  %38 = load i32, ptr %4, align 8, !tbaa !33
  %39 = getelementptr inbounds i8, ptr %0, i64 752
  %40 = load i32, ptr %39, align 8, !tbaa !34
  %41 = tail call i32 @irq_init(i32 noundef %38, i32 noundef %40, ptr noundef nonnull @usart_handler, ptr noundef nonnull %0) #6
  %.not77 = icmp eq i32 %41, 0
  br i1 %.not77, label %42, label %100

42:                                               ; preds = %36
  %43 = load i32, ptr %4, align 8, !tbaa !33
  %44 = tail call i32 @irq_enable(i32 noundef %43) #6
  %.not78 = icmp eq i32 %44, 0
  br i1 %.not78, label %45, label %100

45:                                               ; preds = %42
  %46 = getelementptr inbounds i8, ptr %0, i64 152
  %47 = tail call i32 @HAL_UART_Init(ptr noundef nonnull %46) #6
  %.not79 = icmp eq i32 %47, 0
  br i1 %.not79, label %48, label %100

48:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %2) #6
  store ptr @usart_open, ptr %2, align 8, !tbaa !35
  %49 = getelementptr inbounds i8, ptr %2, i64 8
  store ptr @usart_write, ptr %49, align 8, !tbaa !36
  %50 = getelementptr inbounds i8, ptr %2, i64 16
  store ptr @usart_read, ptr %50, align 8, !tbaa !37
  %51 = getelementptr inbounds i8, ptr %2, i64 24
  store ptr @usart_close, ptr %51, align 8, !tbaa !38
  %52 = getelementptr inbounds i8, ptr %2, i64 32
  store ptr @usart_ioctl, ptr %52, align 8, !tbaa !39
  %53 = getelementptr inbounds i8, ptr %2, i64 40
  %54 = getelementptr inbounds i8, ptr %2, i64 80
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %53, i8 0, i64 40, i1 false)
  store ptr %0, ptr %54, align 8, !tbaa !40
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #6
  %55 = call i32 (ptr, ptr, ...) @sprintf_(ptr noundef nonnull %3, ptr noundef nonnull @.str, ptr noundef nonnull %0) #6
  %56 = call ptr @node_mount(ptr noundef nonnull %3, ptr noundef nonnull %2) #6
  %57 = icmp eq ptr %56, null
  br i1 %57, label %99, label %58

58:                                               ; preds = %48
  %59 = getelementptr inbounds i8, ptr %0, i64 64
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(88) %59, ptr noundef nonnull align 8 dereferenceable(88) %2, i64 88, i1 false), !tbaa.struct !41
  %60 = call ptr @xQueueCreateMutex(i8 noundef zeroext 1) #6
  %61 = getelementptr inbounds i8, ptr %0, i64 792
  store ptr %60, ptr %61, align 8, !tbaa !43
  %62 = icmp eq ptr %60, null
  br i1 %62, label %99, label %63

63:                                               ; preds = %58
  %64 = call ptr @xQueueCreateMutex(i8 noundef zeroext 1) #6
  %65 = getelementptr inbounds i8, ptr %0, i64 800
  store ptr %64, ptr %65, align 8, !tbaa !44
  %66 = icmp eq ptr %64, null
  br i1 %66, label %99, label %67

67:                                               ; preds = %63
  %68 = call ptr @xQueueGenericCreate(i64 noundef 1, i64 noundef 0, i8 noundef zeroext 3) #6
  %69 = getelementptr inbounds i8, ptr %0, i64 776
  store ptr %68, ptr %69, align 8, !tbaa !45
  %70 = icmp eq ptr %68, null
  br i1 %70, label %99, label %71

71:                                               ; preds = %67
  %72 = call ptr @xQueueGenericCreate(i64 noundef 1, i64 noundef 0, i8 noundef zeroext 3) #6
  %73 = getelementptr inbounds i8, ptr %0, i64 784
  store ptr %72, ptr %73, align 8, !tbaa !46
  %74 = icmp eq ptr %72, null
  br i1 %74, label %99, label %75

75:                                               ; preds = %71
  %76 = getelementptr inbounds i8, ptr %0, i64 744
  %77 = load i32, ptr %76, align 8, !tbaa !47
  %78 = trunc i32 %77 to i16
  %79 = call ptr @ring_buf_init(i16 noundef zeroext %78) #6
  %80 = getelementptr inbounds i8, ptr %0, i64 832
  store ptr %79, ptr %80, align 8, !tbaa !48
  %81 = icmp eq ptr %79, null
  br i1 %81, label %99, label %82

82:                                               ; preds = %75
  %83 = load i32, ptr %76, align 8, !tbaa !47
  %84 = trunc i32 %83 to i16
  %85 = call ptr @ring_buf_init(i16 noundef zeroext %84) #6
  %86 = getelementptr inbounds i8, ptr %0, i64 824
  store ptr %85, ptr %86, align 8, !tbaa !49
  %87 = icmp eq ptr %85, null
  br i1 %87, label %99, label %88

88:                                               ; preds = %82
  %89 = load i32, ptr %76, align 8, !tbaa !47
  %90 = sext i32 %89 to i64
  %91 = call noalias ptr @calloc(i64 noundef %90, i64 noundef 1) #7
  %92 = getelementptr inbounds i8, ptr %0, i64 840
  store ptr %91, ptr %92, align 8, !tbaa !50
  %93 = icmp eq ptr %91, null
  br i1 %93, label %99, label %94

94:                                               ; preds = %88
  %95 = call noalias ptr @calloc(i64 noundef %90, i64 noundef 1) #7
  %96 = getelementptr inbounds i8, ptr %0, i64 848
  store ptr %95, ptr %96, align 8, !tbaa !51
  %97 = icmp eq ptr %95, null
  br i1 %97, label %99, label %98

98:                                               ; preds = %94
  store i8 1, ptr %5, align 4, !tbaa !5
  br label %99

99:                                               ; preds = %94, %88, %82, %75, %71, %67, %63, %58, %48, %98
  %.0 = phi i32 [ 0, %98 ], [ -1, %48 ], [ -1, %58 ], [ -1, %63 ], [ -1, %67 ], [ -1, %71 ], [ -1, %75 ], [ -1, %82 ], [ -1, %88 ], [ -1, %94 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %2) #6
  br label %100

100:                                              ; preds = %45, %42, %36, %28, %26, %16, %12, %10, %8, %1, %99
  %.1 = phi i32 [ %.0, %99 ], [ 0, %1 ], [ %9, %8 ], [ %11, %10 ], [ %15, %12 ], [ %19, %16 ], [ %27, %26 ], [ %29, %28 ], [ %41, %36 ], [ %44, %42 ], [ %47, %45 ]
  ret i32 %.1
}

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

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

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

declare i32 @gpio_init(ptr noundef) local_unnamed_addr #2

declare i32 @dma_init(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

declare i32 @irq_init(i32 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare i32 @irq_enable(i32 noundef) local_unnamed_addr #2

declare i32 @HAL_UART_Init(ptr noundef) local_unnamed_addr #2

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @usart_close(ptr noundef) #0

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

declare i32 @sprintf_(ptr noundef, ptr noundef, ...) local_unnamed_addr #2

declare ptr @node_mount(ptr noundef, ptr noundef) local_unnamed_addr #2

; 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

declare ptr @xQueueCreateMutex(i8 noundef zeroext) local_unnamed_addr #2

declare ptr @xQueueGenericCreate(i64 noundef, i64 noundef, i8 noundef zeroext) local_unnamed_addr #2

declare ptr @ring_buf_init(i16 noundef zeroext) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress 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: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0,1) }

!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, !21, i64 860}
!6 = !{!"", !7, i64 0, !7, i64 32, !9, i64 64, !11, i64 152, !16, i64 336, !16, i64 528, !13, i64 720, !10, i64 728, !10, i64 736, !13, i64 744, !13, i64 748, !13, i64 752, !13, i64 756, !13, i64 760, !20, i64 768}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"file_operations", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!"__UART_HandleTypeDef", !10, i64 0, !12, i64 8, !14, i64 44, !10, i64 88, !15, i64 96, !15, i64 98, !10, i64 104, !15, i64 112, !15, i64 114, !15, i64 116, !13, i64 120, !15, i64 124, !15, i64 126, !13, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !13, i64 168, !13, i64 172, !13, i64 176, !13, i64 180}
!12 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32}
!13 = !{!"int", !7, i64 0}
!14 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36}
!15 = !{!"short", !7, i64 0}
!16 = !{!"", !17, i64 0, !13, i64 184, !19, i64 188}
!17 = !{!"__DMA_HandleTypeDef", !10, i64 0, !18, i64 8, !13, i64 56, !13, i64 60, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !13, i64 120, !13, i64 124, !13, i64 128, !10, i64 136, !10, i64 144, !13, i64 152, !10, i64 160, !10, i64 168, !13, i64 176}
!18 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44}
!19 = !{!"", !13, i64 0}
!20 = !{!"", !13, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !13, i64 88, !21, i64 92, !21, i64 93, !21, i64 94, !21, i64 95, !21, i64 96}
!21 = !{!"_Bool", !7, i64 0}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!6, !10, i64 736}
!25 = !{!6, !10, i64 728}
!26 = !{!6, !10, i64 528}
!27 = !{!6, !10, i64 336}
!28 = !{!6, !10, i64 400}
!29 = !{!6, !10, i64 592}
!30 = !{!6, !10, i64 304}
!31 = !{!6, !10, i64 312}
!32 = !{!6, !21, i64 863}
!33 = !{!6, !13, i64 768}
!34 = !{!6, !13, i64 752}
!35 = !{!9, !10, i64 0}
!36 = !{!9, !10, i64 8}
!37 = !{!9, !10, i64 16}
!38 = !{!9, !10, i64 24}
!39 = !{!9, !10, i64 32}
!40 = !{!9, !10, i64 80}
!41 = !{i64 0, i64 8, !42, i64 8, i64 8, !42, i64 16, i64 8, !42, i64 24, i64 8, !42, i64 32, i64 8, !42, i64 40, i64 8, !42, i64 48, i64 8, !42, i64 56, i64 8, !42, i64 64, i64 8, !42, i64 72, i64 8, !42, i64 80, i64 8, !42}
!42 = !{!10, !10, i64 0}
!43 = !{!6, !10, i64 792}
!44 = !{!6, !10, i64 800}
!45 = !{!6, !10, i64 776}
!46 = !{!6, !10, i64 784}
!47 = !{!6, !13, i64 744}
!48 = !{!6, !10, i64 832}
!49 = !{!6, !10, i64 824}
!50 = !{!6, !10, i64 840}
!51 = !{!6, !10, i64 848}


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