; 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
@__PRETTY_FUNCTION__.mpn_submul_1 = external hidden unnamed_addr constant [64 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_submul_1(ptr noundef %0, ptr noundef %1, i64 noundef %2, i64 noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i64, align 8
  %23 = 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 i64 %3, ptr %8, align 8, !tbaa !9
  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 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %24 = load i64, ptr %7, align 8, !tbaa !9
  %25 = icmp sge i64 %24, 1
  br i1 %25, label %26, label %27

26:                                               ; preds = %4
  br label %28

27:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 551, ptr noundef @__PRETTY_FUNCTION__.mpn_submul_1) #4
  unreachable

28:                                               ; preds = %26
  store i64 0, ptr %10, align 8, !tbaa !9
  br label %29

29:                                               ; preds = %118, %28
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = getelementptr inbounds i64, ptr %30, i32 1
  store ptr %31, ptr %6, align 8, !tbaa !5
  %32 = load i64, ptr %30, align 8, !tbaa !9
  store i64 %32, ptr %9, align 8, !tbaa !9
  br label %33

33:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  %34 = load i64, ptr %9, align 8, !tbaa !9
  store i64 %34, ptr %22, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #3
  %35 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %35, ptr %23, align 8, !tbaa !9
  %36 = load i64, ptr %22, align 8, !tbaa !9
  %37 = and i64 %36, 4294967295
  %38 = trunc i64 %37 to i32
  store i32 %38, ptr %18, align 4, !tbaa !11
  %39 = load i64, ptr %22, align 8, !tbaa !9
  %40 = lshr i64 %39, 32
  %41 = trunc i64 %40 to i32
  store i32 %41, ptr %20, align 4, !tbaa !11
  %42 = load i64, ptr %23, align 8, !tbaa !9
  %43 = and i64 %42, 4294967295
  %44 = trunc i64 %43 to i32
  store i32 %44, ptr %19, align 4, !tbaa !11
  %45 = load i64, ptr %23, align 8, !tbaa !9
  %46 = lshr i64 %45, 32
  %47 = trunc i64 %46 to i32
  store i32 %47, ptr %21, align 4, !tbaa !11
  %48 = load i32, ptr %18, align 4, !tbaa !11
  %49 = zext i32 %48 to i64
  %50 = load i32, ptr %19, align 4, !tbaa !11
  %51 = zext i32 %50 to i64
  %52 = mul i64 %49, %51
  store i64 %52, ptr %14, align 8, !tbaa !9
  %53 = load i32, ptr %18, align 4, !tbaa !11
  %54 = zext i32 %53 to i64
  %55 = load i32, ptr %21, align 4, !tbaa !11
  %56 = zext i32 %55 to i64
  %57 = mul i64 %54, %56
  store i64 %57, ptr %15, align 8, !tbaa !9
  %58 = load i32, ptr %20, align 4, !tbaa !11
  %59 = zext i32 %58 to i64
  %60 = load i32, ptr %19, align 4, !tbaa !11
  %61 = zext i32 %60 to i64
  %62 = mul i64 %59, %61
  store i64 %62, ptr %16, align 8, !tbaa !9
  %63 = load i32, ptr %20, align 4, !tbaa !11
  %64 = zext i32 %63 to i64
  %65 = load i32, ptr %21, align 4, !tbaa !11
  %66 = zext i32 %65 to i64
  %67 = mul i64 %64, %66
  store i64 %67, ptr %17, align 8, !tbaa !9
  %68 = load i64, ptr %14, align 8, !tbaa !9
  %69 = lshr i64 %68, 32
  %70 = load i64, ptr %15, align 8, !tbaa !9
  %71 = add i64 %70, %69
  store i64 %71, ptr %15, align 8, !tbaa !9
  %72 = load i64, ptr %16, align 8, !tbaa !9
  %73 = load i64, ptr %15, align 8, !tbaa !9
  %74 = add i64 %73, %72
  store i64 %74, ptr %15, align 8, !tbaa !9
  %75 = load i64, ptr %15, align 8, !tbaa !9
  %76 = load i64, ptr %16, align 8, !tbaa !9
  %77 = icmp ult i64 %75, %76
  br i1 %77, label %78, label %81

78:                                               ; preds = %33
  %79 = load i64, ptr %17, align 8, !tbaa !9
  %80 = add i64 %79, 4294967296
  store i64 %80, ptr %17, align 8, !tbaa !9
  br label %81

81:                                               ; preds = %78, %33
  %82 = load i64, ptr %17, align 8, !tbaa !9
  %83 = load i64, ptr %15, align 8, !tbaa !9
  %84 = lshr i64 %83, 32
  %85 = add i64 %82, %84
  store i64 %85, ptr %11, align 8, !tbaa !9
  %86 = load i64, ptr %15, align 8, !tbaa !9
  %87 = shl i64 %86, 32
  %88 = load i64, ptr %14, align 8, !tbaa !9
  %89 = and i64 %88, 4294967295
  %90 = add i64 %87, %89
  store i64 %90, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  br label %91

91:                                               ; preds = %81
  br label %92

92:                                               ; preds = %91
  %93 = load i64, ptr %10, align 8, !tbaa !9
  %94 = load i64, ptr %12, align 8, !tbaa !9
  %95 = add i64 %94, %93
  store i64 %95, ptr %12, align 8, !tbaa !9
  %96 = load i64, ptr %12, align 8, !tbaa !9
  %97 = load i64, ptr %10, align 8, !tbaa !9
  %98 = icmp ult i64 %96, %97
  %99 = zext i1 %98 to i32
  %100 = sext i32 %99 to i64
  %101 = load i64, ptr %11, align 8, !tbaa !9
  %102 = add i64 %100, %101
  store i64 %102, ptr %10, align 8, !tbaa !9
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = load i64, ptr %103, align 8, !tbaa !9
  store i64 %104, ptr %13, align 8, !tbaa !9
  %105 = load i64, ptr %13, align 8, !tbaa !9
  %106 = load i64, ptr %12, align 8, !tbaa !9
  %107 = sub i64 %105, %106
  store i64 %107, ptr %12, align 8, !tbaa !9
  %108 = load i64, ptr %12, align 8, !tbaa !9
  %109 = load i64, ptr %13, align 8, !tbaa !9
  %110 = icmp ugt i64 %108, %109
  %111 = zext i1 %110 to i32
  %112 = sext i32 %111 to i64
  %113 = load i64, ptr %10, align 8, !tbaa !9
  %114 = add i64 %113, %112
  store i64 %114, ptr %10, align 8, !tbaa !9
  %115 = load i64, ptr %12, align 8, !tbaa !9
  %116 = load ptr, ptr %5, align 8, !tbaa !5
  %117 = getelementptr inbounds i64, ptr %116, i32 1
  store ptr %117, ptr %5, align 8, !tbaa !5
  store i64 %115, ptr %116, align 8, !tbaa !9
  br label %118

118:                                              ; preds = %92
  %119 = load i64, ptr %7, align 8, !tbaa !9
  %120 = add nsw i64 %119, -1
  store i64 %120, ptr %7, align 8, !tbaa !9
  %121 = icmp ne i64 %120, 0
  br i1 %121, label %29, label %122, !llvm.loop !13

122:                                              ; preds = %118
  %123 = load i64, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, 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 %123
}

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
@__PRETTY_FUNCTION__.mpn_submul_1 = external hidden unnamed_addr constant [64 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_submul_1(ptr nocapture noundef %0, ptr nocapture noundef readonly %1, i64 noundef %2, i64 noundef %3) local_unnamed_addr #1 {
  %5 = icmp sgt i64 %2, 0
  br i1 %5, label %.preheader, label %8

.preheader:                                       ; preds = %4
  %6 = lshr i64 %3, 32
  %7 = and i64 %3, 4294967295
  br label %9

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

9:                                                ; preds = %.preheader, %9
  %.043 = phi i64 [ %36, %9 ], [ 0, %.preheader ]
  %.042 = phi i64 [ %38, %9 ], [ %2, %.preheader ]
  %.041 = phi ptr [ %10, %9 ], [ %1, %.preheader ]
  %.0 = phi ptr [ %37, %9 ], [ %0, %.preheader ]
  %10 = getelementptr inbounds i8, ptr %.041, i64 8
  %11 = load i64, ptr %.041, align 8, !tbaa !5
  %12 = lshr i64 %11, 32
  %13 = and i64 %11, 4294967295
  %14 = mul nuw i64 %13, %7
  %15 = mul nuw i64 %13, %6
  %16 = mul nuw i64 %12, %7
  %17 = mul nuw i64 %12, %6
  %18 = lshr i64 %14, 32
  %19 = add i64 %16, %15
  %20 = add i64 %19, %18
  %21 = icmp ult i64 %20, %16
  %22 = add nuw i64 %17, 4294967296
  %spec.select = select i1 %21, i64 %22, i64 %17
  %23 = lshr i64 %20, 32
  %24 = add i64 %spec.select, %23
  %25 = shl i64 %20, 32
  %26 = and i64 %14, 4294967295
  %27 = add i64 %26, %.043
  %28 = add i64 %27, %25
  %29 = icmp ult i64 %28, %.043
  %30 = zext i1 %29 to i64
  %31 = add i64 %24, %30
  %32 = load i64, ptr %.0, align 8, !tbaa !5
  %33 = sub i64 %32, %28
  %34 = icmp ugt i64 %28, %32
  %35 = zext i1 %34 to i64
  %36 = add i64 %31, %35
  %37 = getelementptr inbounds i8, ptr %.0, i64 8
  store i64 %33, ptr %.0, align 8, !tbaa !5
  %38 = add nsw i64 %.042, -1
  %.not = icmp eq i64 %38, 0
  br i1 %.not, label %39, label %9, !llvm.loop !9

39:                                               ; preds = %9
  ret i64 %36
}

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


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