; LLVM IR from dloebl/cgif :: tests (animated_interlaced)

; 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.st_gifconfig = type { ptr, ptr, i32, i32, i16, i16, i16, i16, ptr, ptr }
%struct.st_frameconfig = type { ptr, ptr, i32, i32, i16, i16, i8 }

@__const.main.aPalette = external hidden unnamed_addr constant [9 x i8], align 1
@.str = external hidden unnamed_addr constant [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [44 x i8], align 1
@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca %struct.st_gifconfig, align 8
  %4 = alloca %struct.st_frameconfig, 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 [9 x i8], align 1
  %12 = alloca i8, align 1
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 48, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 9, ptr %11) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %11, ptr align 1 @__const.main.aPalette, i64 9, i1 false)
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #7
  store i8 3, ptr %12, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 148, ptr %13, align 4, !tbaa !8
  %17 = getelementptr inbounds [9 x i8], ptr %11, i64 0, i64 0
  %18 = load i8, ptr %12, align 1, !tbaa !5
  %19 = zext i8 %18 to i16
  call void @initGIFConfig(ptr noundef %3, ptr noundef @.str, i16 noundef zeroext 40, i16 noundef zeroext 40, ptr noundef %17, i16 noundef zeroext %19)
  %20 = call ptr @cgif_newgif(ptr noundef %3)
  store ptr %20, ptr %2, align 8, !tbaa !10
  %21 = load ptr, ptr %2, align 8, !tbaa !10
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %26

23:                                               ; preds = %0
  %24 = load ptr, ptr @stderr, align 8, !tbaa !10
  %25 = call i32 @fputs(ptr noundef @.str.1, ptr noundef %24)
  store i32 1, ptr %1, align 4
  store i32 1, ptr %14, align 4
  br label %150

26:                                               ; preds = %0
  %27 = call noalias ptr @malloc(i64 noundef 1600) #8
  store ptr %27, ptr %5, align 8, !tbaa !10
  %28 = load ptr, ptr %5, align 8, !tbaa !10
  call void @llvm.memset.p0.i64(ptr align 1 %28, i8 0, i64 1600, i1 false)
  store i32 1, ptr %6, align 4, !tbaa !8
  store i32 1, ptr %7, align 4, !tbaa !8
  store i32 1, ptr %8, align 4, !tbaa !8
  store i32 15, ptr %9, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 1, ptr %15, align 4, !tbaa !8
  br label %29

29:                                               ; preds = %40, %26
  %30 = load i32, ptr %15, align 4, !tbaa !8
  %31 = icmp slt i32 %30, 15
  br i1 %31, label %33, label %32

32:                                               ; preds = %29
  store i32 2, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %43

33:                                               ; preds = %29
  %34 = load ptr, ptr %5, align 8, !tbaa !10
  %35 = load i32, ptr %15, align 4, !tbaa !8
  %36 = mul nsw i32 %35, 40
  %37 = add nsw i32 1, %36
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds i8, ptr %34, i64 %38
  store i8 1, ptr %39, align 1, !tbaa !5
  br label %40

40:                                               ; preds = %33
  %41 = load i32, ptr %15, align 4, !tbaa !8
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %15, align 4, !tbaa !8
  br label %29, !llvm.loop !12

43:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !8
  br label %44

44:                                               ; preds = %135, %43
  %45 = load i32, ptr %16, align 4, !tbaa !8
  %46 = load i32, ptr %13, align 4, !tbaa !8
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store i32 5, ptr %14, align 4
  br label %138

49:                                               ; preds = %44
  %50 = load ptr, ptr %5, align 8, !tbaa !10
  %51 = load i32, ptr %6, align 4, !tbaa !8
  %52 = load i32, ptr %7, align 4, !tbaa !8
  %53 = mul nsw i32 %52, 40
  %54 = add nsw i32 %51, %53
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i8, ptr %50, i64 %55
  store i8 0, ptr %56, align 1, !tbaa !5
  %57 = load ptr, ptr %5, align 8, !tbaa !10
  %58 = load i32, ptr %8, align 4, !tbaa !8
  %59 = load i32, ptr %9, align 4, !tbaa !8
  %60 = mul nsw i32 %59, 40
  %61 = add nsw i32 %58, %60
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds i8, ptr %57, i64 %62
  store i8 1, ptr %63, align 1, !tbaa !5
  %64 = load i32, ptr %6, align 4, !tbaa !8
  %65 = icmp eq i32 %64, 1
  br i1 %65, label %66, label %72

66:                                               ; preds = %49
  %67 = load i32, ptr %7, align 4, !tbaa !8
  %68 = icmp slt i32 %67, 38
  br i1 %68, label %69, label %72

69:                                               ; preds = %66
  %70 = load i32, ptr %7, align 4, !tbaa !8
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %7, align 4, !tbaa !8
  br label %95

72:                                               ; preds = %66, %49
  %73 = load i32, ptr %7, align 4, !tbaa !8
  %74 = icmp eq i32 %73, 38
  br i1 %74, label %75, label %81

75:                                               ; preds = %72
  %76 = load i32, ptr %6, align 4, !tbaa !8
  %77 = icmp slt i32 %76, 38
  br i1 %77, label %78, label %81

78:                                               ; preds = %75
  %79 = load i32, ptr %6, align 4, !tbaa !8
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %6, align 4, !tbaa !8
  br label %94

81:                                               ; preds = %75, %72
  %82 = load i32, ptr %6, align 4, !tbaa !8
  %83 = icmp eq i32 %82, 38
  br i1 %83, label %84, label %90

84:                                               ; preds = %81
  %85 = load i32, ptr %7, align 4, !tbaa !8
  %86 = icmp sgt i32 %85, 1
  br i1 %86, label %87, label %90

87:                                               ; preds = %84
  %88 = load i32, ptr %7, align 4, !tbaa !8
  %89 = add nsw i32 %88, -1
  store i32 %89, ptr %7, align 4, !tbaa !8
  br label %93

90:                                               ; preds = %84, %81
  %91 = load i32, ptr %6, align 4, !tbaa !8
  %92 = add nsw i32 %91, -1
  store i32 %92, ptr %6, align 4, !tbaa !8
  br label %93

93:                                               ; preds = %90, %87
  br label %94

94:                                               ; preds = %93, %78
  br label %95

95:                                               ; preds = %94, %69
  %96 = load i32, ptr %8, align 4, !tbaa !8
  %97 = icmp eq i32 %96, 1
  br i1 %97, label %98, label %104

98:                                               ; preds = %95
  %99 = load i32, ptr %9, align 4, !tbaa !8
  %100 = icmp slt i32 %99, 38
  br i1 %100, label %101, label %104

101:                                              ; preds = %98
  %102 = load i32, ptr %9, align 4, !tbaa !8
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %9, align 4, !tbaa !8
  br label %127

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

107:                                              ; preds = %104
  %108 = load i32, ptr %8, align 4, !tbaa !8
  %109 = icmp slt i32 %108, 38
  br i1 %109, label %110, label %113

110:                                              ; preds = %107
  %111 = load i32, ptr %8, align 4, !tbaa !8
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %8, align 4, !tbaa !8
  br label %126

113:                                              ; preds = %107, %104
  %114 = load i32, ptr %8, align 4, !tbaa !8
  %115 = icmp eq i32 %114, 38
  br i1 %115, label %116, label %122

116:                                              ; preds = %113
  %117 = load i32, ptr %9, align 4, !tbaa !8
  %118 = icmp sgt i32 %117, 1
  br i1 %118, label %119, label %122

119:                                              ; preds = %116
  %120 = load i32, ptr %9, align 4, !tbaa !8
  %121 = add nsw i32 %120, -1
  store i32 %121, ptr %9, align 4, !tbaa !8
  br label %125

122:                                              ; preds = %116, %113
  %123 = load i32, ptr %8, align 4, !tbaa !8
  %124 = add nsw i32 %123, -1
  store i32 %124, ptr %8, align 4, !tbaa !8
  br label %125

125:                                              ; preds = %122, %119
  br label %126

126:                                              ; preds = %125, %110
  br label %127

127:                                              ; preds = %126, %101
  %128 = load ptr, ptr %5, align 8, !tbaa !10
  call void @initFrameConfig(ptr noundef %4, ptr noundef %128, i16 noundef zeroext 5)
  %129 = load ptr, ptr %2, align 8, !tbaa !10
  %130 = call i32 @cgif_addframe(ptr noundef %129, ptr noundef %4)
  store i32 %130, ptr %10, align 4, !tbaa !8
  %131 = load i32, ptr %10, align 4, !tbaa !8
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %134

133:                                              ; preds = %127
  store i32 5, ptr %14, align 4
  br label %138

134:                                              ; preds = %127
  br label %135

135:                                              ; preds = %134
  %136 = load i32, ptr %16, align 4, !tbaa !8
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %16, align 4, !tbaa !8
  br label %44, !llvm.loop !14

138:                                              ; preds = %133, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %139

139:                                              ; preds = %138
  %140 = load ptr, ptr %5, align 8, !tbaa !10
  call void @free(ptr noundef %140) #7
  %141 = load ptr, ptr %2, align 8, !tbaa !10
  %142 = call i32 @cgif_close(ptr noundef %141)
  store i32 %142, ptr %10, align 4, !tbaa !8
  %143 = load i32, ptr %10, align 4, !tbaa !8
  %144 = icmp ne i32 %143, 0
  br i1 %144, label %145, label %149

145:                                              ; preds = %139
  %146 = load ptr, ptr @stderr, align 8, !tbaa !10
  %147 = load i32, ptr %10, align 4, !tbaa !8
  %148 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %146, ptr noundef @.str.2, i32 noundef %147) #7
  store i32 2, ptr %1, align 4
  store i32 1, ptr %14, align 4
  br label %150

149:                                              ; preds = %139
  store i32 0, ptr %1, align 4
  store i32 1, ptr %14, align 4
  br label %150

150:                                              ; preds = %149, %145, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 9, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  %151 = load i32, ptr %1, align 4
  ret i32 %151
}

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare hidden void @initGIFConfig(ptr noundef, ptr noundef, i16 noundef zeroext, i16 noundef zeroext, ptr noundef, i16 noundef zeroext) #0

declare ptr @cgif_newgif(ptr noundef) #3

declare i32 @fputs(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #4

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

; 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 hidden void @initFrameConfig(ptr noundef, ptr noundef, i16 noundef zeroext) #0

declare i32 @cgif_addframe(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind
declare void @free(ptr noundef) #6

declare i32 @cgif_close(ptr noundef) #3

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

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 allocsize(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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }

!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, !11, i64 0}
!11 = !{!"any pointer", !6, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}


; 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.st_gifconfig = type { ptr, ptr, i32, i32, i16, i16, i16, i16, ptr, ptr }
%struct.st_frameconfig = type { ptr, ptr, i32, i32, i16, i16, i8 }

@__const.main.aPalette = external hidden unnamed_addr constant [9 x i8], align 1
@.str = external hidden unnamed_addr constant [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [44 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 3) i32 @main() local_unnamed_addr #0 {
  %1 = alloca %struct.st_gifconfig, align 8
  %2 = alloca %struct.st_frameconfig, align 8
  %3 = alloca [9 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %3) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(9) %3, ptr noundef nonnull align 1 dereferenceable(9) @__const.main.aPalette, i64 9, i1 false)
  call void @initGIFConfig(ptr noundef nonnull %1, ptr noundef nonnull @.str, i16 noundef zeroext 40, i16 noundef zeroext 40, ptr noundef nonnull %3, i16 noundef zeroext 3)
  %4 = call ptr @cgif_newgif(ptr noundef nonnull %1) #7
  %5 = icmp eq ptr %4, null
  br i1 %5, label %6, label %.preheader.preheader

6:                                                ; preds = %0
  %7 = load ptr, ptr @stderr, align 8, !tbaa !5
  %8 = call i32 @fputs(ptr noundef nonnull @.str.1, ptr noundef %7) #8
  br label %72

.preheader.preheader:                             ; preds = %0
  %calloc = call dereferenceable_or_null(1600) ptr @calloc(i64 1, i64 1600)
  %9 = getelementptr inbounds i8, ptr %calloc, i64 41
  store i8 1, ptr %9, align 1, !tbaa !9
  %10 = getelementptr inbounds i8, ptr %calloc, i64 81
  store i8 1, ptr %10, align 1, !tbaa !9
  %11 = getelementptr inbounds i8, ptr %calloc, i64 121
  store i8 1, ptr %11, align 1, !tbaa !9
  %12 = getelementptr inbounds i8, ptr %calloc, i64 161
  store i8 1, ptr %12, align 1, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %calloc, i64 201
  store i8 1, ptr %13, align 1, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %calloc, i64 241
  store i8 1, ptr %14, align 1, !tbaa !9
  %15 = getelementptr inbounds i8, ptr %calloc, i64 281
  store i8 1, ptr %15, align 1, !tbaa !9
  %16 = getelementptr inbounds i8, ptr %calloc, i64 321
  store i8 1, ptr %16, align 1, !tbaa !9
  %17 = getelementptr inbounds i8, ptr %calloc, i64 361
  store i8 1, ptr %17, align 1, !tbaa !9
  %18 = getelementptr inbounds i8, ptr %calloc, i64 401
  store i8 1, ptr %18, align 1, !tbaa !9
  %19 = getelementptr inbounds i8, ptr %calloc, i64 441
  store i8 1, ptr %19, align 1, !tbaa !9
  %20 = getelementptr inbounds i8, ptr %calloc, i64 481
  store i8 1, ptr %20, align 1, !tbaa !9
  %21 = getelementptr inbounds i8, ptr %calloc, i64 521
  store i8 1, ptr %21, align 1, !tbaa !9
  %22 = getelementptr inbounds i8, ptr %calloc, i64 561
  store i8 1, ptr %22, align 1, !tbaa !9
  br label %.preheader

.preheader:                                       ; preds = %64, %.preheader.preheader
  %.071 = phi i32 [ 0, %.preheader.preheader ], [ %66, %64 ]
  %.05670 = phi i32 [ 1, %.preheader.preheader ], [ %.1, %64 ]
  %.05769 = phi i32 [ 15, %.preheader.preheader ], [ %.158, %64 ]
  %.05968 = phi i32 [ 1, %.preheader.preheader ], [ %.160, %64 ]
  %.06167 = phi i32 [ 1, %.preheader.preheader ], [ %.162, %64 ]
  %23 = mul nsw i32 %.06167, 40
  %24 = add nsw i32 %.05670, %23
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds i8, ptr %calloc, i64 %25
  store i8 0, ptr %26, align 1, !tbaa !9
  %27 = mul nsw i32 %.05769, 40
  %28 = add nsw i32 %27, %.05968
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds i8, ptr %calloc, i64 %29
  store i8 1, ptr %30, align 1, !tbaa !9
  %31 = icmp eq i32 %.05670, 1
  %32 = icmp slt i32 %.06167, 38
  %or.cond = and i1 %31, %32
  br i1 %or.cond, label %33, label %35

33:                                               ; preds = %.preheader
  %34 = add nsw i32 %.06167, 1
  br label %47

35:                                               ; preds = %.preheader
  %36 = icmp eq i32 %.06167, 38
  %37 = icmp slt i32 %.05670, 38
  %or.cond3 = and i1 %36, %37
  br i1 %or.cond3, label %38, label %40

38:                                               ; preds = %35
  %39 = add nsw i32 %.05670, 1
  br label %47

40:                                               ; preds = %35
  %41 = icmp eq i32 %.05670, 38
  %42 = icmp sgt i32 %.06167, 1
  %or.cond5 = and i1 %41, %42
  br i1 %or.cond5, label %43, label %45

43:                                               ; preds = %40
  %44 = add nsw i32 %.06167, -1
  br label %47

45:                                               ; preds = %40
  %46 = add nsw i32 %.05670, -1
  br label %47

47:                                               ; preds = %38, %45, %43, %33
  %.162 = phi i32 [ %34, %33 ], [ 38, %38 ], [ %44, %43 ], [ %.06167, %45 ]
  %.1 = phi i32 [ 1, %33 ], [ %39, %38 ], [ 38, %43 ], [ %46, %45 ]
  %48 = icmp eq i32 %.05968, 1
  %49 = icmp slt i32 %.05769, 38
  %or.cond7 = and i1 %48, %49
  br i1 %or.cond7, label %50, label %52

50:                                               ; preds = %47
  %51 = add nsw i32 %.05769, 1
  br label %64

52:                                               ; preds = %47
  %53 = icmp eq i32 %.05769, 38
  %54 = icmp slt i32 %.05968, 38
  %or.cond9 = and i1 %53, %54
  br i1 %or.cond9, label %55, label %57

55:                                               ; preds = %52
  %56 = add nsw i32 %.05968, 1
  br label %64

57:                                               ; preds = %52
  %58 = icmp eq i32 %.05968, 38
  %59 = icmp sgt i32 %.05769, 1
  %or.cond11 = and i1 %58, %59
  br i1 %or.cond11, label %60, label %62

60:                                               ; preds = %57
  %61 = add nsw i32 %.05769, -1
  br label %64

62:                                               ; preds = %57
  %63 = add nsw i32 %.05968, -1
  br label %64

64:                                               ; preds = %55, %62, %60, %50
  %.160 = phi i32 [ 1, %50 ], [ %56, %55 ], [ 38, %60 ], [ %63, %62 ]
  %.158 = phi i32 [ %51, %50 ], [ 38, %55 ], [ %61, %60 ], [ %.05769, %62 ]
  call void @initFrameConfig(ptr noundef nonnull %2, ptr noundef nonnull %calloc, i16 noundef zeroext 5)
  %65 = call i32 @cgif_addframe(ptr noundef nonnull %4, ptr noundef nonnull %2) #7
  %.not = icmp ne i32 %65, 0
  %66 = add nuw nsw i32 %.071, 1
  %exitcond.not = icmp eq i32 %66, 148
  %or.cond73 = select i1 %.not, i1 true, i1 %exitcond.not
  br i1 %or.cond73, label %67, label %.preheader, !llvm.loop !10

67:                                               ; preds = %64
  call void @free(ptr noundef %calloc) #7
  %68 = call i32 @cgif_close(ptr noundef nonnull %4) #7
  %.not65 = icmp eq i32 %68, 0
  br i1 %.not65, label %72, label %69

69:                                               ; preds = %67
  %70 = load ptr, ptr @stderr, align 8, !tbaa !5
  %71 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %70, ptr noundef nonnull @.str.2, i32 noundef %68) #9
  br label %72

72:                                               ; preds = %67, %69, %6
  %.055 = phi i32 [ 1, %6 ], [ 2, %69 ], [ 0, %67 ]
  call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #7
  ret i32 %.055
}

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare hidden void @initGIFConfig(ptr noundef, ptr noundef, i16 noundef zeroext, i16 noundef zeroext, ptr noundef, i16 noundef zeroext) local_unnamed_addr #0

declare ptr @cgif_newgif(ptr noundef) local_unnamed_addr #3

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

; 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 hidden void @initFrameConfig(ptr noundef, ptr noundef, i16 noundef zeroext) local_unnamed_addr #0

declare i32 @cgif_addframe(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5

declare i32 @cgif_close(ptr noundef) local_unnamed_addr #3

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

; Function Attrs: nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #6

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #7 = { nounwind }
attributes #8 = { cold }
attributes #9 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,ReassociatePass,SROAPass,SimplifyCFGPass