; LLVM IR from wiktorowski211/deeds-registration :: deeds/libs/deedsBCV0.ll (Z7newEdge4EdgeRS_Pb)

; 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.Edge = type { double, i32, i32 }

; 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z7newEdge4EdgeRS_Pb(double %0, i64 %1, ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef %3) #2 {
  %5 = alloca %class.Edge, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca i8, align 1
  %10 = alloca i32, align 4
  %11 = alloca %class.Edge, align 8
  %12 = alloca %class.Edge, align 8
  %13 = getelementptr inbounds { double, i64 }, ptr %5, i32 0, i32 0
  store double %0, ptr %13, align 8
  %14 = getelementptr inbounds { double, i64 }, ptr %5, i32 0, i32 1
  store i64 %1, ptr %14, align 8
  store ptr %2, ptr %6, align 8, !tbaa !5
  store ptr %3, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #3
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = getelementptr inbounds %class.Edge, ptr %5, i32 0, i32 1
  %17 = load i32, ptr %16, align 8, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds i8, ptr %15, i64 %18
  %20 = load i8, ptr %19, align 1, !tbaa !13, !range !15, !noundef !16
  %21 = trunc i8 %20 to i1
  %22 = zext i1 %21 to i8
  store i8 %22, ptr %8, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #3
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds %class.Edge, ptr %5, i32 0, i32 2
  %25 = load i32, ptr %24, align 4, !tbaa !17
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds i8, ptr %23, i64 %26
  %28 = load i8, ptr %27, align 1, !tbaa !13, !range !15, !noundef !16
  %29 = trunc i8 %28 to i1
  %30 = zext i1 %29 to i8
  store i8 %30, ptr %9, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %31 = load i8, ptr %8, align 1, !tbaa !13, !range !15, !noundef !16
  %32 = trunc i8 %31 to i1
  %33 = zext i1 %32 to i32
  %34 = load i8, ptr %9, align 1, !tbaa !13, !range !15, !noundef !16
  %35 = trunc i8 %34 to i1
  %36 = zext i1 %35 to i32
  %37 = xor i32 %33, %36
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %63

39:                                               ; preds = %4
  %40 = load i8, ptr %8, align 1, !tbaa !13, !range !15, !noundef !16
  %41 = trunc i8 %40 to i1
  br i1 %41, label %42, label %52

42:                                               ; preds = %39
  %43 = getelementptr inbounds %class.Edge, ptr %5, i32 0, i32 2
  %44 = load i32, ptr %43, align 4, !tbaa !17
  store i32 %44, ptr %10, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #3
  %45 = getelementptr inbounds %class.Edge, ptr %5, i32 0, i32 0
  %46 = load double, ptr %45, align 8, !tbaa !19
  %47 = getelementptr inbounds %class.Edge, ptr %5, i32 0, i32 1
  %48 = load i32, ptr %47, align 8, !tbaa !9
  %49 = getelementptr inbounds %class.Edge, ptr %5, i32 0, i32 2
  %50 = load i32, ptr %49, align 4, !tbaa !17
  call void @_ZN4EdgeC1Edii(ptr noundef nonnull align 8 dereferenceable(16) %11, double noundef %46, i32 noundef %48, i32 noundef %50)
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %51, ptr align 8 %11, i64 16, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #3
  br label %62

52:                                               ; preds = %39
  %53 = getelementptr inbounds %class.Edge, ptr %5, i32 0, i32 1
  %54 = load i32, ptr %53, align 8, !tbaa !9
  store i32 %54, ptr %10, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #3
  %55 = getelementptr inbounds %class.Edge, ptr %5, i32 0, i32 0
  %56 = load double, ptr %55, align 8, !tbaa !19
  %57 = getelementptr inbounds %class.Edge, ptr %5, i32 0, i32 2
  %58 = load i32, ptr %57, align 4, !tbaa !17
  %59 = getelementptr inbounds %class.Edge, ptr %5, i32 0, i32 1
  %60 = load i32, ptr %59, align 8, !tbaa !9
  call void @_ZN4EdgeC1Edii(ptr noundef nonnull align 8 dereferenceable(16) %12, double noundef %56, i32 noundef %58, i32 noundef %60)
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %61, ptr align 8 %12, i64 16, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #3
  br label %62

62:                                               ; preds = %52, %42
  br label %64

63:                                               ; preds = %4
  store i32 -1, ptr %10, align 4, !tbaa !18
  br label %64

64:                                               ; preds = %63, %62
  %65 = load i32, ptr %10, align 4, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #3
  ret i32 %65
}

declare void @_ZN4EdgeC1Edii(ptr, double, i32, i32)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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"}
!9 = !{!10, !12, i64 8}
!10 = !{!"_ZTS4Edge", !11, i64 0, !12, i64 8, !12, i64 12}
!11 = !{!"double", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!10, !12, i64 12}
!18 = !{!12, !12, i64 0}
!19 = !{!10, !11, i64 0}
!20 = !{i64 0, i64 8, !21, i64 8, i64 4, !18, i64 12, i64 4, !18}
!21 = !{!11, !11, i64 0}


; 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.Edge = type { double, i32, i32 }

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z7newEdge4EdgeRS_Pb(double %0, i64 %1, ptr nocapture noundef nonnull writeonly align 8 dereferenceable(16) %2, ptr nocapture noundef readonly %3) local_unnamed_addr #2 {
  %5 = alloca %class.Edge, align 8
  %6 = alloca %class.Edge, align 8
  %.sroa.3.8.extract.trunc = trunc i64 %1 to i32
  %.sroa.8.8.extract.shift = lshr i64 %1, 32
  %.sroa.8.8.extract.trunc = trunc nuw i64 %.sroa.8.8.extract.shift to i32
  %sext = shl i64 %1, 32
  %7 = ashr exact i64 %sext, 32
  %8 = getelementptr inbounds i8, ptr %3, i64 %7
  %9 = load i8, ptr %8, align 1, !tbaa !5, !range !9, !noundef !10
  %10 = ashr i64 %1, 32
  %11 = getelementptr inbounds i8, ptr %3, i64 %10
  %12 = load i8, ptr %11, align 1, !tbaa !5, !range !9, !noundef !10
  %.not = icmp eq i8 %9, %12
  br i1 %.not, label %17, label %13

13:                                               ; preds = %4
  %14 = trunc nuw i8 %9 to i1
  br i1 %14, label %15, label %16

15:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #3
  call void @_ZN4EdgeC1Edii(ptr noundef nonnull align 8 dereferenceable(16) %5, double noundef %0, i32 noundef %.sroa.3.8.extract.trunc, i32 noundef %.sroa.8.8.extract.trunc)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %5, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #3
  br label %17

16:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #3
  call void @_ZN4EdgeC1Edii(ptr noundef nonnull align 8 dereferenceable(16) %6, double noundef %0, i32 noundef %.sroa.8.8.extract.trunc, i32 noundef %.sroa.3.8.extract.trunc)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %6, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #3
  br label %17

17:                                               ; preds = %4, %15, %16
  %.0 = phi i32 [ %.sroa.8.8.extract.trunc, %15 ], [ %.sroa.3.8.extract.trunc, %16 ], [ -1, %4 ]
  ret i32 %.0
}

declare void @_ZN4EdgeC1Edii(ptr, double, i32, i32) local_unnamed_addr

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{i8 0, i8 2}
!10 = !{}
!11 = !{i64 0, i64 8, !12, i64 8, i64 4, !14, i64 12, i64 4, !14}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}


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