; LLVM IR from gargarchit/Data_Structure_n_Algorithms :: Linked_List (7_print_lots)

; 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 [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [22 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

declare i32 @printf(ptr noundef, ...) #1

declare i32 @__isoc99_scanf(ptr noundef, ...) #1

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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  store ptr null, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  store ptr null, ptr %4, align 8, !tbaa !5
  br label %6

6:                                                ; preds = %74, %0
  %7 = load i32, ptr %1, align 4, !tbaa !9
  %8 = icmp ne i32 %7, 0
  br i1 %8, label %9, label %75

9:                                                ; preds = %6
  %10 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %11 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %2)
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  %14 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %15 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  %16 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  %17 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  %18 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  %19 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  %20 = call i32 (ptr, ...) @printf(ptr noundef @.str.15)
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %1)
  %22 = load i32, ptr %1, align 4, !tbaa !9
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %26

24:                                               ; preds = %9
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  store i32 1, ptr %5, align 4
  br label %76

26:                                               ; preds = %9
  %27 = load i32, ptr %1, align 4, !tbaa !9
  switch i32 %27, label %72 [
    i32 1, label %28
    i32 2, label %38
    i32 3, label %48
    i32 4, label %58
    i32 5, label %68
    i32 6, label %71
  ]

28:                                               ; preds = %26
  %29 = load i32, ptr %2, align 4, !tbaa !9
  %30 = icmp eq i32 %29, 1
  br i1 %30, label %31, label %32

31:                                               ; preds = %28
  call void @Insert_front(ptr noundef %3)
  call void @Display_LL(ptr noundef %3)
  br label %74

32:                                               ; preds = %28
  %33 = load i32, ptr %2, align 4, !tbaa !9
  %34 = icmp eq i32 %33, 2
  br i1 %34, label %35, label %36

35:                                               ; preds = %32
  call void @Insert_front(ptr noundef %4)
  call void @Display_LL(ptr noundef %4)
  br label %74

36:                                               ; preds = %32
  br label %37

37:                                               ; preds = %36
  br label %38

38:                                               ; preds = %37, %26
  %39 = load i32, ptr %2, align 4, !tbaa !9
  %40 = icmp eq i32 %39, 1
  br i1 %40, label %41, label %42

41:                                               ; preds = %38
  call void @Delete_front(ptr noundef %3)
  call void @Display_LL(ptr noundef %3)
  br label %74

42:                                               ; preds = %38
  %43 = load i32, ptr %2, align 4, !tbaa !9
  %44 = icmp eq i32 %43, 2
  br i1 %44, label %45, label %46

45:                                               ; preds = %42
  call void @Delete_front(ptr noundef %4)
  call void @Display_LL(ptr noundef %4)
  br label %74

46:                                               ; preds = %42
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47, %26
  %49 = load i32, ptr %2, align 4, !tbaa !9
  %50 = icmp eq i32 %49, 1
  br i1 %50, label %51, label %52

51:                                               ; preds = %48
  call void @Insert_end(ptr noundef %3)
  call void @Display_LL(ptr noundef %3)
  br label %74

52:                                               ; preds = %48
  %53 = load i32, ptr %2, align 4, !tbaa !9
  %54 = icmp eq i32 %53, 2
  br i1 %54, label %55, label %56

55:                                               ; preds = %52
  call void @Insert_end(ptr noundef %4)
  call void @Display_LL(ptr noundef %4)
  br label %74

56:                                               ; preds = %52
  br label %57

57:                                               ; preds = %56
  br label %58

58:                                               ; preds = %57, %26
  %59 = load i32, ptr %2, align 4, !tbaa !9
  %60 = icmp eq i32 %59, 1
  br i1 %60, label %61, label %62

61:                                               ; preds = %58
  call void @Delete_end(ptr noundef %3)
  call void @Display_LL(ptr noundef %3)
  br label %74

62:                                               ; preds = %58
  %63 = load i32, ptr %2, align 4, !tbaa !9
  %64 = icmp eq i32 %63, 2
  br i1 %64, label %65, label %66

65:                                               ; preds = %62
  call void @Delete_end(ptr noundef %4)
  call void @Display_LL(ptr noundef %4)
  br label %74

66:                                               ; preds = %62
  br label %67

67:                                               ; preds = %66
  br label %68

68:                                               ; preds = %67, %26
  %69 = call i32 (ptr, ...) @printf(ptr noundef @.str.17)
  call void @Display_LL(ptr noundef %3)
  %70 = call i32 (ptr, ...) @printf(ptr noundef @.str.18)
  call void @Display_LL(ptr noundef %4)
  br label %74

71:                                               ; preds = %26
  call void @print_lots(ptr noundef %3, ptr noundef %4)
  br label %74

72:                                               ; preds = %26
  %73 = call i32 (ptr, ...) @printf(ptr noundef @.str.19)
  br label %74

74:                                               ; preds = %72, %71, %68, %65, %61, %55, %51, %45, %41, %35, %31
  br label %6, !llvm.loop !11

75:                                               ; preds = %6
  store i32 0, ptr %5, align 4
  br label %76

76:                                               ; preds = %75, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #3
  %77 = load i32, ptr %5, align 4
  switch i32 %77, label %79 [
    i32 0, label %78
    i32 1, label %78
  ]

78:                                               ; preds = %76, %76
  ret void

79:                                               ; preds = %76
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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 nofree norecurse noreturn nosync nounwind willreturn memory(none) uwtable
define dso_local void @main() local_unnamed_addr #0 {
  unreachable
}

attributes #0 = { mustprogress nofree norecurse noreturn nosync nounwind willreturn memory(none) 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: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass