; LLVM IR from albertobsd/keyhunt :: secp256k1/SECP256K1.ll (ZN9Secp256K112DoubleDirectER5Point)

; 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.Point = type { %class.Int, %class.Int, %class.Int }
%class.Int = type { %union.anon }
%union.anon = type { [5 x i64] }

declare void @_ZN5PointC1Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #0

declare void @_ZN3IntC1Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN5PointD1Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #1

declare void @_ZN3Int8SetInt32Ej(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9Secp256K112DoubleDirectER5Point(ptr dead_on_unwind noalias writable sret(%class.Point) align 8 %0, ptr noundef nonnull align 8 dereferenceable(983240) %1, ptr noundef nonnull align 8 dereferenceable(120) %2) #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %class.Int, align 8
  %8 = alloca %class.Int, align 8
  %9 = alloca %class.Int, align 8
  %10 = alloca i1, align 1
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %13 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 40, ptr %7) #4
  call void @_ZN3IntC1Ev(ptr noundef nonnull align 8 dereferenceable(40) %7)
  call void @llvm.lifetime.start.p0(i64 40, ptr %8) #4
  call void @_ZN3IntC1Ev(ptr noundef nonnull align 8 dereferenceable(40) %8)
  call void @llvm.lifetime.start.p0(i64 40, ptr %9) #4
  call void @_ZN3IntC1Ev(ptr noundef nonnull align 8 dereferenceable(40) %9)
  store i1 false, ptr %10, align 1
  call void @_ZN5PointC1Ev(ptr noundef nonnull align 8 dereferenceable(120) %0)
  %14 = getelementptr inbounds %class.Point, ptr %0, i32 0, i32 2
  invoke void @_ZN3Int8SetInt32Ej(ptr noundef nonnull align 8 dereferenceable(40) %14, i32 noundef 1)
          to label %15 unwind label %51

15:                                               ; preds = %3
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = getelementptr inbounds %class.Point, ptr %16, i32 0, i32 0
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds %class.Point, ptr %18, i32 0, i32 0
  invoke void @_ZN3Int8ModMulK1EPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %7, ptr noundef %17, ptr noundef %19)
          to label %20 unwind label %51

20:                                               ; preds = %15
  invoke void @_ZN3Int6ModAddEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %8, ptr noundef %7, ptr noundef %7)
          to label %21 unwind label %51

21:                                               ; preds = %20
  invoke void @_ZN3Int6ModAddEPS_(ptr noundef nonnull align 8 dereferenceable(40) %8, ptr noundef %7)
          to label %22 unwind label %51

22:                                               ; preds = %21
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds %class.Point, ptr %23, i32 0, i32 1
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %class.Point, ptr %25, i32 0, i32 1
  invoke void @_ZN3Int6ModAddEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %9, ptr noundef %24, ptr noundef %26)
          to label %27 unwind label %51

27:                                               ; preds = %22
  invoke void @_ZN3Int6ModInvEv(ptr noundef nonnull align 8 dereferenceable(40) %9)
          to label %28 unwind label %51

28:                                               ; preds = %27
  invoke void @_ZN3Int8ModMulK1EPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %7, ptr noundef %8, ptr noundef %9)
          to label %29 unwind label %51

29:                                               ; preds = %28
  invoke void @_ZN3Int8ModMulK1EPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %8, ptr noundef %7, ptr noundef %7)
          to label %30 unwind label %51

30:                                               ; preds = %29
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds %class.Point, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %class.Point, ptr %33, i32 0, i32 0
  invoke void @_ZN3Int6ModAddEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %9, ptr noundef %32, ptr noundef %34)
          to label %35 unwind label %51

35:                                               ; preds = %30
  invoke void @_ZN3Int6ModNegEv(ptr noundef nonnull align 8 dereferenceable(40) %9)
          to label %36 unwind label %51

36:                                               ; preds = %35
  %37 = getelementptr inbounds %class.Point, ptr %0, i32 0, i32 0
  invoke void @_ZN3Int6ModAddEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %37, ptr noundef %9, ptr noundef %8)
          to label %38 unwind label %51

38:                                               ; preds = %36
  %39 = getelementptr inbounds %class.Point, ptr %0, i32 0, i32 0
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %class.Point, ptr %40, i32 0, i32 0
  invoke void @_ZN3Int6ModSubEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %9, ptr noundef %39, ptr noundef %41)
          to label %42 unwind label %51

42:                                               ; preds = %38
  invoke void @_ZN3Int8ModMulK1EPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %8, ptr noundef %9, ptr noundef %7)
          to label %43 unwind label %51

43:                                               ; preds = %42
  %44 = getelementptr inbounds %class.Point, ptr %0, i32 0, i32 1
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %class.Point, ptr %45, i32 0, i32 1
  invoke void @_ZN3Int6ModAddEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %44, ptr noundef %8, ptr noundef %46)
          to label %47 unwind label %51

47:                                               ; preds = %43
  %48 = getelementptr inbounds %class.Point, ptr %0, i32 0, i32 1
  invoke void @_ZN3Int6ModNegEv(ptr noundef nonnull align 8 dereferenceable(40) %48)
          to label %49 unwind label %51

49:                                               ; preds = %47
  store i1 true, ptr %10, align 1
  %50 = load i1, ptr %10, align 1
  br i1 %50, label %56, label %55

51:                                               ; preds = %47, %43, %42, %38, %36, %35, %30, %29, %28, %27, %22, %21, %20, %15, %3
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %11, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %12, align 4
  call void @_ZN5PointD1Ev(ptr noundef nonnull align 8 dereferenceable(120) %0) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %7) #4
  br label %57

55:                                               ; preds = %49
  call void @_ZN5PointD1Ev(ptr noundef nonnull align 8 dereferenceable(120) %0) #4
  br label %56

56:                                               ; preds = %55, %49
  call void @llvm.lifetime.end.p0(i64 40, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %7) #4
  ret void

57:                                               ; preds = %51
  %58 = load ptr, ptr %11, align 8
  %59 = load i32, ptr %12, align 4
  %60 = insertvalue { ptr, i32 } poison, ptr %58, 0
  %61 = insertvalue { ptr, i32 } %60, i32 %59, 1
  resume { ptr, i32 } %61
}

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

declare void @_ZN3Int6ModSubEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef, ptr noundef) #0

declare void @_ZN3Int6ModInvEv(ptr noundef nonnull align 8 dereferenceable(40)) #0

declare void @_ZN3Int8ModMulK1EPS_S0_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef, ptr noundef) #0

declare void @_ZN3Int6ModAddEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef, ptr noundef) #0

declare void @_ZN3Int6ModAddEPS_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) #0

declare void @_ZN3Int6ModNegEv(ptr noundef nonnull align 8 dereferenceable(40)) #0

attributes #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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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

%class.Point = type { %class.Int, %class.Int, %class.Int }
%class.Int = type { %union.anon }
%union.anon = type { [5 x i64] }

declare void @_ZN5PointC1Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #0

declare void @_ZN3IntC1Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN5PointD1Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #1

declare void @_ZN3Int8SetInt32Ej(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9Secp256K112DoubleDirectER5Point(ptr dead_on_unwind noalias writable sret(%class.Point) align 8 %0, ptr nocapture noundef nonnull readnone align 8 dereferenceable(983240) %1, ptr noundef nonnull align 8 dereferenceable(120) %2) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %class.Int, align 8
  %5 = alloca %class.Int, align 8
  %6 = alloca %class.Int, align 8
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #4
  call void @_ZN3IntC1Ev(ptr noundef nonnull align 8 dereferenceable(40) %4)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %5) #4
  call void @_ZN3IntC1Ev(ptr noundef nonnull align 8 dereferenceable(40) %5)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %6) #4
  call void @_ZN3IntC1Ev(ptr noundef nonnull align 8 dereferenceable(40) %6)
  call void @_ZN5PointC1Ev(ptr noundef nonnull align 8 dereferenceable(120) %0)
  %7 = getelementptr inbounds i8, ptr %0, i64 80
  invoke void @_ZN3Int8SetInt32Ej(ptr noundef nonnull align 8 dereferenceable(40) %7, i32 noundef 1)
          to label %8 unwind label %24

8:                                                ; preds = %3
  invoke void @_ZN3Int8ModMulK1EPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull %2, ptr noundef nonnull %2)
          to label %9 unwind label %24

9:                                                ; preds = %8
  invoke void @_ZN3Int6ModAddEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %5, ptr noundef nonnull %4, ptr noundef nonnull %4)
          to label %10 unwind label %24

10:                                               ; preds = %9
  invoke void @_ZN3Int6ModAddEPS_(ptr noundef nonnull align 8 dereferenceable(40) %5, ptr noundef nonnull %4)
          to label %11 unwind label %24

11:                                               ; preds = %10
  %12 = getelementptr inbounds i8, ptr %2, i64 40
  invoke void @_ZN3Int6ModAddEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %6, ptr noundef nonnull %12, ptr noundef nonnull %12)
          to label %13 unwind label %24

13:                                               ; preds = %11
  invoke void @_ZN3Int6ModInvEv(ptr noundef nonnull align 8 dereferenceable(40) %6)
          to label %14 unwind label %24

14:                                               ; preds = %13
  invoke void @_ZN3Int8ModMulK1EPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull %5, ptr noundef nonnull %6)
          to label %15 unwind label %24

15:                                               ; preds = %14
  invoke void @_ZN3Int8ModMulK1EPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %5, ptr noundef nonnull %4, ptr noundef nonnull %4)
          to label %16 unwind label %24

16:                                               ; preds = %15
  invoke void @_ZN3Int6ModAddEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %6, ptr noundef nonnull %2, ptr noundef nonnull %2)
          to label %17 unwind label %24

17:                                               ; preds = %16
  invoke void @_ZN3Int6ModNegEv(ptr noundef nonnull align 8 dereferenceable(40) %6)
          to label %18 unwind label %24

18:                                               ; preds = %17
  invoke void @_ZN3Int6ModAddEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull %6, ptr noundef nonnull %5)
          to label %19 unwind label %24

19:                                               ; preds = %18
  invoke void @_ZN3Int6ModSubEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %6, ptr noundef nonnull %0, ptr noundef nonnull %2)
          to label %20 unwind label %24

20:                                               ; preds = %19
  invoke void @_ZN3Int8ModMulK1EPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %5, ptr noundef nonnull %6, ptr noundef nonnull %4)
          to label %21 unwind label %24

21:                                               ; preds = %20
  %22 = getelementptr inbounds i8, ptr %0, i64 40
  invoke void @_ZN3Int6ModAddEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %22, ptr noundef nonnull %5, ptr noundef nonnull %12)
          to label %23 unwind label %24

23:                                               ; preds = %21
  invoke void @_ZN3Int6ModNegEv(ptr noundef nonnull align 8 dereferenceable(40) %22)
          to label %26 unwind label %24

24:                                               ; preds = %23, %21, %20, %19, %18, %17, %16, %15, %14, %13, %11, %10, %9, %8, %3
  %25 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5PointD1Ev(ptr noundef nonnull align 8 dereferenceable(120) %0) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #4
  resume { ptr, i32 } %25

26:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #4
  ret void
}

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

declare void @_ZN3Int6ModSubEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @_ZN3Int6ModInvEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #0

declare void @_ZN3Int8ModMulK1EPS_S0_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @_ZN3Int6ModAddEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @_ZN3Int6ModAddEPS_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) local_unnamed_addr #0

declare void @_ZN3Int6ModNegEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #0

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass