; LLVM IR from HenryRLee/PokerHandEvaluator :: cpp/test/kev (fast_eval)

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

@__const.eval_6hand_fast.perm = external hidden unnamed_addr constant [6 x [5 x i32]], align 16

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

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

; Function Attrs: nounwind uwtable
declare dso_local signext i16 @eval_5hand_fast(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local signext i16 @eval_6hand_fast(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i16, align 2
  %5 = alloca [6 x [5 x i32]], align 16
  %6 = alloca [5 x i32], align 16
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %4) #3
  store i16 9999, ptr %4, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 120, ptr %5) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %5, ptr align 16 @__const.eval_6hand_fast.perm, i64 120, i1 false)
  store i32 0, ptr %3, align 4, !tbaa !11
  br label %9

9:                                                ; preds = %46, %1
  %10 = load i32, ptr %3, align 4, !tbaa !11
  %11 = icmp slt i32 %10, 6
  br i1 %11, label %12, label %49

12:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 20, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !11
  br label %13

13:                                               ; preds = %31, %12
  %14 = load i32, ptr %7, align 4, !tbaa !11
  %15 = icmp slt i32 %14, 5
  br i1 %15, label %16, label %34

16:                                               ; preds = %13
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = load i32, ptr %3, align 4, !tbaa !11
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [6 x [5 x i32]], ptr %5, i64 0, i64 %19
  %21 = load i32, ptr %7, align 4, !tbaa !11
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [5 x i32], ptr %20, i64 0, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !11
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds i32, ptr %17, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !11
  %28 = load i32, ptr %7, align 4, !tbaa !11
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 %29
  store i32 %27, ptr %30, align 4, !tbaa !11
  br label %31

31:                                               ; preds = %16
  %32 = load i32, ptr %7, align 4, !tbaa !11
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %7, align 4, !tbaa !11
  br label %13, !llvm.loop !13

34:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %35 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 0
  %36 = call signext i16 @eval_5hand_fast(ptr noundef %35)
  %37 = sext i16 %36 to i32
  store i32 %37, ptr %8, align 4, !tbaa !11
  %38 = load i32, ptr %8, align 4, !tbaa !11
  %39 = load i16, ptr %4, align 2, !tbaa !9
  %40 = sext i16 %39 to i32
  %41 = icmp slt i32 %38, %40
  br i1 %41, label %42, label %45

42:                                               ; preds = %34
  %43 = load i32, ptr %8, align 4, !tbaa !11
  %44 = trunc i32 %43 to i16
  store i16 %44, ptr %4, align 2, !tbaa !9
  br label %45

45:                                               ; preds = %42, %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 20, ptr %6) #3
  br label %46

46:                                               ; preds = %45
  %47 = load i32, ptr %3, align 4, !tbaa !11
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %3, align 4, !tbaa !11
  br label %9, !llvm.loop !15

49:                                               ; preds = %9
  %50 = load i16, ptr %4, align 2, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 120, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret i16 %50
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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

@__const.eval_6hand_fast.perm = external hidden unnamed_addr constant [6 x [5 x i32]], align 16

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

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

; Function Attrs: nounwind uwtable
declare dso_local signext i16 @eval_5hand_fast(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local signext i16 @eval_6hand_fast(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = alloca [5 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %2) #3
  %3 = load i32, ptr @__const.eval_6hand_fast.perm, align 16, !tbaa !5
  %4 = sext i32 %3 to i64
  %5 = getelementptr inbounds i32, ptr %0, i64 %4
  %6 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %6, ptr %2, align 16, !tbaa !5
  %7 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 4), align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds i32, ptr %0, i64 %8
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %2, i64 4
  store i32 %10, ptr %11, align 4, !tbaa !5
  %12 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 8), align 8, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds i32, ptr %0, i64 %13
  %15 = load i32, ptr %14, align 4, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %2, i64 8
  store i32 %15, ptr %16, align 8, !tbaa !5
  %17 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 12), align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds i32, ptr %0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %2, i64 12
  store i32 %20, ptr %21, align 4, !tbaa !5
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 16), align 16, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds i32, ptr %0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %2, i64 16
  store i32 %25, ptr %26, align 16, !tbaa !5
  %27 = call signext i16 @eval_5hand_fast(ptr noundef nonnull %2)
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %2) #3
  %28 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 20), align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds i32, ptr %0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !5
  store i32 %31, ptr %2, align 16, !tbaa !5
  %32 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 24), align 8, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds i32, ptr %0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  store i32 %35, ptr %11, align 4, !tbaa !5
  %36 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 28), align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds i32, ptr %0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  store i32 %39, ptr %16, align 8, !tbaa !5
  %40 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 32), align 16, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds i32, ptr %0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  store i32 %43, ptr %21, align 4, !tbaa !5
  %44 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 36), align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds i32, ptr %0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  store i32 %47, ptr %26, align 16, !tbaa !5
  %48 = call signext i16 @eval_5hand_fast(ptr noundef nonnull %2)
  %spec.select = call i16 @llvm.smin.i16(i16 %27, i16 %48)
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %2) #3
  %49 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 40), align 8, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i32, ptr %0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  store i32 %52, ptr %2, align 16, !tbaa !5
  %53 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 44), align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i32, ptr %0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  store i32 %56, ptr %11, align 4, !tbaa !5
  %57 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 48), align 16, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds i32, ptr %0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  store i32 %60, ptr %16, align 8, !tbaa !5
  %61 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 52), align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds i32, ptr %0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  store i32 %64, ptr %21, align 4, !tbaa !5
  %65 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 56), align 8, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds i32, ptr %0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  store i32 %68, ptr %26, align 16, !tbaa !5
  %69 = call signext i16 @eval_5hand_fast(ptr noundef nonnull %2)
  %spec.select.1 = call i16 @llvm.smin.i16(i16 %spec.select, i16 %69)
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %2) #3
  %70 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 60), align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds i32, ptr %0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  store i32 %73, ptr %2, align 16, !tbaa !5
  %74 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 64), align 16, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds i32, ptr %0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  store i32 %77, ptr %11, align 4, !tbaa !5
  %78 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 68), align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds i32, ptr %0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  store i32 %81, ptr %16, align 8, !tbaa !5
  %82 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 72), align 8, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds i32, ptr %0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  store i32 %85, ptr %21, align 4, !tbaa !5
  %86 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 76), align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds i32, ptr %0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  store i32 %89, ptr %26, align 16, !tbaa !5
  %90 = call signext i16 @eval_5hand_fast(ptr noundef nonnull %2)
  %spec.select.2 = call i16 @llvm.smin.i16(i16 %spec.select.1, i16 %90)
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %2) #3
  %91 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 80), align 16, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds i32, ptr %0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  store i32 %94, ptr %2, align 16, !tbaa !5
  %95 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 84), align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds i32, ptr %0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  store i32 %98, ptr %11, align 4, !tbaa !5
  %99 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 88), align 8, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds i32, ptr %0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  store i32 %102, ptr %16, align 8, !tbaa !5
  %103 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 92), align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds i32, ptr %0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  store i32 %106, ptr %21, align 4, !tbaa !5
  %107 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 96), align 16, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds i32, ptr %0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  store i32 %110, ptr %26, align 16, !tbaa !5
  %111 = call signext i16 @eval_5hand_fast(ptr noundef nonnull %2)
  %spec.select.3 = call i16 @llvm.smin.i16(i16 %spec.select.2, i16 %111)
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %2) #3
  %112 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 100), align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds i32, ptr %0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !5
  store i32 %115, ptr %2, align 16, !tbaa !5
  %116 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 104), align 8, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds i32, ptr %0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  store i32 %119, ptr %11, align 4, !tbaa !5
  %120 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 108), align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds i32, ptr %0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  store i32 %123, ptr %16, align 8, !tbaa !5
  %124 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 112), align 16, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds i32, ptr %0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !5
  store i32 %127, ptr %21, align 4, !tbaa !5
  %128 = load i32, ptr getelementptr inbounds (i8, ptr @__const.eval_6hand_fast.perm, i64 116), align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds i32, ptr %0, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !5
  store i32 %131, ptr %26, align 16, !tbaa !5
  %132 = call signext i16 @eval_5hand_fast(ptr noundef nonnull %2)
  %spec.select.4 = call i16 @llvm.smin.i16(i16 %spec.select.3, i16 %132)
  %spec.select.5 = call i16 @llvm.smin.i16(i16 %spec.select.4, i16 9999)
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %2) #3
  ret i16 %spec.select.5
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i16 @llvm.smin.i16(i16, i16) #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass