; LLVM IR from jingweizhanghuai/Morn :: src/util (morn_csv)

; 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.__va_list_tag = type { i32, i32, ptr, ptr }
%struct.HandleCSV = type { ptr, ptr, ptr, i32, i32, [256 x i8], i32, i32, ptr, ptr, ptr }
%struct.MArray = type { i32, i16, %union.anon }
%union.anon = type { ptr }
%struct.MList = type { i32, ptr }

; 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

declare ptr @mornMapRead(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) #1

declare ptr @m_MapWrite(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @CSVHandle(ptr noundef) #2

declare ptr @m_MapRead(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.va_start.p0(ptr) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.va_end.p0(ptr) #3

declare ptr @mListWrite(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @mCSVColAppend(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @mCSVRowAppend(ptr noundef, i64 noundef) #2

declare void @m_MapNodeDelete(ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @m_CSVWrite(ptr noundef %0, i64 noundef %1, i64 noundef %2, ptr noundef %3, ...) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca [1024 x i8], align 16
  %18 = alloca [1 x %struct.__va_list_tag], align 16
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i64 %1, ptr %7, align 8, !tbaa !9
  store i64 %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = call ptr @CSVHandle(ptr noundef %26)
  store ptr %27, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %28 = load i64, ptr %7, align 8, !tbaa !9
  %29 = icmp slt i64 %28, 0
  br i1 %29, label %30, label %37

30:                                               ; preds = %4
  %31 = load ptr, ptr %10, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.HandleCSV, ptr %31, i32 0, i32 4
  %33 = load i32, ptr %32, align 4, !tbaa !11
  store i32 %33, ptr %11, align 4, !tbaa !14
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = load i32, ptr %11, align 4, !tbaa !14
  %36 = sext i32 %35 to i64
  call void @mCSVRowAppend(ptr noundef %34, i64 noundef %36)
  br label %69

37:                                               ; preds = %4
  %38 = load i64, ptr %7, align 8, !tbaa !9
  %39 = load ptr, ptr %10, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.HandleCSV, ptr %39, i32 0, i32 4
  %41 = load i32, ptr %40, align 4, !tbaa !11
  %42 = sext i32 %41 to i64
  %43 = icmp sgt i64 %38, %42
  br i1 %43, label %44, label %65

44:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %45 = load i64, ptr %7, align 8, !tbaa !9
  %46 = inttoptr i64 %45 to ptr
  store ptr %46, ptr %14, align 8, !tbaa !5
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.HandleCSV, ptr %47, i32 0, i32 1
  %49 = load ptr, ptr %48, align 8, !tbaa !15
  %50 = load ptr, ptr %10, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.HandleCSV, ptr %50, i32 0, i32 6
  %52 = load i32, ptr %51, align 8, !tbaa !16
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds ptr, ptr %49, i64 %53
  %55 = load ptr, ptr %54, align 8, !tbaa !5
  %56 = load ptr, ptr %14, align 8, !tbaa !5
  %57 = call ptr @m_MapRead(ptr noundef %55, ptr noundef %56, i32 noundef -1, ptr noundef %11, ptr noundef null)
  store ptr %57, ptr %13, align 8, !tbaa !5
  %58 = load ptr, ptr %13, align 8, !tbaa !5
  %59 = icmp eq ptr %58, null
  br i1 %59, label %60, label %61

60:                                               ; preds = %44
  store ptr null, ptr %5, align 8
  store i32 1, ptr %15, align 4
  br label %62

61:                                               ; preds = %44
  store i32 0, ptr %15, align 4
  br label %62

62:                                               ; preds = %61, %60
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  %63 = load i32, ptr %15, align 4
  switch i32 %63, label %248 [
    i32 0, label %64
  ]

64:                                               ; preds = %62
  br label %68

65:                                               ; preds = %37
  %66 = load i64, ptr %7, align 8, !tbaa !9
  %67 = trunc i64 %66 to i32
  store i32 %67, ptr %11, align 4, !tbaa !14
  br label %68

68:                                               ; preds = %65, %64
  br label %69

69:                                               ; preds = %68, %30
  %70 = load i64, ptr %8, align 8, !tbaa !9
  %71 = icmp slt i64 %70, 0
  br i1 %71, label %72, label %78

72:                                               ; preds = %69
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.HandleCSV, ptr %73, i32 0, i32 3
  %75 = load i32, ptr %74, align 8, !tbaa !17
  store i32 %75, ptr %12, align 4, !tbaa !14
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = load i32, ptr %12, align 4, !tbaa !14
  call void @mCSVColAppend(ptr noundef %76, i32 noundef %77)
  br label %104

78:                                               ; preds = %69
  %79 = load i64, ptr %8, align 8, !tbaa !9
  %80 = load ptr, ptr %10, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.HandleCSV, ptr %80, i32 0, i32 3
  %82 = load i32, ptr %81, align 8, !tbaa !17
  %83 = sext i32 %82 to i64
  %84 = icmp sgt i64 %79, %83
  br i1 %84, label %85, label %100

85:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %86 = load i64, ptr %8, align 8, !tbaa !9
  %87 = inttoptr i64 %86 to ptr
  store ptr %87, ptr %16, align 8, !tbaa !5
  %88 = load ptr, ptr %10, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.HandleCSV, ptr %88, i32 0, i32 2
  %90 = load ptr, ptr %89, align 8, !tbaa !18
  %91 = load ptr, ptr %16, align 8, !tbaa !5
  %92 = call ptr @mornMapRead(ptr noundef %90, ptr noundef %91, i32 noundef -1, ptr noundef %12, ptr noundef null)
  store ptr %92, ptr %13, align 8, !tbaa !5
  %93 = load ptr, ptr %13, align 8, !tbaa !5
  %94 = icmp eq ptr %93, null
  br i1 %94, label %95, label %96

95:                                               ; preds = %85
  store ptr null, ptr %5, align 8
  store i32 1, ptr %15, align 4
  br label %97

96:                                               ; preds = %85
  store i32 0, ptr %15, align 4
  br label %97

97:                                               ; preds = %96, %95
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  %98 = load i32, ptr %15, align 4
  switch i32 %98, label %248 [
    i32 0, label %99
  ]

99:                                               ; preds = %97
  br label %103

100:                                              ; preds = %78
  %101 = load i64, ptr %8, align 8, !tbaa !9
  %102 = trunc i64 %101 to i32
  store i32 %102, ptr %12, align 4, !tbaa !14
  br label %103

103:                                              ; preds = %100, %99
  br label %104

104:                                              ; preds = %103, %72
  call void @llvm.lifetime.start.p0(i64 1024, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %18) #6
  %105 = getelementptr inbounds [1 x %struct.__va_list_tag], ptr %18, i64 0, i64 0
  call void @llvm.va_start.p0(ptr %105)
  %106 = getelementptr inbounds [1024 x i8], ptr %17, i64 0, i64 0
  %107 = getelementptr inbounds i8, ptr %106, i64 1
  %108 = load ptr, ptr %9, align 8, !tbaa !5
  %109 = getelementptr inbounds [1 x %struct.__va_list_tag], ptr %18, i64 0, i64 0
  %110 = call i32 @vsprintf(ptr noundef %107, ptr noundef %108, ptr noundef %109) #6
  %111 = getelementptr inbounds [1 x %struct.__va_list_tag], ptr %18, i64 0, i64 0
  call void @llvm.va_end.p0(ptr %111)
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %112 = getelementptr inbounds [1024 x i8], ptr %17, i64 0, i64 0
  %113 = getelementptr inbounds i8, ptr %112, i64 1
  %114 = call i64 @strlen(ptr noundef %113) #7
  %115 = trunc i64 %114 to i32
  store i32 %115, ptr %19, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 0, ptr %20, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 0, ptr %21, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 0, ptr %22, align 4, !tbaa !14
  br label %116

116:                                              ; preds = %140, %104
  %117 = load i32, ptr %22, align 4, !tbaa !14
  %118 = load i32, ptr %19, align 4, !tbaa !14
  %119 = icmp sle i32 %117, %118
  br i1 %119, label %121, label %120

120:                                              ; preds = %116
  store i32 2, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  br label %143

121:                                              ; preds = %116
  %122 = load i32, ptr %22, align 4, !tbaa !14
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [1024 x i8], ptr %17, i64 0, i64 %123
  %125 = load i8, ptr %124, align 1, !tbaa !19
  %126 = sext i8 %125 to i32
  %127 = icmp eq i32 %126, 44
  br i1 %127, label %128, label %129

128:                                              ; preds = %121
  store i32 1, ptr %20, align 4, !tbaa !14
  br label %129

129:                                              ; preds = %128, %121
  %130 = load i32, ptr %22, align 4, !tbaa !14
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1024 x i8], ptr %17, i64 0, i64 %131
  %133 = load i8, ptr %132, align 1, !tbaa !19
  %134 = sext i8 %133 to i32
  %135 = icmp eq i32 %134, 34
  br i1 %135, label %136, label %139

136:                                              ; preds = %129
  %137 = load i32, ptr %21, align 4, !tbaa !14
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %21, align 4, !tbaa !14
  br label %139

139:                                              ; preds = %136, %129
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %22, align 4, !tbaa !14
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %22, align 4, !tbaa !14
  br label %116, !llvm.loop !20

143:                                              ; preds = %120
  %144 = load i32, ptr %21, align 4, !tbaa !14
  %145 = icmp ne i32 %144, 0
  br i1 %145, label %146, label %151

146:                                              ; preds = %143
  %147 = load i32, ptr %21, align 4, !tbaa !14
  %148 = add nsw i32 %147, 2
  %149 = trunc i32 %148 to i8
  %150 = getelementptr inbounds [1024 x i8], ptr %17, i64 0, i64 0
  store i8 %149, ptr %150, align 16, !tbaa !19
  br label %155

151:                                              ; preds = %143
  %152 = load i32, ptr %20, align 4, !tbaa !14
  %153 = trunc i32 %152 to i8
  %154 = getelementptr inbounds [1024 x i8], ptr %17, i64 0, i64 0
  store i8 %153, ptr %154, align 16, !tbaa !19
  br label %155

155:                                              ; preds = %151, %146
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  %156 = load i32, ptr %11, align 4, !tbaa !14
  %157 = load ptr, ptr %10, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.HandleCSV, ptr %157, i32 0, i32 3
  %159 = load i32, ptr %158, align 8, !tbaa !17
  %160 = mul nsw i32 %156, %159
  %161 = load i32, ptr %12, align 4, !tbaa !14
  %162 = add nsw i32 %160, %161
  store i32 %162, ptr %23, align 4, !tbaa !14
  %163 = load ptr, ptr %10, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.HandleCSV, ptr %163, i32 0, i32 1
  %165 = load ptr, ptr %164, align 8, !tbaa !15
  %166 = load i32, ptr %12, align 4, !tbaa !14
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds ptr, ptr %165, i64 %167
  %169 = load ptr, ptr %168, align 8, !tbaa !5
  %170 = icmp ne ptr %169, null
  br i1 %170, label %171, label %223

171:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  %172 = load ptr, ptr %10, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.HandleCSV, ptr %172, i32 0, i32 0
  %174 = load ptr, ptr %173, align 8, !tbaa !22
  %175 = getelementptr inbounds %struct.MArray, ptr %174, i32 0, i32 2
  %176 = load ptr, ptr %175, align 8, !tbaa !19
  %177 = load i32, ptr %23, align 4, !tbaa !14
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds i32, ptr %176, i64 %178
  %180 = load i32, ptr %179, align 4, !tbaa !14
  store i32 %180, ptr %24, align 4, !tbaa !14
  %181 = load i32, ptr %24, align 4, !tbaa !14
  %182 = icmp sge i32 %181, 0
  br i1 %182, label %183, label %190

183:                                              ; preds = %171
  %184 = load ptr, ptr %10, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.HandleCSV, ptr %184, i32 0, i32 10
  %186 = load ptr, ptr %185, align 8, !tbaa !23
  %187 = load i32, ptr %24, align 4, !tbaa !14
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds i8, ptr %186, i64 %188
  store ptr %189, ptr %13, align 8, !tbaa !5
  br label %202

190:                                              ; preds = %171
  %191 = load ptr, ptr %10, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.HandleCSV, ptr %191, i32 0, i32 9
  %193 = load ptr, ptr %192, align 8, !tbaa !24
  %194 = getelementptr inbounds %struct.MList, ptr %193, i32 0, i32 1
  %195 = load ptr, ptr %194, align 8, !tbaa !25
  %196 = load i32, ptr %23, align 4, !tbaa !14
  %197 = sub nsw i32 -2, %196
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds ptr, ptr %195, i64 %198
  %200 = load ptr, ptr %199, align 8, !tbaa !5
  %201 = getelementptr inbounds i8, ptr %200, i64 1
  store ptr %201, ptr %13, align 8, !tbaa !5
  br label %202

202:                                              ; preds = %190, %183
  br label %203

203:                                              ; preds = %202
  %204 = load ptr, ptr %10, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.HandleCSV, ptr %204, i32 0, i32 1
  %206 = load ptr, ptr %205, align 8, !tbaa !15
  %207 = load i32, ptr %12, align 4, !tbaa !14
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds ptr, ptr %206, i64 %208
  %210 = load ptr, ptr %209, align 8, !tbaa !5
  %211 = load ptr, ptr %13, align 8, !tbaa !5
  call void @m_MapNodeDelete(ptr noundef %210, ptr noundef %211, i32 noundef -1)
  br label %212

212:                                              ; preds = %203
  br label %213

213:                                              ; preds = %212
  %214 = load ptr, ptr %10, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct.HandleCSV, ptr %214, i32 0, i32 1
  %216 = load ptr, ptr %215, align 8, !tbaa !15
  %217 = load i32, ptr %12, align 4, !tbaa !14
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds ptr, ptr %216, i64 %218
  %220 = load ptr, ptr %219, align 8, !tbaa !5
  %221 = getelementptr inbounds [1024 x i8], ptr %17, i64 0, i64 0
  %222 = call ptr @m_MapWrite(ptr noundef %220, ptr noundef %221, i32 noundef -1, ptr noundef %11, i32 noundef 4)
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %223

223:                                              ; preds = %213, %155
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  %224 = load ptr, ptr %10, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.HandleCSV, ptr %224, i32 0, i32 9
  %226 = load ptr, ptr %225, align 8, !tbaa !24
  %227 = getelementptr inbounds %struct.MList, ptr %226, i32 0, i32 0
  %228 = load i32, ptr %227, align 8, !tbaa !27
  store i32 %228, ptr %25, align 4, !tbaa !14
  %229 = load i32, ptr %25, align 4, !tbaa !14
  %230 = sub nsw i32 -2, %229
  %231 = load ptr, ptr %10, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.HandleCSV, ptr %231, i32 0, i32 0
  %233 = load ptr, ptr %232, align 8, !tbaa !22
  %234 = getelementptr inbounds %struct.MArray, ptr %233, i32 0, i32 2
  %235 = load ptr, ptr %234, align 8, !tbaa !19
  %236 = load i32, ptr %23, align 4, !tbaa !14
  %237 = sext i32 %236 to i64
  %238 = getelementptr inbounds i32, ptr %235, i64 %237
  store i32 %230, ptr %238, align 4, !tbaa !14
  %239 = load ptr, ptr %10, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct.HandleCSV, ptr %239, i32 0, i32 9
  %241 = load ptr, ptr %240, align 8, !tbaa !24
  %242 = load i32, ptr %25, align 4, !tbaa !14
  %243 = getelementptr inbounds [1024 x i8], ptr %17, i64 0, i64 0
  %244 = load i32, ptr %19, align 4, !tbaa !14
  %245 = add nsw i32 %244, 1
  %246 = call ptr @mListWrite(ptr noundef %241, i32 noundef %242, ptr noundef %243, i32 noundef %245)
  %247 = getelementptr inbounds i8, ptr %246, i64 1
  store ptr %247, ptr %5, align 8
  store i32 1, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 1024, ptr %17) #6
  br label %248

248:                                              ; preds = %223, %97, %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %249 = load ptr, ptr %5, align 8
  ret ptr %249
}

; Function Attrs: nounwind
declare i32 @vsprintf(ptr noundef, ptr noundef, ptr noundef) #4

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

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

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

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


; 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.__va_list_tag = type { i32, i32, ptr, ptr }

; 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

declare ptr @mornMapRead(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @m_MapWrite(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

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

declare ptr @m_MapRead(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.va_start.p0(ptr) #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.va_end.p0(ptr) #3

declare ptr @mListWrite(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

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

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

declare void @m_MapNodeDelete(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @m_CSVWrite(ptr noundef %0, i64 noundef %1, i64 noundef %2, ptr nocapture noundef readonly %3, ...) local_unnamed_addr #2 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca [1024 x i8], align 16
  %8 = alloca [1 x %struct.__va_list_tag], align 16
  %9 = tail call ptr @CSVHandle(ptr noundef %0)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %10 = icmp slt i64 %1, 0
  %11 = getelementptr inbounds i8, ptr %9, i64 28
  %12 = load i32, ptr %11, align 4, !tbaa !5
  br i1 %10, label %13, label %15

13:                                               ; preds = %4
  store i32 %12, ptr %5, align 4, !tbaa !11
  %14 = sext i32 %12 to i64
  tail call void @mCSVRowAppend(ptr noundef %0, i64 noundef %14)
  br label %30

15:                                               ; preds = %4
  %16 = sext i32 %12 to i64
  %17 = icmp slt i64 %16, %1
  br i1 %17, label %18, label %28

18:                                               ; preds = %15
  %19 = inttoptr i64 %1 to ptr
  %20 = getelementptr inbounds i8, ptr %9, i64 8
  %21 = load ptr, ptr %20, align 8, !tbaa !12
  %22 = getelementptr inbounds i8, ptr %9, i64 288
  %23 = load i32, ptr %22, align 8, !tbaa !13
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds ptr, ptr %21, i64 %24
  %26 = load ptr, ptr %25, align 8, !tbaa !14
  %27 = call ptr @m_MapRead(ptr noundef %26, ptr noundef %19, i32 noundef -1, ptr noundef nonnull %5, ptr noundef null) #7
  %.not = icmp eq ptr %27, null
  br i1 %.not, label %128, label %30

28:                                               ; preds = %15
  %29 = trunc nuw nsw i64 %1 to i32
  store i32 %29, ptr %5, align 4, !tbaa !11
  br label %30

30:                                               ; preds = %28, %18, %13
  %31 = icmp slt i64 %2, 0
  %32 = getelementptr inbounds i8, ptr %9, i64 24
  %33 = load i32, ptr %32, align 8, !tbaa !15
  br i1 %31, label %34, label %35

34:                                               ; preds = %30
  store i32 %33, ptr %6, align 4, !tbaa !11
  call void @mCSVColAppend(ptr noundef %0, i32 noundef %33)
  br label %45

35:                                               ; preds = %30
  %36 = sext i32 %33 to i64
  %37 = icmp slt i64 %36, %2
  br i1 %37, label %38, label %43

38:                                               ; preds = %35
  %39 = inttoptr i64 %2 to ptr
  %40 = getelementptr inbounds i8, ptr %9, i64 16
  %41 = load ptr, ptr %40, align 8, !tbaa !16
  %42 = call ptr @mornMapRead(ptr noundef %41, ptr noundef %39, i32 noundef -1, ptr noundef nonnull %6, ptr noundef null) #7
  %.not65 = icmp eq ptr %42, null
  br i1 %.not65, label %128, label %45

43:                                               ; preds = %35
  %44 = trunc nuw nsw i64 %2 to i32
  store i32 %44, ptr %6, align 4, !tbaa !11
  br label %45

45:                                               ; preds = %43, %38, %34
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #7
  call void @llvm.va_start.p0(ptr nonnull %8)
  %46 = getelementptr inbounds i8, ptr %7, i64 1
  %47 = call i32 @vsprintf(ptr noundef nonnull %46, ptr noundef %3, ptr noundef nonnull %8) #7
  call void @llvm.va_end.p0(ptr nonnull %8)
  %48 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %46) #8
  %49 = trunc i64 %48 to i32
  %.not6669 = icmp slt i32 %49, 0
  br i1 %.not6669, label %._crit_edge.thread, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %45
  %50 = add nuw nsw i64 %48, 1
  %wide.trip.count = and i64 %50, 4294967295
  %min.iters.check = icmp ult i64 %wide.trip.count, 8
  br i1 %min.iters.check, label %.lr.ph.preheader90, label %vector.ph

.lr.ph.preheader90:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %.05871.ph = phi i32 [ 0, %.lr.ph.preheader ], [ %66, %middle.block ]
  %.06070.ph = phi i32 [ 0, %.lr.ph.preheader ], [ %rdx.select, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.mod.vf = and i64 %50, 7
  %n.vec = sub nsw i64 %wide.trip.count, %n.mod.vf
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %63, %vector.body ]
  %vec.phi82 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %64, %vector.body ]
  %vec.phi83 = phi <4 x i1> [ zeroinitializer, %vector.ph ], [ %57, %vector.body ]
  %vec.phi84 = phi <4 x i1> [ zeroinitializer, %vector.ph ], [ %58, %vector.body ]
  %51 = getelementptr inbounds [1024 x i8], ptr %7, i64 0, i64 %index
  %52 = getelementptr inbounds i8, ptr %51, i64 4
  %wide.load = load <4 x i8>, ptr %51, align 8, !tbaa !17
  %wide.load85 = load <4 x i8>, ptr %52, align 4, !tbaa !17
  %53 = freeze <4 x i8> %wide.load
  %54 = freeze <4 x i8> %wide.load85
  %55 = icmp eq <4 x i8> %53, <i8 44, i8 44, i8 44, i8 44>
  %56 = icmp eq <4 x i8> %54, <i8 44, i8 44, i8 44, i8 44>
  %57 = or <4 x i1> %vec.phi83, %55
  %58 = or <4 x i1> %vec.phi84, %56
  %59 = icmp eq <4 x i8> %53, <i8 34, i8 34, i8 34, i8 34>
  %60 = icmp eq <4 x i8> %54, <i8 34, i8 34, i8 34, i8 34>
  %61 = zext <4 x i1> %59 to <4 x i32>
  %62 = zext <4 x i1> %60 to <4 x i32>
  %63 = add <4 x i32> %vec.phi, %61
  %64 = add <4 x i32> %vec.phi82, %62
  %index.next = add nuw i64 %index, 8
  %65 = icmp eq i64 %index.next, %n.vec
  br i1 %65, label %middle.block, label %vector.body, !llvm.loop !18

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %64, %63
  %66 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %bin.rdx86 = or <4 x i1> %58, %57
  %bin.rdx86.fr = freeze <4 x i1> %bin.rdx86
  %67 = bitcast <4 x i1> %bin.rdx86.fr to i4
  %.not89 = icmp ne i4 %67, 0
  %rdx.select = zext i1 %.not89 to i32
  %cmp.n = icmp eq i64 %n.mod.vf, 0
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader90

._crit_edge:                                      ; preds = %.lr.ph, %middle.block
  %spec.select.lcssa = phi i32 [ %rdx.select, %middle.block ], [ %spec.select, %.lr.ph ]
  %.159.lcssa = phi i32 [ %66, %middle.block ], [ %.159, %.lr.ph ]
  %.not67 = icmp eq i32 %.159.lcssa, 0
  %68 = add nuw nsw i32 %.159.lcssa, 2
  %spec.select80 = select i1 %.not67, i32 %spec.select.lcssa, i32 %68
  %69 = trunc i32 %spec.select80 to i8
  br label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %._crit_edge, %45
  %storemerge = phi i8 [ 0, %45 ], [ %69, %._crit_edge ]
  store i8 %storemerge, ptr %7, align 16, !tbaa !17
  %70 = load i32, ptr %5, align 4, !tbaa !11
  %71 = getelementptr inbounds i8, ptr %9, i64 24
  %72 = load i32, ptr %71, align 8, !tbaa !15
  %73 = mul nsw i32 %72, %70
  %74 = load i32, ptr %6, align 4, !tbaa !11
  %75 = add nsw i32 %73, %74
  %76 = getelementptr inbounds i8, ptr %9, i64 8
  %77 = load ptr, ptr %76, align 8, !tbaa !12
  %78 = sext i32 %74 to i64
  %79 = getelementptr inbounds ptr, ptr %77, i64 %78
  %80 = load ptr, ptr %79, align 8, !tbaa !14
  %.not68 = icmp eq ptr %80, null
  br i1 %.not68, label %._crit_edge._crit_edge, label %86

._crit_edge._crit_edge:                           ; preds = %._crit_edge.thread
  %.pre = sext i32 %75 to i64
  br label %116

.lr.ph:                                           ; preds = %.lr.ph.preheader90, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader90 ]
  %.05871 = phi i32 [ %.159, %.lr.ph ], [ %.05871.ph, %.lr.ph.preheader90 ]
  %.06070 = phi i32 [ %spec.select, %.lr.ph ], [ %.06070.ph, %.lr.ph.preheader90 ]
  %81 = getelementptr inbounds [1024 x i8], ptr %7, i64 0, i64 %indvars.iv
  %82 = load i8, ptr %81, align 1, !tbaa !17
  %.fr = freeze i8 %82
  %83 = icmp eq i8 %.fr, 44
  %spec.select = select i1 %83, i32 1, i32 %.06070
  %84 = icmp eq i8 %.fr, 34
  %85 = zext i1 %84 to i32
  %.159 = add i32 %.05871, %85
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !22

86:                                               ; preds = %._crit_edge.thread
  %87 = load ptr, ptr %9, align 8, !tbaa !23
  %88 = getelementptr inbounds i8, ptr %87, i64 8
  %89 = load ptr, ptr %88, align 8, !tbaa !17
  %90 = sext i32 %75 to i64
  %91 = getelementptr inbounds i32, ptr %89, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !11
  %93 = icmp sgt i32 %92, -1
  br i1 %93, label %94, label %99

94:                                               ; preds = %86
  %95 = getelementptr inbounds i8, ptr %9, i64 312
  %96 = load ptr, ptr %95, align 8, !tbaa !24
  %97 = zext nneg i32 %92 to i64
  %98 = getelementptr inbounds i8, ptr %96, i64 %97
  br label %109

99:                                               ; preds = %86
  %100 = getelementptr inbounds i8, ptr %9, i64 304
  %101 = load ptr, ptr %100, align 8, !tbaa !25
  %102 = getelementptr inbounds i8, ptr %101, i64 8
  %103 = load ptr, ptr %102, align 8, !tbaa !26
  %104 = sub nsw i32 -2, %75
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds ptr, ptr %103, i64 %105
  %107 = load ptr, ptr %106, align 8, !tbaa !14
  %108 = getelementptr inbounds i8, ptr %107, i64 1
  br label %109

109:                                              ; preds = %94, %99
  %.054 = phi ptr [ %98, %94 ], [ %108, %99 ]
  call void @m_MapNodeDelete(ptr noundef nonnull %80, ptr noundef %.054, i32 noundef -1) #7
  %110 = load ptr, ptr %76, align 8, !tbaa !12
  %111 = load i32, ptr %6, align 4, !tbaa !11
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds ptr, ptr %110, i64 %112
  %114 = load ptr, ptr %113, align 8, !tbaa !14
  %115 = call ptr @m_MapWrite(ptr noundef %114, ptr noundef nonnull %7, i32 noundef -1, ptr noundef nonnull %5, i32 noundef 4) #7
  br label %116

116:                                              ; preds = %._crit_edge._crit_edge, %109
  %.pre-phi = phi i64 [ %.pre, %._crit_edge._crit_edge ], [ %90, %109 ]
  %117 = getelementptr inbounds i8, ptr %9, i64 304
  %118 = load ptr, ptr %117, align 8, !tbaa !25
  %119 = load i32, ptr %118, align 8, !tbaa !28
  %120 = sub nsw i32 -2, %119
  %121 = load ptr, ptr %9, align 8, !tbaa !23
  %122 = getelementptr inbounds i8, ptr %121, i64 8
  %123 = load ptr, ptr %122, align 8, !tbaa !17
  %124 = getelementptr inbounds i32, ptr %123, i64 %.pre-phi
  store i32 %120, ptr %124, align 4, !tbaa !11
  %125 = add nsw i32 %49, 1
  %126 = call ptr @mListWrite(ptr noundef nonnull %118, i32 noundef %119, ptr noundef nonnull %7, i32 noundef %125) #7
  %127 = getelementptr inbounds i8, ptr %126, i64 1
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %7) #7
  br label %128

128:                                              ; preds = %18, %38, %116
  %.3 = phi ptr [ %127, %116 ], [ null, %38 ], [ null, %18 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  ret ptr %.3
}

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #6

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

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

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


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