; LLVM IR from hydrabus/hydrafw :: src/build-scripts (hex2dfu)

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @ihex2bin_buf(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca [512 x i8], align 16
  %17 = alloca [256 x i8], align 16
  %18 = alloca i8, align 1
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 0, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  store i32 0, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.start.p0(i64 512, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 256, ptr %17) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #8
  store i8 0, ptr %18, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  store ptr null, ptr %19, align 8, !tbaa !5
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 131072, ptr %22, align 4, !tbaa !9
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = load i32, ptr %23, align 4, !tbaa !9
  %25 = zext i32 %24 to i64
  %26 = call noalias ptr @malloc(i64 noundef %25) #9
  store ptr %26, ptr %19, align 8, !tbaa !5
  %27 = load ptr, ptr %19, align 8, !tbaa !5
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %31

29:                                               ; preds = %4
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 -2, ptr %30, align 4, !tbaa !9
  store ptr null, ptr %5, align 8
  store i32 1, ptr %20, align 4
  br label %209

31:                                               ; preds = %4
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 0, ptr %32, align 4, !tbaa !9
  br label %33

33:                                               ; preds = %203, %31
  %34 = getelementptr inbounds [512 x i8], ptr %16, i64 0, i64 0
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = call ptr @fgets(ptr noundef %34, i32 noundef 512, ptr noundef %35)
  %37 = icmp ne ptr %36, null
  br i1 %37, label %38, label %206

38:                                               ; preds = %33
  %39 = getelementptr inbounds [512 x i8], ptr %16, i64 0, i64 0
  %40 = load i8, ptr %39, align 16, !tbaa !11
  %41 = sext i8 %40 to i32
  %42 = icmp eq i32 %41, 58
  br i1 %42, label %43, label %203

43:                                               ; preds = %38
  %44 = getelementptr inbounds [512 x i8], ptr %16, i64 0, i64 0
  %45 = call i64 @strlen(ptr noundef %44) #10
  %46 = sub i64 %45, 2
  %47 = trunc i64 %46 to i32
  store i32 %47, ptr %12, align 4, !tbaa !9
  %48 = getelementptr inbounds [256 x i8], ptr %17, i64 0, i64 0
  %49 = getelementptr inbounds [512 x i8], ptr %16, i64 0, i64 0
  %50 = getelementptr inbounds i8, ptr %49, i64 1
  %51 = load i32, ptr %12, align 4, !tbaa !9
  %52 = call i32 @hex2bin(ptr noundef %48, ptr noundef %50, i32 noundef %51)
  %53 = getelementptr inbounds [256 x i8], ptr %17, i64 0, i64 0
  %54 = load i32, ptr %12, align 4, !tbaa !9
  %55 = udiv i32 %54, 2
  %56 = call i32 @check_checksum(ptr noundef %53, i32 noundef %55)
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %58, label %199

58:                                               ; preds = %43
  %59 = getelementptr inbounds [256 x i8], ptr %17, i64 0, i64 0
  %60 = load i8, ptr %59, align 16, !tbaa !11
  %61 = zext i8 %60 to i32
  %62 = icmp eq i32 %61, 2
  br i1 %62, label %63, label %88

63:                                               ; preds = %58
  %64 = getelementptr inbounds [256 x i8], ptr %17, i64 0, i64 1
  %65 = load i8, ptr %64, align 1, !tbaa !11
  %66 = zext i8 %65 to i32
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %68, label %88

68:                                               ; preds = %63
  %69 = getelementptr inbounds [256 x i8], ptr %17, i64 0, i64 2
  %70 = load i8, ptr %69, align 2, !tbaa !11
  %71 = zext i8 %70 to i32
  %72 = icmp eq i32 %71, 0
  br i1 %72, label %73, label %88

73:                                               ; preds = %68
  %74 = getelementptr inbounds [256 x i8], ptr %17, i64 0, i64 3
  %75 = load i8, ptr %74, align 1, !tbaa !11
  %76 = zext i8 %75 to i32
  %77 = icmp eq i32 %76, 4
  br i1 %77, label %78, label %88

78:                                               ; preds = %73
  %79 = getelementptr inbounds [256 x i8], ptr %17, i64 0, i64 4
  %80 = load i8, ptr %79, align 4, !tbaa !11
  %81 = zext i8 %80 to i32
  %82 = shl i32 %81, 24
  %83 = getelementptr inbounds [256 x i8], ptr %17, i64 0, i64 5
  %84 = load i8, ptr %83, align 1, !tbaa !11
  %85 = zext i8 %84 to i32
  %86 = shl i32 %85, 16
  %87 = or i32 %82, %86
  store i32 %87, ptr %13, align 4, !tbaa !9
  br label %198

88:                                               ; preds = %73, %68, %63, %58
  %89 = getelementptr inbounds [256 x i8], ptr %17, i64 0, i64 0
  %90 = load i8, ptr %89, align 16, !tbaa !11
  %91 = zext i8 %90 to i32
  %92 = icmp eq i32 %91, 0
  br i1 %92, label %93, label %112

93:                                               ; preds = %88
  %94 = getelementptr inbounds [256 x i8], ptr %17, i64 0, i64 1
  %95 = load i8, ptr %94, align 1, !tbaa !11
  %96 = zext i8 %95 to i32
  %97 = icmp eq i32 %96, 0
  br i1 %97, label %98, label %112

98:                                               ; preds = %93
  %99 = getelementptr inbounds [256 x i8], ptr %17, i64 0, i64 2
  %100 = load i8, ptr %99, align 2, !tbaa !11
  %101 = zext i8 %100 to i32
  %102 = icmp eq i32 %101, 0
  br i1 %102, label %103, label %112

103:                                              ; preds = %98
  %104 = getelementptr inbounds [256 x i8], ptr %17, i64 0, i64 3
  %105 = load i8, ptr %104, align 1, !tbaa !11
  %106 = zext i8 %105 to i32
  %107 = icmp eq i32 %106, 1
  br i1 %107, label %108, label %112

108:                                              ; preds = %103
  %109 = load i32, ptr %11, align 4, !tbaa !9
  %110 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 %109, ptr %110, align 4, !tbaa !9
  %111 = load ptr, ptr %19, align 8, !tbaa !5
  store ptr %111, ptr %5, align 8
  store i32 1, ptr %20, align 4
  br label %209

112:                                              ; preds = %103, %98, %93, %88
  %113 = getelementptr inbounds [256 x i8], ptr %17, i64 0, i64 3
  %114 = load i8, ptr %113, align 1, !tbaa !11
  %115 = zext i8 %114 to i32
  %116 = icmp eq i32 %115, 0
  br i1 %116, label %117, label %196

117:                                              ; preds = %112
  %118 = load i32, ptr %13, align 4, !tbaa !9
  %119 = getelementptr inbounds [256 x i8], ptr %17, i64 0, i64 1
  %120 = load i8, ptr %119, align 1, !tbaa !11
  %121 = zext i8 %120 to i32
  %122 = shl i32 %121, 8
  %123 = getelementptr inbounds [256 x i8], ptr %17, i64 0, i64 2
  %124 = load i8, ptr %123, align 2, !tbaa !11
  %125 = zext i8 %124 to i32
  %126 = or i32 %122, %125
  %127 = add i32 %118, %126
  store i32 %127, ptr %14, align 4, !tbaa !9
  %128 = load i8, ptr %18, align 1, !tbaa !11
  %129 = zext i8 %128 to i32
  %130 = icmp eq i32 %129, 0
  br i1 %130, label %131, label %134

131:                                              ; preds = %117
  %132 = load i32, ptr %14, align 4, !tbaa !9
  %133 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 %132, ptr %133, align 4, !tbaa !9
  store i8 1, ptr %18, align 1, !tbaa !11
  br label %134

134:                                              ; preds = %131, %117
  %135 = load i32, ptr %14, align 4, !tbaa !9
  %136 = load i32, ptr %9, align 4, !tbaa !9
  %137 = icmp uge i32 %135, %136
  br i1 %137, label %138, label %142

138:                                              ; preds = %134
  %139 = load i32, ptr %11, align 4, !tbaa !9
  %140 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 %139, ptr %140, align 4, !tbaa !9
  %141 = load ptr, ptr %19, align 8, !tbaa !5
  store ptr %141, ptr %5, align 8
  store i32 1, ptr %20, align 4
  br label %209

142:                                              ; preds = %134
  %143 = load ptr, ptr %6, align 8, !tbaa !5
  %144 = load i32, ptr %143, align 4, !tbaa !9
  %145 = load i32, ptr %14, align 4, !tbaa !9
  %146 = sub i32 %145, %144
  store i32 %146, ptr %14, align 4, !tbaa !9
  %147 = getelementptr inbounds [256 x i8], ptr %17, i64 0, i64 0
  %148 = load i8, ptr %147, align 16, !tbaa !11
  %149 = zext i8 %148 to i32
  store i32 %149, ptr %15, align 4, !tbaa !9
  %150 = load i32, ptr %14, align 4, !tbaa !9
  %151 = load i32, ptr %15, align 4, !tbaa !9
  %152 = add i32 %150, %151
  %153 = load ptr, ptr %7, align 8, !tbaa !5
  %154 = load i32, ptr %153, align 4, !tbaa !9
  %155 = icmp ugt i32 %152, %154
  br i1 %155, label %156, label %177

156:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %157 = load ptr, ptr %19, align 8, !tbaa !5
  %158 = load ptr, ptr %7, align 8, !tbaa !5
  %159 = load i32, ptr %158, align 4, !tbaa !9
  %160 = add i32 %159, 8192
  %161 = zext i32 %160 to i64
  %162 = call ptr @realloc(ptr noundef %157, i64 noundef %161) #11
  store ptr %162, ptr %21, align 8, !tbaa !5
  %163 = load ptr, ptr %21, align 8, !tbaa !5
  %164 = icmp eq ptr %163, null
  br i1 %164, label %165, label %168

165:                                              ; preds = %156
  %166 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 -2, ptr %166, align 4, !tbaa !9
  %167 = load ptr, ptr %19, align 8, !tbaa !5
  call void @free(ptr noundef %167) #8
  store ptr null, ptr %5, align 8
  store i32 1, ptr %20, align 4
  br label %174

168:                                              ; preds = %156
  %169 = load ptr, ptr %7, align 8, !tbaa !5
  %170 = load i32, ptr %169, align 4, !tbaa !9
  %171 = add i32 %170, 8192
  store i32 %171, ptr %169, align 4, !tbaa !9
  %172 = load ptr, ptr %21, align 8, !tbaa !5
  store ptr %172, ptr %19, align 8, !tbaa !5
  br label %173

173:                                              ; preds = %168
  store i32 0, ptr %20, align 4
  br label %174

174:                                              ; preds = %173, %165
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  %175 = load i32, ptr %20, align 4
  switch i32 %175, label %209 [
    i32 0, label %176
  ]

176:                                              ; preds = %174
  br label %177

177:                                              ; preds = %176, %142
  %178 = load ptr, ptr %19, align 8, !tbaa !5
  %179 = load i32, ptr %14, align 4, !tbaa !9
  %180 = zext i32 %179 to i64
  %181 = getelementptr inbounds i8, ptr %178, i64 %180
  %182 = getelementptr inbounds [256 x i8], ptr %17, i64 0, i64 0
  %183 = getelementptr inbounds i8, ptr %182, i64 4
  %184 = load i32, ptr %15, align 4, !tbaa !9
  %185 = zext i32 %184 to i64
  call void @llvm.memmove.p0.p0.i64(ptr align 1 %181, ptr align 1 %183, i64 %185, i1 false)
  %186 = load i32, ptr %14, align 4, !tbaa !9
  %187 = load i32, ptr %15, align 4, !tbaa !9
  %188 = add i32 %186, %187
  %189 = load i32, ptr %11, align 4, !tbaa !9
  %190 = icmp ugt i32 %188, %189
  br i1 %190, label %191, label %195

191:                                              ; preds = %177
  %192 = load i32, ptr %14, align 4, !tbaa !9
  %193 = load i32, ptr %15, align 4, !tbaa !9
  %194 = add i32 %192, %193
  store i32 %194, ptr %11, align 4, !tbaa !9
  br label %195

195:                                              ; preds = %191, %177
  br label %196

196:                                              ; preds = %195, %112
  br label %197

197:                                              ; preds = %196
  br label %198

198:                                              ; preds = %197, %78
  br label %202

199:                                              ; preds = %43
  %200 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 -1, ptr %200, align 4, !tbaa !9
  %201 = load ptr, ptr %19, align 8, !tbaa !5
  call void @free(ptr noundef %201) #8
  store ptr null, ptr %5, align 8
  store i32 1, ptr %20, align 4
  br label %209

202:                                              ; preds = %198
  br label %203

203:                                              ; preds = %202, %38
  %204 = load i32, ptr %10, align 4, !tbaa !9
  %205 = add i32 %204, 1
  store i32 %205, ptr %10, align 4, !tbaa !9
  br label %33, !llvm.loop !12

206:                                              ; preds = %33
  %207 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 -3, ptr %207, align 4, !tbaa !9
  %208 = load ptr, ptr %19, align 8, !tbaa !5
  call void @free(ptr noundef %208) #8
  store ptr null, ptr %5, align 8
  store i32 1, ptr %20, align 4
  br label %209

209:                                              ; preds = %206, %199, %174, %138, %108, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 256, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 512, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  %210 = load ptr, ptr %5, align 8
  ret ptr %210
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #2

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @hex2bin(ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @check_checksum(ptr noundef, i32 noundef) #1

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

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

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #6

; Function Attrs: nounwind
declare void @free(ptr noundef) #7

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

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

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


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

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

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

; Function Attrs: nounwind uwtable
define dso_local noalias ptr @ihex2bin_buf(ptr nocapture noundef %0, ptr nocapture noundef %1, ptr nocapture noundef %2, i32 noundef %3) local_unnamed_addr #1 {
  %5 = alloca [512 x i8], align 16
  %6 = alloca [256 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %5) #9
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %6) #9
  store i32 131072, ptr %1, align 4, !tbaa !5
  %7 = tail call noalias dereferenceable_or_null(131072) ptr @malloc(i64 noundef 131072) #10
  %8 = icmp eq ptr %7, null
  br i1 %8, label %9, label %10

9:                                                ; preds = %4
  store i32 -2, ptr %1, align 4, !tbaa !5
  br label %83

10:                                               ; preds = %4
  store i32 0, ptr %0, align 4, !tbaa !5
  %11 = call ptr @fgets(ptr noundef nonnull %5, i32 noundef 512, ptr noundef %2)
  %.not98 = icmp eq ptr %11, null
  br i1 %.not98, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %10
  %12 = getelementptr inbounds i8, ptr %5, i64 1
  %13 = getelementptr inbounds i8, ptr %6, i64 1
  %14 = getelementptr inbounds i8, ptr %6, i64 2
  %15 = getelementptr inbounds i8, ptr %6, i64 3
  %16 = getelementptr inbounds i8, ptr %6, i64 4
  %17 = getelementptr inbounds i8, ptr %6, i64 5
  br label %18

18:                                               ; preds = %.lr.ph, %81
  %.070102 = phi ptr [ %7, %.lr.ph ], [ %.373, %81 ]
  %.074101 = phi i8 [ 0, %.lr.ph ], [ %.276, %81 ]
  %.078100 = phi i32 [ 0, %.lr.ph ], [ %.179, %81 ]
  %.08099 = phi i32 [ 0, %.lr.ph ], [ %.181, %81 ]
  %19 = load i8, ptr %5, align 16, !tbaa !9
  %20 = icmp eq i8 %19, 58
  br i1 %20, label %21, label %81

21:                                               ; preds = %18
  %22 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %5) #11
  %23 = trunc i64 %22 to i32
  %24 = add i32 %23, -2
  %25 = call i32 @hex2bin(ptr noundef nonnull %6, ptr noundef nonnull %12, i32 noundef %24)
  %26 = lshr i32 %24, 1
  %27 = call i32 @check_checksum(ptr noundef nonnull %6, i32 noundef %26)
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %80

29:                                               ; preds = %21
  %30 = load i8, ptr %6, align 16, !tbaa !9
  %31 = icmp eq i8 %30, 2
  %32 = load i8, ptr %13, align 1
  %33 = zext i8 %32 to i32
  %34 = icmp eq i8 %32, 0
  %or.cond = select i1 %31, i1 %34, i1 false
  %35 = load i8, ptr %14, align 2
  %36 = zext i8 %35 to i32
  %37 = icmp eq i8 %35, 0
  %or.cond7 = select i1 %or.cond, i1 %37, i1 false
  %38 = load i8, ptr %15, align 1
  %39 = icmp eq i8 %38, 4
  %or.cond11 = select i1 %or.cond7, i1 %39, i1 false
  br i1 %or.cond11, label %40, label %48

40:                                               ; preds = %29
  %41 = load i8, ptr %16, align 4, !tbaa !9
  %42 = zext i8 %41 to i32
  %43 = shl nuw i32 %42, 24
  %44 = load i8, ptr %17, align 1, !tbaa !9
  %45 = zext i8 %44 to i32
  %46 = shl nuw nsw i32 %45, 16
  %47 = or disjoint i32 %46, %43
  br label %81

48:                                               ; preds = %29
  %49 = icmp eq i8 %30, 0
  %or.cond15 = select i1 %49, i1 %34, i1 false
  %or.cond19 = select i1 %or.cond15, i1 %37, i1 false
  %50 = icmp eq i8 %38, 1
  %or.cond23 = select i1 %or.cond19, i1 %50, i1 false
  br i1 %or.cond23, label %51, label %52

51:                                               ; preds = %48
  store i32 %.08099, ptr %1, align 4, !tbaa !5
  br label %83

52:                                               ; preds = %48
  %53 = icmp eq i8 %38, 0
  br i1 %53, label %54, label %81

54:                                               ; preds = %52
  %55 = shl nuw nsw i32 %33, 8
  %56 = or disjoint i32 %55, %36
  %57 = add i32 %56, %.078100
  %58 = icmp eq i8 %.074101, 0
  br i1 %58, label %59, label %60

59:                                               ; preds = %54
  store i32 %57, ptr %0, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %59, %54
  %.175 = phi i8 [ 1, %59 ], [ %.074101, %54 ]
  %.not87 = icmp ult i32 %57, %3
  br i1 %.not87, label %62, label %61

61:                                               ; preds = %60
  store i32 %.08099, ptr %1, align 4, !tbaa !5
  br label %83

62:                                               ; preds = %60
  %63 = load i32, ptr %0, align 4, !tbaa !5
  %64 = sub i32 %57, %63
  %65 = zext i8 %30 to i32
  %66 = add i32 %64, %65
  %67 = load i32, ptr %1, align 4, !tbaa !5
  %68 = icmp ugt i32 %66, %67
  br i1 %68, label %69, label %76

69:                                               ; preds = %62
  %70 = add i32 %67, 8192
  %71 = zext i32 %70 to i64
  %72 = call ptr @realloc(ptr noundef %.070102, i64 noundef %71) #12
  %.not88 = icmp eq ptr %72, null
  br i1 %.not88, label %.thread, label %73

.thread:                                          ; preds = %69
  store i32 -2, ptr %1, align 4, !tbaa !5
  call void @free(ptr noundef %.070102) #9
  br label %83

73:                                               ; preds = %69
  %74 = load i32, ptr %1, align 4, !tbaa !5
  %75 = add i32 %74, 8192
  store i32 %75, ptr %1, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %73, %62
  %.272 = phi ptr [ %72, %73 ], [ %.070102, %62 ]
  %77 = zext i32 %64 to i64
  %78 = getelementptr inbounds i8, ptr %.272, i64 %77
  %79 = zext i8 %30 to i64
  call void @llvm.memmove.p0.p0.i64(ptr align 1 %78, ptr nonnull align 4 %16, i64 %79, i1 false)
  %spec.select = call i32 @llvm.umax.i32(i32 %66, i32 %.08099)
  br label %81

80:                                               ; preds = %21
  store i32 -1, ptr %1, align 4, !tbaa !5
  call void @free(ptr noundef %.070102) #9
  br label %83

81:                                               ; preds = %76, %52, %40, %18
  %.181 = phi i32 [ %.08099, %40 ], [ %.08099, %52 ], [ %.08099, %18 ], [ %spec.select, %76 ]
  %.179 = phi i32 [ %47, %40 ], [ %.078100, %52 ], [ %.078100, %18 ], [ %.078100, %76 ]
  %.276 = phi i8 [ %.074101, %40 ], [ %.074101, %52 ], [ %.074101, %18 ], [ %.175, %76 ]
  %.373 = phi ptr [ %.070102, %40 ], [ %.070102, %52 ], [ %.070102, %18 ], [ %.272, %76 ]
  %82 = call ptr @fgets(ptr noundef nonnull %5, i32 noundef 512, ptr noundef %2)
  %.not = icmp eq ptr %82, null
  br i1 %.not, label %._crit_edge, label %18, !llvm.loop !10

._crit_edge:                                      ; preds = %81, %10
  %.070.lcssa = phi ptr [ %7, %10 ], [ %.373, %81 ]
  store i32 -3, ptr %1, align 4, !tbaa !5
  call void @free(ptr noundef %.070.lcssa) #9
  br label %83

83:                                               ; preds = %.thread, %._crit_edge, %80, %61, %51, %9
  %.4 = phi ptr [ null, %9 ], [ %.070102, %51 ], [ %.070102, %61 ], [ null, %80 ], [ null, %._crit_edge ], [ null, %.thread ]
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %5) #9
  ret ptr %.4
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #2

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

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

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

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

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

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #7

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

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

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

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


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