; LLVM IR from corentinartaud/graphics :: ThirdParty/FreeImage-3170/Source/LibJPEG (wrjpgcom)

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

@progname = external hidden global ptr, align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stderr = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [3 x i8], align 1
@infile = external hidden global ptr, align 8
@stdin = external global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [25 x i8], align 1
@stdout = external global ptr, align 8
@outfile = external hidden global ptr, align 8
@.str.12 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 1, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store ptr null, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store ptr null, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %15 = load ptr, ptr %5, align 8, !tbaa !9
  %16 = getelementptr inbounds ptr, ptr %15, i64 0
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  store ptr %17, ptr @progname, align 8, !tbaa !9
  %18 = load ptr, ptr @progname, align 8, !tbaa !9
  %19 = icmp eq ptr %18, null
  br i1 %19, label %26, label %20

20:                                               ; preds = %2
  %21 = load ptr, ptr @progname, align 8, !tbaa !9
  %22 = getelementptr inbounds i8, ptr %21, i64 0
  %23 = load i8, ptr %22, align 1, !tbaa !11
  %24 = sext i8 %23 to i32
  %25 = icmp eq i32 %24, 0
  br i1 %25, label %26, label %27

26:                                               ; preds = %20, %2
  store ptr @.str, ptr @progname, align 8, !tbaa !9
  br label %27

27:                                               ; preds = %26, %20
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %164, %27
  %29 = load i32, ptr %6, align 4, !tbaa !5
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %32, label %167

32:                                               ; preds = %28
  %33 = load ptr, ptr %5, align 8, !tbaa !9
  %34 = load i32, ptr %6, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds ptr, ptr %33, i64 %35
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  store ptr %37, ptr %7, align 8, !tbaa !9
  %38 = load ptr, ptr %7, align 8, !tbaa !9
  %39 = getelementptr inbounds i8, ptr %38, i64 0
  %40 = load i8, ptr %39, align 1, !tbaa !11
  %41 = sext i8 %40 to i32
  %42 = icmp ne i32 %41, 45
  br i1 %42, label %43, label %44

43:                                               ; preds = %32
  br label %167

44:                                               ; preds = %32
  %45 = load ptr, ptr %7, align 8, !tbaa !9
  %46 = getelementptr inbounds i8, ptr %45, i32 1
  store ptr %46, ptr %7, align 8, !tbaa !9
  %47 = load ptr, ptr %7, align 8, !tbaa !9
  %48 = call i32 @keymatch(ptr noundef %47, ptr noundef @.str.1, i32 noundef 1)
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %51

50:                                               ; preds = %44
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %163

51:                                               ; preds = %44
  %52 = load ptr, ptr %7, align 8, !tbaa !9
  %53 = call i32 @keymatch(ptr noundef %52, ptr noundef @.str.2, i32 noundef 2)
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %79

55:                                               ; preds = %51
  %56 = load i32, ptr %6, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %6, align 4, !tbaa !5
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = icmp sge i32 %57, %58
  br i1 %59, label %60, label %61

60:                                               ; preds = %55
  call void @usage()
  br label %61

61:                                               ; preds = %60, %55
  %62 = load ptr, ptr %5, align 8, !tbaa !9
  %63 = load i32, ptr %6, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds ptr, ptr %62, i64 %64
  %66 = load ptr, ptr %65, align 8, !tbaa !9
  %67 = call noalias ptr @fopen(ptr noundef %66, ptr noundef @.str.3)
  store ptr %67, ptr %10, align 8, !tbaa !9
  %68 = icmp eq ptr %67, null
  br i1 %68, label %69, label %78

69:                                               ; preds = %61
  %70 = load ptr, ptr @stderr, align 8, !tbaa !9
  %71 = load ptr, ptr @progname, align 8, !tbaa !9
  %72 = load ptr, ptr %5, align 8, !tbaa !9
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds ptr, ptr %72, i64 %74
  %76 = load ptr, ptr %75, align 8, !tbaa !9
  %77 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %70, ptr noundef @.str.4, ptr noundef %71, ptr noundef %76) #7
  call void @exit(i32 noundef 1) #8
  unreachable

78:                                               ; preds = %61
  br label %162

79:                                               ; preds = %51
  %80 = load ptr, ptr %7, align 8, !tbaa !9
  %81 = call i32 @keymatch(ptr noundef %80, ptr noundef @.str.5, i32 noundef 1)
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %83, label %160

83:                                               ; preds = %79
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %6, align 4, !tbaa !5
  %86 = load i32, ptr %4, align 4, !tbaa !5
  %87 = icmp sge i32 %85, %86
  br i1 %87, label %88, label %89

88:                                               ; preds = %83
  call void @usage()
  br label %89

89:                                               ; preds = %88, %83
  %90 = load ptr, ptr %5, align 8, !tbaa !9
  %91 = load i32, ptr %6, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds ptr, ptr %90, i64 %92
  %94 = load ptr, ptr %93, align 8, !tbaa !9
  store ptr %94, ptr %9, align 8, !tbaa !9
  %95 = load ptr, ptr %9, align 8, !tbaa !9
  %96 = getelementptr inbounds i8, ptr %95, i64 0
  %97 = load i8, ptr %96, align 1, !tbaa !11
  %98 = sext i8 %97 to i32
  %99 = icmp eq i32 %98, 34
  br i1 %99, label %100, label %156

100:                                              ; preds = %89
  %101 = call noalias ptr @malloc(i64 noundef 65000) #9
  store ptr %101, ptr %9, align 8, !tbaa !9
  %102 = load ptr, ptr %9, align 8, !tbaa !9
  %103 = icmp eq ptr %102, null
  br i1 %103, label %104, label %107

104:                                              ; preds = %100
  %105 = load ptr, ptr @stderr, align 8, !tbaa !9
  %106 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %105, ptr noundef @.str.6, ptr noundef @.str.7) #7
  call void @exit(i32 noundef 1) #8
  unreachable

107:                                              ; preds = %100
  %108 = load ptr, ptr %9, align 8, !tbaa !9
  %109 = load ptr, ptr %5, align 8, !tbaa !9
  %110 = load i32, ptr %6, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds ptr, ptr %109, i64 %111
  %113 = load ptr, ptr %112, align 8, !tbaa !9
  %114 = getelementptr inbounds i8, ptr %113, i64 1
  %115 = call ptr @strcpy(ptr noundef %108, ptr noundef %114) #7
  br label %116

116:                                              ; preds = %145, %107
  %117 = load ptr, ptr %9, align 8, !tbaa !9
  %118 = call i64 @strlen(ptr noundef %117) #10
  %119 = trunc i64 %118 to i32
  store i32 %119, ptr %11, align 4, !tbaa !5
  %120 = load i32, ptr %11, align 4, !tbaa !5
  %121 = icmp ugt i32 %120, 0
  br i1 %121, label %122, label %137

122:                                              ; preds = %116
  %123 = load ptr, ptr %9, align 8, !tbaa !9
  %124 = load i32, ptr %11, align 4, !tbaa !5
  %125 = sub i32 %124, 1
  %126 = zext i32 %125 to i64
  %127 = getelementptr inbounds i8, ptr %123, i64 %126
  %128 = load i8, ptr %127, align 1, !tbaa !11
  %129 = sext i8 %128 to i32
  %130 = icmp eq i32 %129, 34
  br i1 %130, label %131, label %137

131:                                              ; preds = %122
  %132 = load ptr, ptr %9, align 8, !tbaa !9
  %133 = load i32, ptr %11, align 4, !tbaa !5
  %134 = sub i32 %133, 1
  %135 = zext i32 %134 to i64
  %136 = getelementptr inbounds i8, ptr %132, i64 %135
  store i8 0, ptr %136, align 1, !tbaa !11
  br label %155

137:                                              ; preds = %122, %116
  %138 = load i32, ptr %6, align 4, !tbaa !5
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %6, align 4, !tbaa !5
  %140 = load i32, ptr %4, align 4, !tbaa !5
  %141 = icmp sge i32 %139, %140
  br i1 %141, label %142, label %145

142:                                              ; preds = %137
  %143 = load ptr, ptr @stderr, align 8, !tbaa !9
  %144 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %143, ptr noundef @.str.6, ptr noundef @.str.8) #7
  call void @exit(i32 noundef 1) #8
  unreachable

145:                                              ; preds = %137
  %146 = load ptr, ptr %9, align 8, !tbaa !9
  %147 = call ptr @strcat(ptr noundef %146, ptr noundef @.str.9) #7
  %148 = load ptr, ptr %9, align 8, !tbaa !9
  %149 = load ptr, ptr %5, align 8, !tbaa !9
  %150 = load i32, ptr %6, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds ptr, ptr %149, i64 %151
  %153 = load ptr, ptr %152, align 8, !tbaa !9
  %154 = call ptr @strcat(ptr noundef %148, ptr noundef %153) #7
  br label %116

155:                                              ; preds = %131
  br label %156

156:                                              ; preds = %155, %89
  %157 = load ptr, ptr %9, align 8, !tbaa !9
  %158 = call i64 @strlen(ptr noundef %157) #10
  %159 = trunc i64 %158 to i32
  store i32 %159, ptr %11, align 4, !tbaa !5
  br label %161

160:                                              ; preds = %79
  call void @usage()
  br label %161

161:                                              ; preds = %160, %156
  br label %162

162:                                              ; preds = %161, %78
  br label %163

163:                                              ; preds = %162, %50
  br label %164

164:                                              ; preds = %163
  %165 = load i32, ptr %6, align 4, !tbaa !5
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %6, align 4, !tbaa !5
  br label %28, !llvm.loop !12

167:                                              ; preds = %43, %28
  %168 = load ptr, ptr %9, align 8, !tbaa !9
  %169 = icmp ne ptr %168, null
  br i1 %169, label %170, label %174

170:                                              ; preds = %167
  %171 = load ptr, ptr %10, align 8, !tbaa !9
  %172 = icmp ne ptr %171, null
  br i1 %172, label %173, label %174

173:                                              ; preds = %170
  call void @usage()
  br label %174

174:                                              ; preds = %173, %170, %167
  %175 = load ptr, ptr %9, align 8, !tbaa !9
  %176 = icmp eq ptr %175, null
  br i1 %176, label %177, label %185

177:                                              ; preds = %174
  %178 = load ptr, ptr %10, align 8, !tbaa !9
  %179 = icmp eq ptr %178, null
  br i1 %179, label %180, label %185

180:                                              ; preds = %177
  %181 = load i32, ptr %6, align 4, !tbaa !5
  %182 = load i32, ptr %4, align 4, !tbaa !5
  %183 = icmp sge i32 %181, %182
  br i1 %183, label %184, label %185

184:                                              ; preds = %180
  call void @usage()
  br label %185

185:                                              ; preds = %184, %180, %177, %174
  %186 = load i32, ptr %6, align 4, !tbaa !5
  %187 = load i32, ptr %4, align 4, !tbaa !5
  %188 = icmp slt i32 %186, %187
  br i1 %188, label %189, label %207

189:                                              ; preds = %185
  %190 = load ptr, ptr %5, align 8, !tbaa !9
  %191 = load i32, ptr %6, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds ptr, ptr %190, i64 %192
  %194 = load ptr, ptr %193, align 8, !tbaa !9
  %195 = call noalias ptr @fopen(ptr noundef %194, ptr noundef @.str.10)
  store ptr %195, ptr @infile, align 8, !tbaa !9
  %196 = icmp eq ptr %195, null
  br i1 %196, label %197, label %206

197:                                              ; preds = %189
  %198 = load ptr, ptr @stderr, align 8, !tbaa !9
  %199 = load ptr, ptr @progname, align 8, !tbaa !9
  %200 = load ptr, ptr %5, align 8, !tbaa !9
  %201 = load i32, ptr %6, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds ptr, ptr %200, i64 %202
  %204 = load ptr, ptr %203, align 8, !tbaa !9
  %205 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %198, ptr noundef @.str.4, ptr noundef %199, ptr noundef %204) #7
  call void @exit(i32 noundef 1) #8
  unreachable

206:                                              ; preds = %189
  br label %209

207:                                              ; preds = %185
  %208 = load ptr, ptr @stdin, align 8, !tbaa !9
  store ptr %208, ptr @infile, align 8, !tbaa !9
  br label %209

209:                                              ; preds = %207, %206
  %210 = load i32, ptr %6, align 4, !tbaa !5
  %211 = load i32, ptr %4, align 4, !tbaa !5
  %212 = sub nsw i32 %211, 1
  %213 = icmp slt i32 %210, %212
  br i1 %213, label %214, label %218

214:                                              ; preds = %209
  %215 = load ptr, ptr @stderr, align 8, !tbaa !9
  %216 = load ptr, ptr @progname, align 8, !tbaa !9
  %217 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %215, ptr noundef @.str.11, ptr noundef %216) #7
  call void @usage()
  br label %218

218:                                              ; preds = %214, %209
  %219 = load ptr, ptr @stdout, align 8, !tbaa !9
  store ptr %219, ptr @outfile, align 8, !tbaa !9
  %220 = load ptr, ptr %9, align 8, !tbaa !9
  %221 = icmp eq ptr %220, null
  br i1 %221, label %222, label %263

222:                                              ; preds = %218
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %223 = call noalias ptr @malloc(i64 noundef 65000) #9
  store ptr %223, ptr %9, align 8, !tbaa !9
  %224 = load ptr, ptr %9, align 8, !tbaa !9
  %225 = icmp eq ptr %224, null
  br i1 %225, label %226, label %229

226:                                              ; preds = %222
  %227 = load ptr, ptr @stderr, align 8, !tbaa !9
  %228 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %227, ptr noundef @.str.6, ptr noundef @.str.7) #7
  call void @exit(i32 noundef 1) #8
  unreachable

229:                                              ; preds = %222
  store i32 0, ptr %11, align 4, !tbaa !5
  %230 = load ptr, ptr %10, align 8, !tbaa !9
  %231 = icmp ne ptr %230, null
  br i1 %231, label %232, label %234

232:                                              ; preds = %229
  %233 = load ptr, ptr %10, align 8, !tbaa !9
  br label %236

234:                                              ; preds = %229
  %235 = load ptr, ptr @stdin, align 8, !tbaa !9
  br label %236

236:                                              ; preds = %234, %232
  %237 = phi ptr [ %233, %232 ], [ %235, %234 ]
  store ptr %237, ptr %13, align 8, !tbaa !9
  br label %238

238:                                              ; preds = %248, %236
  %239 = load ptr, ptr %13, align 8, !tbaa !9
  %240 = call i32 @getc(ptr noundef %239)
  store i32 %240, ptr %14, align 4, !tbaa !5
  %241 = icmp ne i32 %240, -1
  br i1 %241, label %242, label %256

242:                                              ; preds = %238
  %243 = load i32, ptr %11, align 4, !tbaa !5
  %244 = icmp uge i32 %243, 65000
  br i1 %244, label %245, label %248

245:                                              ; preds = %242
  %246 = load ptr, ptr @stderr, align 8, !tbaa !9
  %247 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %246, ptr noundef @.str.12, i32 noundef 65000) #7
  call void @exit(i32 noundef 1) #8
  unreachable

248:                                              ; preds = %242
  %249 = load i32, ptr %14, align 4, !tbaa !5
  %250 = trunc i32 %249 to i8
  %251 = load ptr, ptr %9, align 8, !tbaa !9
  %252 = load i32, ptr %11, align 4, !tbaa !5
  %253 = add i32 %252, 1
  store i32 %253, ptr %11, align 4, !tbaa !5
  %254 = zext i32 %252 to i64
  %255 = getelementptr inbounds i8, ptr %251, i64 %254
  store i8 %250, ptr %255, align 1, !tbaa !11
  br label %238, !llvm.loop !14

256:                                              ; preds = %238
  %257 = load ptr, ptr %10, align 8, !tbaa !9
  %258 = icmp ne ptr %257, null
  br i1 %258, label %259, label %262

259:                                              ; preds = %256
  %260 = load ptr, ptr %10, align 8, !tbaa !9
  %261 = call i32 @fclose(ptr noundef %260)
  br label %262

262:                                              ; preds = %259, %256
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %263

263:                                              ; preds = %262, %218
  %264 = load i32, ptr %8, align 4, !tbaa !5
  %265 = call i32 @scan_JPEG_header(i32 noundef %264)
  store i32 %265, ptr %12, align 4, !tbaa !5
  %266 = load i32, ptr %11, align 4, !tbaa !5
  %267 = icmp ugt i32 %266, 0
  br i1 %267, label %268, label %282

268:                                              ; preds = %263
  call void @write_marker(i32 noundef 254)
  %269 = load i32, ptr %11, align 4, !tbaa !5
  %270 = add i32 %269, 2
  call void @write_2_bytes(i32 noundef %270)
  br label %271

271:                                              ; preds = %274, %268
  %272 = load i32, ptr %11, align 4, !tbaa !5
  %273 = icmp ugt i32 %272, 0
  br i1 %273, label %274, label %281

274:                                              ; preds = %271
  %275 = load ptr, ptr %9, align 8, !tbaa !9
  %276 = getelementptr inbounds i8, ptr %275, i32 1
  store ptr %276, ptr %9, align 8, !tbaa !9
  %277 = load i8, ptr %275, align 1, !tbaa !11
  %278 = sext i8 %277 to i32
  call void @write_1_byte(i32 noundef %278)
  %279 = load i32, ptr %11, align 4, !tbaa !5
  %280 = add i32 %279, -1
  store i32 %280, ptr %11, align 4, !tbaa !5
  br label %271, !llvm.loop !15

281:                                              ; preds = %271
  br label %282

282:                                              ; preds = %281, %263
  %283 = load i32, ptr %12, align 4, !tbaa !5
  call void @write_marker(i32 noundef %283)
  call void @copy_rest_of_file()
  call void @exit(i32 noundef 0) #8
  unreachable
}

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

; Function Attrs: nounwind uwtable
declare hidden i32 @keymatch(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @usage() #0

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

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

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

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

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #3

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

; Function Attrs: nounwind
declare ptr @strcat(ptr noundef, ptr noundef) #3

declare i32 @getc(ptr noundef) #2

declare i32 @fclose(ptr noundef) #2

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

; Function Attrs: nounwind uwtable
declare hidden i32 @scan_JPEG_header(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @write_marker(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @write_2_bytes(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @write_1_byte(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @copy_rest_of_file() #0

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !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"

@progname = external hidden local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [3 x i8], align 1
@infile = external hidden local_unnamed_addr global ptr, align 8
@stdin = external local_unnamed_addr global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [25 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@outfile = external hidden local_unnamed_addr global ptr, align 8
@.str.12 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: noreturn nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = load ptr, ptr %1, align 8, !tbaa !5
  store ptr %3, ptr @progname, align 8, !tbaa !5
  %4 = icmp eq ptr %3, null
  br i1 %4, label %8, label %5

5:                                                ; preds = %2
  %6 = load i8, ptr %3, align 1, !tbaa !9
  %7 = icmp eq i8 %6, 0
  br i1 %7, label %8, label %9

8:                                                ; preds = %5, %2
  store ptr @.str, ptr @progname, align 8, !tbaa !5
  br label %9

9:                                                ; preds = %8, %5
  %10 = icmp sgt i32 %0, 1
  br i1 %10, label %.lr.ph.preheader, label %._crit_edge.thread

.lr.ph.preheader:                                 ; preds = %9
  %11 = zext nneg i32 %0 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %81
  %.0136 = phi i32 [ %82, %81 ], [ 1, %.lr.ph.preheader ]
  %.073135 = phi i32 [ %.174, %81 ], [ 1, %.lr.ph.preheader ]
  %.075134 = phi i32 [ %.176, %81 ], [ 0, %.lr.ph.preheader ]
  %.079133 = phi ptr [ %.180, %81 ], [ null, %.lr.ph.preheader ]
  %.081132 = phi ptr [ %.283, %81 ], [ null, %.lr.ph.preheader ]
  %12 = sext i32 %.0136 to i64
  %13 = getelementptr inbounds ptr, ptr %1, i64 %12
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  %15 = load i8, ptr %14, align 1, !tbaa !9
  %.not = icmp ne i8 %15, 45
  br i1 %.not, label %._crit_edge, label %16

16:                                               ; preds = %.lr.ph
  %17 = getelementptr inbounds i8, ptr %14, i64 1
  %18 = tail call i32 @keymatch(ptr noundef nonnull %17, ptr noundef nonnull @.str.1, i32 noundef 1)
  %.not94 = icmp eq i32 %18, 0
  br i1 %.not94, label %19, label %81

19:                                               ; preds = %16
  %20 = tail call i32 @keymatch(ptr noundef nonnull %17, ptr noundef nonnull @.str.2, i32 noundef 2)
  %.not95 = icmp eq i32 %20, 0
  br i1 %.not95, label %36, label %21

21:                                               ; preds = %19
  %22 = add nsw i32 %.0136, 1
  %.not100 = icmp slt i32 %22, %0
  br i1 %.not100, label %24, label %23

23:                                               ; preds = %21
  tail call void @usage()
  br label %24

24:                                               ; preds = %23, %21
  %25 = sext i32 %22 to i64
  %26 = getelementptr inbounds ptr, ptr %1, i64 %25
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  %28 = tail call noalias ptr @fopen(ptr noundef %27, ptr noundef nonnull @.str.3)
  %29 = icmp eq ptr %28, null
  br i1 %29, label %30, label %81

30:                                               ; preds = %24
  %31 = getelementptr inbounds ptr, ptr %1, i64 %25
  %32 = load ptr, ptr @stderr, align 8, !tbaa !5
  %33 = load ptr, ptr @progname, align 8, !tbaa !5
  %34 = load ptr, ptr %31, align 8, !tbaa !5
  %35 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef nonnull @.str.4, ptr noundef %33, ptr noundef %34) #7
  tail call void @exit(i32 noundef 1) #8
  unreachable

36:                                               ; preds = %19
  %37 = tail call i32 @keymatch(ptr noundef nonnull %17, ptr noundef nonnull @.str.5, i32 noundef 1)
  %.not96 = icmp eq i32 %37, 0
  br i1 %.not96, label %80, label %38

38:                                               ; preds = %36
  %39 = add nsw i32 %.0136, 1
  %.not97 = icmp slt i32 %39, %0
  br i1 %.not97, label %41, label %40

40:                                               ; preds = %38
  tail call void @usage()
  br label %41

41:                                               ; preds = %40, %38
  %42 = sext i32 %39 to i64
  %43 = getelementptr inbounds ptr, ptr %1, i64 %42
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  %45 = load i8, ptr %44, align 1, !tbaa !9
  %46 = icmp eq i8 %45, 34
  br i1 %46, label %47, label %77

47:                                               ; preds = %41
  %48 = tail call noalias dereferenceable_or_null(65000) ptr @malloc(i64 noundef 65000) #9
  %49 = icmp eq ptr %48, null
  br i1 %49, label %50, label %53

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

53:                                               ; preds = %47
  %54 = getelementptr inbounds i8, ptr %44, i64 1
  %55 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %48, ptr noundef nonnull dereferenceable(1) %54) #10
  br label %56

56:                                               ; preds = %72, %53
  %indvars.iv = phi i64 [ %indvars.iv.next, %72 ], [ %42, %53 ]
  %57 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %48) #11
  %58 = and i64 %57, 4294967295
  %.not98 = icmp eq i64 %58, 0
  br i1 %.not98, label %68, label %59

59:                                               ; preds = %56
  %60 = add i64 %57, 4294967295
  %61 = and i64 %60, 4294967295
  %62 = getelementptr inbounds i8, ptr %48, i64 %61
  %63 = load i8, ptr %62, align 1, !tbaa !9
  %64 = icmp eq i8 %63, 34
  br i1 %64, label %65, label %68

65:                                               ; preds = %59
  %66 = getelementptr inbounds i8, ptr %48, i64 %61
  %67 = trunc nsw i64 %indvars.iv to i32
  store i8 0, ptr %66, align 1, !tbaa !9
  br label %77

68:                                               ; preds = %59, %56
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %.not99 = icmp slt i64 %indvars.iv.next, %11
  br i1 %.not99, label %72, label %69

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

72:                                               ; preds = %68
  %73 = tail call ptr @strcat(ptr noundef nonnull dereferenceable(1) %48, ptr noundef nonnull dereferenceable(1) @.str.9) #10
  %74 = getelementptr inbounds ptr, ptr %1, i64 %indvars.iv.next
  %75 = load ptr, ptr %74, align 8, !tbaa !5
  %76 = tail call ptr @strcat(ptr noundef nonnull dereferenceable(1) %48, ptr noundef nonnull dereferenceable(1) %75) #10
  br label %56

77:                                               ; preds = %65, %41
  %.182 = phi ptr [ %48, %65 ], [ %44, %41 ]
  %.2 = phi i32 [ %67, %65 ], [ %39, %41 ]
  %78 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %.182) #11
  %79 = trunc i64 %78 to i32
  br label %81

80:                                               ; preds = %36
  tail call void @usage()
  br label %81

81:                                               ; preds = %16, %77, %80, %24
  %.283 = phi ptr [ %.081132, %24 ], [ %.182, %77 ], [ %.081132, %80 ], [ %.081132, %16 ]
  %.180 = phi ptr [ %28, %24 ], [ %.079133, %77 ], [ %.079133, %80 ], [ %.079133, %16 ]
  %.176 = phi i32 [ %.075134, %24 ], [ %79, %77 ], [ %.075134, %80 ], [ %.075134, %16 ]
  %.174 = phi i32 [ %.073135, %24 ], [ %.073135, %77 ], [ %.073135, %80 ], [ 0, %16 ]
  %.3 = phi i32 [ %22, %24 ], [ %.2, %77 ], [ %.0136, %80 ], [ %.0136, %16 ]
  %82 = add nsw i32 %.3, 1
  %83 = icmp slt i32 %82, %0
  br i1 %83, label %.lr.ph, label %._crit_edge, !llvm.loop !10

._crit_edge:                                      ; preds = %81, %.lr.ph
  %.081.lcssa = phi ptr [ %.283, %81 ], [ %.081132, %.lr.ph ]
  %.079.lcssa = phi ptr [ %.180, %81 ], [ %.079133, %.lr.ph ]
  %.075.lcssa = phi i32 [ %.176, %81 ], [ %.075134, %.lr.ph ]
  %.073.lcssa = phi i32 [ %.174, %81 ], [ %.073135, %.lr.ph ]
  %.0.lcssa = phi i32 [ %82, %81 ], [ %.0136, %.lr.ph ]
  %.lcssa112 = phi i1 [ %.not, %81 ], [ true, %.lr.ph ]
  %84 = icmp ne ptr %.081.lcssa, null
  %85 = icmp ne ptr %.079.lcssa, null
  %or.cond = select i1 %84, i1 %85, i1 false
  br i1 %or.cond, label %.thread, label %._crit_edge.thread

.thread:                                          ; preds = %._crit_edge
  tail call void @usage()
  br i1 %.lcssa112, label %90, label %103

._crit_edge.thread:                               ; preds = %9, %._crit_edge
  %86 = phi i1 [ %85, %._crit_edge ], [ false, %9 ]
  %.lcssa112181 = phi i1 [ %.lcssa112, %._crit_edge ], [ false, %9 ]
  %.0.lcssa180 = phi i32 [ %.0.lcssa, %._crit_edge ], [ 1, %9 ]
  %.073.lcssa178 = phi i32 [ %.073.lcssa, %._crit_edge ], [ 1, %9 ]
  %.075.lcssa176 = phi i32 [ %.075.lcssa, %._crit_edge ], [ 0, %9 ]
  %.079.lcssa174 = phi ptr [ %.079.lcssa, %._crit_edge ], [ null, %9 ]
  %.081.lcssa172 = phi ptr [ %.081.lcssa, %._crit_edge ], [ null, %9 ]
  %87 = icmp eq ptr %.081.lcssa172, null
  %not. = xor i1 %87, true
  %or.cond3 = select i1 %not., i1 true, i1 %86
  %or.cond105 = or i1 %or.cond3, %.lcssa112181
  br i1 %or.cond105, label %89, label %88

88:                                               ; preds = %._crit_edge.thread
  tail call void @usage()
  br i1 %.lcssa112181, label %90, label %103

89:                                               ; preds = %._crit_edge.thread
  br i1 %.lcssa112181, label %90, label %103

90:                                               ; preds = %88, %.thread, %89
  %91 = phi i1 [ false, %.thread ], [ %87, %89 ], [ %87, %88 ]
  %.081.lcssa171197 = phi ptr [ %.081.lcssa, %.thread ], [ %.081.lcssa172, %89 ], [ null, %88 ]
  %.079.lcssa173194 = phi ptr [ %.079.lcssa, %.thread ], [ %.079.lcssa174, %89 ], [ %.079.lcssa174, %88 ]
  %.075.lcssa175191 = phi i32 [ %.075.lcssa, %.thread ], [ %.075.lcssa176, %89 ], [ %.075.lcssa176, %88 ]
  %.073.lcssa177188 = phi i32 [ %.073.lcssa, %.thread ], [ %.073.lcssa178, %89 ], [ %.073.lcssa178, %88 ]
  %.0.lcssa179183 = phi i32 [ %.0.lcssa, %.thread ], [ %.0.lcssa180, %89 ], [ %.0.lcssa180, %88 ]
  %92 = phi i1 [ %85, %.thread ], [ %86, %89 ], [ %86, %88 ]
  %93 = sext i32 %.0.lcssa179183 to i64
  %94 = getelementptr inbounds ptr, ptr %1, i64 %93
  %95 = load ptr, ptr %94, align 8, !tbaa !5
  %96 = tail call noalias ptr @fopen(ptr noundef %95, ptr noundef nonnull @.str.10)
  store ptr %96, ptr @infile, align 8, !tbaa !5
  %97 = icmp eq ptr %96, null
  br i1 %97, label %98, label %107

98:                                               ; preds = %90
  %99 = load ptr, ptr @stderr, align 8, !tbaa !5
  %100 = load ptr, ptr @progname, align 8, !tbaa !5
  %101 = load ptr, ptr %94, align 8, !tbaa !5
  %102 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %99, ptr noundef nonnull @.str.4, ptr noundef %100, ptr noundef %101) #7
  tail call void @exit(i32 noundef 1) #8
  unreachable

103:                                              ; preds = %88, %.thread, %89
  %104 = phi i1 [ false, %.thread ], [ %87, %89 ], [ %87, %88 ]
  %.081.lcssa171196 = phi ptr [ %.081.lcssa, %.thread ], [ %.081.lcssa172, %89 ], [ null, %88 ]
  %.079.lcssa173193 = phi ptr [ %.079.lcssa, %.thread ], [ %.079.lcssa174, %89 ], [ %.079.lcssa174, %88 ]
  %.075.lcssa175190 = phi i32 [ %.075.lcssa, %.thread ], [ %.075.lcssa176, %89 ], [ %.075.lcssa176, %88 ]
  %.073.lcssa177187 = phi i32 [ %.073.lcssa, %.thread ], [ %.073.lcssa178, %89 ], [ %.073.lcssa178, %88 ]
  %.0.lcssa179185 = phi i32 [ %.0.lcssa, %.thread ], [ %.0.lcssa180, %89 ], [ %.0.lcssa180, %88 ]
  %105 = phi i1 [ %85, %.thread ], [ %86, %89 ], [ %86, %88 ]
  %106 = load ptr, ptr @stdin, align 8, !tbaa !5
  store ptr %106, ptr @infile, align 8, !tbaa !5
  br label %107

107:                                              ; preds = %90, %103
  %108 = phi i1 [ %91, %90 ], [ %104, %103 ]
  %.081.lcssa171195 = phi ptr [ %.081.lcssa171197, %90 ], [ %.081.lcssa171196, %103 ]
  %.079.lcssa173192 = phi ptr [ %.079.lcssa173194, %90 ], [ %.079.lcssa173193, %103 ]
  %.075.lcssa175189 = phi i32 [ %.075.lcssa175191, %90 ], [ %.075.lcssa175190, %103 ]
  %.073.lcssa177186 = phi i32 [ %.073.lcssa177188, %90 ], [ %.073.lcssa177187, %103 ]
  %.0.lcssa179184 = phi i32 [ %.0.lcssa179183, %90 ], [ %.0.lcssa179185, %103 ]
  %109 = phi i1 [ %92, %90 ], [ %105, %103 ]
  %110 = add nsw i32 %0, -1
  %111 = icmp slt i32 %.0.lcssa179184, %110
  br i1 %111, label %112, label %116

112:                                              ; preds = %107
  %113 = load ptr, ptr @stderr, align 8, !tbaa !5
  %114 = load ptr, ptr @progname, align 8, !tbaa !5
  %115 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %113, ptr noundef nonnull @.str.11, ptr noundef %114) #7
  tail call void @usage()
  br label %116

116:                                              ; preds = %112, %107
  %117 = load ptr, ptr @stdout, align 8, !tbaa !5
  store ptr %117, ptr @outfile, align 8, !tbaa !5
  br i1 %108, label %118, label %139

118:                                              ; preds = %116
  %119 = tail call noalias dereferenceable_or_null(65000) ptr @malloc(i64 noundef 65000) #9
  %120 = icmp eq ptr %119, null
  br i1 %120, label %121, label %124

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

124:                                              ; preds = %118
  %125 = load ptr, ptr @stdin, align 8
  %126 = select i1 %109, ptr %.079.lcssa173192, ptr %125
  %127 = tail call i32 @getc(ptr noundef %126)
  %.not102149 = icmp eq i32 %127, -1
  br i1 %.not102149, label %._crit_edge153, label %.lr.ph152

.lr.ph152:                                        ; preds = %124, %132
  %indvars.iv161 = phi i64 [ %indvars.iv.next162, %132 ], [ 0, %124 ]
  %128 = phi i32 [ %135, %132 ], [ %127, %124 ]
  %exitcond = icmp eq i64 %indvars.iv161, 65000
  br i1 %exitcond, label %129, label %132

129:                                              ; preds = %.lr.ph152
  %130 = load ptr, ptr @stderr, align 8, !tbaa !5
  %131 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %130, ptr noundef nonnull @.str.12, i32 noundef 65000) #7
  tail call void @exit(i32 noundef 1) #8
  unreachable

132:                                              ; preds = %.lr.ph152
  %133 = trunc i32 %128 to i8
  %indvars.iv.next162 = add nuw nsw i64 %indvars.iv161, 1
  %134 = getelementptr inbounds i8, ptr %119, i64 %indvars.iv161
  store i8 %133, ptr %134, align 1, !tbaa !9
  %135 = tail call i32 @getc(ptr noundef %126)
  %.not102 = icmp eq i32 %135, -1
  br i1 %.not102, label %._crit_edge153.loopexit, label %.lr.ph152, !llvm.loop !12

._crit_edge153.loopexit:                          ; preds = %132
  %136 = trunc nuw nsw i64 %indvars.iv.next162 to i32
  br label %._crit_edge153

._crit_edge153:                                   ; preds = %._crit_edge153.loopexit, %124
  %.277.lcssa = phi i32 [ 0, %124 ], [ %136, %._crit_edge153.loopexit ]
  br i1 %109, label %137, label %139

137:                                              ; preds = %._crit_edge153
  %138 = tail call i32 @fclose(ptr noundef nonnull %.079.lcssa173192)
  br label %139

139:                                              ; preds = %._crit_edge153, %137, %116
  %.384 = phi ptr [ %.081.lcssa171195, %116 ], [ %119, %137 ], [ %119, %._crit_edge153 ]
  %.378 = phi i32 [ %.075.lcssa175189, %116 ], [ %.277.lcssa, %137 ], [ %.277.lcssa, %._crit_edge153 ]
  %140 = tail call i32 @scan_JPEG_header(i32 noundef %.073.lcssa177186)
  %.not103 = icmp eq i32 %.378, 0
  br i1 %.not103, label %.loopexit, label %141

141:                                              ; preds = %139
  tail call void @write_marker(i32 noundef 254)
  %142 = add i32 %.378, 2
  tail call void @write_2_bytes(i32 noundef %142)
  br label %143

143:                                              ; preds = %141, %143
  %.4156 = phi i32 [ %.378, %141 ], [ %147, %143 ]
  %.485155 = phi ptr [ %.384, %141 ], [ %144, %143 ]
  %144 = getelementptr inbounds i8, ptr %.485155, i64 1
  %145 = load i8, ptr %.485155, align 1, !tbaa !9
  %146 = sext i8 %145 to i32
  tail call void @write_1_byte(i32 noundef %146)
  %147 = add i32 %.4156, -1
  %.not104 = icmp eq i32 %147, 0
  br i1 %.not104, label %.loopexit, label %143, !llvm.loop !13

.loopexit:                                        ; preds = %143, %139
  tail call void @write_marker(i32 noundef %140)
  tail call void @copy_rest_of_file()
  tail call void @exit(i32 noundef 0) #8
  unreachable
}

; Function Attrs: nounwind uwtable
declare hidden i32 @keymatch(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @usage() local_unnamed_addr #1

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

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

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #5

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcat(ptr noalias noundef returned, ptr noalias nocapture noundef readonly) local_unnamed_addr #5

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @scan_JPEG_header(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @write_marker(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @write_2_bytes(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @write_1_byte(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @copy_rest_of_file() local_unnamed_addr #1

attributes #0 = { noreturn 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 = { 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 #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { cold nounwind }
attributes #8 = { noreturn nounwind }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(read) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}


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