; LLVM IR from stan-dev/math :: lib/tbb_2020.3/src/test/test_concurrent_queue.ll (ZeqRK5BarExS1_)

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

%class.BarEx = type { i32, i64, i64 }

@.str.17 = external hidden unnamed_addr constant [97 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11ReportErrorPKciS0_S0_(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZeqRK5BarExS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  %6 = getelementptr inbounds %class.BarEx, ptr %5, i32 0, i32 0
  %7 = load i32, ptr %6, align 8, !tbaa !9
  %8 = icmp eq i32 %7, 4660
  br i1 %8, label %9, label %10

9:                                                ; preds = %2
  br label %11

10:                                               ; preds = %2
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.17, i32 noundef 561, ptr noundef @.str.18, ptr noundef null)
  br label %11

11:                                               ; preds = %10, %9
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %class.BarEx, ptr %12, i32 0, i32 0
  %14 = load i32, ptr %13, align 8, !tbaa !9
  %15 = icmp eq i32 %14, 4660
  br i1 %15, label %16, label %17

16:                                               ; preds = %11
  br label %18

17:                                               ; preds = %11
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.17, i32 noundef 562, ptr noundef @.str.19, ptr noundef null)
  br label %18

18:                                               ; preds = %17, %16
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %class.BarEx, ptr %19, i32 0, i32 1
  %21 = load i64, ptr %20, align 8, !tbaa !13
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %class.BarEx, ptr %22, i32 0, i32 2
  %24 = load i64, ptr %23, align 8, !tbaa !14
  %25 = xor i64 %21, %24
  %26 = icmp eq i64 %25, -1
  br i1 %26, label %27, label %28

27:                                               ; preds = %18
  br label %29

28:                                               ; preds = %18
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.17, i32 noundef 563, ptr noundef @.str.20, ptr noundef null)
  br label %29

29:                                               ; preds = %28, %27
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %class.BarEx, ptr %30, i32 0, i32 1
  %32 = load i64, ptr %31, align 8, !tbaa !13
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %class.BarEx, ptr %33, i32 0, i32 2
  %35 = load i64, ptr %34, align 8, !tbaa !14
  %36 = xor i64 %32, %35
  %37 = icmp eq i64 %36, -1
  br i1 %37, label %38, label %39

38:                                               ; preds = %29
  br label %40

39:                                               ; preds = %29
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.17, i32 noundef 564, ptr noundef @.str.21, ptr noundef null)
  br label %40

40:                                               ; preds = %39, %38
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %class.BarEx, ptr %41, i32 0, i32 1
  %43 = load i64, ptr %42, align 8, !tbaa !13
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %class.BarEx, ptr %44, i32 0, i32 1
  %46 = load i64, ptr %45, align 8, !tbaa !13
  %47 = icmp eq i64 %43, %46
  br i1 %47, label %48, label %56

48:                                               ; preds = %40
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %class.BarEx, ptr %49, i32 0, i32 2
  %51 = load i64, ptr %50, align 8, !tbaa !14
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %class.BarEx, ptr %52, i32 0, i32 2
  %54 = load i64, ptr %53, align 8, !tbaa !14
  %55 = icmp eq i64 %51, %54
  br label %56

56:                                               ; preds = %48, %40
  %57 = phi i1 [ false, %40 ], [ %55, %48 ]
  ret i1 %57
}

attributes #0 = { mustprogress 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTS5BarEx", !11, i64 0, !12, i64 8, !12, i64 16}
!11 = !{!"_ZTS7state_t", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!10, !12, i64 8}
!14 = !{!10, !12, i64 16}


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

@.str.17 = external hidden unnamed_addr constant [97 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11ReportErrorPKciS0_S0_(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZeqRK5BarExS1_(ptr nocapture noundef nonnull readonly align 8 dereferenceable(24) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(24) %1) local_unnamed_addr #0 {
  %3 = load i32, ptr %0, align 8, !tbaa !5
  %4 = icmp eq i32 %3, 4660
  br i1 %4, label %6, label %5

5:                                                ; preds = %2
  tail call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.17, i32 noundef 561, ptr noundef nonnull @.str.18, ptr noundef null)
  br label %6

6:                                                ; preds = %2, %5
  %7 = load i32, ptr %1, align 8, !tbaa !5
  %8 = icmp eq i32 %7, 4660
  br i1 %8, label %10, label %9

9:                                                ; preds = %6
  tail call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.17, i32 noundef 562, ptr noundef nonnull @.str.19, ptr noundef null)
  br label %10

10:                                               ; preds = %6, %9
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  %12 = load i64, ptr %11, align 8, !tbaa !11
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %14 = load i64, ptr %13, align 8, !tbaa !12
  %15 = xor i64 %14, %12
  %16 = icmp eq i64 %15, -1
  br i1 %16, label %18, label %17

17:                                               ; preds = %10
  tail call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.17, i32 noundef 563, ptr noundef nonnull @.str.20, ptr noundef null)
  br label %18

18:                                               ; preds = %10, %17
  %19 = getelementptr inbounds i8, ptr %1, i64 8
  %20 = load i64, ptr %19, align 8, !tbaa !11
  %21 = getelementptr inbounds i8, ptr %1, i64 16
  %22 = load i64, ptr %21, align 8
  %23 = xor i64 %22, %20
  %24 = icmp eq i64 %23, -1
  br i1 %24, label %26, label %25

25:                                               ; preds = %18
  tail call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.17, i32 noundef 564, ptr noundef nonnull @.str.21, ptr noundef null)
  %.pre = load i64, ptr %19, align 8, !tbaa !11
  %.pre10 = load i64, ptr %21, align 8
  br label %26

26:                                               ; preds = %18, %25
  %27 = phi i64 [ %22, %18 ], [ %.pre10, %25 ]
  %28 = phi i64 [ %20, %18 ], [ %.pre, %25 ]
  %29 = load i64, ptr %11, align 8, !tbaa !11
  %30 = icmp eq i64 %29, %28
  %31 = load i64, ptr %13, align 8
  %32 = icmp eq i64 %31, %27
  %33 = select i1 %30, i1 %32, i1 false
  ret i1 %33
}

attributes #0 = { mustprogress 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 0}
!6 = !{!"_ZTS5BarEx", !7, i64 0, !10, i64 8, !10, i64 16}
!7 = !{!"_ZTS7state_t", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!6, !10, i64 16}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass