; LLVM IR from yourtion/LearningMasteringAlgorithms-C :: Example/list (main)

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

%struct.List_ = type { i32, ptr, ptr, ptr, ptr }
%struct.ListElmt_ = type { ptr, ptr }

@stdout = external global ptr, align 8
@.str = external hidden unnamed_addr constant [51 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca %struct.List_, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 40, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @list_init(ptr noundef %6, ptr noundef @free)
  %11 = getelementptr inbounds %struct.List_, ptr %6, i32 0, i32 3
  %12 = load ptr, ptr %11, align 8, !tbaa !11
  store ptr %12, ptr %7, align 8, !tbaa !9
  store i32 10, ptr %9, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %28, %2
  %14 = load i32, ptr %9, align 4, !tbaa !5
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %16, label %31

16:                                               ; preds = %13
  %17 = call noalias ptr @malloc(i64 noundef 4) #6
  store ptr %17, ptr %8, align 8, !tbaa !9
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %20

19:                                               ; preds = %16
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %151

20:                                               ; preds = %16
  %21 = load i32, ptr %9, align 4, !tbaa !5
  %22 = load ptr, ptr %8, align 8, !tbaa !9
  store i32 %21, ptr %22, align 4, !tbaa !5
  %23 = load ptr, ptr %8, align 8, !tbaa !9
  %24 = call i32 @list_ins_next(ptr noundef %6, ptr noundef null, ptr noundef %23)
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %26, label %27

26:                                               ; preds = %20
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %151

27:                                               ; preds = %20
  br label %28

28:                                               ; preds = %27
  %29 = load i32, ptr %9, align 4, !tbaa !5
  %30 = add nsw i32 %29, -1
  store i32 %30, ptr %9, align 4, !tbaa !5
  br label %13, !llvm.loop !13

31:                                               ; preds = %13
  call void @print_list(ptr noundef %6)
  %32 = getelementptr inbounds %struct.List_, ptr %6, i32 0, i32 3
  %33 = load ptr, ptr %32, align 8, !tbaa !11
  store ptr %33, ptr %7, align 8, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %41, %31
  %35 = load i32, ptr %9, align 4, !tbaa !5
  %36 = icmp slt i32 %35, 7
  br i1 %36, label %37, label %44

37:                                               ; preds = %34
  %38 = load ptr, ptr %7, align 8, !tbaa !9
  %39 = getelementptr inbounds %struct.ListElmt_, ptr %38, i32 0, i32 1
  %40 = load ptr, ptr %39, align 8, !tbaa !15
  store ptr %40, ptr %7, align 8, !tbaa !9
  br label %41

41:                                               ; preds = %37
  %42 = load i32, ptr %9, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %9, align 4, !tbaa !5
  br label %34, !llvm.loop !17

44:                                               ; preds = %34
  %45 = load ptr, ptr %7, align 8, !tbaa !9
  %46 = getelementptr inbounds %struct.ListElmt_, ptr %45, i32 0, i32 0
  %47 = load ptr, ptr %46, align 8, !tbaa !18
  store ptr %47, ptr %8, align 8, !tbaa !9
  %48 = load ptr, ptr @stdout, align 8, !tbaa !9
  %49 = load ptr, ptr %8, align 8, !tbaa !9
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef @.str, i32 noundef %50) #5
  %52 = load ptr, ptr %7, align 8, !tbaa !9
  %53 = call i32 @list_rem_next(ptr noundef %6, ptr noundef %52, ptr noundef %8)
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %56

55:                                               ; preds = %44
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %151

56:                                               ; preds = %44
  call void @print_list(ptr noundef %6)
  %57 = load ptr, ptr @stdout, align 8, !tbaa !9
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef @.str.1) #5
  %59 = load ptr, ptr %8, align 8, !tbaa !9
  store i32 11, ptr %59, align 4, !tbaa !5
  %60 = getelementptr inbounds %struct.List_, ptr %6, i32 0, i32 4
  %61 = load ptr, ptr %60, align 8, !tbaa !19
  %62 = load ptr, ptr %8, align 8, !tbaa !9
  %63 = call i32 @list_ins_next(ptr noundef %6, ptr noundef %61, ptr noundef %62)
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %66

65:                                               ; preds = %56
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %151

66:                                               ; preds = %56
  call void @print_list(ptr noundef %6)
  %67 = load ptr, ptr @stdout, align 8, !tbaa !9
  %68 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef @.str.2) #5
  %69 = getelementptr inbounds %struct.List_, ptr %6, i32 0, i32 3
  %70 = load ptr, ptr %69, align 8, !tbaa !11
  store ptr %70, ptr %7, align 8, !tbaa !9
  %71 = load ptr, ptr %7, align 8, !tbaa !9
  %72 = call i32 @list_rem_next(ptr noundef %6, ptr noundef %71, ptr noundef %8)
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %74, label %75

74:                                               ; preds = %66
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %151

75:                                               ; preds = %66
  call void @print_list(ptr noundef %6)
  %76 = load ptr, ptr @stdout, align 8, !tbaa !9
  %77 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %76, ptr noundef @.str.3) #5
  %78 = load ptr, ptr %8, align 8, !tbaa !9
  store i32 12, ptr %78, align 4, !tbaa !5
  %79 = load ptr, ptr %8, align 8, !tbaa !9
  %80 = call i32 @list_ins_next(ptr noundef %6, ptr noundef null, ptr noundef %79)
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %83

82:                                               ; preds = %75
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %151

83:                                               ; preds = %75
  call void @print_list(ptr noundef %6)
  %84 = load ptr, ptr @stdout, align 8, !tbaa !9
  %85 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %84, ptr noundef @.str.4) #5
  %86 = getelementptr inbounds %struct.List_, ptr %6, i32 0, i32 3
  %87 = load ptr, ptr %86, align 8, !tbaa !11
  store ptr %87, ptr %7, align 8, !tbaa !9
  %88 = load ptr, ptr %7, align 8, !tbaa !9
  %89 = getelementptr inbounds %struct.ListElmt_, ptr %88, i32 0, i32 1
  %90 = load ptr, ptr %89, align 8, !tbaa !15
  store ptr %90, ptr %7, align 8, !tbaa !9
  %91 = load ptr, ptr %7, align 8, !tbaa !9
  %92 = getelementptr inbounds %struct.ListElmt_, ptr %91, i32 0, i32 1
  %93 = load ptr, ptr %92, align 8, !tbaa !15
  store ptr %93, ptr %7, align 8, !tbaa !9
  %94 = load ptr, ptr %7, align 8, !tbaa !9
  %95 = call i32 @list_rem_next(ptr noundef %6, ptr noundef %94, ptr noundef %8)
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %98

97:                                               ; preds = %83
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %151

98:                                               ; preds = %83
  call void @print_list(ptr noundef %6)
  %99 = load ptr, ptr @stdout, align 8, !tbaa !9
  %100 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %99, ptr noundef @.str.5) #5
  %101 = load ptr, ptr %8, align 8, !tbaa !9
  store i32 13, ptr %101, align 4, !tbaa !5
  %102 = getelementptr inbounds %struct.List_, ptr %6, i32 0, i32 3
  %103 = load ptr, ptr %102, align 8, !tbaa !11
  %104 = load ptr, ptr %8, align 8, !tbaa !9
  %105 = call i32 @list_ins_next(ptr noundef %6, ptr noundef %103, ptr noundef %104)
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %108

107:                                              ; preds = %98
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %151

108:                                              ; preds = %98
  call void @print_list(ptr noundef %6)
  %109 = getelementptr inbounds %struct.List_, ptr %6, i32 0, i32 3
  %110 = load ptr, ptr %109, align 8, !tbaa !11
  %111 = getelementptr inbounds %struct.List_, ptr %6, i32 0, i32 3
  %112 = load ptr, ptr %111, align 8, !tbaa !11
  %113 = icmp eq ptr %110, %112
  %114 = zext i1 %113 to i64
  %115 = select i1 %113, i32 1, i32 0
  store i32 %115, ptr %9, align 4, !tbaa !5
  %116 = load ptr, ptr @stdout, align 8, !tbaa !9
  %117 = load i32, ptr %9, align 4, !tbaa !5
  %118 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %116, ptr noundef @.str.6, i32 noundef %117) #5
  %119 = getelementptr inbounds %struct.List_, ptr %6, i32 0, i32 4
  %120 = load ptr, ptr %119, align 8, !tbaa !19
  %121 = getelementptr inbounds %struct.List_, ptr %6, i32 0, i32 3
  %122 = load ptr, ptr %121, align 8, !tbaa !11
  %123 = icmp eq ptr %120, %122
  %124 = zext i1 %123 to i64
  %125 = select i1 %123, i32 1, i32 0
  store i32 %125, ptr %9, align 4, !tbaa !5
  %126 = load ptr, ptr @stdout, align 8, !tbaa !9
  %127 = load i32, ptr %9, align 4, !tbaa !5
  %128 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %126, ptr noundef @.str.7, i32 noundef %127) #5
  %129 = getelementptr inbounds %struct.List_, ptr %6, i32 0, i32 4
  %130 = load ptr, ptr %129, align 8, !tbaa !19
  %131 = getelementptr inbounds %struct.ListElmt_, ptr %130, i32 0, i32 1
  %132 = load ptr, ptr %131, align 8, !tbaa !15
  %133 = icmp eq ptr %132, null
  %134 = zext i1 %133 to i64
  %135 = select i1 %133, i32 1, i32 0
  store i32 %135, ptr %9, align 4, !tbaa !5
  %136 = load ptr, ptr @stdout, align 8, !tbaa !9
  %137 = load i32, ptr %9, align 4, !tbaa !5
  %138 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %136, ptr noundef @.str.8, i32 noundef %137) #5
  %139 = getelementptr inbounds %struct.List_, ptr %6, i32 0, i32 3
  %140 = load ptr, ptr %139, align 8, !tbaa !11
  %141 = getelementptr inbounds %struct.ListElmt_, ptr %140, i32 0, i32 1
  %142 = load ptr, ptr %141, align 8, !tbaa !15
  %143 = icmp eq ptr %142, null
  %144 = zext i1 %143 to i64
  %145 = select i1 %143, i32 1, i32 0
  store i32 %145, ptr %9, align 4, !tbaa !5
  %146 = load ptr, ptr @stdout, align 8, !tbaa !9
  %147 = load i32, ptr %9, align 4, !tbaa !5
  %148 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %146, ptr noundef @.str.9, i32 noundef %147) #5
  %149 = load ptr, ptr @stdout, align 8, !tbaa !9
  %150 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %149, ptr noundef @.str.10) #5
  call void @list_destroy(ptr noundef %6)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %151

151:                                              ; preds = %108, %107, %97, %82, %74, %65, %55, %26, %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr %6) #5
  %152 = load i32, ptr %3, align 4
  ret i32 %152
}

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

declare void @list_init(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #3

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #4

declare i32 @list_ins_next(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @print_list(ptr noundef) #0

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

declare i32 @list_rem_next(ptr noundef, ptr noundef, ptr noundef) #2

declare void @list_destroy(ptr noundef) #2

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

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 "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 allocsize(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 #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 24}
!12 = !{!"List_", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !10, i64 8}
!16 = !{!"ListElmt_", !10, i64 0, !10, i64 8}
!17 = distinct !{!17, !14}
!18 = !{!16, !10, i64 0}
!19 = !{!12, !10, i64 32}


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

%struct.List_ = type { i32, ptr, ptr, ptr, ptr }

@stdout = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [51 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = alloca %struct.List_, align 8
  %4 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  call void @list_init(ptr noundef nonnull %3, ptr noundef nonnull @free) #6
  %5 = getelementptr inbounds i8, ptr %3, i64 24
  %6 = call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #7
  %7 = icmp eq ptr %6, null
  br i1 %7, label %.loopexit, label %74

8:                                                ; preds = %74
  %9 = call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #7
  %10 = icmp eq ptr %9, null
  br i1 %10, label %.loopexit, label %11

11:                                               ; preds = %8
  store i32 9, ptr %9, align 4, !tbaa !5
  %12 = call i32 @list_ins_next(ptr noundef nonnull %3, ptr noundef null, ptr noundef nonnull %9) #6
  %.not24.1 = icmp eq i32 %12, 0
  br i1 %.not24.1, label %13, label %.loopexit

13:                                               ; preds = %11
  %14 = call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #7
  %15 = icmp eq ptr %14, null
  br i1 %15, label %.loopexit, label %16

16:                                               ; preds = %13
  store i32 8, ptr %14, align 4, !tbaa !5
  %17 = call i32 @list_ins_next(ptr noundef nonnull %3, ptr noundef null, ptr noundef nonnull %14) #6
  %.not24.2 = icmp eq i32 %17, 0
  br i1 %.not24.2, label %18, label %.loopexit

18:                                               ; preds = %16
  %19 = call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #7
  %20 = icmp eq ptr %19, null
  br i1 %20, label %.loopexit, label %21

21:                                               ; preds = %18
  store i32 7, ptr %19, align 4, !tbaa !5
  %22 = call i32 @list_ins_next(ptr noundef nonnull %3, ptr noundef null, ptr noundef nonnull %19) #6
  %.not24.3 = icmp eq i32 %22, 0
  br i1 %.not24.3, label %23, label %.loopexit

23:                                               ; preds = %21
  %24 = call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #7
  %25 = icmp eq ptr %24, null
  br i1 %25, label %.loopexit, label %26

26:                                               ; preds = %23
  store i32 6, ptr %24, align 4, !tbaa !5
  %27 = call i32 @list_ins_next(ptr noundef nonnull %3, ptr noundef null, ptr noundef nonnull %24) #6
  %.not24.4 = icmp eq i32 %27, 0
  br i1 %.not24.4, label %28, label %.loopexit

28:                                               ; preds = %26
  %29 = call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #7
  store ptr %29, ptr %4, align 8, !tbaa !9
  %30 = icmp eq ptr %29, null
  br i1 %30, label %.loopexit, label %31

31:                                               ; preds = %28
  store i32 5, ptr %29, align 4, !tbaa !5
  %32 = call i32 @list_ins_next(ptr noundef nonnull %3, ptr noundef null, ptr noundef nonnull %29) #6
  %.not24.5 = icmp eq i32 %32, 0
  br i1 %.not24.5, label %33, label %.loopexit

33:                                               ; preds = %31
  %34 = call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #7
  %35 = icmp eq ptr %34, null
  br i1 %35, label %.loopexit, label %36

36:                                               ; preds = %33
  store i32 4, ptr %34, align 4, !tbaa !5
  %37 = call i32 @list_ins_next(ptr noundef nonnull %3, ptr noundef null, ptr noundef nonnull %34) #6
  %.not24.6 = icmp eq i32 %37, 0
  br i1 %.not24.6, label %38, label %.loopexit

38:                                               ; preds = %36
  %39 = call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #7
  %40 = icmp eq ptr %39, null
  br i1 %40, label %.loopexit, label %41

41:                                               ; preds = %38
  store i32 3, ptr %39, align 4, !tbaa !5
  %42 = call i32 @list_ins_next(ptr noundef nonnull %3, ptr noundef null, ptr noundef nonnull %39) #6
  %.not24.7 = icmp eq i32 %42, 0
  br i1 %.not24.7, label %43, label %.loopexit

43:                                               ; preds = %41
  %44 = call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #7
  %45 = icmp eq ptr %44, null
  br i1 %45, label %.loopexit, label %46

46:                                               ; preds = %43
  store i32 2, ptr %44, align 4, !tbaa !5
  %47 = call i32 @list_ins_next(ptr noundef nonnull %3, ptr noundef null, ptr noundef nonnull %44) #6
  %.not24.8 = icmp eq i32 %47, 0
  br i1 %.not24.8, label %48, label %.loopexit

48:                                               ; preds = %46
  %49 = call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #7
  %50 = icmp eq ptr %49, null
  br i1 %50, label %.loopexit, label %51

51:                                               ; preds = %48
  store i32 1, ptr %49, align 4, !tbaa !5
  %52 = call i32 @list_ins_next(ptr noundef nonnull %3, ptr noundef null, ptr noundef nonnull %49) #6
  %.not24.9 = icmp eq i32 %52, 0
  br i1 %.not24.9, label %53, label %.loopexit

53:                                               ; preds = %51
  call void @print_list(ptr noundef nonnull %3)
  %54 = load ptr, ptr %5, align 8, !tbaa !11
  %55 = getelementptr inbounds i8, ptr %54, i64 8
  %56 = load ptr, ptr %55, align 8, !tbaa !13
  %57 = getelementptr inbounds i8, ptr %56, i64 8
  %58 = load ptr, ptr %57, align 8, !tbaa !13
  %59 = getelementptr inbounds i8, ptr %58, i64 8
  %60 = load ptr, ptr %59, align 8, !tbaa !13
  %61 = getelementptr inbounds i8, ptr %60, i64 8
  %62 = load ptr, ptr %61, align 8, !tbaa !13
  %63 = getelementptr inbounds i8, ptr %62, i64 8
  %64 = load ptr, ptr %63, align 8, !tbaa !13
  %65 = getelementptr inbounds i8, ptr %64, i64 8
  %66 = load ptr, ptr %65, align 8, !tbaa !13
  %67 = getelementptr inbounds i8, ptr %66, i64 8
  %68 = load ptr, ptr %67, align 8, !tbaa !13
  %69 = load ptr, ptr %68, align 8, !tbaa !15
  store ptr %69, ptr %4, align 8, !tbaa !9
  %70 = load ptr, ptr @stdout, align 8, !tbaa !9
  %71 = load i32, ptr %69, align 4, !tbaa !5
  %72 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %70, ptr noundef nonnull @.str, i32 noundef %71) #6
  %73 = call i32 @list_rem_next(ptr noundef nonnull %3, ptr noundef nonnull %68, ptr noundef nonnull %4) #6
  %.not = icmp eq i32 %73, 0
  br i1 %.not, label %76, label %.loopexit

74:                                               ; preds = %2
  store i32 10, ptr %6, align 4, !tbaa !5
  %75 = call i32 @list_ins_next(ptr noundef nonnull %3, ptr noundef null, ptr noundef nonnull %6) #6
  %.not24 = icmp eq i32 %75, 0
  br i1 %.not24, label %8, label %.loopexit

76:                                               ; preds = %53
  call void @print_list(ptr noundef nonnull %3)
  %77 = load ptr, ptr @stdout, align 8, !tbaa !9
  %78 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef nonnull @.str.1) #6
  %79 = load ptr, ptr %4, align 8, !tbaa !9
  store i32 11, ptr %79, align 4, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %3, i64 32
  %81 = load ptr, ptr %80, align 8, !tbaa !16
  %82 = call i32 @list_ins_next(ptr noundef nonnull %3, ptr noundef %81, ptr noundef nonnull %79) #6
  %.not19 = icmp eq i32 %82, 0
  br i1 %.not19, label %83, label %.loopexit

83:                                               ; preds = %76
  call void @print_list(ptr noundef nonnull %3)
  %84 = load ptr, ptr @stdout, align 8, !tbaa !9
  %85 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %84, ptr noundef nonnull @.str.2) #6
  %86 = load ptr, ptr %5, align 8, !tbaa !11
  %87 = call i32 @list_rem_next(ptr noundef nonnull %3, ptr noundef %86, ptr noundef nonnull %4) #6
  %.not20 = icmp eq i32 %87, 0
  br i1 %.not20, label %88, label %.loopexit

88:                                               ; preds = %83
  call void @print_list(ptr noundef nonnull %3)
  %89 = load ptr, ptr @stdout, align 8, !tbaa !9
  %90 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %89, ptr noundef nonnull @.str.3) #6
  %91 = load ptr, ptr %4, align 8, !tbaa !9
  store i32 12, ptr %91, align 4, !tbaa !5
  %92 = call i32 @list_ins_next(ptr noundef nonnull %3, ptr noundef null, ptr noundef nonnull %91) #6
  %.not21 = icmp eq i32 %92, 0
  br i1 %.not21, label %93, label %.loopexit

93:                                               ; preds = %88
  call void @print_list(ptr noundef nonnull %3)
  %94 = load ptr, ptr @stdout, align 8, !tbaa !9
  %95 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %94, ptr noundef nonnull @.str.4) #6
  %96 = load ptr, ptr %5, align 8, !tbaa !11
  %97 = getelementptr inbounds i8, ptr %96, i64 8
  %98 = load ptr, ptr %97, align 8, !tbaa !13
  %99 = getelementptr inbounds i8, ptr %98, i64 8
  %100 = load ptr, ptr %99, align 8, !tbaa !13
  %101 = call i32 @list_rem_next(ptr noundef nonnull %3, ptr noundef %100, ptr noundef nonnull %4) #6
  %.not22 = icmp eq i32 %101, 0
  br i1 %.not22, label %102, label %.loopexit

102:                                              ; preds = %93
  call void @print_list(ptr noundef nonnull %3)
  %103 = load ptr, ptr @stdout, align 8, !tbaa !9
  %104 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %103, ptr noundef nonnull @.str.5) #6
  %105 = load ptr, ptr %4, align 8, !tbaa !9
  store i32 13, ptr %105, align 4, !tbaa !5
  %106 = load ptr, ptr %5, align 8, !tbaa !11
  %107 = call i32 @list_ins_next(ptr noundef nonnull %3, ptr noundef %106, ptr noundef nonnull %105) #6
  %.not23 = icmp eq i32 %107, 0
  br i1 %.not23, label %108, label %.loopexit

108:                                              ; preds = %102
  call void @print_list(ptr noundef nonnull %3)
  %109 = load ptr, ptr @stdout, align 8, !tbaa !9
  %110 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %109, ptr noundef nonnull @.str.6, i32 noundef 1) #6
  %111 = load ptr, ptr %80, align 8, !tbaa !16
  %112 = load ptr, ptr %5, align 8, !tbaa !11
  %113 = icmp eq ptr %111, %112
  %114 = zext i1 %113 to i32
  %115 = load ptr, ptr @stdout, align 8, !tbaa !9
  %116 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %115, ptr noundef nonnull @.str.7, i32 noundef %114) #6
  %117 = load ptr, ptr %80, align 8, !tbaa !16
  %118 = getelementptr inbounds i8, ptr %117, i64 8
  %119 = load ptr, ptr %118, align 8, !tbaa !13
  %120 = icmp eq ptr %119, null
  %121 = zext i1 %120 to i32
  %122 = load ptr, ptr @stdout, align 8, !tbaa !9
  %123 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %122, ptr noundef nonnull @.str.8, i32 noundef %121) #6
  %124 = load ptr, ptr %5, align 8, !tbaa !11
  %125 = getelementptr inbounds i8, ptr %124, i64 8
  %126 = load ptr, ptr %125, align 8, !tbaa !13
  %127 = icmp eq ptr %126, null
  %128 = zext i1 %127 to i32
  %129 = load ptr, ptr @stdout, align 8, !tbaa !9
  %130 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %129, ptr noundef nonnull @.str.9, i32 noundef %128) #6
  %131 = load ptr, ptr @stdout, align 8, !tbaa !9
  %132 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %131, ptr noundef nonnull @.str.10) #6
  call void @list_destroy(ptr noundef nonnull %3) #6
  br label %.loopexit

.loopexit:                                        ; preds = %74, %2, %8, %11, %13, %16, %18, %21, %23, %26, %28, %31, %33, %36, %38, %41, %43, %46, %48, %51, %102, %93, %88, %83, %76, %53, %108
  %.017 = phi i32 [ 0, %108 ], [ 1, %53 ], [ 1, %76 ], [ 1, %83 ], [ 1, %88 ], [ 1, %93 ], [ 1, %102 ], [ 1, %51 ], [ 1, %48 ], [ 1, %46 ], [ 1, %43 ], [ 1, %41 ], [ 1, %38 ], [ 1, %36 ], [ 1, %33 ], [ 1, %31 ], [ 1, %28 ], [ 1, %26 ], [ 1, %23 ], [ 1, %21 ], [ 1, %18 ], [ 1, %16 ], [ 1, %13 ], [ 1, %11 ], [ 1, %8 ], [ 1, %2 ], [ 1, %74 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #6
  ret i32 %.017
}

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

declare void @list_init(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) #3

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4

declare i32 @list_ins_next(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @print_list(ptr noundef) local_unnamed_addr #0

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

declare i32 @list_rem_next(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @list_destroy(ptr noundef) local_unnamed_addr #2

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

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 = { "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #5 = { 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 #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 24}
!12 = !{!"List_", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!13 = !{!14, !10, i64 8}
!14 = !{!"ListElmt_", !10, i64 0, !10, i64 8}
!15 = !{!14, !10, i64 0}
!16 = !{!12, !10, i64 32}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass