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

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

declare zeroext i8 @DebugAssertEnabled() #0

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i8 @SmBusReceiveByte(i64 noundef %0, ptr noundef %1) #1 {
  %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 %15

8:                                                ; preds = %5
  %9 = load i64, ptr %3, align 8, !tbaa !5
  %10 = lshr i64 %9, 8
  %11 = and i64 %10, 255
  %12 = icmp eq i64 %11, 0
  br i1 %12, label %14, label %13

13:                                               ; preds = %8
  call void @DebugAssert(ptr noundef @.str, i64 noundef 133, ptr noundef @.str.2)
  br label %14

14:                                               ; preds = %13, %8
  br label %15

15:                                               ; preds = %14, %5
  br label %16

16:                                               ; preds = %15
  br label %17

17:                                               ; preds = %16
  %18 = call zeroext i8 @DebugAssertEnabled()
  %19 = icmp ne i8 %18, 0
  br i1 %19, label %20, label %27

20:                                               ; preds = %17
  %21 = load i64, ptr %3, align 8, !tbaa !5
  %22 = lshr i64 %21, 16
  %23 = and i64 %22, 63
  %24 = icmp eq i64 %23, 0
  br i1 %24, label %26, label %25

25:                                               ; preds = %20
  call void @DebugAssert(ptr noundef @.str, i64 noundef 134, ptr noundef @.str.3)
  br label %26

26:                                               ; preds = %25, %20
  br label %27

27:                                               ; preds = %26, %17
  br label %28

28:                                               ; preds = %27
  br label %29

29:                                               ; preds = %28
  %30 = call zeroext i8 @DebugAssertEnabled()
  %31 = icmp ne i8 %30, 0
  br i1 %31, label %32, label %38

32:                                               ; preds = %29
  %33 = load i64, ptr %3, align 8, !tbaa !5
  %34 = and i64 %33, -8388607
  %35 = icmp eq i64 %34, 0
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  call void @DebugAssert(ptr noundef @.str, i64 noundef 135, ptr noundef @.str.4)
  br label %37

37:                                               ; preds = %36, %32
  br label %38

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

39:                                               ; preds = %38
  %40 = load ptr, ptr %4, align 8, !tbaa !9
  %41 = icmp ne ptr %40, null
  br i1 %41, label %42, label %44

42:                                               ; preds = %39
  %43 = load ptr, ptr %4, align 8, !tbaa !9
  store i64 -9223372036854775805, ptr %43, align 8, !tbaa !5
  br label %44

44:                                               ; preds = %42, %39
  ret i8 0
}

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

!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.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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #0

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

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

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

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

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

12:                                               ; preds = %11, %7
  %13 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not5 = icmp eq i8 %13, 0
  %14 = and i64 %0, -8388607
  %15 = icmp eq i64 %14, 0
  %or.cond11 = or i1 %15, %.not5
  br i1 %or.cond11, label %17, label %16

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

17:                                               ; preds = %12, %16
  %.not6 = icmp eq ptr %1, null
  br i1 %.not6, label %19, label %18

18:                                               ; preds = %17
  store i64 -9223372036854775805, ptr %1, align 8, !tbaa !5
  br label %19

19:                                               ; preds = %18, %17
  ret i8 0
}

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


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