; LLVM IR from ramsdell/lineqpp :: lua (llex)

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

@luaX_tokens = external hidden constant [32 x ptr], align 16

; Function Attrs: nounwind uwtable
define hidden void @luaX_init(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %5

5:                                                ; preds = %31, %1
  %6 = load i32, ptr %3, align 4, !tbaa !9
  %7 = icmp slt i32 %6, 21
  br i1 %7, label %8, label %34

8:                                                ; preds = %5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = load i32, ptr %3, align 4, !tbaa !9
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds [32 x ptr], ptr @luaX_tokens, i64 0, i64 %11
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  %14 = load i32, ptr %3, align 4, !tbaa !9
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [32 x ptr], ptr @luaX_tokens, i64 0, i64 %15
  %17 = load ptr, ptr %16, align 8, !tbaa !5
  %18 = call i64 @strlen(ptr noundef %17) #5
  %19 = call ptr @luaS_newlstr(ptr noundef %9, ptr noundef %13, i64 noundef %18)
  store ptr %19, ptr %4, align 8, !tbaa !5
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.anon, ptr %20, i32 0, i32 2
  %22 = load i8, ptr %21, align 1, !tbaa !11
  %23 = zext i8 %22 to i32
  %24 = or i32 %23, 32
  %25 = trunc i32 %24 to i8
  store i8 %25, ptr %21, align 1, !tbaa !11
  %26 = load i32, ptr %3, align 4, !tbaa !9
  %27 = add nsw i32 %26, 1
  %28 = trunc i32 %27 to i8
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.anon, ptr %29, i32 0, i32 3
  store i8 %28, ptr %30, align 2, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %31

31:                                               ; preds = %8
  %32 = load i32, ptr %3, align 4, !tbaa !9
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %3, align 4, !tbaa !9
  br label %5, !llvm.loop !12

34:                                               ; preds = %5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret void
}

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

declare hidden ptr @luaS_newlstr(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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) "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 #4 = { nounwind }
attributes #5 = { 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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"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"

@luaX_tokens = external hidden local_unnamed_addr constant [32 x ptr], align 16

; Function Attrs: nounwind uwtable
define hidden void @luaX_init(ptr noundef %0) local_unnamed_addr #0 {
  %2 = load ptr, ptr @luaX_tokens, align 16, !tbaa !5
  %3 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %2) #3
  %4 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %2, i64 noundef %3) #4
  %5 = getelementptr inbounds i8, ptr %4, i64 9
  %6 = load i8, ptr %5, align 1, !tbaa !9
  %7 = or i8 %6, 32
  store i8 %7, ptr %5, align 1, !tbaa !9
  %8 = getelementptr inbounds i8, ptr %4, i64 10
  store i8 1, ptr %8, align 2, !tbaa !9
  %9 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 8), align 8, !tbaa !5
  %10 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %9) #3
  %11 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %9, i64 noundef %10) #4
  %12 = getelementptr inbounds i8, ptr %11, i64 9
  %13 = load i8, ptr %12, align 1, !tbaa !9
  %14 = or i8 %13, 32
  store i8 %14, ptr %12, align 1, !tbaa !9
  %15 = getelementptr inbounds i8, ptr %11, i64 10
  store i8 2, ptr %15, align 2, !tbaa !9
  %16 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 16), align 16, !tbaa !5
  %17 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %16) #3
  %18 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %16, i64 noundef %17) #4
  %19 = getelementptr inbounds i8, ptr %18, i64 9
  %20 = load i8, ptr %19, align 1, !tbaa !9
  %21 = or i8 %20, 32
  store i8 %21, ptr %19, align 1, !tbaa !9
  %22 = getelementptr inbounds i8, ptr %18, i64 10
  store i8 3, ptr %22, align 2, !tbaa !9
  %23 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 24), align 8, !tbaa !5
  %24 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %23) #3
  %25 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %23, i64 noundef %24) #4
  %26 = getelementptr inbounds i8, ptr %25, i64 9
  %27 = load i8, ptr %26, align 1, !tbaa !9
  %28 = or i8 %27, 32
  store i8 %28, ptr %26, align 1, !tbaa !9
  %29 = getelementptr inbounds i8, ptr %25, i64 10
  store i8 4, ptr %29, align 2, !tbaa !9
  %30 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 32), align 16, !tbaa !5
  %31 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %30) #3
  %32 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %30, i64 noundef %31) #4
  %33 = getelementptr inbounds i8, ptr %32, i64 9
  %34 = load i8, ptr %33, align 1, !tbaa !9
  %35 = or i8 %34, 32
  store i8 %35, ptr %33, align 1, !tbaa !9
  %36 = getelementptr inbounds i8, ptr %32, i64 10
  store i8 5, ptr %36, align 2, !tbaa !9
  %37 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 40), align 8, !tbaa !5
  %38 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %37) #3
  %39 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %37, i64 noundef %38) #4
  %40 = getelementptr inbounds i8, ptr %39, i64 9
  %41 = load i8, ptr %40, align 1, !tbaa !9
  %42 = or i8 %41, 32
  store i8 %42, ptr %40, align 1, !tbaa !9
  %43 = getelementptr inbounds i8, ptr %39, i64 10
  store i8 6, ptr %43, align 2, !tbaa !9
  %44 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 48), align 16, !tbaa !5
  %45 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %44) #3
  %46 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %44, i64 noundef %45) #4
  %47 = getelementptr inbounds i8, ptr %46, i64 9
  %48 = load i8, ptr %47, align 1, !tbaa !9
  %49 = or i8 %48, 32
  store i8 %49, ptr %47, align 1, !tbaa !9
  %50 = getelementptr inbounds i8, ptr %46, i64 10
  store i8 7, ptr %50, align 2, !tbaa !9
  %51 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 56), align 8, !tbaa !5
  %52 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %51) #3
  %53 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %51, i64 noundef %52) #4
  %54 = getelementptr inbounds i8, ptr %53, i64 9
  %55 = load i8, ptr %54, align 1, !tbaa !9
  %56 = or i8 %55, 32
  store i8 %56, ptr %54, align 1, !tbaa !9
  %57 = getelementptr inbounds i8, ptr %53, i64 10
  store i8 8, ptr %57, align 2, !tbaa !9
  %58 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 64), align 16, !tbaa !5
  %59 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %58) #3
  %60 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %58, i64 noundef %59) #4
  %61 = getelementptr inbounds i8, ptr %60, i64 9
  %62 = load i8, ptr %61, align 1, !tbaa !9
  %63 = or i8 %62, 32
  store i8 %63, ptr %61, align 1, !tbaa !9
  %64 = getelementptr inbounds i8, ptr %60, i64 10
  store i8 9, ptr %64, align 2, !tbaa !9
  %65 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 72), align 8, !tbaa !5
  %66 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %65) #3
  %67 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %65, i64 noundef %66) #4
  %68 = getelementptr inbounds i8, ptr %67, i64 9
  %69 = load i8, ptr %68, align 1, !tbaa !9
  %70 = or i8 %69, 32
  store i8 %70, ptr %68, align 1, !tbaa !9
  %71 = getelementptr inbounds i8, ptr %67, i64 10
  store i8 10, ptr %71, align 2, !tbaa !9
  %72 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 80), align 16, !tbaa !5
  %73 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %72) #3
  %74 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %72, i64 noundef %73) #4
  %75 = getelementptr inbounds i8, ptr %74, i64 9
  %76 = load i8, ptr %75, align 1, !tbaa !9
  %77 = or i8 %76, 32
  store i8 %77, ptr %75, align 1, !tbaa !9
  %78 = getelementptr inbounds i8, ptr %74, i64 10
  store i8 11, ptr %78, align 2, !tbaa !9
  %79 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 88), align 8, !tbaa !5
  %80 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %79) #3
  %81 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %79, i64 noundef %80) #4
  %82 = getelementptr inbounds i8, ptr %81, i64 9
  %83 = load i8, ptr %82, align 1, !tbaa !9
  %84 = or i8 %83, 32
  store i8 %84, ptr %82, align 1, !tbaa !9
  %85 = getelementptr inbounds i8, ptr %81, i64 10
  store i8 12, ptr %85, align 2, !tbaa !9
  %86 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 96), align 16, !tbaa !5
  %87 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %86) #3
  %88 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %86, i64 noundef %87) #4
  %89 = getelementptr inbounds i8, ptr %88, i64 9
  %90 = load i8, ptr %89, align 1, !tbaa !9
  %91 = or i8 %90, 32
  store i8 %91, ptr %89, align 1, !tbaa !9
  %92 = getelementptr inbounds i8, ptr %88, i64 10
  store i8 13, ptr %92, align 2, !tbaa !9
  %93 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 104), align 8, !tbaa !5
  %94 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %93) #3
  %95 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %93, i64 noundef %94) #4
  %96 = getelementptr inbounds i8, ptr %95, i64 9
  %97 = load i8, ptr %96, align 1, !tbaa !9
  %98 = or i8 %97, 32
  store i8 %98, ptr %96, align 1, !tbaa !9
  %99 = getelementptr inbounds i8, ptr %95, i64 10
  store i8 14, ptr %99, align 2, !tbaa !9
  %100 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 112), align 16, !tbaa !5
  %101 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %100) #3
  %102 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %100, i64 noundef %101) #4
  %103 = getelementptr inbounds i8, ptr %102, i64 9
  %104 = load i8, ptr %103, align 1, !tbaa !9
  %105 = or i8 %104, 32
  store i8 %105, ptr %103, align 1, !tbaa !9
  %106 = getelementptr inbounds i8, ptr %102, i64 10
  store i8 15, ptr %106, align 2, !tbaa !9
  %107 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 120), align 8, !tbaa !5
  %108 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %107) #3
  %109 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %107, i64 noundef %108) #4
  %110 = getelementptr inbounds i8, ptr %109, i64 9
  %111 = load i8, ptr %110, align 1, !tbaa !9
  %112 = or i8 %111, 32
  store i8 %112, ptr %110, align 1, !tbaa !9
  %113 = getelementptr inbounds i8, ptr %109, i64 10
  store i8 16, ptr %113, align 2, !tbaa !9
  %114 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 128), align 16, !tbaa !5
  %115 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %114) #3
  %116 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %114, i64 noundef %115) #4
  %117 = getelementptr inbounds i8, ptr %116, i64 9
  %118 = load i8, ptr %117, align 1, !tbaa !9
  %119 = or i8 %118, 32
  store i8 %119, ptr %117, align 1, !tbaa !9
  %120 = getelementptr inbounds i8, ptr %116, i64 10
  store i8 17, ptr %120, align 2, !tbaa !9
  %121 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 136), align 8, !tbaa !5
  %122 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %121) #3
  %123 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %121, i64 noundef %122) #4
  %124 = getelementptr inbounds i8, ptr %123, i64 9
  %125 = load i8, ptr %124, align 1, !tbaa !9
  %126 = or i8 %125, 32
  store i8 %126, ptr %124, align 1, !tbaa !9
  %127 = getelementptr inbounds i8, ptr %123, i64 10
  store i8 18, ptr %127, align 2, !tbaa !9
  %128 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 144), align 16, !tbaa !5
  %129 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %128) #3
  %130 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %128, i64 noundef %129) #4
  %131 = getelementptr inbounds i8, ptr %130, i64 9
  %132 = load i8, ptr %131, align 1, !tbaa !9
  %133 = or i8 %132, 32
  store i8 %133, ptr %131, align 1, !tbaa !9
  %134 = getelementptr inbounds i8, ptr %130, i64 10
  store i8 19, ptr %134, align 2, !tbaa !9
  %135 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 152), align 8, !tbaa !5
  %136 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %135) #3
  %137 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %135, i64 noundef %136) #4
  %138 = getelementptr inbounds i8, ptr %137, i64 9
  %139 = load i8, ptr %138, align 1, !tbaa !9
  %140 = or i8 %139, 32
  store i8 %140, ptr %138, align 1, !tbaa !9
  %141 = getelementptr inbounds i8, ptr %137, i64 10
  store i8 20, ptr %141, align 2, !tbaa !9
  %142 = load ptr, ptr getelementptr inbounds (i8, ptr @luaX_tokens, i64 160), align 16, !tbaa !5
  %143 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %142) #3
  %144 = tail call ptr @luaS_newlstr(ptr noundef %0, ptr noundef %142, i64 noundef %143) #4
  %145 = getelementptr inbounds i8, ptr %144, i64 9
  %146 = load i8, ptr %145, align 1, !tbaa !9
  %147 = or i8 %146, 32
  store i8 %147, ptr %145, align 1, !tbaa !9
  %148 = getelementptr inbounds i8, ptr %144, i64 10
  store i8 21, ptr %148, align 2, !tbaa !9
  ret void
}

declare hidden ptr @luaS_newlstr(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { "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(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 #3 = { nounwind willreturn memory(read) }
attributes #4 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass