; LLVM IR from holzschu/ios_system :: shell_cmds/locate/code/locate.code (main)

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

@buf1 = external dso_local global [4096 x i8], align 16
@bigrams = external dso_local global [257 x i8], align 16
@.str = external hidden unnamed_addr constant [1 x i8], align 1
@optind = external global i32, align 4
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@stdout = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@big = external dso_local global [256 x [256 x i16]], align 16
@buf2 = external dso_local global [4096 x i8], align 16
@stdin = external global ptr, align 8

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

17:                                               ; preds = %25, %2
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %19 = load ptr, ptr %5, align 8, !tbaa !9
  %20 = call i32 @getopt(i32 noundef %18, ptr noundef %19, ptr noundef @.str) #7
  store i32 %20, ptr %9, align 4, !tbaa !5
  %21 = icmp ne i32 %20, -1
  br i1 %21, label %22, label %26

22:                                               ; preds = %17
  %23 = load i32, ptr %9, align 4, !tbaa !5
  switch i32 %23, label %24 [
  ]

24:                                               ; preds = %22
  call void @usage()
  br label %25

25:                                               ; preds = %24
  br label %17, !llvm.loop !11

26:                                               ; preds = %17
  %27 = load i32, ptr @optind, align 4, !tbaa !5
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = sub nsw i32 %28, %27
  store i32 %29, ptr %4, align 4, !tbaa !5
  %30 = load i32, ptr @optind, align 4, !tbaa !5
  %31 = load ptr, ptr %5, align 8, !tbaa !9
  %32 = sext i32 %30 to i64
  %33 = getelementptr inbounds ptr, ptr %31, i64 %32
  store ptr %33, ptr %5, align 8, !tbaa !9
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = icmp ne i32 %34, 1
  br i1 %35, label %36, label %37

36:                                               ; preds = %26
  call void @usage()
  br label %37

37:                                               ; preds = %36, %26
  %38 = load ptr, ptr %5, align 8, !tbaa !9
  %39 = getelementptr inbounds ptr, ptr %38, i64 0
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  %41 = call noalias ptr @fopen(ptr noundef %40, ptr noundef @.str.1)
  store ptr %41, ptr %14, align 8, !tbaa !9
  %42 = icmp eq ptr %41, null
  br i1 %42, label %43, label %47

43:                                               ; preds = %37
  %44 = load ptr, ptr %5, align 8, !tbaa !9
  %45 = getelementptr inbounds ptr, ptr %44, i64 0
  %46 = load ptr, ptr %45, align 8, !tbaa !9
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.2, ptr noundef %46) #8
  unreachable

47:                                               ; preds = %37
  %48 = load ptr, ptr %14, align 8, !tbaa !9
  %49 = call ptr @fgets(ptr noundef @bigrams, i32 noundef 257, ptr noundef %48)
  %50 = load ptr, ptr @stdout, align 8, !tbaa !9
  %51 = call i64 @fwrite(ptr noundef @bigrams, i64 noundef 1, i64 noundef 256, ptr noundef %50)
  %52 = icmp ne i64 %51, 256
  br i1 %52, label %53, label %54

53:                                               ; preds = %47
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.3) #8
  unreachable

54:                                               ; preds = %47
  %55 = load ptr, ptr %14, align 8, !tbaa !9
  %56 = call i32 @fclose(ptr noundef %55)
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %75, %54
  %58 = load i32, ptr %15, align 4, !tbaa !5
  %59 = icmp slt i32 %58, 256
  br i1 %59, label %60, label %78

60:                                               ; preds = %57
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %71, %60
  %62 = load i32, ptr %16, align 4, !tbaa !5
  %63 = icmp slt i32 %62, 256
  br i1 %63, label %64, label %74

64:                                               ; preds = %61
  %65 = load i32, ptr %15, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [256 x [256 x i16]], ptr @big, i64 0, i64 %66
  %68 = load i32, ptr %16, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [256 x i16], ptr %67, i64 0, i64 %69
  store i16 -1, ptr %70, align 2, !tbaa !13
  br label %71

71:                                               ; preds = %64
  %72 = load i32, ptr %16, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %16, align 4, !tbaa !5
  br label %61, !llvm.loop !15

74:                                               ; preds = %61
  br label %75

75:                                               ; preds = %74
  %76 = load i32, ptr %15, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %15, align 4, !tbaa !5
  br label %57, !llvm.loop !16

78:                                               ; preds = %57
  store ptr @bigrams, ptr %6, align 8, !tbaa !9
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %96, %78
  %80 = load ptr, ptr %6, align 8, !tbaa !9
  %81 = load i8, ptr %80, align 1, !tbaa !17
  %82 = zext i8 %81 to i32
  %83 = icmp ne i32 %82, 0
  br i1 %83, label %84, label %101

84:                                               ; preds = %79
  %85 = load i32, ptr %15, align 4, !tbaa !5
  %86 = trunc i32 %85 to i16
  %87 = load ptr, ptr %6, align 8, !tbaa !9
  %88 = load i8, ptr %87, align 1, !tbaa !17
  %89 = zext i8 %88 to i64
  %90 = getelementptr inbounds [256 x [256 x i16]], ptr @big, i64 0, i64 %89
  %91 = load ptr, ptr %6, align 8, !tbaa !9
  %92 = getelementptr inbounds i8, ptr %91, i64 1
  %93 = load i8, ptr %92, align 1, !tbaa !17
  %94 = zext i8 %93 to i64
  %95 = getelementptr inbounds [256 x i16], ptr %90, i64 0, i64 %94
  store i16 %86, ptr %95, align 2, !tbaa !13
  br label %96

96:                                               ; preds = %84
  %97 = load i32, ptr %15, align 4, !tbaa !5
  %98 = add nsw i32 %97, 2
  store i32 %98, ptr %15, align 4, !tbaa !5
  %99 = load ptr, ptr %6, align 8, !tbaa !9
  %100 = getelementptr inbounds i8, ptr %99, i64 2
  store ptr %100, ptr %6, align 8, !tbaa !9
  br label %79, !llvm.loop !18

101:                                              ; preds = %79
  store ptr @buf1, ptr %7, align 8, !tbaa !9
  store ptr @buf2, ptr %8, align 8, !tbaa !9
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %275, %112, %101
  %103 = load ptr, ptr %8, align 8, !tbaa !9
  %104 = load ptr, ptr @stdin, align 8, !tbaa !9
  %105 = call ptr @fgets(ptr noundef %103, i32 noundef 4096, ptr noundef %104)
  %106 = icmp ne ptr %105, null
  br i1 %106, label %107, label %276

107:                                              ; preds = %102
  %108 = load ptr, ptr %8, align 8, !tbaa !9
  %109 = load i8, ptr %108, align 1, !tbaa !17
  %110 = zext i8 %109 to i32
  %111 = icmp eq i32 %110, 10
  br i1 %111, label %112, label %113

112:                                              ; preds = %107
  br label %102, !llvm.loop !19

113:                                              ; preds = %107
  %114 = load ptr, ptr %8, align 8, !tbaa !9
  store ptr %114, ptr %6, align 8, !tbaa !9
  br label %115

115:                                              ; preds = %136, %113
  %116 = load ptr, ptr %6, align 8, !tbaa !9
  %117 = load i8, ptr %116, align 1, !tbaa !17
  %118 = zext i8 %117 to i32
  %119 = icmp ne i32 %118, 0
  br i1 %119, label %120, label %139

120:                                              ; preds = %115
  %121 = load ptr, ptr %6, align 8, !tbaa !9
  %122 = load i8, ptr %121, align 1, !tbaa !17
  %123 = zext i8 %122 to i32
  %124 = icmp eq i32 %123, 30
  br i1 %124, label %125, label %127

125:                                              ; preds = %120
  %126 = load ptr, ptr %6, align 8, !tbaa !9
  store i8 63, ptr %126, align 1, !tbaa !17
  br label %135

127:                                              ; preds = %120
  %128 = load ptr, ptr %6, align 8, !tbaa !9
  %129 = load i8, ptr %128, align 1, !tbaa !17
  %130 = zext i8 %129 to i32
  %131 = icmp eq i32 %130, 10
  br i1 %131, label %132, label %134

132:                                              ; preds = %127
  %133 = load ptr, ptr %6, align 8, !tbaa !9
  store i8 0, ptr %133, align 1, !tbaa !17
  br label %134

134:                                              ; preds = %132, %127
  br label %135

135:                                              ; preds = %134, %125
  br label %136

136:                                              ; preds = %135
  %137 = load ptr, ptr %6, align 8, !tbaa !9
  %138 = getelementptr inbounds i8, ptr %137, i32 1
  store ptr %138, ptr %6, align 8, !tbaa !9
  br label %115, !llvm.loop !20

139:                                              ; preds = %115
  %140 = load ptr, ptr %8, align 8, !tbaa !9
  store ptr %140, ptr %6, align 8, !tbaa !9
  br label %141

141:                                              ; preds = %156, %139
  %142 = load ptr, ptr %6, align 8, !tbaa !9
  %143 = load i8, ptr %142, align 1, !tbaa !17
  %144 = zext i8 %143 to i32
  %145 = load ptr, ptr %7, align 8, !tbaa !9
  %146 = load i8, ptr %145, align 1, !tbaa !17
  %147 = zext i8 %146 to i32
  %148 = icmp eq i32 %144, %147
  br i1 %148, label %149, label %161

149:                                              ; preds = %141
  %150 = load ptr, ptr %6, align 8, !tbaa !9
  %151 = load i8, ptr %150, align 1, !tbaa !17
  %152 = zext i8 %151 to i32
  %153 = icmp eq i32 %152, 0
  br i1 %153, label %154, label %155

154:                                              ; preds = %149
  br label %161

155:                                              ; preds = %149
  br label %156

156:                                              ; preds = %155
  %157 = load ptr, ptr %6, align 8, !tbaa !9
  %158 = getelementptr inbounds i8, ptr %157, i32 1
  store ptr %158, ptr %6, align 8, !tbaa !9
  %159 = load ptr, ptr %7, align 8, !tbaa !9
  %160 = getelementptr inbounds i8, ptr %159, i32 1
  store ptr %160, ptr %7, align 8, !tbaa !9
  br label %141, !llvm.loop !21

161:                                              ; preds = %154, %141
  %162 = load ptr, ptr %6, align 8, !tbaa !9
  %163 = load ptr, ptr %8, align 8, !tbaa !9
  %164 = ptrtoint ptr %162 to i64
  %165 = ptrtoint ptr %163 to i64
  %166 = sub i64 %164, %165
  %167 = trunc i64 %166 to i32
  store i32 %167, ptr %11, align 4, !tbaa !5
  %168 = load i32, ptr %11, align 4, !tbaa !5
  %169 = load i32, ptr %13, align 4, !tbaa !5
  %170 = sub nsw i32 %168, %169
  %171 = add nsw i32 %170, 14
  store i32 %171, ptr %12, align 4, !tbaa !5
  %172 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %172, ptr %13, align 4, !tbaa !5
  %173 = load i32, ptr %12, align 4, !tbaa !5
  %174 = icmp slt i32 %173, 0
  br i1 %174, label %178, label %175

175:                                              ; preds = %161
  %176 = load i32, ptr %12, align 4, !tbaa !5
  %177 = icmp sgt i32 %176, 28
  br i1 %177, label %178, label %188

178:                                              ; preds = %175, %161
  %179 = call i32 @putchar(i32 noundef 30)
  %180 = icmp eq i32 %179, -1
  br i1 %180, label %186, label %181

181:                                              ; preds = %178
  %182 = load i32, ptr %12, align 4, !tbaa !5
  %183 = load ptr, ptr @stdout, align 8, !tbaa !9
  %184 = call i32 @putw(i32 noundef %182, ptr noundef %183)
  %185 = icmp eq i32 %184, -1
  br i1 %185, label %186, label %187

186:                                              ; preds = %181, %178
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.3) #8
  unreachable

187:                                              ; preds = %181
  br label %194

188:                                              ; preds = %175
  %189 = load i32, ptr %12, align 4, !tbaa !5
  %190 = call i32 @putchar(i32 noundef %189)
  %191 = icmp eq i32 %190, -1
  br i1 %191, label %192, label %193

192:                                              ; preds = %188
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.3) #8
  unreachable

193:                                              ; preds = %188
  br label %194

194:                                              ; preds = %193, %187
  br label %195

195:                                              ; preds = %269, %194
  %196 = load ptr, ptr %6, align 8, !tbaa !9
  %197 = load i8, ptr %196, align 1, !tbaa !17
  %198 = zext i8 %197 to i32
  %199 = icmp ne i32 %198, 0
  br i1 %199, label %200, label %270

200:                                              ; preds = %195
  %201 = load ptr, ptr %6, align 8, !tbaa !9
  %202 = load i8, ptr %201, align 1, !tbaa !17
  %203 = zext i8 %202 to i64
  %204 = getelementptr inbounds [256 x [256 x i16]], ptr @big, i64 0, i64 %203
  %205 = load ptr, ptr %6, align 8, !tbaa !9
  %206 = getelementptr inbounds i8, ptr %205, i64 1
  %207 = load i8, ptr %206, align 1, !tbaa !17
  %208 = zext i8 %207 to i64
  %209 = getelementptr inbounds [256 x i16], ptr %204, i64 0, i64 %208
  %210 = load i16, ptr %209, align 2, !tbaa !13
  %211 = sext i16 %210 to i32
  store i32 %211, ptr %10, align 4, !tbaa !5
  %212 = icmp ne i32 %211, -1
  br i1 %212, label %213, label %223

213:                                              ; preds = %200
  %214 = load i32, ptr %10, align 4, !tbaa !5
  %215 = sdiv i32 %214, 2
  %216 = or i32 %215, 128
  %217 = call i32 @putchar(i32 noundef %216)
  %218 = icmp eq i32 %217, -1
  br i1 %218, label %219, label %220

219:                                              ; preds = %213
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.3) #8
  unreachable

220:                                              ; preds = %213
  %221 = load ptr, ptr %6, align 8, !tbaa !9
  %222 = getelementptr inbounds i8, ptr %221, i64 2
  store ptr %222, ptr %6, align 8, !tbaa !9
  br label %269

223:                                              ; preds = %200
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %224

224:                                              ; preds = %265, %223
  %225 = load i32, ptr %15, align 4, !tbaa !5
  %226 = icmp slt i32 %225, 2
  br i1 %226, label %227, label %268

227:                                              ; preds = %224
  %228 = load ptr, ptr %6, align 8, !tbaa !9
  %229 = load i8, ptr %228, align 1, !tbaa !17
  %230 = zext i8 %229 to i32
  %231 = icmp eq i32 %230, 0
  br i1 %231, label %232, label %233

232:                                              ; preds = %227
  br label %268

233:                                              ; preds = %227
  %234 = load ptr, ptr %6, align 8, !tbaa !9
  %235 = load i8, ptr %234, align 1, !tbaa !17
  %236 = zext i8 %235 to i32
  %237 = icmp slt i32 %236, 32
  br i1 %237, label %243, label %238

238:                                              ; preds = %233
  %239 = load ptr, ptr %6, align 8, !tbaa !9
  %240 = load i8, ptr %239, align 1, !tbaa !17
  %241 = zext i8 %240 to i32
  %242 = icmp sgt i32 %241, 127
  br i1 %242, label %243, label %255

243:                                              ; preds = %238, %233
  %244 = call i32 @putchar(i32 noundef 31)
  %245 = icmp eq i32 %244, -1
  br i1 %245, label %253, label %246

246:                                              ; preds = %243
  %247 = load ptr, ptr %6, align 8, !tbaa !9
  %248 = getelementptr inbounds i8, ptr %247, i32 1
  store ptr %248, ptr %6, align 8, !tbaa !9
  %249 = load i8, ptr %247, align 1, !tbaa !17
  %250 = zext i8 %249 to i32
  %251 = call i32 @putchar(i32 noundef %250)
  %252 = icmp eq i32 %251, -1
  br i1 %252, label %253, label %254

253:                                              ; preds = %246, %243
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.3) #8
  unreachable

254:                                              ; preds = %246
  br label %264

255:                                              ; preds = %238
  %256 = load ptr, ptr %6, align 8, !tbaa !9
  %257 = getelementptr inbounds i8, ptr %256, i32 1
  store ptr %257, ptr %6, align 8, !tbaa !9
  %258 = load i8, ptr %256, align 1, !tbaa !17
  %259 = zext i8 %258 to i32
  %260 = call i32 @putchar(i32 noundef %259)
  %261 = icmp eq i32 %260, -1
  br i1 %261, label %262, label %263

262:                                              ; preds = %255
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.3) #8
  unreachable

263:                                              ; preds = %255
  br label %264

264:                                              ; preds = %263, %254
  br label %265

265:                                              ; preds = %264
  %266 = load i32, ptr %15, align 4, !tbaa !5
  %267 = add nsw i32 %266, 1
  store i32 %267, ptr %15, align 4, !tbaa !5
  br label %224, !llvm.loop !22

268:                                              ; preds = %232, %224
  br label %269

269:                                              ; preds = %268, %220
  br label %195, !llvm.loop !23

270:                                              ; preds = %195
  %271 = load ptr, ptr %8, align 8, !tbaa !9
  %272 = icmp eq ptr %271, @buf1
  br i1 %272, label %273, label %274

273:                                              ; preds = %270
  store ptr @buf2, ptr %8, align 8, !tbaa !9
  store ptr @buf1, ptr %7, align 8, !tbaa !9
  br label %275

274:                                              ; preds = %270
  store ptr @buf1, ptr %8, align 8, !tbaa !9
  store ptr @buf2, ptr %7, align 8, !tbaa !9
  br label %275

275:                                              ; preds = %274, %273
  br label %102, !llvm.loop !19

276:                                              ; preds = %102
  %277 = load ptr, ptr @stdout, align 8, !tbaa !9
  %278 = call i32 @fflush(ptr noundef %277)
  %279 = icmp ne i32 %278, 0
  br i1 %279, label %284, label %280

280:                                              ; preds = %276
  %281 = load ptr, ptr @stdout, align 8, !tbaa !9
  %282 = call i32 @ferror(ptr noundef %281) #7
  %283 = icmp ne i32 %282, 0
  br i1 %283, label %284, label %285

284:                                              ; preds = %280, %276
  call void @exit(i32 noundef 1) #9
  unreachable

285:                                              ; preds = %280
  call void @exit(i32 noundef 0) #9
  unreachable
}

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

; Function Attrs: nounwind
declare i32 @getopt(i32 noundef, ptr noundef, ptr noundef) #2

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

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

; Function Attrs: noreturn
declare void @err(i32 noundef, ptr noundef, ...) #4

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

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #3

declare i32 @fclose(ptr noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare i32 @putchar(i32 noundef) #5

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

declare i32 @fflush(ptr noundef) #3

; Function Attrs: nounwind
declare i32 @ferror(ptr noundef) #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #6

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "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 = { noreturn "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 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { noreturn }
attributes #9 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}


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

@buf1 = external dso_local global [4096 x i8], align 16
@bigrams = external dso_local global [257 x i8], align 16
@.str = external hidden unnamed_addr constant [1 x i8], align 1
@optind = external local_unnamed_addr global i32, align 4
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@big = external dso_local local_unnamed_addr global [256 x [256 x i16]], align 16
@buf2 = external dso_local global [4096 x i8], align 16
@stdin = external local_unnamed_addr global ptr, align 8

; Function Attrs: noreturn nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = tail call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str) #10
  %.not92 = icmp eq i32 %3, -1
  br i1 %.not92, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %.lr.ph
  tail call void @usage()
  %4 = tail call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str) #10
  %.not = icmp eq i32 %4, -1
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !5

._crit_edge:                                      ; preds = %.lr.ph, %2
  %5 = load i32, ptr @optind, align 4, !tbaa !7
  %6 = sub nsw i32 %0, %5
  %7 = sext i32 %5 to i64
  %8 = getelementptr inbounds ptr, ptr %1, i64 %7
  %.not74 = icmp eq i32 %6, 1
  br i1 %.not74, label %10, label %9

9:                                                ; preds = %._crit_edge
  tail call void @usage()
  br label %10

10:                                               ; preds = %9, %._crit_edge
  %11 = load ptr, ptr %8, align 8, !tbaa !11
  %12 = tail call noalias ptr @fopen(ptr noundef %11, ptr noundef nonnull @.str.1)
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %16

14:                                               ; preds = %10
  %15 = load ptr, ptr %8, align 8, !tbaa !11
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.2, ptr noundef %15) #11
  unreachable

16:                                               ; preds = %10
  %17 = tail call ptr @fgets(ptr noundef nonnull @bigrams, i32 noundef 257, ptr noundef nonnull %12)
  %18 = load ptr, ptr @stdout, align 8, !tbaa !11
  %19 = tail call i64 @fwrite(ptr noundef nonnull @bigrams, i64 noundef 1, i64 noundef 256, ptr noundef %18)
  %.not75 = icmp eq i64 %19, 256
  br i1 %.not75, label %.preheader88, label %20

20:                                               ; preds = %16
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.3) #11
  unreachable

.preheader88:                                     ; preds = %16
  %21 = tail call i32 @fclose(ptr noundef nonnull %12)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(131072) @big, i8 -1, i64 131072, i1 false), !tbaa !13
  %22 = load i8, ptr @bigrams, align 16, !tbaa !15
  %.not7695 = icmp eq i8 %22, 0
  br i1 %.not7695, label %.outer.preheader, label %.lr.ph98

.lr.ph98:                                         ; preds = %.preheader88, %.lr.ph98
  %23 = phi i8 [ %31, %.lr.ph98 ], [ %22, %.preheader88 ]
  %.197 = phi i16 [ %29, %.lr.ph98 ], [ 0, %.preheader88 ]
  %.06096 = phi ptr [ %30, %.lr.ph98 ], [ @bigrams, %.preheader88 ]
  %24 = zext i8 %23 to i64
  %25 = getelementptr inbounds i8, ptr %.06096, i64 1
  %26 = load i8, ptr %25, align 1, !tbaa !15
  %27 = zext i8 %26 to i64
  %28 = getelementptr inbounds [256 x [256 x i16]], ptr @big, i64 0, i64 %24, i64 %27
  store i16 %.197, ptr %28, align 2, !tbaa !13
  %29 = add i16 %.197, 2
  %30 = getelementptr inbounds i8, ptr %.06096, i64 2
  %31 = load i8, ptr %30, align 1, !tbaa !15
  %.not76 = icmp eq i8 %31, 0
  br i1 %.not76, label %.outer.preheader, label %.lr.ph98, !llvm.loop !16

.outer.preheader:                                 ; preds = %.lr.ph98, %.preheader88
  br label %.outer

32:                                               ; preds = %.outer, %35
  %33 = load ptr, ptr @stdin, align 8, !tbaa !11
  %34 = tail call ptr @fgets(ptr noundef nonnull %.066.ph, i32 noundef 4096, ptr noundef %33)
  %.not77 = icmp eq ptr %34, null
  br i1 %.not77, label %118, label %35

35:                                               ; preds = %32
  %36 = load i8, ptr %.066.ph, align 1, !tbaa !15
  %37 = icmp eq i8 %36, 10
  br i1 %37, label %32, label %.preheader86, !llvm.loop !17

.preheader86:                                     ; preds = %35, %44
  %38 = phi i8 [ %.pr, %44 ], [ %36, %35 ]
  %.161 = phi ptr [ %45, %44 ], [ %.066.ph, %35 ]
  switch i8 %38, label %44 [
    i8 0, label %.preheader85
    i8 30, label %.sink.split
    i8 10, label %43
  ]

.preheader85:                                     ; preds = %.preheader86
  %39 = load i8, ptr %.066.ph, align 1, !tbaa !15
  %40 = load i8, ptr %.063.ph, align 1, !tbaa !15
  %41 = icmp ne i8 %39, %40
  %42 = icmp eq i8 %39, 0
  %or.cond8399 = or i1 %42, %41
  br i1 %or.cond8399, label %._crit_edge103, label %.lr.ph102

43:                                               ; preds = %.preheader86
  br label %.sink.split

.sink.split:                                      ; preds = %.preheader86, %43
  %.sink = phi i8 [ 0, %43 ], [ 63, %.preheader86 ]
  store i8 %.sink, ptr %.161, align 1, !tbaa !15
  br label %44

44:                                               ; preds = %.sink.split, %.preheader86
  %45 = getelementptr inbounds i8, ptr %.161, i64 1
  %.pr = load i8, ptr %45, align 1, !tbaa !15
  br label %.preheader86, !llvm.loop !18

.lr.ph102:                                        ; preds = %.preheader85, %.lr.ph102
  %.262101 = phi ptr [ %46, %.lr.ph102 ], [ %.066.ph, %.preheader85 ]
  %.164100 = phi ptr [ %47, %.lr.ph102 ], [ %.063.ph, %.preheader85 ]
  %46 = getelementptr inbounds i8, ptr %.262101, i64 1
  %47 = getelementptr inbounds i8, ptr %.164100, i64 1
  %48 = load i8, ptr %46, align 1, !tbaa !15
  %49 = load i8, ptr %47, align 1, !tbaa !15
  %50 = icmp ne i8 %48, %49
  %51 = icmp eq i8 %48, 0
  %or.cond83 = or i1 %51, %50
  br i1 %or.cond83, label %._crit_edge103, label %.lr.ph102, !llvm.loop !19

._crit_edge103:                                   ; preds = %.lr.ph102, %.preheader85
  %.262.lcssa = phi ptr [ %.066.ph, %.preheader85 ], [ %46, %.lr.ph102 ]
  %52 = ptrtoint ptr %.262.lcssa to i64
  %53 = ptrtoint ptr %.066.ph to i64
  %54 = sub i64 %52, %53
  %55 = trunc i64 %54 to i32
  %56 = sub nsw i32 %55, %.059.ph
  %57 = add nsw i32 %56, 14
  %58 = add i32 %56, -15
  %or.cond = icmp ult i32 %58, -29
  br i1 %or.cond, label %59, label %67

59:                                               ; preds = %._crit_edge103
  %60 = tail call i32 @putchar(i32 noundef 30)
  %61 = icmp eq i32 %60, -1
  br i1 %61, label %66, label %62

62:                                               ; preds = %59
  %63 = load ptr, ptr @stdout, align 8, !tbaa !11
  %64 = tail call i32 @putw(i32 noundef %57, ptr noundef %63) #10
  %65 = icmp eq i32 %64, -1
  br i1 %65, label %66, label %71

66:                                               ; preds = %62, %59
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.3) #11
  unreachable

67:                                               ; preds = %._crit_edge103
  %68 = tail call i32 @putchar(i32 noundef %57)
  %69 = icmp eq i32 %68, -1
  br i1 %69, label %70, label %71

70:                                               ; preds = %67
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.3) #11
  unreachable

71:                                               ; preds = %67, %62
  %72 = load i8, ptr %.262.lcssa, align 1, !tbaa !15
  %.not81106 = icmp eq i8 %72, 0
  br i1 %.not81106, label %._crit_edge110, label %.lr.ph109

.lr.ph109:                                        ; preds = %71, %.loopexit
  %73 = phi i8 [ %.pr114, %.loopexit ], [ %72, %71 ]
  %.3107 = phi ptr [ %.5.1, %.loopexit ], [ %.262.lcssa, %71 ]
  %74 = zext i8 %73 to i64
  %75 = getelementptr inbounds i8, ptr %.3107, i64 1
  %76 = load i8, ptr %75, align 1, !tbaa !15
  %77 = zext i8 %76 to i64
  %78 = getelementptr inbounds [256 x [256 x i16]], ptr @big, i64 0, i64 %74, i64 %77
  %79 = load i16, ptr %78, align 2, !tbaa !13
  %.not82 = icmp eq i16 %79, -1
  br i1 %.not82, label %87, label %80

80:                                               ; preds = %.lr.ph109
  %81 = sdiv i16 %79, 2
  %82 = or i16 %81, 128
  %83 = sext i16 %82 to i32
  %84 = tail call i32 @putchar(i32 noundef %83)
  %85 = icmp eq i32 %84, -1
  br i1 %85, label %86, label %.loopexit

86:                                               ; preds = %80
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.3) #11
  unreachable

87:                                               ; preds = %.lr.ph109
  %or.cond84 = icmp slt i8 %73, 32
  br i1 %or.cond84, label %88, label %97

88:                                               ; preds = %87
  %89 = tail call i32 @putchar(i32 noundef 31)
  %90 = icmp eq i32 %89, -1
  br i1 %90, label %96, label %91

91:                                               ; preds = %88
  %92 = load i8, ptr %.3107, align 1, !tbaa !15
  %93 = zext i8 %92 to i32
  %94 = tail call i32 @putchar(i32 noundef %93)
  %95 = icmp eq i32 %94, -1
  br i1 %95, label %96, label %.preheader.1

96:                                               ; preds = %112, %109, %91, %88
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.3) #11
  unreachable

97:                                               ; preds = %87
  %98 = zext nneg i8 %73 to i32
  %99 = tail call i32 @putchar(i32 noundef %98)
  %100 = icmp eq i32 %99, -1
  br i1 %100, label %101, label %.preheader.1

101:                                              ; preds = %106, %97
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.3) #11
  unreachable

.preheader.1:                                     ; preds = %91, %97
  %102 = load i8, ptr %75, align 1, !tbaa !15
  %103 = zext i8 %102 to i32
  %104 = icmp eq i8 %102, 0
  br i1 %104, label %._crit_edge110, label %105

105:                                              ; preds = %.preheader.1
  %or.cond84.1 = icmp slt i8 %102, 32
  br i1 %or.cond84.1, label %109, label %106

106:                                              ; preds = %105
  %107 = tail call i32 @putchar(i32 noundef %103)
  %108 = icmp eq i32 %107, -1
  br i1 %108, label %101, label %.loopexit

109:                                              ; preds = %105
  %110 = tail call i32 @putchar(i32 noundef 31)
  %111 = icmp eq i32 %110, -1
  br i1 %111, label %96, label %112

112:                                              ; preds = %109
  %113 = load i8, ptr %75, align 1, !tbaa !15
  %114 = zext i8 %113 to i32
  %115 = tail call i32 @putchar(i32 noundef %114)
  %116 = icmp eq i32 %115, -1
  br i1 %116, label %96, label %.loopexit

.loopexit:                                        ; preds = %106, %112, %80
  %.5.1 = getelementptr inbounds i8, ptr %.3107, i64 2
  %.pr114 = load i8, ptr %.5.1, align 1, !tbaa !15
  %.not81 = icmp eq i8 %.pr114, 0
  br i1 %.not81, label %._crit_edge110, label %.lr.ph109, !llvm.loop !20

._crit_edge110:                                   ; preds = %.preheader.1, %.loopexit, %71
  %117 = icmp eq ptr %.066.ph, @buf1
  %buf2.buf1 = select i1 %117, ptr @buf2, ptr @buf1
  %buf1.buf2 = select i1 %117, ptr @buf1, ptr @buf2
  br label %.outer, !llvm.loop !17

.outer:                                           ; preds = %.outer.preheader, %._crit_edge110
  %.066.ph = phi ptr [ %buf2.buf1, %._crit_edge110 ], [ @buf2, %.outer.preheader ]
  %.063.ph = phi ptr [ %buf1.buf2, %._crit_edge110 ], [ @buf1, %.outer.preheader ]
  %.059.ph = phi i32 [ %55, %._crit_edge110 ], [ 0, %.outer.preheader ]
  br label %32

118:                                              ; preds = %32
  %119 = load ptr, ptr @stdout, align 8, !tbaa !11
  %120 = tail call i32 @fflush(ptr noundef %119)
  %.not78 = icmp eq i32 %120, 0
  br i1 %.not78, label %121, label %124

121:                                              ; preds = %118
  %122 = load ptr, ptr @stdout, align 8, !tbaa !11
  %123 = tail call i32 @ferror(ptr noundef %122) #10
  %.not79 = icmp eq i32 %123, 0
  br i1 %.not79, label %125, label %124

124:                                              ; preds = %121, %118
  tail call void @exit(i32 noundef 1) #11
  unreachable

125:                                              ; preds = %121
  tail call void @exit(i32 noundef 0) #11
  unreachable
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @usage() 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: noreturn
declare void @err(i32 noundef, ptr noundef, ...) local_unnamed_addr #4

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

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

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

; Function Attrs: inlinehint nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5

declare i32 @putw(i32 noundef, ptr noundef) local_unnamed_addr #6

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

; Function Attrs: nofree nounwind memory(read)
declare noundef i32 @ferror(ptr nocapture noundef) local_unnamed_addr #7

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #8

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

attributes #0 = { noreturn 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 = { 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 = { 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 #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 = { noreturn "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 = { inlinehint nofree 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 = { "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 = { nofree nounwind memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { 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 #9 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #10 = { nounwind }
attributes #11 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"short", !9, i64 0}
!15 = !{!9, !9, i64 0}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6}
!18 = distinct !{!18, !6}
!19 = distinct !{!19, !6}
!20 = distinct !{!20, !6}


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