; LLVM IR from zisisvakras/crossw :: src (crossu)

; 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
@.str.1 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [38 x i8], align 1
@stderr = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [47 x i8], align 1

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

25:                                               ; preds = %4
  call void @perror(ptr noundef @.str.1)
  %26 = call ptr @__errno_location() #9
  %27 = load i32, ptr %26, align 4, !tbaa !9
  call void @exit(i32 noundef %27) #10
  unreachable

28:                                               ; preds = %4
  %29 = load ptr, ptr %12, align 8, !tbaa !5
  %30 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %29, ptr noundef @.str.2, ptr noundef %10)
  %31 = icmp ne i32 %30, 1
  br i1 %31, label %32, label %35

32:                                               ; preds = %28
  call void @perror(ptr noundef @.str.3)
  %33 = call ptr @__errno_location() #9
  %34 = load i32, ptr %33, align 4, !tbaa !9
  call void @exit(i32 noundef %34) #10
  unreachable

35:                                               ; preds = %28
  %36 = load i32, ptr %10, align 4, !tbaa !9
  %37 = icmp sle i32 %36, 0
  br i1 %37, label %38, label %42

38:                                               ; preds = %35
  %39 = load ptr, ptr @stderr, align 8, !tbaa !5
  %40 = load i32, ptr %10, align 4, !tbaa !9
  %41 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef @.str.4, i32 noundef %40) #8
  call void @exit(i32 noundef 1) #10
  unreachable

42:                                               ; preds = %35
  %43 = load i32, ptr %10, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = mul i64 %44, 8
  %46 = call noalias ptr @malloc(i64 noundef %45) #11
  store ptr %46, ptr %9, align 8, !tbaa !5
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  %48 = icmp eq ptr %47, null
  br i1 %48, label %49, label %52

49:                                               ; preds = %42
  call void @perror(ptr noundef @.str.5)
  %50 = call ptr @__errno_location() #9
  %51 = load i32, ptr %50, align 4, !tbaa !9
  call void @exit(i32 noundef %51) #10
  unreachable

52:                                               ; preds = %42
  %53 = load i32, ptr %10, align 4, !tbaa !9
  %54 = load i32, ptr %10, align 4, !tbaa !9
  %55 = mul nsw i32 %53, %54
  %56 = sext i32 %55 to i64
  %57 = call noalias ptr @calloc(i64 noundef %56, i64 noundef 1) #12
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = getelementptr inbounds ptr, ptr %58, i64 0
  store ptr %57, ptr %59, align 8, !tbaa !5
  %60 = load ptr, ptr %9, align 8, !tbaa !5
  %61 = getelementptr inbounds ptr, ptr %60, i64 0
  %62 = load ptr, ptr %61, align 8, !tbaa !5
  %63 = icmp eq ptr %62, null
  br i1 %63, label %64, label %67

64:                                               ; preds = %52
  call void @perror(ptr noundef @.str.6)
  %65 = call ptr @__errno_location() #9
  %66 = load i32, ptr %65, align 4, !tbaa !9
  call void @exit(i32 noundef %66) #10
  unreachable

67:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %68

68:                                               ; preds = %88, %67
  %69 = load i32, ptr %13, align 4, !tbaa !9
  %70 = load i32, ptr %10, align 4, !tbaa !9
  %71 = sub nsw i32 %70, 1
  %72 = icmp slt i32 %69, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %91

74:                                               ; preds = %68
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = load i32, ptr %13, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds ptr, ptr %75, i64 %77
  %79 = load ptr, ptr %78, align 8, !tbaa !5
  %80 = load i32, ptr %10, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds i8, ptr %79, i64 %81
  %83 = load ptr, ptr %9, align 8, !tbaa !5
  %84 = load i32, ptr %13, align 4, !tbaa !9
  %85 = add nsw i32 %84, 1
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds ptr, ptr %83, i64 %86
  store ptr %82, ptr %87, align 8, !tbaa !5
  br label %88

88:                                               ; preds = %74
  %89 = load i32, ptr %13, align 4, !tbaa !9
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %13, align 4, !tbaa !9
  br label %68, !llvm.loop !11

91:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  br label %92

92:                                               ; preds = %113, %91
  %93 = load ptr, ptr %12, align 8, !tbaa !5
  %94 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %93, ptr noundef @.str.7, ptr noundef %14, ptr noundef %15)
  %95 = icmp eq i32 %94, 2
  br i1 %95, label %96, label %124

96:                                               ; preds = %92
  %97 = load i32, ptr %14, align 4, !tbaa !9
  %98 = icmp sle i32 %97, 0
  br i1 %98, label %110, label %99

99:                                               ; preds = %96
  %100 = load i32, ptr %14, align 4, !tbaa !9
  %101 = load i32, ptr %10, align 4, !tbaa !9
  %102 = icmp sgt i32 %100, %101
  br i1 %102, label %110, label %103

103:                                              ; preds = %99
  %104 = load i32, ptr %15, align 4, !tbaa !9
  %105 = icmp sle i32 %104, 0
  br i1 %105, label %110, label %106

106:                                              ; preds = %103
  %107 = load i32, ptr %15, align 4, !tbaa !9
  %108 = load i32, ptr %10, align 4, !tbaa !9
  %109 = icmp sgt i32 %107, %108
  br i1 %109, label %110, label %113

110:                                              ; preds = %106, %103, %99, %96
  %111 = load ptr, ptr @stderr, align 8, !tbaa !5
  %112 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %111, ptr noundef @.str.8) #8
  call void @exit(i32 noundef 1) #10
  unreachable

113:                                              ; preds = %106
  %114 = load ptr, ptr %9, align 8, !tbaa !5
  %115 = load i32, ptr %14, align 4, !tbaa !9
  %116 = sub nsw i32 %115, 1
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds ptr, ptr %114, i64 %117
  %119 = load ptr, ptr %118, align 8, !tbaa !5
  %120 = load i32, ptr %15, align 4, !tbaa !9
  %121 = sub nsw i32 %120, 1
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds i8, ptr %119, i64 %122
  store i8 13, ptr %123, align 1, !tbaa !13
  br label %92, !llvm.loop !14

124:                                              ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %125

125:                                              ; preds = %221, %124
  %126 = load i32, ptr %16, align 4, !tbaa !9
  %127 = load i32, ptr %10, align 4, !tbaa !9
  %128 = icmp slt i32 %126, %127
  br i1 %128, label %130, label %129

129:                                              ; preds = %125
  store i32 7, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %224

130:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  store i32 0, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  store i32 0, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %131

131:                                              ; preds = %205, %130
  %132 = load i32, ptr %20, align 4, !tbaa !9
  %133 = load i32, ptr %10, align 4, !tbaa !9
  %134 = icmp slt i32 %132, %133
  br i1 %134, label %136, label %135

135:                                              ; preds = %131
  store i32 10, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %208

136:                                              ; preds = %131
  %137 = load ptr, ptr %9, align 8, !tbaa !5
  %138 = load i32, ptr %16, align 4, !tbaa !9
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds ptr, ptr %137, i64 %139
  %141 = load ptr, ptr %140, align 8, !tbaa !5
  %142 = load i32, ptr %20, align 4, !tbaa !9
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds i8, ptr %141, i64 %143
  %145 = load i8, ptr %144, align 1, !tbaa !13
  %146 = sext i8 %145 to i32
  %147 = icmp eq i32 %146, 13
  br i1 %147, label %148, label %155

148:                                              ; preds = %136
  %149 = load i32, ptr %18, align 4, !tbaa !9
  %150 = load i32, ptr %11, align 4, !tbaa !9
  %151 = icmp sgt i32 %149, %150
  br i1 %151, label %152, label %154

152:                                              ; preds = %148
  %153 = load i32, ptr %18, align 4, !tbaa !9
  store i32 %153, ptr %11, align 4, !tbaa !9
  br label %154

154:                                              ; preds = %152, %148
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %155

155:                                              ; preds = %154, %136
  %156 = load ptr, ptr %9, align 8, !tbaa !5
  %157 = load i32, ptr %16, align 4, !tbaa !9
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds ptr, ptr %156, i64 %158
  %160 = load ptr, ptr %159, align 8, !tbaa !5
  %161 = load i32, ptr %20, align 4, !tbaa !9
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds i8, ptr %160, i64 %162
  %164 = load i8, ptr %163, align 1, !tbaa !13
  %165 = sext i8 %164 to i32
  %166 = icmp eq i32 %165, 0
  br i1 %166, label %167, label %170

167:                                              ; preds = %155
  %168 = load i32, ptr %18, align 4, !tbaa !9
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %18, align 4, !tbaa !9
  br label %170

170:                                              ; preds = %167, %155
  %171 = load ptr, ptr %9, align 8, !tbaa !5
  %172 = load i32, ptr %20, align 4, !tbaa !9
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds ptr, ptr %171, i64 %173
  %175 = load ptr, ptr %174, align 8, !tbaa !5
  %176 = load i32, ptr %16, align 4, !tbaa !9
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds i8, ptr %175, i64 %177
  %179 = load i8, ptr %178, align 1, !tbaa !13
  %180 = sext i8 %179 to i32
  %181 = icmp eq i32 %180, 13
  br i1 %181, label %182, label %189

182:                                              ; preds = %170
  %183 = load i32, ptr %19, align 4, !tbaa !9
  %184 = load i32, ptr %11, align 4, !tbaa !9
  %185 = icmp sgt i32 %183, %184
  br i1 %185, label %186, label %188

186:                                              ; preds = %182
  %187 = load i32, ptr %19, align 4, !tbaa !9
  store i32 %187, ptr %11, align 4, !tbaa !9
  br label %188

188:                                              ; preds = %186, %182
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %189

189:                                              ; preds = %188, %170
  %190 = load ptr, ptr %9, align 8, !tbaa !5
  %191 = load i32, ptr %20, align 4, !tbaa !9
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds ptr, ptr %190, i64 %192
  %194 = load ptr, ptr %193, align 8, !tbaa !5
  %195 = load i32, ptr %16, align 4, !tbaa !9
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds i8, ptr %194, i64 %196
  %198 = load i8, ptr %197, align 1, !tbaa !13
  %199 = sext i8 %198 to i32
  %200 = icmp eq i32 %199, 0
  br i1 %200, label %201, label %204

201:                                              ; preds = %189
  %202 = load i32, ptr %19, align 4, !tbaa !9
  %203 = add nsw i32 %202, 1
  store i32 %203, ptr %19, align 4, !tbaa !9
  br label %204

204:                                              ; preds = %201, %189
  br label %205

205:                                              ; preds = %204
  %206 = load i32, ptr %20, align 4, !tbaa !9
  %207 = add nsw i32 %206, 1
  store i32 %207, ptr %20, align 4, !tbaa !9
  br label %131, !llvm.loop !15

208:                                              ; preds = %135
  %209 = load i32, ptr %18, align 4, !tbaa !9
  %210 = load i32, ptr %11, align 4, !tbaa !9
  %211 = icmp sgt i32 %209, %210
  br i1 %211, label %212, label %214

212:                                              ; preds = %208
  %213 = load i32, ptr %18, align 4, !tbaa !9
  store i32 %213, ptr %11, align 4, !tbaa !9
  br label %214

214:                                              ; preds = %212, %208
  %215 = load i32, ptr %19, align 4, !tbaa !9
  %216 = load i32, ptr %11, align 4, !tbaa !9
  %217 = icmp sgt i32 %215, %216
  br i1 %217, label %218, label %220

218:                                              ; preds = %214
  %219 = load i32, ptr %19, align 4, !tbaa !9
  store i32 %219, ptr %11, align 4, !tbaa !9
  br label %220

220:                                              ; preds = %218, %214
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %221

221:                                              ; preds = %220
  %222 = load i32, ptr %16, align 4, !tbaa !9
  %223 = add nsw i32 %222, 1
  store i32 %223, ptr %16, align 4, !tbaa !9
  br label %125, !llvm.loop !16

224:                                              ; preds = %129
  %225 = load ptr, ptr %9, align 8, !tbaa !5
  %226 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %225, ptr %226, align 8, !tbaa !5
  %227 = load i32, ptr %10, align 4, !tbaa !9
  %228 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 %227, ptr %228, align 4, !tbaa !9
  %229 = load i32, ptr %11, align 4, !tbaa !9
  %230 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 %229, ptr %230, align 4, !tbaa !9
  %231 = load ptr, ptr %12, align 8, !tbaa !5
  %232 = call i32 @fclose(ptr noundef %231)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  ret void
}

; 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 void @perror(ptr noundef) #2

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #4

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

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

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

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #7

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

declare i32 @fclose(ptr noundef) #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { nounwind willreturn memory(none) "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 "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 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 #7 = { nounwind allocsize(0,1) "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 #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(none) }
attributes #10 = { noreturn nounwind }
attributes #11 = { nounwind allocsize(0) }
attributes #12 = { nounwind allocsize(0,1) }

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

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [38 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [47 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @init_crossword(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #0 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #9
  store i32 0, ptr %5, align 4, !tbaa !5
  %8 = tail call noalias ptr @fopen(ptr noundef %0, ptr noundef nonnull @.str)
  %9 = icmp eq ptr %8, null
  br i1 %9, label %10, label %13

10:                                               ; preds = %4
  tail call void @perror(ptr noundef nonnull @.str.1) #10
  %11 = tail call ptr @__errno_location() #11
  %12 = load i32, ptr %11, align 4, !tbaa !5
  tail call void @exit(i32 noundef %12) #12
  unreachable

13:                                               ; preds = %4
  %14 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef nonnull %8, ptr noundef nonnull @.str.2, ptr noundef nonnull %5) #9
  %.not = icmp eq i32 %14, 1
  br i1 %.not, label %18, label %15

15:                                               ; preds = %13
  call void @perror(ptr noundef nonnull @.str.3) #10
  %16 = tail call ptr @__errno_location() #11
  %17 = load i32, ptr %16, align 4, !tbaa !5
  call void @exit(i32 noundef %17) #12
  unreachable

18:                                               ; preds = %13
  %19 = load i32, ptr %5, align 4, !tbaa !5
  %20 = icmp slt i32 %19, 1
  br i1 %20, label %21, label %24

21:                                               ; preds = %18
  %22 = load ptr, ptr @stderr, align 8, !tbaa !9
  %23 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef nonnull @.str.4, i32 noundef %19) #13
  call void @exit(i32 noundef 1) #12
  unreachable

24:                                               ; preds = %18
  %25 = zext nneg i32 %19 to i64
  %26 = shl nuw nsw i64 %25, 3
  %27 = call noalias ptr @malloc(i64 noundef %26) #14
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %32

29:                                               ; preds = %24
  call void @perror(ptr noundef nonnull @.str.5) #10
  %30 = tail call ptr @__errno_location() #11
  %31 = load i32, ptr %30, align 4, !tbaa !5
  call void @exit(i32 noundef %31) #12
  unreachable

32:                                               ; preds = %24
  %33 = mul nuw nsw i32 %19, %19
  %34 = zext nneg i32 %33 to i64
  %35 = call noalias ptr @calloc(i64 noundef %34, i64 noundef 1) #15
  store ptr %35, ptr %27, align 8, !tbaa !9
  %36 = icmp eq ptr %35, null
  br i1 %36, label %40, label %.preheader70

.preheader70:                                     ; preds = %32
  %.not88 = icmp eq i32 %19, 1
  br i1 %.not88, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader70
  %37 = add nsw i32 %19, -1
  %wide.trip.count = zext nneg i32 %37 to i64
  %38 = add nsw i64 %wide.trip.count, -1
  %xtraiter = and i64 %wide.trip.count, 7
  %39 = icmp ult i64 %38, 7
  br i1 %39, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %wide.trip.count, 2147483640
  br label %48

40:                                               ; preds = %32
  call void @perror(ptr noundef nonnull @.str.6) #10
  %41 = tail call ptr @__errno_location() #11
  %42 = load i32, ptr %41, align 4, !tbaa !5
  call void @exit(i32 noundef %42) #12
  unreachable

._crit_edge.loopexit.unr-lcssa:                   ; preds = %48, %.lr.ph
  %.unr = phi ptr [ %35, %.lr.ph ], [ %64, %48 ]
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next.7, %48 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader
  %43 = phi ptr [ %44, %.epil.preheader ], [ %.unr, %._crit_edge.loopexit.unr-lcssa ]
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.epil.preheader ], [ %indvars.iv.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %44 = getelementptr inbounds i8, ptr %43, i64 %25
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %45 = getelementptr inbounds ptr, ptr %27, i64 %indvars.iv.next.epil
  store ptr %44, ptr %45, align 8, !tbaa !9
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.epil.preheader, !llvm.loop !11

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader, %.preheader70
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #9
  %invariant.gep = getelementptr i8, ptr %27, i64 -8
  %46 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef nonnull %8, ptr noundef nonnull @.str.7, ptr noundef nonnull %6, ptr noundef nonnull %7) #9
  %47 = icmp eq i32 %46, 2
  br i1 %47, label %.lr.ph73, label %.preheader69

48:                                               ; preds = %48, %.lr.ph.new
  %49 = phi ptr [ %35, %.lr.ph.new ], [ %64, %48 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph.new ], [ %indvars.iv.next.7, %48 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.7, %48 ]
  %50 = getelementptr inbounds i8, ptr %49, i64 %25
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %51 = getelementptr inbounds ptr, ptr %27, i64 %indvars.iv.next
  store ptr %50, ptr %51, align 8, !tbaa !9
  %52 = getelementptr inbounds i8, ptr %50, i64 %25
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %53 = getelementptr inbounds ptr, ptr %27, i64 %indvars.iv.next.1
  store ptr %52, ptr %53, align 8, !tbaa !9
  %54 = getelementptr inbounds i8, ptr %52, i64 %25
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %55 = getelementptr inbounds ptr, ptr %27, i64 %indvars.iv.next.2
  store ptr %54, ptr %55, align 8, !tbaa !9
  %56 = getelementptr inbounds i8, ptr %54, i64 %25
  %indvars.iv.next.3 = or disjoint i64 %indvars.iv, 4
  %57 = getelementptr inbounds ptr, ptr %27, i64 %indvars.iv.next.3
  store ptr %56, ptr %57, align 8, !tbaa !9
  %58 = getelementptr inbounds i8, ptr %56, i64 %25
  %indvars.iv.next.4 = or disjoint i64 %indvars.iv, 5
  %59 = getelementptr inbounds ptr, ptr %27, i64 %indvars.iv.next.4
  store ptr %58, ptr %59, align 8, !tbaa !9
  %60 = getelementptr inbounds i8, ptr %58, i64 %25
  %indvars.iv.next.5 = or disjoint i64 %indvars.iv, 6
  %61 = getelementptr inbounds ptr, ptr %27, i64 %indvars.iv.next.5
  store ptr %60, ptr %61, align 8, !tbaa !9
  %62 = getelementptr inbounds i8, ptr %60, i64 %25
  %indvars.iv.next.6 = or disjoint i64 %indvars.iv, 7
  %63 = getelementptr inbounds ptr, ptr %27, i64 %indvars.iv.next.6
  store ptr %62, ptr %63, align 8, !tbaa !9
  %64 = getelementptr inbounds i8, ptr %62, i64 %25
  %indvars.iv.next.7 = add nuw nsw i64 %indvars.iv, 8
  %65 = getelementptr inbounds ptr, ptr %27, i64 %indvars.iv.next.7
  store ptr %64, ptr %65, align 8, !tbaa !9
  %niter.next.7 = add i64 %niter, 8
  %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %._crit_edge.loopexit.unr-lcssa, label %48, !llvm.loop !13

.preheader69:                                     ; preds = %95, %._crit_edge
  %66 = load i32, ptr %5, align 4, !tbaa !5
  %67 = icmp sgt i32 %66, 0
  br i1 %67, label %.preheader.us.preheader, label %._crit_edge84

.preheader.us.preheader:                          ; preds = %.preheader69
  %wide.trip.count98 = zext nneg i32 %66 to i64
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge79.us
  %indvars.iv95 = phi i64 [ 0, %.preheader.us.preheader ], [ %indvars.iv.next96, %._crit_edge79.us ]
  %.05682.us = phi i32 [ 0, %.preheader.us.preheader ], [ %.7.us, %._crit_edge79.us ]
  %68 = getelementptr inbounds ptr, ptr %27, i64 %indvars.iv95
  %69 = load ptr, ptr %68, align 8, !tbaa !9
  br label %70

70:                                               ; preds = %.preheader.us, %70
  %indvars.iv90 = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next91, %70 ]
  %.05076.us = phi i32 [ 0, %.preheader.us ], [ %.2.us, %70 ]
  %.05175.us = phi i32 [ 0, %.preheader.us ], [ %.253.us, %70 ]
  %.15774.us = phi i32 [ %.05682.us, %.preheader.us ], [ %.5.us, %70 ]
  %71 = getelementptr inbounds i8, ptr %69, i64 %indvars.iv90
  %72 = load i8, ptr %71, align 1, !tbaa !15
  %73 = icmp eq i8 %72, 13
  %spec.select67.us = call i32 @llvm.smax.i32(i32 %.05175.us, i32 %.15774.us)
  %.3.us = select i1 %73, i32 %spec.select67.us, i32 %.15774.us
  %.152.us = select i1 %73, i32 0, i32 %.05175.us
  %74 = icmp eq i8 %72, 0
  %75 = zext i1 %74 to i32
  %.253.us = add nsw i32 %.152.us, %75
  %76 = getelementptr inbounds ptr, ptr %27, i64 %indvars.iv90
  %77 = load ptr, ptr %76, align 8, !tbaa !9
  %78 = getelementptr inbounds i8, ptr %77, i64 %indvars.iv95
  %79 = load i8, ptr %78, align 1, !tbaa !15
  %80 = icmp eq i8 %79, 13
  %spec.select68.us = call i32 @llvm.smax.i32(i32 %.05076.us, i32 %.3.us)
  %.5.us = select i1 %80, i32 %spec.select68.us, i32 %.3.us
  %.1.us = select i1 %80, i32 0, i32 %.05076.us
  %81 = icmp eq i8 %79, 0
  %82 = zext i1 %81 to i32
  %.2.us = add nsw i32 %.1.us, %82
  %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
  %exitcond94.not = icmp eq i64 %indvars.iv.next91, %wide.trip.count98
  br i1 %exitcond94.not, label %._crit_edge79.us, label %70, !llvm.loop !16

._crit_edge79.us:                                 ; preds = %70
  %spec.select.us = call i32 @llvm.smax.i32(i32 %.253.us, i32 %.5.us)
  %.7.us = call i32 @llvm.smax.i32(i32 %.2.us, i32 %spec.select.us)
  %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
  %exitcond99.not = icmp eq i64 %indvars.iv.next96, %wide.trip.count98
  br i1 %exitcond99.not, label %._crit_edge84, label %.preheader.us, !llvm.loop !17

.lr.ph73:                                         ; preds = %._crit_edge, %95
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = icmp slt i32 %83, 1
  br i1 %84, label %92, label %85

85:                                               ; preds = %.lr.ph73
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = icmp sgt i32 %83, %86
  %88 = load i32, ptr %7, align 4
  %89 = icmp slt i32 %88, 1
  %90 = icmp sgt i32 %88, %86
  %91 = or i1 %89, %90
  %or.cond66 = select i1 %87, i1 true, i1 %91
  br i1 %or.cond66, label %92, label %95

92:                                               ; preds = %85, %.lr.ph73
  %93 = load ptr, ptr @stderr, align 8, !tbaa !9
  %94 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %93, ptr noundef nonnull @.str.8) #13
  call void @exit(i32 noundef 1) #12
  unreachable

95:                                               ; preds = %85
  %96 = zext nneg i32 %83 to i64
  %gep = getelementptr ptr, ptr %invariant.gep, i64 %96
  %97 = load ptr, ptr %gep, align 8, !tbaa !9
  %98 = zext nneg i32 %88 to i64
  %99 = getelementptr i8, ptr %97, i64 %98
  %100 = getelementptr i8, ptr %99, i64 -1
  store i8 13, ptr %100, align 1, !tbaa !15
  %101 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef nonnull %8, ptr noundef nonnull @.str.7, ptr noundef nonnull %6, ptr noundef nonnull %7) #9
  %102 = icmp eq i32 %101, 2
  br i1 %102, label %.lr.ph73, label %.preheader69, !llvm.loop !18

._crit_edge84:                                    ; preds = %._crit_edge79.us, %.preheader69
  %.056.lcssa = phi i32 [ 0, %.preheader69 ], [ %.7.us, %._crit_edge79.us ]
  store ptr %27, ptr %1, align 8, !tbaa !9
  store i32 %66, ptr %2, align 4, !tbaa !5
  store i32 %.056.lcssa, ptr %3, align 4, !tbaa !5
  %103 = call i32 @fclose(ptr noundef nonnull %8)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #9
  ret void
}

; 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 void @perror(ptr nocapture noundef readonly) local_unnamed_addr #2

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #4

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

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, 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 #6

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #7

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #8

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 nosync nounwind willreturn memory(none) "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 = { 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 #7 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) 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 #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
attributes #10 = { cold }
attributes #11 = { nounwind willreturn memory(none) }
attributes #12 = { noreturn nounwind }
attributes #13 = { cold nounwind }
attributes #14 = { nounwind allocsize(0) }
attributes #15 = { nounwind allocsize(0,1) }

!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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}


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