; LLVM IR from xirc/cp-algorithm :: atcoder/abc095/C/main.ll (Z5solvev)

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

@A = external dso_local global i32, align 4
@B = external dso_local global i32, align 4
@C = external dso_local global i32, align 4
@X = external dso_local global i32, align 4
@Y = external dso_local global i32, align 4

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z5solvev() #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  %10 = call noundef i64 @_ZNSt14numeric_limitsIxE3maxEv() #4
  store i64 %10, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %11 = load i32, ptr @C, align 4, !tbaa !9
  %12 = sext i32 %11 to i64
  %13 = mul nsw i64 %12, 2
  %14 = load i32, ptr @X, align 4, !tbaa !9
  %15 = sext i32 %14 to i64
  %16 = mul nsw i64 %13, %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %17 = load i32, ptr @Y, align 4, !tbaa !9
  %18 = load i32, ptr @X, align 4, !tbaa !9
  %19 = sub nsw i32 %17, %18
  store i32 %19, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !9
  %20 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %21 = load i32, ptr %20, align 4, !tbaa !9
  %22 = load i32, ptr @B, align 4, !tbaa !9
  %23 = mul nsw i32 %21, %22
  %24 = sext i32 %23 to i64
  %25 = add nsw i64 %16, %24
  store i64 %25, ptr %2, align 8, !tbaa !5
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %27 = load i64, ptr %26, align 8, !tbaa !5
  store i64 %27, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %28 = load i32, ptr @C, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = mul nsw i64 %29, 2
  %31 = load i32, ptr @Y, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = mul nsw i64 %30, %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %34 = load i32, ptr @X, align 4, !tbaa !9
  %35 = load i32, ptr @Y, align 4, !tbaa !9
  %36 = sub nsw i32 %34, %35
  store i32 %36, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  %37 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %38 = load i32, ptr %37, align 4, !tbaa !9
  %39 = load i32, ptr @A, align 4, !tbaa !9
  %40 = mul nsw i32 %38, %39
  %41 = sext i32 %40 to i64
  %42 = add nsw i64 %33, %41
  store i64 %42, ptr %5, align 8, !tbaa !5
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %44 = load i64, ptr %43, align 8, !tbaa !5
  store i64 %44, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %45 = load i32, ptr @C, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = mul nsw i64 %46, 2
  %48 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @X, ptr noundef nonnull align 4 dereferenceable(4) @Y)
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = mul nsw i64 %47, %50
  %52 = load i32, ptr @X, align 4, !tbaa !9
  %53 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @X, ptr noundef nonnull align 4 dereferenceable(4) @Y)
  %54 = load i32, ptr %53, align 4, !tbaa !9
  %55 = sub nsw i32 %52, %54
  %56 = load i32, ptr @A, align 4, !tbaa !9
  %57 = mul nsw i32 %55, %56
  %58 = sext i32 %57 to i64
  %59 = add nsw i64 %51, %58
  %60 = load i32, ptr @Y, align 4, !tbaa !9
  %61 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @X, ptr noundef nonnull align 4 dereferenceable(4) @Y)
  %62 = load i32, ptr %61, align 4, !tbaa !9
  %63 = sub nsw i32 %60, %62
  %64 = load i32, ptr @B, align 4, !tbaa !9
  %65 = mul nsw i32 %63, %64
  %66 = sext i32 %65 to i64
  %67 = add nsw i64 %59, %66
  store i64 %67, ptr %8, align 8, !tbaa !5
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %69 = load i64, ptr %68, align 8, !tbaa !5
  store i64 %69, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %70 = load i32, ptr @A, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = load i32, ptr @X, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = mul nsw i64 %71, %73
  %75 = load i32, ptr @B, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = load i32, ptr @Y, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = mul nsw i64 %76, %78
  %80 = add nsw i64 %74, %79
  store i64 %80, ptr %9, align 8, !tbaa !5
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %82 = load i64, ptr %81, align 8, !tbaa !5
  store i64 %82, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %83 = load i64, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret i64 %83
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt14numeric_limitsIxE3maxEv() #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

attributes #0 = { 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 #1 = { nocallback nofree nosync 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 = { 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 #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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, 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"

@A = external dso_local local_unnamed_addr global i32, align 4
@B = external dso_local local_unnamed_addr global i32, align 4
@C = external dso_local local_unnamed_addr global i32, align 4
@X = external dso_local global i32, align 4
@Y = external dso_local global i32, align 4

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i64 @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #3
  %10 = tail call noundef i64 @_ZNSt14numeric_limitsIxE3maxEv() #3
  store i64 %10, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  %11 = load i32, ptr @C, align 4, !tbaa !9
  %12 = sext i32 %11 to i64
  %13 = shl nsw i64 %12, 1
  %14 = load i32, ptr @X, align 4, !tbaa !9
  %15 = sext i32 %14 to i64
  %16 = mul nsw i64 %13, %15
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #3
  %17 = load i32, ptr @Y, align 4, !tbaa !9
  %18 = sub nsw i32 %17, %14
  store i32 %18, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #3
  store i32 0, ptr %4, align 4, !tbaa !9
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %20 = load i32, ptr %19, align 4, !tbaa !9
  %21 = load i32, ptr @B, align 4, !tbaa !9
  %22 = mul nsw i32 %21, %20
  %23 = sext i32 %22 to i64
  %24 = add nsw i64 %16, %23
  store i64 %24, ptr %2, align 8, !tbaa !5
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %26 = load i64, ptr %25, align 8, !tbaa !5
  store i64 %26, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %27 = load i32, ptr @C, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = shl nsw i64 %28, 1
  %30 = load i32, ptr @Y, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = mul nsw i64 %29, %31
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #3
  %33 = load i32, ptr @X, align 4, !tbaa !9
  %34 = sub nsw i32 %33, %30
  store i32 %34, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #3
  store i32 0, ptr %7, align 4, !tbaa !9
  %35 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %36 = load i32, ptr %35, align 4, !tbaa !9
  %37 = load i32, ptr @A, align 4, !tbaa !9
  %38 = mul nsw i32 %37, %36
  %39 = sext i32 %38 to i64
  %40 = add nsw i64 %32, %39
  store i64 %40, ptr %5, align 8, !tbaa !5
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %42 = load i64, ptr %41, align 8, !tbaa !5
  store i64 %42, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  %43 = load i32, ptr @C, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = shl nsw i64 %44, 1
  %46 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @X, ptr noundef nonnull align 4 dereferenceable(4) @Y)
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = mul nsw i64 %45, %48
  %50 = load i32, ptr @X, align 4, !tbaa !9
  %51 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @X, ptr noundef nonnull align 4 dereferenceable(4) @Y)
  %52 = load i32, ptr %51, align 4, !tbaa !9
  %53 = sub nsw i32 %50, %52
  %54 = load i32, ptr @A, align 4, !tbaa !9
  %55 = mul nsw i32 %53, %54
  %56 = sext i32 %55 to i64
  %57 = add nsw i64 %49, %56
  %58 = load i32, ptr @Y, align 4, !tbaa !9
  %59 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @X, ptr noundef nonnull align 4 dereferenceable(4) @Y)
  %60 = load i32, ptr %59, align 4, !tbaa !9
  %61 = sub nsw i32 %58, %60
  %62 = load i32, ptr @B, align 4, !tbaa !9
  %63 = mul nsw i32 %61, %62
  %64 = sext i32 %63 to i64
  %65 = add nsw i64 %57, %64
  store i64 %65, ptr %8, align 8, !tbaa !5
  %66 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %67 = load i64, ptr %66, align 8, !tbaa !5
  store i64 %67, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #3
  %68 = load i32, ptr @A, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = load i32, ptr @X, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = mul nsw i64 %71, %69
  %73 = load i32, ptr @B, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = load i32, ptr @Y, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = mul nsw i64 %76, %74
  %78 = add nsw i64 %77, %72
  store i64 %78, ptr %9, align 8, !tbaa !5
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %80 = load i64, ptr %79, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #3
  ret i64 %80
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt14numeric_limitsIxE3maxEv() local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

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


; Effective O3 passes: DSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,TailCallElimPass