program example
	implicit none
    
    integer(16) A,B,N
    
    read(*,*) N,A,B
    
    if(mod(B-A,2)==0) then
    
    	write(*,*)  (B-A)/2
            
    else
 		write(*,*) min(N-B,A-1)+1+((B-A-1)/2)
    end if

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

define void @_QQmain() local_unnamed_addr {
  %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.c733cfc1eb4f75d0f6a3687ad8b42eeb, i32 6)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 16)
  %6 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %1, i32 16)
  %7 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %2, i32 16)
  %8 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %9 = load i128, ptr %2, align 8, !tbaa !3
  %10 = load i128, ptr %1, align 8, !tbaa !3
  %11 = sub i128 %9, %10
  %12 = and i128 %11, 1
  %13 = icmp eq i128 %12, 0
  br i1 %13, label %14, label %21

14:                                               ; preds = %0
  %15 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.c733cfc1eb4f75d0f6a3687ad8b42eeb, i32 10)
  %16 = load i128, ptr %2, align 8, !tbaa !3
  %17 = load i128, ptr %1, align 8, !tbaa !3
  %18 = sub i128 %16, %17
  %19 = sdiv i128 %18, 2
  %20 = call i1 @_FortranAioOutputInteger128(ptr %15, i128 %19)
  br label %35

21:                                               ; preds = %0
  %22 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.c733cfc1eb4f75d0f6a3687ad8b42eeb, i32 13)
  %23 = load i128, ptr %3, align 8, !tbaa !3
  %24 = load i128, ptr %2, align 8, !tbaa !3
  %25 = sub i128 %23, %24
  %26 = load i128, ptr %1, align 8, !tbaa !3
  %27 = add i128 %26, -1
  %28 = call i128 @llvm.smin.i128(i128 %25, i128 %27)
  %29 = add i128 %28, 1
  %30 = xor i128 %26, -1
  %31 = add i128 %24, %30
  %32 = sdiv i128 %31, 2
  %33 = add i128 %29, %32
  %34 = call i1 @_FortranAioOutputInteger128(ptr %22, i128 %33)
  br label %35

35:                                               ; preds = %14, %21
  %.sink = phi ptr [ %15, %14 ], [ %22, %21 ]
  %36 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  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 @_FortranAioOutputInteger128(ptr, i128) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i128 @llvm.smin.i128(i128, i128) #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"}
