; LLVM IR from tevador/RandomX :: src/jit_compiler_x86.ll (ZN7randomx14JitCompilerX868h_FADD_RERNS_11InstructionEi)

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

%"class.randomx::Instruction" = type { i8, i8, i8, i8, i32 }

@_ZN7randomxL9REX_ADDPDE = external hidden constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7randomx14JitCompilerX868emitByteEh(ptr noundef nonnull align 8 dereferenceable(68), i8 noundef zeroext) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7randomx14JitCompilerX864emitILm4EEEvRAT__Kh(ptr noundef nonnull align 8 dereferenceable(68), ptr noundef nonnull align 1 dereferenceable(4)) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7randomx14JitCompilerX868h_FADD_RERNS_11InstructionEi(ptr noundef nonnull align 8 dereferenceable(68) %0, ptr noundef nonnull align 4 dereferenceable(8) %1, i32 noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %7 = load ptr, ptr %4, align 8
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  %9 = getelementptr inbounds %"class.randomx::Instruction", ptr %8, i32 0, i32 1
  %10 = load i8, ptr %9, align 1, !tbaa !11
  %11 = zext i8 %10 to i32
  %12 = srem i32 %11, 4
  %13 = trunc i32 %12 to i8
  store i8 %13, ptr %9, align 1, !tbaa !11
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %"class.randomx::Instruction", ptr %14, i32 0, i32 2
  %16 = load i8, ptr %15, align 2, !tbaa !13
  %17 = zext i8 %16 to i32
  %18 = srem i32 %17, 4
  %19 = trunc i32 %18 to i8
  store i8 %19, ptr %15, align 2, !tbaa !13
  call void @_ZN7randomx14JitCompilerX864emitILm4EEEvRAT__Kh(ptr noundef nonnull align 8 dereferenceable(68) %7, ptr noundef nonnull align 1 dereferenceable(4) @_ZN7randomxL9REX_ADDPDE)
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %"class.randomx::Instruction", ptr %20, i32 0, i32 2
  %22 = load i8, ptr %21, align 2, !tbaa !13
  %23 = zext i8 %22 to i32
  %24 = add nsw i32 192, %23
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %"class.randomx::Instruction", ptr %25, i32 0, i32 1
  %27 = load i8, ptr %26, align 1, !tbaa !11
  %28 = zext i8 %27 to i32
  %29 = mul nsw i32 8, %28
  %30 = add nsw i32 %24, %29
  %31 = trunc i32 %30 to i8
  call void @_ZN7randomx14JitCompilerX868emitByteEh(ptr noundef nonnull align 8 dereferenceable(68) %7, i8 noundef zeroext %31)
  ret void
}

attributes #0 = { mustprogress 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 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !7, i64 1}
!12 = !{!"_ZTSN7randomx11InstructionE", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !10, i64 4}
!13 = !{!12, !7, i64 2}


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

@_ZN7randomxL9REX_ADDPDE = external hidden constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7randomx14JitCompilerX868emitByteEh(ptr noundef nonnull align 8 dereferenceable(68), i8 noundef zeroext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7randomx14JitCompilerX864emitILm4EEEvRAT__Kh(ptr noundef nonnull align 8 dereferenceable(68), ptr noundef nonnull align 1 dereferenceable(4)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7randomx14JitCompilerX868h_FADD_RERNS_11InstructionEi(ptr noundef nonnull align 8 dereferenceable(68) %0, ptr nocapture noundef nonnull align 4 dereferenceable(8) %1, i32 noundef %2) local_unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %1, i64 1
  %5 = load i8, ptr %4, align 1, !tbaa !5
  %6 = and i8 %5, 3
  store i8 %6, ptr %4, align 1, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %1, i64 2
  %8 = load i8, ptr %7, align 2, !tbaa !10
  %9 = and i8 %8, 3
  store i8 %9, ptr %7, align 2, !tbaa !10
  tail call void @_ZN7randomx14JitCompilerX864emitILm4EEEvRAT__Kh(ptr noundef nonnull align 8 dereferenceable(68) %0, ptr noundef nonnull align 1 dereferenceable(4) @_ZN7randomxL9REX_ADDPDE)
  %10 = load i8, ptr %7, align 2, !tbaa !10
  %11 = add i8 %10, -64
  %12 = load i8, ptr %4, align 1, !tbaa !5
  %13 = shl i8 %12, 3
  %14 = add i8 %11, %13
  tail call void @_ZN7randomx14JitCompilerX868emitByteEh(ptr noundef nonnull align 8 dereferenceable(68) %0, i8 noundef zeroext %14)
  ret void
}

attributes #0 = { mustprogress 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, !7, i64 1}
!6 = !{!"_ZTSN7randomx11InstructionE", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !9, i64 4}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!6, !7, i64 2}


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