; LLVM IR from freakout42/macrocalc :: arx/src (dbf_crea)

; 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.DBF = type { [1024 x i8], [1024 x i8], ptr, ptr, i32, i32, i8, i8, i8, i8, i8, i8, i8, i32, i32, i8, ptr, ptr, %struct.DBFPROLOG }
%struct.DBFPROLOG = type { i8, i8, i8, i8, i32, i16, i16, i16, i8, i8, [12 x i8], i8, [3 x i8] }
%struct.FIELD_RECORD = type { [11 x i8], i8, i32, i8, i8, [14 x i8] }

@.str = external hidden unnamed_addr constant [30 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @dbf_crea(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca i16, align 2
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 2, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.DBF, ptr %8, i32 0, i32 18
  %10 = getelementptr inbounds %struct.DBFPROLOG, ptr %9, i32 0, i32 0
  store i8 3, ptr %10, align 8, !tbaa !9
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.DBF, ptr %11, i32 0, i32 15
  %13 = load i8, ptr %12, align 8, !tbaa !14
  %14 = zext i8 %13 to i32
  %15 = mul i32 %14, 32
  %16 = add i32 32, %15
  %17 = add i32 %16, 1
  %18 = trunc i32 %17 to i16
  store i16 %18, ptr %5, align 2, !tbaa !15
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.DBF, ptr %19, i32 0, i32 18
  %21 = getelementptr inbounds %struct.DBFPROLOG, ptr %20, i32 0, i32 5
  %22 = load i16, ptr %21, align 8, !tbaa !16
  %23 = zext i16 %22 to i32
  %24 = load i16, ptr %5, align 2, !tbaa !15
  %25 = zext i16 %24 to i32
  %26 = icmp ne i32 %23, %25
  br i1 %26, label %27, label %42

27:                                               ; preds = %1
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.DBF, ptr %28, i32 0, i32 18
  %30 = getelementptr inbounds %struct.DBFPROLOG, ptr %29, i32 0, i32 5
  %31 = load i16, ptr %30, align 8, !tbaa !16
  %32 = zext i16 %31 to i32
  %33 = load i16, ptr %5, align 2, !tbaa !15
  %34 = zext i16 %33 to i32
  %35 = add nsw i32 %34, 1
  %36 = icmp ne i32 %32, %35
  br i1 %36, label %37, label %42

37:                                               ; preds = %27
  %38 = load i16, ptr %5, align 2, !tbaa !15
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.DBF, ptr %39, i32 0, i32 18
  %41 = getelementptr inbounds %struct.DBFPROLOG, ptr %40, i32 0, i32 5
  store i16 %38, ptr %41, align 8, !tbaa !16
  br label %42

42:                                               ; preds = %37, %27, %1
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.DBF, ptr %43, i32 0, i32 16
  %45 = load ptr, ptr %44, align 8, !tbaa !17
  store ptr %45, ptr %6, align 8, !tbaa !5
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.DBF, ptr %46, i32 0, i32 15
  %48 = load i8, ptr %47, align 8, !tbaa !14
  %49 = zext i8 %48 to i32
  %50 = mul i32 %49, 32
  %51 = zext i32 %50 to i64
  %52 = call noalias ptr @malloc(i64 noundef %51) #7
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.DBF, ptr %53, i32 0, i32 16
  store ptr %52, ptr %54, align 8, !tbaa !17
  %55 = icmp eq ptr %52, null
  br i1 %55, label %56, label %57

56:                                               ; preds = %42
  store i32 8, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %222

57:                                               ; preds = %42
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.DBF, ptr %58, i32 0, i32 18
  %60 = getelementptr inbounds %struct.DBFPROLOG, ptr %59, i32 0, i32 6
  %61 = load i16, ptr %60, align 2, !tbaa !18
  %62 = zext i16 %61 to i32
  %63 = add nsw i32 %62, 1
  %64 = sext i32 %63 to i64
  %65 = call noalias ptr @malloc(i64 noundef %64) #7
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.DBF, ptr %66, i32 0, i32 17
  store ptr %65, ptr %67, align 8, !tbaa !19
  %68 = icmp eq ptr %65, null
  br i1 %68, label %69, label %70

69:                                               ; preds = %57
  store i32 8, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %222

70:                                               ; preds = %57
  store i8 0, ptr %4, align 1, !tbaa !20
  store i16 1, ptr %5, align 2, !tbaa !15
  br label %71

71:                                               ; preds = %116, %70
  %72 = load i8, ptr %4, align 1, !tbaa !20
  %73 = zext i8 %72 to i32
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.DBF, ptr %74, i32 0, i32 15
  %76 = load i8, ptr %75, align 8, !tbaa !14
  %77 = zext i8 %76 to i32
  %78 = icmp slt i32 %73, %77
  br i1 %78, label %79, label %119

79:                                               ; preds = %71
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.DBF, ptr %80, i32 0, i32 16
  %82 = load ptr, ptr %81, align 8, !tbaa !17
  %83 = load i8, ptr %4, align 1, !tbaa !20
  %84 = zext i8 %83 to i64
  %85 = getelementptr inbounds %struct.FIELD_RECORD, ptr %82, i64 %84
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.FIELD_RECORD, ptr %86, i32 1
  store ptr %87, ptr %6, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %85, ptr align 4 %86, i64 32, i1 false), !tbaa.struct !21
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.DBF, ptr %88, i32 0, i32 16
  %90 = load ptr, ptr %89, align 8, !tbaa !17
  %91 = load i8, ptr %4, align 1, !tbaa !20
  %92 = zext i8 %91 to i64
  %93 = getelementptr inbounds %struct.FIELD_RECORD, ptr %90, i64 %92
  %94 = getelementptr inbounds %struct.FIELD_RECORD, ptr %93, i32 0, i32 3
  %95 = load i8, ptr %94, align 4, !tbaa !23
  %96 = zext i8 %95 to i32
  %97 = load i16, ptr %5, align 2, !tbaa !15
  %98 = zext i16 %97 to i32
  %99 = add nsw i32 %98, %96
  %100 = trunc i32 %99 to i16
  store i16 %100, ptr %5, align 2, !tbaa !15
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.DBF, ptr %101, i32 0, i32 16
  %103 = load ptr, ptr %102, align 8, !tbaa !17
  %104 = load i8, ptr %4, align 1, !tbaa !20
  %105 = zext i8 %104 to i64
  %106 = getelementptr inbounds %struct.FIELD_RECORD, ptr %103, i64 %105
  %107 = getelementptr inbounds %struct.FIELD_RECORD, ptr %106, i32 0, i32 2
  store i32 0, ptr %107, align 4, !tbaa !25
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.DBF, ptr %108, i32 0, i32 16
  %110 = load ptr, ptr %109, align 8, !tbaa !17
  %111 = load i8, ptr %4, align 1, !tbaa !20
  %112 = zext i8 %111 to i64
  %113 = getelementptr inbounds %struct.FIELD_RECORD, ptr %110, i64 %112
  %114 = getelementptr inbounds %struct.FIELD_RECORD, ptr %113, i32 0, i32 5
  %115 = getelementptr inbounds [14 x i8], ptr %114, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 2 %115, i8 0, i64 14, i1 false)
  br label %116

116:                                              ; preds = %79
  %117 = load i8, ptr %4, align 1, !tbaa !20
  %118 = add i8 %117, 1
  store i8 %118, ptr %4, align 1, !tbaa !20
  br label %71, !llvm.loop !26

119:                                              ; preds = %71
  %120 = load i16, ptr %5, align 2, !tbaa !15
  %121 = zext i16 %120 to i32
  %122 = load ptr, ptr %3, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.DBF, ptr %122, i32 0, i32 18
  %124 = getelementptr inbounds %struct.DBFPROLOG, ptr %123, i32 0, i32 6
  %125 = load i16, ptr %124, align 2, !tbaa !18
  %126 = zext i16 %125 to i32
  %127 = icmp ne i32 %121, %126
  br i1 %127, label %128, label %133

128:                                              ; preds = %119
  call void (ptr, ...) @lib_mesg(ptr noundef @.str)
  %129 = load i16, ptr %5, align 2, !tbaa !15
  %130 = load ptr, ptr %3, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.DBF, ptr %130, i32 0, i32 18
  %132 = getelementptr inbounds %struct.DBFPROLOG, ptr %131, i32 0, i32 6
  store i16 %129, ptr %132, align 2, !tbaa !18
  br label %133

133:                                              ; preds = %128, %119
  %134 = load ptr, ptr %3, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.DBF, ptr %134, i32 0, i32 18
  %136 = load ptr, ptr %3, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.DBF, ptr %136, i32 0, i32 2
  %138 = load ptr, ptr %137, align 8, !tbaa !28
  %139 = call i64 @fwrite(ptr noundef %135, i64 noundef 32, i64 noundef 1, ptr noundef %138)
  %140 = icmp ne i64 %139, 1
  br i1 %140, label %141, label %142

141:                                              ; preds = %133
  store i32 4, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %222

142:                                              ; preds = %133
  %143 = load ptr, ptr %3, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.DBF, ptr %143, i32 0, i32 16
  %145 = load ptr, ptr %144, align 8, !tbaa !17
  %146 = load ptr, ptr %3, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.DBF, ptr %146, i32 0, i32 15
  %148 = load i8, ptr %147, align 8, !tbaa !14
  %149 = zext i8 %148 to i64
  %150 = load ptr, ptr %3, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.DBF, ptr %150, i32 0, i32 2
  %152 = load ptr, ptr %151, align 8, !tbaa !28
  %153 = call i64 @fwrite(ptr noundef %145, i64 noundef 32, i64 noundef %149, ptr noundef %152)
  %154 = load ptr, ptr %3, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.DBF, ptr %154, i32 0, i32 15
  %156 = load i8, ptr %155, align 8, !tbaa !14
  %157 = zext i8 %156 to i64
  %158 = icmp ne i64 %153, %157
  br i1 %158, label %159, label %160

159:                                              ; preds = %142
  store i32 4, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %222

160:                                              ; preds = %142
  %161 = load ptr, ptr %3, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.DBF, ptr %161, i32 0, i32 2
  %163 = load ptr, ptr %162, align 8, !tbaa !28
  %164 = call i32 @fputc(i32 noundef 13, ptr noundef %163)
  %165 = load ptr, ptr %3, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.DBF, ptr %165, i32 0, i32 18
  %167 = getelementptr inbounds %struct.DBFPROLOG, ptr %166, i32 0, i32 5
  %168 = load i16, ptr %167, align 8, !tbaa !16
  %169 = zext i16 %168 to i32
  %170 = sub nsw i32 %169, 1
  %171 = load ptr, ptr %3, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.DBF, ptr %171, i32 0, i32 15
  %173 = load i8, ptr %172, align 8, !tbaa !14
  %174 = zext i8 %173 to i32
  %175 = mul i32 32, %174
  %176 = add i32 32, %175
  %177 = add i32 %176, 1
  %178 = icmp eq i32 %170, %177
  br i1 %178, label %179, label %184

179:                                              ; preds = %160
  %180 = load ptr, ptr %3, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.DBF, ptr %180, i32 0, i32 2
  %182 = load ptr, ptr %181, align 8, !tbaa !28
  %183 = call i32 @fputc(i32 noundef 0, ptr noundef %182)
  br label %184

184:                                              ; preds = %179, %160
  store i8 0, ptr %4, align 1, !tbaa !20
  store i16 1, ptr %5, align 2, !tbaa !15
  br label %185

185:                                              ; preds = %216, %184
  %186 = load i8, ptr %4, align 1, !tbaa !20
  %187 = zext i8 %186 to i32
  %188 = load ptr, ptr %3, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.DBF, ptr %188, i32 0, i32 15
  %190 = load i8, ptr %189, align 8, !tbaa !14
  %191 = zext i8 %190 to i32
  %192 = icmp slt i32 %187, %191
  br i1 %192, label %193, label %219

193:                                              ; preds = %185
  %194 = load i16, ptr %5, align 2, !tbaa !15
  %195 = zext i16 %194 to i32
  %196 = load ptr, ptr %3, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.DBF, ptr %196, i32 0, i32 16
  %198 = load ptr, ptr %197, align 8, !tbaa !17
  %199 = load i8, ptr %4, align 1, !tbaa !20
  %200 = zext i8 %199 to i64
  %201 = getelementptr inbounds %struct.FIELD_RECORD, ptr %198, i64 %200
  %202 = getelementptr inbounds %struct.FIELD_RECORD, ptr %201, i32 0, i32 2
  store i32 %195, ptr %202, align 4, !tbaa !25
  %203 = load ptr, ptr %3, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.DBF, ptr %203, i32 0, i32 16
  %205 = load ptr, ptr %204, align 8, !tbaa !17
  %206 = load i8, ptr %4, align 1, !tbaa !20
  %207 = zext i8 %206 to i64
  %208 = getelementptr inbounds %struct.FIELD_RECORD, ptr %205, i64 %207
  %209 = getelementptr inbounds %struct.FIELD_RECORD, ptr %208, i32 0, i32 3
  %210 = load i8, ptr %209, align 4, !tbaa !23
  %211 = zext i8 %210 to i32
  %212 = load i16, ptr %5, align 2, !tbaa !15
  %213 = zext i16 %212 to i32
  %214 = add nsw i32 %213, %211
  %215 = trunc i32 %214 to i16
  store i16 %215, ptr %5, align 2, !tbaa !15
  br label %216

216:                                              ; preds = %193
  %217 = load i8, ptr %4, align 1, !tbaa !20
  %218 = add i8 %217, 1
  store i8 %218, ptr %4, align 1, !tbaa !20
  br label %185, !llvm.loop !29

219:                                              ; preds = %185
  %220 = load ptr, ptr %3, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.DBF, ptr %220, i32 0, i32 5
  store i32 1, ptr %221, align 4, !tbaa !30
  store i32 0, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %222

222:                                              ; preds = %219, %159, %141, %69, %56
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 2, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #6
  %223 = load i32, ptr %2, align 4
  ret i32 %223
}

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

declare void @lib_mesg(ptr noundef, ...) #5

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #5

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

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

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 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 }
attributes #7 = { 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 = !{!10, !7, i64 2112}
!10 = !{!"DBF", !7, i64 0, !7, i64 1024, !6, i64 2048, !6, i64 2056, !11, i64 2064, !11, i64 2068, !7, i64 2072, !7, i64 2073, !7, i64 2074, !7, i64 2075, !7, i64 2076, !7, i64 2077, !7, i64 2078, !11, i64 2080, !11, i64 2084, !7, i64 2088, !6, i64 2096, !6, i64 2104, !12, i64 2112}
!11 = !{!"int", !7, i64 0}
!12 = !{!"DBFPROLOG", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !11, i64 4, !13, i64 8, !13, i64 10, !13, i64 12, !7, i64 14, !7, i64 15, !7, i64 16, !7, i64 28, !7, i64 29}
!13 = !{!"short", !7, i64 0}
!14 = !{!10, !7, i64 2088}
!15 = !{!13, !13, i64 0}
!16 = !{!10, !13, i64 2120}
!17 = !{!10, !6, i64 2096}
!18 = !{!10, !13, i64 2122}
!19 = !{!10, !6, i64 2104}
!20 = !{!7, !7, i64 0}
!21 = !{i64 0, i64 11, !20, i64 11, i64 1, !20, i64 12, i64 4, !22, i64 16, i64 1, !20, i64 17, i64 1, !20, i64 18, i64 14, !20}
!22 = !{!11, !11, i64 0}
!23 = !{!24, !7, i64 16}
!24 = !{!"FIELD_RECORD", !7, i64 0, !7, i64 11, !11, i64 12, !7, i64 16, !7, i64 17, !7, i64 18}
!25 = !{!24, !11, i64 12}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!10, !6, i64 2048}
!29 = distinct !{!29, !27}
!30 = !{!10, !11, i64 2068}


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

%struct.FIELD_RECORD = type { [11 x i8], i8, i32, i8, i8, [14 x i8] }

@.str = external hidden unnamed_addr constant [30 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 9) i32 @dbf_crea(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 2112
  store i8 3, ptr %2, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 2088
  %4 = load i8, ptr %3, align 8, !tbaa !13
  %5 = zext i8 %4 to i16
  %6 = shl nuw nsw i16 %5, 5
  %7 = add nuw nsw i16 %6, 33
  %8 = getelementptr inbounds i8, ptr %0, i64 2120
  %9 = load i16, ptr %8, align 8, !tbaa !14
  %.not = icmp eq i16 %9, %7
  %narrow = add nuw nsw i16 %6, 34
  %.not56 = icmp eq i16 %9, %narrow
  %or.cond = select i1 %.not, i1 true, i1 %.not56
  br i1 %or.cond, label %11, label %10

10:                                               ; preds = %1
  store i16 %7, ptr %8, align 8, !tbaa !14
  br label %11

11:                                               ; preds = %10, %1
  %12 = getelementptr inbounds i8, ptr %0, i64 2096
  %13 = load ptr, ptr %12, align 8, !tbaa !15
  %14 = zext i8 %4 to i64
  %15 = shl nuw nsw i64 %14, 5
  %16 = tail call noalias ptr @malloc(i64 noundef %15) #6
  store ptr %16, ptr %12, align 8, !tbaa !15
  %17 = icmp eq ptr %16, null
  br i1 %17, label %87, label %18

18:                                               ; preds = %11
  %19 = getelementptr inbounds i8, ptr %0, i64 2122
  %20 = load i16, ptr %19, align 2, !tbaa !16
  %21 = zext i16 %20 to i64
  %22 = add nuw nsw i64 %21, 1
  %23 = tail call noalias ptr @malloc(i64 noundef %22) #6
  %24 = getelementptr inbounds i8, ptr %0, i64 2104
  store ptr %23, ptr %24, align 8, !tbaa !17
  %25 = icmp eq ptr %23, null
  br i1 %25, label %87, label %.preheader

.preheader:                                       ; preds = %18
  %.not68 = icmp eq i8 %4, 0
  br i1 %.not68, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader ]
  %.062 = phi ptr [ %28, %.lr.ph ], [ %13, %.preheader ]
  %.05061 = phi i16 [ %34, %.lr.ph ], [ 1, %.preheader ]
  %26 = load ptr, ptr %12, align 8, !tbaa !15
  %27 = getelementptr inbounds %struct.FIELD_RECORD, ptr %26, i64 %indvars.iv
  %28 = getelementptr inbounds i8, ptr %.062, i64 32
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(32) %27, ptr noundef nonnull align 4 dereferenceable(32) %.062, i64 32, i1 false), !tbaa.struct !18
  %29 = load ptr, ptr %12, align 8, !tbaa !15
  %30 = getelementptr inbounds %struct.FIELD_RECORD, ptr %29, i64 %indvars.iv
  %31 = getelementptr inbounds i8, ptr %30, i64 16
  %32 = load i8, ptr %31, align 4, !tbaa !21
  %33 = zext i8 %32 to i16
  %34 = add i16 %.05061, %33
  %35 = getelementptr inbounds i8, ptr %30, i64 12
  store i32 0, ptr %35, align 4, !tbaa !23
  %36 = getelementptr inbounds %struct.FIELD_RECORD, ptr %29, i64 %indvars.iv, i32 5
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(14) %36, i8 0, i64 14, i1 false)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %37 = load i8, ptr %3, align 8, !tbaa !13
  %38 = zext i8 %37 to i64
  %39 = icmp ult i64 %indvars.iv.next, %38
  br i1 %39, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !24

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i16, ptr %19, align 2, !tbaa !16
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %40 = phi i16 [ %20, %.preheader ], [ %.pre, %._crit_edge.loopexit ]
  %.050.lcssa = phi i16 [ 1, %.preheader ], [ %34, %._crit_edge.loopexit ]
  %.not57 = icmp eq i16 %.050.lcssa, %40
  br i1 %.not57, label %42, label %41

41:                                               ; preds = %._crit_edge
  tail call void (ptr, ...) @lib_mesg(ptr noundef nonnull @.str) #7
  store i16 %.050.lcssa, ptr %19, align 2, !tbaa !16
  br label %42

42:                                               ; preds = %41, %._crit_edge
  %43 = getelementptr inbounds i8, ptr %0, i64 2048
  %44 = load ptr, ptr %43, align 8, !tbaa !26
  %45 = tail call i64 @fwrite(ptr noundef nonnull %2, i64 noundef 32, i64 noundef 1, ptr noundef %44)
  %.not58 = icmp eq i64 %45, 1
  br i1 %.not58, label %46, label %87

46:                                               ; preds = %42
  %47 = load ptr, ptr %12, align 8, !tbaa !15
  %48 = load i8, ptr %3, align 8, !tbaa !13
  %49 = zext i8 %48 to i64
  %50 = load ptr, ptr %43, align 8, !tbaa !26
  %51 = tail call i64 @fwrite(ptr noundef %47, i64 noundef 32, i64 noundef %49, ptr noundef %50)
  %52 = load i8, ptr %3, align 8, !tbaa !13
  %53 = zext i8 %52 to i64
  %.not59 = icmp eq i64 %51, %53
  br i1 %.not59, label %54, label %87

54:                                               ; preds = %46
  %55 = load ptr, ptr %43, align 8, !tbaa !26
  %56 = tail call i32 @fputc(i32 noundef 13, ptr noundef %55)
  %57 = load i16, ptr %8, align 8, !tbaa !14
  %58 = zext i16 %57 to i32
  %59 = load i8, ptr %3, align 8, !tbaa !13
  %60 = zext i8 %59 to i32
  %61 = shl nuw nsw i32 %60, 5
  %62 = add nuw nsw i32 %61, 34
  %63 = icmp eq i32 %62, %58
  br i1 %63, label %64, label %67

64:                                               ; preds = %54
  %65 = load ptr, ptr %43, align 8, !tbaa !26
  %66 = tail call i32 @fputc(i32 noundef 0, ptr noundef %65)
  %.pre74 = load i8, ptr %3, align 8, !tbaa !13
  br label %67

67:                                               ; preds = %64, %54
  %68 = phi i8 [ %.pre74, %64 ], [ %59, %54 ]
  %.not69 = icmp eq i8 %68, 0
  br i1 %.not69, label %._crit_edge67, label %.lr.ph66

.lr.ph66:                                         ; preds = %67
  %69 = load ptr, ptr %12, align 8, !tbaa !15
  %wide.trip.count = zext i8 %68 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %70 = icmp eq i8 %68, 1
  br i1 %70, label %._crit_edge67.loopexit.unr-lcssa, label %.lr.ph66.new

.lr.ph66.new:                                     ; preds = %.lr.ph66
  %unroll_iter = and i64 %wide.trip.count, 254
  br label %71

71:                                               ; preds = %71, %.lr.ph66.new
  %indvars.iv71 = phi i64 [ 0, %.lr.ph66.new ], [ %indvars.iv.next72.1, %71 ]
  %.164 = phi i32 [ 1, %.lr.ph66.new ], [ %83, %71 ]
  %niter = phi i64 [ 0, %.lr.ph66.new ], [ %niter.next.1, %71 ]
  %72 = and i32 %.164, 65535
  %73 = getelementptr inbounds %struct.FIELD_RECORD, ptr %69, i64 %indvars.iv71, i32 2
  store i32 %72, ptr %73, align 4, !tbaa !23
  %74 = getelementptr inbounds %struct.FIELD_RECORD, ptr %69, i64 %indvars.iv71, i32 3
  %75 = load i8, ptr %74, align 4, !tbaa !21
  %76 = zext i8 %75 to i32
  %77 = add nsw i32 %.164, %76
  %indvars.iv.next72 = or disjoint i64 %indvars.iv71, 1
  %78 = and i32 %77, 65535
  %79 = getelementptr inbounds %struct.FIELD_RECORD, ptr %69, i64 %indvars.iv.next72, i32 2
  store i32 %78, ptr %79, align 4, !tbaa !23
  %80 = getelementptr inbounds %struct.FIELD_RECORD, ptr %69, i64 %indvars.iv.next72, i32 3
  %81 = load i8, ptr %80, align 4, !tbaa !21
  %82 = zext i8 %81 to i32
  %83 = add nuw nsw i32 %78, %82
  %indvars.iv.next72.1 = add nuw nsw i64 %indvars.iv71, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge67.loopexit.unr-lcssa.loopexit, label %71, !llvm.loop !27

._crit_edge67.loopexit.unr-lcssa.loopexit:        ; preds = %71
  %84 = and i32 %83, 65535
  br label %._crit_edge67.loopexit.unr-lcssa

._crit_edge67.loopexit.unr-lcssa:                 ; preds = %._crit_edge67.loopexit.unr-lcssa.loopexit, %.lr.ph66
  %indvars.iv71.unr = phi i64 [ 0, %.lr.ph66 ], [ %indvars.iv.next72.1, %._crit_edge67.loopexit.unr-lcssa.loopexit ]
  %.164.unr = phi i32 [ 1, %.lr.ph66 ], [ %84, %._crit_edge67.loopexit.unr-lcssa.loopexit ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge67, label %._crit_edge67.loopexit.epilog-lcssa

._crit_edge67.loopexit.epilog-lcssa:              ; preds = %._crit_edge67.loopexit.unr-lcssa
  %85 = getelementptr inbounds %struct.FIELD_RECORD, ptr %69, i64 %indvars.iv71.unr, i32 2
  store i32 %.164.unr, ptr %85, align 4, !tbaa !23
  br label %._crit_edge67

._crit_edge67:                                    ; preds = %._crit_edge67.loopexit.epilog-lcssa, %._crit_edge67.loopexit.unr-lcssa, %67
  %86 = getelementptr inbounds i8, ptr %0, i64 2068
  store i32 1, ptr %86, align 4, !tbaa !28
  br label %87

87:                                               ; preds = %46, %42, %18, %11, %._crit_edge67
  %.053 = phi i32 [ 0, %._crit_edge67 ], [ 8, %11 ], [ 8, %18 ], [ 4, %42 ], [ 4, %46 ]
  ret i32 %.053
}

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

declare void @lib_mesg(ptr noundef, ...) local_unnamed_addr #4

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { "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 = { nounwind allocsize(0) }
attributes #7 = { 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, !7, i64 2112}
!6 = !{!"DBF", !7, i64 0, !7, i64 1024, !9, i64 2048, !9, i64 2056, !10, i64 2064, !10, i64 2068, !7, i64 2072, !7, i64 2073, !7, i64 2074, !7, i64 2075, !7, i64 2076, !7, i64 2077, !7, i64 2078, !10, i64 2080, !10, i64 2084, !7, i64 2088, !9, i64 2096, !9, i64 2104, !11, i64 2112}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!"DBFPROLOG", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !10, i64 4, !12, i64 8, !12, i64 10, !12, i64 12, !7, i64 14, !7, i64 15, !7, i64 16, !7, i64 28, !7, i64 29}
!12 = !{!"short", !7, i64 0}
!13 = !{!6, !7, i64 2088}
!14 = !{!6, !12, i64 2120}
!15 = !{!6, !9, i64 2096}
!16 = !{!6, !12, i64 2122}
!17 = !{!6, !9, i64 2104}
!18 = !{i64 0, i64 11, !19, i64 11, i64 1, !19, i64 12, i64 4, !20, i64 16, i64 1, !19, i64 17, i64 1, !19, i64 18, i64 14, !19}
!19 = !{!7, !7, i64 0}
!20 = !{!10, !10, i64 0}
!21 = !{!22, !7, i64 16}
!22 = !{!"FIELD_RECORD", !7, i64 0, !7, i64 11, !10, i64 12, !7, i64 16, !7, i64 17, !7, i64 18}
!23 = !{!22, !10, i64 12}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!6, !9, i64 2048}
!27 = distinct !{!27, !25}
!28 = !{!6, !10, i64 2068}


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