; LLVM IR from NOAA-PMEL/Ferret :: fer/ccr (get_sys_cmnd)

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

@.str = external hidden unnamed_addr constant [73 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @get_sys_cmnd_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 8192, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 8192, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %23 = load i32, ptr %20, align 4, !tbaa !9
  store i32 %23, ptr %21, align 4, !tbaa !9
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 0, ptr %24, align 4, !tbaa !9
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 0, ptr %25, align 4, !tbaa !9
  %26 = call ptr @FerMem_Malloc(i64 noundef 65536, ptr noundef @.str, i32 noundef 79)
  store ptr %26, ptr %9, align 8, !tbaa !5
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %31

29:                                               ; preds = %4
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 1, ptr %30, align 4, !tbaa !9
  store i32 1, ptr %22, align 4
  br label %266

31:                                               ; preds = %4
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %32, i8 0, i64 65536, i1 false)
  %33 = load i32, ptr %10, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = mul i64 1, %34
  %36 = call ptr @FerMem_Malloc(i64 noundef %35, ptr noundef @.str, i32 noundef 86)
  store ptr %36, ptr %11, align 8, !tbaa !5
  %37 = load ptr, ptr %11, align 8, !tbaa !5
  %38 = icmp eq ptr %37, null
  br i1 %38, label %39, label %42

39:                                               ; preds = %31
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  call void @FerMem_Free(ptr noundef %40, ptr noundef @.str, i32 noundef 88)
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 1, ptr %41, align 4, !tbaa !9
  store i32 1, ptr %22, align 4
  br label %266

42:                                               ; preds = %31
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = call noalias ptr @popen(ptr noundef %43, ptr noundef @.str.1)
  store ptr %44, ptr %14, align 8, !tbaa !5
  %45 = load ptr, ptr %14, align 8, !tbaa !5
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %245

47:                                               ; preds = %42
  br label %48

48:                                               ; preds = %232, %47
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = load i32, ptr %10, align 4, !tbaa !9
  %51 = load ptr, ptr %14, align 8, !tbaa !5
  %52 = call ptr @fgets(ptr noundef %49, i32 noundef %50, ptr noundef %51)
  %53 = icmp ne ptr %52, null
  br i1 %53, label %54, label %242

54:                                               ; preds = %48
  %55 = load ptr, ptr %11, align 8, !tbaa !5
  %56 = call i64 @strlen(ptr noundef %55) #7
  %57 = trunc i64 %56 to i32
  store i32 %57, ptr %18, align 4, !tbaa !9
  %58 = load ptr, ptr %11, align 8, !tbaa !5
  %59 = load i32, ptr %18, align 4, !tbaa !9
  %60 = sub nsw i32 %59, 1
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds i8, ptr %58, i64 %61
  %63 = load i8, ptr %62, align 1, !tbaa !11
  %64 = sext i8 %63 to i32
  %65 = icmp ne i32 %64, 10
  %66 = zext i1 %65 to i32
  store i32 %66, ptr %19, align 4, !tbaa !9
  %67 = load i32, ptr %19, align 4, !tbaa !9
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %82

69:                                               ; preds = %54
  %70 = load i32, ptr %18, align 4, !tbaa !9
  %71 = load i32, ptr %10, align 4, !tbaa !9
  %72 = sub nsw i32 %71, 2
  %73 = icmp sle i32 %70, %72
  br i1 %73, label %74, label %82

74:                                               ; preds = %69
  %75 = load ptr, ptr %11, align 8, !tbaa !5
  %76 = load i32, ptr %18, align 4, !tbaa !9
  %77 = add nsw i32 %76, 1
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds i8, ptr %75, i64 %78
  store i8 10, ptr %79, align 1, !tbaa !11
  store i32 0, ptr %19, align 4, !tbaa !9
  %80 = load i32, ptr %18, align 4, !tbaa !9
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %18, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %74, %69, %54
  %83 = load i32, ptr %19, align 4, !tbaa !9
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %143

85:                                               ; preds = %82
  br label %86

86:                                               ; preds = %141, %85
  %87 = load i32, ptr %19, align 4, !tbaa !9
  %88 = icmp ne i32 %87, 0
  br i1 %88, label %89, label %142

89:                                               ; preds = %86
  %90 = load i32, ptr %10, align 4, !tbaa !9
  %91 = add nsw i32 %90, 8192
  store i32 %91, ptr %10, align 4, !tbaa !9
  %92 = load ptr, ptr %11, align 8, !tbaa !5
  %93 = load i32, ptr %10, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = mul i64 1, %94
  %96 = call ptr @FerMem_Realloc(ptr noundef %92, i64 noundef %95, ptr noundef @.str, i32 noundef 112)
  store ptr %96, ptr %12, align 8, !tbaa !5
  %97 = load ptr, ptr %12, align 8, !tbaa !5
  %98 = icmp eq ptr %97, null
  br i1 %98, label %99, label %118

99:                                               ; preds = %89
  %100 = load ptr, ptr %11, align 8, !tbaa !5
  call void @FerMem_Free(ptr noundef %100, ptr noundef @.str, i32 noundef 114)
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %101

101:                                              ; preds = %112, %99
  %102 = load i32, ptr %17, align 4, !tbaa !9
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = load i32, ptr %103, align 4, !tbaa !9
  %105 = icmp slt i32 %102, %104
  br i1 %105, label %106, label %115

106:                                              ; preds = %101
  %107 = load ptr, ptr %9, align 8, !tbaa !5
  %108 = load i32, ptr %17, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds ptr, ptr %107, i64 %109
  %111 = load ptr, ptr %110, align 8, !tbaa !5
  call void @FerMem_Free(ptr noundef %111, ptr noundef @.str, i32 noundef 116)
  br label %112

112:                                              ; preds = %106
  %113 = load i32, ptr %17, align 4, !tbaa !9
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %17, align 4, !tbaa !9
  br label %101, !llvm.loop !12

115:                                              ; preds = %101
  %116 = load ptr, ptr %9, align 8, !tbaa !5
  call void @FerMem_Free(ptr noundef %116, ptr noundef @.str, i32 noundef 117)
  %117 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 1, ptr %117, align 4, !tbaa !9
  store i32 1, ptr %22, align 4
  br label %266

118:                                              ; preds = %89
  %119 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %119, ptr %11, align 8, !tbaa !5
  %120 = load ptr, ptr %11, align 8, !tbaa !5
  %121 = load i32, ptr %18, align 4, !tbaa !9
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds i8, ptr %120, i64 %122
  %124 = load ptr, ptr %14, align 8, !tbaa !5
  %125 = call ptr @fgets(ptr noundef %123, i32 noundef 8192, ptr noundef %124)
  %126 = icmp ne ptr %125, null
  br i1 %126, label %127, label %140

127:                                              ; preds = %118
  %128 = load ptr, ptr %11, align 8, !tbaa !5
  %129 = call i64 @strlen(ptr noundef %128) #7
  %130 = trunc i64 %129 to i32
  store i32 %130, ptr %18, align 4, !tbaa !9
  %131 = load ptr, ptr %11, align 8, !tbaa !5
  %132 = load i32, ptr %18, align 4, !tbaa !9
  %133 = sub nsw i32 %132, 1
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds i8, ptr %131, i64 %134
  %136 = load i8, ptr %135, align 1, !tbaa !11
  %137 = sext i8 %136 to i32
  %138 = icmp ne i32 %137, 10
  %139 = zext i1 %138 to i32
  store i32 %139, ptr %19, align 4, !tbaa !9
  br label %141

140:                                              ; preds = %118
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %141

141:                                              ; preds = %140, %127
  br label %86, !llvm.loop !14

142:                                              ; preds = %86
  br label %143

143:                                              ; preds = %142, %82
  %144 = load ptr, ptr %11, align 8, !tbaa !5
  %145 = load i32, ptr %18, align 4, !tbaa !9
  %146 = sub nsw i32 %145, 1
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds i8, ptr %144, i64 %147
  store i8 0, ptr %148, align 1, !tbaa !11
  %149 = load ptr, ptr %11, align 8, !tbaa !5
  %150 = call i64 @strlen(ptr noundef %149) #7
  %151 = add i64 %150, 1
  %152 = trunc i64 %151 to i32
  %153 = sext i32 %152 to i64
  %154 = mul i64 1, %153
  %155 = call ptr @FerMem_Malloc(i64 noundef %154, ptr noundef @.str, i32 noundef 134)
  store ptr %155, ptr %15, align 8, !tbaa !5
  %156 = load ptr, ptr %15, align 8, !tbaa !5
  %157 = icmp eq ptr %156, null
  br i1 %157, label %158, label %177

158:                                              ; preds = %143
  %159 = load ptr, ptr %11, align 8, !tbaa !5
  call void @FerMem_Free(ptr noundef %159, ptr noundef @.str, i32 noundef 136)
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %160

160:                                              ; preds = %171, %158
  %161 = load i32, ptr %17, align 4, !tbaa !9
  %162 = load ptr, ptr %6, align 8, !tbaa !5
  %163 = load i32, ptr %162, align 4, !tbaa !9
  %164 = icmp slt i32 %161, %163
  br i1 %164, label %165, label %174

165:                                              ; preds = %160
  %166 = load ptr, ptr %9, align 8, !tbaa !5
  %167 = load i32, ptr %17, align 4, !tbaa !9
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds ptr, ptr %166, i64 %168
  %170 = load ptr, ptr %169, align 8, !tbaa !5
  call void @FerMem_Free(ptr noundef %170, ptr noundef @.str, i32 noundef 138)
  br label %171

171:                                              ; preds = %165
  %172 = load i32, ptr %17, align 4, !tbaa !9
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %17, align 4, !tbaa !9
  br label %160, !llvm.loop !15

174:                                              ; preds = %160
  %175 = load ptr, ptr %9, align 8, !tbaa !5
  call void @FerMem_Free(ptr noundef %175, ptr noundef @.str, i32 noundef 139)
  %176 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 1, ptr %176, align 4, !tbaa !9
  store i32 1, ptr %22, align 4
  br label %266

177:                                              ; preds = %143
  %178 = load ptr, ptr %15, align 8, !tbaa !5
  %179 = load ptr, ptr %11, align 8, !tbaa !5
  %180 = call ptr @strcpy(ptr noundef %178, ptr noundef %179) #6
  %181 = load i32, ptr %16, align 4, !tbaa !9
  %182 = load i32, ptr %21, align 4, !tbaa !9
  %183 = icmp eq i32 %181, %182
  br i1 %183, label %184, label %232

184:                                              ; preds = %177
  %185 = load i32, ptr %20, align 4, !tbaa !9
  store i32 %185, ptr %21, align 4, !tbaa !9
  %186 = load i32, ptr %20, align 4, !tbaa !9
  %187 = mul nsw i32 %186, 2
  store i32 %187, ptr %20, align 4, !tbaa !9
  %188 = load ptr, ptr %9, align 8, !tbaa !5
  %189 = load i32, ptr %20, align 4, !tbaa !9
  %190 = sext i32 %189 to i64
  %191 = mul i64 8, %190
  %192 = call ptr @FerMem_Realloc(ptr noundef %188, i64 noundef %191, ptr noundef @.str, i32 noundef 148)
  store ptr %192, ptr %13, align 8, !tbaa !5
  %193 = load ptr, ptr %13, align 8, !tbaa !5
  %194 = icmp eq ptr %193, null
  br i1 %194, label %195, label %215

195:                                              ; preds = %184
  %196 = load ptr, ptr %11, align 8, !tbaa !5
  call void @FerMem_Free(ptr noundef %196, ptr noundef @.str, i32 noundef 150)
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %197

197:                                              ; preds = %208, %195
  %198 = load i32, ptr %17, align 4, !tbaa !9
  %199 = load ptr, ptr %6, align 8, !tbaa !5
  %200 = load i32, ptr %199, align 4, !tbaa !9
  %201 = icmp slt i32 %198, %200
  br i1 %201, label %202, label %211

202:                                              ; preds = %197
  %203 = load ptr, ptr %9, align 8, !tbaa !5
  %204 = load i32, ptr %17, align 4, !tbaa !9
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds ptr, ptr %203, i64 %205
  %207 = load ptr, ptr %206, align 8, !tbaa !5
  call void @FerMem_Free(ptr noundef %207, ptr noundef @.str, i32 noundef 152)
  br label %208

208:                                              ; preds = %202
  %209 = load i32, ptr %17, align 4, !tbaa !9
  %210 = add nsw i32 %209, 1
  store i32 %210, ptr %17, align 4, !tbaa !9
  br label %197, !llvm.loop !16

211:                                              ; preds = %197
  %212 = load ptr, ptr %9, align 8, !tbaa !5
  call void @FerMem_Free(ptr noundef %212, ptr noundef @.str, i32 noundef 153)
  %213 = load ptr, ptr %15, align 8, !tbaa !5
  call void @FerMem_Free(ptr noundef %213, ptr noundef @.str, i32 noundef 154)
  %214 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 1, ptr %214, align 4, !tbaa !9
  store i32 1, ptr %22, align 4
  br label %266

215:                                              ; preds = %184
  %216 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %216, ptr %9, align 8, !tbaa !5
  %217 = load ptr, ptr %6, align 8, !tbaa !5
  %218 = load i32, ptr %217, align 4, !tbaa !9
  store i32 %218, ptr %17, align 4, !tbaa !9
  br label %219

219:                                              ; preds = %228, %215
  %220 = load i32, ptr %17, align 4, !tbaa !9
  %221 = load i32, ptr %20, align 4, !tbaa !9
  %222 = icmp slt i32 %220, %221
  br i1 %222, label %223, label %231

223:                                              ; preds = %219
  %224 = load ptr, ptr %9, align 8, !tbaa !5
  %225 = load i32, ptr %17, align 4, !tbaa !9
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds ptr, ptr %224, i64 %226
  store ptr null, ptr %227, align 8, !tbaa !5
  br label %228

228:                                              ; preds = %223
  %229 = load i32, ptr %17, align 4, !tbaa !9
  %230 = add nsw i32 %229, 1
  store i32 %230, ptr %17, align 4, !tbaa !9
  br label %219, !llvm.loop !17

231:                                              ; preds = %219
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %232

232:                                              ; preds = %231, %177
  %233 = load ptr, ptr %15, align 8, !tbaa !5
  %234 = load ptr, ptr %9, align 8, !tbaa !5
  %235 = load ptr, ptr %6, align 8, !tbaa !5
  %236 = load i32, ptr %235, align 4, !tbaa !9
  %237 = add nsw i32 %236, 1
  store i32 %237, ptr %235, align 4, !tbaa !9
  %238 = sext i32 %236 to i64
  %239 = getelementptr inbounds ptr, ptr %234, i64 %238
  store ptr %233, ptr %239, align 8, !tbaa !5
  %240 = load i32, ptr %16, align 4, !tbaa !9
  %241 = add nsw i32 %240, 1
  store i32 %241, ptr %16, align 4, !tbaa !9
  br label %48, !llvm.loop !18

242:                                              ; preds = %48
  %243 = load ptr, ptr %14, align 8, !tbaa !5
  %244 = call i32 @pclose(ptr noundef %243)
  br label %245

245:                                              ; preds = %242, %42
  %246 = load ptr, ptr %11, align 8, !tbaa !5
  call void @FerMem_Free(ptr noundef %246, ptr noundef @.str, i32 noundef 173)
  store ptr null, ptr %11, align 8, !tbaa !5
  %247 = load ptr, ptr %6, align 8, !tbaa !5
  %248 = load i32, ptr %247, align 4, !tbaa !9
  %249 = icmp eq i32 %248, 0
  br i1 %249, label %250, label %263

250:                                              ; preds = %245
  %251 = call ptr @FerMem_Malloc(i64 noundef 1, ptr noundef @.str, i32 noundef 179)
  store ptr %251, ptr %15, align 8, !tbaa !5
  %252 = load ptr, ptr %15, align 8, !tbaa !5
  %253 = icmp eq ptr %252, null
  br i1 %253, label %254, label %257

254:                                              ; preds = %250
  %255 = load ptr, ptr %9, align 8, !tbaa !5
  call void @FerMem_Free(ptr noundef %255, ptr noundef @.str, i32 noundef 181)
  %256 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 1, ptr %256, align 4, !tbaa !9
  store i32 1, ptr %22, align 4
  br label %266

257:                                              ; preds = %250
  %258 = load ptr, ptr %15, align 8, !tbaa !5
  store i8 0, ptr %258, align 1, !tbaa !11
  %259 = load ptr, ptr %15, align 8, !tbaa !5
  %260 = load ptr, ptr %9, align 8, !tbaa !5
  %261 = getelementptr inbounds ptr, ptr %260, i64 0
  store ptr %259, ptr %261, align 8, !tbaa !5
  %262 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 1, ptr %262, align 4, !tbaa !9
  br label %263

263:                                              ; preds = %257, %245
  %264 = load ptr, ptr %9, align 8, !tbaa !5
  %265 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %264, ptr %265, align 8, !tbaa !5
  store i32 1, ptr %22, align 4
  br label %266

266:                                              ; preds = %263, %254, %211, %174, %115, %39, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  ret void
}

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

declare ptr @FerMem_Malloc(i64 noundef, ptr noundef, i32 noundef) #2

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

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

declare noalias ptr @popen(ptr noundef, ptr noundef) #2

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #4

declare ptr @FerMem_Realloc(ptr noundef, i64 noundef, ptr noundef, i32 noundef) #2

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

declare i32 @pclose(ptr noundef) #2

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

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind willreturn 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = external hidden unnamed_addr constant [73 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @get_sys_cmnd_(ptr nocapture noundef writeonly %0, ptr nocapture noundef %1, ptr nocapture noundef readonly %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #0 {
  store i32 0, ptr %1, align 4, !tbaa !5
  store i32 0, ptr %3, align 4, !tbaa !5
  %5 = tail call ptr @FerMem_Malloc(i64 noundef 65536, ptr noundef nonnull @.str, i32 noundef 79) #6
  %6 = icmp eq ptr %5, null
  br i1 %6, label %7, label %8

7:                                                ; preds = %4
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %108

8:                                                ; preds = %4
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(65536) %5, i8 0, i64 65536, i1 false)
  %9 = tail call ptr @FerMem_Malloc(i64 noundef 8192, ptr noundef nonnull @.str, i32 noundef 86) #6
  %10 = icmp eq ptr %9, null
  br i1 %10, label %11, label %12

11:                                               ; preds = %8
  tail call void @FerMem_Free(ptr noundef nonnull %5, ptr noundef nonnull @.str, i32 noundef 88) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %108

12:                                               ; preds = %8
  %13 = tail call noalias ptr @popen(ptr noundef %2, ptr noundef nonnull @.str.1)
  %.not = icmp eq ptr %13, null
  br i1 %.not, label %99, label %.preheader144

.preheader144:                                    ; preds = %12
  %14 = tail call ptr @fgets(ptr noundef nonnull %9, i32 noundef 8192, ptr noundef nonnull %13)
  %.not130158 = icmp eq ptr %14, null
  br i1 %.not130158, label %._crit_edge, label %.lr.ph165

.lr.ph165:                                        ; preds = %.preheader144, %.loopexit
  %.0164 = phi i32 [ %.1, %.loopexit ], [ 8192, %.preheader144 ]
  %.099163 = phi i32 [ %.1100, %.loopexit ], [ 8192, %.preheader144 ]
  %.0109162 = phi i32 [ %96, %.loopexit ], [ 0, %.preheader144 ]
  %.0111161 = phi ptr [ %.1112, %.loopexit ], [ %5, %.preheader144 ]
  %.0114160 = phi i32 [ %.2116, %.loopexit ], [ 8192, %.preheader144 ]
  %.0117159 = phi ptr [ %.2119, %.loopexit ], [ %9, %.preheader144 ]
  %15 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %.0117159) #7
  %16 = trunc i64 %15 to i32
  %17 = shl i64 %15, 32
  %sext = add i64 %17, -4294967296
  %18 = ashr exact i64 %sext, 32
  %19 = getelementptr inbounds i8, ptr %.0117159, i64 %18
  %20 = load i8, ptr %19, align 1, !tbaa !9
  %.not142 = icmp eq i8 %20, 10
  %21 = add nsw i32 %.0114160, -2
  %.not131 = icmp slt i32 %21, %16
  %or.cond = select i1 %.not142, i1 true, i1 %.not131
  br i1 %or.cond, label %25, label %.thread

.thread:                                          ; preds = %.lr.ph165
  %22 = add nsw i32 %16, 1
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds i8, ptr %.0117159, i64 %23
  store i8 10, ptr %24, align 1, !tbaa !9
  br label %.thread138

25:                                               ; preds = %.lr.ph165
  br i1 %.not142, label %.thread138, label %.preheader.preheader

.preheader.preheader:                             ; preds = %25
  %26 = sext i32 %.0114160 to i64
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %41
  %indvars.iv = phi i64 [ %26, %.preheader.preheader ], [ %indvars.iv.next, %41 ]
  %.1118 = phi ptr [ %.0117159, %.preheader.preheader ], [ %27, %41 ]
  %.1104 = phi i32 [ %16, %.preheader.preheader ], [ %43, %41 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, 8192
  %27 = tail call ptr @FerMem_Realloc(ptr noundef nonnull %.1118, i64 noundef %indvars.iv.next, ptr noundef nonnull @.str, i32 noundef 112) #6
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %37

29:                                               ; preds = %.preheader
  tail call void @FerMem_Free(ptr noundef nonnull %.1118, ptr noundef nonnull @.str, i32 noundef 114) #6
  %30 = load i32, ptr %1, align 4, !tbaa !5
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.lr.ph169, label %._crit_edge170

.lr.ph169:                                        ; preds = %29, %.lr.ph169
  %indvars.iv194 = phi i64 [ %indvars.iv.next195, %.lr.ph169 ], [ 0, %29 ]
  %32 = getelementptr inbounds ptr, ptr %.0111161, i64 %indvars.iv194
  %33 = load ptr, ptr %32, align 8, !tbaa !10
  tail call void @FerMem_Free(ptr noundef %33, ptr noundef nonnull @.str, i32 noundef 116) #6
  %indvars.iv.next195 = add nuw nsw i64 %indvars.iv194, 1
  %34 = load i32, ptr %1, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = icmp slt i64 %indvars.iv.next195, %35
  br i1 %36, label %.lr.ph169, label %._crit_edge170, !llvm.loop !12

._crit_edge170:                                   ; preds = %.lr.ph169, %29
  tail call void @FerMem_Free(ptr noundef %.0111161, ptr noundef nonnull @.str, i32 noundef 117) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %108

37:                                               ; preds = %.preheader
  %38 = sext i32 %.1104 to i64
  %39 = getelementptr inbounds i8, ptr %27, i64 %38
  %40 = tail call ptr @fgets(ptr noundef nonnull %39, i32 noundef 8192, ptr noundef nonnull %13)
  %.not132 = icmp eq ptr %40, null
  br i1 %.not132, label %.thread138.loopexit, label %41

41:                                               ; preds = %37
  %42 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %27) #7
  %43 = trunc i64 %42 to i32
  %44 = shl i64 %42, 32
  %sext133 = add i64 %44, -4294967296
  %45 = ashr exact i64 %sext133, 32
  %46 = getelementptr inbounds i8, ptr %27, i64 %45
  %47 = load i8, ptr %46, align 1, !tbaa !9
  %.not143 = icmp eq i8 %47, 10
  br i1 %.not143, label %.thread138.loopexit, label %.preheader

.thread138.loopexit:                              ; preds = %41, %37
  %.3.ph = phi i32 [ %43, %41 ], [ %.1104, %37 ]
  %48 = trunc nsw i64 %indvars.iv.next to i32
  br label %.thread138

.thread138:                                       ; preds = %.thread138.loopexit, %.thread, %25
  %.2119 = phi ptr [ %.0117159, %25 ], [ %.0117159, %.thread ], [ %27, %.thread138.loopexit ]
  %.2116 = phi i32 [ %.0114160, %25 ], [ %.0114160, %.thread ], [ %48, %.thread138.loopexit ]
  %.3 = phi i32 [ %16, %25 ], [ %22, %.thread ], [ %.3.ph, %.thread138.loopexit ]
  %49 = add nsw i32 %.3, -1
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i8, ptr %.2119, i64 %50
  store i8 0, ptr %51, align 1, !tbaa !9
  %52 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %.2119) #7
  %53 = shl i64 %52, 32
  %sext134 = add i64 %53, 4294967296
  %54 = ashr exact i64 %sext134, 32
  %55 = tail call ptr @FerMem_Malloc(i64 noundef %54, ptr noundef nonnull @.str, i32 noundef 134) #6
  %56 = icmp eq ptr %55, null
  br i1 %56, label %57, label %65

57:                                               ; preds = %.thread138
  tail call void @FerMem_Free(ptr noundef nonnull %.2119, ptr noundef nonnull @.str, i32 noundef 136) #6
  %58 = load i32, ptr %1, align 4, !tbaa !5
  %59 = icmp sgt i32 %58, 0
  br i1 %59, label %.lr.ph177, label %._crit_edge178

.lr.ph177:                                        ; preds = %57, %.lr.ph177
  %indvars.iv200 = phi i64 [ %indvars.iv.next201, %.lr.ph177 ], [ 0, %57 ]
  %60 = getelementptr inbounds ptr, ptr %.0111161, i64 %indvars.iv200
  %61 = load ptr, ptr %60, align 8, !tbaa !10
  tail call void @FerMem_Free(ptr noundef %61, ptr noundef nonnull @.str, i32 noundef 138) #6
  %indvars.iv.next201 = add nuw nsw i64 %indvars.iv200, 1
  %62 = load i32, ptr %1, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = icmp slt i64 %indvars.iv.next201, %63
  br i1 %64, label %.lr.ph177, label %._crit_edge178, !llvm.loop !14

._crit_edge178:                                   ; preds = %.lr.ph177, %57
  tail call void @FerMem_Free(ptr noundef %.0111161, ptr noundef nonnull @.str, i32 noundef 139) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %108

65:                                               ; preds = %.thread138
  %66 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %55, ptr noundef nonnull dereferenceable(1) %.2119) #6
  %67 = icmp eq i32 %.0109162, %.0164
  br i1 %67, label %68, label %..loopexit_crit_edge

..loopexit_crit_edge:                             ; preds = %65
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %.loopexit

68:                                               ; preds = %65
  %69 = shl nsw i32 %.099163, 1
  %70 = sext i32 %69 to i64
  %71 = shl nsw i64 %70, 3
  %72 = tail call ptr @FerMem_Realloc(ptr noundef %.0111161, i64 noundef %71, ptr noundef nonnull @.str, i32 noundef 148) #6
  %73 = icmp eq ptr %72, null
  br i1 %73, label %74, label %82

74:                                               ; preds = %68
  tail call void @FerMem_Free(ptr noundef nonnull %.2119, ptr noundef nonnull @.str, i32 noundef 150) #6
  %75 = load i32, ptr %1, align 4, !tbaa !5
  %76 = icmp sgt i32 %75, 0
  br i1 %76, label %.lr.ph173, label %._crit_edge174

.lr.ph173:                                        ; preds = %74, %.lr.ph173
  %indvars.iv197 = phi i64 [ %indvars.iv.next198, %.lr.ph173 ], [ 0, %74 ]
  %77 = getelementptr inbounds ptr, ptr %.0111161, i64 %indvars.iv197
  %78 = load ptr, ptr %77, align 8, !tbaa !10
  tail call void @FerMem_Free(ptr noundef %78, ptr noundef nonnull @.str, i32 noundef 152) #6
  %indvars.iv.next198 = add nuw nsw i64 %indvars.iv197, 1
  %79 = load i32, ptr %1, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = icmp slt i64 %indvars.iv.next198, %80
  br i1 %81, label %.lr.ph173, label %._crit_edge174, !llvm.loop !15

._crit_edge174:                                   ; preds = %.lr.ph173, %74
  tail call void @FerMem_Free(ptr noundef %.0111161, ptr noundef nonnull @.str, i32 noundef 153) #6
  tail call void @FerMem_Free(ptr noundef nonnull %55, ptr noundef nonnull @.str, i32 noundef 154) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %108

82:                                               ; preds = %68
  %83 = load i32, ptr %1, align 4, !tbaa !5
  %84 = icmp slt i32 %83, %69
  br i1 %84, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %82
  %85 = sext i32 %83 to i64
  %86 = shl nsw i64 %85, 3
  %scevgep = getelementptr i8, ptr %72, i64 %86
  %87 = xor i32 %83, -1
  %88 = add i32 %69, %87
  %89 = zext i32 %88 to i64
  %90 = shl nuw nsw i64 %89, 3
  %91 = add nuw nsw i64 %90, 8
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(1) %scevgep, i8 0, i64 %91, i1 false), !tbaa !10
  br label %.loopexit

.loopexit:                                        ; preds = %..loopexit_crit_edge, %.lr.ph.preheader, %82
  %92 = phi i32 [ %.pre, %..loopexit_crit_edge ], [ %83, %82 ], [ %83, %.lr.ph.preheader ]
  %.1112 = phi ptr [ %.0111161, %..loopexit_crit_edge ], [ %72, %82 ], [ %72, %.lr.ph.preheader ]
  %.1110 = phi i32 [ %.0109162, %..loopexit_crit_edge ], [ 0, %82 ], [ 0, %.lr.ph.preheader ]
  %.1100 = phi i32 [ %.099163, %..loopexit_crit_edge ], [ %69, %82 ], [ %69, %.lr.ph.preheader ]
  %.1 = phi i32 [ %.0164, %..loopexit_crit_edge ], [ %.099163, %82 ], [ %.099163, %.lr.ph.preheader ]
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %1, align 4, !tbaa !5
  %94 = sext i32 %92 to i64
  %95 = getelementptr inbounds ptr, ptr %.1112, i64 %94
  store ptr %55, ptr %95, align 8, !tbaa !10
  %96 = add nsw i32 %.1110, 1
  %97 = tail call ptr @fgets(ptr noundef nonnull %.2119, i32 noundef %.2116, ptr noundef nonnull %13)
  %.not130 = icmp eq ptr %97, null
  br i1 %.not130, label %._crit_edge, label %.lr.ph165, !llvm.loop !16

._crit_edge:                                      ; preds = %.loopexit, %.preheader144
  %.0117.lcssa = phi ptr [ %9, %.preheader144 ], [ %.2119, %.loopexit ]
  %.0111.lcssa = phi ptr [ %5, %.preheader144 ], [ %.1112, %.loopexit ]
  %98 = tail call i32 @pclose(ptr noundef nonnull %13)
  br label %99

99:                                               ; preds = %._crit_edge, %12
  %.3120 = phi ptr [ %.0117.lcssa, %._crit_edge ], [ %9, %12 ]
  %.2113 = phi ptr [ %.0111.lcssa, %._crit_edge ], [ %5, %12 ]
  tail call void @FerMem_Free(ptr noundef nonnull %.3120, ptr noundef nonnull @.str, i32 noundef 173) #6
  %100 = load i32, ptr %1, align 4, !tbaa !5
  %101 = icmp eq i32 %100, 0
  br i1 %101, label %102, label %107

102:                                              ; preds = %99
  %103 = tail call ptr @FerMem_Malloc(i64 noundef 1, ptr noundef nonnull @.str, i32 noundef 179) #6
  %104 = icmp eq ptr %103, null
  br i1 %104, label %105, label %106

105:                                              ; preds = %102
  tail call void @FerMem_Free(ptr noundef nonnull %.2113, ptr noundef nonnull @.str, i32 noundef 181) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %108

106:                                              ; preds = %102
  store i8 0, ptr %103, align 1, !tbaa !9
  store ptr %103, ptr %.2113, align 8, !tbaa !10
  store i32 1, ptr %1, align 4, !tbaa !5
  br label %107

107:                                              ; preds = %106, %99
  store ptr %.2113, ptr %0, align 8, !tbaa !10
  br label %108

108:                                              ; preds = %107, %105, %._crit_edge174, %._crit_edge178, %._crit_edge170, %11, %7
  ret void
}

declare ptr @FerMem_Malloc(i64 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

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

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

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4

declare ptr @FerMem_Realloc(ptr noundef, i64 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; 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 #5

; Function Attrs: nofree nounwind
declare noundef i32 @pclose(ptr nocapture noundef) local_unnamed_addr #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 = { "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 nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { mustprogress nofree nounwind willreturn memory(argmem: 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

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


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