; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Bus/Usb (UsbCbiInit)

; 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_ENDPOINT_DESCRIPTOR = type <{ i8, i8, i8, i8, i16, i8 }>
%struct.USB_CBI_PROTOCOL = type { %struct.USB_INTERFACE_DESCRIPTOR, ptr, ptr, ptr, ptr }
%struct.USB_INTERFACE_DESCRIPTOR = type { i8, i8, i8, i8, i8, i8, i8, i8, i8 }
%struct._EFI_USB_IO_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

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

; Function Attrs: nounwind uwtable
define dso_local i64 @UsbCbiInit(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %struct.USB_ENDPOINT_DESCRIPTOR, align 1
  %9 = alloca i64, align 8
  %10 = alloca i8, align 1
  %11 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 7, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #3
  %12 = call ptr @AllocateZeroPool(i64 noundef 69)
  store ptr %12, ptr %6, align 8, !tbaa !5
  br label %13

13:                                               ; preds = %2
  %14 = call zeroext i8 @DebugAssertEnabled()
  %15 = icmp ne i8 %14, 0
  br i1 %15, label %16, label %21

16:                                               ; preds = %13
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  call void @DebugAssert(ptr noundef @.str, i64 noundef 77, ptr noundef @.str.1)
  br label %20

20:                                               ; preds = %19, %16
  br label %21

21:                                               ; preds = %20, %13
  br label %22

22:                                               ; preds = %21
  br label %23

23:                                               ; preds = %22
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %25, i32 0, i32 4
  store ptr %24, ptr %26, align 8, !tbaa !9
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct._EFI_USB_IO_PROTOCOL, ptr %27, i32 0, i32 8
  %29 = load ptr, ptr %28, align 8, !tbaa !12
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %31, i32 0, i32 0
  %33 = call i64 %29(ptr noundef %30, ptr noundef %32)
  store i64 %33, ptr %9, align 8, !tbaa !14
  %34 = load i64, ptr %9, align 8, !tbaa !14
  %35 = icmp slt i64 %34, 0
  br i1 %35, label %36, label %37

36:                                               ; preds = %23
  br label %184

37:                                               ; preds = %23
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %38, i32 0, i32 0
  store ptr %39, ptr %7, align 8, !tbaa !5
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.USB_INTERFACE_DESCRIPTOR, ptr %40, i32 0, i32 7
  %42 = load i8, ptr %41, align 1, !tbaa !16
  %43 = zext i8 %42 to i32
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %52

45:                                               ; preds = %37
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.USB_INTERFACE_DESCRIPTOR, ptr %46, i32 0, i32 7
  %48 = load i8, ptr %47, align 1, !tbaa !16
  %49 = zext i8 %48 to i32
  %50 = icmp ne i32 %49, 1
  br i1 %50, label %51, label %52

51:                                               ; preds = %45
  store i64 -9223372036854775805, ptr %9, align 8, !tbaa !14
  br label %184

52:                                               ; preds = %45, %37
  store i8 0, ptr %10, align 1, !tbaa !17
  br label %53

53:                                               ; preds = %149, %52
  %54 = load i8, ptr %10, align 1, !tbaa !17
  %55 = zext i8 %54 to i32
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.USB_INTERFACE_DESCRIPTOR, ptr %56, i32 0, i32 4
  %58 = load i8, ptr %57, align 1, !tbaa !18
  %59 = zext i8 %58 to i32
  %60 = icmp slt i32 %55, %59
  br i1 %60, label %61, label %152

61:                                               ; preds = %53
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct._EFI_USB_IO_PROTOCOL, ptr %62, i32 0, i32 9
  %64 = load ptr, ptr %63, align 8, !tbaa !19
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = load i8, ptr %10, align 1, !tbaa !17
  %67 = call i64 %64(ptr noundef %65, i8 noundef zeroext %66, ptr noundef %8)
  store i64 %67, ptr %9, align 8, !tbaa !14
  %68 = load i64, ptr %9, align 8, !tbaa !14
  %69 = icmp slt i64 %68, 0
  br i1 %69, label %70, label %71

70:                                               ; preds = %61
  br label %149

71:                                               ; preds = %61
  %72 = getelementptr inbounds %struct.USB_ENDPOINT_DESCRIPTOR, ptr %8, i32 0, i32 3
  %73 = load i8, ptr %72, align 1, !tbaa !20
  %74 = zext i8 %73 to i32
  %75 = and i32 %74, 3
  %76 = icmp eq i32 %75, 2
  br i1 %76, label %77, label %119

77:                                               ; preds = %71
  %78 = getelementptr inbounds %struct.USB_ENDPOINT_DESCRIPTOR, ptr %8, i32 0, i32 2
  %79 = load i8, ptr %78, align 1, !tbaa !23
  %80 = zext i8 %79 to i32
  %81 = and i32 %80, 128
  %82 = icmp eq i32 %81, 128
  br i1 %82, label %83, label %97

83:                                               ; preds = %77
  %84 = load ptr, ptr %6, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %84, i32 0, i32 1
  %86 = load ptr, ptr %85, align 8, !tbaa !24
  %87 = icmp eq ptr %86, null
  br i1 %87, label %88, label %97

88:                                               ; preds = %83
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %89, i64 1
  %91 = load ptr, ptr %6, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %91, i32 0, i32 1
  store ptr %90, ptr %92, align 8, !tbaa !24
  %93 = load ptr, ptr %6, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %93, i32 0, i32 1
  %95 = load ptr, ptr %94, align 8, !tbaa !24
  %96 = call ptr @CopyMem(ptr noundef %95, ptr noundef %8, i64 noundef 7)
  br label %97

97:                                               ; preds = %88, %83, %77
  %98 = getelementptr inbounds %struct.USB_ENDPOINT_DESCRIPTOR, ptr %8, i32 0, i32 2
  %99 = load i8, ptr %98, align 1, !tbaa !23
  %100 = zext i8 %99 to i32
  %101 = and i32 %100, 128
  %102 = icmp eq i32 %101, 0
  br i1 %102, label %103, label %118

103:                                              ; preds = %97
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %104, i32 0, i32 2
  %106 = load ptr, ptr %105, align 8, !tbaa !25
  %107 = icmp eq ptr %106, null
  br i1 %107, label %108, label %118

108:                                              ; preds = %103
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %109, i64 1
  %111 = getelementptr inbounds %struct.USB_ENDPOINT_DESCRIPTOR, ptr %110, i64 1
  %112 = load ptr, ptr %6, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %112, i32 0, i32 2
  store ptr %111, ptr %113, align 8, !tbaa !25
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %114, i32 0, i32 2
  %116 = load ptr, ptr %115, align 8, !tbaa !25
  %117 = call ptr @CopyMem(ptr noundef %116, ptr noundef %8, i64 noundef 7)
  br label %118

118:                                              ; preds = %108, %103, %97
  br label %148

119:                                              ; preds = %71
  %120 = getelementptr inbounds %struct.USB_ENDPOINT_DESCRIPTOR, ptr %8, i32 0, i32 3
  %121 = load i8, ptr %120, align 1, !tbaa !20
  %122 = zext i8 %121 to i32
  %123 = and i32 %122, 3
  %124 = icmp eq i32 %123, 3
  br i1 %124, label %125, label %147

125:                                              ; preds = %119
  %126 = load ptr, ptr %7, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.USB_INTERFACE_DESCRIPTOR, ptr %126, i32 0, i32 7
  %128 = load i8, ptr %127, align 1, !tbaa !16
  %129 = zext i8 %128 to i32
  %130 = icmp eq i32 %129, 0
  br i1 %130, label %131, label %146

131:                                              ; preds = %125
  %132 = load ptr, ptr %6, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %132, i32 0, i32 3
  %134 = load ptr, ptr %133, align 8, !tbaa !26
  %135 = icmp eq ptr %134, null
  br i1 %135, label %136, label %146

136:                                              ; preds = %131
  %137 = load ptr, ptr %6, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %137, i64 1
  %139 = getelementptr inbounds %struct.USB_ENDPOINT_DESCRIPTOR, ptr %138, i64 2
  %140 = load ptr, ptr %6, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %140, i32 0, i32 3
  store ptr %139, ptr %141, align 8, !tbaa !26
  %142 = load ptr, ptr %6, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %142, i32 0, i32 3
  %144 = load ptr, ptr %143, align 8, !tbaa !26
  %145 = call ptr @CopyMem(ptr noundef %144, ptr noundef %8, i64 noundef 7)
  br label %146

146:                                              ; preds = %136, %131, %125
  br label %147

147:                                              ; preds = %146, %119
  br label %148

148:                                              ; preds = %147, %118
  br label %149

149:                                              ; preds = %148, %70
  %150 = load i8, ptr %10, align 1, !tbaa !17
  %151 = add i8 %150, 1
  store i8 %151, ptr %10, align 1, !tbaa !17
  br label %53, !llvm.loop !27

152:                                              ; preds = %53
  %153 = load ptr, ptr %6, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %153, i32 0, i32 1
  %155 = load ptr, ptr %154, align 8, !tbaa !24
  %156 = icmp eq ptr %155, null
  br i1 %156, label %162, label %157

157:                                              ; preds = %152
  %158 = load ptr, ptr %6, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %158, i32 0, i32 2
  %160 = load ptr, ptr %159, align 8, !tbaa !25
  %161 = icmp eq ptr %160, null
  br i1 %161, label %162, label %163

162:                                              ; preds = %157, %152
  store i64 -9223372036854775805, ptr %9, align 8, !tbaa !14
  br label %184

163:                                              ; preds = %157
  %164 = load ptr, ptr %7, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.USB_INTERFACE_DESCRIPTOR, ptr %164, i32 0, i32 7
  %166 = load i8, ptr %165, align 1, !tbaa !16
  %167 = zext i8 %166 to i32
  %168 = icmp eq i32 %167, 0
  br i1 %168, label %169, label %175

169:                                              ; preds = %163
  %170 = load ptr, ptr %6, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.USB_CBI_PROTOCOL, ptr %170, i32 0, i32 3
  %172 = load ptr, ptr %171, align 8, !tbaa !26
  %173 = icmp eq ptr %172, null
  br i1 %173, label %174, label %175

174:                                              ; preds = %169
  store i64 -9223372036854775805, ptr %9, align 8, !tbaa !14
  br label %184

175:                                              ; preds = %169, %163
  %176 = load ptr, ptr %5, align 8, !tbaa !5
  %177 = icmp ne ptr %176, null
  br i1 %177, label %178, label %181

178:                                              ; preds = %175
  %179 = load ptr, ptr %6, align 8, !tbaa !5
  %180 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %179, ptr %180, align 8, !tbaa !5
  br label %183

181:                                              ; preds = %175
  %182 = load ptr, ptr %6, align 8, !tbaa !5
  call void @FreePool(ptr noundef %182)
  br label %183

183:                                              ; preds = %181, %178
  store i64 0, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %187

184:                                              ; preds = %174, %162, %51, %36
  %185 = load ptr, ptr %6, align 8, !tbaa !5
  call void @FreePool(ptr noundef %185)
  %186 = load i64, ptr %9, align 8, !tbaa !14
  store i64 %186, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %187

187:                                              ; preds = %184, %183
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 7, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %188 = load i64, ptr %3, align 8
  ret i64 %188
}

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

declare ptr @AllocateZeroPool(i64 noundef) #2

declare zeroext i8 @DebugAssertEnabled() #2

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

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) #2

declare void @FreePool(ptr noundef) #2

; 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 = { 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, !6, i64 40}
!10 = !{!"", !11, i64 0, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!11 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8}
!12 = !{!13, !6, i64 64}
!13 = !{!"_EFI_USB_IO_PROTOCOL", !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, !6, i64 88, !6, i64 96}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = !{!11, !7, i64 7}
!17 = !{!7, !7, i64 0}
!18 = !{!11, !7, i64 4}
!19 = !{!13, !6, i64 72}
!20 = !{!21, !7, i64 3}
!21 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !22, i64 4, !7, i64 6}
!22 = !{!"short", !7, i64 0}
!23 = !{!21, !7, i64 2}
!24 = !{!10, !6, i64 16}
!25 = !{!10, !6, i64 24}
!26 = !{!10, !6, i64 32}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}


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

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

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775808, 1) i64 @UsbCbiInit(ptr noundef %0, ptr noundef writeonly %1) local_unnamed_addr #0 {
  %3 = alloca %struct.USB_ENDPOINT_DESCRIPTOR, align 1
  call void @llvm.lifetime.start.p0(i64 7, ptr nonnull %3) #3
  %4 = tail call ptr @AllocateZeroPool(i64 noundef 69) #3
  %5 = tail call zeroext i8 @DebugAssertEnabled() #3
  %6 = icmp eq i8 %5, 0
  %7 = icmp ne ptr %4, null
  %or.cond = select i1 %6, i1 true, i1 %7
  br i1 %or.cond, label %9, label %8

8:                                                ; preds = %2
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 77, ptr noundef nonnull @.str.1) #3
  br label %9

9:                                                ; preds = %8, %2
  %10 = getelementptr inbounds i8, ptr %4, i64 40
  store ptr %0, ptr %10, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 64
  %12 = load ptr, ptr %11, align 8, !tbaa !11
  %13 = tail call i64 %12(ptr noundef %0, ptr noundef %4) #3
  %14 = icmp slt i64 %13, 0
  br i1 %14, label %75, label %15

15:                                               ; preds = %9
  %16 = getelementptr inbounds i8, ptr %4, i64 7
  %17 = load i8, ptr %16, align 1, !tbaa !13
  %switch = icmp ult i8 %17, 2
  br i1 %switch, label %.preheader, label %75

.preheader:                                       ; preds = %15
  %18 = getelementptr inbounds i8, ptr %4, i64 4
  %19 = load i8, ptr %18, align 1, !tbaa !14
  %.not = icmp eq i8 %19, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %20 = getelementptr inbounds i8, ptr %0, i64 72
  %21 = getelementptr inbounds i8, ptr %3, i64 3
  %22 = getelementptr inbounds i8, ptr %4, i64 32
  %23 = getelementptr inbounds i8, ptr %4, i64 62
  %24 = getelementptr inbounds i8, ptr %3, i64 2
  %25 = getelementptr inbounds i8, ptr %4, i64 16
  %26 = getelementptr inbounds i8, ptr %4, i64 48
  %27 = getelementptr inbounds i8, ptr %4, i64 24
  %28 = getelementptr inbounds i8, ptr %4, i64 55
  br label %29

29:                                               ; preds = %.lr.ph, %.thread52
  %.050 = phi i8 [ 0, %.lr.ph ], [ %55, %.thread52 ]
  %30 = load ptr, ptr %20, align 8, !tbaa !15
  %31 = call i64 %30(ptr noundef nonnull %0, i8 noundef zeroext %.050, ptr noundef nonnull %3) #3
  %32 = icmp slt i64 %31, 0
  br i1 %32, label %.thread52, label %33

33:                                               ; preds = %29
  %34 = load i8, ptr %21, align 1, !tbaa !16
  %35 = and i8 %34, 3
  switch i8 %35, label %.thread52 [
    i8 2, label %36
    i8 3, label %47
  ]

36:                                               ; preds = %33
  %37 = load i8, ptr %24, align 1, !tbaa !19
  %.not49 = icmp sgt i8 %37, -1
  br i1 %.not49, label %.thread, label %38

38:                                               ; preds = %36
  %39 = load ptr, ptr %25, align 8, !tbaa !20
  %40 = icmp eq ptr %39, null
  br i1 %40, label %41, label %.thread52

41:                                               ; preds = %38
  store ptr %26, ptr %25, align 8, !tbaa !20
  %42 = call ptr @CopyMem(ptr noundef nonnull %26, ptr noundef nonnull %3, i64 noundef 7) #3
  %.pr.pre = load i8, ptr %24, align 1, !tbaa !19
  %43 = icmp sgt i8 %.pr.pre, -1
  br i1 %43, label %.thread, label %.thread52

.thread:                                          ; preds = %36, %41
  %44 = load ptr, ptr %27, align 8, !tbaa !21
  %45 = icmp eq ptr %44, null
  br i1 %45, label %46, label %.thread52

46:                                               ; preds = %.thread
  store ptr %28, ptr %27, align 8, !tbaa !21
  br label %.thread52.sink.split

47:                                               ; preds = %33
  %48 = load i8, ptr %16, align 1, !tbaa !13
  %49 = icmp eq i8 %48, 0
  br i1 %49, label %50, label %.thread52

50:                                               ; preds = %47
  %51 = load ptr, ptr %22, align 8, !tbaa !22
  %52 = icmp eq ptr %51, null
  br i1 %52, label %53, label %.thread52

53:                                               ; preds = %50
  store ptr %23, ptr %22, align 8, !tbaa !22
  br label %.thread52.sink.split

.thread52.sink.split:                             ; preds = %53, %46
  %.sink = phi ptr [ %28, %46 ], [ %23, %53 ]
  %54 = call ptr @CopyMem(ptr noundef nonnull %.sink, ptr noundef nonnull %3, i64 noundef 7) #3
  br label %.thread52

.thread52:                                        ; preds = %.thread52.sink.split, %38, %33, %.thread, %41, %47, %50, %29
  %55 = add nuw i8 %.050, 1
  %56 = load i8, ptr %18, align 1, !tbaa !14
  %57 = icmp ult i8 %55, %56
  br i1 %57, label %29, label %._crit_edge, !llvm.loop !23

._crit_edge:                                      ; preds = %.thread52, %.preheader
  %58 = getelementptr inbounds i8, ptr %4, i64 16
  %59 = load ptr, ptr %58, align 8, !tbaa !20
  %60 = icmp eq ptr %59, null
  br i1 %60, label %75, label %61

61:                                               ; preds = %._crit_edge
  %62 = getelementptr inbounds i8, ptr %4, i64 24
  %63 = load ptr, ptr %62, align 8, !tbaa !21
  %64 = icmp eq ptr %63, null
  br i1 %64, label %75, label %65

65:                                               ; preds = %61
  %66 = load i8, ptr %16, align 1, !tbaa !13
  %67 = icmp eq i8 %66, 0
  br i1 %67, label %68, label %72

68:                                               ; preds = %65
  %69 = getelementptr inbounds i8, ptr %4, i64 32
  %70 = load ptr, ptr %69, align 8, !tbaa !22
  %71 = icmp eq ptr %70, null
  br i1 %71, label %75, label %72

72:                                               ; preds = %68, %65
  %.not48 = icmp eq ptr %1, null
  br i1 %.not48, label %74, label %73

73:                                               ; preds = %72
  store ptr %4, ptr %1, align 8, !tbaa !25
  br label %76

74:                                               ; preds = %72
  call void @FreePool(ptr noundef nonnull %4) #3
  br label %76

75:                                               ; preds = %15, %68, %._crit_edge, %61, %9
  %.041 = phi i64 [ %13, %9 ], [ -9223372036854775805, %15 ], [ -9223372036854775805, %61 ], [ -9223372036854775805, %._crit_edge ], [ -9223372036854775805, %68 ]
  call void @FreePool(ptr noundef nonnull %4) #3
  br label %76

76:                                               ; preds = %73, %74, %75
  %.042 = phi i64 [ %.041, %75 ], [ 0, %74 ], [ 0, %73 ]
  call void @llvm.lifetime.end.p0(i64 7, ptr nonnull %3) #3
  ret i64 %.042
}

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

declare ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #2

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #2

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

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare void @FreePool(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress 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 = { 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, !10, i64 40}
!6 = !{!"", !7, i64 0, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}
!7 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !8, i64 4, !8, i64 5, !8, i64 6, !8, i64 7, !8, i64 8}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!12, !10, i64 64}
!12 = !{!"_EFI_USB_IO_PROTOCOL", !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, i64 88, !10, i64 96}
!13 = !{!7, !8, i64 7}
!14 = !{!7, !8, i64 4}
!15 = !{!12, !10, i64 72}
!16 = !{!17, !8, i64 3}
!17 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !18, i64 4, !8, i64 6}
!18 = !{!"short", !8, i64 0}
!19 = !{!17, !8, i64 2}
!20 = !{!6, !10, i64 16}
!21 = !{!6, !10, i64 24}
!22 = !{!6, !10, i64 32}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!10, !10, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass