; LLVM IR from hanzohasashi33/Competetive_programming :: Snippets/DSA_PROBLEMS (add_2_numbers_linked_list)

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

@__const.main.arr1 = external hidden unnamed_addr constant [25 x i32], align 16
@__const.main.arr2 = external hidden unnamed_addr constant [22 x i32], align 16
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @push(ptr 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: nounwind uwtable
declare dso_local void @printlinkedlist(ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [25 x i32], align 16
  %6 = alloca [22 x i32], align 16
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  store ptr null, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  store ptr null, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store ptr null, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 100, ptr %5) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %5, ptr align 16 @__const.main.arr1, i64 100, i1 false)
  call void @llvm.lifetime.start.p0(i64 88, ptr %6) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %6, ptr align 16 @__const.main.arr2, i64 88, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 25, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 22, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !9
  %10 = load i32, ptr %7, align 4, !tbaa !9
  %11 = sub nsw i32 %10, 1
  store i32 %11, ptr %9, align 4, !tbaa !9
  br label %12

12:                                               ; preds = %20, %0
  %13 = load i32, ptr %9, align 4, !tbaa !9
  %14 = icmp sge i32 %13, 0
  br i1 %14, label %15, label %23

15:                                               ; preds = %12
  %16 = load i32, ptr %9, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [25 x i32], ptr %5, i64 0, i64 %17
  %19 = load i32, ptr %18, align 4, !tbaa !9
  call void @push(ptr noundef %2, i32 noundef %19)
  br label %20

20:                                               ; preds = %15
  %21 = load i32, ptr %9, align 4, !tbaa !9
  %22 = add nsw i32 %21, -1
  store i32 %22, ptr %9, align 4, !tbaa !9
  br label %12, !llvm.loop !11

23:                                               ; preds = %12
  %24 = load i32, ptr %8, align 4, !tbaa !9
  %25 = sub nsw i32 %24, 1
  store i32 %25, ptr %9, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %34, %23
  %27 = load i32, ptr %9, align 4, !tbaa !9
  %28 = icmp sge i32 %27, 0
  br i1 %28, label %29, label %37

29:                                               ; preds = %26
  %30 = load i32, ptr %9, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [22 x i32], ptr %6, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !9
  call void @push(ptr noundef %3, i32 noundef %33)
  br label %34

34:                                               ; preds = %29
  %35 = load i32, ptr %9, align 4, !tbaa !9
  %36 = add nsw i32 %35, -1
  store i32 %36, ptr %9, align 4, !tbaa !9
  br label %26, !llvm.loop !13

37:                                               ; preds = %26
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  call void @printlinkedlist(ptr noundef %38)
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  call void @printlinkedlist(ptr noundef %40)
  %41 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  call void @addlist(ptr noundef %42, ptr noundef %43, ptr noundef %4)
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  call void @printlinkedlist(ptr noundef %44)
  %45 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 88, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 100, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  ret i32 0
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"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"}
!13 = distinct !{!13, !12}


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

@__const.main.arr1 = external hidden unnamed_addr constant [25 x i32], align 16
@__const.main.arr2 = external hidden unnamed_addr constant [22 x i32], align 16
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @push(ptr noundef, 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
declare dso_local void @printlinkedlist(ptr noundef) 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 @addlist(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
.preheader.preheader:
  %0 = alloca ptr, align 8
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %0) #3
  store ptr null, ptr %0, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #3
  store ptr null, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  store ptr null, ptr %2, align 8, !tbaa !5
  %3 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 96), align 16, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %3)
  %4 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 92), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %4)
  %5 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 88), align 8, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %5)
  %6 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 84), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %6)
  %7 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 80), align 16, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %7)
  %8 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 76), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %8)
  %9 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 72), align 8, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %9)
  %10 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 68), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %10)
  %11 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 64), align 16, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %11)
  %12 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 60), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %12)
  %13 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 56), align 8, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %13)
  %14 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 52), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %14)
  %15 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 48), align 16, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %15)
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 44), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %16)
  %17 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 40), align 8, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %17)
  %18 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 36), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %18)
  %19 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 32), align 16, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %19)
  %20 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 28), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %20)
  %21 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 24), align 8, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %21)
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 20), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %22)
  %23 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 16), align 16, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %23)
  %24 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 12), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %24)
  %25 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 8), align 8, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %25)
  %26 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr1, i64 4), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %26)
  %27 = load i32, ptr @__const.main.arr1, align 16, !tbaa !9
  call void @push(ptr noundef nonnull %0, i32 noundef %27)
  %28 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 84), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %28)
  %29 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 80), align 16, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %29)
  %30 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 76), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %30)
  %31 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 72), align 8, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %31)
  %32 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 68), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %32)
  %33 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 64), align 16, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %33)
  %34 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 60), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %34)
  %35 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 56), align 8, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %35)
  %36 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 52), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %36)
  %37 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 48), align 16, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %37)
  %38 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 44), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %38)
  %39 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 40), align 8, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %39)
  %40 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 36), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %40)
  %41 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 32), align 16, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %41)
  %42 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 28), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %42)
  %43 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 24), align 8, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %43)
  %44 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 20), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %44)
  %45 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 16), align 16, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %45)
  %46 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 12), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %46)
  %47 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 8), align 8, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %47)
  %48 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.arr2, i64 4), align 4, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %48)
  %49 = load i32, ptr @__const.main.arr2, align 16, !tbaa !9
  call void @push(ptr noundef nonnull %1, i32 noundef %49)
  %50 = load ptr, ptr %0, align 8, !tbaa !5
  call void @printlinkedlist(ptr noundef %50)
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %52 = load ptr, ptr %1, align 8, !tbaa !5
  call void @printlinkedlist(ptr noundef %52)
  %53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %54 = load ptr, ptr %0, align 8, !tbaa !5
  %55 = load ptr, ptr %1, align 8, !tbaa !5
  call void @addlist(ptr noundef %54, ptr noundef %55, ptr noundef nonnull %2)
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  call void @printlinkedlist(ptr noundef %56)
  %57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %0) #3
  ret i32 0
}

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


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