; LLVM IR from tolgaatam/react-native-hashcash :: cpp/react-native-hashcash.ll (ZN8hashcash6SHA2567getHashEPh)

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

%"class.hashcash::SHA256" = type { i64, i64, [64 x i8], [8 x i32] }

; 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
declare dso_local void @_ZN8hashcash6SHA25613processBufferEv(ptr noundef nonnull align 8 dereferenceable(112)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8hashcash6SHA2567getHashEPh(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [8 x i32], align 16
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %10

10:                                               ; preds = %23, %2
  %11 = load i32, ptr %6, align 4, !tbaa !9
  %12 = icmp slt i32 %11, 8
  br i1 %12, label %14, label %13

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

14:                                               ; preds = %10
  %15 = getelementptr inbounds %"class.hashcash::SHA256", ptr %9, i32 0, i32 3
  %16 = load i32, ptr %6, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [8 x i32], ptr %15, i64 0, i64 %17
  %19 = load i32, ptr %18, align 4, !tbaa !9
  %20 = load i32, ptr %6, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 %21
  store i32 %19, ptr %22, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %14
  %24 = load i32, ptr %6, align 4, !tbaa !9
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %6, align 4, !tbaa !9
  br label %10, !llvm.loop !11

26:                                               ; preds = %13
  call void @_ZN8hashcash6SHA25613processBufferEv(ptr noundef nonnull align 8 dereferenceable(112) %9)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %27, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #2
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %80, %26
  %29 = load i32, ptr %8, align 4, !tbaa !9
  %30 = icmp slt i32 %29, 8
  br i1 %30, label %32, label %31

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

32:                                               ; preds = %28
  %33 = getelementptr inbounds %"class.hashcash::SHA256", ptr %9, i32 0, i32 3
  %34 = load i32, ptr %8, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [8 x i32], ptr %33, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !9
  %38 = lshr i32 %37, 24
  %39 = and i32 %38, 255
  %40 = trunc i32 %39 to i8
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %41, i32 1
  store ptr %42, ptr %7, align 8, !tbaa !5
  store i8 %40, ptr %41, align 1, !tbaa !13
  %43 = getelementptr inbounds %"class.hashcash::SHA256", ptr %9, i32 0, i32 3
  %44 = load i32, ptr %8, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [8 x i32], ptr %43, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = lshr i32 %47, 16
  %49 = and i32 %48, 255
  %50 = trunc i32 %49 to i8
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %51, i32 1
  store ptr %52, ptr %7, align 8, !tbaa !5
  store i8 %50, ptr %51, align 1, !tbaa !13
  %53 = getelementptr inbounds %"class.hashcash::SHA256", ptr %9, i32 0, i32 3
  %54 = load i32, ptr %8, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [8 x i32], ptr %53, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !9
  %58 = lshr i32 %57, 8
  %59 = and i32 %58, 255
  %60 = trunc i32 %59 to i8
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %61, i32 1
  store ptr %62, ptr %7, align 8, !tbaa !5
  store i8 %60, ptr %61, align 1, !tbaa !13
  %63 = getelementptr inbounds %"class.hashcash::SHA256", ptr %9, i32 0, i32 3
  %64 = load i32, ptr %8, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [8 x i32], ptr %63, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !9
  %68 = and i32 %67, 255
  %69 = trunc i32 %68 to i8
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = getelementptr inbounds i8, ptr %70, i32 1
  store ptr %71, ptr %7, align 8, !tbaa !5
  store i8 %69, ptr %70, align 1, !tbaa !13
  %72 = load i32, ptr %8, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [8 x i32], ptr %5, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !9
  %76 = getelementptr inbounds %"class.hashcash::SHA256", ptr %9, i32 0, i32 3
  %77 = load i32, ptr %8, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [8 x i32], ptr %76, i64 0, i64 %78
  store i32 %75, ptr %79, align 4, !tbaa !9
  br label %80

80:                                               ; preds = %32
  %81 = load i32, ptr %8, align 4, !tbaa !9
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %8, align 4, !tbaa !9
  br label %28, !llvm.loop !14

83:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #2
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8hashcash6SHA25613processBufferEv(ptr noundef nonnull align 8 dereferenceable(112)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8hashcash6SHA2567getHashEPh(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 80
  %.sroa.0.0.copyload = load i32, ptr %3, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 84
  %.sroa.4.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 88
  %.sroa.5.0.copyload = load i32, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !5
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 92
  %.sroa.6.0.copyload = load i32, ptr %.sroa.6.0..sroa_idx, align 4, !tbaa !5
  %.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 96
  %.sroa.7.0.copyload = load i32, ptr %.sroa.7.0..sroa_idx, align 8, !tbaa !5
  %.sroa.8.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 100
  %.sroa.8.0.copyload = load i32, ptr %.sroa.8.0..sroa_idx, align 4, !tbaa !5
  %.sroa.9.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 104
  %.sroa.9.0.copyload = load i32, ptr %.sroa.9.0..sroa_idx, align 8, !tbaa !5
  %.sroa.10.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 108
  %.sroa.10.0.copyload = load i32, ptr %.sroa.10.0..sroa_idx, align 4, !tbaa !5
  tail call void @_ZN8hashcash6SHA25613processBufferEv(ptr noundef nonnull align 8 dereferenceable(112) %0)
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = lshr i32 %4, 24
  %6 = trunc nuw i32 %5 to i8
  %7 = getelementptr inbounds i8, ptr %1, i64 1
  store i8 %6, ptr %1, align 1, !tbaa !9
  %8 = load i32, ptr %3, align 8, !tbaa !5
  %9 = lshr i32 %8, 16
  %10 = trunc i32 %9 to i8
  %11 = getelementptr inbounds i8, ptr %1, i64 2
  store i8 %10, ptr %7, align 1, !tbaa !9
  %12 = load i32, ptr %3, align 8, !tbaa !5
  %13 = lshr i32 %12, 8
  %14 = trunc i32 %13 to i8
  %15 = getelementptr inbounds i8, ptr %1, i64 3
  store i8 %14, ptr %11, align 1, !tbaa !9
  %16 = load i32, ptr %3, align 8, !tbaa !5
  %17 = trunc i32 %16 to i8
  %18 = getelementptr inbounds i8, ptr %1, i64 4
  store i8 %17, ptr %15, align 1, !tbaa !9
  store i32 %.sroa.0.0.copyload, ptr %3, align 8, !tbaa !5
  %19 = load i32, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %20 = lshr i32 %19, 24
  %21 = trunc nuw i32 %20 to i8
  %22 = getelementptr inbounds i8, ptr %1, i64 5
  store i8 %21, ptr %18, align 1, !tbaa !9
  %23 = load i32, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %24 = lshr i32 %23, 16
  %25 = trunc i32 %24 to i8
  %26 = getelementptr inbounds i8, ptr %1, i64 6
  store i8 %25, ptr %22, align 1, !tbaa !9
  %27 = load i32, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %28 = lshr i32 %27, 8
  %29 = trunc i32 %28 to i8
  %30 = getelementptr inbounds i8, ptr %1, i64 7
  store i8 %29, ptr %26, align 1, !tbaa !9
  %31 = load i32, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %32 = trunc i32 %31 to i8
  %33 = getelementptr inbounds i8, ptr %1, i64 8
  store i8 %32, ptr %30, align 1, !tbaa !9
  store i32 %.sroa.4.0.copyload, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  %34 = load i32, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !5
  %35 = lshr i32 %34, 24
  %36 = trunc nuw i32 %35 to i8
  %37 = getelementptr inbounds i8, ptr %1, i64 9
  store i8 %36, ptr %33, align 1, !tbaa !9
  %38 = load i32, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !5
  %39 = lshr i32 %38, 16
  %40 = trunc i32 %39 to i8
  %41 = getelementptr inbounds i8, ptr %1, i64 10
  store i8 %40, ptr %37, align 1, !tbaa !9
  %42 = load i32, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !5
  %43 = lshr i32 %42, 8
  %44 = trunc i32 %43 to i8
  %45 = getelementptr inbounds i8, ptr %1, i64 11
  store i8 %44, ptr %41, align 1, !tbaa !9
  %46 = load i32, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !5
  %47 = trunc i32 %46 to i8
  %48 = getelementptr inbounds i8, ptr %1, i64 12
  store i8 %47, ptr %45, align 1, !tbaa !9
  store i32 %.sroa.5.0.copyload, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !5
  %49 = load i32, ptr %.sroa.6.0..sroa_idx, align 4, !tbaa !5
  %50 = lshr i32 %49, 24
  %51 = trunc nuw i32 %50 to i8
  %52 = getelementptr inbounds i8, ptr %1, i64 13
  store i8 %51, ptr %48, align 1, !tbaa !9
  %53 = load i32, ptr %.sroa.6.0..sroa_idx, align 4, !tbaa !5
  %54 = lshr i32 %53, 16
  %55 = trunc i32 %54 to i8
  %56 = getelementptr inbounds i8, ptr %1, i64 14
  store i8 %55, ptr %52, align 1, !tbaa !9
  %57 = load i32, ptr %.sroa.6.0..sroa_idx, align 4, !tbaa !5
  %58 = lshr i32 %57, 8
  %59 = trunc i32 %58 to i8
  %60 = getelementptr inbounds i8, ptr %1, i64 15
  store i8 %59, ptr %56, align 1, !tbaa !9
  %61 = load i32, ptr %.sroa.6.0..sroa_idx, align 4, !tbaa !5
  %62 = trunc i32 %61 to i8
  %63 = getelementptr inbounds i8, ptr %1, i64 16
  store i8 %62, ptr %60, align 1, !tbaa !9
  store i32 %.sroa.6.0.copyload, ptr %.sroa.6.0..sroa_idx, align 4, !tbaa !5
  %64 = load i32, ptr %.sroa.7.0..sroa_idx, align 8, !tbaa !5
  %65 = lshr i32 %64, 24
  %66 = trunc nuw i32 %65 to i8
  %67 = getelementptr inbounds i8, ptr %1, i64 17
  store i8 %66, ptr %63, align 1, !tbaa !9
  %68 = load i32, ptr %.sroa.7.0..sroa_idx, align 8, !tbaa !5
  %69 = lshr i32 %68, 16
  %70 = trunc i32 %69 to i8
  %71 = getelementptr inbounds i8, ptr %1, i64 18
  store i8 %70, ptr %67, align 1, !tbaa !9
  %72 = load i32, ptr %.sroa.7.0..sroa_idx, align 8, !tbaa !5
  %73 = lshr i32 %72, 8
  %74 = trunc i32 %73 to i8
  %75 = getelementptr inbounds i8, ptr %1, i64 19
  store i8 %74, ptr %71, align 1, !tbaa !9
  %76 = load i32, ptr %.sroa.7.0..sroa_idx, align 8, !tbaa !5
  %77 = trunc i32 %76 to i8
  %78 = getelementptr inbounds i8, ptr %1, i64 20
  store i8 %77, ptr %75, align 1, !tbaa !9
  store i32 %.sroa.7.0.copyload, ptr %.sroa.7.0..sroa_idx, align 8, !tbaa !5
  %79 = load i32, ptr %.sroa.8.0..sroa_idx, align 4, !tbaa !5
  %80 = lshr i32 %79, 24
  %81 = trunc nuw i32 %80 to i8
  %82 = getelementptr inbounds i8, ptr %1, i64 21
  store i8 %81, ptr %78, align 1, !tbaa !9
  %83 = load i32, ptr %.sroa.8.0..sroa_idx, align 4, !tbaa !5
  %84 = lshr i32 %83, 16
  %85 = trunc i32 %84 to i8
  %86 = getelementptr inbounds i8, ptr %1, i64 22
  store i8 %85, ptr %82, align 1, !tbaa !9
  %87 = load i32, ptr %.sroa.8.0..sroa_idx, align 4, !tbaa !5
  %88 = lshr i32 %87, 8
  %89 = trunc i32 %88 to i8
  %90 = getelementptr inbounds i8, ptr %1, i64 23
  store i8 %89, ptr %86, align 1, !tbaa !9
  %91 = load i32, ptr %.sroa.8.0..sroa_idx, align 4, !tbaa !5
  %92 = trunc i32 %91 to i8
  %93 = getelementptr inbounds i8, ptr %1, i64 24
  store i8 %92, ptr %90, align 1, !tbaa !9
  store i32 %.sroa.8.0.copyload, ptr %.sroa.8.0..sroa_idx, align 4, !tbaa !5
  %94 = load i32, ptr %.sroa.9.0..sroa_idx, align 8, !tbaa !5
  %95 = lshr i32 %94, 24
  %96 = trunc nuw i32 %95 to i8
  %97 = getelementptr inbounds i8, ptr %1, i64 25
  store i8 %96, ptr %93, align 1, !tbaa !9
  %98 = load i32, ptr %.sroa.9.0..sroa_idx, align 8, !tbaa !5
  %99 = lshr i32 %98, 16
  %100 = trunc i32 %99 to i8
  %101 = getelementptr inbounds i8, ptr %1, i64 26
  store i8 %100, ptr %97, align 1, !tbaa !9
  %102 = load i32, ptr %.sroa.9.0..sroa_idx, align 8, !tbaa !5
  %103 = lshr i32 %102, 8
  %104 = trunc i32 %103 to i8
  %105 = getelementptr inbounds i8, ptr %1, i64 27
  store i8 %104, ptr %101, align 1, !tbaa !9
  %106 = load i32, ptr %.sroa.9.0..sroa_idx, align 8, !tbaa !5
  %107 = trunc i32 %106 to i8
  %108 = getelementptr inbounds i8, ptr %1, i64 28
  store i8 %107, ptr %105, align 1, !tbaa !9
  store i32 %.sroa.9.0.copyload, ptr %.sroa.9.0..sroa_idx, align 8, !tbaa !5
  %109 = load i32, ptr %.sroa.10.0..sroa_idx, align 4, !tbaa !5
  %110 = lshr i32 %109, 24
  %111 = trunc nuw i32 %110 to i8
  %112 = getelementptr inbounds i8, ptr %1, i64 29
  store i8 %111, ptr %108, align 1, !tbaa !9
  %113 = load i32, ptr %.sroa.10.0..sroa_idx, align 4, !tbaa !5
  %114 = lshr i32 %113, 16
  %115 = trunc i32 %114 to i8
  %116 = getelementptr inbounds i8, ptr %1, i64 30
  store i8 %115, ptr %112, align 1, !tbaa !9
  %117 = load i32, ptr %.sroa.10.0..sroa_idx, align 4, !tbaa !5
  %118 = lshr i32 %117, 8
  %119 = trunc i32 %118 to i8
  %120 = getelementptr inbounds i8, ptr %1, i64 31
  store i8 %119, ptr %116, align 1, !tbaa !9
  %121 = load i32, ptr %.sroa.10.0..sroa_idx, align 4, !tbaa !5
  %122 = trunc i32 %121 to i8
  store i8 %122, ptr %120, align 1, !tbaa !9
  store i32 %.sroa.10.0.copyload, ptr %.sroa.10.0..sroa_idx, align 4, !tbaa !5
  ret void
}

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

!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 = !{!7, !7, i64 0}


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