program sample
    implicit none
   
    integer(16) :: a,b,c
    
  
    read(*,*)a,b,c
    if(b==0)then
        write(*,*)1
    elseif(a==0)then
        write(*,*)b/c+1
    else
        write(*,*)b/c-(a-1)/c
    end if
    stop
end program sample
  


; 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.588169d16b6e63984d4ef21201d0e04e = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_7709/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #0 {
  %1 = alloca i128, align 8
  %2 = alloca i128, align 8
  %3 = alloca i128, align 8
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.588169d16b6e63984d4ef21201d0e04e, i32 7)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %1, i32 16)
  %6 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %2, i32 16)
  %7 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 16)
  %8 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %9 = load i128, ptr %2, align 8, !tbaa !3
  %10 = icmp eq i128 %9, 0
  br i1 %10, label %11, label %14

11:                                               ; preds = %0
  %12 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.588169d16b6e63984d4ef21201d0e04e, i32 9)
  %13 = call i1 @_FortranAioOutputInteger32(ptr %12, i32 1)
  br label %34

14:                                               ; preds = %0
  %15 = load i128, ptr %1, align 8, !tbaa !3
  %16 = icmp eq i128 %15, 0
  br i1 %16, label %17, label %24

17:                                               ; preds = %14
  %18 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.588169d16b6e63984d4ef21201d0e04e, i32 11)
  %19 = load i128, ptr %2, align 8, !tbaa !3
  %20 = load i128, ptr %3, align 8, !tbaa !3
  %21 = sdiv i128 %19, %20
  %22 = add i128 %21, 1
  %23 = call i1 @_FortranAioOutputInteger128(ptr %18, i128 %22)
  br label %34

24:                                               ; preds = %14
  %25 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.588169d16b6e63984d4ef21201d0e04e, i32 13)
  %26 = load i128, ptr %2, align 8, !tbaa !3
  %27 = load i128, ptr %3, align 8, !tbaa !3
  %28 = sdiv i128 %26, %27
  %29 = load i128, ptr %1, align 8, !tbaa !3
  %30 = add i128 %29, -1
  %31 = sdiv i128 %30, %27
  %32 = sub i128 %28, %31
  %33 = call i1 @_FortranAioOutputInteger128(ptr %25, i128 %32)
  br label %34

34:                                               ; preds = %11, %17, %24
  %.sink = phi ptr [ %12, %11 ], [ %18, %17 ], [ %25, %24 ]
  %35 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  %36 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable
}

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

declare i1 @_FortranAioOutputInteger128(ptr, i128) local_unnamed_addr

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

attributes #0 = { noreturn }

!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"}
