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

@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@stderr = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [37 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 @gdImageDestroy(ptr noundef) #0

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

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

declare i32 @getc(ptr noundef) #2

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

22:                                               ; preds = %1
  store ptr null, ptr %2, align 8
  store i32 1, ptr %15, align 4
  br label %177

23:                                               ; preds = %1
  %24 = getelementptr inbounds [161 x i8], ptr %14, i64 0, i64 0
  store ptr %24, ptr %13, align 8, !tbaa !5
  %25 = load ptr, ptr %13, align 8, !tbaa !5
  %26 = call ptr @strchr(ptr noundef %25, i32 noundef 32) #7
  store ptr %26, ptr %13, align 8, !tbaa !5
  %27 = load ptr, ptr %13, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %30, label %29

29:                                               ; preds = %23
  store ptr null, ptr %2, align 8
  store i32 1, ptr %15, align 4
  br label %177

30:                                               ; preds = %23
  %31 = load ptr, ptr %13, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %31, i32 1
  store ptr %32, ptr %13, align 8, !tbaa !5
  %33 = load ptr, ptr %13, align 8, !tbaa !5
  %34 = call ptr @strchr(ptr noundef %33, i32 noundef 32) #7
  store ptr %34, ptr %13, align 8, !tbaa !5
  %35 = load ptr, ptr %13, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %38, label %37

37:                                               ; preds = %30
  store ptr null, ptr %2, align 8
  store i32 1, ptr %15, align 4
  br label %177

38:                                               ; preds = %30
  %39 = load ptr, ptr %13, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %39, i64 1
  %41 = call i32 @atoi(ptr noundef %40) #7
  store i32 %41, ptr %6, align 4, !tbaa !9
  %42 = load i32, ptr %6, align 4, !tbaa !9
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %45, label %44

44:                                               ; preds = %38
  store ptr null, ptr %2, align 8
  store i32 1, ptr %15, align 4
  br label %177

45:                                               ; preds = %38
  %46 = getelementptr inbounds [161 x i8], ptr %14, i64 0, i64 0
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = call ptr @fgets(ptr noundef %46, i32 noundef 160, ptr noundef %47)
  %49 = icmp ne ptr %48, null
  br i1 %49, label %51, label %50

50:                                               ; preds = %45
  store ptr null, ptr %2, align 8
  store i32 1, ptr %15, align 4
  br label %177

51:                                               ; preds = %45
  %52 = getelementptr inbounds [161 x i8], ptr %14, i64 0, i64 0
  store ptr %52, ptr %13, align 8, !tbaa !5
  %53 = load ptr, ptr %13, align 8, !tbaa !5
  %54 = call ptr @strchr(ptr noundef %53, i32 noundef 32) #7
  store ptr %54, ptr %13, align 8, !tbaa !5
  %55 = load ptr, ptr %13, align 8, !tbaa !5
  %56 = icmp ne ptr %55, null
  br i1 %56, label %58, label %57

57:                                               ; preds = %51
  store ptr null, ptr %2, align 8
  store i32 1, ptr %15, align 4
  br label %177

58:                                               ; preds = %51
  %59 = load ptr, ptr %13, align 8, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %59, i32 1
  store ptr %60, ptr %13, align 8, !tbaa !5
  %61 = load ptr, ptr %13, align 8, !tbaa !5
  %62 = call ptr @strchr(ptr noundef %61, i32 noundef 32) #7
  store ptr %62, ptr %13, align 8, !tbaa !5
  %63 = load ptr, ptr %13, align 8, !tbaa !5
  %64 = icmp ne ptr %63, null
  br i1 %64, label %66, label %65

65:                                               ; preds = %58
  store ptr null, ptr %2, align 8
  store i32 1, ptr %15, align 4
  br label %177

66:                                               ; preds = %58
  %67 = load ptr, ptr %13, align 8, !tbaa !5
  %68 = getelementptr inbounds i8, ptr %67, i64 1
  %69 = call i32 @atoi(ptr noundef %68) #7
  store i32 %69, ptr %7, align 4, !tbaa !9
  %70 = load i32, ptr %7, align 4, !tbaa !9
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %73, label %72

72:                                               ; preds = %66
  store ptr null, ptr %2, align 8
  store i32 1, ptr %15, align 4
  br label %177

73:                                               ; preds = %66
  %74 = getelementptr inbounds [161 x i8], ptr %14, i64 0, i64 0
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = call ptr @fgets(ptr noundef %74, i32 noundef 160, ptr noundef %75)
  %77 = icmp ne ptr %76, null
  br i1 %77, label %79, label %78

78:                                               ; preds = %73
  store ptr null, ptr %2, align 8
  store i32 1, ptr %15, align 4
  br label %177

79:                                               ; preds = %73
  %80 = load i32, ptr %6, align 4, !tbaa !9
  %81 = load i32, ptr %7, align 4, !tbaa !9
  %82 = mul nsw i32 %80, %81
  %83 = sdiv i32 %82, 8
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %8, align 4, !tbaa !9
  %85 = load i32, ptr %6, align 4, !tbaa !9
  %86 = load i32, ptr %7, align 4, !tbaa !9
  %87 = call ptr @gdImageCreate(i32 noundef %85, i32 noundef %86)
  store ptr %87, ptr %4, align 8, !tbaa !5
  %88 = load ptr, ptr %4, align 8, !tbaa !5
  %89 = call i32 @gdImageColorAllocate(ptr noundef %88, i32 noundef 255, i32 noundef 255, i32 noundef 255)
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = call i32 @gdImageColorAllocate(ptr noundef %90, i32 noundef 0, i32 noundef 0, i32 noundef 0)
  store i32 0, ptr %11, align 4, !tbaa !9
  store i32 0, ptr %12, align 4, !tbaa !9
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %92

92:                                               ; preds = %169, %79
  %93 = load i32, ptr %10, align 4, !tbaa !9
  %94 = load i32, ptr %8, align 4, !tbaa !9
  %95 = icmp slt i32 %93, %94
  br i1 %95, label %96, label %172

96:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 3, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  br label %97

97:                                               ; preds = %108, %96
  br label %98

98:                                               ; preds = %97
  %99 = load ptr, ptr %3, align 8, !tbaa !5
  %100 = call i32 @getc(ptr noundef %99)
  store i32 %100, ptr %9, align 4, !tbaa !9
  %101 = load i32, ptr %9, align 4, !tbaa !9
  %102 = icmp eq i32 %101, -1
  br i1 %102, label %103, label %104

103:                                              ; preds = %98
  store i32 7, ptr %15, align 4
  br label %166

104:                                              ; preds = %98
  %105 = load i32, ptr %9, align 4, !tbaa !9
  %106 = icmp eq i32 %105, 120
  br i1 %106, label %107, label %108

107:                                              ; preds = %104
  br label %109

108:                                              ; preds = %104
  br label %97

109:                                              ; preds = %107
  %110 = load ptr, ptr %3, align 8, !tbaa !5
  %111 = call i32 @getc(ptr noundef %110)
  store i32 %111, ptr %9, align 4, !tbaa !9
  %112 = load i32, ptr %9, align 4, !tbaa !9
  %113 = icmp eq i32 %112, -1
  br i1 %113, label %114, label %115

114:                                              ; preds = %109
  store i32 7, ptr %15, align 4
  br label %166

115:                                              ; preds = %109
  %116 = load i32, ptr %9, align 4, !tbaa !9
  %117 = trunc i32 %116 to i8
  %118 = getelementptr inbounds [3 x i8], ptr %16, i64 0, i64 0
  store i8 %117, ptr %118, align 1, !tbaa !11
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = call i32 @getc(ptr noundef %119)
  store i32 %120, ptr %9, align 4, !tbaa !9
  %121 = load i32, ptr %9, align 4, !tbaa !9
  %122 = icmp eq i32 %121, -1
  br i1 %122, label %123, label %124

123:                                              ; preds = %115
  store i32 7, ptr %15, align 4
  br label %166

124:                                              ; preds = %115
  %125 = load i32, ptr %9, align 4, !tbaa !9
  %126 = trunc i32 %125 to i8
  %127 = getelementptr inbounds [3 x i8], ptr %16, i64 0, i64 1
  store i8 %126, ptr %127, align 1, !tbaa !11
  %128 = getelementptr inbounds [3 x i8], ptr %16, i64 0, i64 2
  store i8 0, ptr %128, align 1, !tbaa !11
  %129 = getelementptr inbounds [3 x i8], ptr %16, i64 0, i64 0
  %130 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %129, ptr noundef @.str.3, ptr noundef %17) #6
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %131

131:                                              ; preds = %162, %124
  %132 = load i32, ptr %5, align 4, !tbaa !9
  %133 = icmp sle i32 %132, 128
  br i1 %133, label %134, label %165

134:                                              ; preds = %131
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  %136 = load i32, ptr %11, align 4, !tbaa !9
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %11, align 4, !tbaa !9
  %138 = load i32, ptr %12, align 4, !tbaa !9
  %139 = load i32, ptr %17, align 4, !tbaa !9
  %140 = load i32, ptr %5, align 4, !tbaa !9
  %141 = and i32 %139, %140
  %142 = icmp ne i32 %141, 0
  %143 = zext i1 %142 to i64
  %144 = select i1 %142, i32 1, i32 0
  call void @gdImageSetPixel(ptr noundef %135, i32 noundef %136, i32 noundef %138, i32 noundef %144)
  %145 = load i32, ptr %11, align 4, !tbaa !9
  %146 = load ptr, ptr %4, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.gdImageStruct, ptr %146, i32 0, i32 1
  %148 = load i32, ptr %147, align 8, !tbaa !12
  %149 = icmp eq i32 %145, %148
  br i1 %149, label %150, label %161

150:                                              ; preds = %134
  store i32 0, ptr %11, align 4, !tbaa !9
  %151 = load i32, ptr %12, align 4, !tbaa !9
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %12, align 4, !tbaa !9
  %153 = load i32, ptr %12, align 4, !tbaa !9
  %154 = load ptr, ptr %4, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.gdImageStruct, ptr %154, i32 0, i32 2
  %156 = load i32, ptr %155, align 4, !tbaa !14
  %157 = icmp eq i32 %153, %156
  br i1 %157, label %158, label %160

158:                                              ; preds = %150
  %159 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %159, ptr %2, align 8
  store i32 1, ptr %15, align 4
  br label %166

160:                                              ; preds = %150
  br label %165

161:                                              ; preds = %134
  br label %162

162:                                              ; preds = %161
  %163 = load i32, ptr %5, align 4, !tbaa !9
  %164 = shl i32 %163, 1
  store i32 %164, ptr %5, align 4, !tbaa !9
  br label %131, !llvm.loop !15

165:                                              ; preds = %160, %131
  store i32 0, ptr %15, align 4
  br label %166

166:                                              ; preds = %165, %158, %123, %114, %103
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 3, ptr %16) #6
  %167 = load i32, ptr %15, align 4
  switch i32 %167, label %177 [
    i32 0, label %168
    i32 7, label %175
  ]

168:                                              ; preds = %166
  br label %169

169:                                              ; preds = %168
  %170 = load i32, ptr %10, align 4, !tbaa !9
  %171 = add nsw i32 %170, 1
  store i32 %171, ptr %10, align 4, !tbaa !9
  br label %92, !llvm.loop !17

172:                                              ; preds = %92
  %173 = load ptr, ptr @stderr, align 8, !tbaa !5
  %174 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %173, ptr noundef @.str.4) #6
  store ptr null, ptr %2, align 8
  store i32 1, ptr %15, align 4
  br label %177

175:                                              ; preds = %166
  %176 = load ptr, ptr %4, align 8, !tbaa !5
  call void @gdImageDestroy(ptr noundef %176)
  store ptr null, ptr %2, align 8
  store i32 1, ptr %15, align 4
  br label %177

177:                                              ; preds = %175, %172, %166, %78, %72, %65, %57, %50, %44, %37, %29, %22
  call void @llvm.lifetime.end.p0(i64 161, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  %178 = load ptr, ptr %2, align 8
  ret ptr %178
}

declare ptr @fgets(ptr noundef, i32 noundef, ptr noundef) #2

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #4

; Function Attrs: nounwind
declare i32 @__isoc99_sscanf(ptr noundef, ptr noundef, ...) #5

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #5

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { inlinehint nounwind willreturn memory(read) 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 #5 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !10, i64 8}
!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 = !{!13, !10, i64 12}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


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

@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [37 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 @gdImageDestroy(ptr noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @gdImageCreateFromXbm(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = alloca [161 x i8], align 16
  %3 = alloca [3 x i8], align 1
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 161, ptr nonnull %2) #5
  %5 = call ptr @fgets(ptr noundef nonnull %2, i32 noundef 160, ptr noundef %0)
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %104, label %6

6:                                                ; preds = %1
  %7 = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %2, i32 noundef 32) #6
  %.not70 = icmp eq ptr %7, null
  br i1 %.not70, label %104, label %8

8:                                                ; preds = %6
  %9 = getelementptr inbounds i8, ptr %7, i64 1
  %10 = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %9, i32 noundef 32) #6
  %.not71 = icmp eq ptr %10, null
  br i1 %.not71, label %104, label %11

11:                                               ; preds = %8
  %12 = getelementptr inbounds i8, ptr %10, i64 1
  %13 = call i32 @atoi(ptr nocapture noundef %12) #6
  %.not72 = icmp eq i32 %13, 0
  br i1 %.not72, label %104, label %14

14:                                               ; preds = %11
  %15 = call ptr @fgets(ptr noundef nonnull %2, i32 noundef 160, ptr noundef %0)
  %.not73 = icmp eq ptr %15, null
  br i1 %.not73, label %104, label %16

16:                                               ; preds = %14
  %17 = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %2, i32 noundef 32) #6
  %.not74 = icmp eq ptr %17, null
  br i1 %.not74, label %104, label %18

18:                                               ; preds = %16
  %19 = getelementptr inbounds i8, ptr %17, i64 1
  %20 = call ptr @strchr(ptr noundef nonnull dereferenceable(1) %19, i32 noundef 32) #6
  %.not75 = icmp eq ptr %20, null
  br i1 %.not75, label %104, label %21

21:                                               ; preds = %18
  %22 = getelementptr inbounds i8, ptr %20, i64 1
  %23 = call i32 @atoi(ptr nocapture noundef %22) #6
  %.not76 = icmp eq i32 %23, 0
  br i1 %.not76, label %104, label %24

24:                                               ; preds = %21
  %25 = call ptr @fgets(ptr noundef nonnull %2, i32 noundef 160, ptr noundef %0)
  %.not77 = icmp eq ptr %25, null
  br i1 %.not77, label %104, label %26

26:                                               ; preds = %24
  %27 = mul nsw i32 %23, %13
  %28 = call ptr @gdImageCreate(i32 noundef %13, i32 noundef %23)
  %29 = call i32 @gdImageColorAllocate(ptr noundef %28, i32 noundef 255, i32 noundef 255, i32 noundef 255)
  %30 = call i32 @gdImageColorAllocate(ptr noundef %28, i32 noundef 0, i32 noundef 0, i32 noundef 0)
  %.not7899 = icmp slt i32 %27, -7
  br i1 %.not7899, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %26
  %31 = sdiv i32 %27, 8
  %32 = getelementptr inbounds i8, ptr %3, i64 1
  %33 = getelementptr inbounds i8, ptr %3, i64 2
  %34 = getelementptr inbounds i8, ptr %28, i64 8
  %35 = getelementptr inbounds i8, ptr %28, i64 12
  br label %36

36:                                               ; preds = %.lr.ph, %.loopexit
  %.049102 = phi i32 [ 0, %.lr.ph ], [ %.2.ph, %.loopexit ]
  %.050101 = phi i32 [ 0, %.lr.ph ], [ %.3.ph, %.loopexit ]
  %.053100 = phi i32 [ 0, %.lr.ph ], [ %101, %.loopexit ]
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  br label %37

37:                                               ; preds = %37, %36
  %38 = call i32 @getc(ptr noundef %0)
  switch i32 %38, label %37 [
    i32 -1, label %.loopexit94
    i32 120, label %39
  ]

39:                                               ; preds = %37
  %40 = call i32 @getc(ptr noundef %0)
  %41 = icmp eq i32 %40, -1
  br i1 %41, label %.loopexit94, label %42

42:                                               ; preds = %39
  %43 = trunc i32 %40 to i8
  store i8 %43, ptr %3, align 1, !tbaa !5
  %44 = call i32 @getc(ptr noundef %0)
  %45 = icmp eq i32 %44, -1
  br i1 %45, label %.loopexit94, label %46

46:                                               ; preds = %42
  %47 = trunc i32 %44 to i8
  store i8 %47, ptr %32, align 1, !tbaa !5
  store i8 0, ptr %33, align 1, !tbaa !5
  %48 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %3, ptr noundef nonnull @.str.3, ptr noundef nonnull %4) #5
  %49 = add i32 %.050101, 1
  %50 = load i32, ptr %4, align 4, !tbaa !8
  %51 = and i32 %50, 1
  call void @gdImageSetPixel(ptr noundef %28, i32 noundef %.050101, i32 noundef %.049102, i32 noundef %51)
  %52 = load i32, ptr %34, align 8, !tbaa !10
  %53 = icmp eq i32 %49, %52
  br i1 %53, label %96, label %54

54:                                               ; preds = %46
  %55 = add i32 %.050101, 2
  %56 = load i32, ptr %4, align 4, !tbaa !8
  %57 = lshr i32 %56, 1
  %.lobit = and i32 %57, 1
  call void @gdImageSetPixel(ptr noundef nonnull %28, i32 noundef %49, i32 noundef %.049102, i32 noundef %.lobit)
  %58 = load i32, ptr %34, align 8, !tbaa !10
  %59 = icmp eq i32 %55, %58
  br i1 %59, label %96, label %60

60:                                               ; preds = %54
  %61 = add i32 %.050101, 3
  %62 = load i32, ptr %4, align 4, !tbaa !8
  %63 = lshr i32 %62, 2
  %.lobit105 = and i32 %63, 1
  call void @gdImageSetPixel(ptr noundef nonnull %28, i32 noundef %55, i32 noundef %.049102, i32 noundef %.lobit105)
  %64 = load i32, ptr %34, align 8, !tbaa !10
  %65 = icmp eq i32 %61, %64
  br i1 %65, label %96, label %66

66:                                               ; preds = %60
  %67 = add i32 %.050101, 4
  %68 = load i32, ptr %4, align 4, !tbaa !8
  %69 = lshr i32 %68, 3
  %.lobit106 = and i32 %69, 1
  call void @gdImageSetPixel(ptr noundef nonnull %28, i32 noundef %61, i32 noundef %.049102, i32 noundef %.lobit106)
  %70 = load i32, ptr %34, align 8, !tbaa !10
  %71 = icmp eq i32 %67, %70
  br i1 %71, label %96, label %72

72:                                               ; preds = %66
  %73 = add i32 %.050101, 5
  %74 = load i32, ptr %4, align 4, !tbaa !8
  %75 = lshr i32 %74, 4
  %.lobit107 = and i32 %75, 1
  call void @gdImageSetPixel(ptr noundef nonnull %28, i32 noundef %67, i32 noundef %.049102, i32 noundef %.lobit107)
  %76 = load i32, ptr %34, align 8, !tbaa !10
  %77 = icmp eq i32 %73, %76
  br i1 %77, label %96, label %78

78:                                               ; preds = %72
  %79 = add i32 %.050101, 6
  %80 = load i32, ptr %4, align 4, !tbaa !8
  %81 = lshr i32 %80, 5
  %.lobit108 = and i32 %81, 1
  call void @gdImageSetPixel(ptr noundef nonnull %28, i32 noundef %73, i32 noundef %.049102, i32 noundef %.lobit108)
  %82 = load i32, ptr %34, align 8, !tbaa !10
  %83 = icmp eq i32 %79, %82
  br i1 %83, label %96, label %84

84:                                               ; preds = %78
  %85 = add i32 %.050101, 7
  %86 = load i32, ptr %4, align 4, !tbaa !8
  %87 = lshr i32 %86, 6
  %.lobit109 = and i32 %87, 1
  call void @gdImageSetPixel(ptr noundef nonnull %28, i32 noundef %79, i32 noundef %.049102, i32 noundef %.lobit109)
  %88 = load i32, ptr %34, align 8, !tbaa !10
  %89 = icmp eq i32 %85, %88
  br i1 %89, label %96, label %90

90:                                               ; preds = %84
  %91 = add i32 %.050101, 8
  %92 = load i32, ptr %4, align 4, !tbaa !8
  %93 = lshr i32 %92, 7
  %.lobit110 = and i32 %93, 1
  call void @gdImageSetPixel(ptr noundef nonnull %28, i32 noundef %85, i32 noundef %.049102, i32 noundef %.lobit110)
  %94 = load i32, ptr %34, align 8, !tbaa !10
  %95 = icmp eq i32 %91, %94
  br i1 %95, label %96, label %.loopexit

96:                                               ; preds = %90, %84, %78, %72, %66, %60, %54, %46
  %97 = add nsw i32 %.049102, 1
  %98 = load i32, ptr %35, align 4, !tbaa !13
  %99 = icmp eq i32 %97, %98
  br i1 %99, label %100, label %.loopexit

100:                                              ; preds = %96
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %3) #5
  br label %104

.loopexit:                                        ; preds = %90, %96
  %.3.ph = phi i32 [ 0, %96 ], [ %91, %90 ]
  %.2.ph = phi i32 [ %97, %96 ], [ %.049102, %90 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %3) #5
  %101 = add nuw nsw i32 %.053100, 1
  %exitcond.not = icmp eq i32 %.053100, %31
  br i1 %exitcond.not, label %._crit_edge, label %36, !llvm.loop !14

._crit_edge:                                      ; preds = %.loopexit, %26
  %102 = load ptr, ptr @stderr, align 8, !tbaa !16
  %103 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %102, ptr noundef nonnull @.str.4) #7
  br label %104

.loopexit94:                                      ; preds = %39, %42, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %3) #5
  call void @gdImageDestroy(ptr noundef %28)
  br label %104

104:                                              ; preds = %100, %24, %21, %18, %16, %14, %11, %8, %6, %1, %.loopexit94, %._crit_edge
  %.256 = phi ptr [ %28, %100 ], [ null, %.loopexit94 ], [ null, %._crit_edge ], [ null, %1 ], [ null, %6 ], [ null, %8 ], [ null, %11 ], [ null, %14 ], [ null, %16 ], [ null, %18 ], [ null, %21 ], [ null, %24 ]
  call void @llvm.lifetime.end.p0(i64 161, ptr nonnull %2) #5
  ret ptr %.256
}

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

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
attributes #7 = { cold 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{!11, !9, i64 8}
!11 = !{!"gdImageStruct", !12, i64 0, !9, i64 8, !9, i64 12, !9, i64 16, !6, i64 20, !6, i64 1044, !6, i64 2068, !6, i64 3092, !9, i64 4116, !12, i64 4120, !9, i64 4128, !12, i64 4136, !12, i64 4144, !6, i64 4152, !6, i64 5176, !9, i64 6200, !9, i64 6204, !12, i64 6208, !9, i64 6216, !9, i64 6220, !9, i64 6224, !9, i64 6228, !9, i64 6232}
!12 = !{!"any pointer", !6, i64 0}
!13 = !{!11, !9, i64 12}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!12, !12, i64 0}


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