; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal (ConfigRequestValidate)

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

@.str.2 = external hidden unnamed_addr constant [6 x i32], align 4
@.str.14 = external hidden unnamed_addr constant [7 x i32], align 4
@.str.15 = external hidden unnamed_addr constant [7 x i32], align 4

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

declare i64 @StrnCmp(ptr noundef, ptr noundef, i64 noundef) #1

declare i64 @StrLen(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @OffsetWidthValidate(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local ptr @NameValueValidate(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local ptr @ConfigRequestValidate(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  store i8 1, ptr %4, align 1, !tbaa !9
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %7, ptr %5, align 8, !tbaa !5
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  %9 = call i64 @StrLen(ptr noundef @.str.2)
  %10 = call i64 @StrnCmp(ptr noundef %8, ptr noundef @.str.2, i64 noundef %9)
  %11 = icmp ne i64 %10, 0
  br i1 %11, label %12, label %14

12:                                               ; preds = %1
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %13, ptr %2, align 8
  store i32 1, ptr %6, align 4
  br label %106

14:                                               ; preds = %1
  %15 = call i64 @StrLen(ptr noundef @.str.2)
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds i16, ptr %16, i64 %15
  store ptr %17, ptr %5, align 8, !tbaa !5
  br label %18

18:                                               ; preds = %30, %14
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = load i16, ptr %19, align 2, !tbaa !10
  %21 = zext i16 %20 to i32
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %28

23:                                               ; preds = %18
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = call i64 @StrLen(ptr noundef @.str.14)
  %26 = call i64 @StrnCmp(ptr noundef %24, ptr noundef @.str.14, i64 noundef %25)
  %27 = icmp ne i64 %26, 0
  br label %28

28:                                               ; preds = %23, %18
  %29 = phi i1 [ false, %18 ], [ %27, %23 ]
  br i1 %29, label %30, label %33

30:                                               ; preds = %28
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds i16, ptr %31, i32 1
  store ptr %32, ptr %5, align 8, !tbaa !5
  br label %18, !llvm.loop !12

33:                                               ; preds = %28
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = load i16, ptr %34, align 2, !tbaa !10
  %36 = zext i16 %35 to i32
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %38, label %40

38:                                               ; preds = %33
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %39, ptr %2, align 8
  store i32 1, ptr %6, align 4
  br label %106

40:                                               ; preds = %33
  %41 = call i64 @StrLen(ptr noundef @.str.14)
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds i16, ptr %42, i64 %41
  store ptr %43, ptr %5, align 8, !tbaa !5
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = load i16, ptr %44, align 2, !tbaa !10
  %46 = zext i16 %45 to i32
  %47 = icmp eq i32 %46, 38
  br i1 %47, label %48, label %49

48:                                               ; preds = %40
  store i8 0, ptr %4, align 1, !tbaa !9
  br label %49

49:                                               ; preds = %48, %40
  br label %50

50:                                               ; preds = %62, %49
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = load i16, ptr %51, align 2, !tbaa !10
  %53 = zext i16 %52 to i32
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %60

55:                                               ; preds = %50
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = call i64 @StrLen(ptr noundef @.str.15)
  %58 = call i64 @StrnCmp(ptr noundef %56, ptr noundef @.str.15, i64 noundef %57)
  %59 = icmp ne i64 %58, 0
  br label %60

60:                                               ; preds = %55, %50
  %61 = phi i1 [ false, %50 ], [ %59, %55 ]
  br i1 %61, label %62, label %65

62:                                               ; preds = %60
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds i16, ptr %63, i32 1
  store ptr %64, ptr %5, align 8, !tbaa !5
  br label %50, !llvm.loop !14

65:                                               ; preds = %60
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = load i16, ptr %66, align 2, !tbaa !10
  %68 = zext i16 %67 to i32
  %69 = icmp eq i32 %68, 0
  br i1 %69, label %70, label %72

70:                                               ; preds = %65
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %71, ptr %2, align 8
  store i32 1, ptr %6, align 4
  br label %106

72:                                               ; preds = %65
  %73 = call i64 @StrLen(ptr noundef @.str.15)
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds i16, ptr %74, i64 %73
  store ptr %75, ptr %5, align 8, !tbaa !5
  br label %76

76:                                               ; preds = %88, %72
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = load i16, ptr %77, align 2, !tbaa !10
  %79 = zext i16 %78 to i32
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %86

81:                                               ; preds = %76
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = load i16, ptr %82, align 2, !tbaa !10
  %84 = zext i16 %83 to i32
  %85 = icmp ne i32 %84, 38
  br label %86

86:                                               ; preds = %81, %76
  %87 = phi i1 [ false, %76 ], [ %85, %81 ]
  br i1 %87, label %88, label %91

88:                                               ; preds = %86
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = getelementptr inbounds i16, ptr %89, i32 1
  store ptr %90, ptr %5, align 8, !tbaa !5
  br label %76, !llvm.loop !15

91:                                               ; preds = %86
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = load i16, ptr %92, align 2, !tbaa !10
  %94 = zext i16 %93 to i32
  %95 = icmp eq i32 %94, 0
  br i1 %95, label %96, label %97

96:                                               ; preds = %91
  store ptr null, ptr %2, align 8
  store i32 1, ptr %6, align 4
  br label %106

97:                                               ; preds = %91
  %98 = load i8, ptr %4, align 1, !tbaa !9
  %99 = icmp ne i8 %98, 0
  br i1 %99, label %100, label %103

100:                                              ; preds = %97
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = call ptr @OffsetWidthValidate(ptr noundef %101)
  store ptr %102, ptr %2, align 8
  store i32 1, ptr %6, align 4
  br label %106

103:                                              ; preds = %97
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = call ptr @NameValueValidate(ptr noundef %104)
  store ptr %105, ptr %2, align 8
  store i32 1, ptr %6, align 4
  br label %106

106:                                              ; preds = %103, %100, %96, %70, %38, %12
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #3
  %107 = load ptr, ptr %2, align 8
  ret ptr %107
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}


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

@.str.2 = external hidden unnamed_addr constant [6 x i32], align 4
@.str.14 = external hidden unnamed_addr constant [7 x i32], align 4
@.str.15 = external hidden unnamed_addr constant [7 x i32], align 4

declare i64 @StrnCmp(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

declare i64 @StrLen(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @OffsetWidthValidate(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @NameValueValidate(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @ConfigRequestValidate(ptr noundef %0) local_unnamed_addr #1 {
  %2 = tail call i64 @StrLen(ptr noundef nonnull @.str.2) #2
  %3 = tail call i64 @StrnCmp(ptr noundef %0, ptr noundef nonnull @.str.2, i64 noundef %2) #2
  %.not = icmp eq i64 %3, 0
  br i1 %.not, label %4, label %.critedge.thread

4:                                                ; preds = %1
  %5 = tail call i64 @StrLen(ptr noundef nonnull @.str.2) #2
  %6 = getelementptr inbounds i16, ptr %0, i64 %5
  %7 = load i16, ptr %6, align 2, !tbaa !5
  %.not3142 = icmp eq i16 %7, 0
  br i1 %.not3142, label %.critedge.thread, label %.lr.ph

.lr.ph:                                           ; preds = %4, %10
  %.043 = phi ptr [ %11, %10 ], [ %6, %4 ]
  %8 = tail call i64 @StrLen(ptr noundef nonnull @.str.14) #2
  %9 = tail call i64 @StrnCmp(ptr noundef nonnull %.043, ptr noundef nonnull @.str.14, i64 noundef %8) #2
  %.not32 = icmp eq i64 %9, 0
  br i1 %.not32, label %.critedge, label %10

10:                                               ; preds = %.lr.ph
  %11 = getelementptr inbounds i8, ptr %.043, i64 2
  %12 = load i16, ptr %11, align 2, !tbaa !5
  %.not31 = icmp eq i16 %12, 0
  br i1 %.not31, label %.critedge.thread, label %.lr.ph, !llvm.loop !9

.critedge:                                        ; preds = %.lr.ph
  %.pr = load i16, ptr %.043, align 2, !tbaa !5
  %13 = icmp eq i16 %.pr, 0
  br i1 %13, label %.critedge.thread, label %14

14:                                               ; preds = %.critedge
  %15 = tail call i64 @StrLen(ptr noundef nonnull @.str.14) #2
  %16 = getelementptr inbounds i16, ptr %.043, i64 %15
  %17 = load i16, ptr %16, align 2, !tbaa !5
  %18 = icmp eq i16 %17, 38
  %.not3344 = icmp eq i16 %17, 0
  br i1 %.not3344, label %.critedge.thread, label %.lr.ph46

.lr.ph46:                                         ; preds = %14, %21
  %.145 = phi ptr [ %22, %21 ], [ %16, %14 ]
  %19 = tail call i64 @StrLen(ptr noundef nonnull @.str.15) #2
  %20 = tail call i64 @StrnCmp(ptr noundef nonnull %.145, ptr noundef nonnull @.str.15, i64 noundef %19) #2
  %.not34 = icmp eq i64 %20, 0
  br i1 %.not34, label %.critedge2, label %21

21:                                               ; preds = %.lr.ph46
  %22 = getelementptr inbounds i8, ptr %.145, i64 2
  %.pr38 = load i16, ptr %22, align 2, !tbaa !5
  %.not33 = icmp eq i16 %.pr38, 0
  br i1 %.not33, label %.critedge.thread, label %.lr.ph46, !llvm.loop !11

.critedge2:                                       ; preds = %.lr.ph46
  %.pre.pre = load i16, ptr %.145, align 2, !tbaa !5
  %23 = icmp eq i16 %.pre.pre, 0
  br i1 %23, label %.critedge.thread, label %24

24:                                               ; preds = %.critedge2
  %25 = tail call i64 @StrLen(ptr noundef nonnull @.str.15) #2
  %26 = getelementptr inbounds i16, ptr %.145, i64 %25
  br label %27

27:                                               ; preds = %29, %24
  %.2 = phi ptr [ %26, %24 ], [ %30, %29 ]
  %28 = load i16, ptr %.2, align 2, !tbaa !5
  switch i16 %28, label %29 [
    i16 0, label %.critedge.thread
    i16 38, label %31
  ]

29:                                               ; preds = %27
  %30 = getelementptr inbounds i8, ptr %.2, i64 2
  br label %27, !llvm.loop !12

31:                                               ; preds = %27
  br i1 %18, label %34, label %32

32:                                               ; preds = %31
  %33 = tail call ptr @OffsetWidthValidate(ptr noundef nonnull %.2)
  br label %.critedge.thread

34:                                               ; preds = %31
  %35 = tail call ptr @NameValueValidate(ptr noundef nonnull %.2)
  br label %.critedge.thread

.critedge.thread:                                 ; preds = %10, %21, %27, %14, %4, %.critedge2, %.critedge, %1, %34, %32
  %.029 = phi ptr [ %33, %32 ], [ %35, %34 ], [ %0, %1 ], [ %0, %.critedge ], [ %0, %.critedge2 ], [ %0, %4 ], [ %0, %14 ], [ null, %27 ], [ %0, %21 ], [ %0, %10 ]
  ret ptr %.029
}

attributes #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 = { 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 #2 = { 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 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}


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