; LLVM IR from NOAA-PMEL/Ferret :: xgks/src/lib (gd)

; 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.gdImageStruct = type { ptr, i32, i32, i32, [256 x i32], [256 x i32], [256 x i32], [256 x i32], i32, ptr, i32, ptr, ptr, [256 x i32], [256 x i32], i32, i32, ptr, i32, i32, i32, i32, i32 }

@ZeroDataBlock = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @gdImageCreateFromGif(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %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 [16 x i8], align 16
  %11 = alloca i8, align 1
  %12 = alloca [3 x [256 x i8]], align 16
  %13 = alloca [3 x [256 x i8]], align 16
  %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 [4 x i8], align 1
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 -1, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 768, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 768, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  store ptr null, ptr %20, align 8, !tbaa !5
  store i32 0, ptr @ZeroDataBlock, align 4, !tbaa !9
  store i32 1, ptr %4, align 4, !tbaa !9
  %23 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 0
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = call i64 @fread(ptr noundef %23, i64 noundef 6, i64 noundef 1, ptr noundef %24)
  %26 = icmp ne i64 %25, 0
  br i1 %26, label %28, label %27

27:                                               ; preds = %1
  store ptr null, ptr %2, align 8
  store i32 1, ptr %21, align 4
  br label %251

28:                                               ; preds = %1
  %29 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 0
  %30 = call i32 @strncmp(ptr noundef %29, ptr noundef @.str, i64 noundef 3) #6
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %33

32:                                               ; preds = %28
  store ptr null, ptr %2, align 8
  store i32 1, ptr %21, align 4
  br label %251

33:                                               ; preds = %28
  %34 = getelementptr inbounds [4 x i8], ptr %19, i64 0, i64 0
  %35 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 0
  %36 = getelementptr inbounds i8, ptr %35, i64 3
  %37 = call ptr @strncpy(ptr noundef %34, ptr noundef %36, i64 noundef 3) #5
  %38 = getelementptr inbounds [4 x i8], ptr %19, i64 0, i64 3
  store i8 0, ptr %38, align 1, !tbaa !11
  %39 = getelementptr inbounds [4 x i8], ptr %19, i64 0, i64 0
  %40 = call i32 @strcmp(ptr noundef %39, ptr noundef @.str.1) #6
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %42, label %47

42:                                               ; preds = %33
  %43 = getelementptr inbounds [4 x i8], ptr %19, i64 0, i64 0
  %44 = call i32 @strcmp(ptr noundef %43, ptr noundef @.str.2) #6
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %47

46:                                               ; preds = %42
  store ptr null, ptr %2, align 8
  store i32 1, ptr %21, align 4
  br label %251

47:                                               ; preds = %42, %33
  %48 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 0
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = call i64 @fread(ptr noundef %48, i64 noundef 7, i64 noundef 1, ptr noundef %49)
  %51 = icmp ne i64 %50, 0
  br i1 %51, label %53, label %52

52:                                               ; preds = %47
  store ptr null, ptr %2, align 8
  store i32 1, ptr %21, align 4
  br label %251

53:                                               ; preds = %47
  %54 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 4
  %55 = load i8, ptr %54, align 4, !tbaa !11
  %56 = zext i8 %55 to i32
  %57 = and i32 %56, 7
  %58 = shl i32 2, %57
  store i32 %58, ptr %5, align 4, !tbaa !9
  %59 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 4
  %60 = load i8, ptr %59, align 4, !tbaa !11
  %61 = zext i8 %60 to i32
  %62 = and i32 %61, 112
  %63 = ashr i32 %62, 3
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %6, align 4, !tbaa !9
  %65 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 5
  %66 = load i8, ptr %65, align 1, !tbaa !11
  %67 = zext i8 %66 to i32
  store i32 %67, ptr %7, align 4, !tbaa !9
  %68 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 6
  %69 = load i8, ptr %68, align 2, !tbaa !11
  %70 = zext i8 %69 to i32
  store i32 %70, ptr %8, align 4, !tbaa !9
  %71 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 4
  %72 = load i8, ptr %71, align 4, !tbaa !11
  %73 = zext i8 %72 to i32
  %74 = and i32 %73, 128
  %75 = icmp eq i32 %74, 128
  br i1 %75, label %76, label %84

76:                                               ; preds = %53
  %77 = load ptr, ptr %3, align 8, !tbaa !5
  %78 = load i32, ptr %5, align 4, !tbaa !9
  %79 = getelementptr inbounds [3 x [256 x i8]], ptr %12, i64 0, i64 0
  %80 = call i32 @ReadColorMap(ptr noundef %77, i32 noundef %78, ptr noundef %79)
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %83

82:                                               ; preds = %76
  store ptr null, ptr %2, align 8
  store i32 1, ptr %21, align 4
  br label %251

83:                                               ; preds = %76
  br label %84

84:                                               ; preds = %83, %53
  br label %85

85:                                               ; preds = %250, %150, %141, %84
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = call i64 @fread(ptr noundef %11, i64 noundef 1, i64 noundef 1, ptr noundef %86)
  %88 = icmp ne i64 %87, 0
  br i1 %88, label %90, label %89

89:                                               ; preds = %85
  store ptr null, ptr %2, align 8
  store i32 1, ptr %21, align 4
  br label %251

90:                                               ; preds = %85
  %91 = load i8, ptr %11, align 1, !tbaa !11
  %92 = zext i8 %91 to i32
  %93 = icmp eq i32 %92, 59
  br i1 %93, label %94, label %132

94:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  %95 = load i32, ptr %18, align 4, !tbaa !9
  %96 = load i32, ptr %4, align 4, !tbaa !9
  %97 = icmp slt i32 %95, %96
  br i1 %97, label %98, label %99

98:                                               ; preds = %94
  store ptr null, ptr %2, align 8
  store i32 1, ptr %21, align 4
  br label %131

99:                                               ; preds = %94
  %100 = load ptr, ptr %20, align 8, !tbaa !5
  %101 = icmp ne ptr %100, null
  br i1 %101, label %103, label %102

102:                                              ; preds = %99
  store ptr null, ptr %2, align 8
  store i32 1, ptr %21, align 4
  br label %131

103:                                              ; preds = %99
  %104 = load ptr, ptr %20, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.gdImageStruct, ptr %104, i32 0, i32 3
  %106 = load i32, ptr %105, align 8, !tbaa !12
  %107 = sub nsw i32 %106, 1
  store i32 %107, ptr %22, align 4, !tbaa !9
  br label %108

108:                                              ; preds = %126, %103
  %109 = load i32, ptr %22, align 4, !tbaa !9
  %110 = icmp sge i32 %109, 0
  br i1 %110, label %111, label %129

111:                                              ; preds = %108
  %112 = load ptr, ptr %20, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.gdImageStruct, ptr %112, i32 0, i32 7
  %114 = load i32, ptr %22, align 4, !tbaa !9
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [256 x i32], ptr %113, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !9
  %118 = icmp ne i32 %117, 0
  br i1 %118, label %119, label %124

119:                                              ; preds = %111
  %120 = load ptr, ptr %20, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.gdImageStruct, ptr %120, i32 0, i32 3
  %122 = load i32, ptr %121, align 8, !tbaa !12
  %123 = add nsw i32 %122, -1
  store i32 %123, ptr %121, align 8, !tbaa !12
  br label %125

124:                                              ; preds = %111
  br label %129

125:                                              ; preds = %119
  br label %126

126:                                              ; preds = %125
  %127 = load i32, ptr %22, align 4, !tbaa !9
  %128 = add nsw i32 %127, -1
  store i32 %128, ptr %22, align 4, !tbaa !9
  br label %108, !llvm.loop !14

129:                                              ; preds = %124, %108
  %130 = load ptr, ptr %20, align 8, !tbaa !5
  store ptr %130, ptr %2, align 8
  store i32 1, ptr %21, align 4
  br label %131

131:                                              ; preds = %129, %102, %98
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  br label %251

132:                                              ; preds = %90
  %133 = load i8, ptr %11, align 1, !tbaa !11
  %134 = zext i8 %133 to i32
  %135 = icmp eq i32 %134, 33
  br i1 %135, label %136, label %146

136:                                              ; preds = %132
  %137 = load ptr, ptr %3, align 8, !tbaa !5
  %138 = call i64 @fread(ptr noundef %11, i64 noundef 1, i64 noundef 1, ptr noundef %137)
  %139 = icmp ne i64 %138, 0
  br i1 %139, label %141, label %140

140:                                              ; preds = %136
  store ptr null, ptr %2, align 8
  store i32 1, ptr %21, align 4
  br label %251

141:                                              ; preds = %136
  %142 = load ptr, ptr %3, align 8, !tbaa !5
  %143 = load i8, ptr %11, align 1, !tbaa !11
  %144 = zext i8 %143 to i32
  %145 = call i32 @DoExtension(ptr noundef %142, i32 noundef %144, ptr noundef %9)
  br label %85

146:                                              ; preds = %132
  %147 = load i8, ptr %11, align 1, !tbaa !11
  %148 = zext i8 %147 to i32
  %149 = icmp ne i32 %148, 44
  br i1 %149, label %150, label %151

150:                                              ; preds = %146
  br label %85

151:                                              ; preds = %146
  %152 = load i32, ptr %18, align 4, !tbaa !9
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %18, align 4, !tbaa !9
  %154 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 0
  %155 = load ptr, ptr %3, align 8, !tbaa !5
  %156 = call i64 @fread(ptr noundef %154, i64 noundef 9, i64 noundef 1, ptr noundef %155)
  %157 = icmp ne i64 %156, 0
  br i1 %157, label %159, label %158

158:                                              ; preds = %151
  store ptr null, ptr %2, align 8
  store i32 1, ptr %21, align 4
  br label %251

159:                                              ; preds = %151
  %160 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 8
  %161 = load i8, ptr %160, align 8, !tbaa !11
  %162 = zext i8 %161 to i32
  %163 = and i32 %162, 128
  %164 = icmp eq i32 %163, 128
  %165 = xor i1 %164, true
  %166 = zext i1 %165 to i32
  store i32 %166, ptr %16, align 4, !tbaa !9
  %167 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 8
  %168 = load i8, ptr %167, align 8, !tbaa !11
  %169 = zext i8 %168 to i32
  %170 = and i32 %169, 7
  %171 = add nsw i32 %170, 1
  %172 = shl i32 1, %171
  store i32 %172, ptr %17, align 4, !tbaa !9
  %173 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 5
  %174 = load i8, ptr %173, align 1, !tbaa !11
  %175 = zext i8 %174 to i32
  %176 = shl i32 %175, 8
  %177 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 4
  %178 = load i8, ptr %177, align 4, !tbaa !11
  %179 = zext i8 %178 to i32
  %180 = or i32 %176, %179
  store i32 %180, ptr %14, align 4, !tbaa !9
  %181 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 7
  %182 = load i8, ptr %181, align 1, !tbaa !11
  %183 = zext i8 %182 to i32
  %184 = shl i32 %183, 8
  %185 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 6
  %186 = load i8, ptr %185, align 2, !tbaa !11
  %187 = zext i8 %186 to i32
  %188 = or i32 %184, %187
  store i32 %188, ptr %15, align 4, !tbaa !9
  %189 = load i32, ptr %14, align 4, !tbaa !9
  %190 = load i32, ptr %15, align 4, !tbaa !9
  %191 = call ptr @gdImageCreate(i32 noundef %189, i32 noundef %190)
  store ptr %191, ptr %20, align 8, !tbaa !5
  %192 = icmp ne ptr %191, null
  br i1 %192, label %194, label %193

193:                                              ; preds = %159
  store ptr null, ptr %2, align 8
  store i32 1, ptr %21, align 4
  br label %251

194:                                              ; preds = %159
  %195 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 8
  %196 = load i8, ptr %195, align 8, !tbaa !11
  %197 = zext i8 %196 to i32
  %198 = and i32 %197, 64
  %199 = icmp eq i32 %198, 64
  %200 = zext i1 %199 to i32
  %201 = load ptr, ptr %20, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.gdImageStruct, ptr %201, i32 0, i32 18
  store i32 %200, ptr %202, align 8, !tbaa !16
  %203 = load i32, ptr %16, align 4, !tbaa !9
  %204 = icmp ne i32 %203, 0
  br i1 %204, label %228, label %205

205:                                              ; preds = %194
  %206 = load ptr, ptr %3, align 8, !tbaa !5
  %207 = load i32, ptr %17, align 4, !tbaa !9
  %208 = getelementptr inbounds [3 x [256 x i8]], ptr %13, i64 0, i64 0
  %209 = call i32 @ReadColorMap(ptr noundef %206, i32 noundef %207, ptr noundef %208)
  %210 = icmp ne i32 %209, 0
  br i1 %210, label %211, label %212

211:                                              ; preds = %205
  store ptr null, ptr %2, align 8
  store i32 1, ptr %21, align 4
  br label %251

212:                                              ; preds = %205
  %213 = load ptr, ptr %20, align 8, !tbaa !5
  %214 = load ptr, ptr %3, align 8, !tbaa !5
  %215 = load i32, ptr %14, align 4, !tbaa !9
  %216 = load i32, ptr %15, align 4, !tbaa !9
  %217 = getelementptr inbounds [3 x [256 x i8]], ptr %13, i64 0, i64 0
  %218 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 8
  %219 = load i8, ptr %218, align 8, !tbaa !11
  %220 = zext i8 %219 to i32
  %221 = and i32 %220, 64
  %222 = icmp eq i32 %221, 64
  %223 = zext i1 %222 to i32
  %224 = load i32, ptr %18, align 4, !tbaa !9
  %225 = load i32, ptr %4, align 4, !tbaa !9
  %226 = icmp ne i32 %224, %225
  %227 = zext i1 %226 to i32
  call void @ReadImage(ptr noundef %213, ptr noundef %214, i32 noundef %215, i32 noundef %216, ptr noundef %217, i32 noundef %223, i32 noundef %227)
  br label %244

228:                                              ; preds = %194
  %229 = load ptr, ptr %20, align 8, !tbaa !5
  %230 = load ptr, ptr %3, align 8, !tbaa !5
  %231 = load i32, ptr %14, align 4, !tbaa !9
  %232 = load i32, ptr %15, align 4, !tbaa !9
  %233 = getelementptr inbounds [3 x [256 x i8]], ptr %12, i64 0, i64 0
  %234 = getelementptr inbounds [16 x i8], ptr %10, i64 0, i64 8
  %235 = load i8, ptr %234, align 8, !tbaa !11
  %236 = zext i8 %235 to i32
  %237 = and i32 %236, 64
  %238 = icmp eq i32 %237, 64
  %239 = zext i1 %238 to i32
  %240 = load i32, ptr %18, align 4, !tbaa !9
  %241 = load i32, ptr %4, align 4, !tbaa !9
  %242 = icmp ne i32 %240, %241
  %243 = zext i1 %242 to i32
  call void @ReadImage(ptr noundef %229, ptr noundef %230, i32 noundef %231, i32 noundef %232, ptr noundef %233, i32 noundef %239, i32 noundef %243)
  br label %244

244:                                              ; preds = %228, %212
  %245 = load i32, ptr %9, align 4, !tbaa !9
  %246 = icmp ne i32 %245, -1
  br i1 %246, label %247, label %250

247:                                              ; preds = %244
  %248 = load ptr, ptr %20, align 8, !tbaa !5
  %249 = load i32, ptr %9, align 4, !tbaa !9
  call void @gdImageColorTransparent(ptr noundef %248, i32 noundef %249)
  br label %250

250:                                              ; preds = %247, %244
  br label %85

251:                                              ; preds = %211, %193, %158, %140, %131, %89, %82, %52, %46, %32, %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 768, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 768, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  %252 = load ptr, ptr %2, align 8
  ret ptr %252
}

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

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

; Function Attrs: nounwind
declare ptr @strncpy(ptr noundef, ptr noundef, i64 noundef) #4

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden i32 @ReadColorMap(ptr noundef, i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @DoExtension(ptr noundef, i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @ReadImage(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) #0

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "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 }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !10, i64 16}
!13 = !{!"gdImageStruct", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !7, i64 20, !7, i64 1044, !7, i64 2068, !7, i64 3092, !10, i64 4116, !6, i64 4120, !10, i64 4128, !6, i64 4136, !6, i64 4144, !7, i64 4152, !7, i64 5176, !10, i64 6200, !10, i64 6204, !6, i64 6208, !10, i64 6216, !10, i64 6220, !10, i64 6224, !10, i64 6228, !10, i64 6232}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!13, !10, i64 6216}


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

@ZeroDataBlock = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @gdImageCreateFromGif(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca i32, align 4
  %3 = alloca [16 x i8], align 16
  %4 = alloca i8, align 1
  %5 = alloca [3 x [256 x i8]], align 16
  %6 = alloca [3 x [256 x i8]], align 16
  %7 = alloca [4 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  store i32 -1, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 768, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 768, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  store i32 0, ptr @ZeroDataBlock, align 4, !tbaa !5
  %8 = call i64 @fread(ptr noundef nonnull %3, i64 noundef 6, i64 noundef 1, ptr noundef %0)
  %.not = icmp eq i64 %8, 0
  br i1 %.not, label %.loopexit, label %9

9:                                                ; preds = %1
  %10 = call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) @.str, i64 noundef 3) #6
  %.not44 = icmp eq i32 %10, 0
  br i1 %.not44, label %11, label %.loopexit

11:                                               ; preds = %9
  %12 = getelementptr inbounds i8, ptr %3, i64 3
  %13 = call ptr @strncpy(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) %12, i64 noundef 3) #5
  %14 = getelementptr inbounds i8, ptr %7, i64 3
  store i8 0, ptr %14, align 1, !tbaa !9
  %15 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.1) #6
  %.not45 = icmp eq i32 %15, 0
  br i1 %.not45, label %18, label %16

16:                                               ; preds = %11
  %17 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.2) #6
  %.not46 = icmp eq i32 %17, 0
  br i1 %.not46, label %18, label %.loopexit

18:                                               ; preds = %16, %11
  %19 = call i64 @fread(ptr noundef nonnull %3, i64 noundef 7, i64 noundef 1, ptr noundef %0)
  %.not47 = icmp eq i64 %19, 0
  br i1 %.not47, label %.loopexit, label %20

20:                                               ; preds = %18
  %21 = getelementptr inbounds i8, ptr %3, i64 4
  %22 = load i8, ptr %21, align 4, !tbaa !9
  %23 = getelementptr inbounds i8, ptr %3, i64 5
  %24 = getelementptr inbounds i8, ptr %3, i64 6
  %.not48 = icmp sgt i8 %22, -1
  br i1 %.not48, label %30, label %25

25:                                               ; preds = %20
  %26 = and i8 %22, 7
  %27 = zext nneg i8 %26 to i32
  %28 = shl nuw nsw i32 2, %27
  %29 = call i32 @ReadColorMap(ptr noundef %0, i32 noundef %28, ptr noundef nonnull %5)
  %.not49 = icmp eq i32 %29, 0
  br i1 %.not49, label %30, label %.loopexit

30:                                               ; preds = %25, %20
  %31 = call i64 @fread(ptr noundef nonnull %4, i64 noundef 1, i64 noundef 1, ptr noundef %0)
  %.not506870 = icmp eq i64 %31, 0
  br i1 %.not506870, label %.loopexit, label %.lr.ph.lr.ph

.lr.ph.lr.ph:                                     ; preds = %30
  %32 = getelementptr inbounds i8, ptr %3, i64 8
  %33 = getelementptr inbounds i8, ptr %3, i64 7
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.lr.ph, %.outer
  %.038.ph72 = phi ptr [ null, %.lr.ph.lr.ph ], [ %77, %.outer ]
  %.039.ph71 = phi i32 [ 0, %.lr.ph.lr.ph ], [ %58, %.outer ]
  br label %34

34:                                               ; preds = %.lr.ph, %.backedge
  %35 = load i8, ptr %4, align 1, !tbaa !9
  switch i8 %35, label %.backedge [
    i8 59, label %36
    i8 33, label %50
    i8 44, label %57
  ]

36:                                               ; preds = %34
  %37 = icmp eq i32 %.039.ph71, 0
  %.not60 = icmp eq ptr %.038.ph72, null
  %or.cond = or i1 %37, %.not60
  br i1 %or.cond, label %.loopexit, label %38

38:                                               ; preds = %36
  %39 = getelementptr inbounds i8, ptr %.038.ph72, i64 16
  %40 = load i32, ptr %39, align 8, !tbaa !10
  %41 = getelementptr inbounds i8, ptr %.038.ph72, i64 3092
  %42 = icmp sgt i32 %40, 0
  br i1 %42, label %.lr.ph75.preheader, label %.loopexit

.lr.ph75.preheader:                               ; preds = %38
  %43 = zext nneg i32 %40 to i64
  br label %.lr.ph75

.lr.ph75:                                         ; preds = %.lr.ph75.preheader, %47
  %44 = phi i32 [ %40, %.lr.ph75.preheader ], [ %48, %47 ]
  %indvars.iv = phi i64 [ %43, %.lr.ph75.preheader ], [ %indvars.iv.next, %47 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %45 = getelementptr inbounds [256 x i32], ptr %41, i64 0, i64 %indvars.iv.next
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %.not61 = icmp eq i32 %46, 0
  br i1 %.not61, label %.loopexit, label %47

47:                                               ; preds = %.lr.ph75
  %48 = add nsw i32 %44, -1
  store i32 %48, ptr %39, align 8, !tbaa !10
  %49 = icmp ugt i64 %indvars.iv, 1
  br i1 %49, label %.lr.ph75, label %.loopexit, !llvm.loop !13

50:                                               ; preds = %34
  %51 = call i64 @fread(ptr noundef nonnull %4, i64 noundef 1, i64 noundef 1, ptr noundef %0)
  %.not59 = icmp eq i64 %51, 0
  br i1 %.not59, label %.loopexit, label %52

52:                                               ; preds = %50
  %53 = load i8, ptr %4, align 1, !tbaa !9
  %54 = zext i8 %53 to i32
  %55 = call i32 @DoExtension(ptr noundef %0, i32 noundef %54, ptr noundef nonnull %2)
  br label %.backedge

.backedge:                                        ; preds = %52, %34
  %56 = call i64 @fread(ptr noundef nonnull %4, i64 noundef 1, i64 noundef 1, ptr noundef %0)
  %.not50 = icmp eq i64 %56, 0
  br i1 %.not50, label %.loopexit, label %34

57:                                               ; preds = %34
  %58 = add nuw nsw i32 %.039.ph71, 1
  %59 = call i64 @fread(ptr noundef nonnull %3, i64 noundef 9, i64 noundef 1, ptr noundef %0)
  %.not52 = icmp eq i64 %59, 0
  br i1 %.not52, label %.loopexit, label %60

60:                                               ; preds = %57
  %61 = load i8, ptr %32, align 8, !tbaa !9
  %62 = and i8 %61, 7
  %narrow = add nuw nsw i8 %62, 1
  %63 = zext nneg i8 %narrow to i32
  %64 = shl nuw nsw i32 1, %63
  %65 = load i8, ptr %23, align 1, !tbaa !9
  %66 = zext i8 %65 to i32
  %67 = shl nuw nsw i32 %66, 8
  %68 = load i8, ptr %21, align 4, !tbaa !9
  %69 = zext i8 %68 to i32
  %70 = or disjoint i32 %67, %69
  %71 = load i8, ptr %33, align 1, !tbaa !9
  %72 = zext i8 %71 to i32
  %73 = shl nuw nsw i32 %72, 8
  %74 = load i8, ptr %24, align 2, !tbaa !9
  %75 = zext i8 %74 to i32
  %76 = or disjoint i32 %73, %75
  %77 = call ptr @gdImageCreate(i32 noundef %70, i32 noundef %76)
  %.not54 = icmp eq ptr %77, null
  br i1 %.not54, label %.loopexit, label %78

78:                                               ; preds = %60
  %.not53 = icmp sgt i8 %61, -1
  %79 = lshr i8 %61, 6
  %.lobit = and i8 %79, 1
  %80 = zext nneg i8 %.lobit to i32
  %81 = getelementptr inbounds i8, ptr %77, i64 6216
  store i32 %80, ptr %81, align 8, !tbaa !15
  br i1 %.not53, label %84, label %82

82:                                               ; preds = %78
  %83 = call i32 @ReadColorMap(ptr noundef %0, i32 noundef %64, ptr noundef nonnull %6)
  %.not55 = icmp eq i32 %83, 0
  br i1 %.not55, label %84, label %.loopexit

84:                                               ; preds = %78, %82
  %.sink = phi ptr [ %6, %82 ], [ %5, %78 ]
  %85 = icmp ne i32 %.039.ph71, 0
  %86 = zext i1 %85 to i32
  call void @ReadImage(ptr noundef nonnull %77, ptr noundef %0, i32 noundef %70, i32 noundef %76, ptr noundef nonnull %.sink, i32 noundef %80, i32 noundef %86)
  %87 = load i32, ptr %2, align 4, !tbaa !5
  %.not58 = icmp eq i32 %87, -1
  br i1 %.not58, label %.outer, label %88

88:                                               ; preds = %84
  call void @gdImageColorTransparent(ptr noundef nonnull %77, i32 noundef %87)
  br label %.outer

.outer:                                           ; preds = %88, %84
  %89 = call i64 @fread(ptr noundef nonnull %4, i64 noundef 1, i64 noundef 1, ptr noundef %0)
  %.not5068 = icmp eq i64 %89, 0
  br i1 %.not5068, label %.loopexit, label %.lr.ph

.loopexit:                                        ; preds = %.outer, %82, %60, %57, %.backedge, %50, %47, %.lr.ph75, %30, %38, %36, %25, %18, %16, %9, %1
  %.1 = phi ptr [ null, %1 ], [ null, %9 ], [ null, %16 ], [ null, %18 ], [ null, %25 ], [ null, %36 ], [ %.038.ph72, %38 ], [ null, %30 ], [ %.038.ph72, %.lr.ph75 ], [ %.038.ph72, %47 ], [ null, %50 ], [ null, %.backedge ], [ null, %57 ], [ null, %60 ], [ null, %82 ], [ null, %.outer ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 768, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 768, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  ret ptr %.1
}

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #4

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

; Function Attrs: nounwind uwtable
declare hidden i32 @ReadColorMap(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @DoExtension(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @ReadImage(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !6, i64 16}
!11 = !{!"gdImageStruct", !12, i64 0, !6, i64 8, !6, i64 12, !6, i64 16, !7, i64 20, !7, i64 1044, !7, i64 2068, !7, i64 3092, !6, i64 4116, !12, i64 4120, !6, i64 4128, !12, i64 4136, !12, i64 4144, !7, i64 4152, !7, i64 5176, !6, i64 6200, !6, i64 6204, !12, i64 6208, !6, i64 6216, !6, i64 6220, !6, i64 6224, !6, i64 6228, !6, i64 6232}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!11, !6, i64 6216}


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