; LLVM IR from jingweizhanghuai/Morn :: src/image (morn_image_file)

; 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.BMPHeader = type { i32, i32, i32, i32, i32, i32, i16, i16, i32, i32, i32, i32, i32, i32 }
%struct.MImage = type { i32, i32, i32, [4 x ptr], ptr }

@.str = external hidden unnamed_addr constant [83 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [17 x i8], align 1
@__FUNCTION__.BMPRGBSave = external hidden unnamed_addr constant [11 x i8], align 1

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

declare void @m_Exception(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) #1

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

declare ptr @m_PropertyRead(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

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

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

declare i32 @fclose(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @BMPRGBSave(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i16, align 2
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %struct.BMPHeader, align 4
  %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
  %26 = alloca [3 x i32], align 4
  %27 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  br label %28

28:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = icmp eq ptr %29, null
  br i1 %30, label %35, label %31

31:                                               ; preds = %28
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = ptrtoint ptr %32 to i64
  %34 = icmp eq i64 %33, -1
  br i1 %34, label %35, label %36

35:                                               ; preds = %31, %28
  br label %65

36:                                               ; preds = %31
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.MImage, ptr %37, i32 0, i32 3
  %39 = getelementptr inbounds [4 x ptr], ptr %38, i64 0, i64 0
  %40 = icmp eq ptr %39, null
  br i1 %40, label %62, label %41

41:                                               ; preds = %36
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.MImage, ptr %42, i32 0, i32 3
  %44 = getelementptr inbounds [4 x ptr], ptr %43, i64 0, i64 0
  %45 = ptrtoint ptr %44 to i64
  %46 = icmp eq i64 %45, -1
  br i1 %46, label %62, label %47

47:                                               ; preds = %41
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.MImage, ptr %48, i32 0, i32 0
  %50 = load i32, ptr %49, align 8, !tbaa !9
  %51 = icmp sle i32 %50, 0
  br i1 %51, label %62, label %52

52:                                               ; preds = %47
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.MImage, ptr %53, i32 0, i32 1
  %55 = load i32, ptr %54, align 4, !tbaa !12
  %56 = icmp sle i32 %55, 0
  br i1 %56, label %62, label %57

57:                                               ; preds = %52
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.MImage, ptr %58, i32 0, i32 2
  %60 = load i32, ptr %59, align 8, !tbaa !13
  %61 = icmp sle i32 %60, 0
  br label %62

62:                                               ; preds = %57, %52, %47, %41, %36
  %63 = phi i1 [ true, %52 ], [ true, %47 ], [ true, %41 ], [ true, %36 ], [ %61, %57 ]
  %64 = zext i1 %63 to i32
  br label %65

65:                                               ; preds = %62, %35
  %66 = phi i32 [ 1, %35 ], [ %64, %62 ]
  store i32 %66, ptr %7, align 4, !tbaa !14
  %67 = load i32, ptr %7, align 4, !tbaa !14
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %71

69:                                               ; preds = %65
  %70 = load i32, ptr %7, align 4, !tbaa !14
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %70, i32 noundef -1, ptr noundef @.str, i32 noundef 106, ptr noundef @__FUNCTION__.BMPRGBSave, ptr noundef @.str.1)
  br label %71

71:                                               ; preds = %69, %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %72

72:                                               ; preds = %71
  br label %73

73:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 -1, ptr %8, align 4, !tbaa !14
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = call ptr @m_PropertyRead(ptr noundef %74, ptr noundef @.str.2, ptr noundef %8, ptr noundef null)
  br label %76

76:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %77 = load i32, ptr %8, align 4, !tbaa !14
  %78 = icmp ne i32 %77, 3
  br i1 %78, label %84, label %79

79:                                               ; preds = %76
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.MImage, ptr %80, i32 0, i32 0
  %82 = load i32, ptr %81, align 8, !tbaa !9
  %83 = icmp slt i32 %82, 3
  br label %84

84:                                               ; preds = %79, %76
  %85 = phi i1 [ true, %76 ], [ %83, %79 ]
  %86 = zext i1 %85 to i32
  store i32 %86, ptr %9, align 4, !tbaa !14
  %87 = load i32, ptr %9, align 4, !tbaa !14
  %88 = icmp ne i32 %87, 0
  br i1 %88, label %89, label %91

89:                                               ; preds = %84
  %90 = load i32, ptr %9, align 4, !tbaa !14
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %90, i32 noundef -1, ptr noundef @.str, i32 noundef 108, ptr noundef @__FUNCTION__.BMPRGBSave, ptr noundef @.str.1)
  br label %91

91:                                               ; preds = %89, %84
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %92

92:                                               ; preds = %91
  br label %93

93:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = call noalias ptr @fopen(ptr noundef %94, ptr noundef @.str.3)
  store ptr %95, ptr %10, align 8, !tbaa !5
  br label %96

96:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %97 = load ptr, ptr %10, align 8, !tbaa !5
  %98 = icmp eq ptr %97, null
  %99 = zext i1 %98 to i32
  store i32 %99, ptr %11, align 4, !tbaa !14
  %100 = load i32, ptr %11, align 4, !tbaa !14
  %101 = icmp ne i32 %100, 0
  br i1 %101, label %102, label %104

102:                                              ; preds = %96
  %103 = load i32, ptr %11, align 4, !tbaa !14
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %103, i32 noundef -1, ptr noundef @.str, i32 noundef 111, ptr noundef @__FUNCTION__.BMPRGBSave, ptr noundef @.str.4)
  br label %104

104:                                              ; preds = %102, %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %105

105:                                              ; preds = %104
  br label %106

106:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 2, ptr %12) #4
  store i16 19778, ptr %12, align 2, !tbaa !15
  br label %107

107:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %108 = load ptr, ptr %10, align 8, !tbaa !5
  %109 = call i64 @fwrite(ptr noundef %12, i64 noundef 1, i64 noundef 2, ptr noundef %108)
  %110 = trunc i64 %109 to i32
  %111 = icmp ne i32 %110, 2
  %112 = zext i1 %111 to i32
  store i32 %112, ptr %13, align 4, !tbaa !14
  %113 = load i32, ptr %13, align 4, !tbaa !14
  %114 = icmp ne i32 %113, 0
  br i1 %114, label %115, label %117

115:                                              ; preds = %107
  %116 = load i32, ptr %13, align 4, !tbaa !14
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %116, i32 noundef -1, ptr noundef @.str, i32 noundef 112, ptr noundef @__FUNCTION__.BMPRGBSave, ptr noundef @.str.5)
  br label %117

117:                                              ; preds = %115, %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %118

118:                                              ; preds = %117
  br label %119

119:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %120 = load ptr, ptr %3, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.MImage, ptr %120, i32 0, i32 2
  %122 = load i32, ptr %121, align 8, !tbaa !13
  store i32 %122, ptr %14, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %123 = load ptr, ptr %3, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.MImage, ptr %123, i32 0, i32 1
  %125 = load i32, ptr %124, align 4, !tbaa !12
  store i32 %125, ptr %15, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %126 = load i32, ptr %14, align 4, !tbaa !14
  %127 = mul nsw i32 %126, 3
  %128 = add nsw i32 %127, 3
  %129 = ashr i32 %128, 2
  %130 = shl i32 %129, 2
  store i32 %130, ptr %16, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %131 = load i32, ptr %16, align 4, !tbaa !14
  %132 = load i32, ptr %15, align 4, !tbaa !14
  %133 = mul nsw i32 %131, %132
  store i32 %133, ptr %17, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 52, ptr %18) #4
  %134 = load i32, ptr %17, align 4, !tbaa !14
  %135 = add nsw i32 54, %134
  %136 = getelementptr inbounds %struct.BMPHeader, ptr %18, i32 0, i32 0
  store i32 %135, ptr %136, align 4, !tbaa !17
  %137 = getelementptr inbounds %struct.BMPHeader, ptr %18, i32 0, i32 1
  store i32 0, ptr %137, align 4, !tbaa !19
  %138 = getelementptr inbounds %struct.BMPHeader, ptr %18, i32 0, i32 2
  store i32 54, ptr %138, align 4, !tbaa !20
  %139 = getelementptr inbounds %struct.BMPHeader, ptr %18, i32 0, i32 3
  store i32 40, ptr %139, align 4, !tbaa !21
  %140 = load i32, ptr %14, align 4, !tbaa !14
  %141 = getelementptr inbounds %struct.BMPHeader, ptr %18, i32 0, i32 4
  store i32 %140, ptr %141, align 4, !tbaa !22
  %142 = load i32, ptr %15, align 4, !tbaa !14
  %143 = getelementptr inbounds %struct.BMPHeader, ptr %18, i32 0, i32 5
  store i32 %142, ptr %143, align 4, !tbaa !23
  %144 = getelementptr inbounds %struct.BMPHeader, ptr %18, i32 0, i32 6
  store i16 1, ptr %144, align 4, !tbaa !24
  %145 = getelementptr inbounds %struct.BMPHeader, ptr %18, i32 0, i32 7
  store i16 24, ptr %145, align 2, !tbaa !25
  %146 = getelementptr inbounds %struct.BMPHeader, ptr %18, i32 0, i32 8
  store i32 0, ptr %146, align 4, !tbaa !26
  %147 = load i32, ptr %17, align 4, !tbaa !14
  %148 = getelementptr inbounds %struct.BMPHeader, ptr %18, i32 0, i32 9
  store i32 %147, ptr %148, align 4, !tbaa !27
  %149 = getelementptr inbounds %struct.BMPHeader, ptr %18, i32 0, i32 10
  store i32 11811, ptr %149, align 4, !tbaa !28
  %150 = getelementptr inbounds %struct.BMPHeader, ptr %18, i32 0, i32 11
  store i32 11811, ptr %150, align 4, !tbaa !29
  %151 = getelementptr inbounds %struct.BMPHeader, ptr %18, i32 0, i32 12
  store i32 0, ptr %151, align 4, !tbaa !30
  %152 = getelementptr inbounds %struct.BMPHeader, ptr %18, i32 0, i32 13
  store i32 0, ptr %152, align 4, !tbaa !31
  br label %153

153:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %154 = load ptr, ptr %10, align 8, !tbaa !5
  %155 = call i64 @fwrite(ptr noundef %18, i64 noundef 1, i64 noundef 52, ptr noundef %154)
  %156 = trunc i64 %155 to i32
  %157 = icmp ne i32 %156, 52
  %158 = zext i1 %157 to i32
  store i32 %158, ptr %19, align 4, !tbaa !14
  %159 = load i32, ptr %19, align 4, !tbaa !14
  %160 = icmp ne i32 %159, 0
  br i1 %160, label %161, label %163

161:                                              ; preds = %153
  %162 = load i32, ptr %19, align 4, !tbaa !14
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %162, i32 noundef -1, ptr noundef @.str, i32 noundef 135, ptr noundef @__FUNCTION__.BMPRGBSave, ptr noundef @.str.5)
  br label %163

163:                                              ; preds = %161, %153
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %164

164:                                              ; preds = %163
  br label %165

165:                                              ; preds = %164
  %166 = load i32, ptr %16, align 4, !tbaa !14
  %167 = load i32, ptr %14, align 4, !tbaa !14
  %168 = mul nsw i32 %167, 3
  %169 = icmp eq i32 %166, %168
  br i1 %169, label %170, label %262

170:                                              ; preds = %165
  %171 = load i32, ptr %15, align 4, !tbaa !14
  %172 = sub nsw i32 %171, 1
  store i32 %172, ptr %6, align 4, !tbaa !14
  br label %173

173:                                              ; preds = %258, %170
  %174 = load i32, ptr %6, align 4, !tbaa !14
  %175 = icmp sge i32 %174, 0
  br i1 %175, label %176, label %261

176:                                              ; preds = %173
  store i32 0, ptr %5, align 4, !tbaa !14
  br label %177

177:                                              ; preds = %254, %176
  %178 = load i32, ptr %5, align 4, !tbaa !14
  %179 = load i32, ptr %14, align 4, !tbaa !14
  %180 = icmp slt i32 %178, %179
  br i1 %180, label %181, label %257

181:                                              ; preds = %177
  br label %182

182:                                              ; preds = %181
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %183 = load ptr, ptr %3, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.MImage, ptr %183, i32 0, i32 3
  %185 = getelementptr inbounds [4 x ptr], ptr %184, i64 0, i64 0
  %186 = load ptr, ptr %185, align 8, !tbaa !5
  %187 = load i32, ptr %6, align 4, !tbaa !14
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds ptr, ptr %186, i64 %188
  %190 = load ptr, ptr %189, align 8, !tbaa !5
  %191 = load i32, ptr %5, align 4, !tbaa !14
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds i8, ptr %190, i64 %192
  %194 = load ptr, ptr %10, align 8, !tbaa !5
  %195 = call i64 @fwrite(ptr noundef %193, i64 noundef 1, i64 noundef 1, ptr noundef %194)
  %196 = trunc i64 %195 to i32
  %197 = icmp ne i32 %196, 1
  %198 = zext i1 %197 to i32
  store i32 %198, ptr %20, align 4, !tbaa !14
  %199 = load i32, ptr %20, align 4, !tbaa !14
  %200 = icmp ne i32 %199, 0
  br i1 %200, label %201, label %203

201:                                              ; preds = %182
  %202 = load i32, ptr %20, align 4, !tbaa !14
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %202, i32 noundef -1, ptr noundef @.str, i32 noundef 142, ptr noundef @__FUNCTION__.BMPRGBSave, ptr noundef @.str.5)
  br label %203

203:                                              ; preds = %201, %182
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %204

204:                                              ; preds = %203
  br label %205

205:                                              ; preds = %204
  br label %206

206:                                              ; preds = %205
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %207 = load ptr, ptr %3, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.MImage, ptr %207, i32 0, i32 3
  %209 = getelementptr inbounds [4 x ptr], ptr %208, i64 0, i64 1
  %210 = load ptr, ptr %209, align 8, !tbaa !5
  %211 = load i32, ptr %6, align 4, !tbaa !14
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds ptr, ptr %210, i64 %212
  %214 = load ptr, ptr %213, align 8, !tbaa !5
  %215 = load i32, ptr %5, align 4, !tbaa !14
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds i8, ptr %214, i64 %216
  %218 = load ptr, ptr %10, align 8, !tbaa !5
  %219 = call i64 @fwrite(ptr noundef %217, i64 noundef 1, i64 noundef 1, ptr noundef %218)
  %220 = trunc i64 %219 to i32
  %221 = icmp ne i32 %220, 1
  %222 = zext i1 %221 to i32
  store i32 %222, ptr %21, align 4, !tbaa !14
  %223 = load i32, ptr %21, align 4, !tbaa !14
  %224 = icmp ne i32 %223, 0
  br i1 %224, label %225, label %227

225:                                              ; preds = %206
  %226 = load i32, ptr %21, align 4, !tbaa !14
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %226, i32 noundef -1, ptr noundef @.str, i32 noundef 143, ptr noundef @__FUNCTION__.BMPRGBSave, ptr noundef @.str.5)
  br label %227

227:                                              ; preds = %225, %206
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  br label %228

228:                                              ; preds = %227
  br label %229

229:                                              ; preds = %228
  br label %230

230:                                              ; preds = %229
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  %231 = load ptr, ptr %3, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.MImage, ptr %231, i32 0, i32 3
  %233 = getelementptr inbounds [4 x ptr], ptr %232, i64 0, i64 2
  %234 = load ptr, ptr %233, align 8, !tbaa !5
  %235 = load i32, ptr %6, align 4, !tbaa !14
  %236 = sext i32 %235 to i64
  %237 = getelementptr inbounds ptr, ptr %234, i64 %236
  %238 = load ptr, ptr %237, align 8, !tbaa !5
  %239 = load i32, ptr %5, align 4, !tbaa !14
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds i8, ptr %238, i64 %240
  %242 = load ptr, ptr %10, align 8, !tbaa !5
  %243 = call i64 @fwrite(ptr noundef %241, i64 noundef 1, i64 noundef 1, ptr noundef %242)
  %244 = trunc i64 %243 to i32
  %245 = icmp ne i32 %244, 1
  %246 = zext i1 %245 to i32
  store i32 %246, ptr %22, align 4, !tbaa !14
  %247 = load i32, ptr %22, align 4, !tbaa !14
  %248 = icmp ne i32 %247, 0
  br i1 %248, label %249, label %251

249:                                              ; preds = %230
  %250 = load i32, ptr %22, align 4, !tbaa !14
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %250, i32 noundef -1, ptr noundef @.str, i32 noundef 144, ptr noundef @__FUNCTION__.BMPRGBSave, ptr noundef @.str.5)
  br label %251

251:                                              ; preds = %249, %230
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  br label %252

252:                                              ; preds = %251
  br label %253

253:                                              ; preds = %252
  br label %254

254:                                              ; preds = %253
  %255 = load i32, ptr %5, align 4, !tbaa !14
  %256 = add nsw i32 %255, 1
  store i32 %256, ptr %5, align 4, !tbaa !14
  br label %177, !llvm.loop !32

257:                                              ; preds = %177
  br label %258

258:                                              ; preds = %257
  %259 = load i32, ptr %6, align 4, !tbaa !14
  %260 = add nsw i32 %259, -1
  store i32 %260, ptr %6, align 4, !tbaa !14
  br label %173, !llvm.loop !34

261:                                              ; preds = %173
  br label %377

262:                                              ; preds = %165
  %263 = load i32, ptr %15, align 4, !tbaa !14
  %264 = sub nsw i32 %263, 1
  store i32 %264, ptr %6, align 4, !tbaa !14
  br label %265

265:                                              ; preds = %373, %262
  %266 = load i32, ptr %6, align 4, !tbaa !14
  %267 = icmp sge i32 %266, 0
  br i1 %267, label %268, label %376

268:                                              ; preds = %265
  store i32 0, ptr %5, align 4, !tbaa !14
  br label %269

269:                                              ; preds = %346, %268
  %270 = load i32, ptr %5, align 4, !tbaa !14
  %271 = load i32, ptr %14, align 4, !tbaa !14
  %272 = icmp slt i32 %270, %271
  br i1 %272, label %273, label %349

273:                                              ; preds = %269
  br label %274

274:                                              ; preds = %273
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #4
  %275 = load ptr, ptr %3, align 8, !tbaa !5
  %276 = getelementptr inbounds %struct.MImage, ptr %275, i32 0, i32 3
  %277 = getelementptr inbounds [4 x ptr], ptr %276, i64 0, i64 0
  %278 = load ptr, ptr %277, align 8, !tbaa !5
  %279 = load i32, ptr %6, align 4, !tbaa !14
  %280 = sext i32 %279 to i64
  %281 = getelementptr inbounds ptr, ptr %278, i64 %280
  %282 = load ptr, ptr %281, align 8, !tbaa !5
  %283 = load i32, ptr %5, align 4, !tbaa !14
  %284 = sext i32 %283 to i64
  %285 = getelementptr inbounds i8, ptr %282, i64 %284
  %286 = load ptr, ptr %10, align 8, !tbaa !5
  %287 = call i64 @fwrite(ptr noundef %285, i64 noundef 1, i64 noundef 1, ptr noundef %286)
  %288 = trunc i64 %287 to i32
  %289 = icmp ne i32 %288, 1
  %290 = zext i1 %289 to i32
  store i32 %290, ptr %23, align 4, !tbaa !14
  %291 = load i32, ptr %23, align 4, !tbaa !14
  %292 = icmp ne i32 %291, 0
  br i1 %292, label %293, label %295

293:                                              ; preds = %274
  %294 = load i32, ptr %23, align 4, !tbaa !14
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %294, i32 noundef -1, ptr noundef @.str, i32 noundef 153, ptr noundef @__FUNCTION__.BMPRGBSave, ptr noundef @.str.5)
  br label %295

295:                                              ; preds = %293, %274
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  br label %296

296:                                              ; preds = %295
  br label %297

297:                                              ; preds = %296
  br label %298

298:                                              ; preds = %297
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #4
  %299 = load ptr, ptr %3, align 8, !tbaa !5
  %300 = getelementptr inbounds %struct.MImage, ptr %299, i32 0, i32 3
  %301 = getelementptr inbounds [4 x ptr], ptr %300, i64 0, i64 1
  %302 = load ptr, ptr %301, align 8, !tbaa !5
  %303 = load i32, ptr %6, align 4, !tbaa !14
  %304 = sext i32 %303 to i64
  %305 = getelementptr inbounds ptr, ptr %302, i64 %304
  %306 = load ptr, ptr %305, align 8, !tbaa !5
  %307 = load i32, ptr %5, align 4, !tbaa !14
  %308 = sext i32 %307 to i64
  %309 = getelementptr inbounds i8, ptr %306, i64 %308
  %310 = load ptr, ptr %10, align 8, !tbaa !5
  %311 = call i64 @fwrite(ptr noundef %309, i64 noundef 1, i64 noundef 1, ptr noundef %310)
  %312 = trunc i64 %311 to i32
  %313 = icmp ne i32 %312, 1
  %314 = zext i1 %313 to i32
  store i32 %314, ptr %24, align 4, !tbaa !14
  %315 = load i32, ptr %24, align 4, !tbaa !14
  %316 = icmp ne i32 %315, 0
  br i1 %316, label %317, label %319

317:                                              ; preds = %298
  %318 = load i32, ptr %24, align 4, !tbaa !14
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %318, i32 noundef -1, ptr noundef @.str, i32 noundef 154, ptr noundef @__FUNCTION__.BMPRGBSave, ptr noundef @.str.5)
  br label %319

319:                                              ; preds = %317, %298
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  br label %320

320:                                              ; preds = %319
  br label %321

321:                                              ; preds = %320
  br label %322

322:                                              ; preds = %321
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #4
  %323 = load ptr, ptr %3, align 8, !tbaa !5
  %324 = getelementptr inbounds %struct.MImage, ptr %323, i32 0, i32 3
  %325 = getelementptr inbounds [4 x ptr], ptr %324, i64 0, i64 2
  %326 = load ptr, ptr %325, align 8, !tbaa !5
  %327 = load i32, ptr %6, align 4, !tbaa !14
  %328 = sext i32 %327 to i64
  %329 = getelementptr inbounds ptr, ptr %326, i64 %328
  %330 = load ptr, ptr %329, align 8, !tbaa !5
  %331 = load i32, ptr %5, align 4, !tbaa !14
  %332 = sext i32 %331 to i64
  %333 = getelementptr inbounds i8, ptr %330, i64 %332
  %334 = load ptr, ptr %10, align 8, !tbaa !5
  %335 = call i64 @fwrite(ptr noundef %333, i64 noundef 1, i64 noundef 1, ptr noundef %334)
  %336 = trunc i64 %335 to i32
  %337 = icmp ne i32 %336, 1
  %338 = zext i1 %337 to i32
  store i32 %338, ptr %25, align 4, !tbaa !14
  %339 = load i32, ptr %25, align 4, !tbaa !14
  %340 = icmp ne i32 %339, 0
  br i1 %340, label %341, label %343

341:                                              ; preds = %322
  %342 = load i32, ptr %25, align 4, !tbaa !14
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %342, i32 noundef -1, ptr noundef @.str, i32 noundef 155, ptr noundef @__FUNCTION__.BMPRGBSave, ptr noundef @.str.5)
  br label %343

343:                                              ; preds = %341, %322
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #4
  br label %344

344:                                              ; preds = %343
  br label %345

345:                                              ; preds = %344
  br label %346

346:                                              ; preds = %345
  %347 = load i32, ptr %5, align 4, !tbaa !14
  %348 = add nsw i32 %347, 1
  store i32 %348, ptr %5, align 4, !tbaa !14
  br label %269, !llvm.loop !35

349:                                              ; preds = %269
  call void @llvm.lifetime.start.p0(i64 12, ptr %26) #4
  call void @llvm.memset.p0.i64(ptr align 4 %26, i8 0, i64 12, i1 false)
  br label %350

350:                                              ; preds = %349
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #4
  %351 = getelementptr inbounds [3 x i32], ptr %26, i64 0, i64 0
  %352 = load i32, ptr %16, align 4, !tbaa !14
  %353 = load i32, ptr %14, align 4, !tbaa !14
  %354 = mul nsw i32 %353, 3
  %355 = sub nsw i32 %352, %354
  %356 = sext i32 %355 to i64
  %357 = load ptr, ptr %10, align 8, !tbaa !5
  %358 = call i64 @fwrite(ptr noundef %351, i64 noundef 1, i64 noundef %356, ptr noundef %357)
  %359 = trunc i64 %358 to i32
  %360 = load i32, ptr %16, align 4, !tbaa !14
  %361 = load i32, ptr %14, align 4, !tbaa !14
  %362 = mul nsw i32 %361, 3
  %363 = sub nsw i32 %360, %362
  %364 = icmp ne i32 %359, %363
  %365 = zext i1 %364 to i32
  store i32 %365, ptr %27, align 4, !tbaa !14
  %366 = load i32, ptr %27, align 4, !tbaa !14
  %367 = icmp ne i32 %366, 0
  br i1 %367, label %368, label %370

368:                                              ; preds = %350
  %369 = load i32, ptr %27, align 4, !tbaa !14
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %369, i32 noundef -1, ptr noundef @.str, i32 noundef 158, ptr noundef @__FUNCTION__.BMPRGBSave, ptr noundef @.str.5)
  br label %370

370:                                              ; preds = %368, %350
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #4
  br label %371

371:                                              ; preds = %370
  br label %372

372:                                              ; preds = %371
  call void @llvm.lifetime.end.p0(i64 12, ptr %26) #4
  br label %373

373:                                              ; preds = %372
  %374 = load i32, ptr %6, align 4, !tbaa !14
  %375 = add nsw i32 %374, -1
  store i32 %375, ptr %6, align 4, !tbaa !14
  br label %265, !llvm.loop !36

376:                                              ; preds = %265
  br label %377

377:                                              ; preds = %376, %261
  %378 = load ptr, ptr %10, align 8, !tbaa !5
  %379 = call i32 @fclose(ptr noundef %378)
  call void @llvm.lifetime.end.p0(i64 52, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret void
}

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

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 nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }

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

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


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

@.str = external hidden unnamed_addr constant [83 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [17 x i8], align 1
@__FUNCTION__.BMPRGBSave = external hidden unnamed_addr constant [11 x i8], align 1

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

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

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

declare ptr @m_PropertyRead(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @BMPRGBSave(ptr noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #3 {
  %3 = alloca i32, align 4
  %4 = alloca i16, align 2
  %5 = alloca %struct.BMPHeader, align 4
  %6 = alloca [3 x i32], align 4
  %magicptr = ptrtoint ptr %0 to i64
  switch i64 %magicptr, label %7 [
    i64 -1, label %.thread
    i64 0, label %.thread
  ]

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = icmp eq ptr %8, inttoptr (i64 -1 to ptr)
  br i1 %9, label %.thread, label %10

10:                                               ; preds = %7
  %11 = load i32, ptr %0, align 8, !tbaa !5
  %12 = icmp slt i32 %11, 1
  br i1 %12, label %.thread, label %13

13:                                               ; preds = %10
  %14 = getelementptr inbounds i8, ptr %0, i64 4
  %15 = load i32, ptr %14, align 4, !tbaa !11
  %16 = icmp slt i32 %15, 1
  br i1 %16, label %.thread, label %17

17:                                               ; preds = %13
  %18 = getelementptr inbounds i8, ptr %0, i64 8
  %19 = load i32, ptr %18, align 8, !tbaa !12
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %21, label %.thread

.thread:                                          ; preds = %7, %10, %13, %2, %2, %17
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 106, ptr noundef nonnull @__FUNCTION__.BMPRGBSave, ptr noundef nonnull @.str.1) #5
  br label %21

21:                                               ; preds = %.thread, %17
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 -1, ptr %3, align 4, !tbaa !13
  %22 = call ptr @m_PropertyRead(ptr noundef %0, ptr noundef nonnull @.str.2, ptr noundef nonnull %3, ptr noundef null) #5
  %23 = load i32, ptr %3, align 4, !tbaa !13
  %.not102 = icmp eq i32 %23, 3
  br i1 %.not102, label %24, label %.thread107

24:                                               ; preds = %21
  %25 = load i32, ptr %0, align 8, !tbaa !5
  %26 = icmp slt i32 %25, 3
  br i1 %26, label %.thread107, label %27

.thread107:                                       ; preds = %21, %24
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 108, ptr noundef nonnull @__FUNCTION__.BMPRGBSave, ptr noundef nonnull @.str.1) #5
  br label %27

27:                                               ; preds = %.thread107, %24
  %28 = call noalias ptr @fopen(ptr noundef %1, ptr noundef nonnull @.str.3)
  %29 = icmp eq ptr %28, null
  br i1 %29, label %30, label %31

30:                                               ; preds = %27
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 111, ptr noundef nonnull @__FUNCTION__.BMPRGBSave, ptr noundef nonnull @.str.4) #5
  br label %31

31:                                               ; preds = %30, %27
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %4) #5
  store i16 19778, ptr %4, align 2, !tbaa !14
  %32 = call i64 @fwrite(ptr noundef nonnull %4, i64 noundef 1, i64 noundef 2, ptr noundef %28)
  %33 = and i64 %32, 4294967295
  %.not = icmp eq i64 %33, 2
  br i1 %.not, label %35, label %34

34:                                               ; preds = %31
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 112, ptr noundef nonnull @__FUNCTION__.BMPRGBSave, ptr noundef nonnull @.str.5) #5
  br label %35

35:                                               ; preds = %34, %31
  %36 = getelementptr inbounds i8, ptr %0, i64 8
  %37 = load i32, ptr %36, align 8, !tbaa !12
  %38 = getelementptr inbounds i8, ptr %0, i64 4
  %39 = load i32, ptr %38, align 4, !tbaa !11
  %40 = mul nsw i32 %37, 3
  %41 = add nsw i32 %40, 3
  %42 = and i32 %41, -4
  %43 = mul nsw i32 %42, %39
  call void @llvm.lifetime.start.p0(i64 52, ptr nonnull %5) #5
  %44 = add nsw i32 %43, 54
  store i32 %44, ptr %5, align 4, !tbaa !16
  %45 = getelementptr inbounds i8, ptr %5, i64 4
  store i32 0, ptr %45, align 4, !tbaa !18
  %46 = getelementptr inbounds i8, ptr %5, i64 8
  store i32 54, ptr %46, align 4, !tbaa !19
  %47 = getelementptr inbounds i8, ptr %5, i64 12
  store i32 40, ptr %47, align 4, !tbaa !20
  %48 = getelementptr inbounds i8, ptr %5, i64 16
  store i32 %37, ptr %48, align 4, !tbaa !21
  %49 = getelementptr inbounds i8, ptr %5, i64 20
  store i32 %39, ptr %49, align 4, !tbaa !22
  %50 = getelementptr inbounds i8, ptr %5, i64 24
  store i16 1, ptr %50, align 4, !tbaa !23
  %51 = getelementptr inbounds i8, ptr %5, i64 26
  store i16 24, ptr %51, align 2, !tbaa !24
  %52 = getelementptr inbounds i8, ptr %5, i64 28
  store i32 0, ptr %52, align 4, !tbaa !25
  %53 = getelementptr inbounds i8, ptr %5, i64 32
  store i32 %43, ptr %53, align 4, !tbaa !26
  %54 = getelementptr inbounds i8, ptr %5, i64 36
  store <4 x i32> <i32 11811, i32 11811, i32 0, i32 0>, ptr %54, align 4, !tbaa !13
  %55 = call i64 @fwrite(ptr noundef nonnull %5, i64 noundef 1, i64 noundef 52, ptr noundef %28)
  %56 = and i64 %55, 4294967295
  %.not108 = icmp eq i64 %56, 52
  br i1 %.not108, label %58, label %57

57:                                               ; preds = %35
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 135, ptr noundef nonnull @__FUNCTION__.BMPRGBSave, ptr noundef nonnull @.str.5) #5
  br label %58

58:                                               ; preds = %57, %35
  %59 = icmp eq i32 %42, %40
  %60 = icmp sgt i32 %39, 0
  br i1 %59, label %.preheader116, label %.preheader119

.preheader119:                                    ; preds = %58
  br i1 %60, label %.preheader118.lr.ph, label %.loopexit117

.preheader118.lr.ph:                              ; preds = %.preheader119
  %.197122 = add nsw i32 %39, -1
  %61 = icmp sgt i32 %37, 0
  %62 = getelementptr inbounds i8, ptr %0, i64 16
  %63 = getelementptr inbounds i8, ptr %0, i64 24
  %64 = getelementptr inbounds i8, ptr %0, i64 32
  %65 = sub nsw i32 %42, %40
  %66 = sext i32 %65 to i64
  br i1 %61, label %.preheader118.us.preheader, label %.preheader118

.preheader118.us.preheader:                       ; preds = %.preheader118.lr.ph
  %67 = zext nneg i32 %.197122 to i64
  %wide.trip.count = zext nneg i32 %37 to i64
  br label %.preheader118.us

.preheader118.us:                                 ; preds = %.preheader118.us.preheader, %69
  %indvars.iv131 = phi i64 [ %67, %.preheader118.us.preheader ], [ %indvars.iv.next132, %69 ]
  br label %71

68:                                               ; preds = %._crit_edge.us
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 158, ptr noundef nonnull @__FUNCTION__.BMPRGBSave, ptr noundef nonnull @.str.5) #5
  br label %69

69:                                               ; preds = %68, %._crit_edge.us
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #5
  %indvars.iv.next132 = add nsw i64 %indvars.iv131, -1
  %70 = icmp sgt i64 %indvars.iv131, 0
  br i1 %70, label %.preheader118.us, label %.loopexit117, !llvm.loop !27

71:                                               ; preds = %.preheader118.us, %95
  %indvars.iv = phi i64 [ 0, %.preheader118.us ], [ %indvars.iv.next, %95 ]
  %72 = load ptr, ptr %62, align 8, !tbaa !29
  %73 = getelementptr inbounds ptr, ptr %72, i64 %indvars.iv131
  %74 = load ptr, ptr %73, align 8, !tbaa !29
  %75 = getelementptr inbounds i8, ptr %74, i64 %indvars.iv
  %76 = call i64 @fwrite(ptr noundef %75, i64 noundef 1, i64 noundef 1, ptr noundef %28)
  %77 = and i64 %76, 4294967295
  %.not110.us = icmp eq i64 %77, 1
  br i1 %.not110.us, label %79, label %78

78:                                               ; preds = %71
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 153, ptr noundef nonnull @__FUNCTION__.BMPRGBSave, ptr noundef nonnull @.str.5) #5
  br label %79

79:                                               ; preds = %78, %71
  %80 = load ptr, ptr %63, align 8, !tbaa !29
  %81 = getelementptr inbounds ptr, ptr %80, i64 %indvars.iv131
  %82 = load ptr, ptr %81, align 8, !tbaa !29
  %83 = getelementptr inbounds i8, ptr %82, i64 %indvars.iv
  %84 = call i64 @fwrite(ptr noundef %83, i64 noundef 1, i64 noundef 1, ptr noundef %28)
  %85 = and i64 %84, 4294967295
  %.not111.us = icmp eq i64 %85, 1
  br i1 %.not111.us, label %87, label %86

86:                                               ; preds = %79
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 154, ptr noundef nonnull @__FUNCTION__.BMPRGBSave, ptr noundef nonnull @.str.5) #5
  br label %87

87:                                               ; preds = %86, %79
  %88 = load ptr, ptr %64, align 8, !tbaa !29
  %89 = getelementptr inbounds ptr, ptr %88, i64 %indvars.iv131
  %90 = load ptr, ptr %89, align 8, !tbaa !29
  %91 = getelementptr inbounds i8, ptr %90, i64 %indvars.iv
  %92 = call i64 @fwrite(ptr noundef %91, i64 noundef 1, i64 noundef 1, ptr noundef %28)
  %93 = and i64 %92, 4294967295
  %.not112.us = icmp eq i64 %93, 1
  br i1 %.not112.us, label %95, label %94

94:                                               ; preds = %87
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 155, ptr noundef nonnull @__FUNCTION__.BMPRGBSave, ptr noundef nonnull @.str.5) #5
  br label %95

95:                                               ; preds = %94, %87
  %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.us, label %71, !llvm.loop !30

._crit_edge.us:                                   ; preds = %95
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %6, i8 0, i64 12, i1 false)
  %96 = call i64 @fwrite(ptr noundef nonnull %6, i64 noundef 1, i64 noundef %66, ptr noundef %28)
  %97 = trunc i64 %96 to i32
  %.not109.us = icmp eq i32 %65, %97
  br i1 %.not109.us, label %69, label %68

.preheader116:                                    ; preds = %58
  br i1 %60, label %.preheader.lr.ph, label %.loopexit117

.preheader.lr.ph:                                 ; preds = %.preheader116
  %98 = icmp sgt i32 %37, 0
  %99 = getelementptr inbounds i8, ptr %0, i64 16
  %100 = getelementptr inbounds i8, ptr %0, i64 24
  %101 = getelementptr inbounds i8, ptr %0, i64 32
  br i1 %98, label %.preheader.us.preheader, label %.loopexit117

.preheader.us.preheader:                          ; preds = %.preheader.lr.ph
  %.096125 = add nsw i32 %39, -1
  %102 = zext nneg i32 %.096125 to i64
  %wide.trip.count137 = zext nneg i32 %37 to i64
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %..loopexit_crit_edge.us
  %indvars.iv139 = phi i64 [ %102, %.preheader.us.preheader ], [ %indvars.iv.next140, %..loopexit_crit_edge.us ]
  br label %103

103:                                              ; preds = %.preheader.us, %127
  %indvars.iv134 = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next135, %127 ]
  %104 = load ptr, ptr %99, align 8, !tbaa !29
  %105 = getelementptr inbounds ptr, ptr %104, i64 %indvars.iv139
  %106 = load ptr, ptr %105, align 8, !tbaa !29
  %107 = getelementptr inbounds i8, ptr %106, i64 %indvars.iv134
  %108 = call i64 @fwrite(ptr noundef %107, i64 noundef 1, i64 noundef 1, ptr noundef %28)
  %109 = and i64 %108, 4294967295
  %.not113.us = icmp eq i64 %109, 1
  br i1 %.not113.us, label %111, label %110

110:                                              ; preds = %103
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 142, ptr noundef nonnull @__FUNCTION__.BMPRGBSave, ptr noundef nonnull @.str.5) #5
  br label %111

111:                                              ; preds = %110, %103
  %112 = load ptr, ptr %100, align 8, !tbaa !29
  %113 = getelementptr inbounds ptr, ptr %112, i64 %indvars.iv139
  %114 = load ptr, ptr %113, align 8, !tbaa !29
  %115 = getelementptr inbounds i8, ptr %114, i64 %indvars.iv134
  %116 = call i64 @fwrite(ptr noundef %115, i64 noundef 1, i64 noundef 1, ptr noundef %28)
  %117 = and i64 %116, 4294967295
  %.not114.us = icmp eq i64 %117, 1
  br i1 %.not114.us, label %119, label %118

118:                                              ; preds = %111
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 143, ptr noundef nonnull @__FUNCTION__.BMPRGBSave, ptr noundef nonnull @.str.5) #5
  br label %119

119:                                              ; preds = %118, %111
  %120 = load ptr, ptr %101, align 8, !tbaa !29
  %121 = getelementptr inbounds ptr, ptr %120, i64 %indvars.iv139
  %122 = load ptr, ptr %121, align 8, !tbaa !29
  %123 = getelementptr inbounds i8, ptr %122, i64 %indvars.iv134
  %124 = call i64 @fwrite(ptr noundef %123, i64 noundef 1, i64 noundef 1, ptr noundef %28)
  %125 = and i64 %124, 4294967295
  %.not115.us = icmp eq i64 %125, 1
  br i1 %.not115.us, label %127, label %126

126:                                              ; preds = %119
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 144, ptr noundef nonnull @__FUNCTION__.BMPRGBSave, ptr noundef nonnull @.str.5) #5
  br label %127

127:                                              ; preds = %126, %119
  %indvars.iv.next135 = add nuw nsw i64 %indvars.iv134, 1
  %exitcond138.not = icmp eq i64 %indvars.iv.next135, %wide.trip.count137
  br i1 %exitcond138.not, label %..loopexit_crit_edge.us, label %103, !llvm.loop !31

..loopexit_crit_edge.us:                          ; preds = %127
  %indvars.iv.next140 = add nsw i64 %indvars.iv139, -1
  %128 = icmp sgt i64 %indvars.iv139, 0
  br i1 %128, label %.preheader.us, label %.loopexit117, !llvm.loop !32

.preheader118:                                    ; preds = %.preheader118.lr.ph, %132
  %.197123 = phi i32 [ %.197, %132 ], [ %.197122, %.preheader118.lr.ph ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %6, i8 0, i64 12, i1 false)
  %129 = call i64 @fwrite(ptr noundef nonnull %6, i64 noundef 1, i64 noundef %66, ptr noundef %28)
  %130 = trunc i64 %129 to i32
  %.not109 = icmp eq i32 %65, %130
  br i1 %.not109, label %132, label %131

131:                                              ; preds = %.preheader118
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 158, ptr noundef nonnull @__FUNCTION__.BMPRGBSave, ptr noundef nonnull @.str.5) #5
  br label %132

132:                                              ; preds = %131, %.preheader118
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #5
  %.197 = add nsw i32 %.197123, -1
  %133 = icmp sgt i32 %.197123, 0
  br i1 %133, label %.preheader118, label %.loopexit117, !llvm.loop !27

.loopexit117:                                     ; preds = %132, %69, %..loopexit_crit_edge.us, %.preheader.lr.ph, %.preheader119, %.preheader116
  %134 = call i32 @fclose(ptr noundef %28)
  call void @llvm.lifetime.end.p0(i64 52, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  ret void
}

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

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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 0}
!6 = !{!"MImage", !7, i64 0, !7, i64 4, !7, i64 8, !8, i64 16, !10, i64 48}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !7, i64 8}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"short", !8, i64 0}
!16 = !{!17, !7, i64 0}
!17 = !{!"BMPHeader", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !15, i64 24, !15, i64 26, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !7, i64 48}
!18 = !{!17, !7, i64 4}
!19 = !{!17, !7, i64 8}
!20 = !{!17, !7, i64 12}
!21 = !{!17, !7, i64 16}
!22 = !{!17, !7, i64 20}
!23 = !{!17, !15, i64 24}
!24 = !{!17, !15, i64 26}
!25 = !{!17, !7, i64 28}
!26 = !{!17, !7, i64 32}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!10, !10, i64 0}
!30 = distinct !{!30, !28}
!31 = distinct !{!31, !28}
!32 = distinct !{!32, !28}


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