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

; 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 [152 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @SmBusQuickRead(i64 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  store i64 %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  br label %5

5:                                                ; preds = %2
  %6 = call zeroext i8 @DebugAssertEnabled()
  %7 = icmp ne i8 %6, 0
  br i1 %7, label %8, label %17

8:                                                ; preds = %5
  %9 = load i64, ptr %3, align 8, !tbaa !5
  %10 = and i64 %9, 4194304
  %11 = icmp ne i64 %10, 0
  %12 = zext i1 %11 to i32
  %13 = trunc i32 %12 to i8
  %14 = icmp ne i8 %13, 0
  br i1 %14, label %15, label %16

15:                                               ; preds = %8
  call void @DebugAssert(ptr noundef @.str, i64 noundef 50, ptr noundef @.str.1)
  br label %16

16:                                               ; preds = %15, %8
  br label %17

17:                                               ; preds = %16, %5
  br label %18

18:                                               ; preds = %17
  br label %19

19:                                               ; preds = %18
  %20 = call zeroext i8 @DebugAssertEnabled()
  %21 = icmp ne i8 %20, 0
  br i1 %21, label %22, label %29

22:                                               ; preds = %19
  %23 = load i64, ptr %3, align 8, !tbaa !5
  %24 = lshr i64 %23, 8
  %25 = and i64 %24, 255
  %26 = icmp eq i64 %25, 0
  br i1 %26, label %28, label %27

27:                                               ; preds = %22
  call void @DebugAssert(ptr noundef @.str, i64 noundef 51, ptr noundef @.str.2)
  br label %28

28:                                               ; preds = %27, %22
  br label %29

29:                                               ; preds = %28, %19
  br label %30

30:                                               ; preds = %29
  br label %31

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

34:                                               ; preds = %31
  %35 = load i64, ptr %3, align 8, !tbaa !5
  %36 = lshr i64 %35, 16
  %37 = and i64 %36, 63
  %38 = icmp eq i64 %37, 0
  br i1 %38, label %40, label %39

39:                                               ; preds = %34
  call void @DebugAssert(ptr noundef @.str, i64 noundef 52, ptr noundef @.str.3)
  br label %40

40:                                               ; preds = %39, %34
  br label %41

41:                                               ; preds = %40, %31
  br label %42

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42
  %44 = call zeroext i8 @DebugAssertEnabled()
  %45 = icmp ne i8 %44, 0
  br i1 %45, label %46, label %52

46:                                               ; preds = %43
  %47 = load i64, ptr %3, align 8, !tbaa !5
  %48 = and i64 %47, -8388607
  %49 = icmp eq i64 %48, 0
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  call void @DebugAssert(ptr noundef @.str, i64 noundef 53, ptr noundef @.str.4)
  br label %51

51:                                               ; preds = %50, %46
  br label %52

52:                                               ; preds = %51, %43
  br label %53

53:                                               ; preds = %52
  %54 = load ptr, ptr %4, align 8, !tbaa !9
  %55 = icmp ne ptr %54, null
  br i1 %55, label %56, label %58

56:                                               ; preds = %53
  %57 = load ptr, ptr %4, align 8, !tbaa !9
  store i64 -9223372036854775805, ptr %57, align 8, !tbaa !5
  br label %58

58:                                               ; preds = %56, %53
  ret void
}

declare zeroext i8 @DebugAssertEnabled() #1

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) #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 = { "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" }

!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 [152 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @SmBusQuickRead(i64 noundef %0, ptr noundef writeonly %1) local_unnamed_addr #0 {
  %3 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not = icmp eq i8 %3, 0
  %4 = and i64 %0, 4194304
  %.not5 = icmp eq i64 %4, 0
  %or.cond = or i1 %.not5, %.not
  br i1 %or.cond, label %6, label %5

5:                                                ; preds = %2
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 50, ptr noundef nonnull @.str.1) #2
  br label %6

6:                                                ; preds = %5, %2
  %7 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not6 = icmp eq i8 %7, 0
  %8 = and i64 %0, 65280
  %9 = icmp eq i64 %8, 0
  %or.cond11 = or i1 %9, %.not6
  br i1 %or.cond11, label %11, label %10

10:                                               ; preds = %6
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 51, ptr noundef nonnull @.str.2) #2
  br label %11

11:                                               ; preds = %10, %6
  %12 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not7 = icmp eq i8 %12, 0
  %13 = and i64 %0, 4128768
  %14 = icmp eq i64 %13, 0
  %or.cond13 = or i1 %14, %.not7
  br i1 %or.cond13, label %16, label %15

15:                                               ; preds = %11
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 52, ptr noundef nonnull @.str.3) #2
  br label %16

16:                                               ; preds = %15, %11
  %17 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not8 = icmp eq i8 %17, 0
  %18 = and i64 %0, -8388607
  %19 = icmp eq i64 %18, 0
  %or.cond15 = or i1 %19, %.not8
  br i1 %or.cond15, label %21, label %20

20:                                               ; preds = %16
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 53, ptr noundef nonnull @.str.4) #2
  br label %21

21:                                               ; preds = %16, %20
  %.not9 = icmp eq ptr %1, null
  br i1 %.not9, label %23, label %22

22:                                               ; preds = %21
  store i64 -9223372036854775805, ptr %1, align 8, !tbaa !5
  br label %23

23:                                               ; preds = %22, %21
  ret void
}

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #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 = { "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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass