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

; 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 = external hidden unnamed_addr constant [49 x i32], align 4
@.str.1 = external hidden unnamed_addr constant [12 x i32], align 4

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

; Function Attrs: nounwind uwtable
define dso_local i64 @ShellAppMain(i64 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [10 x i64], align 16
  store i64 %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 80, ptr %5) #3
  %6 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 0
  store i64 2, ptr %6, align 16, !tbaa !5
  %7 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 1
  store i64 3, ptr %7, align 8, !tbaa !5
  %8 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 2
  store i64 4, ptr %8, align 16, !tbaa !5
  %9 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 3
  store i64 1, ptr %9, align 8, !tbaa !5
  %10 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 4
  store i64 5, ptr %10, align 16, !tbaa !5
  %11 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 5
  store i64 6, ptr %11, align 8, !tbaa !5
  %12 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 6
  store i64 7, ptr %12, align 16, !tbaa !5
  %13 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 7
  store i64 8, ptr %13, align 8, !tbaa !5
  %14 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 8
  store i64 1, ptr %14, align 16, !tbaa !5
  %15 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 9
  store i64 5, ptr %15, align 8, !tbaa !5
  %16 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 0
  %17 = load i64, ptr %16, align 16, !tbaa !5
  %18 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 1
  %19 = load i64, ptr %18, align 8, !tbaa !5
  %20 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 2
  %21 = load i64, ptr %20, align 16, !tbaa !5
  %22 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 3
  %23 = load i64, ptr %22, align 8, !tbaa !5
  %24 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 4
  %25 = load i64, ptr %24, align 16, !tbaa !5
  %26 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 5
  %27 = load i64, ptr %26, align 8, !tbaa !5
  %28 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 6
  %29 = load i64, ptr %28, align 16, !tbaa !5
  %30 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 7
  %31 = load i64, ptr %30, align 8, !tbaa !5
  %32 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 8
  %33 = load i64, ptr %32, align 16, !tbaa !5
  %34 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 9
  %35 = load i64, ptr %34, align 8, !tbaa !5
  %36 = call i64 (ptr, ...) @Print(ptr noundef @.str, i64 noundef %17, i64 noundef %19, i64 noundef %21, i64 noundef %23, i64 noundef %25, i64 noundef %27, i64 noundef %29, i64 noundef %31, i64 noundef %33, i64 noundef %35)
  %37 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 0
  call void @PerformQuickSort(ptr noundef %37, i64 noundef 10, i64 noundef 8, ptr noundef @Test)
  %38 = call i64 (ptr, ...) @Print(ptr noundef @.str.1)
  %39 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 0
  %40 = load i64, ptr %39, align 16, !tbaa !5
  %41 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 1
  %42 = load i64, ptr %41, align 8, !tbaa !5
  %43 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 2
  %44 = load i64, ptr %43, align 16, !tbaa !5
  %45 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 3
  %46 = load i64, ptr %45, align 8, !tbaa !5
  %47 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 4
  %48 = load i64, ptr %47, align 16, !tbaa !5
  %49 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 5
  %50 = load i64, ptr %49, align 8, !tbaa !5
  %51 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 6
  %52 = load i64, ptr %51, align 16, !tbaa !5
  %53 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 7
  %54 = load i64, ptr %53, align 8, !tbaa !5
  %55 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 8
  %56 = load i64, ptr %55, align 16, !tbaa !5
  %57 = getelementptr inbounds [10 x i64], ptr %5, i64 0, i64 9
  %58 = load i64, ptr %57, align 8, !tbaa !5
  %59 = call i64 (ptr, ...) @Print(ptr noundef @.str, i64 noundef %40, i64 noundef %42, i64 noundef %44, i64 noundef %46, i64 noundef %48, i64 noundef %50, i64 noundef %52, i64 noundef %54, i64 noundef %56, i64 noundef %58)
  call void @llvm.lifetime.end.p0(i64 80, ptr %5) #3
  ret i64 0
}

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

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

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

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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !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"

@.str = external hidden unnamed_addr constant [49 x i32], align 4
@.str.1 = external hidden unnamed_addr constant [12 x i32], align 4

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

; Function Attrs: nounwind uwtable
define dso_local noundef i64 @ShellAppMain(i64 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = alloca [10 x i64], align 16
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %3) #3
  store i64 2, ptr %3, align 16, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 8
  store i64 3, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %3, i64 16
  store i64 4, ptr %5, align 16, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %3, i64 24
  store i64 1, ptr %6, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %3, i64 32
  store i64 5, ptr %7, align 16, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %3, i64 40
  store i64 6, ptr %8, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %3, i64 48
  store i64 7, ptr %9, align 16, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %3, i64 56
  store i64 8, ptr %10, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %3, i64 64
  store i64 1, ptr %11, align 16, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %3, i64 72
  store i64 5, ptr %12, align 8, !tbaa !5
  %13 = tail call i64 (ptr, ...) @Print(ptr noundef nonnull @.str, i64 noundef 2, i64 noundef 3, i64 noundef 4, i64 noundef 1, i64 noundef 5, i64 noundef 6, i64 noundef 7, i64 noundef 8, i64 noundef 1, i64 noundef 5) #3
  call void @PerformQuickSort(ptr noundef nonnull %3, i64 noundef 10, i64 noundef 8, ptr noundef nonnull @Test) #3
  %14 = call i64 (ptr, ...) @Print(ptr noundef nonnull @.str.1) #3
  %15 = load i64, ptr %3, align 16, !tbaa !5
  %16 = load i64, ptr %4, align 8, !tbaa !5
  %17 = load i64, ptr %5, align 16, !tbaa !5
  %18 = load i64, ptr %6, align 8, !tbaa !5
  %19 = load i64, ptr %7, align 16, !tbaa !5
  %20 = load i64, ptr %8, align 8, !tbaa !5
  %21 = load i64, ptr %9, align 16, !tbaa !5
  %22 = load i64, ptr %10, align 8, !tbaa !5
  %23 = load i64, ptr %11, align 16, !tbaa !5
  %24 = load i64, ptr %12, align 8, !tbaa !5
  %25 = call i64 (ptr, ...) @Print(ptr noundef nonnull @.str, i64 noundef %15, i64 noundef %16, i64 noundef %17, i64 noundef %18, i64 noundef %19, i64 noundef %20, i64 noundef %21, i64 noundef %22, i64 noundef %23, i64 noundef %24) #3
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %3) #3
  ret i64 0
}

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

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

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

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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass