; LLVM IR from aap/pdp6 :: fe6 (fe)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Symbol = type { ptr, i64 }

@bufstart = external dso_local global ptr, align 8
@symtab = external dso_local global [27 x %struct.Symbol], align 16
@.str.28 = external hidden unnamed_addr constant [2 x i8], align 1
@dot = external dso_local global i32, align 4
@mnemonics = external global [448 x ptr], align 16
@iomnemonics = external global [8 x ptr], align 16

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local i64 @parsesym() #1 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  %4 = load ptr, ptr @bufstart, align 8, !tbaa !5
  %5 = call i32 @strcmp(ptr noundef %4, ptr noundef @.str.28) #4
  %6 = icmp eq i32 %5, 0
  br i1 %6, label %7, label %10

7:                                                ; preds = %0
  %8 = load i32, ptr @dot, align 4, !tbaa !9
  %9 = zext i32 %8 to i64
  store i64 %9, ptr %1, align 8
  store i32 1, ptr %3, align 4
  br label %77

10:                                               ; preds = %0
  store i64 0, ptr %2, align 8, !tbaa !11
  br label %11

11:                                               ; preds = %31, %10
  %12 = load i64, ptr %2, align 8, !tbaa !11
  %13 = getelementptr inbounds [27 x %struct.Symbol], ptr @symtab, i64 0, i64 %12
  %14 = getelementptr inbounds %struct.Symbol, ptr %13, i32 0, i32 0
  %15 = load ptr, ptr %14, align 16, !tbaa !13
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %34

17:                                               ; preds = %11
  %18 = load ptr, ptr @bufstart, align 8, !tbaa !5
  %19 = load i64, ptr %2, align 8, !tbaa !11
  %20 = getelementptr inbounds [27 x %struct.Symbol], ptr @symtab, i64 0, i64 %19
  %21 = getelementptr inbounds %struct.Symbol, ptr %20, i32 0, i32 0
  %22 = load ptr, ptr %21, align 16, !tbaa !13
  %23 = call i32 @strcasecmp(ptr noundef %18, ptr noundef %22) #4
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %25, label %30

25:                                               ; preds = %17
  %26 = load i64, ptr %2, align 8, !tbaa !11
  %27 = getelementptr inbounds [27 x %struct.Symbol], ptr @symtab, i64 0, i64 %26
  %28 = getelementptr inbounds %struct.Symbol, ptr %27, i32 0, i32 1
  %29 = load i64, ptr %28, align 8, !tbaa !15
  store i64 %29, ptr %1, align 8
  store i32 1, ptr %3, align 4
  br label %77

30:                                               ; preds = %17
  br label %31

31:                                               ; preds = %30
  %32 = load i64, ptr %2, align 8, !tbaa !11
  %33 = add i64 %32, 1
  store i64 %33, ptr %2, align 8, !tbaa !11
  br label %11, !llvm.loop !16

34:                                               ; preds = %11
  store i64 0, ptr %2, align 8, !tbaa !11
  br label %35

35:                                               ; preds = %54, %34
  %36 = load i64, ptr %2, align 8, !tbaa !11
  %37 = icmp ult i64 %36, 448
  br i1 %37, label %38, label %57

38:                                               ; preds = %35
  %39 = load i64, ptr %2, align 8, !tbaa !11
  %40 = getelementptr inbounds [448 x ptr], ptr @mnemonics, i64 0, i64 %39
  %41 = load ptr, ptr %40, align 8, !tbaa !5
  %42 = icmp ne ptr %41, null
  br i1 %42, label %43, label %53

43:                                               ; preds = %38
  %44 = load i64, ptr %2, align 8, !tbaa !11
  %45 = getelementptr inbounds [448 x ptr], ptr @mnemonics, i64 0, i64 %44
  %46 = load ptr, ptr %45, align 8, !tbaa !5
  %47 = load ptr, ptr @bufstart, align 8, !tbaa !5
  %48 = call i32 @strcasecmp(ptr noundef %46, ptr noundef %47) #4
  %49 = icmp eq i32 %48, 0
  br i1 %49, label %50, label %53

50:                                               ; preds = %43
  %51 = load i64, ptr %2, align 8, !tbaa !11
  %52 = shl i64 %51, 27
  store i64 %52, ptr %1, align 8
  store i32 1, ptr %3, align 4
  br label %77

53:                                               ; preds = %43, %38
  br label %54

54:                                               ; preds = %53
  %55 = load i64, ptr %2, align 8, !tbaa !11
  %56 = add i64 %55, 1
  store i64 %56, ptr %2, align 8, !tbaa !11
  br label %35, !llvm.loop !18

57:                                               ; preds = %35
  store i64 0, ptr %2, align 8, !tbaa !11
  br label %58

58:                                               ; preds = %73, %57
  %59 = load i64, ptr %2, align 8, !tbaa !11
  %60 = icmp ult i64 %59, 8
  br i1 %60, label %61, label %76

61:                                               ; preds = %58
  %62 = load i64, ptr %2, align 8, !tbaa !11
  %63 = getelementptr inbounds [8 x ptr], ptr @iomnemonics, i64 0, i64 %62
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = load ptr, ptr @bufstart, align 8, !tbaa !5
  %66 = call i32 @strcasecmp(ptr noundef %64, ptr noundef %65) #4
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %68, label %72

68:                                               ; preds = %61
  %69 = load i64, ptr %2, align 8, !tbaa !11
  %70 = shl i64 %69, 23
  %71 = or i64 60129542144, %70
  store i64 %71, ptr %1, align 8
  store i32 1, ptr %3, align 4
  br label %77

72:                                               ; preds = %61
  br label %73

73:                                               ; preds = %72
  %74 = load i64, ptr %2, align 8, !tbaa !11
  %75 = add i64 %74, 1
  store i64 %75, ptr %2, align 8, !tbaa !11
  br label %58, !llvm.loop !19

76:                                               ; preds = %58
  store i64 -1, ptr %1, align 8
  store i32 1, ptr %3, align 4
  br label %77

77:                                               ; preds = %76, %68, %50, %25, %7
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  %78 = load i64, ptr %1, align 8
  ret i64 %78
}

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcasecmp(ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
attributes #4 = { nounwind willreturn memory(read) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"Symbol", !6, i64 0, !12, i64 8}
!15 = !{!14, !12, i64 8}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Symbol = type { ptr, i64 }

@bufstart = external dso_local local_unnamed_addr global ptr, align 8
@symtab = external dso_local local_unnamed_addr global [27 x %struct.Symbol], align 16
@.str.28 = external hidden unnamed_addr constant [2 x i8], align 1
@dot = external dso_local local_unnamed_addr global i32, align 4
@mnemonics = external local_unnamed_addr global [448 x ptr], align 16
@iomnemonics = external local_unnamed_addr global [8 x ptr], align 16

; Function Attrs: nofree nounwind memory(read) uwtable
define dso_local i64 @parsesym() local_unnamed_addr #0 {
  %1 = load ptr, ptr @bufstart, align 8, !tbaa !5
  %2 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @.str.28) #3
  %3 = icmp eq i32 %2, 0
  br i1 %3, label %7, label %.preheader19

.preheader19:                                     ; preds = %0
  %4 = load ptr, ptr @symtab, align 16, !tbaa !9
  %.not23 = icmp eq ptr %4, null
  br i1 %.not23, label %.preheader18.preheader, label %.lr.ph.preheader

.preheader18.preheader:                           ; preds = %.lr.ph36, %.preheader19
  br label %.preheader18

.lr.ph.preheader:                                 ; preds = %.preheader19
  %5 = tail call i32 @strcasecmp(ptr noundef %1, ptr noundef nonnull %4) #3
  %6 = icmp eq i32 %5, 0
  br i1 %6, label %.lr.ph._crit_edge, label %.lr.ph36

7:                                                ; preds = %0
  %8 = load i32, ptr @dot, align 4, !tbaa !12
  %9 = zext i32 %8 to i64
  br label %.loopexit

.lr.ph36:                                         ; preds = %.lr.ph.preheader, %.lr.ph
  %.02435 = phi i64 [ %10, %.lr.ph ], [ 0, %.lr.ph.preheader ]
  %10 = add i64 %.02435, 1
  %11 = getelementptr inbounds [27 x %struct.Symbol], ptr @symtab, i64 0, i64 %10
  %12 = load ptr, ptr %11, align 16, !tbaa !9
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %.preheader18.preheader, label %.lr.ph, !llvm.loop !14

.lr.ph:                                           ; preds = %.lr.ph36
  %13 = tail call i32 @strcasecmp(ptr noundef %1, ptr noundef nonnull %12) #3
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %.lr.ph._crit_edge, label %.lr.ph36, !llvm.loop !14

.lr.ph._crit_edge:                                ; preds = %.lr.ph, %.lr.ph.preheader
  %.lcssa = phi ptr [ @symtab, %.lr.ph.preheader ], [ %11, %.lr.ph ]
  %15 = getelementptr inbounds i8, ptr %.lcssa, i64 8
  %16 = load i64, ptr %15, align 8, !tbaa !16
  br label %.loopexit

.preheader18:                                     ; preds = %.preheader18.preheader, %24
  %.125 = phi i64 [ %25, %24 ], [ 0, %.preheader18.preheader ]
  %17 = getelementptr inbounds [448 x ptr], ptr @mnemonics, i64 0, i64 %.125
  %18 = load ptr, ptr %17, align 8, !tbaa !5
  %.not17 = icmp eq ptr %18, null
  br i1 %.not17, label %24, label %19

19:                                               ; preds = %.preheader18
  %20 = tail call i32 @strcasecmp(ptr noundef nonnull %18, ptr noundef %1) #3
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %22, label %24

22:                                               ; preds = %19
  %23 = shl nuw nsw i64 %.125, 27
  br label %.loopexit

24:                                               ; preds = %.preheader18, %19
  %25 = add nuw nsw i64 %.125, 1
  %exitcond.not = icmp eq i64 %25, 448
  br i1 %exitcond.not, label %.preheader.preheader, label %.preheader18, !llvm.loop !17

.preheader.preheader:                             ; preds = %24
  %26 = load ptr, ptr @iomnemonics, align 16, !tbaa !5
  %27 = tail call i32 @strcasecmp(ptr noundef %26, ptr noundef %1) #3
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %.loopexit, label %.preheader.1

.preheader.1:                                     ; preds = %.preheader.preheader
  %29 = load ptr, ptr getelementptr inbounds (i8, ptr @iomnemonics, i64 8), align 8, !tbaa !5
  %30 = tail call i32 @strcasecmp(ptr noundef %29, ptr noundef %1) #3
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %.loopexit, label %.preheader.2

.preheader.2:                                     ; preds = %.preheader.1
  %32 = load ptr, ptr getelementptr inbounds (i8, ptr @iomnemonics, i64 16), align 16, !tbaa !5
  %33 = tail call i32 @strcasecmp(ptr noundef %32, ptr noundef %1) #3
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %.loopexit, label %.preheader.3

.preheader.3:                                     ; preds = %.preheader.2
  %35 = load ptr, ptr getelementptr inbounds (i8, ptr @iomnemonics, i64 24), align 8, !tbaa !5
  %36 = tail call i32 @strcasecmp(ptr noundef %35, ptr noundef %1) #3
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %.loopexit, label %.preheader.4

.preheader.4:                                     ; preds = %.preheader.3
  %38 = load ptr, ptr getelementptr inbounds (i8, ptr @iomnemonics, i64 32), align 16, !tbaa !5
  %39 = tail call i32 @strcasecmp(ptr noundef %38, ptr noundef %1) #3
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %.loopexit, label %.preheader.5

.preheader.5:                                     ; preds = %.preheader.4
  %41 = load ptr, ptr getelementptr inbounds (i8, ptr @iomnemonics, i64 40), align 8, !tbaa !5
  %42 = tail call i32 @strcasecmp(ptr noundef %41, ptr noundef %1) #3
  %43 = icmp eq i32 %42, 0
  br i1 %43, label %.loopexit, label %.preheader.6

.preheader.6:                                     ; preds = %.preheader.5
  %44 = load ptr, ptr getelementptr inbounds (i8, ptr @iomnemonics, i64 48), align 16, !tbaa !5
  %45 = tail call i32 @strcasecmp(ptr noundef %44, ptr noundef %1) #3
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %.loopexit, label %.preheader.7

.preheader.7:                                     ; preds = %.preheader.6
  %47 = load ptr, ptr getelementptr inbounds (i8, ptr @iomnemonics, i64 56), align 8, !tbaa !5
  %48 = tail call i32 @strcasecmp(ptr noundef %47, ptr noundef %1) #3
  %49 = icmp eq i32 %48, 0
  %spec.select = select i1 %49, i64 60188262400, i64 -1
  br label %.loopexit

.loopexit:                                        ; preds = %.preheader.7, %.preheader.preheader, %.preheader.1, %.preheader.2, %.preheader.3, %.preheader.4, %.preheader.5, %.preheader.6, %22, %.lr.ph._crit_edge, %7
  %.014 = phi i64 [ %9, %7 ], [ %16, %.lr.ph._crit_edge ], [ %23, %22 ], [ 60129542144, %.preheader.preheader ], [ 60137930752, %.preheader.1 ], [ 60146319360, %.preheader.2 ], [ 60154707968, %.preheader.3 ], [ 60163096576, %.preheader.4 ], [ 60171485184, %.preheader.5 ], [ 60179873792, %.preheader.6 ], [ %spec.select, %.preheader.7 ]
  ret i64 %.014
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(read)
declare i32 @strcasecmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #2

attributes #0 = { nofree nounwind memory(read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind willreturn memory(read) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"Symbol", !6, i64 0, !11, i64 8}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!10, !11, i64 8}
!17 = distinct !{!17, !15}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass