; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/ShellPkg/Library (ShellCommandConsistMappingGenMappingName)

; 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.MTD_NAME = type { i32, ptr }
%struct.POOL_PRINT = type { ptr, i64 }
%struct.DEVICE_CONSIST_MAPPING_INFO = type { i64, i32, %struct.POOL_PRINT, i8 }

@.str = external hidden unnamed_addr constant [155 x i8], align 1
@mMTDName = external dso_local global [5 x %struct.MTD_NAME], align 16
@.str.19 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.24 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.25 = external hidden unnamed_addr constant [2 x i32], align 4

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

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

declare zeroext i8 @DebugAssertEnabled() #2

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @ShellCommandConsistMappingGenMappingName(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.POOL_PRINT, align 8
  %7 = alloca %struct.DEVICE_CONSIST_MAPPING_INFO, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %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 16, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 40, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  br label %12

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

15:                                               ; preds = %12
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = icmp ne ptr %16, null
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  call void @DebugAssert(ptr noundef @.str, i64 noundef 1354, ptr noundef @.str.19)
  br label %19

19:                                               ; preds = %18, %15
  br label %20

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

21:                                               ; preds = %20
  br label %22

22:                                               ; preds = %21
  br label %23

23:                                               ; preds = %22
  %24 = call zeroext i8 @DebugAssertEnabled()
  %25 = icmp ne i8 %24, 0
  br i1 %25, label %26, label %31

26:                                               ; preds = %23
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %30, label %29

29:                                               ; preds = %26
  call void @DebugAssert(ptr noundef @.str, i64 noundef 1355, ptr noundef @.str.22)
  br label %30

30:                                               ; preds = %29, %26
  br label %31

31:                                               ; preds = %30, %23
  br label %32

32:                                               ; preds = %31
  br label %33

33:                                               ; preds = %32
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = call ptr @GetHIDevicePath(ptr noundef %34)
  store ptr %35, ptr %8, align 8, !tbaa !5
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = icmp eq ptr %36, null
  br i1 %37, label %38, label %39

38:                                               ; preds = %33
  store ptr null, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %150

39:                                               ; preds = %33
  store i64 0, ptr %9, align 8, !tbaa !9
  br label %40

40:                                               ; preds = %54, %39
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = load i64, ptr %9, align 8, !tbaa !9
  %43 = getelementptr inbounds ptr, ptr %41, i64 %42
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %57

46:                                               ; preds = %40
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = load i64, ptr %9, align 8, !tbaa !9
  %49 = getelementptr inbounds ptr, ptr %47, i64 %48
  %50 = call i64 @DevicePathCompare(ptr noundef %49, ptr noundef %8)
  %51 = icmp eq i64 %50, 0
  br i1 %51, label %52, label %53

52:                                               ; preds = %46
  br label %57

53:                                               ; preds = %46
  br label %54

54:                                               ; preds = %53
  %55 = load i64, ptr %9, align 8, !tbaa !9
  %56 = add i64 %55, 1
  store i64 %56, ptr %9, align 8, !tbaa !9
  br label %40, !llvm.loop !11

57:                                               ; preds = %52, %40
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  call void @FreePool(ptr noundef %58)
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = load i64, ptr %9, align 8, !tbaa !9
  %61 = getelementptr inbounds ptr, ptr %59, i64 %60
  %62 = load ptr, ptr %61, align 8, !tbaa !5
  %63 = icmp eq ptr %62, null
  br i1 %63, label %64, label %65

64:                                               ; preds = %57
  store ptr null, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %150

65:                                               ; preds = %57
  %66 = load i64, ptr %9, align 8, !tbaa !9
  %67 = getelementptr inbounds %struct.DEVICE_CONSIST_MAPPING_INFO, ptr %7, i32 0, i32 0
  store i64 %66, ptr %67, align 8, !tbaa !13
  %68 = getelementptr inbounds %struct.DEVICE_CONSIST_MAPPING_INFO, ptr %7, i32 0, i32 1
  store i32 0, ptr %68, align 8, !tbaa !17
  %69 = getelementptr inbounds %struct.DEVICE_CONSIST_MAPPING_INFO, ptr %7, i32 0, i32 3
  store i8 0, ptr %69, align 8, !tbaa !18
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = call i64 @GetDeviceConsistMappingInfo(ptr noundef %7, ptr noundef %70)
  %72 = call ptr @SetMem(ptr noundef %6, i64 noundef 16, i8 noundef zeroext 0)
  store i64 0, ptr %9, align 8, !tbaa !9
  br label %73

73:                                               ; preds = %89, %65
  %74 = load i64, ptr %9, align 8, !tbaa !9
  %75 = getelementptr inbounds [5 x %struct.MTD_NAME], ptr @mMTDName, i64 0, i64 %74
  %76 = getelementptr inbounds %struct.MTD_NAME, ptr %75, i32 0, i32 0
  %77 = load i32, ptr %76, align 16, !tbaa !19
  %78 = icmp ne i32 %77, 4
  br i1 %78, label %79, label %92

79:                                               ; preds = %73
  %80 = getelementptr inbounds %struct.DEVICE_CONSIST_MAPPING_INFO, ptr %7, i32 0, i32 1
  %81 = load i32, ptr %80, align 8, !tbaa !17
  %82 = load i64, ptr %9, align 8, !tbaa !9
  %83 = getelementptr inbounds [5 x %struct.MTD_NAME], ptr @mMTDName, i64 0, i64 %82
  %84 = getelementptr inbounds %struct.MTD_NAME, ptr %83, i32 0, i32 0
  %85 = load i32, ptr %84, align 16, !tbaa !19
  %86 = icmp eq i32 %81, %85
  br i1 %86, label %87, label %88

87:                                               ; preds = %79
  br label %92

88:                                               ; preds = %79
  br label %89

89:                                               ; preds = %88
  %90 = load i64, ptr %9, align 8, !tbaa !9
  %91 = add i64 %90, 1
  store i64 %91, ptr %9, align 8, !tbaa !9
  br label %73, !llvm.loop !21

92:                                               ; preds = %87, %73
  %93 = load i64, ptr %9, align 8, !tbaa !9
  %94 = getelementptr inbounds [5 x %struct.MTD_NAME], ptr @mMTDName, i64 0, i64 %93
  %95 = getelementptr inbounds %struct.MTD_NAME, ptr %94, i32 0, i32 0
  %96 = load i32, ptr %95, align 16, !tbaa !19
  %97 = icmp ne i32 %96, 4
  br i1 %97, label %98, label %104

98:                                               ; preds = %92
  %99 = load i64, ptr %9, align 8, !tbaa !9
  %100 = getelementptr inbounds [5 x %struct.MTD_NAME], ptr @mMTDName, i64 0, i64 %99
  %101 = getelementptr inbounds %struct.MTD_NAME, ptr %100, i32 0, i32 1
  %102 = load ptr, ptr %101, align 8, !tbaa !22
  %103 = call ptr (ptr, ptr, ...) @CatPrint(ptr noundef %6, ptr noundef @.str.23, ptr noundef %102)
  br label %104

104:                                              ; preds = %98, %92
  %105 = getelementptr inbounds %struct.DEVICE_CONSIST_MAPPING_INFO, ptr %7, i32 0, i32 0
  %106 = load i64, ptr %105, align 8, !tbaa !13
  %107 = call ptr (ptr, ptr, ...) @CatPrint(ptr noundef %6, ptr noundef @.str.24, i64 noundef %106)
  %108 = getelementptr inbounds %struct.DEVICE_CONSIST_MAPPING_INFO, ptr %7, i32 0, i32 2
  %109 = getelementptr inbounds %struct.POOL_PRINT, ptr %108, i32 0, i32 0
  %110 = load ptr, ptr %109, align 8, !tbaa !23
  %111 = icmp ne ptr %110, null
  br i1 %111, label %112, label %120

112:                                              ; preds = %104
  %113 = getelementptr inbounds %struct.DEVICE_CONSIST_MAPPING_INFO, ptr %7, i32 0, i32 2
  %114 = getelementptr inbounds %struct.POOL_PRINT, ptr %113, i32 0, i32 0
  %115 = load ptr, ptr %114, align 8, !tbaa !23
  %116 = call ptr (ptr, ptr, ...) @CatPrint(ptr noundef %6, ptr noundef @.str.23, ptr noundef %115)
  %117 = getelementptr inbounds %struct.DEVICE_CONSIST_MAPPING_INFO, ptr %7, i32 0, i32 2
  %118 = getelementptr inbounds %struct.POOL_PRINT, ptr %117, i32 0, i32 0
  %119 = load ptr, ptr %118, align 8, !tbaa !23
  call void @FreePool(ptr noundef %119)
  br label %120

120:                                              ; preds = %112, %104
  %121 = getelementptr inbounds %struct.POOL_PRINT, ptr %6, i32 0, i32 0
  %122 = load ptr, ptr %121, align 8, !tbaa !24
  %123 = icmp ne ptr %122, null
  br i1 %123, label %124, label %126

124:                                              ; preds = %120
  %125 = call ptr (ptr, ptr, ...) @CatPrint(ptr noundef %6, ptr noundef @.str.25)
  br label %126

126:                                              ; preds = %124, %120
  %127 = getelementptr inbounds %struct.POOL_PRINT, ptr %6, i32 0, i32 1
  %128 = load i64, ptr %127, align 8, !tbaa !25
  %129 = add i64 %128, 1
  %130 = mul i64 %129, 2
  store i64 %130, ptr %10, align 8, !tbaa !9
  %131 = getelementptr inbounds %struct.POOL_PRINT, ptr %6, i32 0, i32 1
  %132 = load i64, ptr %131, align 8, !tbaa !25
  %133 = load i64, ptr %10, align 8, !tbaa !9
  %134 = getelementptr inbounds %struct.POOL_PRINT, ptr %6, i32 0, i32 0
  %135 = load ptr, ptr %134, align 8, !tbaa !24
  %136 = call ptr @ReallocatePool(i64 noundef %132, i64 noundef %133, ptr noundef %135)
  %137 = getelementptr inbounds %struct.POOL_PRINT, ptr %6, i32 0, i32 0
  store ptr %136, ptr %137, align 8, !tbaa !24
  %138 = getelementptr inbounds %struct.POOL_PRINT, ptr %6, i32 0, i32 0
  %139 = load ptr, ptr %138, align 8, !tbaa !24
  %140 = icmp eq ptr %139, null
  br i1 %140, label %141, label %142

141:                                              ; preds = %126
  store ptr null, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %150

142:                                              ; preds = %126
  %143 = getelementptr inbounds %struct.POOL_PRINT, ptr %6, i32 0, i32 0
  %144 = load ptr, ptr %143, align 8, !tbaa !24
  %145 = getelementptr inbounds %struct.POOL_PRINT, ptr %6, i32 0, i32 1
  %146 = load i64, ptr %145, align 8, !tbaa !25
  %147 = getelementptr inbounds i16, ptr %144, i64 %146
  store i16 0, ptr %147, align 2, !tbaa !26
  %148 = getelementptr inbounds %struct.POOL_PRINT, ptr %6, i32 0, i32 0
  %149 = load ptr, ptr %148, align 8, !tbaa !24
  store ptr %149, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %150

150:                                              ; preds = %142, %141, %64, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 40, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #3
  %151 = load ptr, ptr %3, align 8
  ret ptr %151
}

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, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !10, i64 0}
!14 = !{!"", !10, i64 0, !15, i64 8, !16, i64 16, !7, i64 32}
!15 = !{!"int", !7, i64 0}
!16 = !{!"", !6, i64 0, !10, i64 8}
!17 = !{!14, !15, i64 8}
!18 = !{!14, !7, i64 32}
!19 = !{!20, !15, i64 0}
!20 = !{!"", !15, i64 0, !6, i64 8}
!21 = distinct !{!21, !12}
!22 = !{!20, !6, i64 8}
!23 = !{!14, !6, i64 16}
!24 = !{!16, !6, i64 0}
!25 = !{!16, !10, i64 8}
!26 = !{!27, !27, i64 0}
!27 = !{!"short", !7, i64 0}


; 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.MTD_NAME = type { i32, ptr }
%struct.POOL_PRINT = type { ptr, i64 }
%struct.DEVICE_CONSIST_MAPPING_INFO = type { i64, i32, %struct.POOL_PRINT, i8 }

@.str = external hidden unnamed_addr constant [155 x i8], align 1
@mMTDName = external dso_local local_unnamed_addr global [5 x %struct.MTD_NAME], align 16
@.str.19 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.24 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.25 = external hidden unnamed_addr constant [2 x i32], align 4

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

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #2

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @ShellCommandConsistMappingGenMappingName(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.POOL_PRINT, align 8
  %4 = alloca %struct.DEVICE_CONSIST_MAPPING_INFO, align 8
  %5 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %6 = tail call zeroext i8 @DebugAssertEnabled() #3
  %7 = icmp eq i8 %6, 0
  %8 = icmp ne ptr %0, null
  %or.cond = or i1 %8, %7
  br i1 %or.cond, label %10, label %9

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

10:                                               ; preds = %2, %9
  %11 = tail call zeroext i8 @DebugAssertEnabled() #3
  %12 = icmp eq i8 %11, 0
  %13 = icmp ne ptr %1, null
  %or.cond3 = or i1 %13, %12
  br i1 %or.cond3, label %15, label %14

14:                                               ; preds = %10
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 1355, ptr noundef nonnull @.str.22) #3
  br label %15

15:                                               ; preds = %14, %10
  %16 = tail call ptr @GetHIDevicePath(ptr noundef %0)
  store ptr %16, ptr %5, align 8, !tbaa !5
  %17 = icmp eq ptr %16, null
  br i1 %17, label %69, label %.preheader

.preheader:                                       ; preds = %15
  %18 = load ptr, ptr %1, align 8, !tbaa !5
  %.not32 = icmp eq ptr %18, null
  br i1 %.not32, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %22
  %.02133 = phi i64 [ %23, %22 ], [ 0, %.preheader ]
  %19 = getelementptr inbounds ptr, ptr %1, i64 %.02133
  %20 = call i64 @DevicePathCompare(ptr noundef nonnull %19, ptr noundef nonnull %5) #3
  %21 = icmp eq i64 %20, 0
  br i1 %21, label %._crit_edge.loopexit, label %22

22:                                               ; preds = %.lr.ph
  %23 = add i64 %.02133, 1
  %24 = getelementptr inbounds ptr, ptr %1, i64 %23
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  %.not = icmp eq ptr %25, null
  br i1 %.not, label %._crit_edge.loopexit.split.loop.exit39, label %.lr.ph, !llvm.loop !9

._crit_edge.loopexit.split.loop.exit39:           ; preds = %22
  %26 = getelementptr inbounds ptr, ptr %1, i64 %23
  br label %._crit_edge.loopexit

._crit_edge.loopexit:                             ; preds = %.lr.ph, %._crit_edge.loopexit.split.loop.exit39
  %.021.lcssa.ph = phi i64 [ %23, %._crit_edge.loopexit.split.loop.exit39 ], [ %.02133, %.lr.ph ]
  %.lcssa31.ph = phi ptr [ %26, %._crit_edge.loopexit.split.loop.exit39 ], [ %19, %.lr.ph ]
  %.pre = load ptr, ptr %5, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %27 = phi ptr [ %16, %.preheader ], [ %.pre, %._crit_edge.loopexit ]
  %.021.lcssa = phi i64 [ 0, %.preheader ], [ %.021.lcssa.ph, %._crit_edge.loopexit ]
  %.lcssa31 = phi ptr [ %1, %.preheader ], [ %.lcssa31.ph, %._crit_edge.loopexit ]
  call void @FreePool(ptr noundef %27) #3
  %28 = load ptr, ptr %.lcssa31, align 8, !tbaa !5
  %29 = icmp eq ptr %28, null
  br i1 %29, label %69, label %30

30:                                               ; preds = %._crit_edge
  store i64 %.021.lcssa, ptr %4, align 8, !tbaa !11
  %31 = getelementptr inbounds i8, ptr %4, i64 8
  store i32 0, ptr %31, align 8, !tbaa !16
  %32 = getelementptr inbounds i8, ptr %4, i64 32
  store i8 0, ptr %32, align 8, !tbaa !17
  %33 = call i64 @GetDeviceConsistMappingInfo(ptr noundef nonnull %4, ptr noundef %0)
  %34 = call ptr @SetMem(ptr noundef nonnull %3, i64 noundef 16, i8 noundef zeroext 0) #3
  %35 = load i32, ptr %31, align 8
  br label %36

36:                                               ; preds = %36, %30
  %.1 = phi i64 [ 0, %30 ], [ %40, %36 ]
  %37 = getelementptr inbounds [5 x %struct.MTD_NAME], ptr @mMTDName, i64 0, i64 %.1
  %38 = load i32, ptr %37, align 16, !tbaa !18
  %.not25 = icmp eq i32 %38, 4
  %39 = icmp eq i32 %35, %38
  %or.cond30 = select i1 %.not25, i1 true, i1 %39
  %40 = add i64 %.1, 1
  br i1 %or.cond30, label %41, label %36, !llvm.loop !20

41:                                               ; preds = %36
  br i1 %.not25, label %46, label %42

42:                                               ; preds = %41
  %43 = getelementptr inbounds i8, ptr %37, i64 8
  %44 = load ptr, ptr %43, align 8, !tbaa !21
  %45 = call ptr (ptr, ptr, ...) @CatPrint(ptr noundef nonnull %3, ptr noundef nonnull @.str.23, ptr noundef %44)
  br label %46

46:                                               ; preds = %42, %41
  %47 = load i64, ptr %4, align 8, !tbaa !11
  %48 = call ptr (ptr, ptr, ...) @CatPrint(ptr noundef nonnull %3, ptr noundef nonnull @.str.24, i64 noundef %47)
  %49 = getelementptr inbounds i8, ptr %4, i64 16
  %50 = load ptr, ptr %49, align 8, !tbaa !22
  %.not27 = icmp eq ptr %50, null
  br i1 %.not27, label %54, label %51

51:                                               ; preds = %46
  %52 = call ptr (ptr, ptr, ...) @CatPrint(ptr noundef nonnull %3, ptr noundef nonnull @.str.23, ptr noundef nonnull %50)
  %53 = load ptr, ptr %49, align 8, !tbaa !22
  call void @FreePool(ptr noundef %53) #3
  br label %54

54:                                               ; preds = %51, %46
  %55 = load ptr, ptr %3, align 8, !tbaa !23
  %.not28 = icmp eq ptr %55, null
  br i1 %.not28, label %58, label %56

56:                                               ; preds = %54
  %57 = call ptr (ptr, ptr, ...) @CatPrint(ptr noundef nonnull %3, ptr noundef nonnull @.str.25)
  %.pre38 = load ptr, ptr %3, align 8, !tbaa !23
  br label %58

58:                                               ; preds = %56, %54
  %59 = phi ptr [ %.pre38, %56 ], [ null, %54 ]
  %60 = getelementptr inbounds i8, ptr %3, i64 8
  %61 = load i64, ptr %60, align 8, !tbaa !24
  %62 = shl i64 %61, 1
  %63 = add i64 %62, 2
  %64 = call ptr @ReallocatePool(i64 noundef %61, i64 noundef %63, ptr noundef %59) #3
  %65 = icmp eq ptr %64, null
  br i1 %65, label %69, label %66

66:                                               ; preds = %58
  %67 = load i64, ptr %60, align 8, !tbaa !24
  %68 = getelementptr inbounds i16, ptr %64, i64 %67
  store i16 0, ptr %68, align 2, !tbaa !25
  br label %69

69:                                               ; preds = %58, %._crit_edge, %15, %66
  %.0 = phi ptr [ %64, %66 ], [ null, %15 ], [ null, %._crit_edge ], [ null, %58 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #3
  ret ptr %.0
}

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !13, i64 0}
!12 = !{!"", !13, i64 0, !14, i64 8, !15, i64 16, !7, i64 32}
!13 = !{!"long long", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"", !6, i64 0, !13, i64 8}
!16 = !{!12, !14, i64 8}
!17 = !{!12, !7, i64 32}
!18 = !{!19, !14, i64 0}
!19 = !{!"", !14, i64 0, !6, i64 8}
!20 = distinct !{!20, !10}
!21 = !{!19, !6, i64 8}
!22 = !{!12, !6, i64 16}
!23 = !{!15, !6, i64 0}
!24 = !{!15, !13, i64 8}
!25 = !{!26, !26, i64 0}
!26 = !{!"short", !7, i64 0}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass