; LLVM IR from snowballstem/snowball :: compiler (tokeniser)

; 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.system_word = type { i32, ptr, i32 }

@vocab = external hidden constant [83 x %struct.system_word], align 16
@.str.10 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [2 x i8], align 1

; 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 ptr @name_of_token(i32 noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #2
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %6

6:                                                ; preds = %24, %1
  %7 = load i32, ptr %4, align 4, !tbaa !5
  %8 = icmp slt i32 %7, 83
  br i1 %8, label %9, label %27

9:                                                ; preds = %6
  %10 = load i32, ptr %4, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds %struct.system_word, ptr @vocab, i64 %11
  %13 = getelementptr inbounds %struct.system_word, ptr %12, i32 0, i32 2
  %14 = load i32, ptr %13, align 8, !tbaa !9
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = icmp eq i32 %14, %15
  br i1 %16, label %17, label %23

17:                                               ; preds = %9
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds %struct.system_word, ptr @vocab, i64 %19
  %21 = getelementptr inbounds %struct.system_word, ptr %20, i32 0, i32 1
  %22 = load ptr, ptr %21, align 8, !tbaa !12
  store ptr %22, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %45

23:                                               ; preds = %9
  br label %24

24:                                               ; preds = %23
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %4, align 4, !tbaa !5
  br label %6, !llvm.loop !13

27:                                               ; preds = %6
  %28 = load i32, ptr %3, align 4, !tbaa !5
  switch i32 %28, label %44 [
    i32 84, label %29
    i32 81, label %30
    i32 82, label %31
    i32 83, label %32
    i32 85, label %33
    i32 87, label %34
    i32 86, label %35
    i32 88, label %36
    i32 89, label %37
    i32 90, label %38
    i32 91, label %39
    i32 92, label %40
    i32 93, label %41
    i32 -2, label %42
    i32 -1, label %43
  ]

29:                                               ; preds = %27
  store ptr @.str.10, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %45

30:                                               ; preds = %27
  store ptr @.str.11, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %45

31:                                               ; preds = %27
  store ptr @.str.12, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %45

32:                                               ; preds = %27
  store ptr @.str.13, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %45

33:                                               ; preds = %27
  store ptr @.str.14, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %45

34:                                               ; preds = %27
  store ptr @.str.15, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %45

35:                                               ; preds = %27
  store ptr @.str.16, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %45

36:                                               ; preds = %27
  store ptr @.str.17, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %45

37:                                               ; preds = %27
  store ptr @.str.18, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %45

38:                                               ; preds = %27
  store ptr @.str.19, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %45

39:                                               ; preds = %27
  store ptr @.str.20, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %45

40:                                               ; preds = %27
  store ptr @.str.21, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %45

41:                                               ; preds = %27
  store ptr @.str.22, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %45

42:                                               ; preds = %27
  store ptr @.str.23, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %45

43:                                               ; preds = %27
  store ptr @.str.24, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %45

44:                                               ; preds = %27
  store ptr @.str.25, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %45

45:                                               ; preds = %44, %43, %42, %41, %40, %39, %38, %37, %36, %35, %34, %33, %32, %31, %30, %29, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #2
  %46 = load ptr, ptr %2, align 8
  ret ptr %46
}

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 }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 16}
!10 = !{!"system_word", !6, i64 0, !11, i64 8, !6, i64 16}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; 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.system_word = type { i32, ptr, i32 }

@vocab = external hidden local_unnamed_addr constant [83 x %struct.system_word], align 16
@.str.10 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local ptr @name_of_token(i32 noundef %0) local_unnamed_addr #0 {
  br label %8

2:                                                ; preds = %8
  %3 = getelementptr inbounds %struct.system_word, ptr @vocab, i64 %indvars.iv
  %4 = getelementptr inbounds i8, ptr %3, i64 40
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %6 = icmp eq i32 %5, %0
  br i1 %6, label %.split.loop.exit, label %7

7:                                                ; preds = %2
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 83
  br i1 %exitcond.not.1, label %16, label %8, !llvm.loop !11

8:                                                ; preds = %7, %1
  %indvars.iv = phi i64 [ 1, %1 ], [ %indvars.iv.next.1, %7 ]
  %9 = getelementptr inbounds %struct.system_word, ptr @vocab, i64 %indvars.iv
  %10 = getelementptr inbounds i8, ptr %9, i64 16
  %11 = load i32, ptr %10, align 8, !tbaa !5
  %12 = icmp eq i32 %11, %0
  br i1 %12, label %.split.loop.exit13, label %2

.split.loop.exit:                                 ; preds = %2
  %13 = getelementptr inbounds i8, ptr %3, i64 24
  br label %.split.loop.exit13

.split.loop.exit13:                               ; preds = %8, %.split.loop.exit
  %.lcssa = phi ptr [ %13, %.split.loop.exit ], [ %9, %8 ]
  %14 = getelementptr inbounds i8, ptr %.lcssa, i64 8
  %15 = load ptr, ptr %14, align 8, !tbaa !13
  br label %32

16:                                               ; preds = %7
  switch i32 %0, label %31 [
    i32 84, label %32
    i32 81, label %17
    i32 82, label %18
    i32 83, label %19
    i32 85, label %20
    i32 87, label %21
    i32 86, label %22
    i32 88, label %23
    i32 89, label %24
    i32 90, label %25
    i32 91, label %26
    i32 92, label %27
    i32 93, label %28
    i32 -2, label %29
    i32 -1, label %30
  ]

17:                                               ; preds = %16
  br label %32

18:                                               ; preds = %16
  br label %32

19:                                               ; preds = %16
  br label %32

20:                                               ; preds = %16
  br label %32

21:                                               ; preds = %16
  br label %32

22:                                               ; preds = %16
  br label %32

23:                                               ; preds = %16
  br label %32

24:                                               ; preds = %16
  br label %32

25:                                               ; preds = %16
  br label %32

26:                                               ; preds = %16
  br label %32

27:                                               ; preds = %16
  br label %32

28:                                               ; preds = %16
  br label %32

29:                                               ; preds = %16
  br label %32

30:                                               ; preds = %16
  br label %32

31:                                               ; preds = %16
  br label %32

32:                                               ; preds = %16, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %.split.loop.exit13
  %.06 = phi ptr [ %15, %.split.loop.exit13 ], [ @.str.25, %31 ], [ @.str.24, %30 ], [ @.str.23, %29 ], [ @.str.22, %28 ], [ @.str.21, %27 ], [ @.str.20, %26 ], [ @.str.19, %25 ], [ @.str.18, %24 ], [ @.str.17, %23 ], [ @.str.16, %22 ], [ @.str.15, %21 ], [ @.str.14, %20 ], [ @.str.13, %19 ], [ @.str.12, %18 ], [ @.str.11, %17 ], [ @.str.10, %16 ]
  ret ptr %.06
}

attributes #0 = { nofree norecurse nosync nounwind memory(none) 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" }

!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, !7, i64 16}
!6 = !{!"system_word", !7, i64 0, !10, i64 8, !7, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!6, !10, i64 8}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopRotatePass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass