; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R2Shapes/R2Grid.ll (ZN6R2Grid11ReadPNMFileEPKc)

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

%class.R2Affine = type <{ %class.R2Transformation, %class.R3Matrix, i32, [4 x i8] }>
%class.R2Transformation = type { ptr }
%class.R3Matrix = type { [3 x [3 x double]] }
%class.R2Grid = type { %class.R2Affine, %class.R2Affine, double, ptr, [2 x i32], i32, i32 }

@R2identity_affine = external global %class.R2Affine, align 8
@stderr = external global ptr, align 8
@.str.40 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #0

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #1

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(84) ptr @_ZN8R2AffineaSERKS_(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef nonnull align 8 dereferenceable(84)) #3 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #4

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN6R2Grid11ReadPNMFileEPKc(ptr noundef nonnull align 8 dereferenceable(208) %0, ptr noundef %1) #6 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca [256 x i8], align 16
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca [256 x i8], align 16
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca [256 x i8], align 16
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i16, align 2
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i8, align 1
  %25 = alloca i16, align 2
  %26 = alloca i16, align 2
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %29 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #10
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = call noalias ptr @fopen(ptr noundef %30, ptr noundef @.str.40)
  store ptr %31, ptr %6, align 8, !tbaa !5
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = icmp ne ptr %32, null
  br i1 %33, label %38, label %34

34:                                               ; preds = %2
  %35 = load ptr, ptr @stderr, align 8, !tbaa !5
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef @.str.49, ptr noundef %36) #10
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %402

38:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #10
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = call i32 @fgetc(ptr noundef %39)
  store i32 %40, ptr %8, align 4, !tbaa !9
  %41 = load i32, ptr %8, align 4, !tbaa !9
  %42 = icmp ne i32 %41, 80
  br i1 %42, label %43, label %47

43:                                               ; preds = %38
  %44 = load ptr, ptr @stderr, align 8, !tbaa !5
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef @.str.50, ptr noundef %45) #10
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %401

47:                                               ; preds = %38
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = call i32 @fgetc(ptr noundef %48)
  store i32 %49, ptr %8, align 4, !tbaa !9
  %50 = load i32, ptr %8, align 4, !tbaa !9
  %51 = icmp ne i32 %50, 53
  br i1 %51, label %52, label %56

52:                                               ; preds = %47
  %53 = load ptr, ptr @stderr, align 8, !tbaa !5
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef @.str.50, ptr noundef %54) #10
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %401

56:                                               ; preds = %47
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = call i32 @fgetc(ptr noundef %57)
  store i32 %58, ptr %8, align 4, !tbaa !9
  %59 = load i32, ptr %8, align 4, !tbaa !9
  %60 = icmp ne i32 %59, 10
  br i1 %60, label %61, label %65

61:                                               ; preds = %56
  %62 = load ptr, ptr @stderr, align 8, !tbaa !5
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %62, ptr noundef @.str.50, ptr noundef %63) #10
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %401

65:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #10
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 256, ptr %10) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #10
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %66

66:                                               ; preds = %108, %65
  %67 = load i32, ptr %11, align 4, !tbaa !9
  %68 = icmp slt i32 %67, 256
  br i1 %68, label %70, label %69

69:                                               ; preds = %66
  store i32 2, ptr %7, align 4
  br label %111

70:                                               ; preds = %66
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = call i32 @fgetc(ptr noundef %71)
  store i32 %72, ptr %8, align 4, !tbaa !9
  %73 = load i32, ptr %8, align 4, !tbaa !9
  %74 = icmp eq i32 %73, 32
  br i1 %74, label %75, label %79

75:                                               ; preds = %70
  %76 = load i32, ptr %9, align 4, !tbaa !9
  %77 = icmp eq i32 %76, 0
  br i1 %77, label %78, label %79

78:                                               ; preds = %75
  br label %108

79:                                               ; preds = %75, %70
  %80 = load i32, ptr %8, align 4, !tbaa !9
  %81 = icmp eq i32 %80, 32
  br i1 %81, label %85, label %82

82:                                               ; preds = %79
  %83 = load i32, ptr %8, align 4, !tbaa !9
  %84 = icmp eq i32 %83, 10
  br i1 %84, label %85, label %89

85:                                               ; preds = %82, %79
  %86 = load i32, ptr %9, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [256 x i8], ptr %10, i64 0, i64 %87
  store i8 0, ptr %88, align 1, !tbaa !11
  store i32 2, ptr %7, align 4
  br label %111

89:                                               ; preds = %82
  %90 = load i32, ptr %8, align 4, !tbaa !9
  %91 = call i32 @isdigit(i32 noundef %90) #11
  %92 = icmp ne i32 %91, 0
  br i1 %92, label %98, label %93

93:                                               ; preds = %89
  %94 = load ptr, ptr @stderr, align 8, !tbaa !5
  %95 = load i32, ptr %8, align 4, !tbaa !9
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %94, ptr noundef @.str.51, i32 noundef %95, ptr noundef %96) #10
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %111

98:                                               ; preds = %89
  %99 = load i32, ptr %8, align 4, !tbaa !9
  %100 = trunc i32 %99 to i8
  %101 = load i32, ptr %9, align 4, !tbaa !9
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %9, align 4, !tbaa !9
  %103 = sext i32 %101 to i64
  %104 = getelementptr inbounds [256 x i8], ptr %10, i64 0, i64 %103
  store i8 %100, ptr %104, align 1, !tbaa !11
  br label %105

105:                                              ; preds = %98
  br label %106

106:                                              ; preds = %105
  br label %107

107:                                              ; preds = %106
  br label %108

108:                                              ; preds = %107, %78
  %109 = load i32, ptr %11, align 4, !tbaa !9
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %11, align 4, !tbaa !9
  br label %66, !llvm.loop !12

111:                                              ; preds = %93, %85, %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #10
  %112 = load i32, ptr %7, align 4
  switch i32 %112, label %400 [
    i32 2, label %113
  ]

113:                                              ; preds = %111
  %114 = load i32, ptr %9, align 4, !tbaa !9
  %115 = icmp eq i32 %114, 0
  br i1 %115, label %119, label %116

116:                                              ; preds = %113
  %117 = load i32, ptr %9, align 4, !tbaa !9
  %118 = icmp sgt i32 %117, 128
  br i1 %118, label %119, label %123

119:                                              ; preds = %116, %113
  %120 = load ptr, ptr @stderr, align 8, !tbaa !5
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %120, ptr noundef @.str.52, ptr noundef %121) #10
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %400

123:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #10
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 256, ptr %13) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #10
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %124

124:                                              ; preds = %166, %123
  %125 = load i32, ptr %14, align 4, !tbaa !9
  %126 = icmp slt i32 %125, 256
  br i1 %126, label %128, label %127

127:                                              ; preds = %124
  store i32 5, ptr %7, align 4
  br label %169

128:                                              ; preds = %124
  %129 = load ptr, ptr %6, align 8, !tbaa !5
  %130 = call i32 @fgetc(ptr noundef %129)
  store i32 %130, ptr %8, align 4, !tbaa !9
  %131 = load i32, ptr %8, align 4, !tbaa !9
  %132 = icmp eq i32 %131, 32
  br i1 %132, label %133, label %137

133:                                              ; preds = %128
  %134 = load i32, ptr %12, align 4, !tbaa !9
  %135 = icmp eq i32 %134, 0
  br i1 %135, label %136, label %137

136:                                              ; preds = %133
  br label %166

137:                                              ; preds = %133, %128
  %138 = load i32, ptr %8, align 4, !tbaa !9
  %139 = icmp eq i32 %138, 32
  br i1 %139, label %143, label %140

140:                                              ; preds = %137
  %141 = load i32, ptr %8, align 4, !tbaa !9
  %142 = icmp eq i32 %141, 10
  br i1 %142, label %143, label %147

143:                                              ; preds = %140, %137
  %144 = load i32, ptr %12, align 4, !tbaa !9
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [256 x i8], ptr %13, i64 0, i64 %145
  store i8 0, ptr %146, align 1, !tbaa !11
  store i32 5, ptr %7, align 4
  br label %169

147:                                              ; preds = %140
  %148 = load i32, ptr %8, align 4, !tbaa !9
  %149 = call i32 @isdigit(i32 noundef %148) #11
  %150 = icmp ne i32 %149, 0
  br i1 %150, label %156, label %151

151:                                              ; preds = %147
  %152 = load ptr, ptr @stderr, align 8, !tbaa !5
  %153 = load i32, ptr %8, align 4, !tbaa !9
  %154 = load ptr, ptr %5, align 8, !tbaa !5
  %155 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %152, ptr noundef @.str.53, i32 noundef %153, ptr noundef %154) #10
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %169

156:                                              ; preds = %147
  %157 = load i32, ptr %8, align 4, !tbaa !9
  %158 = trunc i32 %157 to i8
  %159 = load i32, ptr %12, align 4, !tbaa !9
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %12, align 4, !tbaa !9
  %161 = sext i32 %159 to i64
  %162 = getelementptr inbounds [256 x i8], ptr %13, i64 0, i64 %161
  store i8 %158, ptr %162, align 1, !tbaa !11
  br label %163

163:                                              ; preds = %156
  br label %164

164:                                              ; preds = %163
  br label %165

165:                                              ; preds = %164
  br label %166

166:                                              ; preds = %165, %136
  %167 = load i32, ptr %14, align 4, !tbaa !9
  %168 = add nsw i32 %167, 1
  store i32 %168, ptr %14, align 4, !tbaa !9
  br label %124, !llvm.loop !14

169:                                              ; preds = %151, %143, %127
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #10
  %170 = load i32, ptr %7, align 4
  switch i32 %170, label %399 [
    i32 5, label %171
  ]

171:                                              ; preds = %169
  %172 = load i32, ptr %12, align 4, !tbaa !9
  %173 = icmp eq i32 %172, 0
  br i1 %173, label %177, label %174

174:                                              ; preds = %171
  %175 = load i32, ptr %12, align 4, !tbaa !9
  %176 = icmp sgt i32 %175, 128
  br i1 %176, label %177, label %181

177:                                              ; preds = %174, %171
  %178 = load ptr, ptr @stderr, align 8, !tbaa !5
  %179 = load ptr, ptr %5, align 8, !tbaa !5
  %180 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %178, ptr noundef @.str.54, ptr noundef %179) #10
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %399

181:                                              ; preds = %174
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #10
  store i32 0, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 256, ptr %16) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #10
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %182

182:                                              ; preds = %228, %181
  %183 = load i32, ptr %17, align 4, !tbaa !9
  %184 = icmp slt i32 %183, 256
  br i1 %184, label %186, label %185

185:                                              ; preds = %182
  store i32 8, ptr %7, align 4
  br label %231

186:                                              ; preds = %182
  %187 = load ptr, ptr %6, align 8, !tbaa !5
  %188 = call i32 @fgetc(ptr noundef %187)
  store i32 %188, ptr %8, align 4, !tbaa !9
  %189 = load i32, ptr %8, align 4, !tbaa !9
  %190 = icmp eq i32 %189, 32
  br i1 %190, label %191, label %195

191:                                              ; preds = %186
  %192 = load i32, ptr %15, align 4, !tbaa !9
  %193 = icmp eq i32 %192, 0
  br i1 %193, label %194, label %195

194:                                              ; preds = %191
  br label %228

195:                                              ; preds = %191, %186
  %196 = load i32, ptr %8, align 4, !tbaa !9
  %197 = icmp eq i32 %196, 32
  br i1 %197, label %201, label %198

198:                                              ; preds = %195
  %199 = load i32, ptr %8, align 4, !tbaa !9
  %200 = icmp eq i32 %199, 10
  br i1 %200, label %201, label %205

201:                                              ; preds = %198, %195
  %202 = load i32, ptr %15, align 4, !tbaa !9
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [256 x i8], ptr %16, i64 0, i64 %203
  store i8 0, ptr %204, align 1, !tbaa !11
  store i32 8, ptr %7, align 4
  br label %231

205:                                              ; preds = %198
  br label %206

206:                                              ; preds = %205
  %207 = load i32, ptr %8, align 4, !tbaa !9
  %208 = call i32 @isdigit(i32 noundef %207) #11
  %209 = icmp ne i32 %208, 0
  br i1 %209, label %221, label %210

210:                                              ; preds = %206
  %211 = load i32, ptr %8, align 4, !tbaa !9
  %212 = icmp ne i32 %211, 46
  br i1 %212, label %213, label %221

213:                                              ; preds = %210
  %214 = load i32, ptr %8, align 4, !tbaa !9
  %215 = icmp ne i32 %214, 45
  br i1 %215, label %216, label %221

216:                                              ; preds = %213
  %217 = load ptr, ptr @stderr, align 8, !tbaa !5
  %218 = load i32, ptr %8, align 4, !tbaa !9
  %219 = load ptr, ptr %5, align 8, !tbaa !5
  %220 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %217, ptr noundef @.str.55, i32 noundef %218, ptr noundef %219) #10
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %231

221:                                              ; preds = %213, %210, %206
  %222 = load i32, ptr %8, align 4, !tbaa !9
  %223 = trunc i32 %222 to i8
  %224 = load i32, ptr %15, align 4, !tbaa !9
  %225 = add nsw i32 %224, 1
  store i32 %225, ptr %15, align 4, !tbaa !9
  %226 = sext i32 %224 to i64
  %227 = getelementptr inbounds [256 x i8], ptr %16, i64 0, i64 %226
  store i8 %223, ptr %227, align 1, !tbaa !11
  br label %228

228:                                              ; preds = %221, %194
  %229 = load i32, ptr %17, align 4, !tbaa !9
  %230 = add nsw i32 %229, 1
  store i32 %230, ptr %17, align 4, !tbaa !9
  br label %182, !llvm.loop !15

231:                                              ; preds = %216, %201, %185
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #10
  %232 = load i32, ptr %7, align 4
  switch i32 %232, label %398 [
    i32 8, label %233
  ]

233:                                              ; preds = %231
  %234 = load i32, ptr %15, align 4, !tbaa !9
  %235 = icmp eq i32 %234, 0
  br i1 %235, label %239, label %236

236:                                              ; preds = %233
  %237 = load i32, ptr %15, align 4, !tbaa !9
  %238 = icmp sgt i32 %237, 128
  br i1 %238, label %239, label %243

239:                                              ; preds = %236, %233
  %240 = load ptr, ptr @stderr, align 8, !tbaa !5
  %241 = load ptr, ptr %5, align 8, !tbaa !5
  %242 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %240, ptr noundef @.str.56, ptr noundef %241) #10
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %398

243:                                              ; preds = %236
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #10
  %244 = getelementptr inbounds [256 x i8], ptr %10, i64 0, i64 0
  %245 = call i32 @atoi(ptr noundef %244) #11
  store i32 %245, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #10
  %246 = getelementptr inbounds [256 x i8], ptr %13, i64 0, i64 0
  %247 = call i32 @atoi(ptr noundef %246) #11
  store i32 %247, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #10
  %248 = getelementptr inbounds [256 x i8], ptr %16, i64 0, i64 0
  %249 = call i32 @atoi(ptr noundef %248) #11
  store i32 %249, ptr %20, align 4, !tbaa !9
  %250 = load i32, ptr %18, align 4, !tbaa !9
  %251 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 4
  %252 = getelementptr inbounds [2 x i32], ptr %251, i64 0, i64 0
  store i32 %250, ptr %252, align 8, !tbaa !9
  %253 = load i32, ptr %19, align 4, !tbaa !9
  %254 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 4
  %255 = getelementptr inbounds [2 x i32], ptr %254, i64 0, i64 1
  store i32 %253, ptr %255, align 4, !tbaa !9
  %256 = load i32, ptr %18, align 4, !tbaa !9
  %257 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 5
  store i32 %256, ptr %257, align 8, !tbaa !16
  %258 = load i32, ptr %18, align 4, !tbaa !9
  %259 = load i32, ptr %19, align 4, !tbaa !9
  %260 = mul nsw i32 %258, %259
  %261 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 6
  store i32 %260, ptr %261, align 4, !tbaa !22
  %262 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 2
  store double 1.000000e+00, ptr %262, align 8, !tbaa !23
  %263 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 1
  %264 = call noundef nonnull align 8 dereferenceable(84) ptr @_ZN8R2AffineaSERKS_(ptr noundef nonnull align 8 dereferenceable(84) %263, ptr noundef nonnull align 8 dereferenceable(84) @R2identity_affine)
  %265 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 0
  %266 = call noundef nonnull align 8 dereferenceable(84) ptr @_ZN8R2AffineaSERKS_(ptr noundef nonnull align 8 dereferenceable(84) %265, ptr noundef nonnull align 8 dereferenceable(84) @R2identity_affine)
  %267 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 3
  %268 = load ptr, ptr %267, align 8, !tbaa !24
  %269 = icmp ne ptr %268, null
  br i1 %269, label %270, label %276

270:                                              ; preds = %243
  %271 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 3
  %272 = load ptr, ptr %271, align 8, !tbaa !24
  %273 = icmp eq ptr %272, null
  br i1 %273, label %275, label %274

274:                                              ; preds = %270
  call void @_ZdaPv(ptr noundef %272) #12
  br label %275

275:                                              ; preds = %274, %270
  br label %276

276:                                              ; preds = %275, %243
  %277 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 6
  %278 = load i32, ptr %277, align 4, !tbaa !22
  %279 = sext i32 %278 to i64
  %280 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %279, i64 8)
  %281 = extractvalue { i64, i1 } %280, 1
  %282 = extractvalue { i64, i1 } %280, 0
  %283 = select i1 %281, i64 -1, i64 %282
  %284 = call noalias noundef nonnull ptr @_Znam(i64 noundef %283) #13
  %285 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 3
  store ptr %284, ptr %285, align 8, !tbaa !24
  %286 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 3
  %287 = load ptr, ptr %286, align 8, !tbaa !24
  %288 = icmp ne ptr %287, null
  br i1 %288, label %295, label %289

289:                                              ; preds = %276
  %290 = load ptr, ptr @stderr, align 8, !tbaa !5
  %291 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 6
  %292 = load i32, ptr %291, align 4, !tbaa !22
  %293 = load ptr, ptr %5, align 8, !tbaa !5
  %294 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %290, ptr noundef @.str.57, i32 noundef %292, ptr noundef %293) #10
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %397

295:                                              ; preds = %276
  call void @llvm.lifetime.start.p0(i64 2, ptr %21) #10
  store i16 1, ptr %21, align 2, !tbaa !25
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #10
  %296 = load i8, ptr %21, align 2, !tbaa !11
  %297 = zext i8 %296 to i32
  %298 = icmp eq i32 %297, 0
  %299 = zext i1 %298 to i64
  %300 = select i1 %298, i32 0, i32 1
  store i32 %300, ptr %22, align 4, !tbaa !9
  %301 = load i32, ptr %22, align 4, !tbaa !9
  %302 = call i32 (ptr, ...) @printf(ptr noundef @.str.58, i32 noundef %301)
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #10
  store i32 0, ptr %23, align 4, !tbaa !9
  br label %303

303:                                              ; preds = %386, %295
  %304 = load i32, ptr %23, align 4, !tbaa !9
  %305 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 6
  %306 = load i32, ptr %305, align 4, !tbaa !22
  %307 = icmp slt i32 %304, %306
  br i1 %307, label %309, label %308

308:                                              ; preds = %303
  store i32 11, ptr %7, align 4
  br label %389

309:                                              ; preds = %303
  %310 = load i32, ptr %20, align 4, !tbaa !9
  %311 = icmp ule i32 %310, 255
  br i1 %311, label %312, label %322

312:                                              ; preds = %309
  call void @llvm.lifetime.start.p0(i64 1, ptr %24) #10
  %313 = load ptr, ptr %6, align 8, !tbaa !5
  %314 = call i64 @fread(ptr noundef %24, i64 noundef 1, i64 noundef 1, ptr noundef %313)
  %315 = load i8, ptr %24, align 1, !tbaa !11
  %316 = uitofp i8 %315 to double
  %317 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 3
  %318 = load ptr, ptr %317, align 8, !tbaa !24
  %319 = load i32, ptr %23, align 4, !tbaa !9
  %320 = sext i32 %319 to i64
  %321 = getelementptr inbounds double, ptr %318, i64 %320
  store double %316, ptr %321, align 8, !tbaa !27
  call void @llvm.lifetime.end.p0(i64 1, ptr %24) #10
  br label %385

322:                                              ; preds = %309
  %323 = load i32, ptr %20, align 4, !tbaa !9
  %324 = icmp ule i32 %323, 65535
  br i1 %324, label %325, label %348

325:                                              ; preds = %322
  call void @llvm.lifetime.start.p0(i64 2, ptr %25) #10
  %326 = load ptr, ptr %6, align 8, !tbaa !5
  %327 = call i64 @fread(ptr noundef %25, i64 noundef 2, i64 noundef 1, ptr noundef %326)
  %328 = load i32, ptr %22, align 4, !tbaa !9
  %329 = icmp ne i32 %328, 0
  br i1 %329, label %330, label %340

330:                                              ; preds = %325
  call void @llvm.lifetime.start.p0(i64 2, ptr %26) #10
  %331 = load i16, ptr %25, align 2, !tbaa !25
  store i16 %331, ptr %26, align 2, !tbaa !25
  %332 = load i16, ptr %26, align 2, !tbaa !25
  %333 = zext i16 %332 to i32
  %334 = shl i32 %333, 8
  %335 = load i16, ptr %26, align 2, !tbaa !25
  %336 = zext i16 %335 to i32
  %337 = ashr i32 %336, 8
  %338 = or i32 %334, %337
  %339 = trunc i32 %338 to i16
  store i16 %339, ptr %25, align 2, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 2, ptr %26) #10
  br label %340

340:                                              ; preds = %330, %325
  %341 = load i16, ptr %25, align 2, !tbaa !25
  %342 = uitofp i16 %341 to double
  %343 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 3
  %344 = load ptr, ptr %343, align 8, !tbaa !24
  %345 = load i32, ptr %23, align 4, !tbaa !9
  %346 = sext i32 %345 to i64
  %347 = getelementptr inbounds double, ptr %344, i64 %346
  store double %342, ptr %347, align 8, !tbaa !27
  call void @llvm.lifetime.end.p0(i64 2, ptr %25) #10
  br label %384

348:                                              ; preds = %322
  %349 = load i32, ptr %20, align 4, !tbaa !9
  %350 = icmp ule i32 %349, -1
  br i1 %350, label %351, label %379

351:                                              ; preds = %348
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #10
  %352 = load ptr, ptr %6, align 8, !tbaa !5
  %353 = call i64 @fread(ptr noundef %27, i64 noundef 4, i64 noundef 1, ptr noundef %352)
  %354 = load i32, ptr %22, align 4, !tbaa !9
  %355 = icmp ne i32 %354, 0
  br i1 %355, label %356, label %371

356:                                              ; preds = %351
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #10
  %357 = load i32, ptr %27, align 4, !tbaa !9
  store i32 %357, ptr %28, align 4, !tbaa !9
  %358 = load i32, ptr %28, align 4, !tbaa !9
  %359 = shl i32 %358, 24
  %360 = load i32, ptr %28, align 4, !tbaa !9
  %361 = shl i32 %360, 8
  %362 = and i32 %361, 16711680
  %363 = or i32 %359, %362
  %364 = load i32, ptr %28, align 4, !tbaa !9
  %365 = lshr i32 %364, 8
  %366 = and i32 %365, 65280
  %367 = or i32 %363, %366
  %368 = load i32, ptr %28, align 4, !tbaa !9
  %369 = lshr i32 %368, 24
  %370 = or i32 %367, %369
  store i32 %370, ptr %27, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #10
  br label %371

371:                                              ; preds = %356, %351
  %372 = load i32, ptr %27, align 4, !tbaa !9
  %373 = uitofp i32 %372 to double
  %374 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 3
  %375 = load ptr, ptr %374, align 8, !tbaa !24
  %376 = load i32, ptr %23, align 4, !tbaa !9
  %377 = sext i32 %376 to i64
  %378 = getelementptr inbounds double, ptr %375, i64 %377
  store double %373, ptr %378, align 8, !tbaa !27
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #10
  br label %383

379:                                              ; preds = %348
  %380 = load ptr, ptr @stderr, align 8, !tbaa !5
  %381 = load ptr, ptr %5, align 8, !tbaa !5
  %382 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %380, ptr noundef @.str.59, ptr noundef %381) #10
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %389

383:                                              ; preds = %371
  br label %384

384:                                              ; preds = %383, %340
  br label %385

385:                                              ; preds = %384, %312
  br label %386

386:                                              ; preds = %385
  %387 = load i32, ptr %23, align 4, !tbaa !9
  %388 = add nsw i32 %387, 1
  store i32 %388, ptr %23, align 4, !tbaa !9
  br label %303, !llvm.loop !28

389:                                              ; preds = %379, %308
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #10
  %390 = load i32, ptr %7, align 4
  switch i32 %390, label %396 [
    i32 11, label %391
  ]

391:                                              ; preds = %389
  %392 = load ptr, ptr %6, align 8, !tbaa !5
  %393 = call i32 @fclose(ptr noundef %392)
  %394 = getelementptr inbounds %class.R2Grid, ptr %29, i32 0, i32 6
  %395 = load i32, ptr %394, align 4, !tbaa !22
  store i32 %395, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %396

396:                                              ; preds = %391, %389
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #10
  call void @llvm.lifetime.end.p0(i64 2, ptr %21) #10
  br label %397

397:                                              ; preds = %396, %289
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #10
  br label %398

398:                                              ; preds = %397, %239, %231
  call void @llvm.lifetime.end.p0(i64 256, ptr %16) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #10
  br label %399

399:                                              ; preds = %398, %177, %169
  call void @llvm.lifetime.end.p0(i64 256, ptr %13) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #10
  br label %400

400:                                              ; preds = %399, %119, %111
  call void @llvm.lifetime.end.p0(i64 256, ptr %10) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #10
  br label %401

401:                                              ; preds = %400, %61, %52, %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #10
  br label %402

402:                                              ; preds = %401, %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #10
  %403 = load i32, ptr %3, align 4
  ret i32 %403
}

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

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

declare i32 @fclose(ptr noundef) #7

declare i32 @fgetc(ptr noundef) #7

; Function Attrs: nounwind willreturn memory(read)
declare i32 @isdigit(i32 noundef) #8

; Function Attrs: inlinehint mustprogress nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #9

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

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nobuiltin 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress 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 #4 = { nobuiltin 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 "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 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 #7 = { "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 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 #9 = { inlinehint mustprogress nounwind willreturn memory(read) 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 #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(read) }
attributes #12 = { builtin nounwind }
attributes #13 = { builtin 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = !{!17, !10, i64 200}
!17 = !{!"_ZTS6R2Grid", !18, i64 0, !18, i64 88, !21, i64 176, !6, i64 184, !7, i64 192, !10, i64 200, !10, i64 204}
!18 = !{!"_ZTS8R2Affine", !19, i64 0, !20, i64 8, !10, i64 80}
!19 = !{!"_ZTS16R2Transformation"}
!20 = !{!"_ZTS8R3Matrix", !7, i64 0}
!21 = !{!"double", !7, i64 0}
!22 = !{!17, !10, i64 204}
!23 = !{!17, !21, i64 176}
!24 = !{!17, !6, i64 184}
!25 = !{!26, !26, i64 0}
!26 = !{!"short", !7, i64 0}
!27 = !{!21, !21, i64 0}
!28 = distinct !{!28, !13}


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

%class.R2Affine = type <{ %class.R2Transformation, %class.R3Matrix, i32, [4 x i8] }>
%class.R2Transformation = type { ptr }
%class.R3Matrix = type { [3 x [3 x double]] }

@R2identity_affine = external global %class.R2Affine, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.40 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #0

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(84) ptr @_ZN8R2AffineaSERKS_(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef nonnull align 8 dereferenceable(84)) local_unnamed_addr #2 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN6R2Grid11ReadPNMFileEPKc(ptr noundef nonnull align 8 dereferenceable(208) %0, ptr noundef %1) local_unnamed_addr #5 align 2 {
  %3 = alloca [256 x i8], align 16
  %4 = alloca [256 x i8], align 16
  %5 = alloca [256 x i8], align 16
  %6 = alloca i8, align 1
  %7 = alloca i16, align 2
  %8 = alloca i32, align 4
  %9 = tail call noalias ptr @fopen(ptr noundef %1, ptr noundef nonnull @.str.40)
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %10, label %13

10:                                               ; preds = %2
  %11 = load ptr, ptr @stderr, align 8, !tbaa !5
  %12 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef nonnull @.str.49, ptr noundef %1) #8
  br label %165

13:                                               ; preds = %2
  %14 = tail call i32 @fgetc(ptr noundef nonnull %9)
  %.not138 = icmp eq i32 %14, 80
  br i1 %.not138, label %18, label %15

15:                                               ; preds = %13
  %16 = load ptr, ptr @stderr, align 8, !tbaa !5
  %17 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef nonnull @.str.50, ptr noundef %1) #8
  br label %165

18:                                               ; preds = %13
  %19 = tail call i32 @fgetc(ptr noundef nonnull %9)
  %.not139 = icmp eq i32 %19, 53
  br i1 %.not139, label %23, label %20

20:                                               ; preds = %18
  %21 = load ptr, ptr @stderr, align 8, !tbaa !5
  %22 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef nonnull @.str.50, ptr noundef %1) #8
  br label %165

23:                                               ; preds = %18
  %24 = tail call i32 @fgetc(ptr noundef nonnull %9)
  %.not140 = icmp eq i32 %24, 10
  br i1 %.not140, label %28, label %25

25:                                               ; preds = %23
  %26 = load ptr, ptr @stderr, align 8, !tbaa !5
  %27 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef nonnull @.str.50, ptr noundef %1) #8
  br label %165

28:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %3) #9
  br label %29

29:                                               ; preds = %28, %46
  %.0124163 = phi i32 [ 0, %28 ], [ %.1125, %46 ]
  %.0126162 = phi i32 [ 0, %28 ], [ %47, %46 ]
  %30 = tail call i32 @fgetc(ptr noundef nonnull %9)
  %31 = icmp eq i32 %30, 32
  %32 = icmp eq i32 %.0124163, 0
  %or.cond = select i1 %31, i1 %32, i1 false
  br i1 %or.cond, label %46, label %33

33:                                               ; preds = %29
  switch i32 %30, label %37 [
    i32 32, label %34
    i32 10, label %34
  ]

34:                                               ; preds = %33, %33
  %35 = sext i32 %.0124163 to i64
  %36 = getelementptr inbounds [256 x i8], ptr %3, i64 0, i64 %35
  store i8 0, ptr %36, align 1, !tbaa !9
  br label %.critedge

37:                                               ; preds = %33
  %isdigittmp = add i32 %30, -48
  %isdigit = icmp ult i32 %isdigittmp, 10
  br i1 %isdigit, label %41, label %38

38:                                               ; preds = %37
  %39 = load ptr, ptr @stderr, align 8, !tbaa !5
  %40 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef nonnull @.str.51, i32 noundef %30, ptr noundef %1) #8
  br label %164

41:                                               ; preds = %37
  %42 = trunc nuw i32 %30 to i8
  %43 = add nsw i32 %.0124163, 1
  %44 = sext i32 %.0124163 to i64
  %45 = getelementptr inbounds [256 x i8], ptr %3, i64 0, i64 %44
  store i8 %42, ptr %45, align 1, !tbaa !9
  br label %46

46:                                               ; preds = %29, %41
  %.1125 = phi i32 [ 0, %29 ], [ %43, %41 ]
  %47 = add nuw nsw i32 %.0126162, 1
  %exitcond.not = icmp eq i32 %47, 256
  br i1 %exitcond.not, label %.critedge, label %29, !llvm.loop !10

.critedge:                                        ; preds = %46, %34
  %.0124160 = phi i32 [ %.0124163, %34 ], [ %.1125, %46 ]
  %48 = icmp eq i32 %.0124160, 0
  %49 = icmp sgt i32 %.0124160, 128
  %or.cond8 = or i1 %48, %49
  br i1 %or.cond8, label %50, label %53

50:                                               ; preds = %.critedge
  %51 = load ptr, ptr @stderr, align 8, !tbaa !5
  %52 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %51, ptr noundef nonnull @.str.52, ptr noundef %1) #8
  br label %164

53:                                               ; preds = %.critedge
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %4) #9
  br label %54

54:                                               ; preds = %53, %71
  %.0127165 = phi i32 [ 0, %53 ], [ %.1128, %71 ]
  %.0129164 = phi i32 [ 0, %53 ], [ %72, %71 ]
  %55 = tail call i32 @fgetc(ptr noundef nonnull %9)
  %56 = icmp eq i32 %55, 32
  %57 = icmp eq i32 %.0127165, 0
  %or.cond10 = select i1 %56, i1 %57, i1 false
  br i1 %or.cond10, label %71, label %58

58:                                               ; preds = %54
  switch i32 %55, label %62 [
    i32 32, label %59
    i32 10, label %59
  ]

59:                                               ; preds = %58, %58
  %60 = sext i32 %.0127165 to i64
  %61 = getelementptr inbounds [256 x i8], ptr %4, i64 0, i64 %60
  store i8 0, ptr %61, align 1, !tbaa !9
  br label %.critedge147

62:                                               ; preds = %58
  %isdigittmp141 = add i32 %55, -48
  %isdigit142 = icmp ult i32 %isdigittmp141, 10
  br i1 %isdigit142, label %66, label %63

63:                                               ; preds = %62
  %64 = load ptr, ptr @stderr, align 8, !tbaa !5
  %65 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %64, ptr noundef nonnull @.str.53, i32 noundef %55, ptr noundef %1) #8
  br label %163

66:                                               ; preds = %62
  %67 = trunc nuw i32 %55 to i8
  %68 = add nsw i32 %.0127165, 1
  %69 = sext i32 %.0127165 to i64
  %70 = getelementptr inbounds [256 x i8], ptr %4, i64 0, i64 %69
  store i8 %67, ptr %70, align 1, !tbaa !9
  br label %71

71:                                               ; preds = %54, %66
  %.1128 = phi i32 [ 0, %54 ], [ %68, %66 ]
  %72 = add nuw nsw i32 %.0129164, 1
  %exitcond184.not = icmp eq i32 %72, 256
  br i1 %exitcond184.not, label %.critedge147, label %54, !llvm.loop !12

.critedge147:                                     ; preds = %71, %59
  %.0127156 = phi i32 [ %.0127165, %59 ], [ %.1128, %71 ]
  %73 = icmp eq i32 %.0127156, 0
  %74 = icmp sgt i32 %.0127156, 128
  %or.cond14 = or i1 %73, %74
  br i1 %or.cond14, label %75, label %78

75:                                               ; preds = %.critedge147
  %76 = load ptr, ptr @stderr, align 8, !tbaa !5
  %77 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %76, ptr noundef nonnull @.str.54, ptr noundef %1) #8
  br label %163

78:                                               ; preds = %.critedge147
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %5) #9
  br label %79

79:                                               ; preds = %78, %99
  %.0130167 = phi i32 [ 0, %78 ], [ %.1131, %99 ]
  %.0132166 = phi i32 [ 0, %78 ], [ %100, %99 ]
  %80 = tail call i32 @fgetc(ptr noundef nonnull %9)
  %81 = icmp eq i32 %80, 32
  %82 = icmp eq i32 %.0130167, 0
  %or.cond16 = select i1 %81, i1 %82, i1 false
  br i1 %or.cond16, label %99, label %83

83:                                               ; preds = %79
  switch i32 %80, label %87 [
    i32 32, label %84
    i32 10, label %84
  ]

84:                                               ; preds = %83, %83
  %85 = sext i32 %.0130167 to i64
  %86 = getelementptr inbounds [256 x i8], ptr %5, i64 0, i64 %85
  store i8 0, ptr %86, align 1, !tbaa !9
  br label %.critedge149

87:                                               ; preds = %83
  %88 = add i32 %80, -58
  %isdigit144 = icmp ult i32 %88, -10
  %89 = add i32 %80, -47
  %90 = icmp ult i32 %89, -2
  %or.cond22 = and i1 %isdigit144, %90
  br i1 %or.cond22, label %91, label %94

91:                                               ; preds = %87
  %92 = load ptr, ptr @stderr, align 8, !tbaa !5
  %93 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %92, ptr noundef nonnull @.str.55, i32 noundef %80, ptr noundef %1) #8
  br label %162

94:                                               ; preds = %87
  %95 = trunc nuw i32 %80 to i8
  %96 = add nsw i32 %.0130167, 1
  %97 = sext i32 %.0130167 to i64
  %98 = getelementptr inbounds [256 x i8], ptr %5, i64 0, i64 %97
  store i8 %95, ptr %98, align 1, !tbaa !9
  br label %99

99:                                               ; preds = %79, %94
  %.1131 = phi i32 [ 0, %79 ], [ %96, %94 ]
  %100 = add nuw nsw i32 %.0132166, 1
  %exitcond185.not = icmp eq i32 %100, 256
  br i1 %exitcond185.not, label %.critedge149, label %79, !llvm.loop !13

.critedge149:                                     ; preds = %99, %84
  %.0130152 = phi i32 [ %.0130167, %84 ], [ %.1131, %99 ]
  %101 = icmp eq i32 %.0130152, 0
  %102 = icmp sgt i32 %.0130152, 128
  %or.cond24 = or i1 %101, %102
  br i1 %or.cond24, label %103, label %106

103:                                              ; preds = %.critedge149
  %104 = load ptr, ptr @stderr, align 8, !tbaa !5
  %105 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %104, ptr noundef nonnull @.str.56, ptr noundef %1) #8
  br label %162

106:                                              ; preds = %.critedge149
  %107 = call i32 @atoi(ptr nocapture noundef %3) #10
  %108 = call i32 @atoi(ptr nocapture noundef %4) #10
  %109 = call i32 @atoi(ptr nocapture noundef %5) #10
  %110 = getelementptr inbounds i8, ptr %0, i64 192
  store i32 %107, ptr %110, align 8, !tbaa !14
  %111 = getelementptr inbounds i8, ptr %0, i64 196
  store i32 %108, ptr %111, align 4, !tbaa !14
  %112 = getelementptr inbounds i8, ptr %0, i64 200
  store i32 %107, ptr %112, align 8, !tbaa !16
  %113 = mul nsw i32 %108, %107
  %114 = getelementptr inbounds i8, ptr %0, i64 204
  store i32 %113, ptr %114, align 4, !tbaa !22
  %115 = getelementptr inbounds i8, ptr %0, i64 176
  store double 1.000000e+00, ptr %115, align 8, !tbaa !23
  %116 = getelementptr inbounds i8, ptr %0, i64 88
  %117 = tail call noundef nonnull align 8 dereferenceable(84) ptr @_ZN8R2AffineaSERKS_(ptr noundef nonnull align 8 dereferenceable(84) %116, ptr noundef nonnull align 8 dereferenceable(84) @R2identity_affine)
  %118 = tail call noundef nonnull align 8 dereferenceable(84) ptr @_ZN8R2AffineaSERKS_(ptr noundef nonnull align 8 dereferenceable(84) %0, ptr noundef nonnull align 8 dereferenceable(84) @R2identity_affine)
  %119 = getelementptr inbounds i8, ptr %0, i64 184
  %120 = load ptr, ptr %119, align 8, !tbaa !24
  %.not145 = icmp eq ptr %120, null
  br i1 %.not145, label %122, label %121

121:                                              ; preds = %106
  tail call void @_ZdaPv(ptr noundef nonnull %120) #11
  br label %122

122:                                              ; preds = %121, %106
  %123 = load i32, ptr %114, align 4, !tbaa !22
  %124 = sext i32 %123 to i64
  %125 = icmp slt i32 %123, 0
  %126 = shl nsw i64 %124, 3
  %127 = select i1 %125, i64 -1, i64 %126
  %128 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %127) #12
  store ptr %128, ptr %119, align 8, !tbaa !24
  %129 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.58, i32 noundef 1)
  %130 = load i32, ptr %114, align 4, !tbaa !22
  %131 = icmp sgt i32 %130, 0
  br i1 %131, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %122
  %132 = icmp ult i32 %109, 256
  br i1 %132, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %.lr.ph.split.us
  %indvars.iv190 = phi i64 [ %indvars.iv.next191, %.lr.ph.split.us ], [ 0, %.lr.ph ]
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #9
  %133 = call i64 @fread(ptr noundef nonnull %6, i64 noundef 1, i64 noundef 1, ptr noundef nonnull %9)
  %134 = load i8, ptr %6, align 1, !tbaa !9
  %135 = uitofp i8 %134 to double
  %136 = load ptr, ptr %119, align 8, !tbaa !24
  %137 = getelementptr inbounds double, ptr %136, i64 %indvars.iv190
  store double %135, ptr %137, align 8, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #9
  %indvars.iv.next191 = add nuw nsw i64 %indvars.iv190, 1
  %138 = load i32, ptr %114, align 4, !tbaa !22
  %139 = sext i32 %138 to i64
  %140 = icmp slt i64 %indvars.iv.next191, %139
  br i1 %140, label %.lr.ph.split.us, label %._crit_edge, !llvm.loop !26

.lr.ph.split:                                     ; preds = %.lr.ph
  %141 = icmp ult i32 %109, 65536
  br i1 %141, label %.lr.ph.split.split.us, label %.lr.ph.split.split

.lr.ph.split.split.us:                            ; preds = %.lr.ph.split, %.lr.ph.split.split.us
  %indvars.iv187 = phi i64 [ %indvars.iv.next188, %.lr.ph.split.split.us ], [ 0, %.lr.ph.split ]
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %7) #9
  %142 = call i64 @fread(ptr noundef nonnull %7, i64 noundef 2, i64 noundef 1, ptr noundef nonnull %9)
  %143 = load i16, ptr %7, align 2, !tbaa !27
  %144 = tail call i16 @llvm.bswap.i16(i16 %143)
  %145 = uitofp i16 %144 to double
  %146 = load ptr, ptr %119, align 8, !tbaa !24
  %147 = getelementptr inbounds double, ptr %146, i64 %indvars.iv187
  store double %145, ptr %147, align 8, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %7) #9
  %indvars.iv.next188 = add nuw nsw i64 %indvars.iv187, 1
  %148 = load i32, ptr %114, align 4, !tbaa !22
  %149 = sext i32 %148 to i64
  %150 = icmp slt i64 %indvars.iv.next188, %149
  br i1 %150, label %.lr.ph.split.split.us, label %._crit_edge, !llvm.loop !26

.lr.ph.split.split:                               ; preds = %.lr.ph.split, %.lr.ph.split.split
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph.split.split ], [ 0, %.lr.ph.split ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #9
  %151 = call i64 @fread(ptr noundef nonnull %8, i64 noundef 4, i64 noundef 1, ptr noundef nonnull %9)
  %152 = load i32, ptr %8, align 4, !tbaa !14
  %153 = tail call i32 @llvm.bswap.i32(i32 %152)
  %154 = uitofp i32 %153 to double
  %155 = load ptr, ptr %119, align 8, !tbaa !24
  %156 = getelementptr inbounds double, ptr %155, i64 %indvars.iv
  store double %154, ptr %156, align 8, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %157 = load i32, ptr %114, align 4, !tbaa !22
  %158 = sext i32 %157 to i64
  %159 = icmp slt i64 %indvars.iv.next, %158
  br i1 %159, label %.lr.ph.split.split, label %._crit_edge, !llvm.loop !26

._crit_edge:                                      ; preds = %.lr.ph.split.split, %.lr.ph.split.split.us, %.lr.ph.split.us, %122
  %160 = tail call i32 @fclose(ptr noundef nonnull %9)
  %161 = load i32, ptr %114, align 4, !tbaa !22
  br label %162

162:                                              ; preds = %91, %._crit_edge, %103
  %.6 = phi i32 [ 0, %103 ], [ %161, %._crit_edge ], [ 0, %91 ]
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %5) #9
  br label %163

163:                                              ; preds = %63, %162, %75
  %.7 = phi i32 [ 0, %75 ], [ %.6, %162 ], [ 0, %63 ]
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %4) #9
  br label %164

164:                                              ; preds = %38, %163, %50
  %.8 = phi i32 [ 0, %50 ], [ %.7, %163 ], [ 0, %38 ]
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %3) #9
  br label %165

165:                                              ; preds = %15, %20, %25, %164, %10
  %.10 = phi i32 [ 0, %10 ], [ 0, %15 ], [ 0, %20 ], [ 0, %25 ], [ %.8, %164 ]
  ret i32 %.10
}

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

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

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

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #6

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i16 @llvm.bswap.i16(i16) #7

attributes #0 = { nobuiltin 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress 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 #3 = { nobuiltin 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 = { 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 #5 = { mustprogress 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 #6 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { cold nounwind }
attributes #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { builtin nounwind }
attributes #12 = { builtin 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++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!17, !15, i64 200}
!17 = !{!"_ZTS6R2Grid", !18, i64 0, !18, i64 88, !21, i64 176, !6, i64 184, !7, i64 192, !15, i64 200, !15, i64 204}
!18 = !{!"_ZTS8R2Affine", !19, i64 0, !20, i64 8, !15, i64 80}
!19 = !{!"_ZTS16R2Transformation"}
!20 = !{!"_ZTS8R3Matrix", !7, i64 0}
!21 = !{!"double", !7, i64 0}
!22 = !{!17, !15, i64 204}
!23 = !{!17, !21, i64 176}
!24 = !{!17, !6, i64 184}
!25 = !{!21, !21, i64 0}
!26 = distinct !{!26, !11}
!27 = !{!28, !28, i64 0}
!28 = !{!"short", !7, i64 0}


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