; LLVM IR from yellow-footed-honeyguide/facad :: src (emoji_utils)

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

@emoji_prefix_dev_map_size = external constant i64, align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@emoji_prefix_dev_map = external constant [0 x %struct.EmojiMapEntry], align 8
@emoji_exact_dev_file_map = external constant [0 x %struct.EmojiMapEntry], align 8
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1

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

7:                                                ; preds = %38, %1
  %8 = load i64, ptr %4, align 8, !tbaa !9
  %9 = load i64, ptr @emoji_prefix_dev_map_size, align 8, !tbaa !9
  %10 = icmp ult i64 %8, %9
  br i1 %10, label %12, label %11

11:                                               ; preds = %7
  store i32 2, ptr %5, align 4
  br label %41

12:                                               ; preds = %7
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = call ptr @strstr(ptr noundef %13, ptr noundef @.str) #4
  %15 = icmp ne ptr %14, null
  br i1 %15, label %16, label %18

16:                                               ; preds = %12
  %17 = call ptr @safe_strdup(ptr noundef @.str.1)
  store ptr %17, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %41

18:                                               ; preds = %12
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = load i64, ptr %4, align 8, !tbaa !9
  %21 = getelementptr inbounds [0 x %struct.EmojiMapEntry], ptr @emoji_prefix_dev_map, i64 0, i64 %20
  %22 = getelementptr inbounds %struct.EmojiMapEntry, ptr %21, i32 0, i32 0
  %23 = load ptr, ptr %22, align 8, !tbaa !11
  %24 = load i64, ptr %4, align 8, !tbaa !9
  %25 = getelementptr inbounds [0 x %struct.EmojiMapEntry], ptr @emoji_prefix_dev_map, i64 0, i64 %24
  %26 = getelementptr inbounds %struct.EmojiMapEntry, ptr %25, i32 0, i32 0
  %27 = load ptr, ptr %26, align 8, !tbaa !11
  %28 = call i64 @strlen(ptr noundef %27) #4
  %29 = call i32 @strncmp(ptr noundef %19, ptr noundef %23, i64 noundef %28) #4
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %31, label %37

31:                                               ; preds = %18
  %32 = load i64, ptr %4, align 8, !tbaa !9
  %33 = getelementptr inbounds [0 x %struct.EmojiMapEntry], ptr @emoji_prefix_dev_map, i64 0, i64 %32
  %34 = getelementptr inbounds %struct.EmojiMapEntry, ptr %33, i32 0, i32 1
  %35 = load ptr, ptr %34, align 8, !tbaa !13
  %36 = call ptr @safe_strdup(ptr noundef %35)
  store ptr %36, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %41

37:                                               ; preds = %18
  br label %38

38:                                               ; preds = %37
  %39 = load i64, ptr %4, align 8, !tbaa !9
  %40 = add i64 %39, 1
  store i64 %40, ptr %4, align 8, !tbaa !9
  br label %7, !llvm.loop !14

41:                                               ; preds = %31, %16, %11
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %42 = load i32, ptr %5, align 4
  switch i32 %42, label %72 [
    i32 2, label %43
    i32 1, label %70
  ]

43:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %44

44:                                               ; preds = %63, %43
  %45 = load i64, ptr %6, align 8, !tbaa !9
  %46 = icmp ult i64 %45, 8
  br i1 %46, label %48, label %47

47:                                               ; preds = %44
  store i32 5, ptr %5, align 4
  br label %66

48:                                               ; preds = %44
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = load i64, ptr %6, align 8, !tbaa !9
  %51 = getelementptr inbounds [0 x %struct.EmojiMapEntry], ptr @emoji_exact_dev_file_map, i64 0, i64 %50
  %52 = getelementptr inbounds %struct.EmojiMapEntry, ptr %51, i32 0, i32 0
  %53 = load ptr, ptr %52, align 8, !tbaa !11
  %54 = call i32 @strcmp(ptr noundef %49, ptr noundef %53) #4
  %55 = icmp eq i32 %54, 0
  br i1 %55, label %56, label %62

56:                                               ; preds = %48
  %57 = load i64, ptr %6, align 8, !tbaa !9
  %58 = getelementptr inbounds [0 x %struct.EmojiMapEntry], ptr @emoji_exact_dev_file_map, i64 0, i64 %57
  %59 = getelementptr inbounds %struct.EmojiMapEntry, ptr %58, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8, !tbaa !13
  %61 = call ptr @safe_strdup(ptr noundef %60)
  store ptr %61, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %66

62:                                               ; preds = %48
  br label %63

63:                                               ; preds = %62
  %64 = load i64, ptr %6, align 8, !tbaa !9
  %65 = add i64 %64, 1
  store i64 %65, ptr %6, align 8, !tbaa !9
  br label %44, !llvm.loop !16

66:                                               ; preds = %56, %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %67 = load i32, ptr %5, align 4
  switch i32 %67, label %72 [
    i32 5, label %68
    i32 1, label %70
  ]

68:                                               ; preds = %66
  %69 = call ptr @safe_strdup(ptr noundef @.str.2)
  store ptr %69, ptr %2, align 8
  br label %70

70:                                               ; preds = %68, %66, %41
  %71 = load ptr, ptr %2, align 8
  ret ptr %71

72:                                               ; preds = %66, %41
  unreachable
}

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

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

; Function Attrs: nounwind uwtable
declare hidden ptr @safe_strdup(ptr noundef) #0

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

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


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

@emoji_prefix_dev_map_size = external local_unnamed_addr constant i64, align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@emoji_prefix_dev_map = external local_unnamed_addr constant [0 x %struct.EmojiMapEntry], align 8
@emoji_exact_dev_file_map = external local_unnamed_addr constant [0 x %struct.EmojiMapEntry], align 8
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @get_dev_emoji(ptr noundef readonly %0) local_unnamed_addr #0 {
  %2 = load i64, ptr @emoji_prefix_dev_map_size, align 8, !tbaa !5
  %.not32 = icmp eq i64 %2, 0
  br i1 %.not32, label %.preheader, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %3 = tail call ptr @strstr(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) @.str) #2
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %.lr.ph.split, label %14

4:                                                ; preds = %.lr.ph.split
  %5 = add nuw i64 %.01530, 1
  %exitcond.not = icmp eq i64 %5, %2
  br i1 %exitcond.not, label %.preheader, label %.lr.ph.split, !llvm.loop !9

.preheader:                                       ; preds = %4, %1
  %6 = load ptr, ptr @emoji_exact_dev_file_map, align 8, !tbaa !11
  %7 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %6) #2
  %8 = icmp eq i32 %7, 0
  br i1 %8, label %50, label %20

.lr.ph.split:                                     ; preds = %.lr.ph, %4
  %.01530 = phi i64 [ %5, %4 ], [ 0, %.lr.ph ]
  %9 = getelementptr inbounds [0 x %struct.EmojiMapEntry], ptr @emoji_prefix_dev_map, i64 0, i64 %.01530
  %10 = load ptr, ptr %9, align 8, !tbaa !11
  %11 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %10) #2
  %12 = tail call i32 @strncmp(ptr noundef %0, ptr noundef %10, i64 noundef %11) #2
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %16, label %4

14:                                               ; preds = %.lr.ph
  %15 = tail call ptr @safe_strdup(ptr noundef nonnull @.str.1)
  br label %.thread

16:                                               ; preds = %.lr.ph.split
  %17 = getelementptr inbounds i8, ptr %9, i64 8
  %18 = load ptr, ptr %17, align 8, !tbaa !14
  %19 = tail call ptr @safe_strdup(ptr noundef %18)
  br label %.thread

20:                                               ; preds = %.preheader
  %21 = load ptr, ptr getelementptr inbounds (i8, ptr @emoji_exact_dev_file_map, i64 16), align 8, !tbaa !11
  %22 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %21) #2
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %50, label %24

24:                                               ; preds = %20
  %25 = load ptr, ptr getelementptr inbounds (i8, ptr @emoji_exact_dev_file_map, i64 32), align 8, !tbaa !11
  %26 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %25) #2
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %50, label %28

28:                                               ; preds = %24
  %29 = load ptr, ptr getelementptr inbounds (i8, ptr @emoji_exact_dev_file_map, i64 48), align 8, !tbaa !11
  %30 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %29) #2
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %50, label %32

32:                                               ; preds = %28
  %33 = load ptr, ptr getelementptr inbounds (i8, ptr @emoji_exact_dev_file_map, i64 64), align 8, !tbaa !11
  %34 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %33) #2
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %50, label %36

36:                                               ; preds = %32
  %37 = load ptr, ptr getelementptr inbounds (i8, ptr @emoji_exact_dev_file_map, i64 80), align 8, !tbaa !11
  %38 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %37) #2
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %50, label %40

40:                                               ; preds = %36
  %41 = load ptr, ptr getelementptr inbounds (i8, ptr @emoji_exact_dev_file_map, i64 96), align 8, !tbaa !11
  %42 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %41) #2
  %43 = icmp eq i32 %42, 0
  br i1 %43, label %50, label %44

44:                                               ; preds = %40
  %45 = load ptr, ptr getelementptr inbounds (i8, ptr @emoji_exact_dev_file_map, i64 112), align 8, !tbaa !11
  %46 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %45) #2
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %50, label %48

48:                                               ; preds = %44
  %49 = tail call ptr @safe_strdup(ptr noundef nonnull @.str.2)
  br label %.thread

50:                                               ; preds = %44, %40, %36, %32, %28, %24, %20, %.preheader
  %.lcssa = phi ptr [ @emoji_exact_dev_file_map, %.preheader ], [ getelementptr inbounds (i8, ptr @emoji_exact_dev_file_map, i64 16), %20 ], [ getelementptr inbounds (i8, ptr @emoji_exact_dev_file_map, i64 32), %24 ], [ getelementptr inbounds (i8, ptr @emoji_exact_dev_file_map, i64 48), %28 ], [ getelementptr inbounds (i8, ptr @emoji_exact_dev_file_map, i64 64), %32 ], [ getelementptr inbounds (i8, ptr @emoji_exact_dev_file_map, i64 80), %36 ], [ getelementptr inbounds (i8, ptr @emoji_exact_dev_file_map, i64 96), %40 ], [ getelementptr inbounds (i8, ptr @emoji_exact_dev_file_map, i64 112), %44 ]
  %51 = getelementptr inbounds i8, ptr %.lcssa, i64 8
  %52 = load ptr, ptr %51, align 8, !tbaa !14
  %53 = tail call ptr @safe_strdup(ptr noundef %52)
  br label %.thread

.thread:                                          ; preds = %16, %14, %50, %48
  %.2 = phi ptr [ %53, %50 ], [ %49, %48 ], [ %19, %16 ], [ %15, %14 ]
  ret ptr %.2
}

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

; Function Attrs: nounwind uwtable
declare hidden ptr @safe_strdup(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strncmp(ptr nocapture noundef, ptr nocapture 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 #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !13, i64 0}
!12 = !{!"", !13, i64 0, !13, i64 8}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!12, !13, i64 8}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass