; LLVM IR from Izaron/ACM-ICPC :: Timus Online Judge/Volume 11/2014. Zhenya moves from parents.ll (Z7getTimev)

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

@as = external dso_local global [6 x i8], align 1
@bs = external dso_local global [6 x i8], align 1
@.str = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z7getTimev() #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @as)
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @bs)
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #3
  %7 = load i8, ptr @as, align 1, !tbaa !5
  %8 = sext i8 %7 to i32
  %9 = sub nsw i32 %8, 48
  %10 = mul nsw i32 %9, 10
  %11 = load i8, ptr getelementptr inbounds ([6 x i8], ptr @as, i64 0, i64 1), align 1, !tbaa !5
  %12 = sext i8 %11 to i32
  %13 = sub nsw i32 %12, 48
  %14 = add nsw i32 %10, %13
  %15 = sext i32 %14 to i64
  store i64 %15, ptr %1, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  %16 = load i8, ptr getelementptr inbounds ([6 x i8], ptr @as, i64 0, i64 3), align 1, !tbaa !5
  %17 = sext i8 %16 to i32
  %18 = sub nsw i32 %17, 48
  %19 = mul nsw i32 %18, 10
  %20 = load i8, ptr getelementptr inbounds ([6 x i8], ptr @as, i64 0, i64 4), align 1, !tbaa !5
  %21 = sext i8 %20 to i32
  %22 = sub nsw i32 %21, 48
  %23 = add nsw i32 %19, %22
  %24 = sext i32 %23 to i64
  store i64 %24, ptr %2, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %25 = load i8, ptr @bs, align 1, !tbaa !5
  %26 = sext i8 %25 to i32
  %27 = sub nsw i32 %26, 48
  %28 = mul nsw i32 %27, 10
  %29 = load i8, ptr getelementptr inbounds ([6 x i8], ptr @bs, i64 0, i64 1), align 1, !tbaa !5
  %30 = sext i8 %29 to i32
  %31 = sub nsw i32 %30, 48
  %32 = add nsw i32 %28, %31
  %33 = sext i32 %32 to i64
  store i64 %33, ptr %3, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %34 = load i8, ptr getelementptr inbounds ([6 x i8], ptr @bs, i64 0, i64 3), align 1, !tbaa !5
  %35 = sext i8 %34 to i32
  %36 = sub nsw i32 %35, 48
  %37 = mul nsw i32 %36, 10
  %38 = load i8, ptr getelementptr inbounds ([6 x i8], ptr @bs, i64 0, i64 4), align 1, !tbaa !5
  %39 = sext i8 %38 to i32
  %40 = sub nsw i32 %39, 48
  %41 = add nsw i32 %37, %40
  %42 = sext i32 %41 to i64
  store i64 %42, ptr %4, align 8, !tbaa !8
  %43 = load i64, ptr %4, align 8, !tbaa !8
  %44 = load i64, ptr %3, align 8, !tbaa !8
  %45 = mul nsw i64 %44, 60
  %46 = add nsw i64 %43, %45
  %47 = load i64, ptr %1, align 8, !tbaa !8
  %48 = mul nsw i64 %47, 60
  %49 = mul nsw i64 %48, 24
  %50 = add nsw i64 %46, %49
  %51 = load i64, ptr %2, align 8, !tbaa !8
  %52 = mul nsw i64 %51, 60
  %53 = mul nsw i64 %52, 24
  %54 = mul nsw i64 %53, 32
  %55 = add nsw i64 %50, %54
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #3
  ret i64 %55
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #1

; 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

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 = { "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 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !6, 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"

@as = external dso_local global [6 x i8], align 1
@bs = external dso_local global [6 x i8], align 1
@.str = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nofree nounwind uwtable
define dso_local noundef range(i64 -92116816, 41347890) i64 @_Z7getTimev() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @as)
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @bs)
  %3 = load i8, ptr @as, align 1, !tbaa !5
  %4 = sext i8 %3 to i64
  %5 = mul nsw i64 %4, 10
  %6 = load i8, ptr getelementptr inbounds (i8, ptr @as, i64 1), align 1, !tbaa !5
  %7 = sext i8 %6 to i64
  %8 = add nsw i64 %5, %7
  %9 = load i8, ptr getelementptr inbounds (i8, ptr @as, i64 3), align 1, !tbaa !5
  %10 = sext i8 %9 to i64
  %11 = mul nsw i64 %10, 10
  %12 = load i8, ptr getelementptr inbounds (i8, ptr @as, i64 4), align 1, !tbaa !5
  %13 = sext i8 %12 to i64
  %14 = add nsw i64 %11, %13
  %15 = load i8, ptr @bs, align 1, !tbaa !5
  %16 = sext i8 %15 to i64
  %17 = mul nsw i64 %16, 10
  %18 = load i8, ptr getelementptr inbounds (i8, ptr @bs, i64 1), align 1, !tbaa !5
  %19 = sext i8 %18 to i64
  %20 = add nsw i64 %17, %19
  %21 = load i8, ptr getelementptr inbounds (i8, ptr @bs, i64 3), align 1, !tbaa !5
  %22 = sext i8 %21 to i64
  %23 = mul nsw i64 %22, 10
  %24 = load i8, ptr getelementptr inbounds (i8, ptr @bs, i64 4), align 1, !tbaa !5
  %25 = sext i8 %24 to i64
  %26 = mul nsw i64 %20, 60
  %27 = mul nsw i64 %8, 1440
  %28 = mul nsw i64 %14, 46080
  %29 = add nsw i64 %27, -25122768
  %30 = add nsw i64 %29, %28
  %31 = add nsw i64 %30, %25
  %32 = add nsw i64 %31, %23
  %33 = add nsw i64 %32, %26
  ret i64 %33
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,TailCallElimPass