; LLVM IR from BrunoLevy/learn-fpga :: LiteX/software/Doom/mc1-doom/src (wi_stuff)

; 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.patch_t = type { i16, i16, i16, i16, [8 x i32] }

@percent = external hidden global ptr, align 8
@playeringame = external global [4 x i32], align 16
@p = external hidden global [4 x ptr], align 16
@me = external hidden global i32, align 4
@star = external hidden global ptr, align 8
@cnt_frags = external hidden global [4 x i32], align 16
@cnt_secret = external hidden global [4 x i32], align 16
@cnt_items = external hidden global [4 x i32], align 16
@cnt_kills = external hidden global [4 x i32], align 16
@dofrags = external hidden global i32, align 4
@kills = external hidden global ptr, align 8
@items = external hidden global ptr, align 8
@secret = external hidden global ptr, align 8
@frags = external hidden global ptr, align 8

; Function Attrs: nounwind uwtable
declare dso_local void @WI_slamBackground() #0

; Function Attrs: nounwind uwtable
declare dso_local void @WI_drawLF() #0

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

declare void @V_DrawPatch(i32 noundef, i32 noundef, i32 noundef, ptr noundef) #2

; 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 @WI_drawAnimatedBack() #0

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

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

; Function Attrs: nounwind uwtable
define dso_local void @WI_drawNetgameStats() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %5 = load ptr, ptr @percent, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.patch_t, ptr %5, i32 0, i32 0
  %7 = load i16, ptr %6, align 4, !tbaa !9
  %8 = sext i16 %7 to i32
  store i32 %8, ptr %4, align 4, !tbaa !12
  call void @WI_slamBackground()
  call void @WI_drawAnimatedBack()
  call void @WI_drawLF()
  %9 = load ptr, ptr @star, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.patch_t, ptr %9, i32 0, i32 0
  %11 = load i16, ptr %10, align 4, !tbaa !9
  %12 = sext i16 %11 to i32
  %13 = sdiv i32 %12, 2
  %14 = add nsw i32 32, %13
  %15 = load i32, ptr @dofrags, align 4, !tbaa !12
  %16 = icmp ne i32 %15, 0
  %17 = xor i1 %16, true
  %18 = zext i1 %17 to i32
  %19 = mul nsw i32 32, %18
  %20 = add nsw i32 %14, %19
  %21 = add nsw i32 %20, 64
  %22 = load ptr, ptr @kills, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.patch_t, ptr %22, i32 0, i32 0
  %24 = load i16, ptr %23, align 4, !tbaa !9
  %25 = sext i16 %24 to i32
  %26 = sub nsw i32 %21, %25
  %27 = load ptr, ptr @kills, align 8, !tbaa !5
  call void @V_DrawPatch(i32 noundef %26, i32 noundef 50, i32 noundef 0, ptr noundef %27)
  %28 = load ptr, ptr @star, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.patch_t, ptr %28, i32 0, i32 0
  %30 = load i16, ptr %29, align 4, !tbaa !9
  %31 = sext i16 %30 to i32
  %32 = sdiv i32 %31, 2
  %33 = add nsw i32 32, %32
  %34 = load i32, ptr @dofrags, align 4, !tbaa !12
  %35 = icmp ne i32 %34, 0
  %36 = xor i1 %35, true
  %37 = zext i1 %36 to i32
  %38 = mul nsw i32 32, %37
  %39 = add nsw i32 %33, %38
  %40 = add nsw i32 %39, 128
  %41 = load ptr, ptr @items, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.patch_t, ptr %41, i32 0, i32 0
  %43 = load i16, ptr %42, align 4, !tbaa !9
  %44 = sext i16 %43 to i32
  %45 = sub nsw i32 %40, %44
  %46 = load ptr, ptr @items, align 8, !tbaa !5
  call void @V_DrawPatch(i32 noundef %45, i32 noundef 50, i32 noundef 0, ptr noundef %46)
  %47 = load ptr, ptr @star, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.patch_t, ptr %47, i32 0, i32 0
  %49 = load i16, ptr %48, align 4, !tbaa !9
  %50 = sext i16 %49 to i32
  %51 = sdiv i32 %50, 2
  %52 = add nsw i32 32, %51
  %53 = load i32, ptr @dofrags, align 4, !tbaa !12
  %54 = icmp ne i32 %53, 0
  %55 = xor i1 %54, true
  %56 = zext i1 %55 to i32
  %57 = mul nsw i32 32, %56
  %58 = add nsw i32 %52, %57
  %59 = add nsw i32 %58, 192
  %60 = load ptr, ptr @secret, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.patch_t, ptr %60, i32 0, i32 0
  %62 = load i16, ptr %61, align 4, !tbaa !9
  %63 = sext i16 %62 to i32
  %64 = sub nsw i32 %59, %63
  %65 = load ptr, ptr @secret, align 8, !tbaa !5
  call void @V_DrawPatch(i32 noundef %64, i32 noundef 50, i32 noundef 0, ptr noundef %65)
  %66 = load i32, ptr @dofrags, align 4, !tbaa !12
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %68, label %88

68:                                               ; preds = %0
  %69 = load ptr, ptr @star, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.patch_t, ptr %69, i32 0, i32 0
  %71 = load i16, ptr %70, align 4, !tbaa !9
  %72 = sext i16 %71 to i32
  %73 = sdiv i32 %72, 2
  %74 = add nsw i32 32, %73
  %75 = load i32, ptr @dofrags, align 4, !tbaa !12
  %76 = icmp ne i32 %75, 0
  %77 = xor i1 %76, true
  %78 = zext i1 %77 to i32
  %79 = mul nsw i32 32, %78
  %80 = add nsw i32 %74, %79
  %81 = add nsw i32 %80, 256
  %82 = load ptr, ptr @frags, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.patch_t, ptr %82, i32 0, i32 0
  %84 = load i16, ptr %83, align 4, !tbaa !9
  %85 = sext i16 %84 to i32
  %86 = sub nsw i32 %81, %85
  %87 = load ptr, ptr @frags, align 8, !tbaa !5
  call void @V_DrawPatch(i32 noundef %86, i32 noundef 50, i32 noundef 0, ptr noundef %87)
  br label %88

88:                                               ; preds = %68, %0
  %89 = load ptr, ptr @kills, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.patch_t, ptr %89, i32 0, i32 1
  %91 = load i16, ptr %90, align 2, !tbaa !14
  %92 = sext i16 %91 to i32
  %93 = add nsw i32 50, %92
  store i32 %93, ptr %3, align 4, !tbaa !12
  store i32 0, ptr %1, align 4, !tbaa !12
  br label %94

94:                                               ; preds = %196, %88
  %95 = load i32, ptr %1, align 4, !tbaa !12
  %96 = icmp slt i32 %95, 4
  br i1 %96, label %97, label %199

97:                                               ; preds = %94
  %98 = load i32, ptr %1, align 4, !tbaa !12
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [4 x i32], ptr @playeringame, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !12
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %104, label %103

103:                                              ; preds = %97
  br label %196

104:                                              ; preds = %97
  %105 = load ptr, ptr @star, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.patch_t, ptr %105, i32 0, i32 0
  %107 = load i16, ptr %106, align 4, !tbaa !9
  %108 = sext i16 %107 to i32
  %109 = sdiv i32 %108, 2
  %110 = add nsw i32 32, %109
  %111 = load i32, ptr @dofrags, align 4, !tbaa !12
  %112 = icmp ne i32 %111, 0
  %113 = xor i1 %112, true
  %114 = zext i1 %113 to i32
  %115 = mul nsw i32 32, %114
  %116 = add nsw i32 %110, %115
  store i32 %116, ptr %2, align 4, !tbaa !12
  %117 = load i32, ptr %2, align 4, !tbaa !12
  %118 = load i32, ptr %1, align 4, !tbaa !12
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [4 x ptr], ptr @p, i64 0, i64 %119
  %121 = load ptr, ptr %120, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.patch_t, ptr %121, i32 0, i32 0
  %123 = load i16, ptr %122, align 4, !tbaa !9
  %124 = sext i16 %123 to i32
  %125 = sub nsw i32 %117, %124
  %126 = load i32, ptr %3, align 4, !tbaa !12
  %127 = load i32, ptr %1, align 4, !tbaa !12
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [4 x ptr], ptr @p, i64 0, i64 %128
  %130 = load ptr, ptr %129, align 8, !tbaa !5
  call void @V_DrawPatch(i32 noundef %125, i32 noundef %126, i32 noundef 0, ptr noundef %130)
  %131 = load i32, ptr %1, align 4, !tbaa !12
  %132 = load i32, ptr @me, align 4, !tbaa !12
  %133 = icmp eq i32 %131, %132
  br i1 %133, label %134, label %146

134:                                              ; preds = %104
  %135 = load i32, ptr %2, align 4, !tbaa !12
  %136 = load i32, ptr %1, align 4, !tbaa !12
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [4 x ptr], ptr @p, i64 0, i64 %137
  %139 = load ptr, ptr %138, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.patch_t, ptr %139, i32 0, i32 0
  %141 = load i16, ptr %140, align 4, !tbaa !9
  %142 = sext i16 %141 to i32
  %143 = sub nsw i32 %135, %142
  %144 = load i32, ptr %3, align 4, !tbaa !12
  %145 = load ptr, ptr @star, align 8, !tbaa !5
  call void @V_DrawPatch(i32 noundef %143, i32 noundef %144, i32 noundef 0, ptr noundef %145)
  br label %146

146:                                              ; preds = %134, %104
  %147 = load i32, ptr %2, align 4, !tbaa !12
  %148 = add nsw i32 %147, 64
  store i32 %148, ptr %2, align 4, !tbaa !12
  %149 = load i32, ptr %2, align 4, !tbaa !12
  %150 = load i32, ptr %4, align 4, !tbaa !12
  %151 = sub nsw i32 %149, %150
  %152 = load i32, ptr %3, align 4, !tbaa !12
  %153 = add nsw i32 %152, 10
  %154 = load i32, ptr %1, align 4, !tbaa !12
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [4 x i32], ptr @cnt_kills, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !12
  call void @WI_drawPercent(i32 noundef %151, i32 noundef %153, i32 noundef %157)
  %158 = load i32, ptr %2, align 4, !tbaa !12
  %159 = add nsw i32 %158, 64
  store i32 %159, ptr %2, align 4, !tbaa !12
  %160 = load i32, ptr %2, align 4, !tbaa !12
  %161 = load i32, ptr %4, align 4, !tbaa !12
  %162 = sub nsw i32 %160, %161
  %163 = load i32, ptr %3, align 4, !tbaa !12
  %164 = add nsw i32 %163, 10
  %165 = load i32, ptr %1, align 4, !tbaa !12
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [4 x i32], ptr @cnt_items, i64 0, i64 %166
  %168 = load i32, ptr %167, align 4, !tbaa !12
  call void @WI_drawPercent(i32 noundef %162, i32 noundef %164, i32 noundef %168)
  %169 = load i32, ptr %2, align 4, !tbaa !12
  %170 = add nsw i32 %169, 64
  store i32 %170, ptr %2, align 4, !tbaa !12
  %171 = load i32, ptr %2, align 4, !tbaa !12
  %172 = load i32, ptr %4, align 4, !tbaa !12
  %173 = sub nsw i32 %171, %172
  %174 = load i32, ptr %3, align 4, !tbaa !12
  %175 = add nsw i32 %174, 10
  %176 = load i32, ptr %1, align 4, !tbaa !12
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [4 x i32], ptr @cnt_secret, i64 0, i64 %177
  %179 = load i32, ptr %178, align 4, !tbaa !12
  call void @WI_drawPercent(i32 noundef %173, i32 noundef %175, i32 noundef %179)
  %180 = load i32, ptr %2, align 4, !tbaa !12
  %181 = add nsw i32 %180, 64
  store i32 %181, ptr %2, align 4, !tbaa !12
  %182 = load i32, ptr @dofrags, align 4, !tbaa !12
  %183 = icmp ne i32 %182, 0
  br i1 %183, label %184, label %193

184:                                              ; preds = %146
  %185 = load i32, ptr %2, align 4, !tbaa !12
  %186 = load i32, ptr %3, align 4, !tbaa !12
  %187 = add nsw i32 %186, 10
  %188 = load i32, ptr %1, align 4, !tbaa !12
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [4 x i32], ptr @cnt_frags, i64 0, i64 %189
  %191 = load i32, ptr %190, align 4, !tbaa !12
  %192 = call i32 @WI_drawNum(i32 noundef %185, i32 noundef %187, i32 noundef %191, i32 noundef -1)
  br label %193

193:                                              ; preds = %184, %146
  %194 = load i32, ptr %3, align 4, !tbaa !12
  %195 = add nsw i32 %194, 33
  store i32 %195, ptr %3, align 4, !tbaa !12
  br label %196

196:                                              ; preds = %193, %103
  %197 = load i32, ptr %1, align 4, !tbaa !12
  %198 = add nsw i32 %197, 1
  store i32 %198, ptr %1, align 4, !tbaa !12
  br label %94, !llvm.loop !15

199:                                              ; preds = %94
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #3
  ret void
}

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 }

!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 = !{!"", !11, i64 0, !11, i64 2, !11, i64 4, !11, i64 6, !7, i64 8}
!11 = !{!"short", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!10, !11, i64 2}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


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

@percent = external hidden local_unnamed_addr global ptr, align 8
@playeringame = external local_unnamed_addr global [4 x i32], align 16
@p = external hidden local_unnamed_addr global [4 x ptr], align 16
@me = external hidden local_unnamed_addr global i32, align 4
@star = external hidden local_unnamed_addr global ptr, align 8
@cnt_frags = external hidden local_unnamed_addr global [4 x i32], align 16
@cnt_secret = external hidden local_unnamed_addr global [4 x i32], align 16
@cnt_items = external hidden local_unnamed_addr global [4 x i32], align 16
@cnt_kills = external hidden local_unnamed_addr global [4 x i32], align 16
@dofrags = external hidden local_unnamed_addr global i32, align 4
@kills = external hidden local_unnamed_addr global ptr, align 8
@items = external hidden local_unnamed_addr global ptr, align 8
@secret = external hidden local_unnamed_addr global ptr, align 8
@frags = external hidden local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
declare dso_local void @WI_slamBackground() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @WI_drawLF() local_unnamed_addr #0

declare void @V_DrawPatch(i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @WI_drawAnimatedBack() local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local void @WI_drawNetgameStats() local_unnamed_addr #0 {
  %1 = load ptr, ptr @percent, align 8, !tbaa !5
  %2 = load i16, ptr %1, align 4, !tbaa !9
  %3 = sext i16 %2 to i32
  tail call void @WI_slamBackground()
  tail call void @WI_drawAnimatedBack()
  tail call void @WI_drawLF()
  %4 = load ptr, ptr @star, align 8, !tbaa !5
  %5 = load i16, ptr %4, align 4, !tbaa !9
  %6 = sdiv i16 %5, 2
  %7 = load i32, ptr @dofrags, align 4, !tbaa !12
  %.not = icmp eq i32 %7, 0
  %8 = select i1 %.not, i32 32, i32 0
  %9 = load ptr, ptr @kills, align 8, !tbaa !5
  %10 = load i16, ptr %9, align 4, !tbaa !9
  %11 = sext i16 %10 to i32
  %narrow = add nsw i16 %6, 96
  %12 = sext i16 %narrow to i32
  %13 = add nsw i32 %8, %12
  %14 = sub nsw i32 %13, %11
  tail call void @V_DrawPatch(i32 noundef %14, i32 noundef 50, i32 noundef 0, ptr noundef nonnull %9) #2
  %15 = load ptr, ptr @star, align 8, !tbaa !5
  %16 = load i16, ptr %15, align 4, !tbaa !9
  %17 = sdiv i16 %16, 2
  %18 = load i32, ptr @dofrags, align 4, !tbaa !12
  %.not33 = icmp eq i32 %18, 0
  %19 = select i1 %.not33, i32 32, i32 0
  %20 = load ptr, ptr @items, align 8, !tbaa !5
  %21 = load i16, ptr %20, align 4, !tbaa !9
  %22 = sext i16 %21 to i32
  %narrow48 = add nsw i16 %17, 160
  %23 = sext i16 %narrow48 to i32
  %24 = add nsw i32 %19, %23
  %25 = sub nsw i32 %24, %22
  tail call void @V_DrawPatch(i32 noundef %25, i32 noundef 50, i32 noundef 0, ptr noundef nonnull %20) #2
  %26 = load ptr, ptr @star, align 8, !tbaa !5
  %27 = load i16, ptr %26, align 4, !tbaa !9
  %28 = sdiv i16 %27, 2
  %29 = load i32, ptr @dofrags, align 4, !tbaa !12
  %.not35 = icmp eq i32 %29, 0
  %30 = select i1 %.not35, i32 32, i32 0
  %31 = load ptr, ptr @secret, align 8, !tbaa !5
  %32 = load i16, ptr %31, align 4, !tbaa !9
  %33 = sext i16 %32 to i32
  %narrow49 = add nsw i16 %28, 224
  %34 = sext i16 %narrow49 to i32
  %35 = add nsw i32 %30, %34
  %36 = sub nsw i32 %35, %33
  tail call void @V_DrawPatch(i32 noundef %36, i32 noundef 50, i32 noundef 0, ptr noundef nonnull %31) #2
  %37 = load i32, ptr @dofrags, align 4, !tbaa !12
  %.not36 = icmp eq i32 %37, 0
  br i1 %.not36, label %47, label %38

38:                                               ; preds = %0
  %39 = load ptr, ptr @star, align 8, !tbaa !5
  %40 = load i16, ptr %39, align 4, !tbaa !9
  %41 = sdiv i16 %40, 2
  %narrow38 = add nsw i16 %41, 288
  %42 = sext i16 %narrow38 to i32
  %43 = load ptr, ptr @frags, align 8, !tbaa !5
  %44 = load i16, ptr %43, align 4, !tbaa !9
  %45 = sext i16 %44 to i32
  %46 = sub nsw i32 %42, %45
  tail call void @V_DrawPatch(i32 noundef %46, i32 noundef 50, i32 noundef 0, ptr noundef nonnull %43) #2
  br label %47

47:                                               ; preds = %38, %0
  %48 = load ptr, ptr @kills, align 8, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %48, i64 2
  %50 = load i16, ptr %49, align 2, !tbaa !14
  %51 = sext i16 %50 to i32
  %52 = add nsw i32 %51, 50
  %53 = load i32, ptr @playeringame, align 16, !tbaa !12
  %.not39 = icmp eq i32 %53, 0
  br i1 %.not39, label %89, label %54

54:                                               ; preds = %47
  %55 = load ptr, ptr @star, align 8, !tbaa !5
  %56 = load i16, ptr %55, align 4, !tbaa !9
  %57 = sdiv i16 %56, 2
  %narrow40 = add nsw i16 %57, 32
  %58 = sext i16 %narrow40 to i32
  %59 = load i32, ptr @dofrags, align 4, !tbaa !12
  %.not41 = icmp eq i32 %59, 0
  %60 = select i1 %.not41, i32 32, i32 0
  %61 = add nsw i32 %60, %58
  %62 = load ptr, ptr @p, align 16, !tbaa !5
  %63 = load i16, ptr %62, align 4, !tbaa !9
  %64 = sext i16 %63 to i32
  %65 = sub nsw i32 %61, %64
  tail call void @V_DrawPatch(i32 noundef %65, i32 noundef %52, i32 noundef 0, ptr noundef nonnull %62) #2
  %66 = load i32, ptr @me, align 4, !tbaa !12
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %68, label %74

68:                                               ; preds = %54
  %69 = load ptr, ptr @p, align 16, !tbaa !5
  %70 = load i16, ptr %69, align 4, !tbaa !9
  %71 = sext i16 %70 to i32
  %72 = sub nsw i32 %61, %71
  %73 = load ptr, ptr @star, align 8, !tbaa !5
  tail call void @V_DrawPatch(i32 noundef %72, i32 noundef %52, i32 noundef 0, ptr noundef %73) #2
  br label %74

74:                                               ; preds = %68, %54
  %reass.sub = sub nsw i32 %61, %3
  %75 = add nsw i32 %reass.sub, 64
  %76 = add nsw i32 %51, 60
  %77 = load i32, ptr @cnt_kills, align 16, !tbaa !12
  tail call void @WI_drawPercent(i32 noundef %75, i32 noundef %76, i32 noundef %77)
  %78 = add nsw i32 %reass.sub, 128
  %79 = load i32, ptr @cnt_items, align 16, !tbaa !12
  tail call void @WI_drawPercent(i32 noundef %78, i32 noundef %76, i32 noundef %79)
  %80 = add nsw i32 %reass.sub, 192
  %81 = load i32, ptr @cnt_secret, align 16, !tbaa !12
  tail call void @WI_drawPercent(i32 noundef %80, i32 noundef %76, i32 noundef %81)
  %82 = load i32, ptr @dofrags, align 4, !tbaa !12
  %.not42 = icmp eq i32 %82, 0
  br i1 %.not42, label %87, label %83

83:                                               ; preds = %74
  %84 = add nsw i32 %61, 256
  %85 = load i32, ptr @cnt_frags, align 16, !tbaa !12
  %86 = tail call i32 @WI_drawNum(i32 noundef %84, i32 noundef %76, i32 noundef %85, i32 noundef -1)
  br label %87

87:                                               ; preds = %83, %74
  %88 = add nsw i32 %51, 83
  br label %89

89:                                               ; preds = %47, %87
  %.1 = phi i32 [ %88, %87 ], [ %52, %47 ]
  %90 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 4), align 4, !tbaa !12
  %.not39.1 = icmp eq i32 %90, 0
  br i1 %.not39.1, label %126, label %91

91:                                               ; preds = %89
  %92 = load ptr, ptr @star, align 8, !tbaa !5
  %93 = load i16, ptr %92, align 4, !tbaa !9
  %94 = sdiv i16 %93, 2
  %narrow40.1 = add nsw i16 %94, 32
  %95 = sext i16 %narrow40.1 to i32
  %96 = load i32, ptr @dofrags, align 4, !tbaa !12
  %.not41.1 = icmp eq i32 %96, 0
  %97 = select i1 %.not41.1, i32 32, i32 0
  %98 = add nsw i32 %97, %95
  %99 = load ptr, ptr getelementptr inbounds (i8, ptr @p, i64 8), align 8, !tbaa !5
  %100 = load i16, ptr %99, align 4, !tbaa !9
  %101 = sext i16 %100 to i32
  %102 = sub nsw i32 %98, %101
  tail call void @V_DrawPatch(i32 noundef %102, i32 noundef %.1, i32 noundef 0, ptr noundef nonnull %99) #2
  %103 = load i32, ptr @me, align 4, !tbaa !12
  %104 = icmp eq i32 %103, 1
  br i1 %104, label %105, label %111

105:                                              ; preds = %91
  %106 = load ptr, ptr getelementptr inbounds (i8, ptr @p, i64 8), align 8, !tbaa !5
  %107 = load i16, ptr %106, align 4, !tbaa !9
  %108 = sext i16 %107 to i32
  %109 = sub nsw i32 %98, %108
  %110 = load ptr, ptr @star, align 8, !tbaa !5
  tail call void @V_DrawPatch(i32 noundef %109, i32 noundef %.1, i32 noundef 0, ptr noundef %110) #2
  br label %111

111:                                              ; preds = %105, %91
  %reass.sub.1 = sub nsw i32 %98, %3
  %112 = add nsw i32 %reass.sub.1, 64
  %113 = add nsw i32 %.1, 10
  %114 = load i32, ptr getelementptr inbounds (i8, ptr @cnt_kills, i64 4), align 4, !tbaa !12
  tail call void @WI_drawPercent(i32 noundef %112, i32 noundef %113, i32 noundef %114)
  %115 = add nsw i32 %reass.sub.1, 128
  %116 = load i32, ptr getelementptr inbounds (i8, ptr @cnt_items, i64 4), align 4, !tbaa !12
  tail call void @WI_drawPercent(i32 noundef %115, i32 noundef %113, i32 noundef %116)
  %117 = add nsw i32 %reass.sub.1, 192
  %118 = load i32, ptr getelementptr inbounds (i8, ptr @cnt_secret, i64 4), align 4, !tbaa !12
  tail call void @WI_drawPercent(i32 noundef %117, i32 noundef %113, i32 noundef %118)
  %119 = load i32, ptr @dofrags, align 4, !tbaa !12
  %.not42.1 = icmp eq i32 %119, 0
  br i1 %.not42.1, label %124, label %120

120:                                              ; preds = %111
  %121 = add nsw i32 %98, 256
  %122 = load i32, ptr getelementptr inbounds (i8, ptr @cnt_frags, i64 4), align 4, !tbaa !12
  %123 = tail call i32 @WI_drawNum(i32 noundef %121, i32 noundef %113, i32 noundef %122, i32 noundef -1)
  br label %124

124:                                              ; preds = %120, %111
  %125 = add nsw i32 %.1, 33
  br label %126

126:                                              ; preds = %124, %89
  %.1.1 = phi i32 [ %125, %124 ], [ %.1, %89 ]
  %127 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 8), align 8, !tbaa !12
  %.not39.2 = icmp eq i32 %127, 0
  br i1 %.not39.2, label %163, label %128

128:                                              ; preds = %126
  %129 = load ptr, ptr @star, align 8, !tbaa !5
  %130 = load i16, ptr %129, align 4, !tbaa !9
  %131 = sdiv i16 %130, 2
  %narrow40.2 = add nsw i16 %131, 32
  %132 = sext i16 %narrow40.2 to i32
  %133 = load i32, ptr @dofrags, align 4, !tbaa !12
  %.not41.2 = icmp eq i32 %133, 0
  %134 = select i1 %.not41.2, i32 32, i32 0
  %135 = add nsw i32 %134, %132
  %136 = load ptr, ptr getelementptr inbounds (i8, ptr @p, i64 16), align 16, !tbaa !5
  %137 = load i16, ptr %136, align 4, !tbaa !9
  %138 = sext i16 %137 to i32
  %139 = sub nsw i32 %135, %138
  tail call void @V_DrawPatch(i32 noundef %139, i32 noundef %.1.1, i32 noundef 0, ptr noundef nonnull %136) #2
  %140 = load i32, ptr @me, align 4, !tbaa !12
  %141 = icmp eq i32 %140, 2
  br i1 %141, label %142, label %148

142:                                              ; preds = %128
  %143 = load ptr, ptr getelementptr inbounds (i8, ptr @p, i64 16), align 16, !tbaa !5
  %144 = load i16, ptr %143, align 4, !tbaa !9
  %145 = sext i16 %144 to i32
  %146 = sub nsw i32 %135, %145
  %147 = load ptr, ptr @star, align 8, !tbaa !5
  tail call void @V_DrawPatch(i32 noundef %146, i32 noundef %.1.1, i32 noundef 0, ptr noundef %147) #2
  br label %148

148:                                              ; preds = %142, %128
  %reass.sub.2 = sub nsw i32 %135, %3
  %149 = add nsw i32 %reass.sub.2, 64
  %150 = add nsw i32 %.1.1, 10
  %151 = load i32, ptr getelementptr inbounds (i8, ptr @cnt_kills, i64 8), align 8, !tbaa !12
  tail call void @WI_drawPercent(i32 noundef %149, i32 noundef %150, i32 noundef %151)
  %152 = add nsw i32 %reass.sub.2, 128
  %153 = load i32, ptr getelementptr inbounds (i8, ptr @cnt_items, i64 8), align 8, !tbaa !12
  tail call void @WI_drawPercent(i32 noundef %152, i32 noundef %150, i32 noundef %153)
  %154 = add nsw i32 %reass.sub.2, 192
  %155 = load i32, ptr getelementptr inbounds (i8, ptr @cnt_secret, i64 8), align 8, !tbaa !12
  tail call void @WI_drawPercent(i32 noundef %154, i32 noundef %150, i32 noundef %155)
  %156 = load i32, ptr @dofrags, align 4, !tbaa !12
  %.not42.2 = icmp eq i32 %156, 0
  br i1 %.not42.2, label %161, label %157

157:                                              ; preds = %148
  %158 = add nsw i32 %135, 256
  %159 = load i32, ptr getelementptr inbounds (i8, ptr @cnt_frags, i64 8), align 8, !tbaa !12
  %160 = tail call i32 @WI_drawNum(i32 noundef %158, i32 noundef %150, i32 noundef %159, i32 noundef -1)
  br label %161

161:                                              ; preds = %157, %148
  %162 = add nsw i32 %.1.1, 33
  br label %163

163:                                              ; preds = %161, %126
  %.1.2 = phi i32 [ %162, %161 ], [ %.1.1, %126 ]
  %164 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 12), align 4, !tbaa !12
  %.not39.3 = icmp eq i32 %164, 0
  br i1 %.not39.3, label %198, label %165

165:                                              ; preds = %163
  %166 = load ptr, ptr @star, align 8, !tbaa !5
  %167 = load i16, ptr %166, align 4, !tbaa !9
  %168 = sdiv i16 %167, 2
  %narrow40.3 = add nsw i16 %168, 32
  %169 = sext i16 %narrow40.3 to i32
  %170 = load i32, ptr @dofrags, align 4, !tbaa !12
  %.not41.3 = icmp eq i32 %170, 0
  %171 = select i1 %.not41.3, i32 32, i32 0
  %172 = add nsw i32 %171, %169
  %173 = load ptr, ptr getelementptr inbounds (i8, ptr @p, i64 24), align 8, !tbaa !5
  %174 = load i16, ptr %173, align 4, !tbaa !9
  %175 = sext i16 %174 to i32
  %176 = sub nsw i32 %172, %175
  tail call void @V_DrawPatch(i32 noundef %176, i32 noundef %.1.2, i32 noundef 0, ptr noundef nonnull %173) #2
  %177 = load i32, ptr @me, align 4, !tbaa !12
  %178 = icmp eq i32 %177, 3
  br i1 %178, label %179, label %185

179:                                              ; preds = %165
  %180 = load ptr, ptr getelementptr inbounds (i8, ptr @p, i64 24), align 8, !tbaa !5
  %181 = load i16, ptr %180, align 4, !tbaa !9
  %182 = sext i16 %181 to i32
  %183 = sub nsw i32 %172, %182
  %184 = load ptr, ptr @star, align 8, !tbaa !5
  tail call void @V_DrawPatch(i32 noundef %183, i32 noundef %.1.2, i32 noundef 0, ptr noundef %184) #2
  br label %185

185:                                              ; preds = %179, %165
  %reass.sub.3 = sub nsw i32 %172, %3
  %186 = add nsw i32 %reass.sub.3, 64
  %187 = add nsw i32 %.1.2, 10
  %188 = load i32, ptr getelementptr inbounds (i8, ptr @cnt_kills, i64 12), align 4, !tbaa !12
  tail call void @WI_drawPercent(i32 noundef %186, i32 noundef %187, i32 noundef %188)
  %189 = add nsw i32 %reass.sub.3, 128
  %190 = load i32, ptr getelementptr inbounds (i8, ptr @cnt_items, i64 12), align 4, !tbaa !12
  tail call void @WI_drawPercent(i32 noundef %189, i32 noundef %187, i32 noundef %190)
  %191 = add nsw i32 %reass.sub.3, 192
  %192 = load i32, ptr getelementptr inbounds (i8, ptr @cnt_secret, i64 12), align 4, !tbaa !12
  tail call void @WI_drawPercent(i32 noundef %191, i32 noundef %187, i32 noundef %192)
  %193 = load i32, ptr @dofrags, align 4, !tbaa !12
  %.not42.3 = icmp eq i32 %193, 0
  br i1 %.not42.3, label %198, label %194

194:                                              ; preds = %185
  %195 = add nsw i32 %172, 256
  %196 = load i32, ptr getelementptr inbounds (i8, ptr @cnt_frags, i64 12), align 4, !tbaa !12
  %197 = tail call i32 @WI_drawNum(i32 noundef %195, i32 noundef %187, i32 noundef %196, i32 noundef -1)
  br label %198

198:                                              ; preds = %185, %194, %163
  ret void
}

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

!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 = !{!"", !11, i64 0, !11, i64 2, !11, i64 4, !11, i64 6, !7, i64 8}
!11 = !{!"short", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!10, !11, i64 2}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass