; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/SecurityPkg/Application_ (PrintInfoFromSmm)

; 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.GUID = type { i32, i16, i16, [8 x i8] }
%struct.EFI_BOOT_SERVICES = type { %struct.EFI_TABLE_HEADER, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_TABLE_HEADER = type { i64, i32, i32, i32, i32 }
%struct.EFI_SMM_COMMUNICATE_HEADER = type <{ %struct.GUID, i64, [1 x i8] }>
%struct.SMM_VARIABLE_COMMUNICATE_HEADER = type { i64, i64, [1 x i8] }
%struct._VARIABLE_INFO_ENTRY = type { ptr, %struct.GUID, ptr, i32, i32, i32, i32, i32, i8 }

@mSmmCommunication = external dso_local global ptr, align 8
@gEfiSmmVariableProtocolGuid = external global %struct.GUID, align 4
@.str.1 = external hidden unnamed_addr constant [153 x i8], align 1
@gBS = external global ptr, align 8
@gEfiSmmCommunicationProtocolGuid = external global %struct.GUID, align 4
@.str.3 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [29 x i32], align 4
@.str.5 = external hidden unnamed_addr constant [31 x i32], align 4
@.str.6 = external hidden unnamed_addr constant [25 x i32], align 4

; Function Attrs: nounwind uwtable
declare dso_local i64 @GetVariableStatisticsData(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

; 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
define dso_local i64 @PrintInfoFromSmm() #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  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 8, ptr %8) #3
  %10 = load ptr, ptr @gBS, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %10, i32 0, i32 38
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = call i64 %12(ptr noundef @gEfiSmmVariableProtocolGuid, ptr noundef null, ptr noundef %8)
  store i64 %13, ptr %2, align 8, !tbaa !14
  %14 = load i64, ptr %2, align 8, !tbaa !14
  %15 = icmp slt i64 %14, 0
  br i1 %15, label %16, label %18

16:                                               ; preds = %0
  %17 = load i64, ptr %2, align 8, !tbaa !14
  store i64 %17, ptr %1, align 8
  store i32 1, ptr %9, align 4
  br label %185

18:                                               ; preds = %0
  %19 = load ptr, ptr @gBS, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %19, i32 0, i32 38
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %22 = call i64 %21(ptr noundef @gEfiSmmCommunicationProtocolGuid, ptr noundef null, ptr noundef @mSmmCommunication)
  store i64 %22, ptr %2, align 8, !tbaa !14
  %23 = load i64, ptr %2, align 8, !tbaa !14
  %24 = icmp slt i64 %23, 0
  br i1 %24, label %25, label %27

25:                                               ; preds = %18
  %26 = load i64, ptr %2, align 8, !tbaa !14
  store i64 %26, ptr %1, align 8
  store i32 1, ptr %9, align 4
  br label %185

27:                                               ; preds = %18
  store i64 40, ptr %6, align 8, !tbaa !14
  %28 = load i64, ptr %6, align 8, !tbaa !14
  store i64 %28, ptr %5, align 8, !tbaa !14
  %29 = load i64, ptr %6, align 8, !tbaa !14
  %30 = call ptr @AllocateZeroPool(i64 noundef %29)
  store ptr %30, ptr %4, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %27
  %32 = call zeroext i8 @DebugAssertEnabled()
  %33 = icmp ne i8 %32, 0
  br i1 %33, label %34, label %39

34:                                               ; preds = %31
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %38, label %37

37:                                               ; preds = %34
  call void @DebugAssert(ptr noundef @.str.1, i64 noundef 108, ptr noundef @.str.3)
  br label %38

38:                                               ; preds = %37, %34
  br label %39

39:                                               ; preds = %38, %31
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40
  %42 = call i64 (ptr, ...) @Print(ptr noundef @.str.4)
  br label %43

43:                                               ; preds = %109, %41
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = call i64 @GetVariableStatisticsData(ptr noundef %44, ptr noundef %6)
  store i64 %45, ptr %2, align 8, !tbaa !14
  %46 = load i64, ptr %2, align 8, !tbaa !14
  %47 = icmp eq i64 %46, -9223372036854775803
  br i1 %47, label %48, label %66

48:                                               ; preds = %43
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  call void @FreePool(ptr noundef %49)
  %50 = load i64, ptr %6, align 8, !tbaa !14
  %51 = call ptr @AllocateZeroPool(i64 noundef %50)
  store ptr %51, ptr %4, align 8, !tbaa !5
  br label %52

52:                                               ; preds = %48
  %53 = call zeroext i8 @DebugAssertEnabled()
  %54 = icmp ne i8 %53, 0
  br i1 %54, label %55, label %60

55:                                               ; preds = %52
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = icmp ne ptr %56, null
  br i1 %57, label %59, label %58

58:                                               ; preds = %55
  call void @DebugAssert(ptr noundef @.str.1, i64 noundef 116, ptr noundef @.str.3)
  br label %59

59:                                               ; preds = %58, %55
  br label %60

60:                                               ; preds = %59, %52
  br label %61

61:                                               ; preds = %60
  br label %62

62:                                               ; preds = %61
  %63 = load i64, ptr %6, align 8, !tbaa !14
  store i64 %63, ptr %5, align 8, !tbaa !14
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = call i64 @GetVariableStatisticsData(ptr noundef %64, ptr noundef %6)
  store i64 %65, ptr %2, align 8, !tbaa !14
  br label %66

66:                                               ; preds = %62, %43
  %67 = load i64, ptr %2, align 8, !tbaa !14
  %68 = icmp slt i64 %67, 0
  br i1 %68, label %72, label %69

69:                                               ; preds = %66
  %70 = load i64, ptr %6, align 8, !tbaa !14
  %71 = icmp ule i64 %70, 40
  br i1 %71, label %72, label %73

72:                                               ; preds = %69, %66
  br label %110

73:                                               ; preds = %69
  %74 = load i64, ptr %6, align 8, !tbaa !14
  %75 = load i64, ptr %5, align 8, !tbaa !14
  %76 = icmp ult i64 %74, %75
  br i1 %76, label %77, label %79

77:                                               ; preds = %73
  %78 = load i64, ptr %5, align 8, !tbaa !14
  store i64 %78, ptr %6, align 8, !tbaa !14
  br label %79

79:                                               ; preds = %77, %73
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.EFI_SMM_COMMUNICATE_HEADER, ptr %80, i32 0, i32 2
  %82 = getelementptr inbounds [1 x i8], ptr %81, i64 0, i64 0
  store ptr %82, ptr %7, align 8, !tbaa !5
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.SMM_VARIABLE_COMMUNICATE_HEADER, ptr %83, i32 0, i32 2
  %85 = getelementptr inbounds [1 x i8], ptr %84, i64 0, i64 0
  store ptr %85, ptr %3, align 8, !tbaa !5
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct._VARIABLE_INFO_ENTRY, ptr %86, i32 0, i32 8
  %88 = load i8, ptr %87, align 4, !tbaa !15
  %89 = icmp ne i8 %88, 0
  br i1 %89, label %108, label %90

90:                                               ; preds = %79
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct._VARIABLE_INFO_ENTRY, ptr %91, i32 0, i32 1
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct._VARIABLE_INFO_ENTRY, ptr %93, i32 0, i32 4
  %95 = load i32, ptr %94, align 4, !tbaa !19
  %96 = load ptr, ptr %3, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct._VARIABLE_INFO_ENTRY, ptr %96, i32 0, i32 7
  %98 = load i32, ptr %97, align 8, !tbaa !20
  %99 = load ptr, ptr %3, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct._VARIABLE_INFO_ENTRY, ptr %99, i32 0, i32 5
  %101 = load i32, ptr %100, align 8, !tbaa !21
  %102 = load ptr, ptr %3, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._VARIABLE_INFO_ENTRY, ptr %102, i32 0, i32 6
  %104 = load i32, ptr %103, align 4, !tbaa !22
  %105 = load ptr, ptr %3, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct._VARIABLE_INFO_ENTRY, ptr %105, i64 1
  %107 = call i64 (ptr, ...) @Print(ptr noundef @.str.5, ptr noundef %92, i32 noundef %95, i32 noundef %98, i32 noundef %101, i32 noundef %104, ptr noundef %106)
  br label %108

108:                                              ; preds = %90, %79
  br label %109

109:                                              ; preds = %108
  br i1 true, label %43, label %110

110:                                              ; preds = %109, %72
  %111 = call i64 (ptr, ...) @Print(ptr noundef @.str.6)
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = load i64, ptr %6, align 8, !tbaa !14
  %114 = call ptr @ZeroMem(ptr noundef %112, i64 noundef %113)
  br label %115

115:                                              ; preds = %181, %110
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = call i64 @GetVariableStatisticsData(ptr noundef %116, ptr noundef %6)
  store i64 %117, ptr %2, align 8, !tbaa !14
  %118 = load i64, ptr %2, align 8, !tbaa !14
  %119 = icmp eq i64 %118, -9223372036854775803
  br i1 %119, label %120, label %138

120:                                              ; preds = %115
  %121 = load ptr, ptr %4, align 8, !tbaa !5
  call void @FreePool(ptr noundef %121)
  %122 = load i64, ptr %6, align 8, !tbaa !14
  %123 = call ptr @AllocateZeroPool(i64 noundef %122)
  store ptr %123, ptr %4, align 8, !tbaa !5
  br label %124

124:                                              ; preds = %120
  %125 = call zeroext i8 @DebugAssertEnabled()
  %126 = icmp ne i8 %125, 0
  br i1 %126, label %127, label %132

127:                                              ; preds = %124
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = icmp ne ptr %128, null
  br i1 %129, label %131, label %130

130:                                              ; preds = %127
  call void @DebugAssert(ptr noundef @.str.1, i64 noundef 152, ptr noundef @.str.3)
  br label %131

131:                                              ; preds = %130, %127
  br label %132

132:                                              ; preds = %131, %124
  br label %133

133:                                              ; preds = %132
  br label %134

134:                                              ; preds = %133
  %135 = load i64, ptr %6, align 8, !tbaa !14
  store i64 %135, ptr %5, align 8, !tbaa !14
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  %137 = call i64 @GetVariableStatisticsData(ptr noundef %136, ptr noundef %6)
  store i64 %137, ptr %2, align 8, !tbaa !14
  br label %138

138:                                              ; preds = %134, %115
  %139 = load i64, ptr %2, align 8, !tbaa !14
  %140 = icmp slt i64 %139, 0
  br i1 %140, label %144, label %141

141:                                              ; preds = %138
  %142 = load i64, ptr %6, align 8, !tbaa !14
  %143 = icmp ule i64 %142, 40
  br i1 %143, label %144, label %145

144:                                              ; preds = %141, %138
  br label %182

145:                                              ; preds = %141
  %146 = load i64, ptr %6, align 8, !tbaa !14
  %147 = load i64, ptr %5, align 8, !tbaa !14
  %148 = icmp ult i64 %146, %147
  br i1 %148, label %149, label %151

149:                                              ; preds = %145
  %150 = load i64, ptr %5, align 8, !tbaa !14
  store i64 %150, ptr %6, align 8, !tbaa !14
  br label %151

151:                                              ; preds = %149, %145
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.EFI_SMM_COMMUNICATE_HEADER, ptr %152, i32 0, i32 2
  %154 = getelementptr inbounds [1 x i8], ptr %153, i64 0, i64 0
  store ptr %154, ptr %7, align 8, !tbaa !5
  %155 = load ptr, ptr %7, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.SMM_VARIABLE_COMMUNICATE_HEADER, ptr %155, i32 0, i32 2
  %157 = getelementptr inbounds [1 x i8], ptr %156, i64 0, i64 0
  store ptr %157, ptr %3, align 8, !tbaa !5
  %158 = load ptr, ptr %3, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct._VARIABLE_INFO_ENTRY, ptr %158, i32 0, i32 8
  %160 = load i8, ptr %159, align 4, !tbaa !15
  %161 = icmp ne i8 %160, 0
  br i1 %161, label %162, label %180

162:                                              ; preds = %151
  %163 = load ptr, ptr %3, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct._VARIABLE_INFO_ENTRY, ptr %163, i32 0, i32 1
  %165 = load ptr, ptr %3, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct._VARIABLE_INFO_ENTRY, ptr %165, i32 0, i32 4
  %167 = load i32, ptr %166, align 4, !tbaa !19
  %168 = load ptr, ptr %3, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct._VARIABLE_INFO_ENTRY, ptr %168, i32 0, i32 7
  %170 = load i32, ptr %169, align 8, !tbaa !20
  %171 = load ptr, ptr %3, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct._VARIABLE_INFO_ENTRY, ptr %171, i32 0, i32 5
  %173 = load i32, ptr %172, align 8, !tbaa !21
  %174 = load ptr, ptr %3, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct._VARIABLE_INFO_ENTRY, ptr %174, i32 0, i32 6
  %176 = load i32, ptr %175, align 4, !tbaa !22
  %177 = load ptr, ptr %3, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct._VARIABLE_INFO_ENTRY, ptr %177, i64 1
  %179 = call i64 (ptr, ...) @Print(ptr noundef @.str.5, ptr noundef %164, i32 noundef %167, i32 noundef %170, i32 noundef %173, i32 noundef %176, ptr noundef %178)
  br label %180

180:                                              ; preds = %162, %151
  br label %181

181:                                              ; preds = %180
  br i1 true, label %115, label %182

182:                                              ; preds = %181, %144
  %183 = load ptr, ptr %4, align 8, !tbaa !5
  call void @FreePool(ptr noundef %183)
  %184 = load i64, ptr %2, align 8, !tbaa !14
  store i64 %184, ptr %1, align 8
  store i32 1, ptr %9, align 4
  br label %185

185:                                              ; preds = %182, %25, %16
  call void @llvm.lifetime.end.p0(i64 8, 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
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  %186 = load i64, ptr %1, align 8
  ret i64 %186
}

declare ptr @AllocateZeroPool(i64 noundef) #2

declare i64 @Print(ptr noundef, ...) #2

declare void @FreePool(ptr noundef) #2

declare ptr @ZeroMem(ptr noundef, i64 noundef) #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 = { 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 320}
!10 = !{!"", !11, i64 0, !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, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368}
!11 = !{!"", !12, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !12, i64 0}
!15 = !{!16, !7, i64 52}
!16 = !{!"_VARIABLE_INFO_ENTRY", !6, i64 0, !17, i64 8, !6, i64 24, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !7, i64 52}
!17 = !{!"", !13, i64 0, !18, i64 4, !18, i64 6, !7, i64 8}
!18 = !{!"short", !7, i64 0}
!19 = !{!16, !13, i64 36}
!20 = !{!16, !13, i64 48}
!21 = !{!16, !13, i64 40}
!22 = !{!16, !13, i64 44}


; 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.GUID = type { i32, i16, i16, [8 x i8] }

@mSmmCommunication = external dso_local global ptr, align 8
@gEfiSmmVariableProtocolGuid = external global %struct.GUID, align 4
@.str.1 = external hidden unnamed_addr constant [153 x i8], align 1
@gBS = external local_unnamed_addr global ptr, align 8
@gEfiSmmCommunicationProtocolGuid = external global %struct.GUID, align 4
@.str.3 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [29 x i32], align 4
@.str.5 = external hidden unnamed_addr constant [31 x i32], align 4
@.str.6 = external hidden unnamed_addr constant [25 x i32], align 4

; Function Attrs: nounwind uwtable
declare dso_local i64 @GetVariableStatisticsData(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

; 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
define dso_local i64 @PrintInfoFromSmm() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  %3 = load ptr, ptr @gBS, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 320
  %5 = load ptr, ptr %4, align 8, !tbaa !9
  %6 = call i64 %5(ptr noundef nonnull @gEfiSmmVariableProtocolGuid, ptr noundef null, ptr noundef nonnull %2) #3
  %7 = icmp slt i64 %6, 0
  br i1 %7, label %97, label %8

8:                                                ; preds = %0
  %9 = load ptr, ptr @gBS, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 320
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %12 = call i64 %11(ptr noundef nonnull @gEfiSmmCommunicationProtocolGuid, ptr noundef null, ptr noundef nonnull @mSmmCommunication) #3
  %13 = icmp slt i64 %12, 0
  br i1 %13, label %97, label %14

14:                                               ; preds = %8
  store i64 40, ptr %1, align 8, !tbaa !14
  %15 = call ptr @AllocateZeroPool(i64 noundef 40) #3
  %16 = call zeroext i8 @DebugAssertEnabled() #3
  %17 = icmp eq i8 %16, 0
  %18 = icmp ne ptr %15, null
  %or.cond5 = select i1 %17, i1 true, i1 %18
  br i1 %or.cond5, label %20, label %19

19:                                               ; preds = %14
  call void @DebugAssert(ptr noundef nonnull @.str.1, i64 noundef 108, ptr noundef nonnull @.str.3) #3
  br label %20

20:                                               ; preds = %19, %14
  %21 = call i64 (ptr, ...) @Print(ptr noundef nonnull @.str.4) #3
  br label %22

22:                                               ; preds = %.backedge65, %20
  %.051 = phi ptr [ %15, %20 ], [ %.152, %.backedge65 ]
  %.0 = phi i64 [ 40, %20 ], [ %.1, %.backedge65 ]
  %23 = call i64 @GetVariableStatisticsData(ptr noundef %.051, ptr noundef nonnull %1)
  %24 = icmp eq i64 %23, -9223372036854775803
  br i1 %24, label %25, label %35

25:                                               ; preds = %22
  call void @FreePool(ptr noundef %.051) #3
  %26 = load i64, ptr %1, align 8, !tbaa !14
  %27 = call ptr @AllocateZeroPool(i64 noundef %26) #3
  %28 = call zeroext i8 @DebugAssertEnabled() #3
  %29 = icmp eq i8 %28, 0
  %30 = icmp ne ptr %27, null
  %or.cond7 = select i1 %29, i1 true, i1 %30
  br i1 %or.cond7, label %32, label %31

31:                                               ; preds = %25
  call void @DebugAssert(ptr noundef nonnull @.str.1, i64 noundef 116, ptr noundef nonnull @.str.3) #3
  br label %32

32:                                               ; preds = %31, %25
  %33 = load i64, ptr %1, align 8, !tbaa !14
  %34 = call i64 @GetVariableStatisticsData(ptr noundef %27, ptr noundef nonnull %1)
  br label %35

35:                                               ; preds = %32, %22
  %.055 = phi i64 [ %34, %32 ], [ %23, %22 ]
  %.152 = phi ptr [ %27, %32 ], [ %.051, %22 ]
  %.1 = phi i64 [ %33, %32 ], [ %.0, %22 ]
  %36 = icmp slt i64 %.055, 0
  %37 = load i64, ptr %1, align 8
  %38 = icmp ult i64 %37, 41
  %or.cond = select i1 %36, i1 true, i1 %38
  br i1 %or.cond, label %57, label %39

39:                                               ; preds = %35
  %40 = icmp ult i64 %37, %.1
  br i1 %40, label %41, label %42

41:                                               ; preds = %39
  store i64 %.1, ptr %1, align 8, !tbaa !14
  br label %42

42:                                               ; preds = %41, %39
  %43 = getelementptr inbounds i8, ptr %.152, i64 92
  %44 = load i8, ptr %43, align 4, !tbaa !15
  %.not = icmp eq i8 %44, 0
  br i1 %.not, label %45, label %.backedge65

.backedge65:                                      ; preds = %42, %45
  br label %22

45:                                               ; preds = %42
  %46 = getelementptr inbounds i8, ptr %.152, i64 48
  %47 = getelementptr inbounds i8, ptr %.152, i64 76
  %48 = load i32, ptr %47, align 4, !tbaa !19
  %49 = getelementptr inbounds i8, ptr %.152, i64 88
  %50 = load i32, ptr %49, align 8, !tbaa !20
  %51 = getelementptr inbounds i8, ptr %.152, i64 80
  %52 = load i32, ptr %51, align 8, !tbaa !21
  %53 = getelementptr inbounds i8, ptr %.152, i64 84
  %54 = load i32, ptr %53, align 4, !tbaa !22
  %55 = getelementptr inbounds i8, ptr %.152, i64 96
  %56 = call i64 (ptr, ...) @Print(ptr noundef nonnull @.str.5, ptr noundef nonnull %46, i32 noundef %48, i32 noundef %50, i32 noundef %52, i32 noundef %54, ptr noundef nonnull %55) #3
  br label %.backedge65

57:                                               ; preds = %35
  %58 = call i64 (ptr, ...) @Print(ptr noundef nonnull @.str.6) #3
  %59 = load i64, ptr %1, align 8, !tbaa !14
  %60 = call ptr @ZeroMem(ptr noundef %.152, i64 noundef %59) #3
  br label %61

61:                                               ; preds = %.backedge, %57
  %.253 = phi ptr [ %.152, %57 ], [ %.354, %.backedge ]
  %.2 = phi i64 [ %.1, %57 ], [ %.3, %.backedge ]
  %62 = call i64 @GetVariableStatisticsData(ptr noundef %.253, ptr noundef nonnull %1)
  %63 = icmp eq i64 %62, -9223372036854775803
  br i1 %63, label %64, label %74

64:                                               ; preds = %61
  call void @FreePool(ptr noundef %.253) #3
  %65 = load i64, ptr %1, align 8, !tbaa !14
  %66 = call ptr @AllocateZeroPool(i64 noundef %65) #3
  %67 = call zeroext i8 @DebugAssertEnabled() #3
  %68 = icmp eq i8 %67, 0
  %69 = icmp ne ptr %66, null
  %or.cond9 = select i1 %68, i1 true, i1 %69
  br i1 %or.cond9, label %71, label %70

70:                                               ; preds = %64
  call void @DebugAssert(ptr noundef nonnull @.str.1, i64 noundef 152, ptr noundef nonnull @.str.3) #3
  br label %71

71:                                               ; preds = %70, %64
  %72 = load i64, ptr %1, align 8, !tbaa !14
  %73 = call i64 @GetVariableStatisticsData(ptr noundef %66, ptr noundef nonnull %1)
  br label %74

74:                                               ; preds = %71, %61
  %.156 = phi i64 [ %73, %71 ], [ %62, %61 ]
  %.354 = phi ptr [ %66, %71 ], [ %.253, %61 ]
  %.3 = phi i64 [ %72, %71 ], [ %.2, %61 ]
  %75 = icmp slt i64 %.156, 0
  %76 = load i64, ptr %1, align 8
  %77 = icmp ult i64 %76, 41
  %or.cond3 = select i1 %75, i1 true, i1 %77
  br i1 %or.cond3, label %96, label %78

78:                                               ; preds = %74
  %79 = icmp ult i64 %76, %.3
  br i1 %79, label %80, label %81

80:                                               ; preds = %78
  store i64 %.3, ptr %1, align 8, !tbaa !14
  br label %81

81:                                               ; preds = %80, %78
  %82 = getelementptr inbounds i8, ptr %.354, i64 92
  %83 = load i8, ptr %82, align 4, !tbaa !15
  %.not64 = icmp eq i8 %83, 0
  br i1 %.not64, label %.backedge, label %84

.backedge:                                        ; preds = %81, %84
  br label %61

84:                                               ; preds = %81
  %85 = getelementptr inbounds i8, ptr %.354, i64 48
  %86 = getelementptr inbounds i8, ptr %.354, i64 76
  %87 = load i32, ptr %86, align 4, !tbaa !19
  %88 = getelementptr inbounds i8, ptr %.354, i64 88
  %89 = load i32, ptr %88, align 8, !tbaa !20
  %90 = getelementptr inbounds i8, ptr %.354, i64 80
  %91 = load i32, ptr %90, align 8, !tbaa !21
  %92 = getelementptr inbounds i8, ptr %.354, i64 84
  %93 = load i32, ptr %92, align 4, !tbaa !22
  %94 = getelementptr inbounds i8, ptr %.354, i64 96
  %95 = call i64 (ptr, ...) @Print(ptr noundef nonnull @.str.5, ptr noundef nonnull %85, i32 noundef %87, i32 noundef %89, i32 noundef %91, i32 noundef %93, ptr noundef nonnull %94) #3
  br label %.backedge

96:                                               ; preds = %74
  call void @FreePool(ptr noundef %.354) #3
  br label %97

97:                                               ; preds = %8, %0, %96
  %.057 = phi i64 [ %.156, %96 ], [ %6, %0 ], [ %12, %8 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #3
  ret i64 %.057
}

declare ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #2

declare i64 @Print(ptr noundef, ...) local_unnamed_addr #2

declare void @FreePool(ptr noundef) local_unnamed_addr #2

declare ptr @ZeroMem(ptr noundef, i64 noundef) local_unnamed_addr #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 = { 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 = !{!10, !6, i64 320}
!10 = !{!"", !11, i64 0, !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, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368}
!11 = !{!"", !12, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !12, i64 0}
!15 = !{!16, !7, i64 52}
!16 = !{!"_VARIABLE_INFO_ENTRY", !6, i64 0, !17, i64 8, !6, i64 24, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !7, i64 52}
!17 = !{!"", !13, i64 0, !18, i64 4, !18, i64 6, !7, i64 8}
!18 = !{!"short", !7, i64 0}
!19 = !{!16, !13, i64 36}
!20 = !{!16, !13, i64 48}
!21 = !{!16, !13, i64 40}
!22 = !{!16, !13, i64 44}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopUnrollPass,SROAPass,SimplifyCFGPass