program pyramid
  implicit none
  integer :: n, x(100) = 0, y(100) = 0, h(100) = 0, i
  integer :: cx, cy, ch, mx, my, mh = -1
  read(*,*) n
  do i = 1, n
    read(*,*) x(i), y(i), h(i)
    if (mh < h(i)) then
      mx = x(i)
      my = y(i)
      mh = h(i)
    end if
  end do
  do cx = 0, 100
    do cy = 0, 100
      ch = mh+abs(mx-cx)+abs(my-cy)
      do i = 1, n
        if (max(ch-abs(cx-x(i))-abs(cy-y(i)),0) /= h(i)) goto 100
      end do
      write(*,'(i0,x,i0,x,i0)') cx, cy, ch
      stop
100 end do
  end do
end program pyramid
; 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"

@_QFEh = internal global [100 x i32] zeroinitializer
@_QFEmh = internal unnamed_addr global i32 -1
@_QFEx = internal global [100 x i32] zeroinitializer
@_QFEy = internal global [100 x i32] zeroinitializer
@_QQcl.d908b1e3552c6642fff206aedddf41fc = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5453/source.f\00"
@_QQcl.2869302C782C69302C782C693029 = linkonce constant [14 x i8] c"(i0,x,i0,x,i0)"
@_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.d908b1e3552c6642fff206aedddf41fc, i32 5)
  %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.preheader, label %.preheader40.thread

.preheader40.thread:                              ; preds = %0
  %.pre = load i32, ptr @_QFEmh, align 4, !tbaa !3
  br label %.preheader

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

.preheader40:                                     ; preds = %51
  %.pre79 = load i32, ptr %1, align 4, !tbaa !3
  %8 = icmp sgt i32 %.pre79, 0
  br i1 %8, label %.preheader.us, label %.preheader

.preheader.us:                                    ; preds = %.preheader40, %.split.us.us
  %.03267.us = phi i32 [ %35, %.split.us.us ], [ 0, %.preheader40 ]
  %9 = sub i32 %.129, %.03267.us
  %10 = call i32 @llvm.abs.i32(i32 %9, i1 false)
  br label %.lr.ph48.us.us

.lr.ph48.us.us:                                   ; preds = %31, %.preheader.us
  %.03157.us.us = phi i32 [ 0, %.preheader.us ], [ %32, %31 ]
  %11 = sub i32 %.1, %.03157.us.us
  %12 = call i32 @llvm.abs.i32(i32 %11, i1 false)
  %13 = add i32 %12, %10
  %14 = add i32 %13, %52
  br label %15

15:                                               ; preds = %33, %.lr.ph48.us.us
  %.03047.us.us = phi i32 [ 1, %.lr.ph48.us.us ], [ %34, %33 ]
  %16 = sext i32 %.03047.us.us to i64
  %17 = add nsw i64 %16, -1
  %18 = getelementptr [100 x i32], ptr @_QFEx, i64 0, i64 %17
  %19 = load i32, ptr %18, align 4, !tbaa !3
  %20 = sub i32 %.03267.us, %19
  %21 = call i32 @llvm.abs.i32(i32 %20, i1 false)
  %22 = getelementptr [100 x i32], ptr @_QFEy, i64 0, i64 %17
  %23 = load i32, ptr %22, align 4, !tbaa !3
  %24 = sub i32 %.03157.us.us, %23
  %25 = call i32 @llvm.abs.i32(i32 %24, i1 false)
  %26 = add i32 %21, %25
  %27 = sub i32 %14, %26
  %28 = call i32 @llvm.smax.i32(i32 %27, i32 0)
  %29 = getelementptr [100 x i32], ptr @_QFEh, i64 0, i64 %17
  %30 = load i32, ptr %29, align 4, !tbaa !3
  %.not.us.us = icmp eq i32 %28, %30
  br i1 %.not.us.us, label %33, label %31

31:                                               ; preds = %15
  %32 = add nuw nsw i32 %.03157.us.us, 1
  %exitcond77.not = icmp eq i32 %32, 101
  br i1 %exitcond77.not, label %.split.us.us, label %.lr.ph48.us.us

33:                                               ; preds = %15
  %34 = add nuw i32 %.03047.us.us, 1
  %exitcond76.not = icmp eq i32 %.03047.us.us, %.pre79
  br i1 %exitcond76.not, label %._crit_edge52, label %15

.split.us.us:                                     ; preds = %31
  %35 = add nuw nsw i32 %.03267.us, 1
  %exitcond78.not = icmp eq i32 %35, 101
  br i1 %exitcond78.not, label %.split.us70, label %.preheader.us

.lr.ph:                                           ; preds = %.lr.ph.preheader, %51
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %51 ]
  %.044 = phi i32 [ undef, %.lr.ph.preheader ], [ %.1, %51 ]
  %.02843 = phi i32 [ undef, %.lr.ph.preheader ], [ %.129, %51 ]
  %36 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.d908b1e3552c6642fff206aedddf41fc, i32 7)
  %37 = add nsw i64 %indvars.iv, -1
  %38 = getelementptr [100 x i32], ptr @_QFEx, i64 0, i64 %37
  %39 = call i1 @_FortranAioInputInteger(ptr %36, ptr %38, i32 4)
  %40 = getelementptr [100 x i32], ptr @_QFEy, i64 0, i64 %37
  %41 = call i1 @_FortranAioInputInteger(ptr %36, ptr %40, i32 4)
  %42 = getelementptr [100 x i32], ptr @_QFEh, i64 0, i64 %37
  %43 = call i1 @_FortranAioInputInteger(ptr %36, ptr %42, i32 4)
  %44 = call i32 @_FortranAioEndIoStatement(ptr %36)
  %45 = load i32, ptr @_QFEmh, align 4, !tbaa !3
  %46 = load i32, ptr %42, align 4, !tbaa !3
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %48, label %51

48:                                               ; preds = %.lr.ph
  %49 = load i32, ptr %38, align 4, !tbaa !3
  %50 = load i32, ptr %40, align 4, !tbaa !3
  store i32 %46, ptr @_QFEmh, align 4, !tbaa !3
  br label %51

51:                                               ; preds = %48, %.lr.ph
  %52 = phi i32 [ %46, %48 ], [ %45, %.lr.ph ]
  %.129 = phi i32 [ %49, %48 ], [ %.02843, %.lr.ph ]
  %.1 = phi i32 [ %50, %48 ], [ %.044, %.lr.ph ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %7
  br i1 %exitcond.not, label %.preheader40, label %.lr.ph

.preheader:                                       ; preds = %.preheader40.thread, %.preheader40
  %.0.lcssa83 = phi i32 [ undef, %.preheader40.thread ], [ %.1, %.preheader40 ]
  %.028.lcssa82 = phi i32 [ undef, %.preheader40.thread ], [ %.129, %.preheader40 ]
  %53 = phi i32 [ %.pre, %.preheader40.thread ], [ %52, %.preheader40 ]
  %54 = call i32 @llvm.abs.i32(i32 %.028.lcssa82, i1 false)
  %55 = call i32 @llvm.abs.i32(i32 %.0.lcssa83, i1 false)
  %56 = add i32 %55, %54
  %57 = add i32 %56, %53
  br label %._crit_edge52

._crit_edge52:                                    ; preds = %33, %.preheader
  %.032.lcssa42 = phi i32 [ 0, %.preheader ], [ %.03267.us, %33 ]
  %.lcssa = phi i32 [ %57, %.preheader ], [ %14, %33 ]
  %.031.lcssa41 = phi i32 [ 0, %.preheader ], [ %.03157.us.us, %33 ]
  %58 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.2869302C782C69302C782C693029, i64 14, ptr null, i32 -1, ptr nonnull @_QQcl.d908b1e3552c6642fff206aedddf41fc, i32 20)
  %59 = call i1 @_FortranAioOutputInteger32(ptr %58, i32 %.032.lcssa42)
  %60 = call i1 @_FortranAioOutputInteger32(ptr %58, i32 %.031.lcssa41)
  %61 = call i1 @_FortranAioOutputInteger32(ptr %58, i32 %.lcssa)
  %62 = call i32 @_FortranAioEndIoStatement(ptr %58)
  %63 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

.split.us70:                                      ; preds = %.split.us.us
  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 @_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

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

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