; LLVM IR from libtcod/libtcod :: src/libtcod (console_etc)

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

@.str.5 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [18 x i8], align 1
@TCOD_console_save_asc.version = external hidden global float, align 4
@__PRETTY_FUNCTION__.TCOD_console_save_asc = external hidden unnamed_addr constant [58 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @TCOD_console_validate_(ptr 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 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

declare i24 @TCOD_console_get_char_background(ptr noundef, i32 noundef, i32 noundef) #4

declare i32 @TCOD_console_get_char(ptr noundef, i32 noundef, i32 noundef) #4

declare i24 @TCOD_console_get_char_foreground(ptr noundef, i32 noundef, i32 noundef) #4

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

declare i32 @fclose(ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @TCOD_console_save_asc(ptr noundef %0, ptr noundef %1) #5 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %struct.TCOD_ColorRGB, align 1
  %9 = alloca %struct.TCOD_ColorRGB, align 1
  %10 = alloca i32, align 4
  %11 = alloca %struct.TCOD_ColorRGB, align 1
  %12 = alloca %struct.TCOD_ColorRGB, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = call ptr @TCOD_console_validate_(ptr noundef %13)
  store ptr %14, ptr %3, align 8, !tbaa !5
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %18

17:                                               ; preds = %2
  br label %19

18:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.17, ptr noundef @.str.5, i32 noundef 690, ptr noundef @__PRETTY_FUNCTION__.TCOD_console_save_asc) #8
  unreachable

19:                                               ; preds = %17
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = icmp ne ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %19
  br label %24

23:                                               ; preds = %19
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.5, i32 noundef 691, ptr noundef @__PRETTY_FUNCTION__.TCOD_console_save_asc) #8
  unreachable

24:                                               ; preds = %22
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.TCOD_Console, ptr %25, i32 0, i32 0
  %27 = load i32, ptr %26, align 8, !tbaa !9
  %28 = icmp sgt i32 %27, 0
  br i1 %28, label %29, label %35

29:                                               ; preds = %24
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.TCOD_Console, ptr %30, i32 0, i32 1
  %32 = load i32, ptr %31, align 4, !tbaa !14
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %34, label %35

34:                                               ; preds = %29
  br label %36

35:                                               ; preds = %29, %24
  call void @__assert_fail(ptr noundef @.str.18, ptr noundef @.str.5, i32 noundef 692, ptr noundef @__PRETTY_FUNCTION__.TCOD_console_save_asc) #8
  unreachable

36:                                               ; preds = %34
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = call noalias ptr @fopen(ptr noundef %37, ptr noundef @.str.19)
  store ptr %38, ptr %5, align 8, !tbaa !5
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %42

41:                                               ; preds = %36
  br label %43

42:                                               ; preds = %36
  call void @__assert_fail(ptr noundef @.str.12, ptr noundef @.str.5, i32 noundef 694, ptr noundef @__PRETTY_FUNCTION__.TCOD_console_save_asc) #8
  unreachable

43:                                               ; preds = %41
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = load float, ptr @TCOD_console_save_asc.version, align 4, !tbaa !15
  %46 = fpext float %45 to double
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef @.str.20, double noundef %46) #7
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.TCOD_Console, ptr %49, i32 0, i32 0
  %51 = load i32, ptr %50, align 8, !tbaa !9
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.TCOD_Console, ptr %52, i32 0, i32 1
  %54 = load i32, ptr %53, align 4, !tbaa !14
  %55 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef @.str.21, i32 noundef %51, i32 noundef %54) #7
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = call i32 @fputc(i32 noundef 35, ptr noundef %56)
  store i32 0, ptr %6, align 4, !tbaa !17
  br label %58

58:                                               ; preds = %125, %43
  %59 = load i32, ptr %6, align 4, !tbaa !17
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.TCOD_Console, ptr %60, i32 0, i32 0
  %62 = load i32, ptr %61, align 8, !tbaa !9
  %63 = icmp slt i32 %59, %62
  br i1 %63, label %64, label %128

64:                                               ; preds = %58
  store i32 0, ptr %7, align 4, !tbaa !17
  br label %65

65:                                               ; preds = %121, %64
  %66 = load i32, ptr %7, align 4, !tbaa !17
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.TCOD_Console, ptr %67, i32 0, i32 1
  %69 = load i32, ptr %68, align 4, !tbaa !14
  %70 = icmp slt i32 %66, %69
  br i1 %70, label %71, label %124

71:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 3, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 3, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = load i32, ptr %6, align 4, !tbaa !17
  %74 = load i32, ptr %7, align 4, !tbaa !17
  %75 = call i32 @TCOD_console_get_char(ptr noundef %72, i32 noundef %73, i32 noundef %74)
  store i32 %75, ptr %10, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 3, ptr %11) #7
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = load i32, ptr %6, align 4, !tbaa !17
  %78 = load i32, ptr %7, align 4, !tbaa !17
  %79 = call i24 @TCOD_console_get_char_foreground(ptr noundef %76, i32 noundef %77, i32 noundef %78)
  store i24 %79, ptr %11, align 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %8, ptr align 1 %11, i64 3, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 3, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 3, ptr %12) #7
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = load i32, ptr %6, align 4, !tbaa !17
  %82 = load i32, ptr %7, align 4, !tbaa !17
  %83 = call i24 @TCOD_console_get_char_background(ptr noundef %80, i32 noundef %81, i32 noundef %82)
  store i24 %83, ptr %12, align 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %9, ptr align 1 %12, i64 3, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 3, ptr %12) #7
  %84 = load i32, ptr %10, align 4, !tbaa !17
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = call i32 @fputc(i32 noundef %84, ptr noundef %85)
  %87 = getelementptr inbounds %struct.TCOD_ColorRGB, ptr %8, i32 0, i32 0
  %88 = load i8, ptr %87, align 1, !tbaa !20
  %89 = zext i8 %88 to i32
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = call i32 @fputc(i32 noundef %89, ptr noundef %90)
  %92 = getelementptr inbounds %struct.TCOD_ColorRGB, ptr %8, i32 0, i32 1
  %93 = load i8, ptr %92, align 1, !tbaa !21
  %94 = zext i8 %93 to i32
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = call i32 @fputc(i32 noundef %94, ptr noundef %95)
  %97 = getelementptr inbounds %struct.TCOD_ColorRGB, ptr %8, i32 0, i32 2
  %98 = load i8, ptr %97, align 1, !tbaa !22
  %99 = zext i8 %98 to i32
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = call i32 @fputc(i32 noundef %99, ptr noundef %100)
  %102 = getelementptr inbounds %struct.TCOD_ColorRGB, ptr %9, i32 0, i32 0
  %103 = load i8, ptr %102, align 1, !tbaa !20
  %104 = zext i8 %103 to i32
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = call i32 @fputc(i32 noundef %104, ptr noundef %105)
  %107 = getelementptr inbounds %struct.TCOD_ColorRGB, ptr %9, i32 0, i32 1
  %108 = load i8, ptr %107, align 1, !tbaa !21
  %109 = zext i8 %108 to i32
  %110 = load ptr, ptr %5, align 8, !tbaa !5
  %111 = call i32 @fputc(i32 noundef %109, ptr noundef %110)
  %112 = getelementptr inbounds %struct.TCOD_ColorRGB, ptr %9, i32 0, i32 2
  %113 = load i8, ptr %112, align 1, !tbaa !22
  %114 = zext i8 %113 to i32
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = call i32 @fputc(i32 noundef %114, ptr noundef %115)
  %117 = load ptr, ptr %5, align 8, !tbaa !5
  %118 = call i32 @fputc(i32 noundef 0, ptr noundef %117)
  %119 = load ptr, ptr %5, align 8, !tbaa !5
  %120 = call i32 @fputc(i32 noundef 1, ptr noundef %119)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 3, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 3, ptr %8) #7
  br label %121

121:                                              ; preds = %71
  %122 = load i32, ptr %7, align 4, !tbaa !17
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %7, align 4, !tbaa !17
  br label %65, !llvm.loop !23

124:                                              ; preds = %65
  br label %125

125:                                              ; preds = %124
  %126 = load i32, ptr %6, align 4, !tbaa !17
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %6, align 4, !tbaa !17
  br label %58, !llvm.loop !25

128:                                              ; preds = %58
  %129 = load ptr, ptr %5, align 8, !tbaa !5
  %130 = call i32 @fclose(ptr noundef %129)
  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
  ret i1 true
}

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

declare i32 @fputc(i32 noundef, ptr noundef) #4

attributes #0 = { inlinehint 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 = { noreturn 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 #4 = { "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 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 #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 = { noreturn nounwind }

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

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


; 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.5 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [18 x i8], align 1
@TCOD_console_save_asc.version = external hidden local_unnamed_addr global float, align 4
@__PRETTY_FUNCTION__.TCOD_console_save_asc = external hidden unnamed_addr constant [58 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @TCOD_console_validate_(ptr noundef) local_unnamed_addr #0

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare i24 @TCOD_console_get_char_background(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

declare i32 @TCOD_console_get_char(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

declare i24 @TCOD_console_get_char_foreground(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @TCOD_console_save_asc(ptr noundef %0, ptr noundef readonly %1) local_unnamed_addr #4 {
  %3 = tail call ptr @TCOD_console_validate_(ptr noundef %0)
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %4, label %5

4:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.5, i32 noundef 690, ptr noundef nonnull @__PRETTY_FUNCTION__.TCOD_console_save_asc) #5
  unreachable

5:                                                ; preds = %2
  %.not46 = icmp eq ptr %1, null
  br i1 %.not46, label %6, label %7

6:                                                ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.5, i32 noundef 691, ptr noundef nonnull @__PRETTY_FUNCTION__.TCOD_console_save_asc) #5
  unreachable

7:                                                ; preds = %5
  %8 = load i32, ptr %3, align 8, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %10, label %14

10:                                               ; preds = %7
  %11 = getelementptr inbounds i8, ptr %3, i64 4
  %12 = load i32, ptr %11, align 4, !tbaa !13
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %15, label %14

14:                                               ; preds = %10, %7
  tail call void @__assert_fail(ptr noundef nonnull @.str.18, ptr noundef nonnull @.str.5, i32 noundef 692, ptr noundef nonnull @__PRETTY_FUNCTION__.TCOD_console_save_asc) #5
  unreachable

15:                                               ; preds = %10
  %16 = tail call noalias ptr @fopen(ptr noundef nonnull %1, ptr noundef nonnull @.str.19)
  %.not47 = icmp eq ptr %16, null
  br i1 %.not47, label %17, label %18

17:                                               ; preds = %15
  tail call void @__assert_fail(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.5, i32 noundef 694, ptr noundef nonnull @__PRETTY_FUNCTION__.TCOD_console_save_asc) #5
  unreachable

18:                                               ; preds = %15
  %19 = load float, ptr @TCOD_console_save_asc.version, align 4, !tbaa !14
  %20 = fpext float %19 to double
  %21 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %16, ptr noundef nonnull @.str.20, double noundef %20) #6
  %22 = load i32, ptr %3, align 8, !tbaa !5
  %23 = load i32, ptr %11, align 4, !tbaa !13
  %24 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %16, ptr noundef nonnull @.str.21, i32 noundef %22, i32 noundef %23) #6
  %25 = tail call i32 @fputc(i32 noundef 35, ptr noundef nonnull %16)
  %26 = load i32, ptr %3, align 8, !tbaa !5
  %27 = icmp sgt i32 %26, 0
  br i1 %27, label %.preheader.lr.ph, label %._crit_edge50

.preheader.lr.ph:                                 ; preds = %18
  %28 = load i32, ptr %11, align 4, !tbaa !13
  %29 = icmp sgt i32 %28, 0
  br i1 %29, label %.preheader, label %._crit_edge50

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge
  %30 = phi i32 [ %56, %._crit_edge ], [ %26, %.preheader.lr.ph ]
  %31 = phi i32 [ %57, %._crit_edge ], [ %28, %.preheader.lr.ph ]
  %.049 = phi i32 [ %58, %._crit_edge ], [ 0, %.preheader.lr.ph ]
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.04248 = phi i32 [ %53, %.lr.ph ], [ 0, %.preheader ]
  %33 = tail call i32 @TCOD_console_get_char(ptr noundef nonnull %3, i32 noundef %.049, i32 noundef %.04248) #6
  %34 = tail call i24 @TCOD_console_get_char_foreground(ptr noundef nonnull %3, i32 noundef %.049, i32 noundef %.04248) #6
  %.sroa.44.0.extract.shift = lshr i24 %34, 8
  %.sroa.55.0.extract.shift = lshr i24 %34, 16
  %.sroa.55.0.extract.trunc = zext nneg i24 %.sroa.55.0.extract.shift to i32
  %35 = tail call i24 @TCOD_console_get_char_background(ptr noundef nonnull %3, i32 noundef %.049, i32 noundef %.04248) #6
  %.sroa.4.0.extract.shift = lshr i24 %35, 8
  %.sroa.5.0.extract.shift = lshr i24 %35, 16
  %.sroa.5.0.extract.trunc = zext nneg i24 %.sroa.5.0.extract.shift to i32
  %36 = tail call i32 @fputc(i32 noundef %33, ptr noundef nonnull %16)
  %37 = and i24 %34, 255
  %38 = zext nneg i24 %37 to i32
  %39 = tail call i32 @fputc(i32 noundef %38, ptr noundef nonnull %16)
  %40 = and i24 %.sroa.44.0.extract.shift, 255
  %41 = zext nneg i24 %40 to i32
  %42 = tail call i32 @fputc(i32 noundef %41, ptr noundef nonnull %16)
  %43 = tail call i32 @fputc(i32 noundef %.sroa.55.0.extract.trunc, ptr noundef nonnull %16)
  %44 = and i24 %35, 255
  %45 = zext nneg i24 %44 to i32
  %46 = tail call i32 @fputc(i32 noundef %45, ptr noundef nonnull %16)
  %47 = and i24 %.sroa.4.0.extract.shift, 255
  %48 = zext nneg i24 %47 to i32
  %49 = tail call i32 @fputc(i32 noundef %48, ptr noundef nonnull %16)
  %50 = tail call i32 @fputc(i32 noundef %.sroa.5.0.extract.trunc, ptr noundef nonnull %16)
  %51 = tail call i32 @fputc(i32 noundef 0, ptr noundef nonnull %16)
  %52 = tail call i32 @fputc(i32 noundef 1, ptr noundef nonnull %16)
  %53 = add nuw nsw i32 %.04248, 1
  %54 = load i32, ptr %11, align 4, !tbaa !13
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !16

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i32, ptr %3, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %56 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %30, %.preheader ]
  %57 = phi i32 [ %54, %._crit_edge.loopexit ], [ %31, %.preheader ]
  %58 = add nuw nsw i32 %.049, 1
  %59 = icmp slt i32 %58, %56
  br i1 %59, label %.preheader, label %._crit_edge50, !llvm.loop !18

._crit_edge50:                                    ; preds = %._crit_edge, %.preheader.lr.ph, %18
  %60 = tail call i32 @fclose(ptr noundef nonnull %16)
  ret i1 true
}

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

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

attributes #0 = { inlinehint 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 = { noreturn 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 #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 = { 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 #4 = { 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 #5 = { noreturn nounwind }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"TCOD_Console", !7, i64 0, !7, i64 4, !10, i64 8, !7, i64 16, !7, i64 20, !11, i64 24, !11, i64 27, !12, i64 30, !11, i64 31, !7, i64 36, !10, i64 40, !10, i64 48}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"TCOD_ColorRGB", !8, i64 0, !8, i64 1, !8, i64 2}
!12 = !{!"_Bool", !8, i64 0}
!13 = !{!6, !7, i64 4}
!14 = !{!15, !15, i64 0}
!15 = !{!"float", !8, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17, !19}
!19 = !{!"llvm.loop.unswitch.partial.disable"}


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