; LLVM IR from BitFunnel/NativeJIT :: test/CodeGen/ML64Verifier.ll (ZN9NativeJIT12ML64Verifier13ReadHexNumberERmRj)

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @isxdigit(i32 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432)) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN9NativeJIT12ML64Verifier13ReadHexNumberERmRj(ptr noundef nonnull align 8 dereferenceable(432) %0, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(4) %2) #3 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #4
  store i8 0, ptr %7, align 1, !tbaa !9
  %11 = call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %10)
  %12 = sext i8 %11 to i32
  %13 = call i32 @isxdigit(i32 noundef %12) #5
  %14 = icmp ne i32 %13, 0
  br i1 %14, label %15, label %48

15:                                               ; preds = %3
  store i8 1, ptr %7, align 1, !tbaa !9
  %16 = call noundef i32 @_ZN9NativeJIT12ML64Verifier11ReadHexByteEv(ptr noundef nonnull align 8 dereferenceable(432) %10)
  %17 = zext i32 %16 to i64
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %17, ptr %18, align 8, !tbaa !11
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 1, ptr %19, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !13
  br label %20

20:                                               ; preds = %43, %15
  %21 = load i32, ptr %8, align 4, !tbaa !13
  %22 = icmp ult i32 %21, 7
  br i1 %22, label %24, label %23

23:                                               ; preds = %20
  store i32 2, ptr %9, align 4
  br label %46

24:                                               ; preds = %20
  %25 = call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %10)
  %26 = sext i8 %25 to i32
  %27 = call i32 @isxdigit(i32 noundef %26) #5
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %41

29:                                               ; preds = %24
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = load i64, ptr %30, align 8, !tbaa !11
  %32 = shl i64 %31, 8
  store i64 %32, ptr %30, align 8, !tbaa !11
  %33 = call noundef i32 @_ZN9NativeJIT12ML64Verifier11ReadHexByteEv(ptr noundef nonnull align 8 dereferenceable(432) %10)
  %34 = zext i32 %33 to i64
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = load i64, ptr %35, align 8, !tbaa !11
  %37 = or i64 %36, %34
  store i64 %37, ptr %35, align 8, !tbaa !11
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = load i32, ptr %38, align 4, !tbaa !13
  %40 = add i32 %39, 1
  store i32 %40, ptr %38, align 4, !tbaa !13
  br label %42

41:                                               ; preds = %24
  store i32 2, ptr %9, align 4
  br label %46

42:                                               ; preds = %29
  br label %43

43:                                               ; preds = %42
  %44 = load i32, ptr %8, align 4, !tbaa !13
  %45 = add i32 %44, 1
  store i32 %45, ptr %8, align 4, !tbaa !13
  br label %20, !llvm.loop !15

46:                                               ; preds = %41, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47, %3
  %49 = load i8, ptr %7, align 1, !tbaa !9, !range !17, !noundef !18
  %50 = trunc i8 %49 to i1
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #4
  ret i1 %50
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN9NativeJIT12ML64Verifier11ReadHexByteEv(ptr noundef nonnull align 8 dereferenceable(432)) #3 align 2

attributes #0 = { nounwind willreturn memory(read) "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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }

!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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{i8 0, i8 2}
!18 = !{}


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

; Function Attrs: mustprogress nofree nounwind willreturn memory(read)
declare i32 @isxdigit(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN9NativeJIT12ML64Verifier13ReadHexNumberERmRj(ptr noundef nonnull align 8 dereferenceable(432) %0, ptr nocapture noundef nonnull align 8 dereferenceable(8) %1, ptr nocapture noundef nonnull align 4 dereferenceable(4) %2) local_unnamed_addr #2 align 2 {
  %4 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %5 = sext i8 %4 to i32
  %6 = tail call i32 @isxdigit(i32 noundef %5) #3
  %.not = icmp ne i32 %6, 0
  br i1 %.not, label %7, label %.loopexit

7:                                                ; preds = %3
  %8 = tail call noundef i32 @_ZN9NativeJIT12ML64Verifier11ReadHexByteEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %9 = zext i32 %8 to i64
  store i64 %9, ptr %1, align 8, !tbaa !5
  store i32 1, ptr %2, align 4, !tbaa !9
  %10 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %11 = sext i8 %10 to i32
  %12 = tail call i32 @isxdigit(i32 noundef %11) #3
  %.not9 = icmp eq i32 %12, 0
  br i1 %.not9, label %.loopexit, label %13

13:                                               ; preds = %7
  %14 = load i64, ptr %1, align 8, !tbaa !5
  %15 = shl i64 %14, 8
  store i64 %15, ptr %1, align 8, !tbaa !5
  %16 = tail call noundef i32 @_ZN9NativeJIT12ML64Verifier11ReadHexByteEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %17 = zext i32 %16 to i64
  %18 = load i64, ptr %1, align 8, !tbaa !5
  %19 = or i64 %18, %17
  store i64 %19, ptr %1, align 8, !tbaa !5
  %20 = load i32, ptr %2, align 4, !tbaa !9
  %21 = add i32 %20, 1
  store i32 %21, ptr %2, align 4, !tbaa !9
  %22 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %23 = sext i8 %22 to i32
  %24 = tail call i32 @isxdigit(i32 noundef %23) #3
  %.not9.1 = icmp eq i32 %24, 0
  br i1 %.not9.1, label %.loopexit, label %25

25:                                               ; preds = %13
  %26 = load i64, ptr %1, align 8, !tbaa !5
  %27 = shl i64 %26, 8
  store i64 %27, ptr %1, align 8, !tbaa !5
  %28 = tail call noundef i32 @_ZN9NativeJIT12ML64Verifier11ReadHexByteEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %29 = zext i32 %28 to i64
  %30 = load i64, ptr %1, align 8, !tbaa !5
  %31 = or i64 %30, %29
  store i64 %31, ptr %1, align 8, !tbaa !5
  %32 = load i32, ptr %2, align 4, !tbaa !9
  %33 = add i32 %32, 1
  store i32 %33, ptr %2, align 4, !tbaa !9
  %34 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %35 = sext i8 %34 to i32
  %36 = tail call i32 @isxdigit(i32 noundef %35) #3
  %.not9.2 = icmp eq i32 %36, 0
  br i1 %.not9.2, label %.loopexit, label %37

37:                                               ; preds = %25
  %38 = load i64, ptr %1, align 8, !tbaa !5
  %39 = shl i64 %38, 8
  store i64 %39, ptr %1, align 8, !tbaa !5
  %40 = tail call noundef i32 @_ZN9NativeJIT12ML64Verifier11ReadHexByteEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %41 = zext i32 %40 to i64
  %42 = load i64, ptr %1, align 8, !tbaa !5
  %43 = or i64 %42, %41
  store i64 %43, ptr %1, align 8, !tbaa !5
  %44 = load i32, ptr %2, align 4, !tbaa !9
  %45 = add i32 %44, 1
  store i32 %45, ptr %2, align 4, !tbaa !9
  %46 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %47 = sext i8 %46 to i32
  %48 = tail call i32 @isxdigit(i32 noundef %47) #3
  %.not9.3 = icmp eq i32 %48, 0
  br i1 %.not9.3, label %.loopexit, label %49

49:                                               ; preds = %37
  %50 = load i64, ptr %1, align 8, !tbaa !5
  %51 = shl i64 %50, 8
  store i64 %51, ptr %1, align 8, !tbaa !5
  %52 = tail call noundef i32 @_ZN9NativeJIT12ML64Verifier11ReadHexByteEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %53 = zext i32 %52 to i64
  %54 = load i64, ptr %1, align 8, !tbaa !5
  %55 = or i64 %54, %53
  store i64 %55, ptr %1, align 8, !tbaa !5
  %56 = load i32, ptr %2, align 4, !tbaa !9
  %57 = add i32 %56, 1
  store i32 %57, ptr %2, align 4, !tbaa !9
  %58 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %59 = sext i8 %58 to i32
  %60 = tail call i32 @isxdigit(i32 noundef %59) #3
  %.not9.4 = icmp eq i32 %60, 0
  br i1 %.not9.4, label %.loopexit, label %61

61:                                               ; preds = %49
  %62 = load i64, ptr %1, align 8, !tbaa !5
  %63 = shl i64 %62, 8
  store i64 %63, ptr %1, align 8, !tbaa !5
  %64 = tail call noundef i32 @_ZN9NativeJIT12ML64Verifier11ReadHexByteEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %65 = zext i32 %64 to i64
  %66 = load i64, ptr %1, align 8, !tbaa !5
  %67 = or i64 %66, %65
  store i64 %67, ptr %1, align 8, !tbaa !5
  %68 = load i32, ptr %2, align 4, !tbaa !9
  %69 = add i32 %68, 1
  store i32 %69, ptr %2, align 4, !tbaa !9
  %70 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %71 = sext i8 %70 to i32
  %72 = tail call i32 @isxdigit(i32 noundef %71) #3
  %.not9.5 = icmp eq i32 %72, 0
  br i1 %.not9.5, label %.loopexit, label %73

73:                                               ; preds = %61
  %74 = load i64, ptr %1, align 8, !tbaa !5
  %75 = shl i64 %74, 8
  store i64 %75, ptr %1, align 8, !tbaa !5
  %76 = tail call noundef i32 @_ZN9NativeJIT12ML64Verifier11ReadHexByteEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %77 = zext i32 %76 to i64
  %78 = load i64, ptr %1, align 8, !tbaa !5
  %79 = or i64 %78, %77
  store i64 %79, ptr %1, align 8, !tbaa !5
  %80 = load i32, ptr %2, align 4, !tbaa !9
  %81 = add i32 %80, 1
  store i32 %81, ptr %2, align 4, !tbaa !9
  %82 = tail call noundef signext i8 @_ZN9NativeJIT12ML64Verifier8PeekCharEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %83 = sext i8 %82 to i32
  %84 = tail call i32 @isxdigit(i32 noundef %83) #3
  %.not9.6 = icmp eq i32 %84, 0
  br i1 %.not9.6, label %.loopexit, label %85

85:                                               ; preds = %73
  %86 = load i64, ptr %1, align 8, !tbaa !5
  %87 = shl i64 %86, 8
  store i64 %87, ptr %1, align 8, !tbaa !5
  %88 = tail call noundef i32 @_ZN9NativeJIT12ML64Verifier11ReadHexByteEv(ptr noundef nonnull align 8 dereferenceable(432) %0)
  %89 = zext i32 %88 to i64
  %90 = load i64, ptr %1, align 8, !tbaa !5
  %91 = or i64 %90, %89
  store i64 %91, ptr %1, align 8, !tbaa !5
  %92 = load i32, ptr %2, align 4, !tbaa !9
  %93 = add i32 %92, 1
  store i32 %93, ptr %2, align 4, !tbaa !9
  br label %.loopexit

.loopexit:                                        ; preds = %7, %13, %25, %37, %49, %61, %73, %85, %3
  ret i1 %.not
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN9NativeJIT12ML64Verifier11ReadHexByteEv(ptr noundef nonnull align 8 dereferenceable(432)) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress nofree nounwind willreturn memory(read) "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 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 = { 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 willreturn memory(read) }

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


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass