; 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__.BMPRGBASave = external hidden unnamed_addr constant [12 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 @BMPRGBASave(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i16, align 2
  %13 = alloca %struct.BMPHeader, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, 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
  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 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %12) #3
  store i16 19778, ptr %12, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 52, ptr %13) #3
  br label %24

24:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %31, label %27

27:                                               ; preds = %24
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = ptrtoint ptr %28 to i64
  %30 = icmp eq i64 %29, -1
  br i1 %30, label %31, label %32

31:                                               ; preds = %27, %24
  br label %61

32:                                               ; preds = %27
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.MImage, ptr %33, i32 0, i32 3
  %35 = getelementptr inbounds [4 x ptr], ptr %34, i64 0, i64 0
  %36 = icmp eq ptr %35, null
  br i1 %36, label %58, label %37

37:                                               ; preds = %32
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.MImage, ptr %38, i32 0, i32 3
  %40 = getelementptr inbounds [4 x ptr], ptr %39, i64 0, i64 0
  %41 = ptrtoint ptr %40 to i64
  %42 = icmp eq i64 %41, -1
  br i1 %42, label %58, label %43

43:                                               ; preds = %37
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.MImage, ptr %44, i32 0, i32 0
  %46 = load i32, ptr %45, align 8, !tbaa !11
  %47 = icmp sle i32 %46, 0
  br i1 %47, label %58, label %48

48:                                               ; preds = %43
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.MImage, ptr %49, i32 0, i32 1
  %51 = load i32, ptr %50, align 4, !tbaa !14
  %52 = icmp sle i32 %51, 0
  br i1 %52, label %58, label %53

53:                                               ; preds = %48
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.MImage, ptr %54, i32 0, i32 2
  %56 = load i32, ptr %55, align 8, !tbaa !15
  %57 = icmp sle i32 %56, 0
  br label %58

58:                                               ; preds = %53, %48, %43, %37, %32
  %59 = phi i1 [ true, %48 ], [ true, %43 ], [ true, %37 ], [ true, %32 ], [ %57, %53 ]
  %60 = zext i1 %59 to i32
  br label %61

61:                                               ; preds = %58, %31
  %62 = phi i32 [ 1, %31 ], [ %60, %58 ]
  store i32 %62, ptr %14, align 4, !tbaa !16
  %63 = load i32, ptr %14, align 4, !tbaa !16
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %67

65:                                               ; preds = %61
  %66 = load i32, ptr %14, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %66, i32 noundef -1, ptr noundef @.str, i32 noundef 180, ptr noundef @__FUNCTION__.BMPRGBASave, ptr noundef @.str.1)
  br label %67

67:                                               ; preds = %65, %61
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  br label %68

68:                                               ; preds = %67
  br label %69

69:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  store i32 -1, ptr %15, align 4, !tbaa !16
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = call ptr @m_PropertyRead(ptr noundef %70, ptr noundef @.str.2, ptr noundef %15, ptr noundef null)
  br label %72

72:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %73 = load i32, ptr %15, align 4, !tbaa !16
  %74 = icmp ne i32 %73, 4
  br i1 %74, label %80, label %75

75:                                               ; preds = %72
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.MImage, ptr %76, i32 0, i32 0
  %78 = load i32, ptr %77, align 8, !tbaa !11
  %79 = icmp slt i32 %78, 4
  br label %80

80:                                               ; preds = %75, %72
  %81 = phi i1 [ true, %72 ], [ %79, %75 ]
  %82 = zext i1 %81 to i32
  store i32 %82, ptr %16, align 4, !tbaa !16
  %83 = load i32, ptr %16, align 4, !tbaa !16
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %87

85:                                               ; preds = %80
  %86 = load i32, ptr %16, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %86, i32 noundef -1, ptr noundef @.str, i32 noundef 182, ptr noundef @__FUNCTION__.BMPRGBASave, ptr noundef @.str.1)
  br label %87

87:                                               ; preds = %85, %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  br label %88

88:                                               ; preds = %87
  br label %89

89:                                               ; preds = %88
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = call noalias ptr @fopen(ptr noundef %90, ptr noundef @.str.3)
  store ptr %91, ptr %5, align 8, !tbaa !5
  br label %92

92:                                               ; preds = %89
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = icmp eq ptr %93, null
  %95 = zext i1 %94 to i32
  store i32 %95, ptr %17, align 4, !tbaa !16
  %96 = load i32, ptr %17, align 4, !tbaa !16
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %98, label %100

98:                                               ; preds = %92
  %99 = load i32, ptr %17, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %99, i32 noundef -1, ptr noundef @.str, i32 noundef 185, ptr noundef @__FUNCTION__.BMPRGBASave, ptr noundef @.str.4)
  br label %100

100:                                              ; preds = %98, %92
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  br label %101

101:                                              ; preds = %100
  br label %102

102:                                              ; preds = %101
  %103 = load ptr, ptr %3, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.MImage, ptr %103, i32 0, i32 2
  %105 = load i32, ptr %104, align 8, !tbaa !15
  store i32 %105, ptr %6, align 4, !tbaa !16
  %106 = load ptr, ptr %3, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.MImage, ptr %106, i32 0, i32 1
  %108 = load i32, ptr %107, align 4, !tbaa !14
  store i32 %108, ptr %7, align 4, !tbaa !16
  %109 = load i32, ptr %6, align 4, !tbaa !16
  %110 = mul nsw i32 %109, 4
  store i32 %110, ptr %8, align 4, !tbaa !16
  %111 = load i32, ptr %8, align 4, !tbaa !16
  %112 = load i32, ptr %7, align 4, !tbaa !16
  %113 = mul nsw i32 %111, %112
  store i32 %113, ptr %9, align 4, !tbaa !16
  br label %114

114:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = call i64 @fwrite(ptr noundef %12, i64 noundef 1, i64 noundef 2, ptr noundef %115)
  %117 = trunc i64 %116 to i32
  %118 = icmp ne i32 %117, 2
  %119 = zext i1 %118 to i32
  store i32 %119, ptr %18, align 4, !tbaa !16
  %120 = load i32, ptr %18, align 4, !tbaa !16
  %121 = icmp ne i32 %120, 0
  br i1 %121, label %122, label %124

122:                                              ; preds = %114
  %123 = load i32, ptr %18, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %123, i32 noundef -1, ptr noundef @.str, i32 noundef 193, ptr noundef @__FUNCTION__.BMPRGBASave, ptr noundef @.str.5)
  br label %124

124:                                              ; preds = %122, %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  br label %125

125:                                              ; preds = %124
  br label %126

126:                                              ; preds = %125
  %127 = load i32, ptr %9, align 4, !tbaa !16
  %128 = add nsw i32 54, %127
  %129 = getelementptr inbounds %struct.BMPHeader, ptr %13, i32 0, i32 0
  store i32 %128, ptr %129, align 4, !tbaa !17
  %130 = getelementptr inbounds %struct.BMPHeader, ptr %13, i32 0, i32 1
  store i32 0, ptr %130, align 4, !tbaa !19
  %131 = getelementptr inbounds %struct.BMPHeader, ptr %13, i32 0, i32 2
  store i32 54, ptr %131, align 4, !tbaa !20
  %132 = getelementptr inbounds %struct.BMPHeader, ptr %13, i32 0, i32 3
  store i32 40, ptr %132, align 4, !tbaa !21
  %133 = load i32, ptr %6, align 4, !tbaa !16
  %134 = getelementptr inbounds %struct.BMPHeader, ptr %13, i32 0, i32 4
  store i32 %133, ptr %134, align 4, !tbaa !22
  %135 = load i32, ptr %7, align 4, !tbaa !16
  %136 = getelementptr inbounds %struct.BMPHeader, ptr %13, i32 0, i32 5
  store i32 %135, ptr %136, align 4, !tbaa !23
  %137 = getelementptr inbounds %struct.BMPHeader, ptr %13, i32 0, i32 6
  store i16 1, ptr %137, align 4, !tbaa !24
  %138 = getelementptr inbounds %struct.BMPHeader, ptr %13, i32 0, i32 7
  store i16 32, ptr %138, align 2, !tbaa !25
  %139 = getelementptr inbounds %struct.BMPHeader, ptr %13, i32 0, i32 8
  store i32 0, ptr %139, align 4, !tbaa !26
  %140 = load i32, ptr %9, align 4, !tbaa !16
  %141 = getelementptr inbounds %struct.BMPHeader, ptr %13, i32 0, i32 9
  store i32 %140, ptr %141, align 4, !tbaa !27
  %142 = getelementptr inbounds %struct.BMPHeader, ptr %13, i32 0, i32 10
  store i32 11811, ptr %142, align 4, !tbaa !28
  %143 = getelementptr inbounds %struct.BMPHeader, ptr %13, i32 0, i32 11
  store i32 11811, ptr %143, align 4, !tbaa !29
  %144 = getelementptr inbounds %struct.BMPHeader, ptr %13, i32 0, i32 12
  store i32 0, ptr %144, align 4, !tbaa !30
  %145 = getelementptr inbounds %struct.BMPHeader, ptr %13, i32 0, i32 13
  store i32 1, ptr %145, align 4, !tbaa !31
  br label %146

146:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %147 = load ptr, ptr %5, align 8, !tbaa !5
  %148 = call i64 @fwrite(ptr noundef %13, i64 noundef 1, i64 noundef 52, ptr noundef %147)
  %149 = trunc i64 %148 to i32
  %150 = icmp ne i32 %149, 52
  %151 = zext i1 %150 to i32
  store i32 %151, ptr %19, align 4, !tbaa !16
  %152 = load i32, ptr %19, align 4, !tbaa !16
  %153 = icmp ne i32 %152, 0
  br i1 %153, label %154, label %156

154:                                              ; preds = %146
  %155 = load i32, ptr %19, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %155, i32 noundef -1, ptr noundef @.str, i32 noundef 210, ptr noundef @__FUNCTION__.BMPRGBASave, ptr noundef @.str.5)
  br label %156

156:                                              ; preds = %154, %146
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  br label %157

157:                                              ; preds = %156
  br label %158

158:                                              ; preds = %157
  %159 = load i32, ptr %7, align 4, !tbaa !16
  %160 = sub nsw i32 %159, 1
  store i32 %160, ptr %11, align 4, !tbaa !16
  br label %161

161:                                              ; preds = %270, %158
  %162 = load i32, ptr %11, align 4, !tbaa !16
  %163 = icmp sge i32 %162, 0
  br i1 %163, label %164, label %273

164:                                              ; preds = %161
  store i32 0, ptr %10, align 4, !tbaa !16
  br label %165

165:                                              ; preds = %266, %164
  %166 = load i32, ptr %10, align 4, !tbaa !16
  %167 = load i32, ptr %6, align 4, !tbaa !16
  %168 = icmp slt i32 %166, %167
  br i1 %168, label %169, label %269

169:                                              ; preds = %165
  br label %170

170:                                              ; preds = %169
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  %171 = load ptr, ptr %3, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.MImage, ptr %171, i32 0, i32 3
  %173 = getelementptr inbounds [4 x ptr], ptr %172, i64 0, i64 0
  %174 = load ptr, ptr %173, align 8, !tbaa !5
  %175 = load i32, ptr %11, align 4, !tbaa !16
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds ptr, ptr %174, i64 %176
  %178 = load ptr, ptr %177, align 8, !tbaa !5
  %179 = load i32, ptr %10, align 4, !tbaa !16
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds i8, ptr %178, i64 %180
  %182 = load ptr, ptr %5, align 8, !tbaa !5
  %183 = call i64 @fwrite(ptr noundef %181, i64 noundef 1, i64 noundef 1, ptr noundef %182)
  %184 = trunc i64 %183 to i32
  %185 = icmp ne i32 %184, 1
  %186 = zext i1 %185 to i32
  store i32 %186, ptr %20, align 4, !tbaa !16
  %187 = load i32, ptr %20, align 4, !tbaa !16
  %188 = icmp ne i32 %187, 0
  br i1 %188, label %189, label %191

189:                                              ; preds = %170
  %190 = load i32, ptr %20, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %190, i32 noundef -1, ptr noundef @.str, i32 noundef 215, ptr noundef @__FUNCTION__.BMPRGBASave, ptr noundef @.str.5)
  br label %191

191:                                              ; preds = %189, %170
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  br label %192

192:                                              ; preds = %191
  br label %193

193:                                              ; preds = %192
  br label %194

194:                                              ; preds = %193
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  %195 = load ptr, ptr %3, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.MImage, ptr %195, i32 0, i32 3
  %197 = getelementptr inbounds [4 x ptr], ptr %196, i64 0, i64 1
  %198 = load ptr, ptr %197, align 8, !tbaa !5
  %199 = load i32, ptr %11, align 4, !tbaa !16
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds ptr, ptr %198, i64 %200
  %202 = load ptr, ptr %201, align 8, !tbaa !5
  %203 = load i32, ptr %10, align 4, !tbaa !16
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds i8, ptr %202, i64 %204
  %206 = load ptr, ptr %5, align 8, !tbaa !5
  %207 = call i64 @fwrite(ptr noundef %205, i64 noundef 1, i64 noundef 1, ptr noundef %206)
  %208 = trunc i64 %207 to i32
  %209 = icmp ne i32 %208, 1
  %210 = zext i1 %209 to i32
  store i32 %210, ptr %21, align 4, !tbaa !16
  %211 = load i32, ptr %21, align 4, !tbaa !16
  %212 = icmp ne i32 %211, 0
  br i1 %212, label %213, label %215

213:                                              ; preds = %194
  %214 = load i32, ptr %21, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %214, i32 noundef -1, ptr noundef @.str, i32 noundef 216, ptr noundef @__FUNCTION__.BMPRGBASave, ptr noundef @.str.5)
  br label %215

215:                                              ; preds = %213, %194
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  br label %216

216:                                              ; preds = %215
  br label %217

217:                                              ; preds = %216
  br label %218

218:                                              ; preds = %217
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  %219 = load ptr, ptr %3, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.MImage, ptr %219, i32 0, i32 3
  %221 = getelementptr inbounds [4 x ptr], ptr %220, i64 0, i64 2
  %222 = load ptr, ptr %221, align 8, !tbaa !5
  %223 = load i32, ptr %11, align 4, !tbaa !16
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds ptr, ptr %222, i64 %224
  %226 = load ptr, ptr %225, align 8, !tbaa !5
  %227 = load i32, ptr %10, align 4, !tbaa !16
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds i8, ptr %226, i64 %228
  %230 = load ptr, ptr %5, align 8, !tbaa !5
  %231 = call i64 @fwrite(ptr noundef %229, i64 noundef 1, i64 noundef 1, ptr noundef %230)
  %232 = trunc i64 %231 to i32
  %233 = icmp ne i32 %232, 1
  %234 = zext i1 %233 to i32
  store i32 %234, ptr %22, align 4, !tbaa !16
  %235 = load i32, ptr %22, align 4, !tbaa !16
  %236 = icmp ne i32 %235, 0
  br i1 %236, label %237, label %239

237:                                              ; preds = %218
  %238 = load i32, ptr %22, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %238, i32 noundef -1, ptr noundef @.str, i32 noundef 217, ptr noundef @__FUNCTION__.BMPRGBASave, ptr noundef @.str.5)
  br label %239

239:                                              ; preds = %237, %218
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  br label %240

240:                                              ; preds = %239
  br label %241

241:                                              ; preds = %240
  br label %242

242:                                              ; preds = %241
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  %243 = load ptr, ptr %3, align 8, !tbaa !5
  %244 = getelementptr inbounds %struct.MImage, ptr %243, i32 0, i32 3
  %245 = getelementptr inbounds [4 x ptr], ptr %244, i64 0, i64 3
  %246 = load ptr, ptr %245, align 8, !tbaa !5
  %247 = load i32, ptr %11, align 4, !tbaa !16
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds ptr, ptr %246, i64 %248
  %250 = load ptr, ptr %249, align 8, !tbaa !5
  %251 = load i32, ptr %10, align 4, !tbaa !16
  %252 = sext i32 %251 to i64
  %253 = getelementptr inbounds i8, ptr %250, i64 %252
  %254 = load ptr, ptr %5, align 8, !tbaa !5
  %255 = call i64 @fwrite(ptr noundef %253, i64 noundef 1, i64 noundef 1, ptr noundef %254)
  %256 = trunc i64 %255 to i32
  %257 = icmp ne i32 %256, 1
  %258 = zext i1 %257 to i32
  store i32 %258, ptr %23, align 4, !tbaa !16
  %259 = load i32, ptr %23, align 4, !tbaa !16
  %260 = icmp ne i32 %259, 0
  br i1 %260, label %261, label %263

261:                                              ; preds = %242
  %262 = load i32, ptr %23, align 4, !tbaa !16
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %262, i32 noundef -1, ptr noundef @.str, i32 noundef 218, ptr noundef @__FUNCTION__.BMPRGBASave, ptr noundef @.str.5)
  br label %263

263:                                              ; preds = %261, %242
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  br label %264

264:                                              ; preds = %263
  br label %265

265:                                              ; preds = %264
  br label %266

266:                                              ; preds = %265
  %267 = load i32, ptr %10, align 4, !tbaa !16
  %268 = add nsw i32 %267, 1
  store i32 %268, ptr %10, align 4, !tbaa !16
  br label %165, !llvm.loop !32

269:                                              ; preds = %165
  br label %270

270:                                              ; preds = %269
  %271 = load i32, ptr %11, align 4, !tbaa !16
  %272 = add nsw i32 %271, -1
  store i32 %272, ptr %11, align 4, !tbaa !16
  br label %161, !llvm.loop !34

273:                                              ; preds = %161
  %274 = load ptr, ptr %5, align 8, !tbaa !5
  %275 = call i32 @fclose(ptr noundef %274)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 52, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret void
}

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 = { 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, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"MImage", !13, i64 0, !13, i64 4, !13, i64 8, !7, i64 16, !6, i64 48}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !13, i64 4}
!15 = !{!12, !13, i64 8}
!16 = !{!13, !13, i64 0}
!17 = !{!18, !13, i64 0}
!18 = !{!"BMPHeader", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !10, i64 24, !10, i64 26, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48}
!19 = !{!18, !13, i64 4}
!20 = !{!18, !13, i64 8}
!21 = !{!18, !13, i64 12}
!22 = !{!18, !13, i64 16}
!23 = !{!18, !13, i64 20}
!24 = !{!18, !10, i64 24}
!25 = !{!18, !10, i64 26}
!26 = !{!18, !13, i64 28}
!27 = !{!18, !13, i64 32}
!28 = !{!18, !13, i64 36}
!29 = !{!18, !13, i64 40}
!30 = !{!18, !13, i64 44}
!31 = !{!18, !13, i64 48}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = distinct !{!34, !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__.BMPRGBASave = external hidden unnamed_addr constant [12 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 @BMPRGBASave(ptr noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #3 {
  %3 = alloca i16, align 2
  %4 = alloca %struct.BMPHeader, align 4
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %3) #4
  store i16 19778, ptr %3, align 2, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 52, ptr nonnull %4) #4
  %magicptr = ptrtoint ptr %0 to i64
  switch i64 %magicptr, label %6 [
    i64 -1, label %.critedge
    i64 0, label %.critedge
  ]

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

9:                                                ; preds = %6
  %10 = load i32, ptr %0, align 8, !tbaa !9
  %11 = icmp slt i32 %10, 1
  br i1 %11, label %.critedge, label %12

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

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

.critedge:                                        ; preds = %2, %2, %12, %9, %6, %16
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 180, ptr noundef nonnull @__FUNCTION__.BMPRGBASave, ptr noundef nonnull @.str.1) #4
  br label %20

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

23:                                               ; preds = %20
  %24 = load i32, ptr %0, align 8, !tbaa !9
  %25 = icmp slt i32 %24, 4
  br i1 %25, label %.thread, label %26

.thread:                                          ; preds = %20, %23
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 182, ptr noundef nonnull @__FUNCTION__.BMPRGBASave, ptr noundef nonnull @.str.1) #4
  br label %26

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

29:                                               ; preds = %26
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 185, ptr noundef nonnull @__FUNCTION__.BMPRGBASave, ptr noundef nonnull @.str.4) #4
  br label %30

30:                                               ; preds = %29, %26
  %31 = getelementptr inbounds i8, ptr %0, i64 8
  %32 = load i32, ptr %31, align 8, !tbaa !14
  %33 = getelementptr inbounds i8, ptr %0, i64 4
  %34 = load i32, ptr %33, align 4, !tbaa !13
  %35 = shl nsw i32 %32, 2
  %36 = mul nsw i32 %35, %34
  %37 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 1, i64 noundef 2, ptr noundef %27)
  %38 = and i64 %37, 4294967295
  %.not = icmp eq i64 %38, 2
  br i1 %.not, label %40, label %39

39:                                               ; preds = %30
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 193, ptr noundef nonnull @__FUNCTION__.BMPRGBASave, ptr noundef nonnull @.str.5) #4
  br label %40

40:                                               ; preds = %39, %30
  %41 = add nsw i32 %36, 54
  store i32 %41, ptr %4, align 4, !tbaa !16
  %42 = getelementptr inbounds i8, ptr %4, i64 4
  store i32 0, ptr %42, align 4, !tbaa !18
  %43 = getelementptr inbounds i8, ptr %4, i64 8
  store i32 54, ptr %43, align 4, !tbaa !19
  %44 = getelementptr inbounds i8, ptr %4, i64 12
  store i32 40, ptr %44, align 4, !tbaa !20
  %45 = getelementptr inbounds i8, ptr %4, i64 16
  store i32 %32, ptr %45, align 4, !tbaa !21
  %46 = getelementptr inbounds i8, ptr %4, i64 20
  store i32 %34, ptr %46, align 4, !tbaa !22
  %47 = getelementptr inbounds i8, ptr %4, i64 24
  store i16 1, ptr %47, align 4, !tbaa !23
  %48 = getelementptr inbounds i8, ptr %4, i64 26
  store i16 32, ptr %48, align 2, !tbaa !24
  %49 = getelementptr inbounds i8, ptr %4, i64 28
  store i32 0, ptr %49, align 4, !tbaa !25
  %50 = getelementptr inbounds i8, ptr %4, i64 32
  store i32 %36, ptr %50, align 4, !tbaa !26
  %51 = getelementptr inbounds i8, ptr %4, i64 36
  store <4 x i32> <i32 11811, i32 11811, i32 0, i32 1>, ptr %51, align 4, !tbaa !15
  %52 = call i64 @fwrite(ptr noundef nonnull %4, i64 noundef 1, i64 noundef 52, ptr noundef %27)
  %53 = and i64 %52, 4294967295
  %.not73 = icmp eq i64 %53, 52
  br i1 %.not73, label %55, label %54

54:                                               ; preds = %40
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 210, ptr noundef nonnull @__FUNCTION__.BMPRGBASave, ptr noundef nonnull @.str.5) #4
  br label %55

55:                                               ; preds = %54, %40
  %56 = icmp sgt i32 %34, 0
  br i1 %56, label %.preheader.lr.ph, label %._crit_edge

.preheader.lr.ph:                                 ; preds = %55
  %57 = icmp sgt i32 %32, 0
  %58 = getelementptr inbounds i8, ptr %0, i64 16
  %59 = getelementptr inbounds i8, ptr %0, i64 24
  %60 = getelementptr inbounds i8, ptr %0, i64 32
  %61 = getelementptr inbounds i8, ptr %0, i64 40
  br i1 %57, label %.preheader.us.preheader, label %._crit_edge

.preheader.us.preheader:                          ; preds = %.preheader.lr.ph
  %.06979 = add nsw i32 %34, -1
  %62 = zext nneg i32 %.06979 to i64
  %wide.trip.count = zext nneg i32 %32 to i64
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %..loopexit_crit_edge.us
  %indvars.iv83 = phi i64 [ %62, %.preheader.us.preheader ], [ %indvars.iv.next84, %..loopexit_crit_edge.us ]
  br label %63

63:                                               ; preds = %.preheader.us, %95
  %indvars.iv = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next, %95 ]
  %64 = load ptr, ptr %58, align 8, !tbaa !27
  %65 = getelementptr inbounds ptr, ptr %64, i64 %indvars.iv83
  %66 = load ptr, ptr %65, align 8, !tbaa !27
  %67 = getelementptr inbounds i8, ptr %66, i64 %indvars.iv
  %68 = call i64 @fwrite(ptr noundef %67, i64 noundef 1, i64 noundef 1, ptr noundef %27)
  %69 = and i64 %68, 4294967295
  %.not74.us = icmp eq i64 %69, 1
  br i1 %.not74.us, label %71, label %70

70:                                               ; preds = %63
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 215, ptr noundef nonnull @__FUNCTION__.BMPRGBASave, ptr noundef nonnull @.str.5) #4
  br label %71

71:                                               ; preds = %70, %63
  %72 = load ptr, ptr %59, align 8, !tbaa !27
  %73 = getelementptr inbounds ptr, ptr %72, i64 %indvars.iv83
  %74 = load ptr, ptr %73, align 8, !tbaa !27
  %75 = getelementptr inbounds i8, ptr %74, i64 %indvars.iv
  %76 = call i64 @fwrite(ptr noundef %75, i64 noundef 1, i64 noundef 1, ptr noundef %27)
  %77 = and i64 %76, 4294967295
  %.not75.us = icmp eq i64 %77, 1
  br i1 %.not75.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 216, ptr noundef nonnull @__FUNCTION__.BMPRGBASave, ptr noundef nonnull @.str.5) #4
  br label %79

79:                                               ; preds = %78, %71
  %80 = load ptr, ptr %60, align 8, !tbaa !27
  %81 = getelementptr inbounds ptr, ptr %80, i64 %indvars.iv83
  %82 = load ptr, ptr %81, align 8, !tbaa !27
  %83 = getelementptr inbounds i8, ptr %82, i64 %indvars.iv
  %84 = call i64 @fwrite(ptr noundef %83, i64 noundef 1, i64 noundef 1, ptr noundef %27)
  %85 = and i64 %84, 4294967295
  %.not76.us = icmp eq i64 %85, 1
  br i1 %.not76.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 217, ptr noundef nonnull @__FUNCTION__.BMPRGBASave, ptr noundef nonnull @.str.5) #4
  br label %87

87:                                               ; preds = %86, %79
  %88 = load ptr, ptr %61, align 8, !tbaa !27
  %89 = getelementptr inbounds ptr, ptr %88, i64 %indvars.iv83
  %90 = load ptr, ptr %89, align 8, !tbaa !27
  %91 = getelementptr inbounds i8, ptr %90, i64 %indvars.iv
  %92 = call i64 @fwrite(ptr noundef %91, i64 noundef 1, i64 noundef 1, ptr noundef %27)
  %93 = and i64 %92, 4294967295
  %.not77.us = icmp eq i64 %93, 1
  br i1 %.not77.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 218, ptr noundef nonnull @__FUNCTION__.BMPRGBASave, ptr noundef nonnull @.str.5) #4
  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 %..loopexit_crit_edge.us, label %63, !llvm.loop !28

..loopexit_crit_edge.us:                          ; preds = %95
  %indvars.iv.next84 = add nsw i64 %indvars.iv83, -1
  %96 = icmp sgt i64 %indvars.iv83, 0
  br i1 %96, label %.preheader.us, label %._crit_edge, !llvm.loop !30

._crit_edge:                                      ; preds = %..loopexit_crit_edge.us, %.preheader.lr.ph, %55
  %97 = call i32 @fclose(ptr noundef %27)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 52, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %3) #4
  ret void
}

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 = { 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 = !{!"short", !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, !12, i64 48}
!11 = !{!"int", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!10, !11, i64 4}
!14 = !{!10, !11, i64 8}
!15 = !{!11, !11, i64 0}
!16 = !{!17, !11, i64 0}
!17 = !{!"BMPHeader", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !6, i64 24, !6, i64 26, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48}
!18 = !{!17, !11, i64 4}
!19 = !{!17, !11, i64 8}
!20 = !{!17, !11, i64 12}
!21 = !{!17, !11, i64 16}
!22 = !{!17, !11, i64 20}
!23 = !{!17, !6, i64 24}
!24 = !{!17, !6, i64 26}
!25 = !{!17, !11, i64 28}
!26 = !{!17, !11, i64 32}
!27 = !{!12, !12, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = distinct !{!30, !29}


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