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

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

@.str.1 = external hidden unnamed_addr constant [74 x i8], align 1
@obint_hash.init = external hidden global i8, align 1
@obint_hash.seed = external hidden global i64, align 8
@.str.10 = external hidden unnamed_addr constant [8 x i8], align 1
@__PRETTY_FUNCTION__.obint_hash = external hidden unnamed_addr constant [34 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [31 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

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

9:                                                ; preds = %1
  br label %11

10:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.1, i32 noundef 386, ptr noundef @__PRETTY_FUNCTION__.obint_hash) #6
  unreachable

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

15:                                               ; preds = %11
  br label %17

16:                                               ; preds = %11
  call void @__assert_fail(ptr noundef @.str.12, ptr noundef @.str.1, i32 noundef 387, ptr noundef @__PRETTY_FUNCTION__.obint_hash) #6
  unreachable

17:                                               ; preds = %15
  %18 = load i8, ptr @obint_hash.init, align 1, !tbaa !9
  %19 = sext i8 %18 to i32
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %21, label %26

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

26:                                               ; preds = %21, %17
  %27 = load i64, ptr @obint_hash.seed, align 8, !tbaa !10
  store i64 %27, ptr %4, align 8, !tbaa !10
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = call i64 @obint_most_sig(ptr noundef %28)
  store i64 %29, ptr %3, align 8, !tbaa !10
  br label %30

30:                                               ; preds = %54, %26
  %31 = load i64, ptr %3, align 8, !tbaa !10
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.obint_struct, ptr %32, i32 0, i32 3
  %34 = load i64, ptr %33, align 8, !tbaa !12
  %35 = icmp ult i64 %31, %34
  br i1 %35, label %36, label %57

36:                                               ; preds = %30
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.obint_struct, ptr %37, i32 0, i32 2
  %39 = load ptr, ptr %38, align 8, !tbaa !14
  %40 = load i64, ptr %3, align 8, !tbaa !10
  %41 = getelementptr inbounds i8, ptr %39, i64 %40
  %42 = load i8, ptr %41, align 1, !tbaa !9
  %43 = sext i8 %42 to i64
  %44 = load i64, ptr %4, align 8, !tbaa !10
  %45 = add i64 %44, %43
  store i64 %45, ptr %4, align 8, !tbaa !10
  %46 = load i64, ptr %4, align 8, !tbaa !10
  %47 = shl i64 %46, 10
  %48 = load i64, ptr %4, align 8, !tbaa !10
  %49 = add i64 %48, %47
  store i64 %49, ptr %4, align 8, !tbaa !10
  %50 = load i64, ptr %4, align 8, !tbaa !10
  %51 = lshr i64 %50, 6
  %52 = load i64, ptr %4, align 8, !tbaa !10
  %53 = xor i64 %52, %51
  store i64 %53, ptr %4, align 8, !tbaa !10
  br label %54

54:                                               ; preds = %36
  %55 = load i64, ptr %3, align 8, !tbaa !10
  %56 = add i64 %55, -1
  store i64 %56, ptr %3, align 8, !tbaa !10
  br label %30, !llvm.loop !15

57:                                               ; preds = %30
  %58 = load i64, ptr %4, align 8, !tbaa !10
  %59 = shl i64 %58, 3
  %60 = load i64, ptr %4, align 8, !tbaa !10
  %61 = add i64 %60, %59
  store i64 %61, ptr %4, align 8, !tbaa !10
  %62 = load i64, ptr %4, align 8, !tbaa !10
  %63 = lshr i64 %62, 11
  %64 = load i64, ptr %4, align 8, !tbaa !10
  %65 = xor i64 %64, %63
  store i64 %65, ptr %4, align 8, !tbaa !10
  %66 = load i64, ptr %4, align 8, !tbaa !10
  %67 = shl i64 %66, 15
  %68 = load i64, ptr %4, align 8, !tbaa !10
  %69 = mul i64 %68, %67
  store i64 %69, ptr %4, align 8, !tbaa !10
  %70 = load i64, ptr %4, align 8, !tbaa !10
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret i64 %70
}

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

; 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

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 = !{!13, !11, i64 24}
!13 = !{!"obint_struct", !6, i64 0, !7, i64 8, !6, i64 16, !11, i64 24}
!14 = !{!13, !6, i64 16}
!15 = distinct !{!15, !16}
!16 = !{!"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 [74 x i8], align 1
@obint_hash.init = external hidden local_unnamed_addr global i8, align 1
@obint_hash.seed = external hidden local_unnamed_addr global i64, align 8
@.str.10 = external hidden unnamed_addr constant [8 x i8], align 1
@__PRETTY_FUNCTION__.obint_hash = external hidden unnamed_addr constant [34 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [31 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 i64 @obint_most_sig(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i64 @obint_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.10, ptr noundef nonnull @.str.1, i32 noundef 386, ptr noundef nonnull @__PRETTY_FUNCTION__.obint_hash) #4
  unreachable

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

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

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

._crit_edge25:                                    ; preds = %6
  %.pre = load i64, ptr @obint_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 @obint_hash.seed, align 8, !tbaa !8
  store i8 1, ptr @obint_hash.init, align 1, !tbaa !5
  br label %14

14:                                               ; preds = %._crit_edge25, %9
  %15 = phi i64 [ %.pre, %._crit_edge25 ], [ %13, %9 ]
  %16 = tail call i64 @obint_most_sig(ptr noundef nonnull %0)
  %17 = getelementptr inbounds i8, ptr %0, i64 24
  %18 = load i64, ptr %17, align 8, !tbaa !10
  %19 = icmp ult i64 %16, %18
  br i1 %19, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %14
  %20 = getelementptr inbounds i8, ptr %0, i64 16
  %21 = load ptr, ptr %20, align 8, !tbaa !13
  br label %22

22:                                               ; preds = %.lr.ph, %22
  %.024 = phi i64 [ %16, %.lr.ph ], [ %30, %22 ]
  %.02023 = phi i64 [ %15, %.lr.ph ], [ %29, %22 ]
  %23 = getelementptr inbounds i8, ptr %21, i64 %.024
  %24 = load i8, ptr %23, align 1, !tbaa !5
  %25 = sext i8 %24 to i64
  %26 = add i64 %.02023, %25
  %27 = mul i64 %26, 1025
  %28 = lshr i64 %27, 6
  %29 = xor i64 %28, %27
  %30 = add i64 %.024, -1
  %31 = icmp ult i64 %30, %18
  br i1 %31, label %22, label %._crit_edge, !llvm.loop !14

._crit_edge:                                      ; preds = %22, %14
  %.020.lcssa = phi i64 [ %15, %14 ], [ %29, %22 ]
  %32 = mul i64 %.020.lcssa, 9
  %33 = lshr i64 %32, 11
  %34 = xor i64 %33, %32
  %35 = shl i64 %34, 15
  %36 = mul i64 %35, %34
  ret i64 %36
}

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

; 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

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 = !{!11, !9, i64 24}
!11 = !{!"obint_struct", !12, i64 0, !6, i64 8, !12, i64 16, !9, i64 24}
!12 = !{!"any pointer", !6, i64 0}
!13 = !{!11, !12, i64 16}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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