; LLVM IR from bqi343/cp-notebook :: Contests/Other Solutions/VT HSPC/2017/Criss-Cross.ll (Z3getSt4pairIS_IxxExES1_S1_S1_)

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

%"struct.std::pair.0" = type { %"struct.std::pair", i64 }
%"struct.std::pair" = type { i64, i64 }

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt3absx(i64 noundef) #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 nounwind uwtable
declare dso_local void @_ZmlxSt4pairIS_IxxExE(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.0") align 8, i64 noundef, ptr noundef byval(%"struct.std::pair.0") align 8) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZdvSt4pairIS_IxxExEx(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8, i64 noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZplSt4pairIS_IxxExES1_(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef byval(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3getSt4pairIS_IxxExES1_S1_S1_(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.0") align 8 %0, ptr noundef byval(%"struct.std::pair.0") align 8 %1, ptr noundef byval(%"struct.std::pair.0") align 8 %2, ptr noundef byval(%"struct.std::pair.0") align 8 %3, ptr noundef byval(%"struct.std::pair.0") align 8 %4) #3 {
  %6 = alloca %"struct.std::pair.0", align 8
  %7 = alloca %"struct.std::pair.0", align 8
  %8 = alloca %"struct.std::pair.0", align 8
  %9 = alloca %"struct.std::pair.0", align 8
  %10 = alloca %"struct.std::pair.0", align 8
  %11 = alloca %"struct.std::pair.0", align 8
  %12 = alloca %"struct.std::pair.0", align 8
  %13 = alloca %"struct.std::pair.0", align 8
  %14 = alloca %"struct.std::pair.0", align 8
  %15 = alloca %"struct.std::pair.0", align 8
  %16 = alloca %"struct.std::pair.0", align 8
  %17 = alloca %"struct.std::pair.0", align 8
  %18 = alloca %"struct.std::pair.0", align 8
  %19 = alloca %"struct.std::pair.0", align 8
  %20 = alloca %"struct.std::pair.0", align 8
  %21 = alloca %"struct.std::pair.0", align 8
  %22 = alloca %"struct.std::pair.0", align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %1, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %2, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %3, i64 24, i1 false)
  %23 = call noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef byval(%"struct.std::pair.0") align 8 %8, ptr noundef byval(%"struct.std::pair.0") align 8 %9, ptr noundef byval(%"struct.std::pair.0") align 8 %10)
  %24 = call noundef i64 @_ZSt3absx(i64 noundef %23)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %4, i64 24, i1 false)
  call void @_ZmlxSt4pairIS_IxxExE(ptr dead_on_unwind writable sret(%"struct.std::pair.0") align 8 %7, i64 noundef %24, ptr noundef byval(%"struct.std::pair.0") align 8 %11)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %13, ptr align 8 %1, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %14, ptr align 8 %2, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 %4, i64 24, i1 false)
  %25 = call noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef byval(%"struct.std::pair.0") align 8 %13, ptr noundef byval(%"struct.std::pair.0") align 8 %14, ptr noundef byval(%"struct.std::pair.0") align 8 %15)
  %26 = call noundef i64 @_ZSt3absx(i64 noundef %25)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %16, ptr align 8 %3, i64 24, i1 false)
  call void @_ZmlxSt4pairIS_IxxExE(ptr dead_on_unwind writable sret(%"struct.std::pair.0") align 8 %12, i64 noundef %26, ptr noundef byval(%"struct.std::pair.0") align 8 %16)
  call void @_ZplSt4pairIS_IxxExES1_(ptr dead_on_unwind writable sret(%"struct.std::pair.0") align 8 %6, ptr noundef byval(%"struct.std::pair.0") align 8 %7, ptr noundef byval(%"struct.std::pair.0") align 8 %12)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %17, ptr align 8 %1, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 8 %2, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 %3, i64 24, i1 false)
  %27 = call noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef byval(%"struct.std::pair.0") align 8 %17, ptr noundef byval(%"struct.std::pair.0") align 8 %18, ptr noundef byval(%"struct.std::pair.0") align 8 %19)
  %28 = call noundef i64 @_ZSt3absx(i64 noundef %27)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 %1, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %21, ptr align 8 %2, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %22, ptr align 8 %4, i64 24, i1 false)
  %29 = call noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef byval(%"struct.std::pair.0") align 8 %20, ptr noundef byval(%"struct.std::pair.0") align 8 %21, ptr noundef byval(%"struct.std::pair.0") align 8 %22)
  %30 = call noundef i64 @_ZSt3absx(i64 noundef %29)
  %31 = add nsw i64 %28, %30
  call void @_ZdvSt4pairIS_IxxExEx(ptr dead_on_unwind writable sret(%"struct.std::pair.0") align 8 %0, ptr noundef byval(%"struct.std::pair.0") align 8 %6, i64 noundef %31)
  ret void
}

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

!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)"}


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

%"struct.std::pair.0" = type { %"struct.std::pair", i64 }
%"struct.std::pair" = type { i64, i64 }

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt3absx(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZmlxSt4pairIS_IxxExE(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.0") align 8, i64 noundef, ptr noundef byval(%"struct.std::pair.0") align 8) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZdvSt4pairIS_IxxExEx(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZplSt4pairIS_IxxExES1_(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef byval(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3getSt4pairIS_IxxExES1_S1_S1_(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.0") align 8 %0, ptr nocapture noundef readonly byval(%"struct.std::pair.0") align 8 %1, ptr nocapture noundef readonly byval(%"struct.std::pair.0") align 8 %2, ptr nocapture noundef readonly byval(%"struct.std::pair.0") align 8 %3, ptr nocapture noundef readonly byval(%"struct.std::pair.0") align 8 %4) local_unnamed_addr #2 {
  %6 = alloca %"struct.std::pair.0", align 8
  %7 = alloca %"struct.std::pair.0", align 8
  %8 = alloca %"struct.std::pair.0", align 8
  %9 = tail call noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef nonnull byval(%"struct.std::pair.0") align 8 %1, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 %2, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 %3)
  %10 = tail call noundef i64 @_ZSt3absx(i64 noundef %9)
  call void @_ZmlxSt4pairIS_IxxExE(ptr dead_on_unwind nonnull writable sret(%"struct.std::pair.0") align 8 %7, i64 noundef %10, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 %4)
  %11 = call noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef nonnull byval(%"struct.std::pair.0") align 8 %1, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 %2, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 %4)
  %12 = call noundef i64 @_ZSt3absx(i64 noundef %11)
  call void @_ZmlxSt4pairIS_IxxExE(ptr dead_on_unwind nonnull writable sret(%"struct.std::pair.0") align 8 %8, i64 noundef %12, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 %3)
  call void @_ZplSt4pairIS_IxxExES1_(ptr dead_on_unwind nonnull writable sret(%"struct.std::pair.0") align 8 %6, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 %7, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 %8)
  %13 = call noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef nonnull byval(%"struct.std::pair.0") align 8 %1, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 %2, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 %3)
  %14 = call noundef i64 @_ZSt3absx(i64 noundef %13)
  %15 = call noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef nonnull byval(%"struct.std::pair.0") align 8 %1, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 %2, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 %4)
  %16 = call noundef i64 @_ZSt3absx(i64 noundef %15)
  %17 = add nsw i64 %16, %14
  call void @_ZdvSt4pairIS_IxxExEx(ptr dead_on_unwind writable sret(%"struct.std::pair.0") align 8 %0, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 %6, i64 noundef %17)
  ret void
}

attributes #0 = { inlinehint mustprogress 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 #1 = { mustprogress 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 = { 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" }

!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: DSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,TailCallElimPass