program interval_running
  implicit none
  integer(8) :: t(2), a(2), b(2), p, q, x, y
  read(*,*) t
  read(*,*) a
  read(*,*) b
  p = (a(1)-b(1))*t(1)
  q = (a(2)-b(2))*t(2)
  if (p > 0_8) then
    p = -p
    q = -q
  end if
  if (p+q < 0_8) then
    write(*,'(i0)') 0
    stop
  else if (p+q == 0_8) then
    write(*,'(a)') "infinity"
    stop
  end if
  x = -p/(p+q)
  y = min(mod(-p,p+q),1_8)
  write(*,'(i0)') 2_8*x+y
end program interval_running
; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QQcl.6e72e1047a4d6b300cfff3802284b837 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_2907/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQcl.286129 = linkonce constant [3 x i8] c"(a)"
@_QQcl.696E66696E697479 = linkonce constant [8 x i8] c"infinity"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %3 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %4 = alloca [2 x i64], align 8
  %5 = alloca [2 x i64], align 8
  %6 = alloca [2 x i64], align 8
  %7 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.6e72e1047a4d6b300cfff3802284b837, i32 4)
  store ptr %6, ptr %3, align 8, !tbaa !3
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %3, i64 0, i32 1
  store i64 8, ptr %.fca.1.gep, align 8, !tbaa !3
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %3, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !3
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %3, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !3
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %3, i64 0, i32 4
  store i8 10, ptr %.fca.4.gep, align 1, !tbaa !3
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %3, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !3
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %3, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !3
  %.fca.7.0.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %3, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !3
  %.fca.7.0.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %3, i64 0, i32 7, i64 0, i64 1
  store i64 2, ptr %.fca.7.0.1.gep, align 8, !tbaa !3
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %3, i64 0, i32 7, i64 0, i64 2
  store i64 8, ptr %.fca.7.0.2.gep, align 8, !tbaa !3
  %8 = call i1 @_FortranAioInputDescriptor(ptr %7, ptr nonnull %3)
  %9 = call i32 @_FortranAioEndIoStatement(ptr %7)
  %10 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.6e72e1047a4d6b300cfff3802284b837, i32 5)
  store ptr %4, ptr %2, align 8, !tbaa !3
  %.fca.1.gep16 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 1
  store i64 8, ptr %.fca.1.gep16, align 8, !tbaa !3
  %.fca.2.gep18 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep18, align 8, !tbaa !3
  %.fca.3.gep20 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep20, align 4, !tbaa !3
  %.fca.4.gep22 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 4
  store i8 10, ptr %.fca.4.gep22, align 1, !tbaa !3
  %.fca.5.gep24 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep24, align 2, !tbaa !3
  %.fca.6.gep26 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep26, align 1, !tbaa !3
  %.fca.7.0.0.gep28 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep28, align 8, !tbaa !3
  %.fca.7.0.1.gep30 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 7, i64 0, i64 1
  store i64 2, ptr %.fca.7.0.1.gep30, align 8, !tbaa !3
  %.fca.7.0.2.gep32 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, i64 0, i32 7, i64 0, i64 2
  store i64 8, ptr %.fca.7.0.2.gep32, align 8, !tbaa !3
  %11 = call i1 @_FortranAioInputDescriptor(ptr %10, ptr nonnull %2)
  %12 = call i32 @_FortranAioEndIoStatement(ptr %10)
  %13 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.6e72e1047a4d6b300cfff3802284b837, i32 6)
  store ptr %5, ptr %1, align 8, !tbaa !3
  %.fca.1.gep36 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  store i64 8, ptr %.fca.1.gep36, align 8, !tbaa !3
  %.fca.2.gep38 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep38, align 8, !tbaa !3
  %.fca.3.gep40 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep40, align 4, !tbaa !3
  %.fca.4.gep42 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 10, ptr %.fca.4.gep42, align 1, !tbaa !3
  %.fca.5.gep44 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep44, align 2, !tbaa !3
  %.fca.6.gep46 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep46, align 1, !tbaa !3
  %.fca.7.0.0.gep48 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep48, align 8, !tbaa !3
  %.fca.7.0.1.gep50 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  store i64 2, ptr %.fca.7.0.1.gep50, align 8, !tbaa !3
  %.fca.7.0.2.gep52 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 2
  store i64 8, ptr %.fca.7.0.2.gep52, align 8, !tbaa !3
  %14 = call i1 @_FortranAioInputDescriptor(ptr %13, ptr nonnull %1)
  %15 = call i32 @_FortranAioEndIoStatement(ptr %13)
  %16 = load i64, ptr %4, align 8, !tbaa !7
  %17 = load i64, ptr %5, align 8, !tbaa !7
  %18 = sub i64 %16, %17
  %19 = load i64, ptr %6, align 8, !tbaa !7
  %20 = mul i64 %18, %19
  %21 = getelementptr inbounds [2 x i64], ptr %4, i64 0, i64 1
  %22 = load i64, ptr %21, align 8, !tbaa !7
  %23 = getelementptr inbounds [2 x i64], ptr %5, i64 0, i64 1
  %24 = load i64, ptr %23, align 8, !tbaa !7
  %25 = sub i64 %22, %24
  %26 = getelementptr inbounds [2 x i64], ptr %6, i64 0, i64 1
  %27 = load i64, ptr %26, align 8, !tbaa !7
  %28 = mul i64 %25, %27
  %29 = icmp sgt i64 %20, 0
  %30 = sub i64 0, %28
  %.053 = select i1 %29, i64 %30, i64 %28
  %31 = call i64 @llvm.abs.i64(i64 %20, i1 false)
  %32 = sub i64 %.053, %31
  %33 = icmp slt i64 %32, 0
  br i1 %33, label %34, label %39

34:                                               ; preds = %0
  %35 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.6e72e1047a4d6b300cfff3802284b837, i32 14)
  %36 = call i1 @_FortranAioOutputInteger32(ptr %35, i32 0)
  %37 = call i32 @_FortranAioEndIoStatement(ptr %35)
  %38 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

39:                                               ; preds = %0
  %40 = icmp eq i64 %.053, %31
  br i1 %40, label %41, label %46

41:                                               ; preds = %39
  %42 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.286129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.6e72e1047a4d6b300cfff3802284b837, i32 17)
  %43 = call i1 @_FortranAioOutputAscii(ptr %42, ptr nonnull @_QQcl.696E66696E697479, i64 8)
  %44 = call i32 @_FortranAioEndIoStatement(ptr %42)
  %45 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

46:                                               ; preds = %39
  %47 = udiv i64 %31, %32
  %48 = srem i64 %31, %32
  %49 = call i64 @llvm.smin.i64(i64 %48, i64 1)
  %50 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.6e72e1047a4d6b300cfff3802284b837, i32 22)
  %.neg.neg = shl i64 %47, 1
  %51 = add i64 %.neg.neg, %49
  %52 = call i1 @_FortranAioOutputInteger64(ptr %50, i64 %51)
  %53 = call i32 @_FortranAioEndIoStatement(ptr %50)
  ret void
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

declare i1 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

declare i1 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #0

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"descriptor member", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any data access", !5, i64 0}
