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

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9Secp256K19AddDirectER5PointS1_(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, ptr noundef nonnull align 8 dereferenceable(120) %3) #3 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %class.Int, align 8
  %10 = alloca %class.Int, align 8
  %11 = alloca %class.Int, align 8
  %12 = alloca %class.Int, align 8
  %13 = alloca i1, align 1
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  store ptr %0, ptr %5, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %16 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 40, ptr %9) #4
  call void @_ZN3IntC1Ev(ptr noundef nonnull align 8 dereferenceable(40) %9)
  call void @llvm.lifetime.start.p0(i64 40, ptr %10) #4
  call void @_ZN3IntC1Ev(ptr noundef nonnull align 8 dereferenceable(40) %10)
  call void @llvm.lifetime.start.p0(i64 40, ptr %11) #4
  call void @_ZN3IntC1Ev(ptr noundef nonnull align 8 dereferenceable(40) %11)
  call void @llvm.lifetime.start.p0(i64 40, ptr %12) #4
  call void @_ZN3IntC1Ev(ptr noundef nonnull align 8 dereferenceable(40) %12)
  store i1 false, ptr %13, align 1
  call void @_ZN5PointC1Ev(ptr noundef nonnull align 8 dereferenceable(120) %0)
  %17 = getelementptr inbounds %class.Point, ptr %0, i32 0, i32 2
  invoke void @_ZN3Int8SetInt32Ej(ptr noundef nonnull align 8 dereferenceable(40) %17, i32 noundef 1)
          to label %18 unwind label %52

18:                                               ; preds = %4
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  %20 = getelementptr inbounds %class.Point, ptr %19, i32 0, i32 1
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = getelementptr inbounds %class.Point, ptr %21, i32 0, i32 1
  invoke void @_ZN3Int6ModSubEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %11, ptr noundef %20, ptr noundef %22)
          to label %23 unwind label %52

23:                                               ; preds = %18
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = getelementptr inbounds %class.Point, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = getelementptr inbounds %class.Point, ptr %26, i32 0, i32 0
  invoke void @_ZN3Int6ModSubEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %12, ptr noundef %25, ptr noundef %27)
          to label %28 unwind label %52

28:                                               ; preds = %23
  invoke void @_ZN3Int6ModInvEv(ptr noundef nonnull align 8 dereferenceable(40) %12)
          to label %29 unwind label %52

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

30:                                               ; preds = %29
  invoke void @_ZN3Int11ModSquareK1EPS_(ptr noundef nonnull align 8 dereferenceable(40) %10, ptr noundef %9)
          to label %31 unwind label %52

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

35:                                               ; preds = %31
  %36 = getelementptr inbounds %class.Point, ptr %0, i32 0, i32 0
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = getelementptr inbounds %class.Point, ptr %37, i32 0, i32 0
  invoke void @_ZN3Int6ModSubEPS_(ptr noundef nonnull align 8 dereferenceable(40) %36, ptr noundef %38)
          to label %39 unwind label %52

39:                                               ; preds = %35
  %40 = getelementptr inbounds %class.Point, ptr %0, i32 0, i32 1
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = getelementptr inbounds %class.Point, ptr %41, i32 0, i32 0
  %43 = getelementptr inbounds %class.Point, ptr %0, i32 0, i32 0
  invoke void @_ZN3Int6ModSubEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %40, ptr noundef %42, ptr noundef %43)
          to label %44 unwind label %52

44:                                               ; preds = %39
  %45 = getelementptr inbounds %class.Point, ptr %0, i32 0, i32 1
  invoke void @_ZN3Int8ModMulK1EPS_(ptr noundef nonnull align 8 dereferenceable(40) %45, ptr noundef %9)
          to label %46 unwind label %52

46:                                               ; preds = %44
  %47 = getelementptr inbounds %class.Point, ptr %0, i32 0, i32 1
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = getelementptr inbounds %class.Point, ptr %48, i32 0, i32 1
  invoke void @_ZN3Int6ModSubEPS_(ptr noundef nonnull align 8 dereferenceable(40) %47, ptr noundef %49)
          to label %50 unwind label %52

50:                                               ; preds = %46
  store i1 true, ptr %13, align 1
  %51 = load i1, ptr %13, align 1
  br i1 %51, label %57, label %56

52:                                               ; preds = %46, %44, %39, %35, %31, %30, %29, %28, %23, %18, %4
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %14, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %15, align 4
  call void @_ZN5PointD1Ev(ptr noundef nonnull align 8 dereferenceable(120) %0) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %9) #4
  br label %58

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

57:                                               ; preds = %56, %50
  call void @llvm.lifetime.end.p0(i64 40, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %9) #4
  ret void

58:                                               ; preds = %52
  %59 = load ptr, ptr %14, align 8
  %60 = load i32, ptr %15, align 4
  %61 = insertvalue { ptr, i32 } poison, ptr %59, 0
  %62 = insertvalue { ptr, i32 } %61, i32 %60, 1
  resume { ptr, i32 } %62
}

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 @_ZN3Int11ModSquareK1EPS_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) #0

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

declare void @_ZN3Int8ModMulK1EPS_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9Secp256K19AddDirectER5PointS1_(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, ptr noundef nonnull align 8 dereferenceable(120) %3) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %class.Int, align 8
  %6 = alloca %class.Int, align 8
  %7 = alloca %class.Int, align 8
  %8 = alloca %class.Int, align 8
  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 @llvm.lifetime.start.p0(i64 40, ptr nonnull %7) #4
  call void @_ZN3IntC1Ev(ptr noundef nonnull align 8 dereferenceable(40) %7)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %8) #4
  call void @_ZN3IntC1Ev(ptr noundef nonnull align 8 dereferenceable(40) %8)
  call void @_ZN5PointC1Ev(ptr noundef nonnull align 8 dereferenceable(120) %0)
  %9 = getelementptr inbounds i8, ptr %0, i64 80
  invoke void @_ZN3Int8SetInt32Ej(ptr noundef nonnull align 8 dereferenceable(40) %9, i32 noundef 1)
          to label %10 unwind label %23

10:                                               ; preds = %4
  %11 = getelementptr inbounds i8, ptr %3, i64 40
  %12 = getelementptr inbounds i8, ptr %2, i64 40
  invoke void @_ZN3Int6ModSubEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %7, ptr noundef nonnull %11, ptr noundef nonnull %12)
          to label %13 unwind label %23

13:                                               ; preds = %10
  invoke void @_ZN3Int6ModSubEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %8, ptr noundef nonnull %3, ptr noundef nonnull %2)
          to label %14 unwind label %23

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

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

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

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

18:                                               ; preds = %17
  invoke void @_ZN3Int6ModSubEPS_(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull %3)
          to label %19 unwind label %23

19:                                               ; preds = %18
  %20 = getelementptr inbounds i8, ptr %0, i64 40
  invoke void @_ZN3Int6ModSubEPS_S0_(ptr noundef nonnull align 8 dereferenceable(40) %20, ptr noundef nonnull %3, ptr noundef nonnull %0)
          to label %21 unwind label %23

21:                                               ; preds = %19
  invoke void @_ZN3Int8ModMulK1EPS_(ptr noundef nonnull align 8 dereferenceable(40) %20, ptr noundef nonnull %5)
          to label %22 unwind label %23

22:                                               ; preds = %21
  invoke void @_ZN3Int6ModSubEPS_(ptr noundef nonnull align 8 dereferenceable(40) %20, ptr noundef nonnull %11)
          to label %25 unwind label %23

23:                                               ; preds = %22, %21, %19, %18, %17, %16, %15, %14, %13, %10, %4
  %24 = 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 %8) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %7) #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
  resume { ptr, i32 } %24

25:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %7) #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
  ret void
}

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 @_ZN3Int11ModSquareK1EPS_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) local_unnamed_addr #0

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

declare void @_ZN3Int8ModMulK1EPS_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef) 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