; LLVM IR from intuitive-robots/mdt_policy :: pyhash-0.9.3/src/smhasher/main.ll (Z8SelfTestv)

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

%struct.HashInfo = type { ptr, i32, i32, ptr, ptr }

@g_hashes = external dso_local global [63 x %struct.HashInfo], align 16
@.str.133 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.134 = external hidden unnamed_addr constant [8 x i8], align 1

; 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: mustprogress uwtable
define dso_local void @_Z8SelfTestv() #1 {
  %1 = alloca i8, align 1
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %1) #4
  store i8 1, ptr %1, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  store i64 0, ptr %2, align 8, !tbaa !9
  br label %6

6:                                                ; preds = %30, %0
  %7 = load i64, ptr %2, align 8, !tbaa !9
  %8 = icmp ult i64 %7, 63
  br i1 %8, label %10, label %9

9:                                                ; preds = %6
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  br label %33

10:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %11 = load i64, ptr %2, align 8, !tbaa !9
  %12 = getelementptr inbounds [63 x %struct.HashInfo], ptr @g_hashes, i64 0, i64 %11
  store ptr %12, ptr %3, align 8, !tbaa !11
  %13 = load ptr, ptr %3, align 8, !tbaa !11
  %14 = getelementptr inbounds %struct.HashInfo, ptr %13, i32 0, i32 0
  %15 = load ptr, ptr %14, align 8, !tbaa !13
  %16 = load ptr, ptr %3, align 8, !tbaa !11
  %17 = getelementptr inbounds %struct.HashInfo, ptr %16, i32 0, i32 1
  %18 = load i32, ptr %17, align 8, !tbaa !16
  %19 = load ptr, ptr %3, align 8, !tbaa !11
  %20 = getelementptr inbounds %struct.HashInfo, ptr %19, i32 0, i32 2
  %21 = load i32, ptr %20, align 4, !tbaa !17
  %22 = call noundef zeroext i1 @_Z16VerificationTestPFvPKvijPvEijb(ptr noundef %15, i32 noundef %18, i32 noundef %21, i1 noundef zeroext false)
  %23 = zext i1 %22 to i32
  %24 = load i8, ptr %1, align 1, !tbaa !5, !range !18, !noundef !19
  %25 = trunc i8 %24 to i1
  %26 = zext i1 %25 to i32
  %27 = and i32 %26, %23
  %28 = icmp ne i32 %27, 0
  %29 = zext i1 %28 to i8
  store i8 %29, ptr %1, align 1, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  br label %30

30:                                               ; preds = %10
  %31 = load i64, ptr %2, align 8, !tbaa !9
  %32 = add i64 %31, 1
  store i64 %32, ptr %2, align 8, !tbaa !9
  br label %6, !llvm.loop !20

33:                                               ; preds = %9
  %34 = load i8, ptr %1, align 1, !tbaa !5, !range !18, !noundef !19
  %35 = trunc i8 %34 to i1
  br i1 %35, label %70, label %36

36:                                               ; preds = %33
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str.133)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store i64 0, ptr %4, align 8, !tbaa !9
  br label %38

38:                                               ; preds = %66, %36
  %39 = load i64, ptr %4, align 8, !tbaa !9
  %40 = icmp ult i64 %39, 63
  br i1 %40, label %42, label %41

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

42:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %43 = load i64, ptr %4, align 8, !tbaa !9
  %44 = getelementptr inbounds [63 x %struct.HashInfo], ptr @g_hashes, i64 0, i64 %43
  store ptr %44, ptr %5, align 8, !tbaa !11
  %45 = load ptr, ptr %5, align 8, !tbaa !11
  %46 = getelementptr inbounds %struct.HashInfo, ptr %45, i32 0, i32 3
  %47 = load ptr, ptr %46, align 8, !tbaa !22
  %48 = call i32 (ptr, ...) @printf(ptr noundef @.str.134, ptr noundef %47)
  %49 = load ptr, ptr %5, align 8, !tbaa !11
  %50 = getelementptr inbounds %struct.HashInfo, ptr %49, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !13
  %52 = load ptr, ptr %5, align 8, !tbaa !11
  %53 = getelementptr inbounds %struct.HashInfo, ptr %52, i32 0, i32 1
  %54 = load i32, ptr %53, align 8, !tbaa !16
  %55 = load ptr, ptr %5, align 8, !tbaa !11
  %56 = getelementptr inbounds %struct.HashInfo, ptr %55, i32 0, i32 2
  %57 = load i32, ptr %56, align 4, !tbaa !17
  %58 = call noundef zeroext i1 @_Z16VerificationTestPFvPKvijPvEijb(ptr noundef %51, i32 noundef %54, i32 noundef %57, i1 noundef zeroext true)
  %59 = zext i1 %58 to i32
  %60 = load i8, ptr %1, align 1, !tbaa !5, !range !18, !noundef !19
  %61 = trunc i8 %60 to i1
  %62 = zext i1 %61 to i32
  %63 = and i32 %62, %59
  %64 = icmp ne i32 %63, 0
  %65 = zext i1 %64 to i8
  store i8 %65, ptr %1, align 1, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %66

66:                                               ; preds = %42
  %67 = load i64, ptr %4, align 8, !tbaa !9
  %68 = add i64 %67, 1
  store i64 %68, ptr %4, align 8, !tbaa !9
  br label %38, !llvm.loop !23

69:                                               ; preds = %41
  call void @exit(i32 noundef 1) #5
  unreachable

70:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 1, ptr %1) #4
  ret void
}

declare noundef zeroext i1 @_Z16VerificationTestPFvPKvijPvEijb(ptr noundef, i32 noundef, i32 noundef, i1 noundef zeroext) #2

declare i32 @printf(ptr noundef, ...) #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #2 = { "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 = { noreturn nounwind "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 = { noreturn 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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"_ZTS8HashInfo", !12, i64 0, !15, i64 8, !15, i64 12, !12, i64 16, !12, i64 24}
!15 = !{!"int", !7, i64 0}
!16 = !{!14, !15, i64 8}
!17 = !{!14, !15, i64 12}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!14, !12, i64 16}
!23 = distinct !{!23, !21}


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

%struct.HashInfo = type { ptr, i32, i32, ptr, ptr }

@g_hashes = external dso_local local_unnamed_addr global [63 x %struct.HashInfo], align 16
@.str.133 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.134 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8SelfTestv() local_unnamed_addr #0 {
  br label %2

1:                                                ; preds = %2
  br i1 %10, label %27, label %12

2:                                                ; preds = %0, %2
  %.018 = phi i1 [ true, %0 ], [ %10, %2 ]
  %.01617 = phi i64 [ 0, %0 ], [ %11, %2 ]
  %3 = getelementptr inbounds [63 x %struct.HashInfo], ptr @g_hashes, i64 0, i64 %.01617
  %4 = load ptr, ptr %3, align 16, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %3, i64 8
  %6 = load i32, ptr %5, align 8, !tbaa !11
  %7 = getelementptr inbounds i8, ptr %3, i64 12
  %8 = load i32, ptr %7, align 4, !tbaa !12
  %9 = tail call noundef zeroext i1 @_Z16VerificationTestPFvPKvijPvEijb(ptr noundef %4, i32 noundef %6, i32 noundef %8, i1 noundef zeroext false)
  %10 = and i1 %.018, %9
  %11 = add nuw nsw i64 %.01617, 1
  %exitcond.not = icmp eq i64 %11, 63
  br i1 %exitcond.not, label %1, label %2, !llvm.loop !13

12:                                               ; preds = %1
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.133)
  br label %15

14:                                               ; preds = %15
  tail call void @exit(i32 noundef 1) #4
  unreachable

15:                                               ; preds = %12, %15
  %.01519 = phi i64 [ 0, %12 ], [ %26, %15 ]
  %16 = getelementptr inbounds [63 x %struct.HashInfo], ptr @g_hashes, i64 0, i64 %.01519
  %17 = getelementptr inbounds i8, ptr %16, i64 16
  %18 = load ptr, ptr %17, align 16, !tbaa !15
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.134, ptr noundef %18)
  %20 = load ptr, ptr %16, align 16, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %16, i64 8
  %22 = load i32, ptr %21, align 8, !tbaa !11
  %23 = getelementptr inbounds i8, ptr %16, i64 12
  %24 = load i32, ptr %23, align 4, !tbaa !12
  %25 = tail call noundef zeroext i1 @_Z16VerificationTestPFvPKvijPvEijb(ptr noundef %20, i32 noundef %22, i32 noundef %24, i1 noundef zeroext true)
  %26 = add nuw nsw i64 %.01519, 1
  %exitcond20.not = icmp eq i64 %26, 63
  br i1 %exitcond20.not, label %14, label %15, !llvm.loop !16

27:                                               ; preds = %1
  ret void
}

declare noundef zeroext i1 @_Z16VerificationTestPFvPKvijPvEijb(ptr noundef, i32 noundef, i32 noundef, i1 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3

attributes #0 = { 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 #1 = { "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 = { nofree nounwind "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 = { noreturn nounwind "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 = { noreturn 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, !7, i64 0}
!6 = !{!"_ZTS8HashInfo", !7, i64 0, !10, i64 8, !10, i64 12, !7, i64 16, !7, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!6, !10, i64 12}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!6, !7, i64 16}
!16 = distinct !{!16, !14}


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