; LLVM IR from holzschu/ios_system :: shell_cmds/hexdump (parse)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct._fs = type { ptr, ptr, i32 }
%struct._fu = type { ptr, ptr, i32, i32, i32, ptr }

@add.nextfs = external hidden global ptr, align 8
@fshead = external global ptr, align 8

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

; Function Attrs: noreturn
declare void @err(i32 noundef, ptr noundef, ...) #1

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() #2

; Function Attrs: nounwind uwtable
define dso_local void @add(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %8 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 24) #9
  store ptr %8, ptr %5, align 8, !tbaa !5
  %9 = icmp eq ptr %8, null
  br i1 %9, label %10, label %11

10:                                               ; preds = %1
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef null) #10
  unreachable

11:                                               ; preds = %1
  %12 = load ptr, ptr @fshead, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %16, label %14

14:                                               ; preds = %11
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %15, ptr @fshead, align 8, !tbaa !5
  br label %19

16:                                               ; preds = %11
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = load ptr, ptr @add.nextfs, align 8, !tbaa !5
  store ptr %17, ptr %18, align 8, !tbaa !5
  br label %19

19:                                               ; preds = %16, %14
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct._fs, ptr %20, i32 0, i32 0
  store ptr %21, ptr @add.nextfs, align 8, !tbaa !5
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct._fs, ptr %22, i32 0, i32 1
  store ptr %23, ptr %7, align 8, !tbaa !5
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %24, ptr %3, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %257, %19
  br label %26

26:                                               ; preds = %39, %25
  %27 = call ptr @__ctype_b_loc() #11
  %28 = load ptr, ptr %27, align 8, !tbaa !5
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = load i8, ptr %29, align 1, !tbaa !9
  %31 = zext i8 %30 to i32
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds i16, ptr %28, i64 %32
  %34 = load i16, ptr %33, align 2, !tbaa !10
  %35 = zext i16 %34 to i32
  %36 = and i32 %35, 8192
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %38, label %42

38:                                               ; preds = %26
  br label %39

39:                                               ; preds = %38
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %40, i32 1
  store ptr %41, ptr %3, align 8, !tbaa !5
  br label %26, !llvm.loop !12

42:                                               ; preds = %26
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = load i8, ptr %43, align 1, !tbaa !9
  %45 = icmp ne i8 %44, 0
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  br label %282

47:                                               ; preds = %42
  %48 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 40) #9
  store ptr %48, ptr %6, align 8, !tbaa !5
  %49 = icmp eq ptr %48, null
  br i1 %49, label %50, label %51

50:                                               ; preds = %47
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef null) #10
  unreachable

51:                                               ; preds = %47
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %52, ptr %53, align 8, !tbaa !5
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct._fu, ptr %54, i32 0, i32 0
  store ptr %55, ptr %7, align 8, !tbaa !5
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._fu, ptr %56, i32 0, i32 3
  store i32 1, ptr %57, align 4, !tbaa !14
  %58 = call ptr @__ctype_b_loc() #11
  %59 = load ptr, ptr %58, align 8, !tbaa !5
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = load i8, ptr %60, align 1, !tbaa !9
  %62 = zext i8 %61 to i32
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds i16, ptr %59, i64 %63
  %65 = load i16, ptr %64, align 2, !tbaa !10
  %66 = zext i16 %65 to i32
  %67 = and i32 %66, 2048
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %132

69:                                               ; preds = %51
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %70, ptr %4, align 8, !tbaa !5
  br label %71

71:                                               ; preds = %84, %69
  %72 = call ptr @__ctype_b_loc() #11
  %73 = load ptr, ptr %72, align 8, !tbaa !5
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = load i8, ptr %74, align 1, !tbaa !9
  %76 = zext i8 %75 to i32
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds i16, ptr %73, i64 %77
  %79 = load i16, ptr %78, align 2, !tbaa !10
  %80 = zext i16 %79 to i32
  %81 = and i32 %80, 2048
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %83, label %87

83:                                               ; preds = %71
  br label %84

84:                                               ; preds = %83
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = getelementptr inbounds i8, ptr %85, i32 1
  store ptr %86, ptr %3, align 8, !tbaa !5
  br label %71, !llvm.loop !17

87:                                               ; preds = %71
  %88 = call ptr @__ctype_b_loc() #11
  %89 = load ptr, ptr %88, align 8, !tbaa !5
  %90 = load ptr, ptr %3, align 8, !tbaa !5
  %91 = load i8, ptr %90, align 1, !tbaa !9
  %92 = zext i8 %91 to i32
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds i16, ptr %89, i64 %93
  %95 = load i16, ptr %94, align 2, !tbaa !10
  %96 = zext i16 %95 to i32
  %97 = and i32 %96, 8192
  %98 = icmp ne i32 %97, 0
  br i1 %98, label %106, label %99

99:                                               ; preds = %87
  %100 = load ptr, ptr %3, align 8, !tbaa !5
  %101 = load i8, ptr %100, align 1, !tbaa !9
  %102 = zext i8 %101 to i32
  %103 = icmp ne i32 %102, 47
  br i1 %103, label %104, label %106

104:                                              ; preds = %99
  %105 = load ptr, ptr %2, align 8, !tbaa !5
  call void @badfmt(ptr noundef %105)
  br label %106

106:                                              ; preds = %104, %99, %87
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = call i32 @atoi(ptr noundef %107) #12
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct._fu, ptr %109, i32 0, i32 3
  store i32 %108, ptr %110, align 4, !tbaa !14
  %111 = load ptr, ptr %6, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct._fu, ptr %111, i32 0, i32 2
  store i32 2, ptr %112, align 8, !tbaa !18
  %113 = load ptr, ptr %3, align 8, !tbaa !5
  %114 = getelementptr inbounds i8, ptr %113, i32 1
  store ptr %114, ptr %3, align 8, !tbaa !5
  br label %115

115:                                              ; preds = %128, %106
  %116 = call ptr @__ctype_b_loc() #11
  %117 = load ptr, ptr %116, align 8, !tbaa !5
  %118 = load ptr, ptr %3, align 8, !tbaa !5
  %119 = load i8, ptr %118, align 1, !tbaa !9
  %120 = zext i8 %119 to i32
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds i16, ptr %117, i64 %121
  %123 = load i16, ptr %122, align 2, !tbaa !10
  %124 = zext i16 %123 to i32
  %125 = and i32 %124, 8192
  %126 = icmp ne i32 %125, 0
  br i1 %126, label %127, label %131

127:                                              ; preds = %115
  br label %128

128:                                              ; preds = %127
  %129 = load ptr, ptr %3, align 8, !tbaa !5
  %130 = getelementptr inbounds i8, ptr %129, i32 1
  store ptr %130, ptr %3, align 8, !tbaa !5
  br label %115, !llvm.loop !19

131:                                              ; preds = %115
  br label %132

132:                                              ; preds = %131, %51
  %133 = load ptr, ptr %3, align 8, !tbaa !5
  %134 = load i8, ptr %133, align 1, !tbaa !9
  %135 = zext i8 %134 to i32
  %136 = icmp eq i32 %135, 47
  br i1 %136, label %137, label %153

137:                                              ; preds = %132
  br label %138

138:                                              ; preds = %151, %137
  %139 = call ptr @__ctype_b_loc() #11
  %140 = load ptr, ptr %139, align 8, !tbaa !5
  %141 = load ptr, ptr %3, align 8, !tbaa !5
  %142 = getelementptr inbounds i8, ptr %141, i32 1
  store ptr %142, ptr %3, align 8, !tbaa !5
  %143 = load i8, ptr %142, align 1, !tbaa !9
  %144 = zext i8 %143 to i32
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds i16, ptr %140, i64 %145
  %147 = load i16, ptr %146, align 2, !tbaa !10
  %148 = zext i16 %147 to i32
  %149 = and i32 %148, 8192
  %150 = icmp ne i32 %149, 0
  br i1 %150, label %151, label %152

151:                                              ; preds = %138
  br label %138, !llvm.loop !20

152:                                              ; preds = %138
  br label %153

153:                                              ; preds = %152, %132
  %154 = call ptr @__ctype_b_loc() #11
  %155 = load ptr, ptr %154, align 8, !tbaa !5
  %156 = load ptr, ptr %3, align 8, !tbaa !5
  %157 = load i8, ptr %156, align 1, !tbaa !9
  %158 = zext i8 %157 to i32
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds i16, ptr %155, i64 %159
  %161 = load i16, ptr %160, align 2, !tbaa !10
  %162 = zext i16 %161 to i32
  %163 = and i32 %162, 2048
  %164 = icmp ne i32 %163, 0
  br i1 %164, label %165, label %221

165:                                              ; preds = %153
  %166 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %166, ptr %4, align 8, !tbaa !5
  br label %167

167:                                              ; preds = %180, %165
  %168 = call ptr @__ctype_b_loc() #11
  %169 = load ptr, ptr %168, align 8, !tbaa !5
  %170 = load ptr, ptr %3, align 8, !tbaa !5
  %171 = load i8, ptr %170, align 1, !tbaa !9
  %172 = zext i8 %171 to i32
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds i16, ptr %169, i64 %173
  %175 = load i16, ptr %174, align 2, !tbaa !10
  %176 = zext i16 %175 to i32
  %177 = and i32 %176, 2048
  %178 = icmp ne i32 %177, 0
  br i1 %178, label %179, label %183

179:                                              ; preds = %167
  br label %180

180:                                              ; preds = %179
  %181 = load ptr, ptr %3, align 8, !tbaa !5
  %182 = getelementptr inbounds i8, ptr %181, i32 1
  store ptr %182, ptr %3, align 8, !tbaa !5
  br label %167, !llvm.loop !21

183:                                              ; preds = %167
  %184 = call ptr @__ctype_b_loc() #11
  %185 = load ptr, ptr %184, align 8, !tbaa !5
  %186 = load ptr, ptr %3, align 8, !tbaa !5
  %187 = load i8, ptr %186, align 1, !tbaa !9
  %188 = zext i8 %187 to i32
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds i16, ptr %185, i64 %189
  %191 = load i16, ptr %190, align 2, !tbaa !10
  %192 = zext i16 %191 to i32
  %193 = and i32 %192, 8192
  %194 = icmp ne i32 %193, 0
  br i1 %194, label %197, label %195

195:                                              ; preds = %183
  %196 = load ptr, ptr %2, align 8, !tbaa !5
  call void @badfmt(ptr noundef %196)
  br label %197

197:                                              ; preds = %195, %183
  %198 = load ptr, ptr %4, align 8, !tbaa !5
  %199 = call i32 @atoi(ptr noundef %198) #12
  %200 = load ptr, ptr %6, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct._fu, ptr %200, i32 0, i32 4
  store i32 %199, ptr %201, align 8, !tbaa !22
  %202 = load ptr, ptr %3, align 8, !tbaa !5
  %203 = getelementptr inbounds i8, ptr %202, i32 1
  store ptr %203, ptr %3, align 8, !tbaa !5
  br label %204

204:                                              ; preds = %217, %197
  %205 = call ptr @__ctype_b_loc() #11
  %206 = load ptr, ptr %205, align 8, !tbaa !5
  %207 = load ptr, ptr %3, align 8, !tbaa !5
  %208 = load i8, ptr %207, align 1, !tbaa !9
  %209 = zext i8 %208 to i32
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds i16, ptr %206, i64 %210
  %212 = load i16, ptr %211, align 2, !tbaa !10
  %213 = zext i16 %212 to i32
  %214 = and i32 %213, 8192
  %215 = icmp ne i32 %214, 0
  br i1 %215, label %216, label %220

216:                                              ; preds = %204
  br label %217

217:                                              ; preds = %216
  %218 = load ptr, ptr %3, align 8, !tbaa !5
  %219 = getelementptr inbounds i8, ptr %218, i32 1
  store ptr %219, ptr %3, align 8, !tbaa !5
  br label %204, !llvm.loop !23

220:                                              ; preds = %204
  br label %221

221:                                              ; preds = %220, %153
  %222 = load ptr, ptr %3, align 8, !tbaa !5
  %223 = load i8, ptr %222, align 1, !tbaa !9
  %224 = zext i8 %223 to i32
  %225 = icmp ne i32 %224, 34
  br i1 %225, label %226, label %228

226:                                              ; preds = %221
  %227 = load ptr, ptr %2, align 8, !tbaa !5
  call void @badfmt(ptr noundef %227)
  br label %228

228:                                              ; preds = %226, %221
  %229 = load ptr, ptr %3, align 8, !tbaa !5
  %230 = getelementptr inbounds i8, ptr %229, i32 1
  store ptr %230, ptr %3, align 8, !tbaa !5
  store ptr %230, ptr %4, align 8, !tbaa !5
  br label %231

231:                                              ; preds = %244, %228
  %232 = load ptr, ptr %3, align 8, !tbaa !5
  %233 = load i8, ptr %232, align 1, !tbaa !9
  %234 = zext i8 %233 to i32
  %235 = icmp ne i32 %234, 34
  br i1 %235, label %236, label %245

236:                                              ; preds = %231
  %237 = load ptr, ptr %3, align 8, !tbaa !5
  %238 = getelementptr inbounds i8, ptr %237, i32 1
  store ptr %238, ptr %3, align 8, !tbaa !5
  %239 = load i8, ptr %237, align 1, !tbaa !9
  %240 = zext i8 %239 to i32
  %241 = icmp eq i32 %240, 0
  br i1 %241, label %242, label %244

242:                                              ; preds = %236
  %243 = load ptr, ptr %2, align 8, !tbaa !5
  call void @badfmt(ptr noundef %243)
  br label %244

244:                                              ; preds = %242, %236
  br label %231, !llvm.loop !24

245:                                              ; preds = %231
  %246 = load ptr, ptr %3, align 8, !tbaa !5
  %247 = load ptr, ptr %4, align 8, !tbaa !5
  %248 = ptrtoint ptr %246 to i64
  %249 = ptrtoint ptr %247 to i64
  %250 = sub i64 %248, %249
  %251 = add nsw i64 %250, 1
  %252 = call noalias ptr @malloc(i64 noundef %251) #13
  %253 = load ptr, ptr %6, align 8, !tbaa !5
  %254 = getelementptr inbounds %struct._fu, ptr %253, i32 0, i32 5
  store ptr %252, ptr %254, align 8, !tbaa !25
  %255 = icmp ne ptr %252, null
  br i1 %255, label %257, label %256

256:                                              ; preds = %245
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef null) #10
  unreachable

257:                                              ; preds = %245
  %258 = load ptr, ptr %6, align 8, !tbaa !5
  %259 = getelementptr inbounds %struct._fu, ptr %258, i32 0, i32 5
  %260 = load ptr, ptr %259, align 8, !tbaa !25
  %261 = load ptr, ptr %4, align 8, !tbaa !5
  %262 = load ptr, ptr %3, align 8, !tbaa !5
  %263 = load ptr, ptr %4, align 8, !tbaa !5
  %264 = ptrtoint ptr %262 to i64
  %265 = ptrtoint ptr %263 to i64
  %266 = sub i64 %264, %265
  %267 = call ptr @strncpy(ptr noundef %260, ptr noundef %261, i64 noundef %266) #8
  %268 = load ptr, ptr %6, align 8, !tbaa !5
  %269 = getelementptr inbounds %struct._fu, ptr %268, i32 0, i32 5
  %270 = load ptr, ptr %269, align 8, !tbaa !25
  %271 = load ptr, ptr %3, align 8, !tbaa !5
  %272 = load ptr, ptr %4, align 8, !tbaa !5
  %273 = ptrtoint ptr %271 to i64
  %274 = ptrtoint ptr %272 to i64
  %275 = sub i64 %273, %274
  %276 = getelementptr inbounds i8, ptr %270, i64 %275
  store i8 0, ptr %276, align 1, !tbaa !9
  %277 = load ptr, ptr %6, align 8, !tbaa !5
  %278 = getelementptr inbounds %struct._fu, ptr %277, i32 0, i32 5
  %279 = load ptr, ptr %278, align 8, !tbaa !25
  call void @escape(ptr noundef %279)
  %280 = load ptr, ptr %3, align 8, !tbaa !5
  %281 = getelementptr inbounds i8, ptr %280, i32 1
  store ptr %281, ptr %3, align 8, !tbaa !5
  br label %25

282:                                              ; preds = %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  ret void
}

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @badfmt(ptr noundef) #3

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

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

; Function Attrs: nounwind
declare ptr @strncpy(ptr noundef, ptr noundef, i64 noundef) #7

; Function Attrs: nounwind uwtable
declare dso_local void @escape(ptr noundef) #3

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !16, i64 20}
!15 = !{!"_fu", !6, i64 0, !6, i64 8, !16, i64 16, !16, i64 20, !16, i64 24, !6, i64 32}
!16 = !{!"int", !7, i64 0}
!17 = distinct !{!17, !13}
!18 = !{!15, !16, i64 16}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}
!22 = !{!15, !16, i64 24}
!23 = distinct !{!23, !13}
!24 = distinct !{!24, !13}
!25 = !{!15, !6, i64 32}


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

@add.nextfs = external hidden local_unnamed_addr global ptr, align 8
@fshead = external local_unnamed_addr global ptr, align 8

; Function Attrs: noreturn
declare void @err(i32 noundef, ptr noundef, ...) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local void @add(ptr noundef %0) local_unnamed_addr #2 {
  %2 = tail call noalias dereferenceable_or_null(24) ptr @calloc(i64 noundef 1, i64 noundef 24) #7
  %3 = icmp eq ptr %2, null
  br i1 %3, label %4, label %5

4:                                                ; preds = %1
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef null) #8
  unreachable

5:                                                ; preds = %1
  %6 = load ptr, ptr @fshead, align 8, !tbaa !5
  %.not = icmp eq ptr %6, null
  %7 = load ptr, ptr @add.nextfs, align 8
  %.sink = select i1 %.not, ptr @fshead, ptr %7
  store ptr %2, ptr %.sink, align 8, !tbaa !5
  store ptr %2, ptr @add.nextfs, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %2, i64 8
  %9 = tail call ptr @__ctype_b_loc() #9
  br label %10

10:                                               ; preds = %102, %5
  %.056 = phi ptr [ %0, %5 ], [ %105, %102 ]
  %.0 = phi ptr [ %8, %5 ], [ %21, %102 ]
  %11 = load ptr, ptr %9, align 8, !tbaa !5
  br label %12

12:                                               ; preds = %12, %10
  %.1 = phi ptr [ %.056, %10 ], [ %18, %12 ]
  %13 = load i8, ptr %.1, align 1, !tbaa !9
  %14 = zext i8 %13 to i64
  %15 = getelementptr inbounds i16, ptr %11, i64 %14
  %16 = load i16, ptr %15, align 2, !tbaa !10
  %17 = and i16 %16, 8192
  %.not61 = icmp eq i16 %17, 0
  %18 = getelementptr inbounds i8, ptr %.1, i64 1
  br i1 %.not61, label %19, label %12, !llvm.loop !12

19:                                               ; preds = %12
  %.not62 = icmp eq i8 %13, 0
  br i1 %.not62, label %106, label %20

20:                                               ; preds = %19
  %21 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #7
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %24

23:                                               ; preds = %20
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef null) #8
  unreachable

24:                                               ; preds = %20
  store ptr %21, ptr %.0, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %21, i64 20
  store i32 1, ptr %25, align 4, !tbaa !14
  %26 = load ptr, ptr %9, align 8, !tbaa !5
  %27 = load i8, ptr %.1, align 1, !tbaa !9
  %28 = zext i8 %27 to i64
  %29 = getelementptr inbounds i16, ptr %26, i64 %28
  %30 = load i16, ptr %29, align 2, !tbaa !10
  %31 = and i16 %30, 2048
  %.not63 = icmp eq i16 %31, 0
  br i1 %.not63, label %.loopexit78, label %.preheader79

.preheader79:                                     ; preds = %24, %.preheader79
  %.2 = phi ptr [ %38, %.preheader79 ], [ %.1, %24 ]
  %32 = load i8, ptr %.2, align 1, !tbaa !9
  %33 = zext i8 %32 to i64
  %34 = getelementptr inbounds i16, ptr %26, i64 %33
  %35 = load i16, ptr %34, align 2, !tbaa !10
  %36 = zext i16 %35 to i32
  %37 = and i32 %36, 2048
  %.not64 = icmp eq i32 %37, 0
  %38 = getelementptr inbounds i8, ptr %.2, i64 1
  br i1 %.not64, label %39, label %.preheader79, !llvm.loop !17

39:                                               ; preds = %.preheader79
  %40 = and i32 %36, 8192
  %.not65 = icmp ne i32 %40, 0
  %.not66 = icmp eq i8 %32, 47
  %or.cond = or i1 %.not66, %.not65
  br i1 %or.cond, label %42, label %41

41:                                               ; preds = %39
  tail call void @badfmt(ptr noundef %0)
  %.pre = load ptr, ptr %9, align 8, !tbaa !5
  br label %42

42:                                               ; preds = %41, %39
  %43 = phi ptr [ %.pre, %41 ], [ %26, %39 ]
  %44 = tail call i32 @atoi(ptr nocapture noundef %.1) #10
  store i32 %44, ptr %25, align 4, !tbaa !14
  %45 = getelementptr inbounds i8, ptr %21, i64 16
  store i32 2, ptr %45, align 8, !tbaa !18
  br label %46

46:                                               ; preds = %46, %42
  %.2.pn = phi ptr [ %.2, %42 ], [ %.3, %46 ]
  %.3 = getelementptr inbounds i8, ptr %.2.pn, i64 1
  %47 = load i8, ptr %.3, align 1, !tbaa !9
  %48 = zext i8 %47 to i64
  %49 = getelementptr inbounds i16, ptr %43, i64 %48
  %50 = load i16, ptr %49, align 2, !tbaa !10
  %51 = and i16 %50, 8192
  %.not67 = icmp eq i16 %51, 0
  br i1 %.not67, label %.loopexit78, label %46, !llvm.loop !19

.loopexit78:                                      ; preds = %46, %24
  %.pre93 = phi i16 [ %30, %24 ], [ %50, %46 ]
  %52 = phi ptr [ %26, %24 ], [ %43, %46 ]
  %53 = phi i8 [ %27, %24 ], [ %47, %46 ]
  %.4 = phi ptr [ %.1, %24 ], [ %.3, %46 ]
  %54 = icmp eq i8 %53, 47
  br i1 %54, label %.preheader76, label %.loopexit77

.preheader76:                                     ; preds = %.loopexit78, %.preheader76
  %.5 = phi ptr [ %55, %.preheader76 ], [ %.4, %.loopexit78 ]
  %55 = getelementptr inbounds i8, ptr %.5, i64 1
  %56 = load i8, ptr %55, align 1, !tbaa !9
  %57 = zext i8 %56 to i64
  %58 = getelementptr inbounds i16, ptr %52, i64 %57
  %59 = load i16, ptr %58, align 2, !tbaa !10
  %60 = and i16 %59, 8192
  %.not68 = icmp eq i16 %60, 0
  br i1 %.not68, label %.loopexit77, label %.preheader76, !llvm.loop !20

.loopexit77:                                      ; preds = %.preheader76, %.loopexit78
  %61 = phi i16 [ %.pre93, %.loopexit78 ], [ %59, %.preheader76 ]
  %62 = phi i8 [ %53, %.loopexit78 ], [ %56, %.preheader76 ]
  %.6 = phi ptr [ %.4, %.loopexit78 ], [ %55, %.preheader76 ]
  %63 = and i16 %61, 2048
  %.not69 = icmp eq i16 %63, 0
  br i1 %.not69, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %.loopexit77, %.preheader
  %.7 = phi ptr [ %70, %.preheader ], [ %.6, %.loopexit77 ]
  %64 = load i8, ptr %.7, align 1, !tbaa !9
  %65 = zext i8 %64 to i64
  %66 = getelementptr inbounds i16, ptr %52, i64 %65
  %67 = load i16, ptr %66, align 2, !tbaa !10
  %68 = zext i16 %67 to i32
  %69 = and i32 %68, 2048
  %.not70 = icmp eq i32 %69, 0
  %70 = getelementptr inbounds i8, ptr %.7, i64 1
  br i1 %.not70, label %71, label %.preheader, !llvm.loop !21

71:                                               ; preds = %.preheader
  %72 = and i32 %68, 8192
  %.not71 = icmp eq i32 %72, 0
  br i1 %.not71, label %73, label %74

73:                                               ; preds = %71
  tail call void @badfmt(ptr noundef %0)
  %.pre94 = load ptr, ptr %9, align 8, !tbaa !5
  br label %74

74:                                               ; preds = %73, %71
  %75 = phi ptr [ %.pre94, %73 ], [ %52, %71 ]
  %76 = tail call i32 @atoi(ptr nocapture noundef %.6) #10
  %77 = getelementptr inbounds i8, ptr %21, i64 24
  store i32 %76, ptr %77, align 8, !tbaa !22
  br label %78

78:                                               ; preds = %78, %74
  %.7.pn = phi ptr [ %.7, %74 ], [ %.8, %78 ]
  %.8 = getelementptr inbounds i8, ptr %.7.pn, i64 1
  %79 = load i8, ptr %.8, align 1, !tbaa !9
  %80 = zext i8 %79 to i64
  %81 = getelementptr inbounds i16, ptr %75, i64 %80
  %82 = load i16, ptr %81, align 2, !tbaa !10
  %83 = and i16 %82, 8192
  %.not72 = icmp eq i16 %83, 0
  br i1 %.not72, label %.loopexit, label %78, !llvm.loop !23

.loopexit:                                        ; preds = %78, %.loopexit77
  %84 = phi i8 [ %62, %.loopexit77 ], [ %79, %78 ]
  %.9 = phi ptr [ %.6, %.loopexit77 ], [ %.8, %78 ]
  %.not73 = icmp eq i8 %84, 34
  br i1 %.not73, label %86, label %85

85:                                               ; preds = %.loopexit
  tail call void @badfmt(ptr noundef %0)
  br label %86

86:                                               ; preds = %85, %.loopexit
  %87 = getelementptr inbounds i8, ptr %.9, i64 1
  %88 = load i8, ptr %87, align 1, !tbaa !9
  %.not7485 = icmp eq i8 %88, 34
  br i1 %.not7485, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %86, %93
  %89 = phi i8 [ %94, %93 ], [ %88, %86 ]
  %.1086 = phi ptr [ %90, %93 ], [ %87, %86 ]
  %90 = getelementptr inbounds i8, ptr %.1086, i64 1
  %91 = icmp eq i8 %89, 0
  br i1 %91, label %92, label %93

92:                                               ; preds = %.lr.ph
  tail call void @badfmt(ptr noundef %0)
  br label %93

93:                                               ; preds = %92, %.lr.ph
  %94 = load i8, ptr %90, align 1, !tbaa !9
  %.not74 = icmp eq i8 %94, 34
  br i1 %.not74, label %._crit_edge, label %.lr.ph, !llvm.loop !24

._crit_edge:                                      ; preds = %93, %86
  %.10.lcssa = phi ptr [ %87, %86 ], [ %90, %93 ]
  %95 = ptrtoint ptr %.10.lcssa to i64
  %96 = ptrtoint ptr %87 to i64
  %97 = sub i64 %95, %96
  %98 = add nsw i64 %97, 1
  %99 = tail call noalias ptr @malloc(i64 noundef %98) #11
  %100 = getelementptr inbounds i8, ptr %21, i64 32
  store ptr %99, ptr %100, align 8, !tbaa !25
  %.not75 = icmp eq ptr %99, null
  br i1 %.not75, label %101, label %102

101:                                              ; preds = %._crit_edge
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef null) #8
  unreachable

102:                                              ; preds = %._crit_edge
  %103 = tail call ptr @strncpy(ptr noundef nonnull %99, ptr noundef nonnull %87, i64 noundef %97) #12
  %104 = getelementptr inbounds i8, ptr %99, i64 %97
  store i8 0, ptr %104, align 1, !tbaa !9
  tail call void @escape(ptr noundef nonnull %99)
  %105 = getelementptr inbounds i8, ptr %.10.lcssa, i64 1
  br label %10

106:                                              ; preds = %19
  ret void
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @badfmt(ptr noundef) local_unnamed_addr #2

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @escape(ptr noundef) local_unnamed_addr #2

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

!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 = !{!11, !11, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !16, i64 20}
!15 = !{!"_fu", !6, i64 0, !6, i64 8, !16, i64 16, !16, i64 20, !16, i64 24, !6, i64 32}
!16 = !{!"int", !7, i64 0}
!17 = distinct !{!17, !13}
!18 = !{!15, !16, i64 16}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}
!22 = !{!15, !16, i64 24}
!23 = distinct !{!23, !13}
!24 = distinct !{!24, !13}
!25 = !{!15, !6, i64 32}


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