; LLVM IR from metaspartan/denarius :: src/tor (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 i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i8, align 1
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca %struct.termios, align 4
  %21 = alloca %struct.termios, align 4
  %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 %struct.sigaction, align 8
  %32 = 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
  store i64 0, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, 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 4, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.start.p0(i64 60, ptr %20) #8
  call void @llvm.lifetime.start.p0(i64 60, 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
  call void @llvm.lifetime.start.p0(i64 152, ptr %31) #8
  %33 = load i64, ptr %8, align 8, !tbaa !9
  %34 = icmp eq i64 %33, 0
  br i1 %34, label %35, label %37

35:                                               ; preds = %4
  %36 = call ptr @__errno_location() #9
  store i32 22, ptr %36, align 4, !tbaa !11
  store ptr null, ptr %5, align 8
  store i32 1, ptr %32, align 4
  br label %229

37:                                               ; preds = %4
  br label %38

38:                                               ; preds = %214, %37
  store i32 0, ptr %15, align 4, !tbaa !11
  br label %39

39:                                               ; preds = %46, %38
  %40 = load i32, ptr %15, align 4, !tbaa !11
  %41 = icmp slt i32 %40, 65
  br i1 %41, label %42, label %49

42:                                               ; preds = %39
  %43 = load i32, ptr %15, align 4, !tbaa !11
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [65 x i32], ptr @signo, i64 0, i64 %44
  store volatile i32 0, ptr %45, align 4, !tbaa !11
  br label %46

46:                                               ; preds = %42
  %47 = load i32, ptr %15, align 4, !tbaa !11
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %15, align 4, !tbaa !11
  br label %39, !llvm.loop !13

49:                                               ; preds = %39
  store i64 -1, ptr %11, align 8, !tbaa !9
  store i32 0, ptr %14, align 4, !tbaa !11
  store i32 0, ptr %16, align 4, !tbaa !11
  %50 = load i32, ptr %9, align 4, !tbaa !11
  %51 = and i32 %50, 32
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %56, label %53

53:                                               ; preds = %49
  %54 = call i32 (ptr, i32, ...) @open(ptr noundef @.str, i32 noundef 2)
  store i32 %54, ptr %13, align 4, !tbaa !11
  store i32 %54, ptr %12, align 4, !tbaa !11
  %55 = icmp eq i32 %54, -1
  br i1 %55, label %56, label %63

56:                                               ; preds = %53, %49
  %57 = load i32, ptr %9, align 4, !tbaa !11
  %58 = and i32 %57, 2
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %62

60:                                               ; preds = %56
  %61 = call ptr @__errno_location() #9
  store i32 25, ptr %61, align 4, !tbaa !11
  store ptr null, ptr %5, align 8
  store i32 1, ptr %32, align 4
  br label %229

62:                                               ; preds = %56
  store i32 0, ptr %12, align 4, !tbaa !11
  store i32 2, ptr %13, align 4, !tbaa !11
  br label %63

63:                                               ; preds = %62, %53
  %64 = getelementptr inbounds %struct.sigaction, ptr %22, i32 0, i32 1
  %65 = call i32 @sigemptyset(ptr noundef %64) #8
  %66 = getelementptr inbounds %struct.sigaction, ptr %22, i32 0, i32 2
  store i32 0, ptr %66, align 8, !tbaa !15
  %67 = getelementptr inbounds %struct.sigaction, ptr %22, i32 0, i32 0
  store ptr @handler, ptr %67, align 8, !tbaa !18
  %68 = call i32 @sigaction(i32 noundef 14, ptr noundef %22, ptr noundef %23) #8
  %69 = call i32 @sigaction(i32 noundef 1, ptr noundef %22, ptr noundef %25) #8
  %70 = call i32 @sigaction(i32 noundef 2, ptr noundef %22, ptr noundef %24) #8
  %71 = call i32 @sigaction(i32 noundef 13, ptr noundef %22, ptr noundef %31) #8
  %72 = call i32 @sigaction(i32 noundef 3, ptr noundef %22, ptr noundef %26) #8
  %73 = call i32 @sigaction(i32 noundef 15, ptr noundef %22, ptr noundef %27) #8
  %74 = call i32 @sigaction(i32 noundef 20, ptr noundef %22, ptr noundef %28) #8
  %75 = call i32 @sigaction(i32 noundef 21, ptr noundef %22, ptr noundef %29) #8
  %76 = call i32 @sigaction(i32 noundef 22, ptr noundef %22, ptr noundef %30) #8
  %77 = load i32, ptr %12, align 4, !tbaa !11
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %94

79:                                               ; preds = %63
  %80 = load i32, ptr %12, align 4, !tbaa !11
  %81 = call i32 @tcgetattr(i32 noundef %80, ptr noundef %21) #8
  %82 = icmp eq i32 %81, 0
  br i1 %82, label %83, label %94

83:                                               ; preds = %79
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %21, i64 60, i1 false)
  %84 = load i32, ptr %9, align 4, !tbaa !11
  %85 = and i32 %84, 1
  %86 = icmp ne i32 %85, 0
  br i1 %86, label %91, label %87

87:                                               ; preds = %83
  %88 = getelementptr inbounds %struct.termios, ptr %20, i32 0, i32 3
  %89 = load i32, ptr %88, align 4, !tbaa !19
  %90 = and i32 %89, -73
  store i32 %90, ptr %88, align 4, !tbaa !19
  br label %91

91:                                               ; preds = %87, %83
  %92 = load i32, ptr %12, align 4, !tbaa !11
  %93 = call i32 @tcsetattr(i32 noundef %92, i32 noundef 2, ptr noundef %20) #8
  br label %101

94:                                               ; preds = %79, %63
  call void @llvm.memset.p0.i64(ptr align 4 %20, i8 0, i64 60, i1 false)
  %95 = getelementptr inbounds %struct.termios, ptr %20, i32 0, i32 3
  %96 = load i32, ptr %95, align 4, !tbaa !19
  %97 = or i32 %96, 8
  store i32 %97, ptr %95, align 4, !tbaa !19
  call void @llvm.memset.p0.i64(ptr align 4 %21, i8 0, i64 60, i1 false)
  %98 = getelementptr inbounds %struct.termios, ptr %21, i32 0, i32 3
  %99 = load i32, ptr %98, align 4, !tbaa !19
  %100 = or i32 %99, 8
  store i32 %100, ptr %98, align 4, !tbaa !19
  br label %101

101:                                              ; preds = %94, %91
  %102 = load volatile i32, ptr getelementptr inbounds ([65 x i32], ptr @signo, i64 0, i64 22), align 8, !tbaa !11
  %103 = icmp ne i32 %102, 1
  br i1 %103, label %104, label %158

104:                                              ; preds = %101
  %105 = load volatile i32, ptr getelementptr inbounds ([65 x i32], ptr @signo, i64 0, i64 21), align 4, !tbaa !11
  %106 = icmp ne i32 %105, 1
  br i1 %106, label %107, label %158

107:                                              ; preds = %104
  %108 = load i32, ptr %9, align 4, !tbaa !11
  %109 = and i32 %108, 32
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %117, label %111

111:                                              ; preds = %107
  %112 = load i32, ptr %13, align 4, !tbaa !11
  %113 = load ptr, ptr %6, align 8, !tbaa !5
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  %115 = call i64 @strlen(ptr noundef %114) #10
  %116 = call i64 @write(i32 noundef %112, ptr noundef %113, i64 noundef %115)
  store i64 %116, ptr %10, align 8, !tbaa !9
  br label %117

117:                                              ; preds = %111, %107
  %118 = load ptr, ptr %7, align 8, !tbaa !5
  %119 = load i64, ptr %8, align 8, !tbaa !9
  %120 = getelementptr inbounds i8, ptr %118, i64 %119
  %121 = getelementptr inbounds i8, ptr %120, i64 -1
  store ptr %121, ptr %19, align 8, !tbaa !5
  %122 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %122, ptr %18, align 8, !tbaa !5
  br label %123

123:                                              ; preds = %145, %117
  %124 = load i32, ptr %12, align 4, !tbaa !11
  %125 = call i64 @read(i32 noundef %124, ptr noundef %17, i64 noundef 1)
  store i64 %125, ptr %11, align 8, !tbaa !9
  %126 = icmp eq i64 %125, 1
  br i1 %126, label %127, label %135

127:                                              ; preds = %123
  %128 = load i8, ptr %17, align 1, !tbaa !18
  %129 = sext i8 %128 to i32
  %130 = icmp ne i32 %129, 10
  br i1 %130, label %131, label %135

131:                                              ; preds = %127
  %132 = load i8, ptr %17, align 1, !tbaa !18
  %133 = sext i8 %132 to i32
  %134 = icmp ne i32 %133, 13
  br label %135

135:                                              ; preds = %131, %127, %123
  %136 = phi i1 [ false, %127 ], [ false, %123 ], [ %134, %131 ]
  br i1 %136, label %137, label %146

137:                                              ; preds = %135
  %138 = load ptr, ptr %18, align 8, !tbaa !5
  %139 = load ptr, ptr %19, align 8, !tbaa !5
  %140 = icmp ult ptr %138, %139
  br i1 %140, label %141, label %145

141:                                              ; preds = %137
  %142 = load i8, ptr %17, align 1, !tbaa !18
  %143 = load ptr, ptr %18, align 8, !tbaa !5
  %144 = getelementptr inbounds i8, ptr %143, i32 1
  store ptr %144, ptr %18, align 8, !tbaa !5
  store i8 %142, ptr %143, align 1, !tbaa !18
  br label %145

145:                                              ; preds = %141, %137
  br label %123, !llvm.loop !21

146:                                              ; preds = %135
  %147 = load ptr, ptr %18, align 8, !tbaa !5
  store i8 0, ptr %147, align 1, !tbaa !18
  %148 = call ptr @__errno_location() #9
  %149 = load i32, ptr %148, align 4, !tbaa !11
  store i32 %149, ptr %14, align 4, !tbaa !11
  %150 = getelementptr inbounds %struct.termios, ptr %20, i32 0, i32 3
  %151 = load i32, ptr %150, align 4, !tbaa !19
  %152 = and i32 %151, 8
  %153 = icmp ne i32 %152, 0
  br i1 %153, label %157, label %154

154:                                              ; preds = %146
  %155 = load i32, ptr %13, align 4, !tbaa !11
  %156 = call i64 @write(i32 noundef %155, ptr noundef @.str.1, i64 noundef 1)
  store i64 %156, ptr %10, align 8, !tbaa !9
  br label %157

157:                                              ; preds = %154, %146
  br label %158

158:                                              ; preds = %157, %104, %101
  %159 = load i64, ptr %10, align 8, !tbaa !9
  %160 = call i32 @memcmp(ptr noundef %20, ptr noundef %21, i64 noundef 60) #10
  %161 = icmp ne i32 %160, 0
  br i1 %161, label %162, label %175

162:                                              ; preds = %158
  br label %163

163:                                              ; preds = %173, %162
  %164 = load i32, ptr %12, align 4, !tbaa !11
  %165 = call i32 @tcsetattr(i32 noundef %164, i32 noundef 2, ptr noundef %21) #8
  %166 = icmp eq i32 %165, -1
  br i1 %166, label %167, label %171

167:                                              ; preds = %163
  %168 = call ptr @__errno_location() #9
  %169 = load i32, ptr %168, align 4, !tbaa !11
  %170 = icmp eq i32 %169, 4
  br label %171

171:                                              ; preds = %167, %163
  %172 = phi i1 [ false, %163 ], [ %170, %167 ]
  br i1 %172, label %173, label %174

173:                                              ; preds = %171
  br label %163, !llvm.loop !22

174:                                              ; preds = %171
  br label %175

175:                                              ; preds = %174, %158
  %176 = call i32 @sigaction(i32 noundef 14, ptr noundef %23, ptr noundef null) #8
  %177 = call i32 @sigaction(i32 noundef 1, ptr noundef %25, ptr noundef null) #8
  %178 = call i32 @sigaction(i32 noundef 2, ptr noundef %24, ptr noundef null) #8
  %179 = call i32 @sigaction(i32 noundef 3, ptr noundef %26, ptr noundef null) #8
  %180 = call i32 @sigaction(i32 noundef 13, ptr noundef %31, ptr noundef null) #8
  %181 = call i32 @sigaction(i32 noundef 15, ptr noundef %27, ptr noundef null) #8
  %182 = call i32 @sigaction(i32 noundef 20, ptr noundef %28, ptr noundef null) #8
  %183 = call i32 @sigaction(i32 noundef 21, ptr noundef %29, ptr noundef null) #8
  %184 = call i32 @sigaction(i32 noundef 22, ptr noundef %30, ptr noundef null) #8
  %185 = load i32, ptr %12, align 4, !tbaa !11
  %186 = icmp ne i32 %185, 0
  br i1 %186, label %187, label %190

187:                                              ; preds = %175
  %188 = load i32, ptr %12, align 4, !tbaa !11
  %189 = call i32 @close(i32 noundef %188)
  br label %190

190:                                              ; preds = %187, %175
  store i32 0, ptr %15, align 4, !tbaa !11
  br label %191

191:                                              ; preds = %208, %190
  %192 = load i32, ptr %15, align 4, !tbaa !11
  %193 = icmp slt i32 %192, 65
  br i1 %193, label %194, label %211

194:                                              ; preds = %191
  %195 = load i32, ptr %15, align 4, !tbaa !11
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [65 x i32], ptr @signo, i64 0, i64 %196
  %198 = load volatile i32, ptr %197, align 4, !tbaa !11
  %199 = icmp ne i32 %198, 0
  br i1 %199, label %200, label %207

200:                                              ; preds = %194
  %201 = call i32 @getpid() #8
  %202 = load i32, ptr %15, align 4, !tbaa !11
  %203 = call i32 @kill(i32 noundef %201, i32 noundef %202) #8
  %204 = load i32, ptr %15, align 4, !tbaa !11
  switch i32 %204, label %206 [
    i32 20, label %205
    i32 21, label %205
    i32 22, label %205
  ]

205:                                              ; preds = %200, %200, %200
  store i32 1, ptr %16, align 4, !tbaa !11
  br label %206

206:                                              ; preds = %205, %200
  br label %207

207:                                              ; preds = %206, %194
  br label %208

208:                                              ; preds = %207
  %209 = load i32, ptr %15, align 4, !tbaa !11
  %210 = add nsw i32 %209, 1
  store i32 %210, ptr %15, align 4, !tbaa !11
  br label %191, !llvm.loop !23

211:                                              ; preds = %191
  %212 = load i32, ptr %16, align 4, !tbaa !11
  %213 = icmp ne i32 %212, 0
  br i1 %213, label %214, label %215

214:                                              ; preds = %211
  br label %38

215:                                              ; preds = %211
  %216 = load i32, ptr %14, align 4, !tbaa !11
  %217 = icmp ne i32 %216, 0
  br i1 %217, label %218, label %221

218:                                              ; preds = %215
  %219 = load i32, ptr %14, align 4, !tbaa !11
  %220 = call ptr @__errno_location() #9
  store i32 %219, ptr %220, align 4, !tbaa !11
  br label %221

221:                                              ; preds = %218, %215
  %222 = load i64, ptr %11, align 8, !tbaa !9
  %223 = icmp eq i64 %222, -1
  br i1 %223, label %224, label %225

224:                                              ; preds = %221
  br label %227

225:                                              ; preds = %221
  %226 = load ptr, ptr %7, align 8, !tbaa !5
  br label %227

227:                                              ; preds = %225, %224
  %228 = phi ptr [ null, %224 ], [ %226, %225 ]
  store ptr %228, ptr %5, align 8
  store i32 1, ptr %32, align 4
  br label %229

229:                                              ; preds = %227, %60, %35
  call void @llvm.lifetime.end.p0(i64 152, ptr %31) #8
  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 60, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 60, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, 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 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  %230 = load ptr, ptr %5, align 8
  ret ptr %230
}

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

; 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

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(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

; 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 = { 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 136}
!16 = !{!"sigaction", !7, i64 0, !17, i64 8, !12, i64 136, !6, i64 144}
!17 = !{!"", !7, i64 0}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !12, i64 12}
!20 = !{!"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}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !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 %28, label %.preheader66

.preheader66:                                     ; preds = %4
  %19 = and i32 %3, 32
  %.not = icmp eq i32 %19, 0
  %20 = and i32 %3, 2
  %.not56 = icmp eq i32 %20, 0
  %21 = getelementptr inbounds i8, ptr %8, i64 8
  %22 = getelementptr inbounds i8, ptr %8, i64 136
  %23 = and i32 %3, 1
  %.not58 = icmp eq i32 %23, 0
  %24 = getelementptr inbounds i8, ptr %6, i64 12
  %25 = getelementptr inbounds i8, ptr %7, i64 12
  %26 = getelementptr inbounds i8, ptr %1, i64 %2
  %27 = getelementptr inbounds i8, ptr %26, i64 -1
  br label %30

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

30:                                               ; preds = %.preheader66, %111
  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 %31, label %34

31:                                               ; preds = %30
  %32 = call i32 (ptr, i32, ...) @open(ptr noundef nonnull @.str, i32 noundef 2) #10
  %33 = icmp ne i32 %32, -1
  %brmerge = or i1 %33, %.not56
  %.mux = select i1 %33, i32 %32, i32 0
  %.mux78 = select i1 %33, i32 %32, i32 2
  br i1 %brmerge, label %37, label %35

34:                                               ; preds = %30
  br i1 %.not56, label %37, label %35

35:                                               ; preds = %31, %34
  %36 = tail call ptr @__errno_location() #11
  store i32 25, ptr %36, align 4, !tbaa !5
  br label %118

37:                                               ; preds = %31, %34
  %.051 = phi i32 [ %.mux, %31 ], [ 0, %34 ]
  %.050 = phi i32 [ %.mux78, %31 ], [ 2, %34 ]
  %38 = call i32 @sigemptyset(ptr noundef nonnull %21) #10
  store i32 0, ptr %22, align 8, !tbaa !9
  store ptr @handler, ptr %8, align 8, !tbaa !13
  %39 = call i32 @sigaction(i32 noundef 14, ptr noundef nonnull %8, ptr noundef nonnull %9) #10
  %40 = call i32 @sigaction(i32 noundef 1, ptr noundef nonnull %8, ptr noundef nonnull %11) #10
  %41 = call i32 @sigaction(i32 noundef 2, ptr noundef nonnull %8, ptr noundef nonnull %10) #10
  %42 = call i32 @sigaction(i32 noundef 13, ptr noundef nonnull %8, ptr noundef nonnull %17) #10
  %43 = call i32 @sigaction(i32 noundef 3, ptr noundef nonnull %8, ptr noundef nonnull %12) #10
  %44 = call i32 @sigaction(i32 noundef 15, ptr noundef nonnull %8, ptr noundef nonnull %13) #10
  %45 = call i32 @sigaction(i32 noundef 20, ptr noundef nonnull %8, ptr noundef nonnull %14) #10
  %46 = call i32 @sigaction(i32 noundef 21, ptr noundef nonnull %8, ptr noundef nonnull %15) #10
  %47 = call i32 @sigaction(i32 noundef 22, ptr noundef nonnull %8, ptr noundef nonnull %16) #10
  %.not57 = icmp eq i32 %.051, 0
  br i1 %.not57, label %57, label %48

48:                                               ; preds = %37
  %49 = call i32 @tcgetattr(i32 noundef %.051, ptr noundef nonnull %7) #10
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %57

51:                                               ; preds = %48
  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 %.not58, label %52, label %55

52:                                               ; preds = %51
  %53 = load i32, ptr %24, align 4, !tbaa !14
  %54 = and i32 %53, -73
  store i32 %54, ptr %24, align 4, !tbaa !14
  br label %55

55:                                               ; preds = %52, %51
  %56 = call i32 @tcsetattr(i32 noundef %.051, i32 noundef 2, ptr noundef nonnull %6) #10
  br label %58

57:                                               ; preds = %48, %37
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(60) %6, i8 0, i64 60, i1 false)
  store i32 8, ptr %24, align 4, !tbaa !14
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(60) %7, i8 0, i64 60, i1 false)
  store i32 8, ptr %25, align 4, !tbaa !14
  br label %58

58:                                               ; preds = %57, %55
  %59 = load volatile i32, ptr getelementptr inbounds (i8, ptr @signo, i64 88), align 8, !tbaa !5
  %.not59 = icmp eq i32 %59, 1
  br i1 %.not59, label %83, label %60

60:                                               ; preds = %58
  %61 = load volatile i32, ptr getelementptr inbounds (i8, ptr @signo, i64 84), align 4, !tbaa !5
  %.not60 = icmp eq i32 %61, 1
  br i1 %.not60, label %83, label %62

62:                                               ; preds = %60
  br i1 %.not, label %63, label %66

63:                                               ; preds = %62
  %64 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #12
  %65 = call i64 @write(i32 noundef %.050, ptr noundef %0, i64 noundef %64) #10
  br label %66

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

switch.early.test:                                ; preds = %66, %74
  %.04468 = phi ptr [ %.1, %74 ], [ %1, %66 ]
  %69 = load i8, ptr %5, align 1
  switch i8 %69, label %70 [
    i8 13, label %.critedge
    i8 10, label %.critedge
  ]

70:                                               ; preds = %switch.early.test
  %71 = icmp ult ptr %.04468, %27
  br i1 %71, label %72, label %74

72:                                               ; preds = %70
  %73 = getelementptr inbounds i8, ptr %.04468, i64 1
  store i8 %69, ptr %.04468, align 1, !tbaa !13
  br label %74

74:                                               ; preds = %72, %70
  %.1 = phi ptr [ %73, %72 ], [ %.04468, %70 ]
  %75 = call i64 @read(i32 noundef %.051, ptr noundef nonnull %5, i64 noundef 1) #10
  %76 = icmp eq i64 %75, 1
  br i1 %76, label %switch.early.test, label %.critedge, !llvm.loop !16

.critedge:                                        ; preds = %74, %switch.early.test, %switch.early.test, %66
  %.044.lcssa = phi ptr [ %1, %66 ], [ %.04468, %switch.early.test ], [ %.04468, %switch.early.test ], [ %.1, %74 ]
  %.lcssa = phi i64 [ %67, %66 ], [ 1, %switch.early.test ], [ 1, %switch.early.test ], [ %75, %74 ]
  store i8 0, ptr %.044.lcssa, align 1, !tbaa !13
  %77 = tail call ptr @__errno_location() #11
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = load i32, ptr %24, align 4, !tbaa !14
  %80 = and i32 %79, 8
  %.not61 = icmp eq i32 %80, 0
  br i1 %.not61, label %81, label %83

81:                                               ; preds = %.critedge
  %82 = call i64 @write(i32 noundef %.050, ptr noundef nonnull @.str.1, i64 noundef 1) #10
  br label %83

83:                                               ; preds = %.critedge, %81, %60, %58
  %.052 = phi i64 [ %.lcssa, %.critedge ], [ %.lcssa, %81 ], [ -1, %60 ], [ -1, %58 ]
  %.049 = phi i32 [ %78, %.critedge ], [ %78, %81 ], [ 0, %60 ], [ 0, %58 ]
  %bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(60) %6, ptr noundef nonnull dereferenceable(60) %7, i64 60)
  %.not62 = icmp eq i32 %bcmp, 0
  br i1 %.not62, label %.critedge4, label %.preheader

.preheader:                                       ; preds = %83, %86
  %84 = call i32 @tcsetattr(i32 noundef %.051, i32 noundef 2, ptr noundef nonnull %7) #10
  %85 = icmp eq i32 %84, -1
  br i1 %85, label %86, label %.critedge4

86:                                               ; preds = %.preheader
  %87 = tail call ptr @__errno_location() #11
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = icmp eq i32 %88, 4
  br i1 %89, label %.preheader, label %.critedge4, !llvm.loop !18

.critedge4:                                       ; preds = %86, %.preheader, %83
  %90 = call i32 @sigaction(i32 noundef 14, ptr noundef nonnull %9, ptr noundef null) #10
  %91 = call i32 @sigaction(i32 noundef 1, ptr noundef nonnull %11, ptr noundef null) #10
  %92 = call i32 @sigaction(i32 noundef 2, ptr noundef nonnull %10, ptr noundef null) #10
  %93 = call i32 @sigaction(i32 noundef 3, ptr noundef nonnull %12, ptr noundef null) #10
  %94 = call i32 @sigaction(i32 noundef 13, ptr noundef nonnull %17, ptr noundef null) #10
  %95 = call i32 @sigaction(i32 noundef 15, ptr noundef nonnull %13, ptr noundef null) #10
  %96 = call i32 @sigaction(i32 noundef 20, ptr noundef nonnull %14, ptr noundef null) #10
  %97 = call i32 @sigaction(i32 noundef 21, ptr noundef nonnull %15, ptr noundef null) #10
  %98 = call i32 @sigaction(i32 noundef 22, ptr noundef nonnull %16, ptr noundef null) #10
  br i1 %.not57, label %.preheader82, label %99

99:                                               ; preds = %.critedge4
  %100 = call i32 @close(i32 noundef %.051) #10
  br label %.preheader82

.preheader82:                                     ; preds = %99, %.critedge4
  br label %101

101:                                              ; preds = %.preheader82, %110
  %indvars.iv = phi i64 [ %indvars.iv.next, %110 ], [ 0, %.preheader82 ]
  %.04576 = phi i32 [ %.146, %110 ], [ 0, %.preheader82 ]
  %102 = getelementptr inbounds [65 x i32], ptr @signo, i64 0, i64 %indvars.iv
  %103 = load volatile i32, ptr %102, align 4, !tbaa !5
  %.not65 = icmp eq i32 %103, 0
  br i1 %.not65, label %110, label %104

104:                                              ; preds = %101
  %105 = call i32 @getpid() #10
  %106 = trunc nuw nsw i64 %indvars.iv to i32
  %107 = call i32 @kill(i32 noundef %105, i32 noundef %106) #10
  %108 = trunc i64 %indvars.iv to i32
  %109 = add i32 %108, -20
  %switch = icmp ult i32 %109, 3
  %spec.select = select i1 %switch, i32 1, i32 %.04576
  br label %110

110:                                              ; preds = %104, %101
  %.146 = phi i32 [ %.04576, %101 ], [ %spec.select, %104 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 65
  br i1 %exitcond.not, label %111, label %101, !llvm.loop !19

111:                                              ; preds = %110
  %.not63 = icmp eq i32 %.146, 0
  br i1 %.not63, label %112, label %30

112:                                              ; preds = %111
  %.not64 = icmp eq i32 %.049, 0
  br i1 %.not64, label %115, label %113

113:                                              ; preds = %112
  %114 = tail call ptr @__errno_location() #11
  store i32 %.049, ptr %114, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %113, %112
  %116 = icmp eq i64 %.052, -1
  %117 = select i1 %116, ptr null, ptr %1
  br label %118

118:                                              ; preds = %115, %35, %28
  %.0 = phi ptr [ null, %28 ], [ null, %35 ], [ %117, %115 ]
  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 @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: 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: 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

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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; 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 136}
!10 = !{!"sigaction", !7, i64 0, !11, i64 8, !6, i64 136, !12, i64 144}
!11 = !{!"", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !6, i64 12}
!15 = !{!"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}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}


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