; LLVM IR from syby119/CG-projects :: doc/c++ tutorial/4. advanced technics/2. exception (error_code)

; 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 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @readFile(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #0 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i8, align 1
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr null, ptr %18, align 8, !tbaa !5
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr null, ptr %19, align 8, !tbaa !5
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 -1, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = call noalias ptr @fopen(ptr noundef %21, ptr noundef @.str)
  store ptr %22, ptr %10, align 8, !tbaa !5
  %23 = load ptr, ptr %10, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %26, label %25

25:                                               ; preds = %4
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %168

26:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #6
  store i8 0, ptr %14, align 1, !tbaa !11
  br label %27

27:                                               ; preds = %49, %26
  br label %28

28:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %29 = load ptr, ptr %10, align 8, !tbaa !5
  %30 = call i32 @fgetc(ptr noundef %29)
  store i32 %30, ptr %15, align 4, !tbaa !9
  %31 = load i32, ptr %15, align 4, !tbaa !9
  %32 = icmp eq i32 %31, -1
  br i1 %32, label %33, label %34

33:                                               ; preds = %28
  store i32 3, ptr %11, align 4
  br label %47

34:                                               ; preds = %28
  %35 = load i32, ptr %15, align 4, !tbaa !9
  %36 = trunc i32 %35 to i8
  store i8 %36, ptr %14, align 1, !tbaa !11
  %37 = load i32, ptr %15, align 4, !tbaa !9
  %38 = trunc i32 %37 to i8
  %39 = sext i8 %38 to i32
  %40 = icmp eq i32 %39, 10
  br i1 %40, label %41, label %44

41:                                               ; preds = %34
  %42 = load i32, ptr %13, align 4, !tbaa !9
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %13, align 4, !tbaa !9
  br label %44

44:                                               ; preds = %41, %34
  %45 = load i32, ptr %12, align 4, !tbaa !9
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %12, align 4, !tbaa !9
  store i32 0, ptr %11, align 4
  br label %47

47:                                               ; preds = %44, %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  %48 = load i32, ptr %11, align 4
  switch i32 %48, label %170 [
    i32 0, label %49
    i32 3, label %50
  ]

49:                                               ; preds = %47
  br label %27

50:                                               ; preds = %47
  %51 = load i8, ptr %14, align 1, !tbaa !11
  %52 = sext i8 %51 to i32
  %53 = icmp ne i32 %52, 10
  br i1 %53, label %54, label %61

54:                                               ; preds = %50
  %55 = load i8, ptr %14, align 1, !tbaa !11
  %56 = sext i8 %55 to i32
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %61

58:                                               ; preds = %54
  %59 = load i32, ptr %13, align 4, !tbaa !9
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %13, align 4, !tbaa !9
  br label %61

61:                                               ; preds = %58, %54, %50
  %62 = load i32, ptr %13, align 4, !tbaa !9
  %63 = load i32, ptr %12, align 4, !tbaa !9
  %64 = add nsw i32 %63, %62
  store i32 %64, ptr %12, align 4, !tbaa !9
  %65 = load ptr, ptr %10, align 8, !tbaa !5
  %66 = call i32 @feof(ptr noundef %65) #6
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %71, label %68

68:                                               ; preds = %61
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  %70 = call i32 @fclose(ptr noundef %69)
  store i32 -100, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %167

71:                                               ; preds = %61
  %72 = load ptr, ptr %10, align 8, !tbaa !5
  call void @rewind(ptr noundef %72)
  %73 = load i32, ptr %12, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = mul i64 %74, 1
  %76 = call noalias ptr @malloc(i64 noundef %75) #7
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %76, ptr %77, align 8, !tbaa !5
  %78 = load i32, ptr %13, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = mul i64 %79, 4
  %81 = call noalias ptr @malloc(i64 noundef %80) #7
  %82 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %81, ptr %82, align 8, !tbaa !5
  %83 = load i32, ptr %13, align 4, !tbaa !9
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %83, ptr %84, align 4, !tbaa !9
  %85 = load ptr, ptr %7, align 8, !tbaa !5
  %86 = load ptr, ptr %85, align 8, !tbaa !5
  %87 = icmp eq ptr %86, null
  br i1 %87, label %92, label %88

88:                                               ; preds = %71
  %89 = load ptr, ptr %8, align 8, !tbaa !5
  %90 = load ptr, ptr %89, align 8, !tbaa !5
  %91 = icmp eq ptr %90, null
  br i1 %91, label %92, label %101

92:                                               ; preds = %88, %71
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  %94 = load ptr, ptr %93, align 8, !tbaa !5
  call void @free(ptr noundef %94) #6
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr null, ptr %95, align 8, !tbaa !5
  %96 = load ptr, ptr %8, align 8, !tbaa !5
  %97 = load ptr, ptr %96, align 8, !tbaa !5
  call void @free(ptr noundef %97) #6
  %98 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr null, ptr %98, align 8, !tbaa !5
  %99 = load ptr, ptr %10, align 8, !tbaa !5
  %100 = call i32 @fclose(ptr noundef %99)
  store i32 -10000, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %167

101:                                              ; preds = %88
  %102 = load ptr, ptr %8, align 8, !tbaa !5
  %103 = load ptr, ptr %102, align 8, !tbaa !5
  %104 = getelementptr inbounds i32, ptr %103, i64 0
  store i32 0, ptr %104, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %105

105:                                              ; preds = %159, %101
  %106 = load i32, ptr %16, align 4, !tbaa !9
  %107 = load i32, ptr %13, align 4, !tbaa !9
  %108 = icmp slt i32 %106, %107
  br i1 %108, label %110, label %109

109:                                              ; preds = %105
  store i32 4, ptr %11, align 4
  br label %162

110:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %111 = load ptr, ptr %7, align 8, !tbaa !5
  %112 = load ptr, ptr %111, align 8, !tbaa !5
  %113 = load ptr, ptr %8, align 8, !tbaa !5
  %114 = load ptr, ptr %113, align 8, !tbaa !5
  %115 = load i32, ptr %16, align 4, !tbaa !9
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds i32, ptr %114, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !9
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds i8, ptr %112, i64 %119
  store ptr %120, ptr %17, align 8, !tbaa !5
  %121 = load ptr, ptr %17, align 8, !tbaa !5
  %122 = load i32, ptr %12, align 4, !tbaa !9
  %123 = load ptr, ptr %10, align 8, !tbaa !5
  %124 = call ptr @fgets(ptr noundef %121, i32 noundef %122, ptr noundef %123)
  %125 = icmp eq ptr %124, null
  br i1 %125, label %126, label %132

126:                                              ; preds = %110
  %127 = load i32, ptr %16, align 4, !tbaa !9
  %128 = sub nsw i32 %127, 1
  %129 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %128, ptr %129, align 4, !tbaa !9
  %130 = load ptr, ptr %10, align 8, !tbaa !5
  %131 = call i32 @fclose(ptr noundef %130)
  store i32 -100, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %156

132:                                              ; preds = %110
  %133 = load i32, ptr %16, align 4, !tbaa !9
  %134 = load i32, ptr %13, align 4, !tbaa !9
  %135 = icmp slt i32 %133, %134
  br i1 %135, label %136, label %155

136:                                              ; preds = %132
  %137 = load ptr, ptr %8, align 8, !tbaa !5
  %138 = load ptr, ptr %137, align 8, !tbaa !5
  %139 = load i32, ptr %16, align 4, !tbaa !9
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds i32, ptr %138, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !9
  %143 = sext i32 %142 to i64
  %144 = load ptr, ptr %17, align 8, !tbaa !5
  %145 = call i64 @strlen(ptr noundef %144) #8
  %146 = add i64 %143, %145
  %147 = add i64 %146, 1
  %148 = trunc i64 %147 to i32
  %149 = load ptr, ptr %8, align 8, !tbaa !5
  %150 = load ptr, ptr %149, align 8, !tbaa !5
  %151 = load i32, ptr %16, align 4, !tbaa !9
  %152 = add nsw i32 %151, 1
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds i32, ptr %150, i64 %153
  store i32 %148, ptr %154, align 4, !tbaa !9
  br label %155

155:                                              ; preds = %136, %132
  store i32 0, ptr %11, align 4
  br label %156

156:                                              ; preds = %155, %126
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  %157 = load i32, ptr %11, align 4
  switch i32 %157, label %162 [
    i32 0, label %158
  ]

158:                                              ; preds = %156
  br label %159

159:                                              ; preds = %158
  %160 = load i32, ptr %16, align 4, !tbaa !9
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %16, align 4, !tbaa !9
  br label %105, !llvm.loop !12

162:                                              ; preds = %156, %109
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  %163 = load i32, ptr %11, align 4
  switch i32 %163, label %167 [
    i32 4, label %164
  ]

164:                                              ; preds = %162
  %165 = load ptr, ptr %10, align 8, !tbaa !5
  %166 = call i32 @fclose(ptr noundef %165)
  store i32 0, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %167

167:                                              ; preds = %164, %162, %92, %68
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %168

168:                                              ; preds = %167, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %169 = load i32, ptr %5, align 4
  ret i32 %169

170:                                              ; preds = %47
  unreachable
}

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

declare noalias ptr @fopen(ptr noundef, ptr noundef) #2

declare i32 @fgetc(ptr noundef) #2

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

; Function Attrs: nounwind
declare i32 @feof(ptr noundef) #3

declare i32 @fclose(ptr noundef) #2

declare void @rewind(ptr noundef) #2

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

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #5

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 willreturn memory(read) "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) }
attributes #8 = { nounwind willreturn memory(read) }

!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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"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"

@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @readFile(ptr nocapture noundef readonly %0, ptr nocapture noundef %1, ptr nocapture noundef %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #0 {
  store ptr null, ptr %1, align 8, !tbaa !5
  store ptr null, ptr %2, align 8, !tbaa !5
  store i32 -1, ptr %3, align 4, !tbaa !9
  %5 = tail call noalias ptr @fopen(ptr noundef %0, ptr noundef nonnull @.str)
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %52, label %.preheader

.preheader:                                       ; preds = %4
  %6 = tail call i32 @fgetc(ptr noundef nonnull %5)
  %7 = icmp eq i32 %6, -1
  br i1 %7, label %.thread, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %8 = phi i32 [ %12, %.lr.ph ], [ %6, %.preheader ]
  %.06588 = phi i32 [ %spec.select, %.lr.ph ], [ 0, %.preheader ]
  %.06987 = phi i32 [ %11, %.lr.ph ], [ 0, %.preheader ]
  %sext.mask = and i32 %8, 255
  %9 = icmp eq i32 %sext.mask, 10
  %10 = zext i1 %9 to i32
  %spec.select = add nuw nsw i32 %.06588, %10
  %11 = add nuw nsw i32 %.06987, 1
  %12 = tail call i32 @fgetc(ptr noundef nonnull %5)
  %13 = icmp eq i32 %12, -1
  br i1 %13, label %14, label %.lr.ph

14:                                               ; preds = %.lr.ph
  %15 = trunc i32 %8 to i8
  switch i8 %15, label %16 [
    i8 10, label %.thread
    i8 0, label %.thread
  ]

16:                                               ; preds = %14
  %17 = add nuw nsw i32 %spec.select, 1
  br label %.thread

.thread:                                          ; preds = %.preheader, %14, %14, %16
  %.069.lcssa101 = phi i32 [ %11, %16 ], [ %11, %14 ], [ %11, %14 ], [ 0, %.preheader ]
  %.368 = phi i32 [ %17, %16 ], [ %spec.select, %14 ], [ %spec.select, %14 ], [ 0, %.preheader ]
  %18 = add nsw i32 %.368, %.069.lcssa101
  %19 = tail call i32 @feof(ptr noundef nonnull %5) #5
  %.not74 = icmp eq i32 %19, 0
  br i1 %.not74, label %.sink.split, label %20

20:                                               ; preds = %.thread
  tail call void @rewind(ptr noundef nonnull %5)
  %21 = sext i32 %18 to i64
  %22 = tail call noalias ptr @malloc(i64 noundef %21) #6
  store ptr %22, ptr %1, align 8, !tbaa !5
  %23 = sext i32 %.368 to i64
  %24 = shl nsw i64 %23, 2
  %25 = tail call noalias ptr @malloc(i64 noundef %24) #6
  store ptr %25, ptr %2, align 8, !tbaa !5
  store i32 %.368, ptr %3, align 4, !tbaa !9
  %26 = load ptr, ptr %1, align 8, !tbaa !5
  %27 = icmp eq ptr %26, null
  %28 = icmp eq ptr %25, null
  %or.cond = or i1 %28, %27
  br i1 %or.cond, label %29, label %31

29:                                               ; preds = %20
  tail call void @free(ptr noundef %26) #5
  store ptr null, ptr %1, align 8, !tbaa !5
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  tail call void @free(ptr noundef %30) #5
  store ptr null, ptr %2, align 8, !tbaa !5
  br label %.sink.split

31:                                               ; preds = %20
  store i32 0, ptr %25, align 4, !tbaa !9
  %.not7691 = icmp sgt i32 %.368, 0
  br i1 %.not7691, label %.lr.ph94.preheader, label %.sink.split

.lr.ph94.preheader:                               ; preds = %31
  %wide.trip.count = zext nneg i32 %.368 to i64
  br label %.lr.ph94

.lr.ph94:                                         ; preds = %.lr.ph94.preheader, %39
  %32 = phi ptr [ %25, %.lr.ph94.preheader ], [ %40, %39 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph94.preheader ], [ %indvars.iv.next, %39 ]
  %33 = load ptr, ptr %1, align 8, !tbaa !5
  %34 = getelementptr inbounds i32, ptr %32, i64 %indvars.iv
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds i8, ptr %33, i64 %36
  %38 = tail call ptr @fgets(ptr noundef %37, i32 noundef %18, ptr noundef nonnull %5)
  %.not75 = icmp eq ptr %38, null
  br i1 %.not75, label %48, label %39

39:                                               ; preds = %.lr.ph94
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = getelementptr inbounds i32, ptr %40, i64 %indvars.iv
  %42 = load i32, ptr %41, align 4, !tbaa !9
  %43 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %37) #7
  %44 = trunc i64 %43 to i32
  %45 = add i32 %42, 1
  %46 = add i32 %45, %44
  %47 = getelementptr inbounds i8, ptr %41, i64 4
  store i32 %46, ptr %47, align 4, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.sink.split, label %.lr.ph94, !llvm.loop !11

48:                                               ; preds = %.lr.ph94
  %49 = trunc nuw nsw i64 %indvars.iv to i32
  %50 = add nsw i32 %49, -1
  store i32 %50, ptr %3, align 4, !tbaa !9
  br label %.sink.split

.sink.split:                                      ; preds = %39, %31, %.thread, %29, %48
  %.4.ph = phi i32 [ -100, %48 ], [ -10000, %29 ], [ -100, %.thread ], [ 0, %31 ], [ 0, %39 ]
  %51 = tail call i32 @fclose(ptr noundef nonnull %5)
  br label %52

52:                                               ; preds = %.sink.split, %4
  %.4 = phi i32 [ -1, %4 ], [ %.4.ph, %.sink.split ]
  ret i32 %.4
}

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fgetc(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @feof(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare void @rewind(ptr nocapture noundef) local_unnamed_addr #1

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

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

; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4

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 = { 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 #2 = { 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 #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 memory(argmem: read) "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) }
attributes #7 = { nounwind willreturn memory(read) }

!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"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass