; LLVM IR from VAR-solutions/Algorithms :: LinkedList/C (linkedList)

; 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.3 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @begins(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: nounwind uwtable
declare dso_local void @endins(i32 noundef) #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @begdel() #0

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

; Function Attrs: nounwind uwtable
declare dso_local void @enddel() #0

; Function Attrs: nounwind uwtable
declare dso_local void @posdel(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @datadel(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @disp() #0

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

5:                                                ; preds = %51, %0
  br label %6

6:                                                ; preds = %5
  %7 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %2)
  %9 = load i32, ptr %2, align 4, !tbaa !5
  switch i32 %9, label %49 [
    i32 1, label %10
    i32 2, label %14
    i32 3, label %18
    i32 4, label %19
    i32 5, label %20
    i32 6, label %31
    i32 8, label %36
    i32 7, label %40
  ]

10:                                               ; preds = %6
  %11 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %3)
  %13 = load i32, ptr %3, align 4, !tbaa !5
  call void @begins(i32 noundef %13)
  br label %51

14:                                               ; preds = %6
  %15 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %3)
  %17 = load i32, ptr %3, align 4, !tbaa !5
  call void @endins(i32 noundef %17)
  br label %51

18:                                               ; preds = %6
  call void @begdel()
  br label %51

19:                                               ; preds = %6
  call void @enddel()
  br label %51

20:                                               ; preds = %6
  %21 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.7, ptr noundef %4, ptr noundef %3)
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %25, label %27

25:                                               ; preds = %20
  %26 = load i32, ptr %3, align 4, !tbaa !5
  call void @begins(i32 noundef %26)
  br label %51

27:                                               ; preds = %20
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = sub nsw i32 %29, 1
  call void @posins(i32 noundef %28, i32 noundef %30)
  br label %51

31:                                               ; preds = %6
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  %33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.7, ptr noundef %4, ptr noundef %3)
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = load i32, ptr %4, align 4, !tbaa !5
  call void @datains(i32 noundef %34, i32 noundef %35)
  br label %51

36:                                               ; preds = %6
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %4)
  %39 = load i32, ptr %4, align 4, !tbaa !5
  call void @datadel(i32 noundef %39)
  br label %51

40:                                               ; preds = %6
  %41 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  %42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %4)
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %45, label %46

45:                                               ; preds = %40
  call void @begdel()
  br label %51

46:                                               ; preds = %40
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = sub nsw i32 %47, 1
  call void @posdel(i32 noundef %48)
  br label %51

49:                                               ; preds = %6
  %50 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  br label %51

51:                                               ; preds = %49, %46, %45, %36, %31, %27, %25, %19, %18, %14, %10
  call void @disp()
  br label %5
}

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

attributes #0 = { 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 = { "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/C++ TBAA"}


; 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.3 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @begins(i32 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local void @endins(i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @begdel() local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @enddel() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @posdel(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @datadel(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @disp() local_unnamed_addr #0

; Function Attrs: noreturn nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  br label %4

4:                                                ; preds = %46, %0
  %5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %1)
  %7 = load i32, ptr %1, align 4, !tbaa !5
  switch i32 %7, label %44 [
    i32 1, label %8
    i32 2, label %12
    i32 3, label %16
    i32 4, label %17
    i32 5, label %18
    i32 6, label %27
    i32 8, label %32
    i32 7, label %36
  ]

8:                                                ; preds = %4
  %9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %2)
  %11 = load i32, ptr %2, align 4, !tbaa !5
  call void @begins(i32 noundef %11)
  br label %46

12:                                               ; preds = %4
  %13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %2)
  %15 = load i32, ptr %2, align 4, !tbaa !5
  call void @endins(i32 noundef %15)
  br label %46

16:                                               ; preds = %4
  call void @begdel()
  br label %46

17:                                               ; preds = %4
  call void @enddel()
  br label %46

18:                                               ; preds = %4
  %19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.7, ptr noundef nonnull %3, ptr noundef nonnull %2)
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = icmp eq i32 %21, 0
  %23 = load i32, ptr %2, align 4, !tbaa !5
  br i1 %22, label %24, label %25

24:                                               ; preds = %18
  call void @begins(i32 noundef %23)
  br label %46

25:                                               ; preds = %18
  %26 = add nsw i32 %21, -1
  call void @posins(i32 noundef %23, i32 noundef %26)
  br label %46

27:                                               ; preds = %4
  %28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.7, ptr noundef nonnull %3, ptr noundef nonnull %2)
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = load i32, ptr %3, align 4, !tbaa !5
  call void @datains(i32 noundef %30, i32 noundef %31)
  br label %46

32:                                               ; preds = %4
  %33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  %34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %3)
  %35 = load i32, ptr %3, align 4, !tbaa !5
  call void @datadel(i32 noundef %35)
  br label %46

36:                                               ; preds = %4
  %37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  %38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %3)
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %41, label %42

41:                                               ; preds = %36
  call void @begdel()
  br label %46

42:                                               ; preds = %36
  %43 = add nsw i32 %39, -1
  call void @posdel(i32 noundef %43)
  br label %46

44:                                               ; preds = %4
  %45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  br label %46

46:                                               ; preds = %44, %42, %41, %32, %27, %25, %24, %17, %16, %12, %8
  call void @disp()
  br label %4
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

attributes #0 = { 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree 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 #3 = { noreturn 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 #4 = { 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/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass