; LLVM IR from lichen-community-systems/signaletic :: hosts/daisy/vendor/libDaisy/Middlewares/ST/STM32_USB_Device_Library/Core/Src (ParseSetupRequest)

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

; Function Attrs: nounwind uwtable
define dso_local void @USBD_ParseSetupRequest(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = load i8, ptr %5, align 1, !tbaa !9
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.usb_setup_req, ptr %7, i32 0, i32 0
  store i8 %6, ptr %8, align 2, !tbaa !10
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 1
  %11 = load i8, ptr %10, align 1, !tbaa !9
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.usb_setup_req, ptr %12, i32 0, i32 1
  store i8 %11, ptr %13, align 1, !tbaa !13
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %14, i64 2
  %16 = load i8, ptr %15, align 1, !tbaa !9
  %17 = zext i8 %16 to i16
  %18 = zext i16 %17 to i32
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %19, i64 2
  %21 = getelementptr inbounds i8, ptr %20, i64 1
  %22 = load i8, ptr %21, align 1, !tbaa !9
  %23 = zext i8 %22 to i16
  %24 = zext i16 %23 to i32
  %25 = shl i32 %24, 8
  %26 = add nsw i32 %18, %25
  %27 = trunc i32 %26 to i16
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.usb_setup_req, ptr %28, i32 0, i32 2
  store i16 %27, ptr %29, align 2, !tbaa !14
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %30, i64 4
  %32 = load i8, ptr %31, align 1, !tbaa !9
  %33 = zext i8 %32 to i16
  %34 = zext i16 %33 to i32
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %35, i64 4
  %37 = getelementptr inbounds i8, ptr %36, i64 1
  %38 = load i8, ptr %37, align 1, !tbaa !9
  %39 = zext i8 %38 to i16
  %40 = zext i16 %39 to i32
  %41 = shl i32 %40, 8
  %42 = add nsw i32 %34, %41
  %43 = trunc i32 %42 to i16
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.usb_setup_req, ptr %44, i32 0, i32 3
  store i16 %43, ptr %45, align 2, !tbaa !15
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %46, i64 6
  %48 = load i8, ptr %47, align 1, !tbaa !9
  %49 = zext i8 %48 to i16
  %50 = zext i16 %49 to i32
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %51, i64 6
  %53 = getelementptr inbounds i8, ptr %52, i64 1
  %54 = load i8, ptr %53, align 1, !tbaa !9
  %55 = zext i8 %54 to i16
  %56 = zext i16 %55 to i32
  %57 = shl i32 %56, 8
  %58 = add nsw i32 %50, %57
  %59 = trunc i32 %58 to i16
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.usb_setup_req, ptr %60, i32 0, i32 4
  store i16 %59, ptr %61, align 2, !tbaa !16
  ret void
}

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

!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 = !{!7, !7, i64 0}
!10 = !{!11, !7, i64 0}
!11 = !{!"usb_setup_req", !7, i64 0, !7, i64 1, !12, i64 2, !12, i64 4, !12, i64 6}
!12 = !{!"short", !7, i64 0}
!13 = !{!11, !7, i64 1}
!14 = !{!11, !12, i64 2}
!15 = !{!11, !12, i64 4}
!16 = !{!11, !12, i64 6}


; 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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @USBD_ParseSetupRequest(ptr nocapture noundef writeonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = load i8, ptr %1, align 1, !tbaa !5
  store i8 %3, ptr %0, align 2, !tbaa !8
  %4 = getelementptr inbounds i8, ptr %1, i64 1
  %5 = load i8, ptr %4, align 1, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 1
  store i8 %5, ptr %6, align 1, !tbaa !11
  %7 = getelementptr inbounds i8, ptr %1, i64 2
  %8 = load i16, ptr %7, align 1
  %9 = getelementptr inbounds i8, ptr %0, i64 2
  store i16 %8, ptr %9, align 2, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %1, i64 4
  %11 = load i16, ptr %10, align 1
  %12 = getelementptr inbounds i8, ptr %0, i64 4
  store i16 %11, ptr %12, align 2, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %1, i64 6
  %14 = load i16, ptr %13, align 1
  %15 = getelementptr inbounds i8, ptr %0, i64 6
  store i16 %14, ptr %15, align 2, !tbaa !14
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !6, i64 0}
!9 = !{!"usb_setup_req", !6, i64 0, !6, i64 1, !10, i64 2, !10, i64 4, !10, i64 6}
!10 = !{!"short", !6, i64 0}
!11 = !{!9, !6, i64 1}
!12 = !{!9, !10, i64 2}
!13 = !{!9, !10, i64 4}
!14 = !{!9, !10, i64 6}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass