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

; 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.usb_t = type { [32 x i8], [32 x i8], %struct.file_operations, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, %struct.usb_private_t }
%struct.usb_private_t = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i8, i8, i8, i8, i32, i32, i8 }

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

; Function Attrs: nounwind uwtable
define dso_local i32 @usb_init(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca %struct.file_operations, align 8
  %5 = alloca [32 x i8], align 16
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %7 = load ptr, ptr @usb, align 8, !tbaa !5
  %8 = icmp ne ptr %7, null
  br i1 %8, label %9, label %10

9:                                                ; preds = %1
  store i32 16, ptr %2, align 4
  br label %153

10:                                               ; preds = %1
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %11, ptr @usb, align 8, !tbaa !5
  %12 = call ptr @xQueueCreateMutex(i8 noundef zeroext 1)
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.usb_t, ptr %13, i32 0, i32 12
  %15 = getelementptr inbounds %struct.usb_private_t, ptr %14, i32 0, i32 3
  store ptr %12, ptr %15, align 8, !tbaa !9
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.usb_t, ptr %16, i32 0, i32 12
  %18 = getelementptr inbounds %struct.usb_private_t, ptr %17, i32 0, i32 3
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = icmp eq ptr %19, null
  br i1 %20, label %21, label %22

21:                                               ; preds = %10
  store i32 -1, ptr %2, align 4
  br label %153

22:                                               ; preds = %10
  %23 = call ptr @xQueueCreateMutex(i8 noundef zeroext 1)
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.usb_t, ptr %24, i32 0, i32 12
  %26 = getelementptr inbounds %struct.usb_private_t, ptr %25, i32 0, i32 4
  store ptr %23, ptr %26, align 8, !tbaa !15
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.usb_t, ptr %27, i32 0, i32 12
  %29 = getelementptr inbounds %struct.usb_private_t, ptr %28, i32 0, i32 4
  %30 = load ptr, ptr %29, align 8, !tbaa !15
  %31 = icmp eq ptr %30, null
  br i1 %31, label %32, label %33

32:                                               ; preds = %22
  store i32 -1, ptr %2, align 4
  br label %153

33:                                               ; preds = %22
  %34 = call ptr @xQueueGenericCreate(i64 noundef 1, i64 noundef 0, i8 noundef zeroext 3)
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.usb_t, ptr %35, i32 0, i32 12
  %37 = getelementptr inbounds %struct.usb_private_t, ptr %36, i32 0, i32 1
  store ptr %34, ptr %37, align 8, !tbaa !16
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.usb_t, ptr %38, i32 0, i32 12
  %40 = getelementptr inbounds %struct.usb_private_t, ptr %39, i32 0, i32 1
  %41 = load ptr, ptr %40, align 8, !tbaa !16
  %42 = icmp eq ptr %41, null
  br i1 %42, label %43, label %44

43:                                               ; preds = %33
  store i32 -1, ptr %2, align 4
  br label %153

44:                                               ; preds = %33
  %45 = call ptr @xQueueGenericCreate(i64 noundef 1, i64 noundef 0, i8 noundef zeroext 3)
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.usb_t, ptr %46, i32 0, i32 12
  %48 = getelementptr inbounds %struct.usb_private_t, ptr %47, i32 0, i32 2
  store ptr %45, ptr %48, align 8, !tbaa !17
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.usb_t, ptr %49, i32 0, i32 12
  %51 = getelementptr inbounds %struct.usb_private_t, ptr %50, i32 0, i32 2
  %52 = load ptr, ptr %51, align 8, !tbaa !17
  %53 = icmp eq ptr %52, null
  br i1 %53, label %54, label %55

54:                                               ; preds = %44
  store i32 -1, ptr %2, align 4
  br label %153

55:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 88, ptr %4) #5
  %56 = getelementptr inbounds %struct.file_operations, ptr %4, i32 0, i32 0
  store ptr @usb_open, ptr %56, align 8, !tbaa !18
  %57 = getelementptr inbounds %struct.file_operations, ptr %4, i32 0, i32 1
  store ptr @usb_write, ptr %57, align 8, !tbaa !19
  %58 = getelementptr inbounds %struct.file_operations, ptr %4, i32 0, i32 2
  store ptr @usb_read, ptr %58, align 8, !tbaa !20
  %59 = getelementptr inbounds %struct.file_operations, ptr %4, i32 0, i32 3
  store ptr @usb_close, ptr %59, align 8, !tbaa !21
  %60 = getelementptr inbounds %struct.file_operations, ptr %4, i32 0, i32 4
  store ptr @usb_ioctl, ptr %60, align 8, !tbaa !22
  %61 = getelementptr inbounds %struct.file_operations, ptr %4, i32 0, i32 5
  store ptr null, ptr %61, align 8, !tbaa !23
  %62 = getelementptr inbounds %struct.file_operations, ptr %4, i32 0, i32 6
  store ptr null, ptr %62, align 8, !tbaa !24
  %63 = getelementptr inbounds %struct.file_operations, ptr %4, i32 0, i32 7
  store ptr null, ptr %63, align 8, !tbaa !25
  %64 = getelementptr inbounds %struct.file_operations, ptr %4, i32 0, i32 8
  store ptr null, ptr %64, align 8, !tbaa !26
  %65 = getelementptr inbounds %struct.file_operations, ptr %4, i32 0, i32 9
  store ptr null, ptr %65, align 8, !tbaa !27
  %66 = getelementptr inbounds %struct.file_operations, ptr %4, i32 0, i32 10
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %67, ptr %66, align 8, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 32, ptr %5) #5
  %68 = getelementptr inbounds [32 x i8], ptr %5, i64 0, i64 0
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.usb_t, ptr %69, i32 0, i32 0
  %71 = getelementptr inbounds [32 x i8], ptr %70, i64 0, i64 0
  %72 = call i32 (ptr, ptr, ...) @sprintf_(ptr noundef %68, ptr noundef @.str, ptr noundef %71)
  %73 = getelementptr inbounds [32 x i8], ptr %5, i64 0, i64 0
  %74 = call ptr @node_mount(ptr noundef %73, ptr noundef %4)
  %75 = icmp eq ptr %74, null
  br i1 %75, label %76, label %77

76:                                               ; preds = %55
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %152

77:                                               ; preds = %55
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.usb_t, ptr %78, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %79, ptr align 8 %4, i64 88, i1 false), !tbaa.struct !29
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.usb_t, ptr %80, i32 0, i32 8
  %82 = load i32, ptr %81, align 8, !tbaa !30
  %83 = trunc i32 %82 to i16
  %84 = call ptr @ring_buf_init(i16 noundef zeroext %83)
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.usb_t, ptr %85, i32 0, i32 12
  %87 = getelementptr inbounds %struct.usb_private_t, ptr %86, i32 0, i32 6
  store ptr %84, ptr %87, align 8, !tbaa !31
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.usb_t, ptr %88, i32 0, i32 12
  %90 = getelementptr inbounds %struct.usb_private_t, ptr %89, i32 0, i32 6
  %91 = load ptr, ptr %90, align 8, !tbaa !31
  %92 = icmp eq ptr %91, null
  br i1 %92, label %93, label %94

93:                                               ; preds = %77
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %152

94:                                               ; preds = %77
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.usb_t, ptr %95, i32 0, i32 8
  %97 = load i32, ptr %96, align 8, !tbaa !30
  %98 = trunc i32 %97 to i16
  %99 = call ptr @ring_buf_init(i16 noundef zeroext %98)
  %100 = load ptr, ptr %3, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.usb_t, ptr %100, i32 0, i32 12
  %102 = getelementptr inbounds %struct.usb_private_t, ptr %101, i32 0, i32 5
  store ptr %99, ptr %102, align 8, !tbaa !32
  %103 = load ptr, ptr %3, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.usb_t, ptr %103, i32 0, i32 12
  %105 = getelementptr inbounds %struct.usb_private_t, ptr %104, i32 0, i32 5
  %106 = load ptr, ptr %105, align 8, !tbaa !32
  %107 = icmp eq ptr %106, null
  br i1 %107, label %108, label %109

108:                                              ; preds = %94
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %152

109:                                              ; preds = %94
  %110 = load ptr, ptr %3, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.usb_t, ptr %110, i32 0, i32 8
  %112 = load i32, ptr %111, align 8, !tbaa !30
  %113 = sext i32 %112 to i64
  %114 = call noalias ptr @calloc(i64 noundef %113, i64 noundef 1) #6
  %115 = load ptr, ptr %3, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.usb_t, ptr %115, i32 0, i32 12
  %117 = getelementptr inbounds %struct.usb_private_t, ptr %116, i32 0, i32 7
  store ptr %114, ptr %117, align 8, !tbaa !33
  %118 = load ptr, ptr %3, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.usb_t, ptr %118, i32 0, i32 12
  %120 = getelementptr inbounds %struct.usb_private_t, ptr %119, i32 0, i32 7
  %121 = load ptr, ptr %120, align 8, !tbaa !33
  %122 = icmp eq ptr %121, null
  br i1 %122, label %123, label %124

123:                                              ; preds = %109
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %152

124:                                              ; preds = %109
  %125 = load ptr, ptr %3, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.usb_t, ptr %125, i32 0, i32 8
  %127 = load i32, ptr %126, align 8, !tbaa !30
  %128 = sext i32 %127 to i64
  %129 = call noalias ptr @calloc(i64 noundef %128, i64 noundef 1) #6
  %130 = load ptr, ptr %3, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.usb_t, ptr %130, i32 0, i32 12
  %132 = getelementptr inbounds %struct.usb_private_t, ptr %131, i32 0, i32 8
  store ptr %129, ptr %132, align 8, !tbaa !34
  %133 = load ptr, ptr %3, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.usb_t, ptr %133, i32 0, i32 12
  %135 = getelementptr inbounds %struct.usb_private_t, ptr %134, i32 0, i32 8
  %136 = load ptr, ptr %135, align 8, !tbaa !34
  %137 = icmp eq ptr %136, null
  br i1 %137, label %138, label %139

138:                                              ; preds = %124
  store i32 -1, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %152

139:                                              ; preds = %124
  %140 = load ptr, ptr %3, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.usb_t, ptr %140, i32 0, i32 12
  %142 = getelementptr inbounds %struct.usb_private_t, ptr %141, i32 0, i32 14
  store i32 0, ptr %142, align 8, !tbaa !35
  %143 = load ptr, ptr %3, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.usb_t, ptr %143, i32 0, i32 12
  %145 = getelementptr inbounds %struct.usb_private_t, ptr %144, i32 0, i32 15
  store i32 0, ptr %145, align 4, !tbaa !36
  %146 = load ptr, ptr %3, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.usb_t, ptr %146, i32 0, i32 12
  %148 = getelementptr inbounds %struct.usb_private_t, ptr %147, i32 0, i32 16
  store i8 0, ptr %148, align 8, !tbaa !37
  call void @MX_USB_DEVICE_Init()
  %149 = load ptr, ptr %3, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.usb_t, ptr %149, i32 0, i32 12
  %151 = getelementptr inbounds %struct.usb_private_t, ptr %150, i32 0, i32 10
  store i8 1, ptr %151, align 4, !tbaa !38
  store i32 0, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %152

152:                                              ; preds = %139, %138, %123, %108, %93, %76
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 88, ptr %4) #5
  br label %153

153:                                              ; preds = %152, %54, %43, %32, %21, %9
  %154 = load i32, ptr %2, align 4
  ret i32 %154
}

declare ptr @xQueueCreateMutex(i8 noundef zeroext) #1

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

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

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

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

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

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

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

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

declare ptr @node_mount(ptr noundef, ptr noundef) #1

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

declare ptr @ring_buf_init(i16 noundef zeroext) #1

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

declare void @MX_USB_DEVICE_Init() #1

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

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 232}
!10 = !{!"", !7, i64 0, !7, i64 32, !11, i64 64, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !12, i64 192, !12, i64 196, !12, i64 200, !12, i64 204, !13, i64 208}
!11 = !{!"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}
!12 = !{!"int", !7, i64 0}
!13 = !{!"", !12, 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, !12, i64 72, !14, i64 76, !14, i64 77, !14, i64 78, !14, i64 79, !12, i64 80, !12, i64 84, !14, i64 88}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!10, !6, i64 240}
!16 = !{!10, !6, i64 216}
!17 = !{!10, !6, i64 224}
!18 = !{!11, !6, i64 0}
!19 = !{!11, !6, i64 8}
!20 = !{!11, !6, i64 16}
!21 = !{!11, !6, i64 24}
!22 = !{!11, !6, i64 32}
!23 = !{!11, !6, i64 40}
!24 = !{!11, !6, i64 48}
!25 = !{!11, !6, i64 56}
!26 = !{!11, !6, i64 64}
!27 = !{!11, !6, i64 72}
!28 = !{!11, !6, i64 80}
!29 = !{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}
!30 = !{!10, !12, i64 192}
!31 = !{!10, !6, i64 256}
!32 = !{!10, !6, i64 248}
!33 = !{!10, !6, i64 264}
!34 = !{!10, !6, i64 272}
!35 = !{!10, !12, i64 288}
!36 = !{!10, !12, i64 292}
!37 = !{!10, !14, i64 296}
!38 = !{!10, !14, i64 284}


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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 17) i32 @usb_init(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca %struct.file_operations, align 8
  %3 = alloca [32 x i8], align 16
  %4 = load ptr, ptr @usb, align 8, !tbaa !5
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %5, label %59

5:                                                ; preds = %1
  store ptr %0, ptr @usb, align 8, !tbaa !5
  %6 = tail call ptr @xQueueCreateMutex(i8 noundef zeroext 1) #6
  %7 = getelementptr inbounds i8, ptr %0, i64 232
  store ptr %6, ptr %7, align 8, !tbaa !9
  %8 = icmp eq ptr %6, null
  br i1 %8, label %59, label %9

9:                                                ; preds = %5
  %10 = tail call ptr @xQueueCreateMutex(i8 noundef zeroext 1) #6
  %11 = getelementptr inbounds i8, ptr %0, i64 240
  store ptr %10, ptr %11, align 8, !tbaa !15
  %12 = icmp eq ptr %10, null
  br i1 %12, label %59, label %13

13:                                               ; preds = %9
  %14 = tail call ptr @xQueueGenericCreate(i64 noundef 1, i64 noundef 0, i8 noundef zeroext 3) #6
  %15 = getelementptr inbounds i8, ptr %0, i64 216
  store ptr %14, ptr %15, align 8, !tbaa !16
  %16 = icmp eq ptr %14, null
  br i1 %16, label %59, label %17

17:                                               ; preds = %13
  %18 = tail call ptr @xQueueGenericCreate(i64 noundef 1, i64 noundef 0, i8 noundef zeroext 3) #6
  %19 = getelementptr inbounds i8, ptr %0, i64 224
  store ptr %18, ptr %19, align 8, !tbaa !17
  %20 = icmp eq ptr %18, null
  br i1 %20, label %59, label %21

21:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %2) #6
  store ptr @usb_open, ptr %2, align 8, !tbaa !18
  %22 = getelementptr inbounds i8, ptr %2, i64 8
  store ptr @usb_write, ptr %22, align 8, !tbaa !19
  %23 = getelementptr inbounds i8, ptr %2, i64 16
  store ptr @usb_read, ptr %23, align 8, !tbaa !20
  %24 = getelementptr inbounds i8, ptr %2, i64 24
  store ptr @usb_close, ptr %24, align 8, !tbaa !21
  %25 = getelementptr inbounds i8, ptr %2, i64 32
  store ptr @usb_ioctl, ptr %25, align 8, !tbaa !22
  %26 = getelementptr inbounds i8, ptr %2, i64 40
  %27 = getelementptr inbounds i8, ptr %2, i64 80
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %26, i8 0, i64 40, i1 false)
  store ptr %0, ptr %27, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #6
  %28 = call i32 (ptr, ptr, ...) @sprintf_(ptr noundef nonnull %3, ptr noundef nonnull @.str, ptr noundef nonnull %0) #6
  %29 = call ptr @node_mount(ptr noundef nonnull %3, ptr noundef nonnull %2) #6
  %30 = icmp eq ptr %29, null
  br i1 %30, label %58, label %31

31:                                               ; preds = %21
  %32 = getelementptr inbounds i8, ptr %0, i64 64
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(88) %32, ptr noundef nonnull align 8 dereferenceable(88) %2, i64 88, i1 false), !tbaa.struct !24
  %33 = getelementptr inbounds i8, ptr %0, i64 192
  %34 = load i32, ptr %33, align 8, !tbaa !25
  %35 = trunc i32 %34 to i16
  %36 = call ptr @ring_buf_init(i16 noundef zeroext %35) #6
  %37 = getelementptr inbounds i8, ptr %0, i64 256
  store ptr %36, ptr %37, align 8, !tbaa !26
  %38 = icmp eq ptr %36, null
  br i1 %38, label %58, label %39

39:                                               ; preds = %31
  %40 = load i32, ptr %33, align 8, !tbaa !25
  %41 = trunc i32 %40 to i16
  %42 = call ptr @ring_buf_init(i16 noundef zeroext %41) #6
  %43 = getelementptr inbounds i8, ptr %0, i64 248
  store ptr %42, ptr %43, align 8, !tbaa !27
  %44 = icmp eq ptr %42, null
  br i1 %44, label %58, label %45

45:                                               ; preds = %39
  %46 = load i32, ptr %33, align 8, !tbaa !25
  %47 = sext i32 %46 to i64
  %48 = call noalias ptr @calloc(i64 noundef %47, i64 noundef 1) #7
  %49 = getelementptr inbounds i8, ptr %0, i64 264
  store ptr %48, ptr %49, align 8, !tbaa !28
  %50 = icmp eq ptr %48, null
  br i1 %50, label %58, label %51

51:                                               ; preds = %45
  %52 = call noalias ptr @calloc(i64 noundef %47, i64 noundef 1) #7
  %53 = getelementptr inbounds i8, ptr %0, i64 272
  store ptr %52, ptr %53, align 8, !tbaa !29
  %54 = icmp eq ptr %52, null
  br i1 %54, label %58, label %55

55:                                               ; preds = %51
  %56 = getelementptr inbounds i8, ptr %0, i64 288
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(9) %56, i8 0, i64 9, i1 false)
  call void @MX_USB_DEVICE_Init() #6
  %57 = getelementptr inbounds i8, ptr %0, i64 284
  store i8 1, ptr %57, align 4, !tbaa !30
  br label %58

58:                                               ; preds = %51, %45, %39, %31, %21, %55
  %.0 = phi i32 [ 0, %55 ], [ -1, %21 ], [ -1, %31 ], [ -1, %39 ], [ -1, %45 ], [ -1, %51 ]
  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 %59

59:                                               ; preds = %17, %13, %9, %5, %1, %58
  %.1 = phi i32 [ %.0, %58 ], [ 16, %1 ], [ -1, %5 ], [ -1, %9 ], [ -1, %13 ], [ -1, %17 ]
  ret i32 %.1
}

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

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

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

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

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

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

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

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

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

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

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

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

; 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

declare void @MX_USB_DEVICE_Init() local_unnamed_addr #1

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

; 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 232}
!10 = !{!"", !7, i64 0, !7, i64 32, !11, i64 64, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !12, i64 192, !12, i64 196, !12, i64 200, !12, i64 204, !13, i64 208}
!11 = !{!"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}
!12 = !{!"int", !7, i64 0}
!13 = !{!"", !12, 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, !12, i64 72, !14, i64 76, !14, i64 77, !14, i64 78, !14, i64 79, !12, i64 80, !12, i64 84, !14, i64 88}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!10, !6, i64 240}
!16 = !{!10, !6, i64 216}
!17 = !{!10, !6, i64 224}
!18 = !{!11, !6, i64 0}
!19 = !{!11, !6, i64 8}
!20 = !{!11, !6, i64 16}
!21 = !{!11, !6, i64 24}
!22 = !{!11, !6, i64 32}
!23 = !{!11, !6, i64 80}
!24 = !{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}
!25 = !{!10, !12, i64 192}
!26 = !{!10, !6, i64 256}
!27 = !{!10, !6, i64 248}
!28 = !{!10, !6, i64 264}
!29 = !{!10, !6, i64 272}
!30 = !{!10, !14, i64 284}


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