; LLVM IR from theck01/offbrand_lib :: src/classes (obdeque)

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

@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@obdeque_hash.init = external hidden global i8, align 1
@obdeque_hash.seed = external hidden global i64, align 8
@.str.20 = external hidden unnamed_addr constant [8 x i8], align 1
@__PRETTY_FUNCTION__.obdeque_hash = external hidden unnamed_addr constant [36 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [33 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @obdeque_head_iterator(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local ptr @obdeque_obj_at_iterator(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @obdeque_iterate_next(ptr noundef, ptr noundef) #2

declare ptr @ob_release(ptr noundef) #3

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

declare zeroext i8 @ob_has_class(ptr noundef, ptr noundef) #3

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

11:                                               ; preds = %1
  br label %13

12:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str.20, ptr noundef @.str.1, i32 noundef 619, ptr noundef @__PRETTY_FUNCTION__.obdeque_hash) #6
  unreachable

13:                                               ; preds = %11
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = call zeroext i8 @ob_has_class(ptr noundef %14, ptr noundef @.str.21)
  %16 = icmp ne i8 %15, 0
  br i1 %16, label %17, label %18

17:                                               ; preds = %13
  br label %19

18:                                               ; preds = %13
  call void @__assert_fail(ptr noundef @.str.22, ptr noundef @.str.1, i32 noundef 620, ptr noundef @__PRETTY_FUNCTION__.obdeque_hash) #6
  unreachable

19:                                               ; preds = %17
  %20 = load i8, ptr @obdeque_hash.init, align 1, !tbaa !9
  %21 = sext i8 %20 to i32
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %28

23:                                               ; preds = %19
  %24 = call i64 @time(ptr noundef null) #5
  %25 = trunc i64 %24 to i32
  call void @srand(i32 noundef %25) #5
  %26 = call i32 @rand() #5
  %27 = sext i32 %26 to i64
  store i64 %27, ptr @obdeque_hash.seed, align 8, !tbaa !10
  store i8 1, ptr @obdeque_hash.init, align 1, !tbaa !9
  br label %28

28:                                               ; preds = %23, %19
  %29 = load i64, ptr @obdeque_hash.seed, align 8, !tbaa !10
  store i64 %29, ptr %4, align 8, !tbaa !10
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = call ptr @obdeque_head_iterator(ptr noundef %30)
  store ptr %31, ptr %6, align 8, !tbaa !5
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = icmp ne ptr %32, null
  br i1 %33, label %36, label %34

34:                                               ; preds = %28
  %35 = load i64, ptr %4, align 8, !tbaa !10
  store i64 %35, ptr %2, align 8
  store i32 1, ptr %7, align 4
  br label %73

36:                                               ; preds = %28
  br label %37

37:                                               ; preds = %52, %36
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = call ptr @obdeque_obj_at_iterator(ptr noundef %38, ptr noundef %39)
  %41 = call i64 @ob_hash(ptr noundef %40)
  %42 = load i64, ptr %4, align 8, !tbaa !10
  %43 = add i64 %42, %41
  store i64 %43, ptr %4, align 8, !tbaa !10
  %44 = load i64, ptr %4, align 8, !tbaa !10
  %45 = shl i64 %44, 10
  %46 = load i64, ptr %4, align 8, !tbaa !10
  %47 = add i64 %46, %45
  store i64 %47, ptr %4, align 8, !tbaa !10
  %48 = load i64, ptr %4, align 8, !tbaa !10
  %49 = lshr i64 %48, 6
  %50 = load i64, ptr %4, align 8, !tbaa !10
  %51 = xor i64 %50, %49
  store i64 %51, ptr %4, align 8, !tbaa !10
  br label %52

52:                                               ; preds = %37
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = call zeroext i8 @obdeque_iterate_next(ptr noundef %53, ptr noundef %54)
  %56 = icmp ne i8 %55, 0
  br i1 %56, label %37, label %57, !llvm.loop !12

57:                                               ; preds = %52
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = call ptr @ob_release(ptr noundef %58)
  %60 = load i64, ptr %4, align 8, !tbaa !10
  %61 = shl i64 %60, 3
  %62 = load i64, ptr %4, align 8, !tbaa !10
  %63 = add i64 %62, %61
  store i64 %63, ptr %4, align 8, !tbaa !10
  %64 = load i64, ptr %4, align 8, !tbaa !10
  %65 = lshr i64 %64, 11
  %66 = load i64, ptr %4, align 8, !tbaa !10
  %67 = xor i64 %66, %65
  store i64 %67, ptr %4, align 8, !tbaa !10
  %68 = load i64, ptr %4, align 8, !tbaa !10
  %69 = shl i64 %68, 15
  %70 = load i64, ptr %4, align 8, !tbaa !10
  %71 = add i64 %70, %69
  store i64 %71, ptr %4, align 8, !tbaa !10
  %72 = load i64, ptr %4, align 8, !tbaa !10
  store i64 %72, ptr %2, align 8
  store i32 1, ptr %7, align 4
  br label %73

73:                                               ; preds = %57, %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  %74 = load i64, ptr %2, align 8
  ret i64 %74
}

; Function Attrs: nounwind
declare void @srand(i32 noundef) #4

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #4

; Function Attrs: nounwind
declare i32 @rand() #4

declare i64 @ob_hash(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn nounwind "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 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 #3 = { "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 "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 #5 = { nounwind }
attributes #6 = { noreturn 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}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !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"

@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@obdeque_hash.init = external hidden local_unnamed_addr global i8, align 1
@obdeque_hash.seed = external hidden local_unnamed_addr global i64, align 8
@.str.20 = external hidden unnamed_addr constant [8 x i8], align 1
@__PRETTY_FUNCTION__.obdeque_hash = external hidden unnamed_addr constant [36 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [33 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @obdeque_obj_at_iterator(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @obdeque_iterate_next(ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @ob_release(ptr noundef) local_unnamed_addr #2

declare zeroext i8 @ob_has_class(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local i64 @obdeque_hash(ptr noundef %0) local_unnamed_addr #1 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %2, label %3

2:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.1, i32 noundef 619, ptr noundef nonnull @__PRETTY_FUNCTION__.obdeque_hash) #4
  unreachable

3:                                                ; preds = %1
  %4 = tail call zeroext i8 @ob_has_class(ptr noundef nonnull %0, ptr noundef nonnull @.str.21) #5
  %.not25 = icmp eq i8 %4, 0
  br i1 %.not25, label %5, label %6

5:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str.22, ptr noundef nonnull @.str.1, i32 noundef 620, ptr noundef nonnull @__PRETTY_FUNCTION__.obdeque_hash) #4
  unreachable

6:                                                ; preds = %3
  %7 = load i8, ptr @obdeque_hash.init, align 1, !tbaa !5
  %8 = icmp eq i8 %7, 0
  br i1 %8, label %9, label %._crit_edge

._crit_edge:                                      ; preds = %6
  %.pre = load i64, ptr @obdeque_hash.seed, align 8, !tbaa !8
  br label %14

9:                                                ; preds = %6
  %10 = tail call i64 @time(ptr noundef null) #5
  %11 = trunc i64 %10 to i32
  tail call void @srand(i32 noundef %11) #5
  %12 = tail call i32 @rand() #5
  %13 = sext i32 %12 to i64
  store i64 %13, ptr @obdeque_hash.seed, align 8, !tbaa !8
  store i8 1, ptr @obdeque_hash.init, align 1, !tbaa !5
  br label %14

14:                                               ; preds = %._crit_edge, %9
  %15 = phi i64 [ %.pre, %._crit_edge ], [ %13, %9 ]
  %16 = tail call ptr @obdeque_head_iterator(ptr noundef nonnull %0)
  %.not26 = icmp eq ptr %16, null
  br i1 %.not26, label %30, label %.preheader

.preheader:                                       ; preds = %14, %.preheader
  %.023 = phi i64 [ %22, %.preheader ], [ %15, %14 ]
  %17 = tail call ptr @obdeque_obj_at_iterator(ptr noundef nonnull %0, ptr noundef nonnull %16)
  %18 = tail call i64 @ob_hash(ptr noundef %17) #5
  %19 = add i64 %18, %.023
  %20 = mul i64 %19, 1025
  %21 = lshr i64 %20, 6
  %22 = xor i64 %21, %20
  %23 = tail call zeroext i8 @obdeque_iterate_next(ptr noundef nonnull %0, ptr noundef nonnull %16)
  %.not27 = icmp eq i8 %23, 0
  br i1 %.not27, label %24, label %.preheader, !llvm.loop !10

24:                                               ; preds = %.preheader
  %25 = tail call ptr @ob_release(ptr noundef nonnull %16) #5
  %26 = mul i64 %22, 9
  %27 = lshr i64 %26, 11
  %28 = xor i64 %27, %26
  %29 = mul i64 %28, 32769
  br label %30

30:                                               ; preds = %14, %24
  %.0 = phi i64 [ %29, %24 ], [ %15, %14 ]
  ret i64 %.0
}

; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #3

declare i64 @ob_hash(ptr noundef) local_unnamed_addr #2

attributes #0 = { noreturn nounwind "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 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 = { "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 "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 = { noreturn nounwind }
attributes #5 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass