; LLVM IR from intuitive-robots/mdt_policy :: pyhash-0.9.3/src/t1ha/src (t1ha_selfcheck)

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

@t1ha_test_pattern = external hidden constant [64 x i8], align 16

; Function Attrs: cold nounwind optsize uwtable
define hidden i32 @t1ha_selfcheck(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca [512 x i8], align 16
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #3
  store i8 0, ptr %5, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store i64 0, ptr %6, align 8, !tbaa !11
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds i64, ptr %14, i32 1
  store ptr %15, ptr %4, align 8, !tbaa !5
  %16 = load i64, ptr %14, align 8, !tbaa !11
  %17 = call zeroext i1 @probe(ptr noundef %13, i64 noundef %16, ptr noundef null, i32 noundef 0, i64 noundef 0)
  %18 = zext i1 %17 to i32
  %19 = load i8, ptr %5, align 1, !tbaa !9, !range !13, !noundef !14
  %20 = trunc i8 %19 to i1
  %21 = zext i1 %20 to i32
  %22 = or i32 %21, %18
  %23 = icmp ne i32 %22, 0
  %24 = zext i1 %23 to i8
  store i8 %24, ptr %5, align 1, !tbaa !9
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds i64, ptr %26, i32 1
  store ptr %27, ptr %4, align 8, !tbaa !5
  %28 = load i64, ptr %26, align 8, !tbaa !11
  %29 = call zeroext i1 @probe(ptr noundef %25, i64 noundef %28, ptr noundef null, i32 noundef 0, i64 noundef -1)
  %30 = zext i1 %29 to i32
  %31 = load i8, ptr %5, align 1, !tbaa !9, !range !13, !noundef !14
  %32 = trunc i8 %31 to i1
  %33 = zext i1 %32 to i32
  %34 = or i32 %33, %30
  %35 = icmp ne i32 %34, 0
  %36 = zext i1 %35 to i8
  store i8 %36, ptr %5, align 1, !tbaa !9
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds i64, ptr %38, i32 1
  store ptr %39, ptr %4, align 8, !tbaa !5
  %40 = load i64, ptr %38, align 8, !tbaa !11
  %41 = call zeroext i1 @probe(ptr noundef %37, i64 noundef %40, ptr noundef @t1ha_test_pattern, i32 noundef 64, i64 noundef 0)
  %42 = zext i1 %41 to i32
  %43 = load i8, ptr %5, align 1, !tbaa !9, !range !13, !noundef !14
  %44 = trunc i8 %43 to i1
  %45 = zext i1 %44 to i32
  %46 = or i32 %45, %42
  %47 = icmp ne i32 %46, 0
  %48 = zext i1 %47 to i8
  store i8 %48, ptr %5, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store i64 1, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 1, ptr %8, align 4, !tbaa !15
  br label %49

49:                                               ; preds = %70, %2
  %50 = load i32, ptr %8, align 4, !tbaa !15
  %51 = icmp slt i32 %50, 64
  br i1 %51, label %53, label %52

52:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %73

53:                                               ; preds = %49
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds i64, ptr %55, i32 1
  store ptr %56, ptr %4, align 8, !tbaa !5
  %57 = load i64, ptr %55, align 8, !tbaa !11
  %58 = load i32, ptr %8, align 4, !tbaa !15
  %59 = load i64, ptr %7, align 8, !tbaa !11
  %60 = call zeroext i1 @probe(ptr noundef %54, i64 noundef %57, ptr noundef @t1ha_test_pattern, i32 noundef %58, i64 noundef %59)
  %61 = zext i1 %60 to i32
  %62 = load i8, ptr %5, align 1, !tbaa !9, !range !13, !noundef !14
  %63 = trunc i8 %62 to i1
  %64 = zext i1 %63 to i32
  %65 = or i32 %64, %61
  %66 = icmp ne i32 %65, 0
  %67 = zext i1 %66 to i8
  store i8 %67, ptr %5, align 1, !tbaa !9
  %68 = load i64, ptr %7, align 8, !tbaa !11
  %69 = shl i64 %68, 1
  store i64 %69, ptr %7, align 8, !tbaa !11
  br label %70

70:                                               ; preds = %53
  %71 = load i32, ptr %8, align 4, !tbaa !15
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %8, align 4, !tbaa !15
  br label %49, !llvm.loop !17

73:                                               ; preds = %52
  store i64 -1, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 1, ptr %9, align 4, !tbaa !15
  br label %74

74:                                               ; preds = %99, %73
  %75 = load i32, ptr %9, align 4, !tbaa !15
  %76 = icmp sle i32 %75, 7
  br i1 %76, label %78, label %77

77:                                               ; preds = %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %102

78:                                               ; preds = %74
  %79 = load i64, ptr %7, align 8, !tbaa !11
  %80 = shl i64 %79, 1
  store i64 %80, ptr %7, align 8, !tbaa !11
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds i64, ptr %82, i32 1
  store ptr %83, ptr %4, align 8, !tbaa !5
  %84 = load i64, ptr %82, align 8, !tbaa !11
  %85 = load i32, ptr %9, align 4, !tbaa !15
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds i8, ptr @t1ha_test_pattern, i64 %86
  %88 = load i32, ptr %9, align 4, !tbaa !15
  %89 = sub nsw i32 64, %88
  %90 = load i64, ptr %7, align 8, !tbaa !11
  %91 = call zeroext i1 @probe(ptr noundef %81, i64 noundef %84, ptr noundef %87, i32 noundef %89, i64 noundef %90)
  %92 = zext i1 %91 to i32
  %93 = load i8, ptr %5, align 1, !tbaa !9, !range !13, !noundef !14
  %94 = trunc i8 %93 to i1
  %95 = zext i1 %94 to i32
  %96 = or i32 %95, %92
  %97 = icmp ne i32 %96, 0
  %98 = zext i1 %97 to i8
  store i8 %98, ptr %5, align 1, !tbaa !9
  br label %99

99:                                               ; preds = %78
  %100 = load i32, ptr %9, align 4, !tbaa !15
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %9, align 4, !tbaa !15
  br label %74, !llvm.loop !19

102:                                              ; preds = %77
  call void @llvm.lifetime.start.p0(i64 512, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store i64 0, ptr %11, align 8, !tbaa !11
  br label %103

103:                                              ; preds = %112, %102
  %104 = load i64, ptr %11, align 8, !tbaa !11
  %105 = icmp ult i64 %104, 512
  br i1 %105, label %107, label %106

106:                                              ; preds = %103
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br label %115

107:                                              ; preds = %103
  %108 = load i64, ptr %11, align 8, !tbaa !11
  %109 = trunc i64 %108 to i8
  %110 = load i64, ptr %11, align 8, !tbaa !11
  %111 = getelementptr inbounds [512 x i8], ptr %10, i64 0, i64 %110
  store i8 %109, ptr %111, align 1, !tbaa !20
  br label %112

112:                                              ; preds = %107
  %113 = load i64, ptr %11, align 8, !tbaa !11
  %114 = add i64 %113, 1
  store i64 %114, ptr %11, align 8, !tbaa !11
  br label %103, !llvm.loop !21

115:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 0, ptr %12, align 4, !tbaa !15
  br label %116

116:                                              ; preds = %141, %115
  %117 = load i32, ptr %12, align 4, !tbaa !15
  %118 = icmp sle i32 %117, 7
  br i1 %118, label %120, label %119

119:                                              ; preds = %116
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  br label %144

120:                                              ; preds = %116
  %121 = load ptr, ptr %3, align 8, !tbaa !5
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds i64, ptr %122, i32 1
  store ptr %123, ptr %4, align 8, !tbaa !5
  %124 = load i64, ptr %122, align 8, !tbaa !11
  %125 = getelementptr inbounds [512 x i8], ptr %10, i64 0, i64 0
  %126 = load i32, ptr %12, align 4, !tbaa !15
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds i8, ptr %125, i64 %127
  %129 = load i32, ptr %12, align 4, !tbaa !15
  %130 = mul nsw i32 %129, 17
  %131 = add nsw i32 128, %130
  %132 = load i64, ptr %7, align 8, !tbaa !11
  %133 = call zeroext i1 @probe(ptr noundef %121, i64 noundef %124, ptr noundef %128, i32 noundef %131, i64 noundef %132)
  %134 = zext i1 %133 to i32
  %135 = load i8, ptr %5, align 1, !tbaa !9, !range !13, !noundef !14
  %136 = trunc i8 %135 to i1
  %137 = zext i1 %136 to i32
  %138 = or i32 %137, %134
  %139 = icmp ne i32 %138, 0
  %140 = zext i1 %139 to i8
  store i8 %140, ptr %5, align 1, !tbaa !9
  br label %141

141:                                              ; preds = %120
  %142 = load i32, ptr %12, align 4, !tbaa !15
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %12, align 4, !tbaa !15
  br label %116, !llvm.loop !22

144:                                              ; preds = %119
  %145 = load i8, ptr %5, align 1, !tbaa !9, !range !13, !noundef !14
  %146 = trunc i8 %145 to i1
  %147 = zext i1 %146 to i64
  %148 = select i1 %146, i32 -1, i32 0
  call void @llvm.lifetime.end.p0(i64 512, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #3
  ret i32 %148
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @probe(ptr noundef, i64 noundef, ptr noundef, i32 noundef, i64 noundef) #2

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

attributes #0 = { cold nounwind optsize 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #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 = !{!"_Bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !16, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !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"

@t1ha_test_pattern = external hidden constant [64 x i8], align 16

; Function Attrs: cold nounwind optsize uwtable
define hidden range(i32 -1, 1) i32 @t1ha_selfcheck(ptr noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca [512 x i8], align 16
  %4 = getelementptr inbounds i8, ptr %1, i64 8
  %5 = load i64, ptr %1, align 8, !tbaa !5
  %6 = tail call zeroext i1 @probe(ptr noundef %0, i64 noundef %5, ptr noundef null, i32 noundef 0, i64 noundef 0)
  %7 = getelementptr inbounds i8, ptr %1, i64 16
  %8 = load i64, ptr %4, align 8, !tbaa !5
  %9 = tail call zeroext i1 @probe(ptr noundef %0, i64 noundef %8, ptr noundef null, i32 noundef 0, i64 noundef -1)
  %10 = or i1 %6, %9
  %11 = getelementptr inbounds i8, ptr %1, i64 24
  %12 = load i64, ptr %7, align 8, !tbaa !5
  %13 = tail call zeroext i1 @probe(ptr noundef %0, i64 noundef %12, ptr noundef nonnull @t1ha_test_pattern, i32 noundef 64, i64 noundef 0)
  %14 = or i1 %10, %13
  br label %15

15:                                               ; preds = %2, %15
  %.04051 = phi i32 [ 1, %2 ], [ %21, %15 ]
  %.04150 = phi i64 [ 1, %2 ], [ %20, %15 ]
  %.04249 = phi ptr [ %11, %2 ], [ %16, %15 ]
  %.044.in48 = phi i1 [ %14, %2 ], [ %19, %15 ]
  %16 = getelementptr inbounds i8, ptr %.04249, i64 8
  %17 = load i64, ptr %.04249, align 8, !tbaa !5
  %18 = tail call zeroext i1 @probe(ptr noundef %0, i64 noundef %17, ptr noundef nonnull @t1ha_test_pattern, i32 noundef %.04051, i64 noundef %.04150)
  %19 = or i1 %.044.in48, %18
  %20 = shl i64 %.04150, 1
  %21 = add nuw nsw i32 %.04051, 1
  %exitcond.not = icmp eq i32 %21, 64
  br i1 %exitcond.not, label %.preheader47, label %15, !llvm.loop !9

vector.ph:                                        ; preds = %.preheader47
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %3) #3
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <16 x i8> [ <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %22 = getelementptr inbounds [512 x i8], ptr %3, i64 0, i64 %index
  store <16 x i8> %vec.ind, ptr %22, align 16, !tbaa !11
  %index.next = add nuw i64 %index, 16
  %vec.ind.next = add <16 x i8> %vec.ind, <i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16>
  %23 = icmp eq i64 %index.next, 512
  br i1 %23, label %.preheader, label %vector.body, !llvm.loop !12

.preheader47:                                     ; preds = %15, %.preheader47
  %indvars.iv = phi i64 [ %indvars.iv.next, %.preheader47 ], [ 1, %15 ]
  %.154 = phi i64 [ %24, %.preheader47 ], [ -1, %15 ]
  %.14353 = phi ptr [ %25, %.preheader47 ], [ %16, %15 ]
  %.14552 = phi i1 [ %31, %.preheader47 ], [ %19, %15 ]
  %24 = shl i64 %.154, 1
  %25 = getelementptr inbounds i8, ptr %.14353, i64 8
  %26 = load i64, ptr %.14353, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr @t1ha_test_pattern, i64 %indvars.iv
  %28 = trunc i64 %indvars.iv to i32
  %29 = sub i32 64, %28
  %30 = tail call zeroext i1 @probe(ptr noundef %0, i64 noundef %26, ptr noundef nonnull %27, i32 noundef %29, i64 noundef %24)
  %31 = or i1 %.14552, %30
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond65.not = icmp eq i64 %indvars.iv.next, 8
  br i1 %exitcond65.not, label %vector.ph, label %.preheader47, !llvm.loop !15

32:                                               ; preds = %.preheader
  %33 = sext i1 %41 to i32
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %3) #3
  ret i32 %33

.preheader:                                       ; preds = %vector.body, %.preheader
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %.preheader ], [ 0, %vector.body ]
  %.258 = phi ptr [ %34, %.preheader ], [ %25, %vector.body ]
  %.24657 = phi i1 [ %41, %.preheader ], [ %31, %vector.body ]
  %34 = getelementptr inbounds i8, ptr %.258, i64 8
  %35 = load i64, ptr %.258, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %3, i64 %indvars.iv67
  %37 = trunc i64 %indvars.iv67 to i32
  %38 = mul i32 %37, 17
  %39 = add i32 %38, 128
  %40 = call zeroext i1 @probe(ptr noundef %0, i64 noundef %35, ptr noundef nonnull %36, i32 noundef %39, i64 noundef -128)
  %41 = or i1 %.24657, %40
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %exitcond69.not = icmp eq i64 %indvars.iv.next68, 8
  br i1 %exitcond69.not, label %32, label %.preheader, !llvm.loop !16
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @probe(ptr noundef, i64 noundef, ptr noundef, i32 noundef, i64 noundef) local_unnamed_addr #2

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

attributes #0 = { cold nounwind optsize 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass