; LLVM IR from BrunoLevy/learn-fpga :: LiteX/software/Doom/mc1-doom/src (hu_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.hu_itext_t = type { %struct.hu_textline_t, i32, ptr, i32 }
%struct.hu_textline_t = type { i32, i32, ptr, i32, [81 x i8], i32, i32 }
%struct.event_t = type { i32, i32, i32, i32 }
%struct.player_s = type { ptr, i32, %struct.ticcmd_t, i32, i32, i32, i32, i32, i32, i32, [6 x i32], [6 x i32], i32, [4 x i32], i32, i32, [9 x i32], [4 x i32], [4 x i32], i32, i32, i32, i32, i32, i32, i32, ptr, i32, i32, ptr, i32, i32, i32, [2 x %struct.pspdef_t], i32 }
%struct.ticcmd_t = type { i8, i8, i16, i16, i8, i8 }
%struct.pspdef_t = type { ptr, i32, i32, i32 }

@chat_macros = external dso_local global [10 x ptr], align 16
@shiftxform = external dso_local global ptr, align 8
@consoleplayer = external global i32, align 4
@plr = external hidden global ptr, align 8
@message_on = external hidden global i32, align 4
@chat_on = external dso_local global i32, align 4
@w_chat = external hidden global %struct.hu_itext_t, align 8
@message_counter = external hidden global i32, align 4
@netgame = external global i32, align 4
@playeringame = external global [4 x i32], align 16
@HU_Responder.lastmessage = external hidden global [81 x i8], align 16
@HU_Responder.shiftdown = external hidden global i32, align 4
@HU_Responder.altdown = external hidden global i32, align 4
@HU_Responder.destination_keys = external hidden global [4 x i8], align 1
@HU_Responder.num_nobrainers = external hidden global i32, align 4
@.str.149 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.150 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.151 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.152 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.153 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @ForeignTranslation(i8 noundef zeroext) #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

declare i32 @HUlib_keyInIText(ptr noundef, i8 noundef zeroext) #2

declare void @HUlib_resetIText(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @HU_queueChatChar(i8 noundef signext) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @HU_Responder(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !9
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %10

10:                                               ; preds = %20, %1
  %11 = load i32, ptr %7, align 4, !tbaa !9
  %12 = icmp slt i32 %11, 4
  br i1 %12, label %13, label %23

13:                                               ; preds = %10
  %14 = load i32, ptr %7, align 4, !tbaa !9
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [4 x i32], ptr @playeringame, i64 0, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !9
  %18 = load i32, ptr %8, align 4, !tbaa !9
  %19 = add i32 %18, %17
  store i32 %19, ptr %8, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %13
  %21 = load i32, ptr %7, align 4, !tbaa !9
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %7, align 4, !tbaa !9
  br label %10, !llvm.loop !11

23:                                               ; preds = %10
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.event_t, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %25, align 4, !tbaa !13
  %27 = icmp eq i32 %26, 182
  br i1 %27, label %28, label %34

28:                                               ; preds = %23
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.event_t, ptr %29, i32 0, i32 0
  %31 = load i32, ptr %30, align 4, !tbaa !15
  %32 = icmp eq i32 %31, 0
  %33 = zext i1 %32 to i32
  store i32 %33, ptr @HU_Responder.shiftdown, align 4, !tbaa !9
  store i32 0, ptr %2, align 4
  store i32 1, ptr %9, align 4
  br label %241

34:                                               ; preds = %23
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.event_t, ptr %35, i32 0, i32 1
  %37 = load i32, ptr %36, align 4, !tbaa !13
  %38 = icmp eq i32 %37, 184
  br i1 %38, label %44, label %39

39:                                               ; preds = %34
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.event_t, ptr %40, i32 0, i32 1
  %42 = load i32, ptr %41, align 4, !tbaa !13
  %43 = icmp eq i32 %42, 184
  br i1 %43, label %44, label %50

44:                                               ; preds = %39, %34
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.event_t, ptr %45, i32 0, i32 0
  %47 = load i32, ptr %46, align 4, !tbaa !15
  %48 = icmp eq i32 %47, 0
  %49 = zext i1 %48 to i32
  store i32 %49, ptr @HU_Responder.altdown, align 4, !tbaa !9
  store i32 0, ptr %2, align 4
  store i32 1, ptr %9, align 4
  br label %241

50:                                               ; preds = %39
  br label %51

51:                                               ; preds = %50
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.event_t, ptr %52, i32 0, i32 0
  %54 = load i32, ptr %53, align 4, !tbaa !15
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %56, label %57

56:                                               ; preds = %51
  store i32 0, ptr %2, align 4
  store i32 1, ptr %9, align 4
  br label %241

57:                                               ; preds = %51
  %58 = load i32, ptr @chat_on, align 4, !tbaa !9
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %156, label %60

60:                                               ; preds = %57
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.event_t, ptr %61, i32 0, i32 1
  %63 = load i32, ptr %62, align 4, !tbaa !13
  %64 = icmp eq i32 %63, 13
  br i1 %64, label %65, label %66

65:                                               ; preds = %60
  store i32 1, ptr @message_on, align 4, !tbaa !9
  store i32 140, ptr @message_counter, align 4, !tbaa !9
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %155

66:                                               ; preds = %60
  %67 = load i32, ptr @netgame, align 4, !tbaa !9
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %75

69:                                               ; preds = %66
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.event_t, ptr %70, i32 0, i32 1
  %72 = load i32, ptr %71, align 4, !tbaa !13
  %73 = icmp eq i32 %72, 116
  br i1 %73, label %74, label %75

74:                                               ; preds = %69
  store i32 1, ptr @chat_on, align 4, !tbaa !9
  store i32 1, ptr %5, align 4, !tbaa !9
  call void @HUlib_resetIText(ptr noundef @w_chat)
  call void @HU_queueChatChar(i8 noundef signext 5)
  br label %154

75:                                               ; preds = %69, %66
  %76 = load i32, ptr @netgame, align 4, !tbaa !9
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %153

78:                                               ; preds = %75
  %79 = load i32, ptr %8, align 4, !tbaa !9
  %80 = icmp sgt i32 %79, 2
  br i1 %80, label %81, label %153

81:                                               ; preds = %78
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %149, %81
  %83 = load i32, ptr %7, align 4, !tbaa !9
  %84 = icmp slt i32 %83, 4
  br i1 %84, label %85, label %152

85:                                               ; preds = %82
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.event_t, ptr %86, i32 0, i32 1
  %88 = load i32, ptr %87, align 4, !tbaa !13
  %89 = load i32, ptr %7, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [4 x i8], ptr @HU_Responder.destination_keys, i64 0, i64 %90
  %92 = load i8, ptr %91, align 1, !tbaa !16
  %93 = sext i8 %92 to i32
  %94 = icmp eq i32 %88, %93
  br i1 %94, label %95, label %148

95:                                               ; preds = %85
  %96 = load i32, ptr %7, align 4, !tbaa !9
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [4 x i32], ptr @playeringame, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !9
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %101, label %109

101:                                              ; preds = %95
  %102 = load i32, ptr %7, align 4, !tbaa !9
  %103 = load i32, ptr @consoleplayer, align 4, !tbaa !9
  %104 = icmp ne i32 %102, %103
  br i1 %104, label %105, label %109

105:                                              ; preds = %101
  store i32 1, ptr @chat_on, align 4, !tbaa !9
  store i32 1, ptr %5, align 4, !tbaa !9
  call void @HUlib_resetIText(ptr noundef @w_chat)
  %106 = load i32, ptr %7, align 4, !tbaa !9
  %107 = add nsw i32 %106, 1
  %108 = trunc i32 %107 to i8
  call void @HU_queueChatChar(i8 noundef signext %108)
  br label %152

109:                                              ; preds = %101, %95
  %110 = load i32, ptr %7, align 4, !tbaa !9
  %111 = load i32, ptr @consoleplayer, align 4, !tbaa !9
  %112 = icmp eq i32 %110, %111
  br i1 %112, label %113, label %146

113:                                              ; preds = %109
  %114 = load i32, ptr @HU_Responder.num_nobrainers, align 4, !tbaa !9
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr @HU_Responder.num_nobrainers, align 4, !tbaa !9
  %116 = load i32, ptr @HU_Responder.num_nobrainers, align 4, !tbaa !9
  %117 = icmp slt i32 %116, 3
  br i1 %117, label %118, label %121

118:                                              ; preds = %113
  %119 = load ptr, ptr @plr, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.player_s, ptr %119, i32 0, i32 26
  store ptr @.str.149, ptr %120, align 8, !tbaa !17
  br label %145

121:                                              ; preds = %113
  %122 = load i32, ptr @HU_Responder.num_nobrainers, align 4, !tbaa !9
  %123 = icmp slt i32 %122, 6
  br i1 %123, label %124, label %127

124:                                              ; preds = %121
  %125 = load ptr, ptr @plr, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.player_s, ptr %125, i32 0, i32 26
  store ptr @.str.150, ptr %126, align 8, !tbaa !17
  br label %144

127:                                              ; preds = %121
  %128 = load i32, ptr @HU_Responder.num_nobrainers, align 4, !tbaa !9
  %129 = icmp slt i32 %128, 9
  br i1 %129, label %130, label %133

130:                                              ; preds = %127
  %131 = load ptr, ptr @plr, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.player_s, ptr %131, i32 0, i32 26
  store ptr @.str.151, ptr %132, align 8, !tbaa !17
  br label %143

133:                                              ; preds = %127
  %134 = load i32, ptr @HU_Responder.num_nobrainers, align 4, !tbaa !9
  %135 = icmp slt i32 %134, 32
  br i1 %135, label %136, label %139

136:                                              ; preds = %133
  %137 = load ptr, ptr @plr, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.player_s, ptr %137, i32 0, i32 26
  store ptr @.str.152, ptr %138, align 8, !tbaa !17
  br label %142

139:                                              ; preds = %133
  %140 = load ptr, ptr @plr, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.player_s, ptr %140, i32 0, i32 26
  store ptr @.str.153, ptr %141, align 8, !tbaa !17
  br label %142

142:                                              ; preds = %139, %136
  br label %143

143:                                              ; preds = %142, %130
  br label %144

144:                                              ; preds = %143, %124
  br label %145

145:                                              ; preds = %144, %118
  br label %146

146:                                              ; preds = %145, %109
  br label %147

147:                                              ; preds = %146
  br label %148

148:                                              ; preds = %147, %85
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %7, align 4, !tbaa !9
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %7, align 4, !tbaa !9
  br label %82, !llvm.loop !21

152:                                              ; preds = %105, %82
  br label %153

153:                                              ; preds = %152, %78, %75
  br label %154

154:                                              ; preds = %153, %74
  br label %155

155:                                              ; preds = %154, %65
  br label %239

156:                                              ; preds = %57
  %157 = load ptr, ptr %3, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.event_t, ptr %157, i32 0, i32 1
  %159 = load i32, ptr %158, align 4, !tbaa !13
  %160 = trunc i32 %159 to i8
  store i8 %160, ptr %6, align 1, !tbaa !16
  %161 = load i32, ptr @HU_Responder.altdown, align 4, !tbaa !9
  %162 = icmp ne i32 %161, 0
  br i1 %162, label %163, label %193

163:                                              ; preds = %156
  %164 = load i8, ptr %6, align 1, !tbaa !16
  %165 = zext i8 %164 to i32
  %166 = sub nsw i32 %165, 48
  %167 = trunc i32 %166 to i8
  store i8 %167, ptr %6, align 1, !tbaa !16
  %168 = load i8, ptr %6, align 1, !tbaa !16
  %169 = zext i8 %168 to i32
  %170 = icmp sgt i32 %169, 9
  br i1 %170, label %171, label %172

171:                                              ; preds = %163
  store i32 0, ptr %2, align 4
  store i32 1, ptr %9, align 4
  br label %241

172:                                              ; preds = %163
  %173 = load i8, ptr %6, align 1, !tbaa !16
  %174 = zext i8 %173 to i64
  %175 = getelementptr inbounds [10 x ptr], ptr @chat_macros, i64 0, i64 %174
  %176 = load ptr, ptr %175, align 8, !tbaa !5
  store ptr %176, ptr %4, align 8, !tbaa !5
  call void @HU_queueChatChar(i8 noundef signext 13)
  br label %177

177:                                              ; preds = %181, %172
  %178 = load ptr, ptr %4, align 8, !tbaa !5
  %179 = load i8, ptr %178, align 1, !tbaa !16
  %180 = icmp ne i8 %179, 0
  br i1 %180, label %181, label %185

181:                                              ; preds = %177
  %182 = load ptr, ptr %4, align 8, !tbaa !5
  %183 = getelementptr inbounds i8, ptr %182, i32 1
  store ptr %183, ptr %4, align 8, !tbaa !5
  %184 = load i8, ptr %182, align 1, !tbaa !16
  call void @HU_queueChatChar(i8 noundef signext %184)
  br label %177, !llvm.loop !22

185:                                              ; preds = %177
  call void @HU_queueChatChar(i8 noundef signext 13)
  store i32 0, ptr @chat_on, align 4, !tbaa !9
  %186 = load i8, ptr %6, align 1, !tbaa !16
  %187 = zext i8 %186 to i64
  %188 = getelementptr inbounds [10 x ptr], ptr @chat_macros, i64 0, i64 %187
  %189 = load ptr, ptr %188, align 8, !tbaa !5
  %190 = call ptr @strcpy(ptr noundef @HU_Responder.lastmessage, ptr noundef %189) #4
  %191 = load ptr, ptr @plr, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.player_s, ptr %191, i32 0, i32 26
  store ptr @HU_Responder.lastmessage, ptr %192, align 8, !tbaa !17
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %238

193:                                              ; preds = %156
  %194 = load i8, ptr %6, align 1, !tbaa !16
  %195 = call signext i8 @ForeignTranslation(i8 noundef zeroext %194)
  store i8 %195, ptr %6, align 1, !tbaa !16
  %196 = load i32, ptr @HU_Responder.shiftdown, align 4, !tbaa !9
  %197 = icmp ne i32 %196, 0
  br i1 %197, label %206, label %198

198:                                              ; preds = %193
  %199 = load i8, ptr %6, align 1, !tbaa !16
  %200 = zext i8 %199 to i32
  %201 = icmp sge i32 %200, 97
  br i1 %201, label %202, label %212

202:                                              ; preds = %198
  %203 = load i8, ptr %6, align 1, !tbaa !16
  %204 = zext i8 %203 to i32
  %205 = icmp sle i32 %204, 122
  br i1 %205, label %206, label %212

206:                                              ; preds = %202, %193
  %207 = load ptr, ptr @shiftxform, align 8, !tbaa !5
  %208 = load i8, ptr %6, align 1, !tbaa !16
  %209 = zext i8 %208 to i64
  %210 = getelementptr inbounds i8, ptr %207, i64 %209
  %211 = load i8, ptr %210, align 1, !tbaa !16
  store i8 %211, ptr %6, align 1, !tbaa !16
  br label %212

212:                                              ; preds = %206, %202, %198
  %213 = load i8, ptr %6, align 1, !tbaa !16
  %214 = call i32 @HUlib_keyInIText(ptr noundef @w_chat, i8 noundef zeroext %213)
  store i32 %214, ptr %5, align 4, !tbaa !9
  %215 = load i32, ptr %5, align 4, !tbaa !9
  %216 = icmp ne i32 %215, 0
  br i1 %216, label %217, label %219

217:                                              ; preds = %212
  %218 = load i8, ptr %6, align 1, !tbaa !16
  call void @HU_queueChatChar(i8 noundef signext %218)
  br label %219

219:                                              ; preds = %217, %212
  %220 = load i8, ptr %6, align 1, !tbaa !16
  %221 = zext i8 %220 to i32
  %222 = icmp eq i32 %221, 13
  br i1 %222, label %223, label %231

223:                                              ; preds = %219
  store i32 0, ptr @chat_on, align 4, !tbaa !9
  %224 = load i32, ptr getelementptr inbounds (%struct.hu_textline_t, ptr @w_chat, i32 0, i32 5), align 8, !tbaa !23
  %225 = icmp ne i32 %224, 0
  br i1 %225, label %226, label %230

226:                                              ; preds = %223
  %227 = call ptr @strcpy(ptr noundef @HU_Responder.lastmessage, ptr noundef getelementptr inbounds (%struct.hu_textline_t, ptr @w_chat, i32 0, i32 4)) #4
  %228 = load ptr, ptr @plr, align 8, !tbaa !5
  %229 = getelementptr inbounds %struct.player_s, ptr %228, i32 0, i32 26
  store ptr @HU_Responder.lastmessage, ptr %229, align 8, !tbaa !17
  br label %230

230:                                              ; preds = %226, %223
  br label %237

231:                                              ; preds = %219
  %232 = load i8, ptr %6, align 1, !tbaa !16
  %233 = zext i8 %232 to i32
  %234 = icmp eq i32 %233, 27
  br i1 %234, label %235, label %236

235:                                              ; preds = %231
  store i32 0, ptr @chat_on, align 4, !tbaa !9
  br label %236

236:                                              ; preds = %235, %231
  br label %237

237:                                              ; preds = %236, %230
  br label %238

238:                                              ; preds = %237, %185
  br label %239

239:                                              ; preds = %238, %155
  %240 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %240, ptr %2, align 4
  store i32 1, ptr %9, align 4
  br label %241

241:                                              ; preds = %239, %171, %56, %44, %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  %242 = load i32, ptr %2, align 4
  ret i32 %242
}

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #3

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

!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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !10, i64 4}
!14 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!15 = !{!14, !10, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !6, i64 224}
!18 = !{!"player_s", !6, i64 0, !10, i64 8, !19, i64 12, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !7, i64 48, !7, i64 72, !10, i64 96, !7, i64 100, !10, i64 116, !10, i64 120, !7, i64 124, !7, i64 160, !7, i64 176, !10, i64 192, !10, i64 196, !10, i64 200, !10, i64 204, !10, i64 208, !10, i64 212, !10, i64 216, !6, i64 224, !10, i64 232, !10, i64 236, !6, i64 240, !10, i64 248, !10, i64 252, !10, i64 256, !7, i64 264, !10, i64 312}
!19 = !{!"", !7, i64 0, !7, i64 1, !20, i64 2, !20, i64 4, !7, i64 6, !7, i64 7}
!20 = !{!"short", !7, i64 0}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = !{!24, !10, i64 104}
!24 = !{!"", !25, i64 0, !10, i64 112, !6, i64 120, !10, i64 128}
!25 = !{!"", !10, i64 0, !10, i64 4, !6, i64 8, !10, i64 16, !7, i64 20, !10, i64 104, !10, i64 108}


; 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.hu_itext_t = type { %struct.hu_textline_t, i32, ptr, i32 }
%struct.hu_textline_t = type { i32, i32, ptr, i32, [81 x i8], i32, i32 }

@chat_macros = external dso_local local_unnamed_addr global [10 x ptr], align 16
@shiftxform = external dso_local local_unnamed_addr global ptr, align 8
@consoleplayer = external local_unnamed_addr global i32, align 4
@plr = external hidden local_unnamed_addr global ptr, align 8
@message_on = external hidden local_unnamed_addr global i32, align 4
@chat_on = external dso_local local_unnamed_addr global i32, align 4
@w_chat = external hidden global %struct.hu_itext_t, align 8
@message_counter = external hidden local_unnamed_addr global i32, align 4
@netgame = external local_unnamed_addr global i32, align 4
@playeringame = external local_unnamed_addr global [4 x i32], align 16
@HU_Responder.lastmessage = external hidden global [81 x i8], align 16
@HU_Responder.shiftdown = external hidden local_unnamed_addr global i32, align 4
@HU_Responder.altdown = external hidden local_unnamed_addr global i32, align 4
@HU_Responder.destination_keys = external hidden local_unnamed_addr global [4 x i8], align 1
@HU_Responder.num_nobrainers = external hidden local_unnamed_addr global i32, align 4
@.str.149 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.150 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.151 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.152 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.153 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @ForeignTranslation(i8 noundef zeroext) local_unnamed_addr #0

declare i32 @HUlib_keyInIText(ptr noundef, i8 noundef zeroext) local_unnamed_addr #1

declare void @HUlib_resetIText(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @HU_queueChatChar(i8 noundef signext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @HU_Responder(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = load i32, ptr @playeringame, align 16, !tbaa !5
  %3 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 4), align 4, !tbaa !5
  %4 = add i32 %3, %2
  %5 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 8), align 8, !tbaa !5
  %6 = add i32 %5, %4
  %7 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 12), align 4, !tbaa !5
  %8 = add i32 %7, %6
  %9 = getelementptr inbounds i8, ptr %0, i64 4
  %10 = load i32, ptr %9, align 4, !tbaa !9
  %11 = load i32, ptr %0, align 4, !tbaa !11
  %.not = icmp eq i32 %11, 0
  switch i32 %10, label %16 [
    i32 182, label %12
    i32 184, label %14
  ]

12:                                               ; preds = %1
  %13 = zext i1 %.not to i32
  store i32 %13, ptr @HU_Responder.shiftdown, align 4, !tbaa !5
  br label %.loopexit

14:                                               ; preds = %1
  %15 = zext i1 %.not to i32
  store i32 %15, ptr @HU_Responder.altdown, align 4, !tbaa !5
  br label %.loopexit

16:                                               ; preds = %1
  br i1 %.not, label %17, label %.loopexit

17:                                               ; preds = %16
  %18 = load i32, ptr @chat_on, align 4, !tbaa !5
  %.not51 = icmp eq i32 %18, 0
  br i1 %.not51, label %19, label %99

19:                                               ; preds = %17
  %20 = icmp eq i32 %10, 13
  br i1 %20, label %21, label %22

21:                                               ; preds = %19
  store i32 1, ptr @message_on, align 4, !tbaa !5
  store i32 140, ptr @message_counter, align 4, !tbaa !5
  br label %.loopexit

22:                                               ; preds = %19
  %23 = load i32, ptr @netgame, align 4, !tbaa !5
  %.not52 = icmp ne i32 %23, 0
  %24 = icmp eq i32 %10, 116
  %or.cond60 = and i1 %24, %.not52
  br i1 %or.cond60, label %25, label %26

25:                                               ; preds = %22
  store i32 1, ptr @chat_on, align 4, !tbaa !5
  tail call void @HUlib_resetIText(ptr noundef nonnull @w_chat) #3
  tail call void @HU_queueChatChar(i8 noundef signext 5)
  br label %.loopexit

26:                                               ; preds = %22
  %27 = icmp sgt i32 %8, 2
  %or.cond = select i1 %.not52, i1 %27, i1 false
  br i1 %or.cond, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %26
  %HU_Responder.num_nobrainers.promoted = load i32, ptr @HU_Responder.num_nobrainers, align 4, !tbaa !5
  %28 = load i32, ptr @consoleplayer, align 4
  %29 = load ptr, ptr @plr, align 8
  %30 = getelementptr inbounds i8, ptr %29, i64 224
  %31 = load i8, ptr @HU_Responder.destination_keys, align 1, !tbaa !12
  %32 = sext i8 %31 to i32
  %33 = icmp eq i32 %10, %32
  br i1 %33, label %34, label %46

34:                                               ; preds = %.preheader
  %.not53 = icmp eq i32 %2, 0
  %.not54 = icmp eq i32 %28, 0
  %or.cond61 = select i1 %.not53, i1 true, i1 %.not54
  br i1 %or.cond61, label %36, label %35

35:                                               ; preds = %83, %67, %51, %34
  %.168.lcssa.wide = phi i8 [ 1, %34 ], [ 2, %51 ], [ 3, %67 ], [ 4, %83 ]
  store i32 1, ptr @chat_on, align 4, !tbaa !5
  tail call void @HUlib_resetIText(ptr noundef nonnull @w_chat) #3
  tail call void @HU_queueChatChar(i8 noundef signext %.168.lcssa.wide)
  br label %.loopexit

36:                                               ; preds = %34
  br i1 %.not54, label %37, label %46

37:                                               ; preds = %36
  %38 = add nsw i32 %HU_Responder.num_nobrainers.promoted, 1
  store i32 %38, ptr @HU_Responder.num_nobrainers, align 4, !tbaa !5
  %39 = icmp slt i32 %HU_Responder.num_nobrainers.promoted, 2
  br i1 %39, label %.sink.split, label %40

40:                                               ; preds = %37
  %41 = icmp ult i32 %HU_Responder.num_nobrainers.promoted, 5
  br i1 %41, label %.sink.split, label %42

42:                                               ; preds = %40
  %43 = icmp ult i32 %HU_Responder.num_nobrainers.promoted, 8
  br i1 %43, label %.sink.split, label %44

44:                                               ; preds = %42
  %45 = icmp ult i32 %HU_Responder.num_nobrainers.promoted, 31
  %.str.152..str.153 = select i1 %45, ptr @.str.152, ptr @.str.153
  br label %.sink.split

.sink.split:                                      ; preds = %44, %42, %40, %37
  %.str.150.sink = phi ptr [ @.str.149, %37 ], [ @.str.150, %40 ], [ @.str.151, %42 ], [ %.str.152..str.153, %44 ]
  store ptr %.str.150.sink, ptr %30, align 8, !tbaa !13
  br label %46

46:                                               ; preds = %.sink.split, %.preheader, %36
  %47 = phi i32 [ %HU_Responder.num_nobrainers.promoted, %.preheader ], [ %HU_Responder.num_nobrainers.promoted, %36 ], [ %38, %.sink.split ]
  %48 = load i8, ptr getelementptr inbounds (i8, ptr @HU_Responder.destination_keys, i64 1), align 1, !tbaa !12
  %49 = sext i8 %48 to i32
  %50 = icmp eq i32 %10, %49
  br i1 %50, label %51, label %62

51:                                               ; preds = %46
  %.not53.1 = icmp eq i32 %3, 0
  %.not54.1 = icmp eq i32 %28, 1
  %or.cond61.1 = select i1 %.not53.1, i1 true, i1 %.not54.1
  br i1 %or.cond61.1, label %52, label %35

52:                                               ; preds = %51
  br i1 %.not54.1, label %53, label %62

53:                                               ; preds = %52
  %54 = add nsw i32 %47, 1
  store i32 %54, ptr @HU_Responder.num_nobrainers, align 4, !tbaa !5
  %55 = icmp slt i32 %47, 2
  br i1 %55, label %.sink.split72, label %56

56:                                               ; preds = %53
  %57 = icmp ult i32 %47, 5
  br i1 %57, label %.sink.split72, label %58

58:                                               ; preds = %56
  %59 = icmp ult i32 %47, 8
  br i1 %59, label %.sink.split72, label %60

60:                                               ; preds = %58
  %61 = icmp ult i32 %47, 31
  %.str.152..str.15375 = select i1 %61, ptr @.str.152, ptr @.str.153
  br label %.sink.split72

.sink.split72:                                    ; preds = %53, %56, %58, %60
  %.str.149.sink = phi ptr [ %.str.152..str.15375, %60 ], [ @.str.151, %58 ], [ @.str.150, %56 ], [ @.str.149, %53 ]
  store ptr %.str.149.sink, ptr %30, align 8, !tbaa !13
  br label %62

62:                                               ; preds = %.sink.split72, %52, %46
  %63 = phi i32 [ %47, %46 ], [ %47, %52 ], [ %54, %.sink.split72 ]
  %64 = load i8, ptr getelementptr inbounds (i8, ptr @HU_Responder.destination_keys, i64 2), align 1, !tbaa !12
  %65 = sext i8 %64 to i32
  %66 = icmp eq i32 %10, %65
  br i1 %66, label %67, label %78

67:                                               ; preds = %62
  %.not53.2 = icmp eq i32 %5, 0
  %.not54.2 = icmp eq i32 %28, 2
  %or.cond61.2 = select i1 %.not53.2, i1 true, i1 %.not54.2
  br i1 %or.cond61.2, label %68, label %35

68:                                               ; preds = %67
  br i1 %.not54.2, label %69, label %78

69:                                               ; preds = %68
  %70 = add nsw i32 %63, 1
  store i32 %70, ptr @HU_Responder.num_nobrainers, align 4, !tbaa !5
  %71 = icmp slt i32 %63, 2
  br i1 %71, label %.sink.split73, label %72

72:                                               ; preds = %69
  %73 = icmp ult i32 %63, 5
  br i1 %73, label %.sink.split73, label %74

74:                                               ; preds = %72
  %75 = icmp ult i32 %63, 8
  br i1 %75, label %.sink.split73, label %76

76:                                               ; preds = %74
  %77 = icmp ult i32 %63, 31
  %.str.152..str.15376 = select i1 %77, ptr @.str.152, ptr @.str.153
  br label %.sink.split73

.sink.split73:                                    ; preds = %69, %72, %74, %76
  %.str.149.sink74 = phi ptr [ %.str.152..str.15376, %76 ], [ @.str.151, %74 ], [ @.str.150, %72 ], [ @.str.149, %69 ]
  store ptr %.str.149.sink74, ptr %30, align 8, !tbaa !13
  br label %78

78:                                               ; preds = %.sink.split73, %68, %62
  %79 = phi i32 [ %63, %62 ], [ %63, %68 ], [ %70, %.sink.split73 ]
  %80 = load i8, ptr getelementptr inbounds (i8, ptr @HU_Responder.destination_keys, i64 3), align 1, !tbaa !12
  %81 = sext i8 %80 to i32
  %82 = icmp eq i32 %10, %81
  br i1 %82, label %83, label %.loopexit

83:                                               ; preds = %78
  %.not53.3 = icmp eq i32 %7, 0
  %.not54.3 = icmp eq i32 %28, 3
  %or.cond61.3 = select i1 %.not53.3, i1 true, i1 %.not54.3
  br i1 %or.cond61.3, label %84, label %35

84:                                               ; preds = %83
  br i1 %.not54.3, label %85, label %.loopexit

85:                                               ; preds = %84
  %86 = add nsw i32 %79, 1
  store i32 %86, ptr @HU_Responder.num_nobrainers, align 4, !tbaa !5
  %87 = icmp slt i32 %79, 2
  br i1 %87, label %98, label %88

88:                                               ; preds = %85
  %89 = icmp ult i32 %79, 5
  br i1 %89, label %97, label %90

90:                                               ; preds = %88
  %91 = icmp ult i32 %79, 8
  br i1 %91, label %96, label %92

92:                                               ; preds = %90
  %93 = icmp ult i32 %79, 31
  br i1 %93, label %95, label %94

94:                                               ; preds = %92
  store ptr @.str.153, ptr %30, align 8, !tbaa !13
  br label %.loopexit

95:                                               ; preds = %92
  store ptr @.str.152, ptr %30, align 8, !tbaa !13
  br label %.loopexit

96:                                               ; preds = %90
  store ptr @.str.151, ptr %30, align 8, !tbaa !13
  br label %.loopexit

97:                                               ; preds = %88
  store ptr @.str.150, ptr %30, align 8, !tbaa !13
  br label %.loopexit

98:                                               ; preds = %85
  store ptr @.str.149, ptr %30, align 8, !tbaa !13
  br label %.loopexit

99:                                               ; preds = %17
  %100 = load i32, ptr @HU_Responder.altdown, align 4, !tbaa !5
  %.not55 = icmp eq i32 %100, 0
  %101 = trunc i32 %10 to i8
  br i1 %.not55, label %117, label %102

102:                                              ; preds = %99
  %103 = add i8 %101, -48
  %104 = icmp ugt i8 %103, 9
  br i1 %104, label %.loopexit, label %105

105:                                              ; preds = %102
  %106 = zext nneg i8 %103 to i64
  %107 = getelementptr inbounds [10 x ptr], ptr @chat_macros, i64 0, i64 %106
  %108 = load ptr, ptr %107, align 8, !tbaa !18
  tail call void @HU_queueChatChar(i8 noundef signext 13)
  %109 = load i8, ptr %108, align 1, !tbaa !12
  %.not5966 = icmp eq i8 %109, 0
  br i1 %.not5966, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %105, %.lr.ph
  %110 = phi i8 [ %112, %.lr.ph ], [ %109, %105 ]
  %.04567 = phi ptr [ %111, %.lr.ph ], [ %108, %105 ]
  %111 = getelementptr inbounds i8, ptr %.04567, i64 1
  tail call void @HU_queueChatChar(i8 noundef signext %110)
  %112 = load i8, ptr %111, align 1, !tbaa !12
  %.not59 = icmp eq i8 %112, 0
  br i1 %.not59, label %._crit_edge, label %.lr.ph, !llvm.loop !19

._crit_edge:                                      ; preds = %.lr.ph, %105
  tail call void @HU_queueChatChar(i8 noundef signext 13)
  store i32 0, ptr @chat_on, align 4, !tbaa !5
  %113 = load ptr, ptr %107, align 8, !tbaa !18
  %114 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) @HU_Responder.lastmessage, ptr noundef nonnull dereferenceable(1) %113) #3
  %115 = load ptr, ptr @plr, align 8, !tbaa !18
  %116 = getelementptr inbounds i8, ptr %115, i64 224
  store ptr @HU_Responder.lastmessage, ptr %116, align 8, !tbaa !13
  br label %.loopexit

117:                                              ; preds = %99
  %118 = tail call signext i8 @ForeignTranslation(i8 noundef zeroext %101)
  %119 = load i32, ptr @HU_Responder.shiftdown, align 4, !tbaa !5
  %.not56 = icmp ne i32 %119, 0
  %120 = add i8 %118, -97
  %or.cond4 = icmp ult i8 %120, 26
  %or.cond62 = select i1 %.not56, i1 true, i1 %or.cond4
  br i1 %or.cond62, label %121, label %126

121:                                              ; preds = %117
  %122 = load ptr, ptr @shiftxform, align 8, !tbaa !18
  %123 = zext i8 %118 to i64
  %124 = getelementptr inbounds i8, ptr %122, i64 %123
  %125 = load i8, ptr %124, align 1, !tbaa !12
  br label %126

126:                                              ; preds = %117, %121
  %.043 = phi i8 [ %125, %121 ], [ %118, %117 ]
  %127 = tail call i32 @HUlib_keyInIText(ptr noundef nonnull @w_chat, i8 noundef zeroext %.043) #3
  %.not57 = icmp eq i32 %127, 0
  br i1 %.not57, label %129, label %128

128:                                              ; preds = %126
  tail call void @HU_queueChatChar(i8 noundef signext %.043)
  br label %129

129:                                              ; preds = %128, %126
  switch i8 %.043, label %.loopexit [
    i8 13, label %130
    i8 27, label %136
  ]

130:                                              ; preds = %129
  store i32 0, ptr @chat_on, align 4, !tbaa !5
  %131 = load i32, ptr getelementptr inbounds (i8, ptr @w_chat, i64 104), align 8, !tbaa !21
  %.not58 = icmp eq i32 %131, 0
  br i1 %.not58, label %.loopexit, label %132

132:                                              ; preds = %130
  %133 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) @HU_Responder.lastmessage, ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @w_chat, i64 20)) #3
  %134 = load ptr, ptr @plr, align 8, !tbaa !18
  %135 = getelementptr inbounds i8, ptr %134, i64 224
  store ptr @HU_Responder.lastmessage, ptr %135, align 8, !tbaa !13
  br label %.loopexit

136:                                              ; preds = %129
  store i32 0, ptr @chat_on, align 4, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %78, %84, %94, %95, %96, %97, %98, %25, %35, %26, %21, %132, %130, %136, %._crit_edge, %129, %102, %16, %14, %12
  %.046 = phi i32 [ 0, %12 ], [ 0, %14 ], [ 0, %16 ], [ 0, %102 ], [ 1, %._crit_edge ], [ %127, %132 ], [ %127, %130 ], [ %127, %136 ], [ 1, %21 ], [ 1, %25 ], [ 1, %35 ], [ 0, %26 ], [ %127, %129 ], [ 0, %98 ], [ 0, %97 ], [ 0, %96 ], [ 0, %95 ], [ 0, %94 ], [ 0, %84 ], [ 0, %78 ]
  ret i32 %.046
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias 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 = { "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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!11 = !{!10, !6, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !15, i64 224}
!14 = !{!"player_s", !15, i64 0, !6, i64 8, !16, i64 12, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !6, i64 44, !7, i64 48, !7, i64 72, !6, i64 96, !7, i64 100, !6, i64 116, !6, i64 120, !7, i64 124, !7, i64 160, !7, i64 176, !6, i64 192, !6, i64 196, !6, i64 200, !6, i64 204, !6, i64 208, !6, i64 212, !6, i64 216, !15, i64 224, !6, i64 232, !6, i64 236, !15, i64 240, !6, i64 248, !6, i64 252, !6, i64 256, !7, i64 264, !6, i64 312}
!15 = !{!"any pointer", !7, i64 0}
!16 = !{!"", !7, i64 0, !7, i64 1, !17, i64 2, !17, i64 4, !7, i64 6, !7, i64 7}
!17 = !{!"short", !7, i64 0}
!18 = !{!15, !15, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!22, !6, i64 104}
!22 = !{!"", !23, i64 0, !6, i64 112, !15, i64 120, !6, i64 128}
!23 = !{!"", !6, i64 0, !6, i64 4, !15, i64 8, !6, i64 16, !7, i64 20, !6, i64 104, !6, i64 108}


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