; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/SHORT/COOK69/Problem D/brute.ll (Z3biniiii)

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

@to = external dso_local global [11 x i32], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z8getHashSiii(i32 noundef, i32 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z8getHashTiii(i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z3biniiii(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #2 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i8, align 1
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 %0, ptr %6, align 4, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !5
  %16 = load i32, ptr %6, align 4, !tbaa !5
  %17 = load i32, ptr %7, align 4, !tbaa !5
  %18 = icmp eq i32 %16, %17
  br i1 %18, label %19, label %21

19:                                               ; preds = %4
  %20 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %20, ptr %5, align 4
  br label %78

21:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %22 = load i32, ptr %6, align 4, !tbaa !5
  %23 = load i32, ptr %7, align 4, !tbaa !5
  %24 = add nsw i32 %22, %23
  %25 = add nsw i32 %24, 1
  %26 = sdiv i32 %25, 2
  store i32 %26, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #3
  store i8 1, ptr %11, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %57, %21
  %28 = load i32, ptr %12, align 4, !tbaa !5
  %29 = icmp slt i32 %28, 10
  br i1 %29, label %31, label %30

30:                                               ; preds = %27
  store i32 2, ptr %13, align 4
  br label %60

31:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %32 = load i32, ptr %12, align 4, !tbaa !5
  %33 = load i32, ptr %8, align 4, !tbaa !5
  %34 = load i32, ptr %8, align 4, !tbaa !5
  %35 = load i32, ptr %10, align 4, !tbaa !5
  %36 = add nsw i32 %34, %35
  %37 = sub nsw i32 %36, 1
  %38 = call noundef i32 @_Z8getHashSiii(i32 noundef %32, i32 noundef %33, i32 noundef %37)
  store i32 %38, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %39 = load i32, ptr %12, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [11 x i32], ptr @to, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = load i32, ptr %9, align 4, !tbaa !5
  %44 = load i32, ptr %9, align 4, !tbaa !5
  %45 = load i32, ptr %10, align 4, !tbaa !5
  %46 = add nsw i32 %44, %45
  %47 = sub nsw i32 %46, 1
  %48 = call noundef i32 @_Z8getHashTiii(i32 noundef %42, i32 noundef %43, i32 noundef %47)
  store i32 %48, ptr %15, align 4, !tbaa !5
  %49 = load i32, ptr %14, align 4, !tbaa !5
  %50 = load i32, ptr %15, align 4, !tbaa !5
  %51 = icmp ne i32 %49, %50
  br i1 %51, label %52, label %53

52:                                               ; preds = %31
  store i8 0, ptr %11, align 1, !tbaa !9
  store i32 2, ptr %13, align 4
  br label %54

53:                                               ; preds = %31
  store i32 0, ptr %13, align 4
  br label %54

54:                                               ; preds = %53, %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  %55 = load i32, ptr %13, align 4
  switch i32 %55, label %60 [
    i32 0, label %56
  ]

56:                                               ; preds = %54
  br label %57

57:                                               ; preds = %56
  %58 = load i32, ptr %12, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %12, align 4, !tbaa !5
  br label %27, !llvm.loop !11

60:                                               ; preds = %54, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  br label %61

61:                                               ; preds = %60
  %62 = load i8, ptr %11, align 1, !tbaa !9, !range !13, !noundef !14
  %63 = trunc i8 %62 to i1
  br i1 %63, label %64, label %70

64:                                               ; preds = %61
  %65 = load i32, ptr %10, align 4, !tbaa !5
  %66 = load i32, ptr %7, align 4, !tbaa !5
  %67 = load i32, ptr %8, align 4, !tbaa !5
  %68 = load i32, ptr %9, align 4, !tbaa !5
  %69 = call noundef i32 @_Z3biniiii(i32 noundef %65, i32 noundef %66, i32 noundef %67, i32 noundef %68)
  store i32 %69, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %77

70:                                               ; preds = %61
  %71 = load i32, ptr %6, align 4, !tbaa !5
  %72 = load i32, ptr %10, align 4, !tbaa !5
  %73 = sub nsw i32 %72, 1
  %74 = load i32, ptr %8, align 4, !tbaa !5
  %75 = load i32, ptr %9, align 4, !tbaa !5
  %76 = call noundef i32 @_Z3biniiii(i32 noundef %71, i32 noundef %73, i32 noundef %74, i32 noundef %75)
  store i32 %76, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %77

77:                                               ; preds = %70, %64
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %78

78:                                               ; preds = %77, %19
  %79 = load i32, ptr %5, align 4
  ret i32 %79
}

attributes #0 = { mustprogress 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 = { 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" }
attributes #3 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{i8 0, i8 2}
!14 = !{}


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

@to = external dso_local local_unnamed_addr global [11 x i32], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z8getHashSiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z8getHashTiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_Z3biniiii(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = icmp eq i32 %0, %1
  br i1 %5, label %tailrecurse.outer._crit_edge, label %.lr.ph.lr.ph

.lr.ph.lr.ph:                                     ; preds = %4
  %6 = add i32 %2, -1
  %7 = add i32 %3, -1
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.lr.ph, %.critedge
  %.tr35.ph47 = phi i32 [ %1, %.lr.ph.lr.ph ], [ %.tr3544, %.critedge ]
  %.tr.ph46 = phi i32 [ %0, %.lr.ph.lr.ph ], [ %11, %.critedge ]
  %8 = add i32 %.tr.ph46, 1
  br label %9

9:                                                ; preds = %.lr.ph, %tailrecurse
  %.tr3544 = phi i32 [ %.tr35.ph47, %.lr.ph ], [ %54, %tailrecurse ]
  %10 = add i32 %8, %.tr3544
  %11 = sdiv i32 %10, 2
  %12 = add i32 %6, %11
  %13 = add i32 %7, %11
  %14 = tail call noundef i32 @_Z8getHashSiii(i32 noundef 0, i32 noundef %2, i32 noundef %12)
  %15 = load i32, ptr @to, align 16, !tbaa !5
  %16 = tail call noundef i32 @_Z8getHashTiii(i32 noundef %15, i32 noundef %3, i32 noundef %13)
  %.not = icmp eq i32 %14, %16
  br i1 %.not, label %17, label %tailrecurse

17:                                               ; preds = %9
  %18 = tail call noundef i32 @_Z8getHashSiii(i32 noundef 1, i32 noundef %2, i32 noundef %12)
  %19 = load i32, ptr getelementptr inbounds (i8, ptr @to, i64 4), align 4, !tbaa !5
  %20 = tail call noundef i32 @_Z8getHashTiii(i32 noundef %19, i32 noundef %3, i32 noundef %13)
  %.not.1 = icmp eq i32 %18, %20
  br i1 %.not.1, label %21, label %tailrecurse

21:                                               ; preds = %17
  %22 = tail call noundef i32 @_Z8getHashSiii(i32 noundef 2, i32 noundef %2, i32 noundef %12)
  %23 = load i32, ptr getelementptr inbounds (i8, ptr @to, i64 8), align 8, !tbaa !5
  %24 = tail call noundef i32 @_Z8getHashTiii(i32 noundef %23, i32 noundef %3, i32 noundef %13)
  %.not.2 = icmp eq i32 %22, %24
  br i1 %.not.2, label %25, label %tailrecurse

25:                                               ; preds = %21
  %26 = tail call noundef i32 @_Z8getHashSiii(i32 noundef 3, i32 noundef %2, i32 noundef %12)
  %27 = load i32, ptr getelementptr inbounds (i8, ptr @to, i64 12), align 4, !tbaa !5
  %28 = tail call noundef i32 @_Z8getHashTiii(i32 noundef %27, i32 noundef %3, i32 noundef %13)
  %.not.3 = icmp eq i32 %26, %28
  br i1 %.not.3, label %29, label %tailrecurse

29:                                               ; preds = %25
  %30 = tail call noundef i32 @_Z8getHashSiii(i32 noundef 4, i32 noundef %2, i32 noundef %12)
  %31 = load i32, ptr getelementptr inbounds (i8, ptr @to, i64 16), align 16, !tbaa !5
  %32 = tail call noundef i32 @_Z8getHashTiii(i32 noundef %31, i32 noundef %3, i32 noundef %13)
  %.not.4 = icmp eq i32 %30, %32
  br i1 %.not.4, label %33, label %tailrecurse

33:                                               ; preds = %29
  %34 = tail call noundef i32 @_Z8getHashSiii(i32 noundef 5, i32 noundef %2, i32 noundef %12)
  %35 = load i32, ptr getelementptr inbounds (i8, ptr @to, i64 20), align 4, !tbaa !5
  %36 = tail call noundef i32 @_Z8getHashTiii(i32 noundef %35, i32 noundef %3, i32 noundef %13)
  %.not.5 = icmp eq i32 %34, %36
  br i1 %.not.5, label %37, label %tailrecurse

37:                                               ; preds = %33
  %38 = tail call noundef i32 @_Z8getHashSiii(i32 noundef 6, i32 noundef %2, i32 noundef %12)
  %39 = load i32, ptr getelementptr inbounds (i8, ptr @to, i64 24), align 8, !tbaa !5
  %40 = tail call noundef i32 @_Z8getHashTiii(i32 noundef %39, i32 noundef %3, i32 noundef %13)
  %.not.6 = icmp eq i32 %38, %40
  br i1 %.not.6, label %41, label %tailrecurse

41:                                               ; preds = %37
  %42 = tail call noundef i32 @_Z8getHashSiii(i32 noundef 7, i32 noundef %2, i32 noundef %12)
  %43 = load i32, ptr getelementptr inbounds (i8, ptr @to, i64 28), align 4, !tbaa !5
  %44 = tail call noundef i32 @_Z8getHashTiii(i32 noundef %43, i32 noundef %3, i32 noundef %13)
  %.not.7 = icmp eq i32 %42, %44
  br i1 %.not.7, label %45, label %tailrecurse

45:                                               ; preds = %41
  %46 = tail call noundef i32 @_Z8getHashSiii(i32 noundef 8, i32 noundef %2, i32 noundef %12)
  %47 = load i32, ptr getelementptr inbounds (i8, ptr @to, i64 32), align 16, !tbaa !5
  %48 = tail call noundef i32 @_Z8getHashTiii(i32 noundef %47, i32 noundef %3, i32 noundef %13)
  %.not.8 = icmp eq i32 %46, %48
  br i1 %.not.8, label %49, label %tailrecurse

49:                                               ; preds = %45
  %50 = tail call noundef i32 @_Z8getHashSiii(i32 noundef 9, i32 noundef %2, i32 noundef %12)
  %51 = load i32, ptr getelementptr inbounds (i8, ptr @to, i64 36), align 4, !tbaa !5
  %52 = tail call noundef i32 @_Z8getHashTiii(i32 noundef %51, i32 noundef %3, i32 noundef %13)
  %.not.9 = icmp eq i32 %50, %52
  br i1 %.not.9, label %.critedge, label %tailrecurse

.critedge:                                        ; preds = %49
  %53 = icmp eq i32 %11, %.tr3544
  br i1 %53, label %tailrecurse.outer._crit_edge, label %.lr.ph

tailrecurse:                                      ; preds = %49, %45, %41, %37, %33, %29, %25, %21, %17, %9
  %54 = add nsw i32 %11, -1
  %55 = icmp eq i32 %.tr.ph46, %54
  br i1 %55, label %tailrecurse.outer._crit_edge, label %9

tailrecurse.outer._crit_edge:                     ; preds = %.critedge, %tailrecurse, %4
  %.tr.ph.lcssa = phi i32 [ %0, %4 ], [ %.tr.ph46, %tailrecurse ], [ %.tr3544, %.critedge ]
  ret i32 %.tr.ph.lcssa
}

attributes #0 = { mustprogress 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" }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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