; 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_mul_1 = external hidden unnamed_addr constant [61 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_mul_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 i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i64, align 8
  %22 = 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
  %23 = load i64, ptr %7, align 8, !tbaa !9
  %24 = icmp sge i64 %23, 1
  br i1 %24, label %25, label %26

25:                                               ; preds = %4
  br label %27

26:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 502, ptr noundef @__PRETTY_FUNCTION__.mpn_mul_1) #4
  unreachable

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

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

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

77:                                               ; preds = %32
  %78 = load i64, ptr %16, align 8, !tbaa !9
  %79 = add i64 %78, 4294967296
  store i64 %79, ptr %16, align 8, !tbaa !9
  br label %80

80:                                               ; preds = %77, %32
  %81 = load i64, ptr %16, align 8, !tbaa !9
  %82 = load i64, ptr %14, align 8, !tbaa !9
  %83 = lshr i64 %82, 32
  %84 = add i64 %81, %83
  store i64 %84, ptr %11, align 8, !tbaa !9
  %85 = load i64, ptr %14, align 8, !tbaa !9
  %86 = shl i64 %85, 32
  %87 = load i64, ptr %13, align 8, !tbaa !9
  %88 = and i64 %87, 4294967295
  %89 = add i64 %86, %88
  store i64 %89, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, 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 4, 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
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  br label %90

90:                                               ; preds = %80
  br label %91

91:                                               ; preds = %90
  %92 = load i64, ptr %10, align 8, !tbaa !9
  %93 = load i64, ptr %12, align 8, !tbaa !9
  %94 = add i64 %93, %92
  store i64 %94, ptr %12, align 8, !tbaa !9
  %95 = load i64, ptr %12, align 8, !tbaa !9
  %96 = load i64, ptr %10, align 8, !tbaa !9
  %97 = icmp ult i64 %95, %96
  %98 = zext i1 %97 to i32
  %99 = sext i32 %98 to i64
  %100 = load i64, ptr %11, align 8, !tbaa !9
  %101 = add i64 %99, %100
  store i64 %101, ptr %10, align 8, !tbaa !9
  %102 = load i64, ptr %12, align 8, !tbaa !9
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = getelementptr inbounds i64, ptr %103, i32 1
  store ptr %104, ptr %5, align 8, !tbaa !5
  store i64 %102, ptr %103, align 8, !tbaa !9
  br label %105

105:                                              ; preds = %91
  %106 = load i64, ptr %7, align 8, !tbaa !9
  %107 = add nsw i64 %106, -1
  store i64 %107, ptr %7, align 8, !tbaa !9
  %108 = icmp ne i64 %107, 0
  br i1 %108, label %28, label %109, !llvm.loop !13

109:                                              ; preds = %105
  %110 = load i64, ptr %10, align 8, !tbaa !9
  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 %110
}

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_mul_1 = external hidden unnamed_addr constant [61 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_mul_1(ptr nocapture noundef writeonly %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 502, ptr noundef nonnull @__PRETTY_FUNCTION__.mpn_mul_1) #2
  unreachable

9:                                                ; preds = %.preheader, %9
  %.037 = phi i64 [ %31, %9 ], [ 0, %.preheader ]
  %.036 = phi i64 [ %33, %9 ], [ %2, %.preheader ]
  %.035 = phi ptr [ %10, %9 ], [ %1, %.preheader ]
  %.0 = phi ptr [ %32, %9 ], [ %0, %.preheader ]
  %10 = getelementptr inbounds i8, ptr %.035, i64 8
  %11 = load i64, ptr %.035, 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, %.037
  %28 = add i64 %27, %25
  %29 = icmp ult i64 %28, %.037
  %30 = zext i1 %29 to i64
  %31 = add i64 %24, %30
  %32 = getelementptr inbounds i8, ptr %.0, i64 8
  store i64 %28, ptr %.0, align 8, !tbaa !5
  %33 = add nsw i64 %.036, -1
  %.not = icmp eq i64 %33, 0
  br i1 %.not, label %34, label %9, !llvm.loop !9

34:                                               ; preds = %9
  ret i64 %31
}

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