; LLVM IR from Chasmiccoder/Algos-for-Amigos :: IIITH-Coursework/2-Automata-Theory/Programming-Assignment-2 (rps)

; 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.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z10random_intii(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 void @_ZNSt6vectorIS_IiSaIiEESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z16mutate_one_stateRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z21mutate_one_transitionRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z10mutate_dfaSt6vectorIS_IiSaIiEESaIS1_EEif(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8 %0, ptr noundef %1, i32 noundef %2, float noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca float, align 4
  %9 = alloca i1, align 1
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store ptr %0, ptr %5, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store float %3, ptr %8, align 4, !tbaa !11
  store i1 false, ptr %9, align 1
  call void @_ZNSt6vectorIS_IiSaIiEESaIS1_EEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1)
  %16 = load float, ptr %8, align 4, !tbaa !11
  %17 = fcmp olt float %16, 8.500000e+01
  br i1 %17, label %18, label %36

18:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %32, %18
  %20 = load i32, ptr %10, align 4, !tbaa !9
  %21 = icmp slt i32 %20, 5
  br i1 %21, label %23, label %22

22:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %35

23:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %24 = call noundef i32 @_Z10random_intii(i32 noundef 0, i32 noundef 1)
  store i32 %24, ptr %11, align 4, !tbaa !9
  %25 = load i32, ptr %11, align 4, !tbaa !9
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %27, label %29

27:                                               ; preds = %23
  %28 = load i32, ptr %7, align 4, !tbaa !9
  call void @_Z16mutate_one_stateRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %28)
  br label %31

29:                                               ; preds = %23
  %30 = load i32, ptr %7, align 4, !tbaa !9
  call void @_Z21mutate_one_transitionRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %30)
  br label %31

31:                                               ; preds = %29, %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  br label %32

32:                                               ; preds = %31
  %33 = load i32, ptr %10, align 4, !tbaa !9
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %10, align 4, !tbaa !9
  br label %19, !llvm.loop !13

35:                                               ; preds = %22
  br label %80

36:                                               ; preds = %4
  %37 = load float, ptr %8, align 4, !tbaa !11
  %38 = fcmp olt float %37, 9.000000e+01
  br i1 %38, label %39, label %57

39:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %53, %39
  %41 = load i32, ptr %12, align 4, !tbaa !9
  %42 = icmp slt i32 %41, 3
  br i1 %42, label %44, label %43

43:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  br label %56

44:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %45 = call noundef i32 @_Z10random_intii(i32 noundef 0, i32 noundef 1)
  store i32 %45, ptr %13, align 4, !tbaa !9
  %46 = load i32, ptr %13, align 4, !tbaa !9
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %50

48:                                               ; preds = %44
  %49 = load i32, ptr %7, align 4, !tbaa !9
  call void @_Z16mutate_one_stateRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %49)
  br label %52

50:                                               ; preds = %44
  %51 = load i32, ptr %7, align 4, !tbaa !9
  call void @_Z21mutate_one_transitionRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %51)
  br label %52

52:                                               ; preds = %50, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  br label %53

53:                                               ; preds = %52
  %54 = load i32, ptr %12, align 4, !tbaa !9
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %12, align 4, !tbaa !9
  br label %40, !llvm.loop !15

56:                                               ; preds = %43
  br label %79

57:                                               ; preds = %36
  %58 = load float, ptr %8, align 4, !tbaa !11
  %59 = fcmp olt float %58, 1.000000e+02
  br i1 %59, label %60, label %78

60:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %61

61:                                               ; preds = %74, %60
  %62 = load i32, ptr %14, align 4, !tbaa !9
  %63 = icmp slt i32 %62, 1
  br i1 %63, label %65, label %64

64:                                               ; preds = %61
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  br label %77

65:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %66 = call noundef i32 @_Z10random_intii(i32 noundef 0, i32 noundef 1)
  store i32 %66, ptr %15, align 4, !tbaa !9
  %67 = load i32, ptr %15, align 4, !tbaa !9
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %71

69:                                               ; preds = %65
  %70 = load i32, ptr %7, align 4, !tbaa !9
  call void @_Z16mutate_one_stateRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %70)
  br label %73

71:                                               ; preds = %65
  %72 = load i32, ptr %7, align 4, !tbaa !9
  call void @_Z21mutate_one_transitionRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %72)
  br label %73

73:                                               ; preds = %71, %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  br label %74

74:                                               ; preds = %73
  %75 = load i32, ptr %14, align 4, !tbaa !9
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %14, align 4, !tbaa !9
  br label %61, !llvm.loop !16

77:                                               ; preds = %64
  br label %78

78:                                               ; preds = %77, %57
  br label %79

79:                                               ; preds = %78, %56
  br label %80

80:                                               ; preds = %79, %35
  store i1 true, ptr %9, align 1
  %81 = load i1, ptr %9, align 1
  br i1 %81, label %83, label %82

82:                                               ; preds = %80
  call void @_ZNSt6vectorIS_IiSaIiEESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  br label %83

83:                                               ; preds = %82, %80
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIS_IiSaIiEESaIS1_EEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !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"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z16mutate_one_stateRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z21mutate_one_transitionRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z10mutate_dfaSt6vectorIS_IiSaIiEESaIS1_EEif(ptr dead_on_unwind noalias nonnull writable sret(%"class.std::vector") align 8 %0, ptr noundef nonnull %1, i32 noundef %2, float noundef %3) local_unnamed_addr #1 {
  tail call void @_ZNSt6vectorIS_IiSaIiEESaIS1_EEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1)
  %5 = fcmp olt float %3, 8.500000e+01
  br i1 %5, label %.preheader.preheader, label %21

.preheader.preheader:                             ; preds = %4
  %6 = tail call noundef i32 @_Z10random_intii(i32 noundef 0, i32 noundef 1)
  %.not22 = icmp eq i32 %6, 0
  br i1 %.not22, label %8, label %7

7:                                                ; preds = %.preheader.preheader
  tail call void @_Z16mutate_one_stateRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.preheader.1

8:                                                ; preds = %.preheader.preheader
  tail call void @_Z21mutate_one_transitionRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.preheader.1

.preheader.1:                                     ; preds = %8, %7
  %9 = tail call noundef i32 @_Z10random_intii(i32 noundef 0, i32 noundef 1)
  %.not22.1 = icmp eq i32 %9, 0
  br i1 %.not22.1, label %11, label %10

10:                                               ; preds = %.preheader.1
  tail call void @_Z16mutate_one_stateRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.preheader.2

11:                                               ; preds = %.preheader.1
  tail call void @_Z21mutate_one_transitionRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.preheader.2

.preheader.2:                                     ; preds = %11, %10
  %12 = tail call noundef i32 @_Z10random_intii(i32 noundef 0, i32 noundef 1)
  %.not22.2 = icmp eq i32 %12, 0
  br i1 %.not22.2, label %14, label %13

13:                                               ; preds = %.preheader.2
  tail call void @_Z16mutate_one_stateRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.preheader.3

14:                                               ; preds = %.preheader.2
  tail call void @_Z21mutate_one_transitionRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.preheader.3

.preheader.3:                                     ; preds = %14, %13
  %15 = tail call noundef i32 @_Z10random_intii(i32 noundef 0, i32 noundef 1)
  %.not22.3 = icmp eq i32 %15, 0
  br i1 %.not22.3, label %17, label %16

16:                                               ; preds = %.preheader.3
  tail call void @_Z16mutate_one_stateRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.preheader.4

17:                                               ; preds = %.preheader.3
  tail call void @_Z21mutate_one_transitionRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.preheader.4

.preheader.4:                                     ; preds = %17, %16
  %18 = tail call noundef i32 @_Z10random_intii(i32 noundef 0, i32 noundef 1)
  %.not22.4 = icmp eq i32 %18, 0
  br i1 %.not22.4, label %20, label %19

19:                                               ; preds = %.preheader.4
  tail call void @_Z16mutate_one_stateRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.critedge

20:                                               ; preds = %.preheader.4
  tail call void @_Z21mutate_one_transitionRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.critedge

21:                                               ; preds = %4
  %22 = fcmp olt float %3, 9.000000e+01
  br i1 %22, label %.preheader23.preheader, label %32

.preheader23.preheader:                           ; preds = %21
  %23 = tail call noundef i32 @_Z10random_intii(i32 noundef 0, i32 noundef 1)
  %.not21 = icmp eq i32 %23, 0
  br i1 %.not21, label %25, label %24

24:                                               ; preds = %.preheader23.preheader
  tail call void @_Z16mutate_one_stateRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.preheader23.1

25:                                               ; preds = %.preheader23.preheader
  tail call void @_Z21mutate_one_transitionRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.preheader23.1

.preheader23.1:                                   ; preds = %25, %24
  %26 = tail call noundef i32 @_Z10random_intii(i32 noundef 0, i32 noundef 1)
  %.not21.1 = icmp eq i32 %26, 0
  br i1 %.not21.1, label %28, label %27

27:                                               ; preds = %.preheader23.1
  tail call void @_Z16mutate_one_stateRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.preheader23.2

28:                                               ; preds = %.preheader23.1
  tail call void @_Z21mutate_one_transitionRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.preheader23.2

.preheader23.2:                                   ; preds = %28, %27
  %29 = tail call noundef i32 @_Z10random_intii(i32 noundef 0, i32 noundef 1)
  %.not21.2 = icmp eq i32 %29, 0
  br i1 %.not21.2, label %31, label %30

30:                                               ; preds = %.preheader23.2
  tail call void @_Z16mutate_one_stateRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.critedge

31:                                               ; preds = %.preheader23.2
  tail call void @_Z21mutate_one_transitionRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.critedge

32:                                               ; preds = %21
  %33 = fcmp olt float %3, 1.000000e+02
  br i1 %33, label %34, label %.critedge

34:                                               ; preds = %32
  %35 = tail call noundef i32 @_Z10random_intii(i32 noundef 0, i32 noundef 1)
  %.not = icmp eq i32 %35, 0
  br i1 %.not, label %37, label %36

36:                                               ; preds = %34
  tail call void @_Z16mutate_one_stateRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.critedge

37:                                               ; preds = %34
  tail call void @_Z21mutate_one_transitionRSt6vectorIS_IiSaIiEESaIS1_EEi(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2)
  br label %.critedge

.critedge:                                        ; preds = %30, %31, %19, %20, %32, %37, %36
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIS_IiSaIiEESaIS1_EEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

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 = { 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)"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass