; LLVM IR from nragland37/cpp-projects :: data_structures-I/12-DLList/main.ll (Z7processR6DLListI7StudentE)

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7processR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16) %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i8, align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #2
  br label %4

4:                                                ; preds = %21, %1
  %5 = call noundef signext i8 @_Z9getChoicev()
  store i8 %5, ptr %3, align 1, !tbaa !9
  %6 = load i8, ptr %3, align 1, !tbaa !9
  %7 = sext i8 %6 to i32
  switch i32 %7, label %20 [
    i32 65, label %8
    i32 70, label %10
    i32 82, label %12
    i32 67, label %14
    i32 86, label %16
    i32 68, label %18
    i32 81, label %20
  ]

8:                                                ; preds = %4
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_Z13addNewStudentR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16) %9)
  br label %20

10:                                               ; preds = %4
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_Z11findStudentR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16) %11)
  br label %20

12:                                               ; preds = %4
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_Z13removeStudentR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16) %13)
  br label %20

14:                                               ; preds = %4
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_Z13countStudentsR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16) %15)
  br label %20

16:                                               ; preds = %4
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_Z17displayStudentRevR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16) %17)
  br label %20

18:                                               ; preds = %4
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_Z14displayStudentR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16) %19)
  br label %20

20:                                               ; preds = %18, %16, %14, %12, %10, %8, %4, %4
  br label %21

21:                                               ; preds = %20
  %22 = load i8, ptr %3, align 1, !tbaa !9
  %23 = sext i8 %22 to i32
  %24 = icmp ne i32 %23, 81
  br i1 %24, label %4, label %25, !llvm.loop !10

25:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #2
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef signext i8 @_Z9getChoicev() #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13addNewStudentR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16)) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11findStudentR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16)) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13removeStudentR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16)) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13countStudentsR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16)) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z17displayStudentRevR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16)) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z14displayStudentR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16)) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #2 = { 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"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"

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7processR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16) %0) local_unnamed_addr #0 {
  br label %.backedge

.backedge:                                        ; preds = %.backedge.backedge, %1
  %2 = tail call noundef signext i8 @_Z9getChoicev()
  switch i8 %2, label %.backedge.backedge [
    i8 65, label %3
    i8 70, label %4
    i8 82, label %5
    i8 67, label %6
    i8 86, label %7
    i8 68, label %8
    i8 81, label %9
  ]

3:                                                ; preds = %.backedge
  tail call void @_Z13addNewStudentR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16) %0)
  br label %.backedge.backedge

4:                                                ; preds = %.backedge
  tail call void @_Z11findStudentR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16) %0)
  br label %.backedge.backedge

5:                                                ; preds = %.backedge
  tail call void @_Z13removeStudentR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16) %0)
  br label %.backedge.backedge

6:                                                ; preds = %.backedge
  tail call void @_Z13countStudentsR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16) %0)
  br label %.backedge.backedge

7:                                                ; preds = %.backedge
  tail call void @_Z17displayStudentRevR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16) %0)
  br label %.backedge.backedge

8:                                                ; preds = %.backedge
  tail call void @_Z14displayStudentR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16) %0)
  br label %.backedge.backedge

.backedge.backedge:                               ; preds = %8, %7, %6, %5, %4, %3, %.backedge
  br label %.backedge, !llvm.loop !5

9:                                                ; preds = %.backedge
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef signext i8 @_Z9getChoicev() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13addNewStudentR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11findStudentR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13removeStudentR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13countStudentsR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z17displayStudentRevR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z14displayStudentR6DLListI7StudentE(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0

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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass