program prob2
    implicit none
    character(110) :: a, b
    integer :: i, la, lb
    logical :: ans, decide
    read(*,*) a, b
    la = len_trim(a)
    lb = len_trim(b)
    decide = .false.
    if(la > lb) then
        ans = .true.
        decide = .true.
    else if(la < lb) then
        decide = .true.
        ans = .false.
    else
        do i = 1, la
            if(a(i:i) > b(i:i))then
                decide = .true.
                ans = .true.
                exit
            else if(a(i:i) < b(i:i)) then
                decide = .true.
                ans = .false.
                exit
            else
                cycle
            end if
        end do
    end if

    if(decide .eqv. .false.) then
        write(*,*) 'EQUAL'
    else
        if(ans .eqv. .true.) then
            write(*,*) 'GREATER'
        else
            write(*,*) 'LESS'
        end if
    end if

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

@_QFEa = internal global [110 x i8] undef
@_QFEb = internal global [110 x i8] undef
@_QQcl.7a240a6a9414225c96d3df2a44ba0a12 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_7367/source.f\00"
@_QQcl.455155414C = linkonce constant [5 x i8] c"EQUAL"
@_QQcl.47524541544552 = linkonce constant [7 x i8] c"GREATER"
@_QQcl.4C455353 = linkonce constant [4 x i8] c"LESS"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.7a240a6a9414225c96d3df2a44ba0a12, i32 6)
  %4 = tail call i1 @_FortranAioInputAscii(ptr %3, ptr nonnull @_QFEa, i64 110)
  %5 = tail call i1 @_FortranAioInputAscii(ptr %3, ptr nonnull @_QFEb, i64 110)
  %6 = tail call i32 @_FortranAioEndIoStatement(ptr %3)
  br label %7

7:                                                ; preds = %0, %7
  %8 = phi i64 [ 109, %0 ], [ %12, %7 ]
  %9 = getelementptr [110 x [1 x i8]], ptr @_QFEa, i64 0, i64 %8
  %10 = load i8, ptr %9, align 1, !tbaa !3
  %11 = icmp eq i8 %10, 32
  %12 = add nsw i64 %8, -1
  %13 = icmp ne i64 %8, 0
  %14 = and i1 %11, %13
  br i1 %14, label %7, label %15

15:                                               ; preds = %7
  %16 = trunc i64 %8 to i32
  %17 = add i32 %16, 1
  br label %18

18:                                               ; preds = %15, %18
  %19 = phi i64 [ 109, %15 ], [ %23, %18 ]
  %20 = getelementptr [110 x [1 x i8]], ptr @_QFEb, i64 0, i64 %19
  %21 = load i8, ptr %20, align 1, !tbaa !3
  %22 = icmp eq i8 %21, 32
  %23 = add nsw i64 %19, -1
  %24 = icmp ne i64 %19, 0
  %25 = and i1 %22, %24
  br i1 %25, label %18, label %26

26:                                               ; preds = %18
  %27 = select i1 %11, i32 0, i32 %17
  %28 = trunc i64 %19 to i32
  %29 = add i32 %28, 1
  %30 = select i1 %22, i32 0, i32 %29
  store i32 0, ptr %2, align 4, !tbaa !3
  %31 = icmp sgt i32 %27, %30
  br i1 %31, label %.loopexit, label %32

32:                                               ; preds = %26
  %33 = icmp slt i32 %27, %30
  br i1 %33, label %.thread20, label %.preheader

.preheader:                                       ; preds = %32
  %34 = icmp sgt i32 %27, 0
  br i1 %34, label %.lr.ph.preheader, label %.loopexit.thread

.lr.ph.preheader:                                 ; preds = %.preheader
  %35 = add nuw i32 %27, 1
  %wide.trip.count = zext i32 %35 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %44
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %44 ]
  %36 = add nsw i64 %indvars.iv, -1
  %37 = getelementptr [110 x [1 x i8]], ptr @_QFEa, i64 0, i64 %36
  %38 = getelementptr [110 x [1 x i8]], ptr @_QFEb, i64 0, i64 %36
  %39 = tail call i32 @_FortranACharacterCompareScalar1(ptr %37, ptr %38, i64 1, i64 1)
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %.loopexit, label %41

41:                                               ; preds = %.lr.ph
  %42 = tail call i32 @_FortranACharacterCompareScalar1(ptr %37, ptr %38, i64 1, i64 1)
  %43 = icmp slt i32 %42, 0
  br i1 %43, label %.thread20, label %44

44:                                               ; preds = %41
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit.thread, label %.lr.ph

.loopexit:                                        ; preds = %.lr.ph, %26
  %45 = phi ptr [ %1, %26 ], [ %2, %.lr.ph ]
  %46 = phi ptr [ %2, %26 ], [ %1, %.lr.ph ]
  store i32 1, ptr %45, align 4, !tbaa !3
  store i32 1, ptr %46, align 4, !tbaa !3
  %.0..0..0..0..pr.pre = load i32, ptr %2, align 4, !tbaa !3
  %47 = icmp eq i32 %.0..0..0..0..pr.pre, 0
  br i1 %47, label %.loopexit.thread, label %48

48:                                               ; preds = %.loopexit
  %.0..0..0..0.8.pr = load i32, ptr %1, align 4, !tbaa !3
  %.not16 = icmp eq i32 %.0..0..0..0.8.pr, 0
  br i1 %.not16, label %.thread20, label %.loopexit.thread

.thread20:                                        ; preds = %41, %32, %48
  br label %.loopexit.thread

.loopexit.thread:                                 ; preds = %44, %48, %.loopexit, %.preheader, %.thread20
  %.sink = phi i32 [ 38, %.thread20 ], [ 33, %.preheader ], [ 33, %.loopexit ], [ 36, %48 ], [ 33, %44 ]
  %.sink39 = phi i64 [ 4, %.thread20 ], [ 5, %.preheader ], [ 5, %.loopexit ], [ 7, %48 ], [ 5, %44 ]
  %_QQcl.455155414C.sink = phi ptr [ @_QQcl.4C455353, %.thread20 ], [ @_QQcl.455155414C, %.preheader ], [ @_QQcl.455155414C, %.loopexit ], [ @_QQcl.47524541544552, %48 ], [ @_QQcl.455155414C, %44 ]
  %49 = tail call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.7a240a6a9414225c96d3df2a44ba0a12, i32 %.sink)
  %50 = tail call i1 @_FortranAioOutputAscii(ptr %49, ptr nonnull %_QQcl.455155414C.sink, i64 %.sink39)
  %51 = tail call i32 @_FortranAioEndIoStatement(ptr %49)
  %52 = tail call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable
}

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

declare i1 @_FortranAioInputAscii(ptr, ptr, i64) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i32 @_FortranACharacterCompareScalar1(ptr, ptr, i64, i64) local_unnamed_addr

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

declare i1 @_FortranAioOutputAscii(ptr, ptr, i64) 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"}
