; LLVM IR from cryptid-org/cryptid-native :: dependencies/gmp/src (mini-gmp)

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

@.str.1 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [20 x i8], align 1
@__PRETTY_FUNCTION__.mpn_rshift = external hidden unnamed_addr constant [65 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i64 @mpn_rshift(ptr noundef %0, ptr noundef %1, i64 noundef %2, i32 noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %13 = load i64, ptr %7, align 8, !tbaa !9
  %14 = icmp sge i64 %13, 1
  br i1 %14, label %15, label %16

15:                                               ; preds = %4
  br label %17

16:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 644, ptr noundef @__PRETTY_FUNCTION__.mpn_rshift) #4
  unreachable

17:                                               ; preds = %15
  %18 = load i32, ptr %8, align 4, !tbaa !11
  %19 = icmp uge i32 %18, 1
  br i1 %19, label %20, label %21

20:                                               ; preds = %17
  br label %22

21:                                               ; preds = %17
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 645, ptr noundef @__PRETTY_FUNCTION__.mpn_rshift) #4
  unreachable

22:                                               ; preds = %20
  %23 = load i32, ptr %8, align 4, !tbaa !11
  %24 = zext i32 %23 to i64
  %25 = icmp ult i64 %24, 64
  br i1 %25, label %26, label %27

26:                                               ; preds = %22
  br label %28

27:                                               ; preds = %22
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 646, ptr noundef @__PRETTY_FUNCTION__.mpn_rshift) #4
  unreachable

28:                                               ; preds = %26
  %29 = load i32, ptr %8, align 4, !tbaa !11
  %30 = zext i32 %29 to i64
  %31 = sub i64 64, %30
  %32 = trunc i64 %31 to i32
  store i32 %32, ptr %11, align 4, !tbaa !11
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds i64, ptr %33, i32 1
  store ptr %34, ptr %6, align 8, !tbaa !5
  %35 = load i64, ptr %33, align 8, !tbaa !9
  store i64 %35, ptr %9, align 8, !tbaa !9
  %36 = load i64, ptr %9, align 8, !tbaa !9
  %37 = load i32, ptr %11, align 4, !tbaa !11
  %38 = zext i32 %37 to i64
  %39 = shl i64 %36, %38
  store i64 %39, ptr %12, align 8, !tbaa !9
  %40 = load i64, ptr %9, align 8, !tbaa !9
  %41 = load i32, ptr %8, align 4, !tbaa !11
  %42 = zext i32 %41 to i64
  %43 = lshr i64 %40, %42
  store i64 %43, ptr %10, align 8, !tbaa !9
  br label %44

44:                                               ; preds = %48, %28
  %45 = load i64, ptr %7, align 8, !tbaa !9
  %46 = add nsw i64 %45, -1
  store i64 %46, ptr %7, align 8, !tbaa !9
  %47 = icmp ne i64 %46, 0
  br i1 %47, label %48, label %64

48:                                               ; preds = %44
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds i64, ptr %49, i32 1
  store ptr %50, ptr %6, align 8, !tbaa !5
  %51 = load i64, ptr %49, align 8, !tbaa !9
  store i64 %51, ptr %9, align 8, !tbaa !9
  %52 = load i64, ptr %10, align 8, !tbaa !9
  %53 = load i64, ptr %9, align 8, !tbaa !9
  %54 = load i32, ptr %11, align 4, !tbaa !11
  %55 = zext i32 %54 to i64
  %56 = shl i64 %53, %55
  %57 = or i64 %52, %56
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds i64, ptr %58, i32 1
  store ptr %59, ptr %5, align 8, !tbaa !5
  store i64 %57, ptr %58, align 8, !tbaa !9
  %60 = load i64, ptr %9, align 8, !tbaa !9
  %61 = load i32, ptr %8, align 4, !tbaa !11
  %62 = zext i32 %61 to i64
  %63 = lshr i64 %60, %62
  store i64 %63, ptr %10, align 8, !tbaa !9
  br label %44, !llvm.loop !13

64:                                               ; preds = %44
  %65 = load i64, ptr %10, align 8, !tbaa !9
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %65, ptr %66, align 8, !tbaa !9
  %67 = load i64, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  ret i64 %67
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 }
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, !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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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

@.str.1 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [20 x i8], align 1
@__PRETTY_FUNCTION__.mpn_rshift = external hidden unnamed_addr constant [65 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i64 @mpn_rshift(ptr nocapture noundef writeonly %0, ptr nocapture noundef readonly %1, i64 noundef %2, i32 noundef %3) local_unnamed_addr #1 {
  %5 = icmp sgt i64 %2, 0
  br i1 %5, label %7, label %6

6:                                                ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 644, ptr noundef nonnull @__PRETTY_FUNCTION__.mpn_rshift) #2
  unreachable

7:                                                ; preds = %4
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %8, label %9

8:                                                ; preds = %7
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 645, ptr noundef nonnull @__PRETTY_FUNCTION__.mpn_rshift) #2
  unreachable

9:                                                ; preds = %7
  %10 = zext nneg i32 %3 to i64
  %11 = icmp ult i32 %3, 64
  br i1 %11, label %13, label %12

12:                                               ; preds = %9
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 646, ptr noundef nonnull @__PRETTY_FUNCTION__.mpn_rshift) #2
  unreachable

13:                                               ; preds = %9
  %14 = sub nuw nsw i32 64, %3
  %15 = load i64, ptr %1, align 8, !tbaa !5
  %16 = zext nneg i32 %14 to i64
  %.02028 = lshr i64 %15, %10
  %17 = add nsw i64 %2, -1
  %.not2629 = icmp eq i64 %17, 0
  br i1 %.not2629, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %13
  %18 = add nsw i64 %2, -2
  %xtraiter = and i64 %17, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol

.lr.ph.prol:                                      ; preds = %.lr.ph.preheader, %.lr.ph.prol
  %19 = phi i64 [ %24, %.lr.ph.prol ], [ %17, %.lr.ph.preheader ]
  %.02032.prol = phi i64 [ %.020.prol, %.lr.ph.prol ], [ %.02028, %.lr.ph.preheader ]
  %.031.prol = phi ptr [ %23, %.lr.ph.prol ], [ %0, %.lr.ph.preheader ]
  %.pn2730.prol = phi ptr [ %.019.prol, %.lr.ph.prol ], [ %1, %.lr.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph.prol ], [ 0, %.lr.ph.preheader ]
  %.019.prol = getelementptr inbounds i8, ptr %.pn2730.prol, i64 8
  %20 = load i64, ptr %.019.prol, align 8, !tbaa !5
  %21 = shl i64 %20, %16
  %22 = or i64 %21, %.02032.prol
  %23 = getelementptr inbounds i8, ptr %.031.prol, i64 8
  store i64 %22, ptr %.031.prol, align 8, !tbaa !5
  %.020.prol = lshr i64 %20, %10
  %24 = add nsw i64 %19, -1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol, !llvm.loop !9

.lr.ph.prol.loopexit:                             ; preds = %.lr.ph.prol, %.lr.ph.preheader
  %.lcssa.unr = phi ptr [ poison, %.lr.ph.preheader ], [ %23, %.lr.ph.prol ]
  %.020.lcssa37.unr = phi i64 [ poison, %.lr.ph.preheader ], [ %.020.prol, %.lr.ph.prol ]
  %.unr = phi i64 [ %17, %.lr.ph.preheader ], [ %24, %.lr.ph.prol ]
  %.02032.unr = phi i64 [ %.02028, %.lr.ph.preheader ], [ %.020.prol, %.lr.ph.prol ]
  %.031.unr = phi ptr [ %0, %.lr.ph.preheader ], [ %23, %.lr.ph.prol ]
  %.pn2730.unr = phi ptr [ %1, %.lr.ph.preheader ], [ %.019.prol, %.lr.ph.prol ]
  %25 = icmp ult i64 %18, 3
  br i1 %25, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.prol.loopexit, %.lr.ph
  %26 = phi i64 [ %43, %.lr.ph ], [ %.unr, %.lr.ph.prol.loopexit ]
  %.02032 = phi i64 [ %.020.3, %.lr.ph ], [ %.02032.unr, %.lr.ph.prol.loopexit ]
  %.031 = phi ptr [ %42, %.lr.ph ], [ %.031.unr, %.lr.ph.prol.loopexit ]
  %.pn2730 = phi ptr [ %.019.3, %.lr.ph ], [ %.pn2730.unr, %.lr.ph.prol.loopexit ]
  %.019 = getelementptr inbounds i8, ptr %.pn2730, i64 8
  %27 = load i64, ptr %.019, align 8, !tbaa !5
  %28 = shl i64 %27, %16
  %29 = or i64 %28, %.02032
  %30 = getelementptr inbounds i8, ptr %.031, i64 8
  store i64 %29, ptr %.031, align 8, !tbaa !5
  %.020 = lshr i64 %27, %10
  %.019.1 = getelementptr inbounds i8, ptr %.pn2730, i64 16
  %31 = load i64, ptr %.019.1, align 8, !tbaa !5
  %32 = shl i64 %31, %16
  %33 = or i64 %32, %.020
  %34 = getelementptr inbounds i8, ptr %.031, i64 16
  store i64 %33, ptr %30, align 8, !tbaa !5
  %.020.1 = lshr i64 %31, %10
  %.019.2 = getelementptr inbounds i8, ptr %.pn2730, i64 24
  %35 = load i64, ptr %.019.2, align 8, !tbaa !5
  %36 = shl i64 %35, %16
  %37 = or i64 %36, %.020.1
  %38 = getelementptr inbounds i8, ptr %.031, i64 24
  store i64 %37, ptr %34, align 8, !tbaa !5
  %.020.2 = lshr i64 %35, %10
  %.019.3 = getelementptr inbounds i8, ptr %.pn2730, i64 32
  %39 = load i64, ptr %.019.3, align 8, !tbaa !5
  %40 = shl i64 %39, %16
  %41 = or i64 %40, %.020.2
  %42 = getelementptr inbounds i8, ptr %.031, i64 32
  store i64 %41, ptr %38, align 8, !tbaa !5
  %.020.3 = lshr i64 %39, %10
  %43 = add nsw i64 %26, -4
  %.not26.3 = icmp eq i64 %43, 0
  br i1 %.not26.3, label %._crit_edge, label %.lr.ph, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph.prol.loopexit, %.lr.ph, %13
  %.0.lcssa = phi ptr [ %0, %13 ], [ %.lcssa.unr, %.lr.ph.prol.loopexit ], [ %42, %.lr.ph ]
  %.020.lcssa = phi i64 [ %.02028, %13 ], [ %.020.lcssa37.unr, %.lr.ph.prol.loopexit ], [ %.020.3, %.lr.ph ]
  %44 = shl i64 %15, %16
  store i64 %.020.lcssa, ptr %.0.lcssa, align 8, !tbaa !5
  ret i64 %44
}

attributes #0 = { 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 #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 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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