; LLVM IR from arasgungore/filters-and-fractals :: main (readPPM)

; 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.PPMImage = type { i32, i32, ptr }

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [27 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @readPPM(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca [16 x i8], align 16
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i8, align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = call noalias ptr @fopen(ptr noundef %8, ptr noundef @.str)
  store ptr %9, ptr %5, align 8, !tbaa !5
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = icmp ne ptr %10, null
  br i1 %11, label %16, label %12

12:                                               ; preds = %1
  %13 = load ptr, ptr @stderr, align 8, !tbaa !5
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %13, ptr noundef @.str.1, ptr noundef %14) #6
  call void @exit(i32 noundef 1) #7
  unreachable

16:                                               ; preds = %1
  %17 = getelementptr inbounds [16 x i8], ptr %3, i64 0, i64 0
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = call ptr @fgets(ptr noundef %17, i32 noundef 16, ptr noundef %18)
  %20 = icmp ne ptr %19, null
  br i1 %20, label %23, label %21

21:                                               ; preds = %16
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  call void @perror(ptr noundef %22)
  call void @exit(i32 noundef 1) #7
  unreachable

23:                                               ; preds = %16
  %24 = getelementptr inbounds [16 x i8], ptr %3, i64 0, i64 0
  %25 = load i8, ptr %24, align 16, !tbaa !9
  %26 = sext i8 %25 to i32
  %27 = icmp ne i32 %26, 80
  br i1 %27, label %33, label %28

28:                                               ; preds = %23
  %29 = getelementptr inbounds [16 x i8], ptr %3, i64 0, i64 1
  %30 = load i8, ptr %29, align 1, !tbaa !9
  %31 = sext i8 %30 to i32
  %32 = icmp ne i32 %31, 54
  br i1 %32, label %33, label %36

33:                                               ; preds = %28, %23
  %34 = load ptr, ptr @stderr, align 8, !tbaa !5
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef @.str.2) #6
  call void @exit(i32 noundef 1) #7
  unreachable

36:                                               ; preds = %28
  %37 = call noalias ptr @malloc(i64 noundef 16) #8
  store ptr %37, ptr %4, align 8, !tbaa !5
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = icmp ne ptr %38, null
  br i1 %39, label %43, label %40

40:                                               ; preds = %36
  %41 = load ptr, ptr @stderr, align 8, !tbaa !5
  %42 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %41, ptr noundef @.str.3) #6
  call void @exit(i32 noundef 1) #7
  unreachable

43:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #6
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = call i32 @getc(ptr noundef %44)
  %46 = trunc i32 %45 to i8
  store i8 %46, ptr %7, align 1, !tbaa !9
  br label %47

47:                                               ; preds = %57, %43
  %48 = load i8, ptr %7, align 1, !tbaa !9
  %49 = sext i8 %48 to i32
  %50 = icmp eq i32 %49, 35
  br i1 %50, label %51, label %61

51:                                               ; preds = %47
  br label %52

52:                                               ; preds = %56, %51
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = call i32 @getc(ptr noundef %53)
  %55 = icmp ne i32 %54, 10
  br i1 %55, label %56, label %57

56:                                               ; preds = %52
  br label %52, !llvm.loop !10

57:                                               ; preds = %52
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = call i32 @getc(ptr noundef %58)
  %60 = trunc i32 %59 to i8
  store i8 %60, ptr %7, align 1, !tbaa !9
  br label %47, !llvm.loop !12

61:                                               ; preds = %47
  %62 = load i8, ptr %7, align 1, !tbaa !9
  %63 = sext i8 %62 to i32
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = call i32 @ungetc(i32 noundef %63, ptr noundef %64)
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.PPMImage, ptr %67, i32 0, i32 0
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.PPMImage, ptr %69, i32 0, i32 1
  %71 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %66, ptr noundef @.str.4, ptr noundef %68, ptr noundef %70)
  %72 = icmp ne i32 %71, 2
  br i1 %72, label %73, label %77

73:                                               ; preds = %61
  %74 = load ptr, ptr @stderr, align 8, !tbaa !5
  %75 = load ptr, ptr %2, align 8, !tbaa !5
  %76 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %74, ptr noundef @.str.5, ptr noundef %75) #6
  call void @exit(i32 noundef 1) #7
  unreachable

77:                                               ; preds = %61
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %78, ptr noundef @.str.6, ptr noundef %6)
  %80 = icmp ne i32 %79, 1
  br i1 %80, label %81, label %85

81:                                               ; preds = %77
  %82 = load ptr, ptr @stderr, align 8, !tbaa !5
  %83 = load ptr, ptr %2, align 8, !tbaa !5
  %84 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef @.str.7, ptr noundef %83) #6
  call void @exit(i32 noundef 1) #7
  unreachable

85:                                               ; preds = %77
  %86 = load i32, ptr %6, align 4, !tbaa !13
  %87 = icmp ne i32 %86, 255
  br i1 %87, label %88, label %92

88:                                               ; preds = %85
  %89 = load ptr, ptr @stderr, align 8, !tbaa !5
  %90 = load ptr, ptr %2, align 8, !tbaa !5
  %91 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %89, ptr noundef @.str.8, ptr noundef %90) #6
  call void @exit(i32 noundef 1) #7
  unreachable

92:                                               ; preds = %85
  br label %93

93:                                               ; preds = %97, %92
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = call i32 @fgetc(ptr noundef %94)
  %96 = icmp ne i32 %95, 10
  br i1 %96, label %97, label %98

97:                                               ; preds = %93
  br label %93, !llvm.loop !15

98:                                               ; preds = %93
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.PPMImage, ptr %99, i32 0, i32 0
  %101 = load i32, ptr %100, align 8, !tbaa !16
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.PPMImage, ptr %102, i32 0, i32 1
  %104 = load i32, ptr %103, align 4, !tbaa !18
  %105 = mul i32 %101, %104
  %106 = zext i32 %105 to i64
  %107 = mul i64 %106, 3
  %108 = call noalias ptr @malloc(i64 noundef %107) #8
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.PPMImage, ptr %109, i32 0, i32 2
  store ptr %108, ptr %110, align 8, !tbaa !19
  %111 = load ptr, ptr %4, align 8, !tbaa !5
  %112 = icmp ne ptr %111, null
  br i1 %112, label %116, label %113

113:                                              ; preds = %98
  %114 = load ptr, ptr @stderr, align 8, !tbaa !5
  %115 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %114, ptr noundef @.str.3) #6
  call void @exit(i32 noundef 1) #7
  unreachable

116:                                              ; preds = %98
  %117 = load ptr, ptr %4, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.PPMImage, ptr %117, i32 0, i32 2
  %119 = load ptr, ptr %118, align 8, !tbaa !19
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.PPMImage, ptr %120, i32 0, i32 0
  %122 = load i32, ptr %121, align 8, !tbaa !16
  %123 = mul i32 3, %122
  %124 = zext i32 %123 to i64
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.PPMImage, ptr %125, i32 0, i32 1
  %127 = load i32, ptr %126, align 4, !tbaa !18
  %128 = zext i32 %127 to i64
  %129 = load ptr, ptr %5, align 8, !tbaa !5
  %130 = call i64 @fread(ptr noundef %119, i64 noundef %124, i64 noundef %128, ptr noundef %129)
  %131 = load ptr, ptr %4, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.PPMImage, ptr %131, i32 0, i32 1
  %133 = load i32, ptr %132, align 4, !tbaa !18
  %134 = zext i32 %133 to i64
  %135 = icmp ne i64 %130, %134
  br i1 %135, label %136, label %140

136:                                              ; preds = %116
  %137 = load ptr, ptr @stderr, align 8, !tbaa !5
  %138 = load ptr, ptr %2, align 8, !tbaa !5
  %139 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %137, ptr noundef @.str.9, ptr noundef %138) #6
  call void @exit(i32 noundef 1) #7
  unreachable

140:                                              ; preds = %116
  %141 = load ptr, ptr %5, align 8, !tbaa !5
  %142 = call i32 @fclose(ptr noundef %141)
  %143 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #6
  ret ptr %143
}

; 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

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #4

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

declare void @perror(ptr noundef) #2

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

declare i32 @getc(ptr noundef) #2

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

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

declare i32 @fgetc(ptr noundef) #2

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

declare i32 @fclose(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 = { noreturn 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn nounwind }
attributes #8 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !11}
!16 = !{!17, !14, i64 0}
!17 = !{!"", !14, i64 0, !14, i64 4, !6, i64 8}
!18 = !{!17, !14, i64 4}
!19 = !{!17, !6, i64 8}


; 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 [3 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [27 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @readPPM(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca [16 x i8], align 16
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %4 = tail call noalias ptr @fopen(ptr noundef %0, ptr noundef nonnull @.str)
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %5, label %8

5:                                                ; preds = %1
  %6 = load ptr, ptr @stderr, align 8, !tbaa !5
  %7 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %6, ptr noundef nonnull @.str.1, ptr noundef %0) #7
  tail call void @exit(i32 noundef 1) #8
  unreachable

8:                                                ; preds = %1
  %9 = call ptr @fgets(ptr noundef nonnull %2, i32 noundef 16, ptr noundef nonnull %4)
  %.not37 = icmp eq ptr %9, null
  br i1 %.not37, label %10, label %11

10:                                               ; preds = %8
  call void @perror(ptr noundef %0) #9
  call void @exit(i32 noundef 1) #8
  unreachable

11:                                               ; preds = %8
  %12 = load i8, ptr %2, align 16, !tbaa !9
  %13 = icmp ne i8 %12, 80
  %14 = getelementptr inbounds i8, ptr %2, i64 1
  %15 = load i8, ptr %14, align 1
  %16 = icmp ne i8 %15, 54
  %or.cond = select i1 %13, i1 true, i1 %16
  br i1 %or.cond, label %17, label %20

17:                                               ; preds = %11
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str.2) #7
  call void @exit(i32 noundef 1) #8
  unreachable

20:                                               ; preds = %11
  %21 = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #10
  %.not38 = icmp eq ptr %21, null
  br i1 %.not38, label %22, label %25

22:                                               ; preds = %20
  %23 = load ptr, ptr @stderr, align 8, !tbaa !5
  %24 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef nonnull @.str.3) #7
  call void @exit(i32 noundef 1) #8
  unreachable

25:                                               ; preds = %20
  %26 = call i32 @getc(ptr noundef nonnull %4)
  %sext46 = shl i32 %26, 24
  %27 = icmp eq i32 %sext46, 587202560
  br i1 %27, label %.preheader45, label %._crit_edge

.preheader45:                                     ; preds = %25, %.preheader45.backedge
  %28 = call i32 @getc(ptr noundef nonnull %4)
  %.not44 = icmp eq i32 %28, 10
  br i1 %.not44, label %29, label %.preheader45.backedge

.preheader45.backedge:                            ; preds = %.preheader45, %29
  br label %.preheader45, !llvm.loop !10

29:                                               ; preds = %.preheader45
  %30 = call i32 @getc(ptr noundef nonnull %4)
  %sext = shl i32 %30, 24
  %31 = icmp eq i32 %sext, 587202560
  br i1 %31, label %.preheader45.backedge, label %._crit_edge

._crit_edge:                                      ; preds = %29, %25
  %sext.lcssa = phi i32 [ %sext46, %25 ], [ %sext, %29 ]
  %32 = ashr exact i32 %sext.lcssa, 24
  %33 = call i32 @ungetc(i32 noundef %32, ptr noundef nonnull %4)
  %34 = getelementptr inbounds i8, ptr %21, i64 4
  %35 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef nonnull %4, ptr noundef nonnull @.str.4, ptr noundef nonnull %21, ptr noundef nonnull %34) #6
  %.not39 = icmp eq i32 %35, 2
  br i1 %.not39, label %39, label %36

36:                                               ; preds = %._crit_edge
  %37 = load ptr, ptr @stderr, align 8, !tbaa !5
  %38 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %37, ptr noundef nonnull @.str.5, ptr noundef %0) #7
  call void @exit(i32 noundef 1) #8
  unreachable

39:                                               ; preds = %._crit_edge
  %40 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef nonnull %4, ptr noundef nonnull @.str.6, ptr noundef nonnull %3) #6
  %.not40 = icmp eq i32 %40, 1
  br i1 %.not40, label %44, label %41

41:                                               ; preds = %39
  %42 = load ptr, ptr @stderr, align 8, !tbaa !5
  %43 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef nonnull @.str.7, ptr noundef %0) #7
  call void @exit(i32 noundef 1) #8
  unreachable

44:                                               ; preds = %39
  %45 = load i32, ptr %3, align 4, !tbaa !12
  %.not41 = icmp eq i32 %45, 255
  br i1 %.not41, label %.preheader, label %46

46:                                               ; preds = %44
  %47 = load ptr, ptr @stderr, align 8, !tbaa !5
  %48 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef nonnull @.str.8, ptr noundef %0) #7
  call void @exit(i32 noundef 1) #8
  unreachable

.preheader:                                       ; preds = %44, %.preheader
  %49 = call i32 @fgetc(ptr noundef nonnull %4)
  %.not42 = icmp eq i32 %49, 10
  br i1 %.not42, label %50, label %.preheader, !llvm.loop !14

50:                                               ; preds = %.preheader
  %51 = load i32, ptr %21, align 8, !tbaa !15
  %52 = load i32, ptr %34, align 4, !tbaa !17
  %53 = mul i32 %52, %51
  %54 = zext i32 %53 to i64
  %55 = mul nuw nsw i64 %54, 3
  %56 = call noalias ptr @malloc(i64 noundef %55) #10
  %57 = getelementptr inbounds i8, ptr %21, i64 8
  store ptr %56, ptr %57, align 8, !tbaa !18
  %58 = mul i32 %51, 3
  %59 = zext i32 %58 to i64
  %60 = zext i32 %52 to i64
  %61 = call i64 @fread(ptr noundef %56, i64 noundef %59, i64 noundef %60, ptr noundef nonnull %4)
  %62 = load i32, ptr %34, align 4, !tbaa !17
  %63 = zext i32 %62 to i64
  %.not43 = icmp eq i64 %61, %63
  br i1 %.not43, label %67, label %64

64:                                               ; preds = %50
  %65 = load ptr, ptr @stderr, align 8, !tbaa !5
  %66 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %65, ptr noundef nonnull @.str.9, ptr noundef %0) #7
  call void @exit(i32 noundef 1) #8
  unreachable

67:                                               ; preds = %50
  %68 = call i32 @fclose(ptr noundef nonnull %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #6
  ret ptr %21
}

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

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

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3

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

; Function Attrs: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #2

; 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

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

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

declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #5

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

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture 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 = { 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 "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 = { "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 = { cold nounwind }
attributes #8 = { noreturn nounwind }
attributes #9 = { cold }
attributes #10 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !11}
!15 = !{!16, !13, i64 0}
!16 = !{!"", !13, i64 0, !13, i64 4, !6, i64 8}
!17 = !{!16, !13, i64 4}
!18 = !{!16, !6, i64 8}


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