; LLVM IR from matz/streem :: src (string)

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @strm_str_len(i64 noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @strm_str_eq(i64 noundef %0, i64 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  store i64 %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !5
  %6 = load i64, ptr %4, align 8, !tbaa !5
  %7 = load i64, ptr %5, align 8, !tbaa !5
  %8 = icmp eq i64 %6, %7
  br i1 %8, label %9, label %10

9:                                                ; preds = %2
  store i32 1, ptr %3, align 4
  br label %36

10:                                               ; preds = %2
  %11 = load i64, ptr %4, align 8, !tbaa !5
  %12 = and i64 %11, -281474976710656
  %13 = icmp eq i64 %12, -1688849860263936
  br i1 %13, label %14, label %19

14:                                               ; preds = %10
  %15 = load i64, ptr %5, align 8, !tbaa !5
  %16 = and i64 %15, -281474976710656
  %17 = icmp eq i64 %16, -1688849860263936
  br i1 %17, label %18, label %19

18:                                               ; preds = %14
  store i32 0, ptr %3, align 4
  br label %36

19:                                               ; preds = %14, %10
  %20 = load i64, ptr %4, align 8, !tbaa !5
  %21 = call i32 @strm_str_len(i64 noundef %20)
  %22 = load i64, ptr %5, align 8, !tbaa !5
  %23 = call i32 @strm_str_len(i64 noundef %22)
  %24 = icmp ne i32 %21, %23
  br i1 %24, label %25, label %26

25:                                               ; preds = %19
  store i32 0, ptr %3, align 4
  br label %36

26:                                               ; preds = %19
  %27 = call ptr @strm_strp_ptr(ptr noundef %4)
  %28 = call ptr @strm_strp_ptr(ptr noundef %5)
  %29 = load i64, ptr %4, align 8, !tbaa !5
  %30 = call i32 @strm_str_len(i64 noundef %29)
  %31 = sext i32 %30 to i64
  %32 = call i32 @memcmp(ptr noundef %27, ptr noundef %28, i64 noundef %31) #2
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %34, label %35

34:                                               ; preds = %26
  store i32 1, ptr %3, align 4
  br label %36

35:                                               ; preds = %26
  store i32 0, ptr %3, align 4
  br label %36

36:                                               ; preds = %35, %34, %25, %18, %9
  %37 = load i32, ptr %3, align 4
  ret i32 %37
}

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


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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @strm_str_len(i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @strm_str_eq(i64 noundef %0, i64 noundef %1) local_unnamed_addr #0 {
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  store i64 %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !5
  %5 = icmp eq i64 %0, %1
  br i1 %5, label %21, label %6

6:                                                ; preds = %2
  %7 = and i64 %0, -281474976710656
  %8 = icmp eq i64 %7, -1688849860263936
  %9 = and i64 %1, -281474976710656
  %10 = icmp eq i64 %9, -1688849860263936
  %or.cond = and i1 %8, %10
  br i1 %or.cond, label %21, label %11

11:                                               ; preds = %6
  %12 = tail call i32 @strm_str_len(i64 noundef %0)
  %13 = tail call i32 @strm_str_len(i64 noundef %1)
  %.not = icmp eq i32 %12, %13
  br i1 %.not, label %14, label %21

14:                                               ; preds = %11
  %15 = call ptr @strm_strp_ptr(ptr noundef nonnull %3)
  %16 = call ptr @strm_strp_ptr(ptr noundef nonnull %4)
  %17 = load i64, ptr %3, align 8, !tbaa !5
  %18 = call i32 @strm_str_len(i64 noundef %17)
  %19 = sext i32 %18 to i64
  %bcmp = call i32 @bcmp(ptr %15, ptr %16, i64 %19)
  %20 = icmp eq i32 %bcmp, 0
  %. = zext i1 %20 to i32
  br label %21

21:                                               ; preds = %14, %11, %6, %2
  %.0 = phi i32 [ 1, %2 ], [ 0, %6 ], [ 0, %11 ], [ %., %14 ]
  ret i32 %.0
}

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) 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 = { nofree nounwind willreturn memory(argmem: 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"}


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