; LLVM IR from holzschu/ios_system :: ssh-agent/y.tab (yylex)

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

%union.YYSTYPE = type { ptr }

@yylval = external dso_local global %union.YYSTYPE, align 8
@av = external dso_local global ptr, align 8
@.str.10 = external hidden unnamed_addr constant [14 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 i32 @yylex() #1 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  %4 = load ptr, ptr @av, align 8, !tbaa !5
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = icmp eq ptr %5, null
  br i1 %6, label %7, label %8

7:                                                ; preds = %0
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %48

8:                                                ; preds = %0
  %9 = load ptr, ptr @av, align 8, !tbaa !5
  %10 = getelementptr inbounds ptr, ptr %9, i32 1
  store ptr %10, ptr @av, align 8, !tbaa !5
  %11 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %11, ptr %2, align 8, !tbaa !5
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = call i64 @strlen(ptr noundef %12) #4
  %14 = icmp eq i64 %13, 1
  br i1 %14, label %15, label %26

15:                                               ; preds = %8
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = load i8, ptr %16, align 1, !tbaa !9
  %18 = sext i8 %17 to i32
  %19 = call ptr @strchr(ptr noundef @.str.10, i32 noundef %18) #4
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %25

21:                                               ; preds = %15
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = load i8, ptr %22, align 1, !tbaa !9
  %24 = sext i8 %23 to i32
  store i32 %24, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %48

25:                                               ; preds = %15
  br label %45

26:                                               ; preds = %8
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = call i64 @strlen(ptr noundef %27) #4
  %29 = icmp eq i64 %28, 2
  br i1 %29, label %30, label %44

30:                                               ; preds = %26
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %31, i64 1
  %33 = load i8, ptr %32, align 1, !tbaa !9
  %34 = sext i8 %33 to i32
  %35 = icmp eq i32 %34, 61
  br i1 %35, label %36, label %44

36:                                               ; preds = %30
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = load i8, ptr %37, align 1, !tbaa !9
  %39 = sext i8 %38 to i32
  switch i32 %39, label %43 [
    i32 62, label %40
    i32 60, label %41
    i32 33, label %42
  ]

40:                                               ; preds = %36
  store i32 260, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %48

41:                                               ; preds = %36
  store i32 259, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %48

42:                                               ; preds = %36
  store i32 258, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %48

43:                                               ; preds = %36
  br label %44

44:                                               ; preds = %43, %30, %26
  br label %45

45:                                               ; preds = %44, %25
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = call ptr @make_str(ptr noundef %46)
  store ptr %47, ptr @yylval, align 8, !tbaa !9
  store i32 261, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %48

48:                                               ; preds = %45, %42, %41, %40, %21, %7
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  %49 = load i32, ptr %1, align 4
  ret i32 %49
}

; Function Attrs: nounwind uwtable
declare dso_local ptr @make_str(ptr noundef) #1

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

; Function Attrs: nounwind willreturn memory(read)
declare ptr @strchr(ptr noundef, i32 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 = !{!7, !7, i64 0}


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

%union.YYSTYPE = type { ptr }

@yylval = external dso_local local_unnamed_addr global %union.YYSTYPE, align 8
@av = external dso_local local_unnamed_addr global ptr, align 8
@.str.10 = external hidden unnamed_addr constant [14 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -128, 262) i32 @yylex() local_unnamed_addr #0 {
  %1 = load ptr, ptr @av, align 8, !tbaa !5
  %2 = load ptr, ptr %1, align 8, !tbaa !5
  %3 = icmp eq ptr %2, null
  br i1 %3, label %22, label %4

4:                                                ; preds = %0
  %5 = getelementptr inbounds i8, ptr %1, i64 8
  store ptr %5, ptr @av, align 8, !tbaa !5
  %6 = load ptr, ptr %1, align 8, !tbaa !5
  %7 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %6) #2
  switch i64 %7, label %20 [
    i64 1, label %8
    i64 2, label %12
  ]

8:                                                ; preds = %4
  %9 = load i8, ptr %6, align 1, !tbaa !9
  %10 = sext i8 %9 to i32
  %11 = tail call ptr @strchr(ptr noundef nonnull dereferenceable(1) @.str.10, i32 noundef %10) #2
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %20, label %22

12:                                               ; preds = %4
  %13 = getelementptr inbounds i8, ptr %6, i64 1
  %14 = load i8, ptr %13, align 1, !tbaa !9
  %15 = icmp eq i8 %14, 61
  br i1 %15, label %16, label %20

16:                                               ; preds = %12
  %17 = load i8, ptr %6, align 1, !tbaa !9
  switch i8 %17, label %20 [
    i8 62, label %22
    i8 60, label %18
    i8 33, label %19
  ]

18:                                               ; preds = %16
  br label %22

19:                                               ; preds = %16
  br label %22

20:                                               ; preds = %4, %12, %16, %8
  %21 = tail call ptr @make_str(ptr noundef %6)
  store ptr %21, ptr @yylval, align 8, !tbaa !9
  br label %22

22:                                               ; preds = %16, %8, %0, %20, %19, %18
  %.0 = phi i32 [ 261, %20 ], [ 258, %19 ], [ 259, %18 ], [ 0, %0 ], [ %10, %8 ], [ 260, %16 ]
  ret i32 %.0
}

; Function Attrs: nounwind uwtable
declare dso_local ptr @make_str(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strchr(ptr noundef, i32 noundef) local_unnamed_addr #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 = { 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 = { 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 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass