; LLVM IR from Simple-XX/SimpleKernel :: src/arch/ia32/i386/intr/intr.ll (ZN4INTR11disable_irqEh)

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZN2IO12get_instanceEv() #0

declare void @_ZN2IO4outbEjh(i32 noundef, i8 noundef zeroext) #0

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

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

declare noundef zeroext i8 @_ZN2IO3inbEj(i32 noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4INTR11disable_irqEh(ptr noundef nonnull align 1 dereferenceable(1) %0, i8 noundef zeroext %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca i8, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i8 %1, ptr %4, align 1, !tbaa !9
  %6 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #3
  store i8 0, ptr %5, align 1, !tbaa !9
  %7 = load i8, ptr %4, align 1, !tbaa !9
  %8 = zext i8 %7 to i32
  %9 = icmp uge i32 %8, 40
  br i1 %9, label %10, label %22

10:                                               ; preds = %2
  %11 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2IO12get_instanceEv()
  %12 = call noundef zeroext i8 @_ZN2IO3inbEj(i32 noundef 161)
  %13 = zext i8 %12 to i32
  %14 = load i8, ptr %4, align 1, !tbaa !9
  %15 = zext i8 %14 to i32
  %16 = srem i32 %15, 8
  %17 = shl i32 1, %16
  %18 = or i32 %13, %17
  %19 = trunc i32 %18 to i8
  store i8 %19, ptr %5, align 1, !tbaa !9
  %20 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2IO12get_instanceEv()
  %21 = load i8, ptr %5, align 1, !tbaa !9
  call void @_ZN2IO4outbEjh(i32 noundef 161, i8 noundef zeroext %21)
  br label %34

22:                                               ; preds = %2
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2IO12get_instanceEv()
  %24 = call noundef zeroext i8 @_ZN2IO3inbEj(i32 noundef 33)
  %25 = zext i8 %24 to i32
  %26 = load i8, ptr %4, align 1, !tbaa !9
  %27 = zext i8 %26 to i32
  %28 = srem i32 %27, 8
  %29 = shl i32 1, %28
  %30 = or i32 %25, %29
  %31 = trunc i32 %30 to i8
  store i8 %31, ptr %5, align 1, !tbaa !9
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2IO12get_instanceEv()
  %33 = load i8, ptr %5, align 1, !tbaa !9
  call void @_ZN2IO4outbEjh(i32 noundef 33, i8 noundef zeroext %33)
  br label %34

34:                                               ; preds = %22, %10
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #3
  ret void
}

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress 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++ TBAA"}
!9 = !{!7, !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"

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZN2IO12get_instanceEv() local_unnamed_addr #0

declare void @_ZN2IO4outbEjh(i32 noundef, i8 noundef zeroext) local_unnamed_addr #0

declare noundef zeroext i8 @_ZN2IO3inbEj(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4INTR11disable_irqEh(ptr nocapture noundef nonnull readnone align 1 dereferenceable(1) %0, i8 noundef zeroext %1) local_unnamed_addr #1 align 2 {
  %3 = icmp ugt i8 %1, 39
  %4 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2IO12get_instanceEv()
  %5 = and i8 %1, 7
  %6 = shl nuw i8 1, %5
  %. = select i1 %3, i32 161, i32 33
  %7 = tail call noundef zeroext i8 @_ZN2IO3inbEj(i32 noundef %.)
  %8 = or i8 %7, %6
  %9 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN2IO12get_instanceEv()
  tail call void @_ZN2IO4outbEjh(i32 noundef %., i8 noundef zeroext %8)
  ret void
}

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 = { mustprogress 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)"}


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