; LLVM IR from albertobsd/keyhunt :: keyhunt.ll (Z16processOneVanityv)

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

@vanity_rmd_targets = external dso_local global i32, align 4
@vanity_rmd_total = external dso_local global i32, align 4
@vanity_rmd_limits = external dso_local global ptr, align 8
@vanity_rmd_limit_values_A = external dso_local global ptr, align 8
@vanity_rmd_minimun_bytes_check_length = external dso_local global i32, align 4
@vanity_bloom = external dso_local global ptr, align 8
@stderr = external global ptr, align 8
@.str.289 = external hidden unnamed_addr constant [37 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: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

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

declare i32 @bloom_add(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z16processOneVanityv() #3 {
  %1 = alloca i1, align 1
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %5 = load i32, ptr @vanity_rmd_targets, align 4, !tbaa !5
  %6 = icmp eq i32 %5, 0
  br i1 %6, label %7, label %10

7:                                                ; preds = %0
  %8 = load ptr, ptr @stderr, align 8, !tbaa !9
  %9 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %8, ptr noundef @.str.289) #4
  store i1 false, ptr %1, align 1
  store i32 1, ptr %4, align 4
  br label %51

10:                                               ; preds = %0
  %11 = load ptr, ptr @vanity_bloom, align 8, !tbaa !9
  %12 = load i32, ptr @vanity_rmd_total, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = call noundef zeroext i1 @_Z15initBloomFilterP5bloomm(ptr noundef %11, i64 noundef %13)
  br i1 %14, label %16, label %15

15:                                               ; preds = %10
  store i1 false, ptr %1, align 1
  store i32 1, ptr %4, align 4
  br label %51

16:                                               ; preds = %10
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %47, %16
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = load i32, ptr @vanity_rmd_targets, align 4, !tbaa !5
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %21, label %50

21:                                               ; preds = %17
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %43, %21
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = load ptr, ptr @vanity_rmd_limits, align 8, !tbaa !9
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds i32, ptr %24, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = icmp slt i32 %23, %28
  br i1 %29, label %30, label %46

30:                                               ; preds = %22
  %31 = load ptr, ptr @vanity_bloom, align 8, !tbaa !9
  %32 = load ptr, ptr @vanity_rmd_limit_values_A, align 8, !tbaa !9
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds ptr, ptr %32, i64 %34
  %36 = load ptr, ptr %35, align 8, !tbaa !9
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds ptr, ptr %36, i64 %38
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  %41 = load i32, ptr @vanity_rmd_minimun_bytes_check_length, align 4, !tbaa !5
  %42 = call i32 @bloom_add(ptr noundef %31, ptr noundef %40, i32 noundef %41)
  br label %43

43:                                               ; preds = %30
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %3, align 4, !tbaa !5
  br label %22, !llvm.loop !11

46:                                               ; preds = %22
  br label %47

47:                                               ; preds = %46
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !13

50:                                               ; preds = %17
  store i1 true, ptr %1, align 1
  store i32 1, ptr %4, align 4
  br label %51

51:                                               ; preds = %50, %15, %7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  %52 = load i1, ptr %1, align 1
  ret i1 %52
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z15initBloomFilterP5bloomm(ptr noundef, i64 noundef) #3

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

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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

@vanity_rmd_targets = external dso_local local_unnamed_addr global i32, align 4
@vanity_rmd_total = external dso_local local_unnamed_addr global i32, align 4
@vanity_rmd_limits = external dso_local local_unnamed_addr global ptr, align 8
@vanity_rmd_limit_values_A = external dso_local local_unnamed_addr global ptr, align 8
@vanity_rmd_minimun_bytes_check_length = external dso_local local_unnamed_addr global i32, align 4
@vanity_bloom = external dso_local local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.289 = external hidden unnamed_addr constant [37 x i8], align 1

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

declare i32 @bloom_add(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z16processOneVanityv() local_unnamed_addr #2 {
  %1 = load i32, ptr @vanity_rmd_targets, align 4, !tbaa !5
  %2 = icmp eq i32 %1, 0
  br i1 %2, label %3, label %6

3:                                                ; preds = %0
  %4 = load ptr, ptr @stderr, align 8, !tbaa !9
  %5 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %4, ptr noundef nonnull @.str.289) #3
  br label %.loopexit

6:                                                ; preds = %0
  %7 = load ptr, ptr @vanity_bloom, align 8, !tbaa !9
  %8 = load i32, ptr @vanity_rmd_total, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %10 = tail call noundef zeroext i1 @_Z15initBloomFilterP5bloomm(ptr noundef %7, i64 noundef %9)
  br i1 %10, label %.preheader9, label %.loopexit

.preheader9:                                      ; preds = %6
  %11 = load i32, ptr @vanity_rmd_targets, align 4, !tbaa !5
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.preheader.preheader, label %.loopexit

.preheader.preheader:                             ; preds = %.preheader9
  %.pre = load ptr, ptr @vanity_rmd_limits, align 8, !tbaa !9
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge
  %13 = phi i32 [ %11, %.preheader.preheader ], [ %31, %._crit_edge ]
  %14 = phi ptr [ %.pre, %.preheader.preheader ], [ %32, %._crit_edge ]
  %indvars.iv13 = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next14, %._crit_edge ]
  %15 = getelementptr inbounds i32, ptr %14, i64 %indvars.iv13
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader ]
  %18 = load ptr, ptr @vanity_bloom, align 8, !tbaa !9
  %19 = load ptr, ptr @vanity_rmd_limit_values_A, align 8, !tbaa !9
  %20 = getelementptr inbounds ptr, ptr %19, i64 %indvars.iv13
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %22 = getelementptr inbounds ptr, ptr %21, i64 %indvars.iv
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  %24 = load i32, ptr @vanity_rmd_minimun_bytes_check_length, align 4, !tbaa !5
  %25 = tail call i32 @bloom_add(ptr noundef %18, ptr noundef %23, i32 noundef %24)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %26 = load ptr, ptr @vanity_rmd_limits, align 8, !tbaa !9
  %27 = getelementptr inbounds i32, ptr %26, i64 %indvars.iv13
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = icmp slt i64 %indvars.iv.next, %29
  br i1 %30, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !11

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre16 = load i32, ptr @vanity_rmd_targets, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %31 = phi i32 [ %.pre16, %._crit_edge.loopexit ], [ %13, %.preheader ]
  %32 = phi ptr [ %26, %._crit_edge.loopexit ], [ %14, %.preheader ]
  %indvars.iv.next14 = add nuw nsw i64 %indvars.iv13, 1
  %33 = sext i32 %31 to i64
  %34 = icmp slt i64 %indvars.iv.next14, %33
  br i1 %34, label %.preheader, label %.loopexit, !llvm.loop !13

.loopexit:                                        ; preds = %._crit_edge, %.preheader9, %6, %3
  %.08 = phi i1 [ false, %3 ], [ false, %6 ], [ true, %.preheader9 ], [ true, %._crit_edge ]
  ret i1 %.08
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z15initBloomFilterP5bloomm(ptr noundef, i64 noundef) local_unnamed_addr #2

attributes #0 = { 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 #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 = { 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 = { cold 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass