program c179

implicit none
integer :: n, a, z, c
real :: b

read *, n

z = 0

do a = 1, n
 b = real(n) / real(a)
 c = int(b)
 z = z + c
 if(a*c == n) then
  z = z - 1
 end if
end do

print *, z

end program c179
; 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.a021348240da2beb3623323f84567da0 = linkonce constant [72 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_629/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.a021348240da2beb3623323f84567da0, i32 7)
  %3 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %1, i32 4)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = load i32, ptr %1, align 4, !tbaa !3
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0
  %7 = zext i32 %5 to i64
  %8 = sitofp i32 %5 to float
  %min.iters.check = icmp ult i32 %5, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.vec = and i64 %7, 4294967288
  %ind.end = and i64 %7, 7
  %.cast = trunc i64 %n.vec to i32
  %ind.end10 = or i32 %.cast, 1
  %broadcast.splatinsert = insertelement <4 x float> poison, float %8, i64 0
  %broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert14 = insertelement <4 x float> poison, float %8, i64 0
  %broadcast.splat15 = shufflevector <4 x float> %broadcast.splatinsert14, <4 x float> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert16 = insertelement <4 x i32> poison, i32 %5, i64 0
  %broadcast.splat17 = shufflevector <4 x i32> %broadcast.splatinsert16, <4 x i32> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert18 = insertelement <4 x i32> poison, i32 %5, i64 0
  %broadcast.splat19 = shufflevector <4 x i32> %broadcast.splatinsert18, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %23, %vector.body ]
  %vec.phi13 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %24, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %9 = sitofp <4 x i32> %vec.ind to <4 x float>
  %10 = sitofp <4 x i32> %step.add to <4 x float>
  %11 = fdiv contract <4 x float> %broadcast.splat, %9
  %12 = fdiv contract <4 x float> %broadcast.splat15, %10
  %13 = fptosi <4 x float> %11 to <4 x i32>
  %14 = fptosi <4 x float> %12 to <4 x i32>
  %15 = add <4 x i32> %vec.phi, %13
  %16 = add <4 x i32> %vec.phi13, %14
  %17 = mul <4 x i32> %vec.ind, %13
  %18 = mul <4 x i32> %step.add, %14
  %19 = icmp eq <4 x i32> %17, %broadcast.splat17
  %20 = icmp eq <4 x i32> %18, %broadcast.splat19
  %21 = sext <4 x i1> %19 to <4 x i32>
  %22 = sext <4 x i1> %20 to <4 x i32>
  %23 = add <4 x i32> %15, %21
  %24 = add <4 x i32> %16, %22
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %25 = icmp eq i64 %index.next, %n.vec
  br i1 %25, label %middle.block, label %vector.body, !llvm.loop !7

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %24, %23
  %26 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %7
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %.lr.ph, %middle.block
  %.ph = phi i64 [ %7, %.lr.ph ], [ %ind.end, %middle.block ]
  %.ph20 = phi i32 [ 1, %.lr.ph ], [ %ind.end10, %middle.block ]
  %.09.ph = phi i32 [ 0, %.lr.ph ], [ %26, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %27 = phi i64 [ %37, %scalar.ph ], [ %.ph, %scalar.ph.preheader ]
  %28 = phi i32 [ %36, %scalar.ph ], [ %.ph20, %scalar.ph.preheader ]
  %.09 = phi i32 [ %spec.select, %scalar.ph ], [ %.09.ph, %scalar.ph.preheader ]
  %29 = sitofp i32 %28 to float
  %30 = fdiv contract float %8, %29
  %31 = fptosi float %30 to i32
  %32 = add i32 %.09, %31
  %33 = mul i32 %28, %31
  %34 = icmp eq i32 %33, %5
  %35 = sext i1 %34 to i32
  %spec.select = add i32 %32, %35
  %36 = add nuw i32 %28, 1
  %37 = add nsw i64 %27, -1
  %38 = icmp ugt i64 %27, 1
  br i1 %38, label %scalar.ph, label %._crit_edge, !llvm.loop !10

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %0
  %.0.lcssa = phi i32 [ 0, %0 ], [ %26, %middle.block ], [ %spec.select, %scalar.ph ]
  %39 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.a021348240da2beb3623323f84567da0, i32 20)
  %40 = call i1 @_FortranAioOutputInteger32(ptr %39, i32 %.0.lcssa)
  %41 = call i32 @_FortranAioEndIoStatement(ptr %39)
  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 ptr @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #0

attributes #0 = { nocallback nofree nosync nounwind 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, !9}
!8 = !{!"llvm.loop.isvectorized", i32 1}
!9 = !{!"llvm.loop.unroll.runtime.disable"}
!10 = distinct !{!10, !9, !8}
