; LLVM IR from chdb-io/chdb :: base/readpassphrase (readpassphrase)

; 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.termios = type { i32, i32, i32, i32, i8, [32 x i8], i32, i32 }
%struct.sigaction = type { %union.anon, %struct.__sigset_t, i32, ptr }
%union.anon = type { ptr }
%struct.__sigset_t = type { [16 x i64] }

@signo = external hidden global [65 x i32], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @readpassphrase(ptr noundef %0, ptr noundef %1, i64 noundef %2, i32 noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i8, align 1
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca %struct.termios, align 4
  %20 = alloca %struct.termios, align 4
  %21 = alloca %struct.sigaction, align 8
  %22 = alloca %struct.sigaction, align 8
  %23 = alloca %struct.sigaction, align 8
  %24 = alloca %struct.sigaction, align 8
  %25 = alloca %struct.sigaction, align 8
  %26 = alloca %struct.sigaction, align 8
  %27 = alloca %struct.sigaction, align 8
  %28 = alloca %struct.sigaction, align 8
  %29 = alloca %struct.sigaction, align 8
  %30 = alloca %struct.sigaction, align 8
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca i32, align 4
  %34 = alloca i32, align 4
  %35 = alloca i32, align 4
  %36 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i64 %2, ptr %8, align 8, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.start.p0(i64 60, ptr %19) #8
  call void @llvm.lifetime.start.p0(i64 60, ptr %20) #8
  call void @llvm.lifetime.start.p0(i64 152, ptr %21) #8
  call void @llvm.lifetime.start.p0(i64 152, ptr %22) #8
  call void @llvm.lifetime.start.p0(i64 152, ptr %23) #8
  call void @llvm.lifetime.start.p0(i64 152, ptr %24) #8
  call void @llvm.lifetime.start.p0(i64 152, ptr %25) #8
  call void @llvm.lifetime.start.p0(i64 152, ptr %26) #8
  call void @llvm.lifetime.start.p0(i64 152, ptr %27) #8
  call void @llvm.lifetime.start.p0(i64 152, ptr %28) #8
  call void @llvm.lifetime.start.p0(i64 152, ptr %29) #8
  call void @llvm.lifetime.start.p0(i64 152, ptr %30) #8
  %37 = load i64, ptr %8, align 8, !tbaa !9
  %38 = icmp eq i64 %37, 0
  br i1 %38, label %39, label %41

39:                                               ; preds = %4
  %40 = call ptr @__errno_location() #9
  store i32 22, ptr %40, align 4, !tbaa !11
  store ptr null, ptr %5, align 8
  store i32 1, ptr %31, align 4
  br label %282

41:                                               ; preds = %4
  br label %42

42:                                               ; preds = %267, %41
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %43

43:                                               ; preds = %50, %42
  %44 = load i32, ptr %14, align 4, !tbaa !11
  %45 = icmp slt i32 %44, 65
  br i1 %45, label %46, label %53

46:                                               ; preds = %43
  %47 = load i32, ptr %14, align 4, !tbaa !11
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [65 x i32], ptr @signo, i64 0, i64 %48
  store volatile i32 0, ptr %49, align 4, !tbaa !11
  br label %50

50:                                               ; preds = %46
  %51 = load i32, ptr %14, align 4, !tbaa !11
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %14, align 4, !tbaa !11
  br label %43, !llvm.loop !13

53:                                               ; preds = %43
  store i64 -1, ptr %10, align 8, !tbaa !9
  store i32 0, ptr %13, align 4, !tbaa !11
  store i32 0, ptr %15, align 4, !tbaa !11
  %54 = load i32, ptr %9, align 4, !tbaa !11
  %55 = and i32 %54, 32
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %60, label %57

57:                                               ; preds = %53
  %58 = call i32 (ptr, i32, ...) @open(ptr noundef @.str, i32 noundef 2)
  store i32 %58, ptr %12, align 4, !tbaa !11
  store i32 %58, ptr %11, align 4, !tbaa !11
  %59 = icmp eq i32 %58, -1
  br i1 %59, label %60, label %67

60:                                               ; preds = %57, %53
  %61 = load i32, ptr %9, align 4, !tbaa !11
  %62 = and i32 %61, 2
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %64, label %66

64:                                               ; preds = %60
  %65 = call ptr @__errno_location() #9
  store i32 25, ptr %65, align 4, !tbaa !11
  store ptr null, ptr %5, align 8
  store i32 1, ptr %31, align 4
  br label %282

66:                                               ; preds = %60
  store i32 0, ptr %11, align 4, !tbaa !11
  store i32 2, ptr %12, align 4, !tbaa !11
  br label %67

67:                                               ; preds = %66, %57
  %68 = load i32, ptr %11, align 4, !tbaa !11
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %70, label %85

70:                                               ; preds = %67
  %71 = load i32, ptr %11, align 4, !tbaa !11
  %72 = call i32 @tcgetattr(i32 noundef %71, ptr noundef %20) #8
  %73 = icmp eq i32 %72, 0
  br i1 %73, label %74, label %85

74:                                               ; preds = %70
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %20, i64 60, i1 false)
  %75 = load i32, ptr %9, align 4, !tbaa !11
  %76 = and i32 %75, 1
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %82, label %78

78:                                               ; preds = %74
  %79 = getelementptr inbounds %struct.termios, ptr %19, i32 0, i32 3
  %80 = load i32, ptr %79, align 4, !tbaa !15
  %81 = and i32 %80, -73
  store i32 %81, ptr %79, align 4, !tbaa !15
  br label %82

82:                                               ; preds = %78, %74
  %83 = load i32, ptr %11, align 4, !tbaa !11
  %84 = call i32 @tcsetattr(i32 noundef %83, i32 noundef 2, ptr noundef %19) #8
  br label %92

85:                                               ; preds = %70, %67
  call void @llvm.memset.p0.i64(ptr align 4 %19, i8 0, i64 60, i1 false)
  %86 = getelementptr inbounds %struct.termios, ptr %19, i32 0, i32 3
  %87 = load i32, ptr %86, align 4, !tbaa !15
  %88 = or i32 %87, 8
  store i32 %88, ptr %86, align 4, !tbaa !15
  call void @llvm.memset.p0.i64(ptr align 4 %20, i8 0, i64 60, i1 false)
  %89 = getelementptr inbounds %struct.termios, ptr %20, i32 0, i32 3
  %90 = load i32, ptr %89, align 4, !tbaa !15
  %91 = or i32 %90, 8
  store i32 %91, ptr %89, align 4, !tbaa !15
  br label %92

92:                                               ; preds = %85, %82
  %93 = getelementptr inbounds %struct.sigaction, ptr %21, i32 0, i32 1
  %94 = call i32 @sigemptyset(ptr noundef %93) #8
  %95 = getelementptr inbounds %struct.sigaction, ptr %21, i32 0, i32 2
  store i32 0, ptr %95, align 8, !tbaa !17
  %96 = getelementptr inbounds %struct.sigaction, ptr %21, i32 0, i32 0
  store ptr @handler, ptr %96, align 8, !tbaa !20
  %97 = call i32 @sigaction(i32 noundef 14, ptr noundef %21, ptr noundef %22) #8
  %98 = call i32 @sigaction(i32 noundef 1, ptr noundef %21, ptr noundef %24) #8
  %99 = call i32 @sigaction(i32 noundef 2, ptr noundef %21, ptr noundef %23) #8
  %100 = call i32 @sigaction(i32 noundef 13, ptr noundef %21, ptr noundef %30) #8
  %101 = call i32 @sigaction(i32 noundef 3, ptr noundef %21, ptr noundef %25) #8
  %102 = call i32 @sigaction(i32 noundef 15, ptr noundef %21, ptr noundef %26) #8
  %103 = call i32 @sigaction(i32 noundef 20, ptr noundef %21, ptr noundef %27) #8
  %104 = call i32 @sigaction(i32 noundef 21, ptr noundef %21, ptr noundef %28) #8
  %105 = call i32 @sigaction(i32 noundef 22, ptr noundef %21, ptr noundef %29) #8
  %106 = load i32, ptr %9, align 4, !tbaa !11
  %107 = and i32 %106, 32
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %115, label %109

109:                                              ; preds = %92
  %110 = load i32, ptr %12, align 4, !tbaa !11
  %111 = load ptr, ptr %6, align 8, !tbaa !5
  %112 = load ptr, ptr %6, align 8, !tbaa !5
  %113 = call i64 @strlen(ptr noundef %112) #10
  %114 = call i64 @write(i32 noundef %110, ptr noundef %111, i64 noundef %113)
  br label %115

115:                                              ; preds = %109, %92
  %116 = load ptr, ptr %7, align 8, !tbaa !5
  %117 = load i64, ptr %8, align 8, !tbaa !9
  %118 = getelementptr inbounds i8, ptr %116, i64 %117
  %119 = getelementptr inbounds i8, ptr %118, i64 -1
  store ptr %119, ptr %18, align 8, !tbaa !5
  %120 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %120, ptr %17, align 8, !tbaa !5
  br label %121

121:                                              ; preds = %194, %115
  %122 = load i32, ptr %11, align 4, !tbaa !11
  %123 = call i64 @read(i32 noundef %122, ptr noundef %16, i64 noundef 1)
  store i64 %123, ptr %10, align 8, !tbaa !9
  %124 = icmp eq i64 %123, 1
  br i1 %124, label %125, label %133

125:                                              ; preds = %121
  %126 = load i8, ptr %16, align 1, !tbaa !20
  %127 = sext i8 %126 to i32
  %128 = icmp ne i32 %127, 10
  br i1 %128, label %129, label %133

129:                                              ; preds = %125
  %130 = load i8, ptr %16, align 1, !tbaa !20
  %131 = sext i8 %130 to i32
  %132 = icmp ne i32 %131, 13
  br label %133

133:                                              ; preds = %129, %125, %121
  %134 = phi i1 [ false, %125 ], [ false, %121 ], [ %132, %129 ]
  br i1 %134, label %135, label %195

135:                                              ; preds = %133
  %136 = load ptr, ptr %17, align 8, !tbaa !5
  %137 = load ptr, ptr %18, align 8, !tbaa !5
  %138 = icmp ult ptr %136, %137
  br i1 %138, label %139, label %194

139:                                              ; preds = %135
  %140 = load i32, ptr %9, align 4, !tbaa !11
  %141 = and i32 %140, 16
  %142 = icmp ne i32 %141, 0
  br i1 %142, label %143, label %148

143:                                              ; preds = %139
  %144 = load i8, ptr %16, align 1, !tbaa !20
  %145 = sext i8 %144 to i32
  %146 = and i32 %145, 127
  %147 = trunc i32 %146 to i8
  store i8 %147, ptr %16, align 1, !tbaa !20
  br label %148

148:                                              ; preds = %143, %139
  %149 = call ptr @__ctype_b_loc() #9
  %150 = load ptr, ptr %149, align 8, !tbaa !5
  %151 = load i8, ptr %16, align 1, !tbaa !20
  %152 = zext i8 %151 to i32
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds i16, ptr %150, i64 %153
  %155 = load i16, ptr %154, align 2, !tbaa !21
  %156 = zext i16 %155 to i32
  %157 = and i32 %156, 1024
  %158 = icmp ne i32 %157, 0
  br i1 %158, label %159, label %190

159:                                              ; preds = %148
  %160 = load i32, ptr %9, align 4, !tbaa !11
  %161 = and i32 %160, 4
  %162 = icmp ne i32 %161, 0
  br i1 %162, label %163, label %174

163:                                              ; preds = %159
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #8
  %164 = call ptr @__ctype_tolower_loc() #9
  %165 = load ptr, ptr %164, align 8, !tbaa !5
  %166 = load i8, ptr %16, align 1, !tbaa !20
  %167 = zext i8 %166 to i32
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds i32, ptr %165, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !11
  store i32 %170, ptr %32, align 4, !tbaa !11
  %171 = load i32, ptr %32, align 4, !tbaa !11
  store i32 %171, ptr %33, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #8
  %172 = load i32, ptr %33, align 4, !tbaa !11
  %173 = trunc i32 %172 to i8
  store i8 %173, ptr %16, align 1, !tbaa !20
  br label %174

174:                                              ; preds = %163, %159
  %175 = load i32, ptr %9, align 4, !tbaa !11
  %176 = and i32 %175, 8
  %177 = icmp ne i32 %176, 0
  br i1 %177, label %178, label %189

178:                                              ; preds = %174
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #8
  %179 = call ptr @__ctype_toupper_loc() #9
  %180 = load ptr, ptr %179, align 8, !tbaa !5
  %181 = load i8, ptr %16, align 1, !tbaa !20
  %182 = zext i8 %181 to i32
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds i32, ptr %180, i64 %183
  %185 = load i32, ptr %184, align 4, !tbaa !11
  store i32 %185, ptr %34, align 4, !tbaa !11
  %186 = load i32, ptr %34, align 4, !tbaa !11
  store i32 %186, ptr %35, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #8
  %187 = load i32, ptr %35, align 4, !tbaa !11
  %188 = trunc i32 %187 to i8
  store i8 %188, ptr %16, align 1, !tbaa !20
  br label %189

189:                                              ; preds = %178, %174
  br label %190

190:                                              ; preds = %189, %148
  %191 = load i8, ptr %16, align 1, !tbaa !20
  %192 = load ptr, ptr %17, align 8, !tbaa !5
  %193 = getelementptr inbounds i8, ptr %192, i32 1
  store ptr %193, ptr %17, align 8, !tbaa !5
  store i8 %191, ptr %192, align 1, !tbaa !20
  br label %194

194:                                              ; preds = %190, %135
  br label %121, !llvm.loop !23

195:                                              ; preds = %133
  %196 = load ptr, ptr %17, align 8, !tbaa !5
  store i8 0, ptr %196, align 1, !tbaa !20
  %197 = call ptr @__errno_location() #9
  %198 = load i32, ptr %197, align 4, !tbaa !11
  store i32 %198, ptr %13, align 4, !tbaa !11
  %199 = getelementptr inbounds %struct.termios, ptr %19, i32 0, i32 3
  %200 = load i32, ptr %199, align 4, !tbaa !15
  %201 = and i32 %200, 8
  %202 = icmp ne i32 %201, 0
  br i1 %202, label %206, label %203

203:                                              ; preds = %195
  %204 = load i32, ptr %12, align 4, !tbaa !11
  %205 = call i64 @write(i32 noundef %204, ptr noundef @.str.1, i64 noundef 1)
  br label %206

206:                                              ; preds = %203, %195
  %207 = call i32 @memcmp(ptr noundef %19, ptr noundef %20, i64 noundef 60) #10
  %208 = icmp ne i32 %207, 0
  br i1 %208, label %209, label %228

209:                                              ; preds = %206
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #8
  %210 = load volatile i32, ptr getelementptr inbounds ([65 x i32], ptr @signo, i64 0, i64 22), align 8, !tbaa !11
  store i32 %210, ptr %36, align 4, !tbaa !11
  br label %211

211:                                              ; preds = %225, %209
  %212 = load i32, ptr %11, align 4, !tbaa !11
  %213 = call i32 @tcsetattr(i32 noundef %212, i32 noundef 2, ptr noundef %20) #8
  %214 = icmp eq i32 %213, -1
  br i1 %214, label %215, label %223

215:                                              ; preds = %211
  %216 = call ptr @__errno_location() #9
  %217 = load i32, ptr %216, align 4, !tbaa !11
  %218 = icmp eq i32 %217, 4
  br i1 %218, label %219, label %223

219:                                              ; preds = %215
  %220 = load volatile i32, ptr getelementptr inbounds ([65 x i32], ptr @signo, i64 0, i64 22), align 8, !tbaa !11
  %221 = icmp ne i32 %220, 0
  %222 = xor i1 %221, true
  br label %223

223:                                              ; preds = %219, %215, %211
  %224 = phi i1 [ false, %215 ], [ false, %211 ], [ %222, %219 ]
  br i1 %224, label %225, label %226

225:                                              ; preds = %223
  br label %211, !llvm.loop !24

226:                                              ; preds = %223
  %227 = load i32, ptr %36, align 4, !tbaa !11
  store volatile i32 %227, ptr getelementptr inbounds ([65 x i32], ptr @signo, i64 0, i64 22), align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #8
  br label %228

228:                                              ; preds = %226, %206
  %229 = call i32 @sigaction(i32 noundef 14, ptr noundef %22, ptr noundef null) #8
  %230 = call i32 @sigaction(i32 noundef 1, ptr noundef %24, ptr noundef null) #8
  %231 = call i32 @sigaction(i32 noundef 2, ptr noundef %23, ptr noundef null) #8
  %232 = call i32 @sigaction(i32 noundef 3, ptr noundef %25, ptr noundef null) #8
  %233 = call i32 @sigaction(i32 noundef 13, ptr noundef %30, ptr noundef null) #8
  %234 = call i32 @sigaction(i32 noundef 15, ptr noundef %26, ptr noundef null) #8
  %235 = call i32 @sigaction(i32 noundef 20, ptr noundef %27, ptr noundef null) #8
  %236 = call i32 @sigaction(i32 noundef 21, ptr noundef %28, ptr noundef null) #8
  %237 = call i32 @sigaction(i32 noundef 22, ptr noundef %29, ptr noundef null) #8
  %238 = load i32, ptr %11, align 4, !tbaa !11
  %239 = icmp ne i32 %238, 0
  br i1 %239, label %240, label %243

240:                                              ; preds = %228
  %241 = load i32, ptr %11, align 4, !tbaa !11
  %242 = call i32 @close(i32 noundef %241)
  br label %243

243:                                              ; preds = %240, %228
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %244

244:                                              ; preds = %261, %243
  %245 = load i32, ptr %14, align 4, !tbaa !11
  %246 = icmp slt i32 %245, 65
  br i1 %246, label %247, label %264

247:                                              ; preds = %244
  %248 = load i32, ptr %14, align 4, !tbaa !11
  %249 = sext i32 %248 to i64
  %250 = getelementptr inbounds [65 x i32], ptr @signo, i64 0, i64 %249
  %251 = load volatile i32, ptr %250, align 4, !tbaa !11
  %252 = icmp ne i32 %251, 0
  br i1 %252, label %253, label %260

253:                                              ; preds = %247
  %254 = call i32 @getpid() #8
  %255 = load i32, ptr %14, align 4, !tbaa !11
  %256 = call i32 @kill(i32 noundef %254, i32 noundef %255) #8
  %257 = load i32, ptr %14, align 4, !tbaa !11
  switch i32 %257, label %259 [
    i32 20, label %258
    i32 21, label %258
    i32 22, label %258
  ]

258:                                              ; preds = %253, %253, %253
  store i32 1, ptr %15, align 4, !tbaa !11
  br label %259

259:                                              ; preds = %258, %253
  br label %260

260:                                              ; preds = %259, %247
  br label %261

261:                                              ; preds = %260
  %262 = load i32, ptr %14, align 4, !tbaa !11
  %263 = add nsw i32 %262, 1
  store i32 %263, ptr %14, align 4, !tbaa !11
  br label %244, !llvm.loop !25

264:                                              ; preds = %244
  %265 = load i32, ptr %15, align 4, !tbaa !11
  %266 = icmp ne i32 %265, 0
  br i1 %266, label %267, label %268

267:                                              ; preds = %264
  br label %42

268:                                              ; preds = %264
  %269 = load i32, ptr %13, align 4, !tbaa !11
  %270 = icmp ne i32 %269, 0
  br i1 %270, label %271, label %274

271:                                              ; preds = %268
  %272 = load i32, ptr %13, align 4, !tbaa !11
  %273 = call ptr @__errno_location() #9
  store i32 %272, ptr %273, align 4, !tbaa !11
  br label %274

274:                                              ; preds = %271, %268
  %275 = load i64, ptr %10, align 8, !tbaa !9
  %276 = icmp eq i64 %275, -1
  br i1 %276, label %277, label %278

277:                                              ; preds = %274
  br label %280

278:                                              ; preds = %274
  %279 = load ptr, ptr %7, align 8, !tbaa !5
  br label %280

280:                                              ; preds = %278, %277
  %281 = phi ptr [ null, %277 ], [ %279, %278 ]
  store ptr %281, ptr %5, align 8
  store i32 1, ptr %31, align 4
  br label %282

282:                                              ; preds = %280, %64, %39
  call void @llvm.lifetime.end.p0(i64 152, ptr %30) #8
  call void @llvm.lifetime.end.p0(i64 152, ptr %29) #8
  call void @llvm.lifetime.end.p0(i64 152, ptr %28) #8
  call void @llvm.lifetime.end.p0(i64 152, ptr %27) #8
  call void @llvm.lifetime.end.p0(i64 152, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 152, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 152, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 152, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 152, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 152, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 60, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 60, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  %283 = load ptr, ptr %5, align 8
  ret ptr %283
}

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #2

declare i32 @open(ptr noundef, i32 noundef, ...) #3

; Function Attrs: nounwind
declare i32 @tcgetattr(i32 noundef, ptr noundef) #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: nounwind
declare i32 @tcsetattr(i32 noundef, i32 noundef, ptr noundef) #4

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

; Function Attrs: nounwind
declare i32 @sigemptyset(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare hidden void @handler(i32 noundef) #0

; Function Attrs: nounwind
declare i32 @sigaction(i32 noundef, ptr noundef, ptr noundef) #4

declare i64 @write(i32 noundef, ptr noundef, i64 noundef) #3

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

declare i64 @read(i32 noundef, ptr noundef, i64 noundef) #3

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() #2

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_tolower_loc() #2

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_toupper_loc() #2

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #7

declare i32 @close(i32 noundef) #3

; Function Attrs: nounwind
declare i32 @kill(i32 noundef, i32 noundef) #4

; Function Attrs: nounwind
declare i32 @getpid() #4

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 willreturn memory(none) "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 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(none) }
attributes #10 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !12, i64 12}
!16 = !{!"termios", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !7, i64 16, !7, i64 17, !12, i64 52, !12, i64 56}
!17 = !{!18, !12, i64 136}
!18 = !{!"sigaction", !7, i64 0, !19, i64 8, !12, i64 136, !6, i64 144}
!19 = !{!"", !7, i64 0}
!20 = !{!7, !7, i64 0}
!21 = !{!22, !22, i64 0}
!22 = !{!"short", !7, i64 0}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !14}
!25 = distinct !{!25, !14}


; 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.termios = type { i32, i32, i32, i32, i8, [32 x i8], i32, i32 }
%struct.sigaction = type { %union.anon, %struct.__sigset_t, i32, ptr }
%union.anon = type { ptr }
%struct.__sigset_t = type { [16 x i64] }

@signo = external hidden global [65 x i32], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @readpassphrase(ptr nocapture noundef readonly %0, ptr noundef writeonly %1, i64 noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = alloca i8, align 1
  %6 = alloca %struct.termios, align 4
  %7 = alloca %struct.termios, align 4
  %8 = alloca %struct.sigaction, align 8
  %9 = alloca %struct.sigaction, align 8
  %10 = alloca %struct.sigaction, align 8
  %11 = alloca %struct.sigaction, align 8
  %12 = alloca %struct.sigaction, align 8
  %13 = alloca %struct.sigaction, align 8
  %14 = alloca %struct.sigaction, align 8
  %15 = alloca %struct.sigaction, align 8
  %16 = alloca %struct.sigaction, align 8
  %17 = alloca %struct.sigaction, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #10
  call void @llvm.lifetime.start.p0(i64 60, ptr nonnull %6) #10
  call void @llvm.lifetime.start.p0(i64 60, ptr nonnull %7) #10
  call void @llvm.lifetime.start.p0(i64 152, ptr nonnull %8) #10
  call void @llvm.lifetime.start.p0(i64 152, ptr nonnull %9) #10
  call void @llvm.lifetime.start.p0(i64 152, ptr nonnull %10) #10
  call void @llvm.lifetime.start.p0(i64 152, ptr nonnull %11) #10
  call void @llvm.lifetime.start.p0(i64 152, ptr nonnull %12) #10
  call void @llvm.lifetime.start.p0(i64 152, ptr nonnull %13) #10
  call void @llvm.lifetime.start.p0(i64 152, ptr nonnull %14) #10
  call void @llvm.lifetime.start.p0(i64 152, ptr nonnull %15) #10
  call void @llvm.lifetime.start.p0(i64 152, ptr nonnull %16) #10
  call void @llvm.lifetime.start.p0(i64 152, ptr nonnull %17) #10
  %18 = icmp eq i64 %2, 0
  br i1 %18, label %31, label %.preheader

.preheader:                                       ; preds = %4
  %19 = and i32 %3, 32
  %.not = icmp eq i32 %19, 0
  %20 = and i32 %3, 2
  %.not61 = icmp eq i32 %20, 0
  %21 = getelementptr inbounds i8, ptr %6, i64 12
  %22 = getelementptr inbounds i8, ptr %7, i64 12
  %23 = and i32 %3, 1
  %.not63 = icmp eq i32 %23, 0
  %24 = getelementptr inbounds i8, ptr %8, i64 8
  %25 = getelementptr inbounds i8, ptr %8, i64 136
  %26 = getelementptr inbounds i8, ptr %1, i64 %2
  %27 = getelementptr inbounds i8, ptr %26, i64 -1
  %28 = and i32 %3, 16
  %.not70 = icmp eq i32 %28, 0
  %29 = and i32 %3, 4
  %.not72 = icmp eq i32 %29, 0
  %30 = and i32 %3, 8
  %.not73 = icmp eq i32 %30, 0
  br label %33

31:                                               ; preds = %4
  %32 = tail call ptr @__errno_location() #11
  store i32 22, ptr %32, align 4, !tbaa !5
  br label %146

33:                                               ; preds = %.preheader, %140
  store volatile i32 0, ptr @signo, align 16, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 4), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 8), align 8, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 12), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 16), align 16, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 20), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 24), align 8, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 28), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 32), align 16, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 36), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 40), align 8, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 44), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 48), align 16, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 52), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 56), align 8, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 60), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 64), align 16, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 68), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 72), align 8, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 76), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 80), align 16, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 84), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 88), align 8, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 92), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 96), align 16, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 100), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 104), align 8, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 108), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 112), align 16, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 116), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 120), align 8, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 124), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 128), align 16, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 132), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 136), align 8, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 140), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 144), align 16, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 148), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 152), align 8, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 156), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 160), align 16, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 164), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 168), align 8, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 172), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 176), align 16, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 180), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 184), align 8, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 188), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 192), align 16, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 196), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 200), align 8, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 204), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 208), align 16, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 212), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 216), align 8, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 220), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 224), align 16, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 228), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 232), align 8, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 236), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 240), align 16, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 244), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 248), align 8, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 252), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @signo, i64 256), align 16, !tbaa !5
  br i1 %.not, label %34, label %36

34:                                               ; preds = %33
  %35 = call i32 (ptr, i32, ...) @open(ptr noundef nonnull @.str, i32 noundef 2) #10
  switch i32 %35, label %39 [
    i32 -1, label %36
    i32 0, label %.thread
  ]

36:                                               ; preds = %34, %33
  br i1 %.not61, label %.thread, label %37

37:                                               ; preds = %36
  %38 = tail call ptr @__errno_location() #11
  store i32 25, ptr %38, align 4, !tbaa !5
  br label %146

39:                                               ; preds = %34
  %40 = call i32 @tcgetattr(i32 noundef %35, ptr noundef nonnull %7) #10
  %41 = icmp eq i32 %40, 0
  br i1 %41, label %42, label %.thread

42:                                               ; preds = %39
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(60) %6, ptr noundef nonnull align 4 dereferenceable(60) %7, i64 60, i1 false)
  br i1 %.not63, label %43, label %46

43:                                               ; preds = %42
  %44 = load i32, ptr %21, align 4, !tbaa !9
  %45 = and i32 %44, -73
  store i32 %45, ptr %21, align 4, !tbaa !9
  br label %46

46:                                               ; preds = %43, %42
  %47 = call i32 @tcsetattr(i32 noundef %35, i32 noundef 2, ptr noundef nonnull %6) #10
  br label %48

.thread:                                          ; preds = %34, %36, %39
  %.not6283 = phi i1 [ false, %39 ], [ true, %36 ], [ true, %34 ]
  %.05180 = phi i32 [ %35, %39 ], [ 0, %36 ], [ %35, %34 ]
  %.05278 = phi i32 [ %35, %39 ], [ 2, %36 ], [ %35, %34 ]
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(60) %6, i8 0, i64 60, i1 false)
  store i32 8, ptr %21, align 4, !tbaa !9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(60) %7, i8 0, i64 60, i1 false)
  store i32 8, ptr %22, align 4, !tbaa !9
  br label %48

48:                                               ; preds = %.thread, %46
  %.not6282 = phi i1 [ %.not6283, %.thread ], [ false, %46 ]
  %.05179 = phi i32 [ %.05180, %.thread ], [ %35, %46 ]
  %.05277 = phi i32 [ %.05278, %.thread ], [ %35, %46 ]
  %49 = call i32 @sigemptyset(ptr noundef nonnull %24) #10
  store i32 0, ptr %25, align 8, !tbaa !11
  store ptr @handler, ptr %8, align 8, !tbaa !15
  %50 = call i32 @sigaction(i32 noundef 14, ptr noundef nonnull %8, ptr noundef nonnull %9) #10
  %51 = call i32 @sigaction(i32 noundef 1, ptr noundef nonnull %8, ptr noundef nonnull %11) #10
  %52 = call i32 @sigaction(i32 noundef 2, ptr noundef nonnull %8, ptr noundef nonnull %10) #10
  %53 = call i32 @sigaction(i32 noundef 13, ptr noundef nonnull %8, ptr noundef nonnull %17) #10
  %54 = call i32 @sigaction(i32 noundef 3, ptr noundef nonnull %8, ptr noundef nonnull %12) #10
  %55 = call i32 @sigaction(i32 noundef 15, ptr noundef nonnull %8, ptr noundef nonnull %13) #10
  %56 = call i32 @sigaction(i32 noundef 20, ptr noundef nonnull %8, ptr noundef nonnull %14) #10
  %57 = call i32 @sigaction(i32 noundef 21, ptr noundef nonnull %8, ptr noundef nonnull %15) #10
  %58 = call i32 @sigaction(i32 noundef 22, ptr noundef nonnull %8, ptr noundef nonnull %16) #10
  br i1 %.not, label %59, label %62

59:                                               ; preds = %48
  %60 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #12
  %61 = call i64 @write(i32 noundef %.05277, ptr noundef %0, i64 noundef %60) #10
  br label %62

62:                                               ; preds = %59, %48
  %63 = call i64 @read(i32 noundef %.05179, ptr noundef nonnull %5, i64 noundef 1) #10
  %64 = icmp eq i64 %63, 1
  br i1 %64, label %switch.early.test, label %.critedge

switch.early.test:                                ; preds = %62, %98
  %.05487 = phi ptr [ %.155, %98 ], [ %1, %62 ]
  %65 = load i8, ptr %5, align 1
  switch i8 %65, label %66 [
    i8 13, label %.critedge
    i8 10, label %.critedge
  ]

66:                                               ; preds = %switch.early.test
  %67 = icmp ult ptr %.05487, %27
  br i1 %67, label %68, label %98

68:                                               ; preds = %66
  br i1 %.not70, label %71, label %69

69:                                               ; preds = %68
  %70 = and i8 %65, 127
  store i8 %70, ptr %5, align 1, !tbaa !15
  br label %71

71:                                               ; preds = %69, %68
  %72 = phi i8 [ %70, %69 ], [ %65, %68 ]
  %73 = tail call ptr @__ctype_b_loc() #11
  %74 = load ptr, ptr %73, align 8, !tbaa !16
  %75 = zext i8 %72 to i64
  %76 = getelementptr inbounds i16, ptr %74, i64 %75
  %77 = load i16, ptr %76, align 2, !tbaa !17
  %78 = and i16 %77, 1024
  %.not71 = icmp eq i16 %78, 0
  br i1 %.not71, label %95, label %79

79:                                               ; preds = %71
  br i1 %.not72, label %86, label %80

80:                                               ; preds = %79
  %81 = tail call ptr @__ctype_tolower_loc() #11
  %82 = load ptr, ptr %81, align 8, !tbaa !16
  %83 = getelementptr inbounds i32, ptr %82, i64 %75
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = trunc i32 %84 to i8
  store i8 %85, ptr %5, align 1, !tbaa !15
  br label %86

86:                                               ; preds = %80, %79
  %87 = phi i8 [ %85, %80 ], [ %72, %79 ]
  br i1 %.not73, label %95, label %88

88:                                               ; preds = %86
  %89 = tail call ptr @__ctype_toupper_loc() #11
  %90 = load ptr, ptr %89, align 8, !tbaa !16
  %91 = zext i8 %87 to i64
  %92 = getelementptr inbounds i32, ptr %90, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = trunc i32 %93 to i8
  store i8 %94, ptr %5, align 1, !tbaa !15
  br label %95

95:                                               ; preds = %86, %88, %71
  %96 = phi i8 [ %87, %86 ], [ %94, %88 ], [ %72, %71 ]
  %97 = getelementptr inbounds i8, ptr %.05487, i64 1
  store i8 %96, ptr %.05487, align 1, !tbaa !15
  br label %98

98:                                               ; preds = %95, %66
  %.155 = phi ptr [ %97, %95 ], [ %.05487, %66 ]
  %99 = call i64 @read(i32 noundef %.05179, ptr noundef nonnull %5, i64 noundef 1) #10
  %100 = icmp eq i64 %99, 1
  br i1 %100, label %switch.early.test, label %.critedge, !llvm.loop !19

.critedge:                                        ; preds = %98, %switch.early.test, %switch.early.test, %62
  %.054.lcssa = phi ptr [ %1, %62 ], [ %.05487, %switch.early.test ], [ %.05487, %switch.early.test ], [ %.155, %98 ]
  %.lcssa = phi i64 [ %63, %62 ], [ 1, %switch.early.test ], [ 1, %switch.early.test ], [ %99, %98 ]
  store i8 0, ptr %.054.lcssa, align 1, !tbaa !15
  %101 = tail call ptr @__errno_location() #11
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = load i32, ptr %21, align 4, !tbaa !9
  %104 = and i32 %103, 8
  %.not64 = icmp eq i32 %104, 0
  br i1 %.not64, label %105, label %107

105:                                              ; preds = %.critedge
  %106 = call i64 @write(i32 noundef %.05277, ptr noundef nonnull @.str.1, i64 noundef 1) #10
  br label %107

107:                                              ; preds = %105, %.critedge
  %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(60) %6, ptr noundef nonnull dereferenceable(60) %7, i64 60)
  %.not65 = icmp eq i32 %bcmp, 0
  br i1 %.not65, label %118, label %108

108:                                              ; preds = %107
  %109 = load volatile i32, ptr getelementptr inbounds (i8, ptr @signo, i64 88), align 8, !tbaa !5
  br label %110

110:                                              ; preds = %116, %108
  %111 = call i32 @tcsetattr(i32 noundef %.05179, i32 noundef 2, ptr noundef nonnull %7) #10
  %112 = icmp eq i32 %111, -1
  br i1 %112, label %113, label %.critedge4

113:                                              ; preds = %110
  %114 = load i32, ptr %101, align 4, !tbaa !5
  %115 = icmp eq i32 %114, 4
  br i1 %115, label %116, label %.critedge4

116:                                              ; preds = %113
  %117 = load volatile i32, ptr getelementptr inbounds (i8, ptr @signo, i64 88), align 8, !tbaa !5
  %.not66 = icmp eq i32 %117, 0
  br i1 %.not66, label %110, label %.critedge4, !llvm.loop !21

.critedge4:                                       ; preds = %113, %110, %116
  store volatile i32 %109, ptr getelementptr inbounds (i8, ptr @signo, i64 88), align 8, !tbaa !5
  br label %118

118:                                              ; preds = %.critedge4, %107
  %119 = call i32 @sigaction(i32 noundef 14, ptr noundef nonnull %9, ptr noundef null) #10
  %120 = call i32 @sigaction(i32 noundef 1, ptr noundef nonnull %11, ptr noundef null) #10
  %121 = call i32 @sigaction(i32 noundef 2, ptr noundef nonnull %10, ptr noundef null) #10
  %122 = call i32 @sigaction(i32 noundef 3, ptr noundef nonnull %12, ptr noundef null) #10
  %123 = call i32 @sigaction(i32 noundef 13, ptr noundef nonnull %17, ptr noundef null) #10
  %124 = call i32 @sigaction(i32 noundef 15, ptr noundef nonnull %13, ptr noundef null) #10
  %125 = call i32 @sigaction(i32 noundef 20, ptr noundef nonnull %14, ptr noundef null) #10
  %126 = call i32 @sigaction(i32 noundef 21, ptr noundef nonnull %15, ptr noundef null) #10
  %127 = call i32 @sigaction(i32 noundef 22, ptr noundef nonnull %16, ptr noundef null) #10
  br i1 %.not6282, label %.preheader105, label %128

128:                                              ; preds = %118
  %129 = call i32 @close(i32 noundef %.05179) #10
  br label %.preheader105

.preheader105:                                    ; preds = %128, %118
  br label %130

130:                                              ; preds = %.preheader105, %139
  %indvars.iv = phi i64 [ %indvars.iv.next, %139 ], [ 0, %.preheader105 ]
  %.05694 = phi i32 [ %.157, %139 ], [ 0, %.preheader105 ]
  %131 = getelementptr inbounds [65 x i32], ptr @signo, i64 0, i64 %indvars.iv
  %132 = load volatile i32, ptr %131, align 4, !tbaa !5
  %.not69 = icmp eq i32 %132, 0
  br i1 %.not69, label %139, label %133

133:                                              ; preds = %130
  %134 = call i32 @getpid() #10
  %135 = trunc nuw nsw i64 %indvars.iv to i32
  %136 = call i32 @kill(i32 noundef %134, i32 noundef %135) #10
  %137 = trunc i64 %indvars.iv to i32
  %138 = add i32 %137, -20
  %switch = icmp ult i32 %138, 3
  %spec.select = select i1 %switch, i32 1, i32 %.05694
  br label %139

139:                                              ; preds = %133, %130
  %.157 = phi i32 [ %.05694, %130 ], [ %spec.select, %133 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 65
  br i1 %exitcond.not, label %140, label %130, !llvm.loop !22

140:                                              ; preds = %139
  %.not67 = icmp eq i32 %.157, 0
  br i1 %.not67, label %141, label %33

141:                                              ; preds = %140
  %.not68 = icmp eq i32 %102, 0
  br i1 %.not68, label %143, label %142

142:                                              ; preds = %141
  store i32 %102, ptr %101, align 4, !tbaa !5
  br label %143

143:                                              ; preds = %142, %141
  %144 = icmp eq i64 %.lcssa, -1
  %145 = select i1 %144, ptr null, ptr %1
  br label %146

146:                                              ; preds = %143, %37, %31
  %.0 = phi ptr [ null, %31 ], [ null, %37 ], [ %145, %143 ]
  call void @llvm.lifetime.end.p0(i64 152, ptr nonnull %17) #10
  call void @llvm.lifetime.end.p0(i64 152, ptr nonnull %16) #10
  call void @llvm.lifetime.end.p0(i64 152, ptr nonnull %15) #10
  call void @llvm.lifetime.end.p0(i64 152, ptr nonnull %14) #10
  call void @llvm.lifetime.end.p0(i64 152, ptr nonnull %13) #10
  call void @llvm.lifetime.end.p0(i64 152, ptr nonnull %12) #10
  call void @llvm.lifetime.end.p0(i64 152, ptr nonnull %11) #10
  call void @llvm.lifetime.end.p0(i64 152, ptr nonnull %10) #10
  call void @llvm.lifetime.end.p0(i64 152, ptr nonnull %9) #10
  call void @llvm.lifetime.end.p0(i64 152, ptr nonnull %8) #10
  call void @llvm.lifetime.end.p0(i64 60, ptr nonnull %7) #10
  call void @llvm.lifetime.end.p0(i64 60, ptr nonnull %6) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #10
  ret ptr %.0
}

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #2

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

; Function Attrs: nounwind
declare i32 @tcgetattr(i32 noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: nounwind
declare i32 @tcsetattr(i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

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

; Function Attrs: nounwind
declare i32 @sigemptyset(ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare hidden void @handler(i32 noundef) #0

; Function Attrs: nounwind
declare i32 @sigaction(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nofree
declare noundef i64 @write(i32 noundef, ptr nocapture noundef readonly, i64 noundef) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #2

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_tolower_loc() local_unnamed_addr #2

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_toupper_loc() local_unnamed_addr #2

declare i32 @close(i32 noundef) local_unnamed_addr #8

; Function Attrs: nounwind
declare i32 @kill(i32 noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: nounwind
declare i32 @getpid() local_unnamed_addr #4

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #9

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 "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 "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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 #8 = { "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 = { nofree nounwind willreturn memory(argmem: read) }
attributes #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(none) }
attributes #12 = { 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 = !{!10, !6, i64 12}
!10 = !{!"termios", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !7, i64 16, !7, i64 17, !6, i64 52, !6, i64 56}
!11 = !{!12, !6, i64 136}
!12 = !{!"sigaction", !7, i64 0, !13, i64 8, !6, i64 136, !14, i64 144}
!13 = !{!"", !7, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!7, !7, i64 0}
!16 = !{!14, !14, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"short", !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}
!22 = distinct !{!22, !20}


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