program test
implicit none
integer :: n,x,i,a
double precision :: m(100)=0.


read(*,*) n,x

do i = 1, n
 read(*,*) m(i)
enddo
 
write(*,*) int( (x - sum(m(1:n)))  / minval(m(1:n))) + n


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

@_QFEm = internal global [100 x double] zeroinitializer
@_QQcl.2d5599ed47d2771731820c9770e399bd = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6047/source.f\00"
@_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 i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.2d5599ed47d2771731820c9770e399bd, i32 7)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %2, i32 4)
  %6 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 4)
  %7 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %8 = load i32, ptr %2, align 4, !tbaa !3
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %10 = zext i32 %8 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %11 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.2d5599ed47d2771731820c9770e399bd, i32 10)
  %12 = add nsw i64 %indvars.iv, -1
  %13 = getelementptr [100 x double], ptr @_QFEm, i64 0, i64 %12
  %14 = call i1 @_FortranAioInputReal64(ptr %11, ptr %13)
  %15 = call i32 @_FortranAioEndIoStatement(ptr %11)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %10
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %16 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.2d5599ed47d2771731820c9770e399bd, i32 13)
  %17 = load i32, ptr %3, align 4, !tbaa !3
  %18 = load i32, ptr %2, align 4, !tbaa !3
  %19 = call i32 @llvm.smax.i32(i32 %18, i32 0)
  %20 = zext i32 %19 to i64
  %.not = icmp slt i32 %18, 1
  br i1 %.not, label %_FortranASumReal8x1_contract_simplified.exit, label %.lr.ph.i.preheader

.lr.ph.i.preheader:                               ; preds = %._crit_edge
  %21 = add nsw i64 %20, -1
  %xtraiter = and i64 %20, 3
  %22 = icmp ult i64 %21, 3
  br i1 %22, label %_FortranASumReal8x1_contract_simplified.exit.loopexit.unr-lcssa, label %.lr.ph.i.preheader.new

.lr.ph.i.preheader.new:                           ; preds = %.lr.ph.i.preheader
  %unroll_iter = and i64 %20, 2147483644
  br label %.lr.ph.i

.lr.ph.i:                                         ; preds = %.lr.ph.i, %.lr.ph.i.preheader.new
  %23 = phi double [ 0.000000e+00, %.lr.ph.i.preheader.new ], [ %43, %.lr.ph.i ]
  %24 = phi i64 [ 0, %.lr.ph.i.preheader.new ], [ %44, %.lr.ph.i ]
  %niter = phi i64 [ 0, %.lr.ph.i.preheader.new ], [ %niter.next.3, %.lr.ph.i ]
  %25 = shl i64 %24, 3
  %26 = getelementptr i8, ptr @_QFEm, i64 %25
  %27 = load double, ptr %26, align 16, !tbaa !3
  %28 = fadd contract double %23, %27
  %29 = shl i64 %24, 3
  %30 = or i64 %29, 8
  %31 = getelementptr i8, ptr @_QFEm, i64 %30
  %32 = load double, ptr %31, align 8, !tbaa !3
  %33 = fadd contract double %28, %32
  %34 = shl i64 %24, 3
  %35 = or i64 %34, 16
  %36 = getelementptr i8, ptr @_QFEm, i64 %35
  %37 = load double, ptr %36, align 16, !tbaa !3
  %38 = fadd contract double %33, %37
  %39 = shl i64 %24, 3
  %40 = or i64 %39, 24
  %41 = getelementptr i8, ptr @_QFEm, i64 %40
  %42 = load double, ptr %41, align 8, !tbaa !3
  %43 = fadd contract double %38, %42
  %44 = add nuw nsw i64 %24, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %_FortranASumReal8x1_contract_simplified.exit.loopexit.unr-lcssa, label %.lr.ph.i

_FortranASumReal8x1_contract_simplified.exit.loopexit.unr-lcssa: ; preds = %.lr.ph.i, %.lr.ph.i.preheader
  %.lcssa.ph = phi double [ undef, %.lr.ph.i.preheader ], [ %43, %.lr.ph.i ]
  %.unr = phi double [ 0.000000e+00, %.lr.ph.i.preheader ], [ %43, %.lr.ph.i ]
  %.unr23 = phi i64 [ 0, %.lr.ph.i.preheader ], [ %44, %.lr.ph.i ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %_FortranASumReal8x1_contract_simplified.exit, label %.lr.ph.i.epil

.lr.ph.i.epil:                                    ; preds = %_FortranASumReal8x1_contract_simplified.exit.loopexit.unr-lcssa, %.lr.ph.i.epil
  %45 = phi double [ %50, %.lr.ph.i.epil ], [ %.unr, %_FortranASumReal8x1_contract_simplified.exit.loopexit.unr-lcssa ]
  %46 = phi i64 [ %51, %.lr.ph.i.epil ], [ %.unr23, %_FortranASumReal8x1_contract_simplified.exit.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph.i.epil ], [ 0, %_FortranASumReal8x1_contract_simplified.exit.loopexit.unr-lcssa ]
  %47 = shl i64 %46, 3
  %48 = getelementptr i8, ptr @_QFEm, i64 %47
  %49 = load double, ptr %48, align 8, !tbaa !3
  %50 = fadd contract double %45, %49
  %51 = add nuw nsw i64 %46, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %_FortranASumReal8x1_contract_simplified.exit, label %.lr.ph.i.epil, !llvm.loop !7

_FortranASumReal8x1_contract_simplified.exit:     ; preds = %_FortranASumReal8x1_contract_simplified.exit.loopexit.unr-lcssa, %.lr.ph.i.epil, %._crit_edge
  %.lcssa.i = phi double [ 0.000000e+00, %._crit_edge ], [ %.lcssa.ph, %_FortranASumReal8x1_contract_simplified.exit.loopexit.unr-lcssa ], [ %50, %.lr.ph.i.epil ]
  %52 = sitofp i32 %17 to double
  %53 = fsub contract double %52, %.lcssa.i
  store ptr @_QFEm, ptr %1, align 8, !tbaa !9
  %.fca.1.gep5 = 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.gep5, align 8, !tbaa !9
  %.fca.2.gep7 = 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.gep7, align 8, !tbaa !9
  %.fca.3.gep9 = 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.gep9, align 4, !tbaa !9
  %.fca.4.gep11 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 28, ptr %.fca.4.gep11, align 1, !tbaa !9
  %.fca.5.gep13 = 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.gep13, align 2, !tbaa !9
  %.fca.6.gep15 = 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.gep15, align 1, !tbaa !9
  %.fca.7.0.0.gep17 = 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.gep17, align 8, !tbaa !9
  %.fca.7.0.1.gep19 = 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 %20, ptr %.fca.7.0.1.gep19, align 8, !tbaa !9
  %.fca.7.0.2.gep21 = 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.gep21, align 8, !tbaa !9
  %54 = call contract double @_FortranAMinvalReal8(ptr nonnull %1, ptr nonnull @_QQcl.2d5599ed47d2771731820c9770e399bd, i32 13, i32 0, ptr null)
  %55 = fdiv contract double %53, %54
  %56 = fptosi double %55 to i32
  %57 = load i32, ptr %2, align 4, !tbaa !3
  %58 = add i32 %57, %56
  %59 = call i1 @_FortranAioOutputInteger32(ptr %16, i32 %58)
  %60 = call i32 @_FortranAioEndIoStatement(ptr %16)
  ret void
}

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

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i1 @_FortranAioInputReal64(ptr, ptr) local_unnamed_addr

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

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

declare double @_FortranAMinvalReal8(ptr, ptr, i32, i32, ptr) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #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 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = distinct !{!7, !8}
!8 = !{!"llvm.loop.unroll.disable"}
!9 = !{!10, !10, i64 0}
!10 = !{!"descriptor member", !5, i64 0}
