; LLVM IR from nelhage/reptyr :: attach (attach_child)

; 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.ptrace_child = type { i32, i32, i32, i32, i32, i64, i64, %struct.user_regs_struct }
%struct.user_regs_struct = type { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
%struct.syscall_numbers = type { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 }

@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [49 x i8], align 1

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @do_setsid(ptr noundef) #2

declare void @debug(ptr noundef, ...) #3

declare i32 @ptrace_restore_regs(ptr noundef) #3

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

declare ptr @ptrace_syscall_numbers(ptr noundef) #3

declare void @error(ptr noundef, ...) #3

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) #1

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

declare i32 @ptrace_detach_child(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @ignore_hup(ptr noundef, i64 noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local void @wait_for_stop(i32 noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @copy_tty_state(i32 noundef, ptr noundef) #2

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

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

declare i32 @close(i32 noundef) #3

; Function Attrs: nounwind
declare i64 @sysconf(i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @grab_pid(i32 noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @preflight_check(i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @attach_child(i32 noundef %0, ptr noundef %1, i32 noundef %2) #2 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %struct.ptrace_child, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, 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 i64, align 8
  %17 = alloca [4096 x i8], align 16
  %18 = alloca i32, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 256, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store i64 -1, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store ptr null, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 -1, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %19 = call i64 @sysconf(i32 noundef 30) #7
  store i64 %19, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4096, ptr %17) #7
  %20 = load i32, ptr %5, align 4, !tbaa !5
  %21 = call i32 @check_pgroup(i32 noundef %20)
  store i32 %21, ptr %15, align 4, !tbaa !5
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %25

23:                                               ; preds = %3
  %24 = load i32, ptr %15, align 4, !tbaa !5
  store i32 %24, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %232

25:                                               ; preds = %3
  %26 = load i32, ptr %5, align 4, !tbaa !5
  %27 = call i32 @preflight_check(i32 noundef %26)
  store i32 %27, ptr %15, align 4, !tbaa !5
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %31

29:                                               ; preds = %25
  %30 = load i32, ptr %15, align 4, !tbaa !5
  store i32 %30, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %232

31:                                               ; preds = %25
  %32 = load ptr, ptr %6, align 8, !tbaa !9
  call void (ptr, ...) @debug(ptr noundef @.str.9, ptr noundef %32)
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = load ptr, ptr %6, align 8, !tbaa !9
  %35 = call i32 @copy_tty_state(i32 noundef %33, ptr noundef %34)
  store i32 %35, ptr %15, align 4, !tbaa !5
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %46

37:                                               ; preds = %31
  %38 = load i32, ptr %15, align 4, !tbaa !5
  %39 = icmp eq i32 %38, 25
  br i1 %39, label %40, label %45

40:                                               ; preds = %37
  %41 = load i32, ptr %7, align 4, !tbaa !5
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %45, label %43

43:                                               ; preds = %40
  call void (ptr, ...) @error(ptr noundef @.str.10)
  %44 = load i32, ptr %15, align 4, !tbaa !5
  store i32 %44, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %232

45:                                               ; preds = %40, %37
  br label %46

46:                                               ; preds = %45, %31
  %47 = getelementptr inbounds [4096 x i8], ptr %17, i64 0, i64 0
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %47, i64 noundef 4096, ptr noundef @.str.11, i32 noundef %48) #7
  %50 = getelementptr inbounds [4096 x i8], ptr %17, i64 0, i64 0
  %51 = call i32 (ptr, i32, ...) @open(ptr noundef %50, i32 noundef 0)
  store i32 %51, ptr %13, align 4, !tbaa !5
  %52 = load i32, ptr %13, align 4, !tbaa !5
  %53 = icmp slt i32 %52, 0
  br i1 %53, label %54, label %61

54:                                               ; preds = %46
  %55 = getelementptr inbounds [4096 x i8], ptr %17, i64 0, i64 0
  %56 = call ptr @__errno_location() #8
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = call ptr @strerror(i32 noundef %57) #7
  call void (ptr, ...) @error(ptr noundef @.str.12, ptr noundef %55, ptr noundef %58)
  %59 = load i32, ptr %13, align 4, !tbaa !5
  %60 = sub nsw i32 0, %59
  store i32 %60, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %232

61:                                               ; preds = %46
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = call i32 @kill(i32 noundef %62, i32 noundef 20) #7
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = load i32, ptr %13, align 4, !tbaa !5
  call void @wait_for_stop(i32 noundef %64, i32 noundef %65)
  %66 = load i32, ptr %5, align 4, !tbaa !5
  %67 = call i32 @grab_pid(i32 noundef %66, ptr noundef %8, ptr noundef %9)
  store i32 %67, ptr %15, align 4, !tbaa !5
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %70

69:                                               ; preds = %61
  br label %217

70:                                               ; preds = %61
  %71 = load i32, ptr %7, align 4, !tbaa !5
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %85

73:                                               ; preds = %70
  %74 = call noalias ptr @malloc(i64 noundef 12) #9
  store ptr %74, ptr %10, align 8, !tbaa !9
  %75 = load ptr, ptr %10, align 8, !tbaa !9
  %76 = icmp ne ptr %75, null
  br i1 %76, label %78, label %77

77:                                               ; preds = %73
  store i32 12, ptr %15, align 4, !tbaa !5
  br label %199

78:                                               ; preds = %73
  store i32 3, ptr %11, align 4, !tbaa !5
  %79 = load ptr, ptr %10, align 8, !tbaa !9
  %80 = getelementptr inbounds i32, ptr %79, i64 0
  store i32 0, ptr %80, align 4, !tbaa !5
  %81 = load ptr, ptr %10, align 8, !tbaa !9
  %82 = getelementptr inbounds i32, ptr %81, i64 1
  store i32 1, ptr %82, align 4, !tbaa !5
  %83 = load ptr, ptr %10, align 8, !tbaa !9
  %84 = getelementptr inbounds i32, ptr %83, i64 2
  store i32 2, ptr %84, align 4, !tbaa !5
  br label %94

85:                                               ; preds = %70
  %86 = load i32, ptr %13, align 4, !tbaa !5
  %87 = call ptr @get_child_tty_fds(ptr noundef %8, i32 noundef %86, ptr noundef %11)
  store ptr %87, ptr %10, align 8, !tbaa !9
  %88 = load ptr, ptr %10, align 8, !tbaa !9
  %89 = icmp ne ptr %88, null
  br i1 %89, label %93, label %90

90:                                               ; preds = %85
  %91 = getelementptr inbounds %struct.ptrace_child, ptr %8, i32 0, i32 4
  %92 = load i32, ptr %91, align 8, !tbaa !13
  store i32 %92, ptr %15, align 4, !tbaa !5
  br label %199

93:                                               ; preds = %85
  br label %94

94:                                               ; preds = %93, %78
  %95 = load i64, ptr %9, align 8, !tbaa !11
  %96 = load ptr, ptr %6, align 8, !tbaa !9
  %97 = load ptr, ptr %6, align 8, !tbaa !9
  %98 = call i64 @strlen(ptr noundef %97) #10
  %99 = add i64 %98, 1
  %100 = call i32 @ptrace_memcpy_to_child(ptr noundef %8, i64 noundef %95, ptr noundef %96, i64 noundef %99)
  %101 = icmp ne i32 %100, 0
  br i1 %101, label %102, label %105

102:                                              ; preds = %94
  %103 = getelementptr inbounds %struct.ptrace_child, ptr %8, i32 0, i32 4
  %104 = load i32, ptr %103, align 8, !tbaa !13
  store i32 %104, ptr %15, align 4, !tbaa !5
  call void (ptr, ...) @error(ptr noundef @.str.13)
  br label %197

105:                                              ; preds = %94
  %106 = call ptr @ptrace_syscall_numbers(ptr noundef %8)
  %107 = getelementptr inbounds %struct.syscall_numbers, ptr %106, i32 0, i32 11
  %108 = load i64, ptr %107, align 8, !tbaa !17
  %109 = load i64, ptr %9, align 8, !tbaa !11
  %110 = call i64 @ptrace_remote_syscall(ptr noundef %8, i64 noundef %108, i64 noundef -1, i64 noundef %109, i64 noundef 258, i64 noundef 0, i64 noundef 0, i64 noundef 0)
  %111 = trunc i64 %110 to i32
  store i32 %111, ptr %12, align 4, !tbaa !5
  %112 = load i32, ptr %12, align 4, !tbaa !5
  %113 = icmp slt i32 %112, 0
  br i1 %113, label %114, label %116

114:                                              ; preds = %105
  %115 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %115, ptr %15, align 4, !tbaa !5
  call void (ptr, ...) @error(ptr noundef @.str.14)
  br label %197

116:                                              ; preds = %105
  %117 = load i32, ptr %12, align 4, !tbaa !5
  call void (ptr, ...) @debug(ptr noundef @.str.15, i32 noundef %117)
  %118 = load i64, ptr %9, align 8, !tbaa !11
  %119 = call i32 @ignore_hup(ptr noundef %8, i64 noundef %118)
  store i32 %119, ptr %15, align 4, !tbaa !5
  %120 = load i32, ptr %15, align 4, !tbaa !5
  %121 = icmp slt i32 %120, 0
  br i1 %121, label %122, label %123

122:                                              ; preds = %116
  br label %190

123:                                              ; preds = %116
  %124 = call ptr @ptrace_syscall_numbers(ptr noundef %8)
  %125 = getelementptr inbounds %struct.syscall_numbers, ptr %124, i32 0, i32 3
  %126 = load i64, ptr %125, align 8, !tbaa !19
  %127 = call i64 @ptrace_remote_syscall(ptr noundef %8, i64 noundef %126, i64 noundef 0, i64 noundef 0, i64 noundef 0, i64 noundef 0, i64 noundef 0, i64 noundef 0)
  %128 = trunc i64 %127 to i32
  store i32 %128, ptr %15, align 4, !tbaa !5
  %129 = load i32, ptr %15, align 4, !tbaa !5
  %130 = getelementptr inbounds %struct.ptrace_child, ptr %8, i32 0, i32 0
  %131 = load i32, ptr %130, align 8, !tbaa !20
  %132 = icmp ne i32 %129, %131
  br i1 %132, label %133, label %135

133:                                              ; preds = %123
  call void (ptr, ...) @debug(ptr noundef @.str.16)
  %134 = call i32 @do_setsid(ptr noundef %8)
  store i32 %134, ptr %15, align 4, !tbaa !5
  br label %144

135:                                              ; preds = %123
  %136 = call ptr @ptrace_syscall_numbers(ptr noundef %8)
  %137 = getelementptr inbounds %struct.syscall_numbers, ptr %136, i32 0, i32 13
  %138 = load i64, ptr %137, align 8, !tbaa !21
  %139 = load ptr, ptr %10, align 8, !tbaa !9
  %140 = getelementptr inbounds i32, ptr %139, i64 0
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = call i64 @ptrace_remote_syscall(ptr noundef %8, i64 noundef %138, i64 noundef %142, i64 noundef 21538, i64 noundef 0, i64 noundef 0, i64 noundef 0, i64 noundef 0)
  br label %144

144:                                              ; preds = %135, %133
  %145 = load i32, ptr %15, align 4, !tbaa !5
  %146 = icmp slt i32 %145, 0
  br i1 %146, label %147, label %148

147:                                              ; preds = %144
  br label %190

148:                                              ; preds = %144
  %149 = call ptr @ptrace_syscall_numbers(ptr noundef %8)
  %150 = getelementptr inbounds %struct.syscall_numbers, ptr %149, i32 0, i32 13
  %151 = load i64, ptr %150, align 8, !tbaa !21
  %152 = load i32, ptr %12, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = call i64 @ptrace_remote_syscall(ptr noundef %8, i64 noundef %151, i64 noundef %153, i64 noundef 21518, i64 noundef 1, i64 noundef 0, i64 noundef 0, i64 noundef 0)
  %155 = trunc i64 %154 to i32
  store i32 %155, ptr %15, align 4, !tbaa !5
  %156 = load i32, ptr %15, align 4, !tbaa !5
  %157 = icmp ne i32 %156, 0
  br i1 %157, label %158, label %161

158:                                              ; preds = %148
  %159 = load i32, ptr %15, align 4, !tbaa !5
  %160 = call ptr @strerror(i32 noundef %159) #7
  call void (ptr, ...) @error(ptr noundef @.str.17, ptr noundef %160)
  br label %190

161:                                              ; preds = %148
  call void (ptr, ...) @debug(ptr noundef @.str.18)
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %162

162:                                              ; preds = %186, %161
  %163 = load i32, ptr %14, align 4, !tbaa !5
  %164 = load i32, ptr %11, align 4, !tbaa !5
  %165 = icmp slt i32 %163, %164
  br i1 %165, label %166, label %189

166:                                              ; preds = %162
  %167 = load i32, ptr %12, align 4, !tbaa !5
  %168 = load ptr, ptr %10, align 8, !tbaa !9
  %169 = load i32, ptr %14, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds i32, ptr %168, i64 %170
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %173 = call i32 @do_dup2(ptr noundef %8, i32 noundef %167, i32 noundef %172)
  store i32 %173, ptr %15, align 4, !tbaa !5
  %174 = load i32, ptr %15, align 4, !tbaa !5
  %175 = icmp slt i32 %174, 0
  br i1 %175, label %176, label %185

176:                                              ; preds = %166
  %177 = load ptr, ptr %10, align 8, !tbaa !9
  %178 = load i32, ptr %14, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds i32, ptr %177, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !5
  %182 = call ptr @__errno_location() #8
  %183 = load i32, ptr %182, align 4, !tbaa !5
  %184 = call ptr @strerror(i32 noundef %183) #7
  call void (ptr, ...) @error(ptr noundef @.str.19, i32 noundef %181, ptr noundef %184)
  br label %185

185:                                              ; preds = %176, %166
  br label %186

186:                                              ; preds = %185
  %187 = load i32, ptr %14, align 4, !tbaa !5
  %188 = add nsw i32 %187, 1
  store i32 %188, ptr %14, align 4, !tbaa !5
  br label %162, !llvm.loop !22

189:                                              ; preds = %162
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %190

190:                                              ; preds = %189, %158, %147, %122
  %191 = call ptr @ptrace_syscall_numbers(ptr noundef %8)
  %192 = getelementptr inbounds %struct.syscall_numbers, ptr %191, i32 0, i32 12
  %193 = load i64, ptr %192, align 8, !tbaa !24
  %194 = load i32, ptr %12, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = call i64 @ptrace_remote_syscall(ptr noundef %8, i64 noundef %193, i64 noundef %195, i64 noundef 0, i64 noundef 0, i64 noundef 0, i64 noundef 0, i64 noundef 0)
  br label %197

197:                                              ; preds = %190, %114, %102
  %198 = load ptr, ptr %10, align 8, !tbaa !9
  call void @free(ptr noundef %198) #7
  br label %199

199:                                              ; preds = %197, %90, %77
  %200 = load i64, ptr %9, align 8, !tbaa !11
  %201 = load i64, ptr %16, align 8, !tbaa !11
  call void @do_unmap(ptr noundef %8, i64 noundef %200, i64 noundef %201)
  %202 = call i32 @ptrace_restore_regs(ptr noundef %8)
  %203 = call i32 @ptrace_detach_child(ptr noundef %8)
  %204 = load i32, ptr %15, align 4, !tbaa !5
  %205 = icmp eq i32 %204, 0
  br i1 %205, label %206, label %213

206:                                              ; preds = %199
  %207 = getelementptr inbounds %struct.ptrace_child, ptr %8, i32 0, i32 0
  %208 = load i32, ptr %207, align 8, !tbaa !20
  %209 = call i32 @kill(i32 noundef %208, i32 noundef 19) #7
  %210 = getelementptr inbounds %struct.ptrace_child, ptr %8, i32 0, i32 0
  %211 = load i32, ptr %210, align 8, !tbaa !20
  %212 = load i32, ptr %13, align 4, !tbaa !5
  call void @wait_for_stop(i32 noundef %211, i32 noundef %212)
  br label %213

213:                                              ; preds = %206, %199
  %214 = getelementptr inbounds %struct.ptrace_child, ptr %8, i32 0, i32 0
  %215 = load i32, ptr %214, align 8, !tbaa !20
  %216 = call i32 @kill(i32 noundef %215, i32 noundef 28) #7
  br label %217

217:                                              ; preds = %213, %69
  %218 = getelementptr inbounds %struct.ptrace_child, ptr %8, i32 0, i32 0
  %219 = load i32, ptr %218, align 8, !tbaa !20
  %220 = call i32 @kill(i32 noundef %219, i32 noundef 18) #7
  %221 = load i32, ptr %13, align 4, !tbaa !5
  %222 = call i32 @close(i32 noundef %221)
  %223 = load i32, ptr %15, align 4, !tbaa !5
  %224 = icmp slt i32 %223, 0
  br i1 %224, label %225, label %228

225:                                              ; preds = %217
  %226 = load i32, ptr %15, align 4, !tbaa !5
  %227 = sub nsw i32 0, %226
  br label %230

228:                                              ; preds = %217
  %229 = load i32, ptr %15, align 4, !tbaa !5
  br label %230

230:                                              ; preds = %228, %225
  %231 = phi i32 [ %227, %225 ], [ %229, %228 ]
  store i32 %231, ptr %4, align 4
  store i32 1, ptr %18, align 4
  br label %232

232:                                              ; preds = %230, %54, %43, %29, %23
  call void @llvm.lifetime.end.p0(i64 4096, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 256, ptr %8) #7
  %233 = load i32, ptr %4, align 4
  ret i32 %233
}

declare i32 @check_pgroup(i32 noundef) #3

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #1

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #5

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @do_dup2(ptr noundef, i32 noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @do_unmap(ptr noundef, i64 noundef, i64 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "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 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 #5 = { nounwind allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(none) }
attributes #9 = { nounwind allocsize(0) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !6, i64 16}
!14 = !{!"ptrace_child", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !12, i64 24, !12, i64 32, !15, i64 40}
!15 = !{!"user_regs_struct", !16, i64 0, !16, i64 8, !16, i64 16, !16, i64 24, !16, i64 32, !16, i64 40, !16, i64 48, !16, i64 56, !16, i64 64, !16, i64 72, !16, i64 80, !16, i64 88, !16, i64 96, !16, i64 104, !16, i64 112, !16, i64 120, !16, i64 128, !16, i64 136, !16, i64 144, !16, i64 152, !16, i64 160, !16, i64 168, !16, i64 176, !16, i64 184, !16, i64 192, !16, i64 200, !16, i64 208}
!16 = !{!"long long", !7, i64 0}
!17 = !{!18, !12, i64 88}
!18 = !{!"syscall_numbers", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !12, i64 152}
!19 = !{!18, !12, i64 24}
!20 = !{!14, !6, i64 0}
!21 = !{!18, !12, i64 104}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!18, !12, i64 96}


; 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.ptrace_child = type { i32, i32, i32, i32, i32, i64, i64, %struct.user_regs_struct }
%struct.user_regs_struct = type { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 }

@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [49 x i8], align 1

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @do_setsid(ptr noundef) local_unnamed_addr #2

declare void @debug(ptr noundef, ...) local_unnamed_addr #3

declare i32 @ptrace_restore_regs(ptr noundef) local_unnamed_addr #3

declare i64 @ptrace_remote_syscall(ptr noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #3

declare ptr @ptrace_syscall_numbers(ptr noundef) local_unnamed_addr #3

declare void @error(ptr noundef, ...) local_unnamed_addr #3

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

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

declare i32 @ptrace_detach_child(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @ignore_hup(ptr noundef, i64 noundef) local_unnamed_addr #2

declare i32 @ptrace_memcpy_to_child(ptr noundef, i64 noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local void @wait_for_stop(i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @copy_tty_state(i32 noundef, ptr noundef) local_unnamed_addr #2

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

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

declare i32 @close(i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare i64 @sysconf(i32 noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare dso_local i32 @grab_pid(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @preflight_check(i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local i32 @attach_child(i32 noundef %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = alloca %struct.ptrace_child, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca [4096 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %4) #11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #11
  store i64 -1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #11
  %8 = tail call i64 @sysconf(i32 noundef 30) #11
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %7) #11
  %9 = tail call i32 @check_pgroup(i32 noundef %0) #11
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %10, label %128

10:                                               ; preds = %3
  %11 = tail call i32 @preflight_check(i32 noundef %0)
  %.not70 = icmp eq i32 %11, 0
  br i1 %.not70, label %12, label %128

12:                                               ; preds = %10
  tail call void (ptr, ...) @debug(ptr noundef nonnull @.str.9, ptr noundef %1) #11
  %13 = tail call i32 @copy_tty_state(i32 noundef %0, ptr noundef %1)
  %.not71 = icmp eq i32 %13, 0
  br i1 %.not71, label %18, label %14

14:                                               ; preds = %12
  %15 = icmp ne i32 %13, 25
  %16 = icmp ne i32 %2, 0
  %or.cond = or i1 %16, %15
  br i1 %or.cond, label %18, label %17

17:                                               ; preds = %14
  tail call void (ptr, ...) @error(ptr noundef nonnull @.str.10) #11
  br label %128

18:                                               ; preds = %14, %12
  %19 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %7, i64 noundef 4096, ptr noundef nonnull @.str.11, i32 noundef %0) #11
  %20 = call i32 (ptr, i32, ...) @open(ptr noundef nonnull %7, i32 noundef 0) #11
  %21 = icmp slt i32 %20, 0
  br i1 %21, label %22, label %27

22:                                               ; preds = %18
  %23 = tail call ptr @__errno_location() #12
  %24 = load i32, ptr %23, align 4, !tbaa !9
  %25 = tail call ptr @strerror(i32 noundef %24) #11
  call void (ptr, ...) @error(ptr noundef nonnull @.str.12, ptr noundef nonnull %7, ptr noundef %25) #11
  %26 = sub nsw i32 0, %20
  br label %128

27:                                               ; preds = %18
  %28 = tail call i32 @kill(i32 noundef %0, i32 noundef 20) #11
  tail call void @wait_for_stop(i32 noundef %0, i32 noundef %20)
  %29 = call i32 @grab_pid(i32 noundef %0, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %.not72 = icmp eq i32 %29, 0
  br i1 %.not72, label %30, label %123

30:                                               ; preds = %27
  %.not73 = icmp eq i32 %2, 0
  br i1 %.not73, label %36, label %31

31:                                               ; preds = %30
  %32 = call noalias dereferenceable_or_null(12) ptr @malloc(i64 noundef 12) #13
  %.not75 = icmp eq ptr %32, null
  br i1 %.not75, label %111, label %33

33:                                               ; preds = %31
  store i32 3, ptr %6, align 4, !tbaa !9
  store i32 0, ptr %32, align 4, !tbaa !9
  %34 = getelementptr inbounds i8, ptr %32, i64 4
  store i32 1, ptr %34, align 4, !tbaa !9
  %35 = getelementptr inbounds i8, ptr %32, i64 8
  store i32 2, ptr %35, align 4, !tbaa !9
  br label %41

36:                                               ; preds = %30
  %37 = call ptr @get_child_tty_fds(ptr noundef nonnull %4, i32 noundef %20, ptr noundef nonnull %6) #11
  %.not74 = icmp eq ptr %37, null
  br i1 %.not74, label %38, label %41

38:                                               ; preds = %36
  %39 = getelementptr inbounds i8, ptr %4, i64 16
  %40 = load i32, ptr %39, align 8, !tbaa !11
  br label %111

41:                                               ; preds = %36, %33
  %.056 = phi ptr [ %32, %33 ], [ %37, %36 ]
  %42 = load i64, ptr %5, align 8, !tbaa !5
  %43 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #14
  %44 = add i64 %43, 1
  %45 = call i32 @ptrace_memcpy_to_child(ptr noundef nonnull %4, i64 noundef %42, ptr noundef %1, i64 noundef %44) #11
  %.not76 = icmp eq i32 %45, 0
  br i1 %.not76, label %49, label %46

46:                                               ; preds = %41
  %47 = getelementptr inbounds i8, ptr %4, i64 16
  %48 = load i32, ptr %47, align 8, !tbaa !11
  call void (ptr, ...) @error(ptr noundef nonnull @.str.13) #11
  br label %110

49:                                               ; preds = %41
  %50 = call ptr @ptrace_syscall_numbers(ptr noundef nonnull %4) #11
  %51 = getelementptr inbounds i8, ptr %50, i64 88
  %52 = load i64, ptr %51, align 8, !tbaa !15
  %53 = load i64, ptr %5, align 8, !tbaa !5
  %54 = call i64 @ptrace_remote_syscall(ptr noundef nonnull %4, i64 noundef %52, i64 noundef -1, i64 noundef %53, i64 noundef 258, i64 noundef 0, i64 noundef 0, i64 noundef 0) #11
  %55 = trunc i64 %54 to i32
  %56 = icmp slt i32 %55, 0
  br i1 %56, label %57, label %58

57:                                               ; preds = %49
  call void (ptr, ...) @error(ptr noundef nonnull @.str.14) #11
  br label %110

58:                                               ; preds = %49
  call void (ptr, ...) @debug(ptr noundef nonnull @.str.15, i32 noundef %55) #11
  %59 = load i64, ptr %5, align 8, !tbaa !5
  %60 = call i32 @ignore_hup(ptr noundef nonnull %4, i64 noundef %59)
  %61 = icmp slt i32 %60, 0
  br i1 %61, label %.loopexit, label %62

62:                                               ; preds = %58
  %63 = call ptr @ptrace_syscall_numbers(ptr noundef nonnull %4) #11
  %64 = getelementptr inbounds i8, ptr %63, i64 24
  %65 = load i64, ptr %64, align 8, !tbaa !17
  %66 = call i64 @ptrace_remote_syscall(ptr noundef nonnull %4, i64 noundef %65, i64 noundef 0, i64 noundef 0, i64 noundef 0, i64 noundef 0, i64 noundef 0, i64 noundef 0) #11
  %67 = trunc i64 %66 to i32
  %68 = load i32, ptr %4, align 8, !tbaa !18
  %.not77 = icmp eq i32 %68, %67
  br i1 %.not77, label %71, label %69

69:                                               ; preds = %62
  call void (ptr, ...) @debug(ptr noundef nonnull @.str.16) #11
  %70 = call i32 @do_setsid(ptr noundef nonnull %4)
  br label %78

71:                                               ; preds = %62
  %72 = call ptr @ptrace_syscall_numbers(ptr noundef nonnull %4) #11
  %73 = getelementptr inbounds i8, ptr %72, i64 104
  %74 = load i64, ptr %73, align 8, !tbaa !19
  %75 = load i32, ptr %.056, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = call i64 @ptrace_remote_syscall(ptr noundef nonnull %4, i64 noundef %74, i64 noundef %76, i64 noundef 21538, i64 noundef 0, i64 noundef 0, i64 noundef 0, i64 noundef 0) #11
  br label %78

78:                                               ; preds = %71, %69
  %.054 = phi i32 [ %70, %69 ], [ %67, %71 ]
  %79 = icmp slt i32 %.054, 0
  br i1 %79, label %.loopexit, label %80

80:                                               ; preds = %78
  %81 = call ptr @ptrace_syscall_numbers(ptr noundef nonnull %4) #11
  %82 = getelementptr inbounds i8, ptr %81, i64 104
  %83 = load i64, ptr %82, align 8, !tbaa !19
  %84 = and i64 %54, 2147483647
  %85 = call i64 @ptrace_remote_syscall(ptr noundef nonnull %4, i64 noundef %83, i64 noundef %84, i64 noundef 21518, i64 noundef 1, i64 noundef 0, i64 noundef 0, i64 noundef 0) #11
  %86 = trunc i64 %85 to i32
  %.not78 = icmp eq i32 %86, 0
  br i1 %.not78, label %89, label %87

87:                                               ; preds = %80
  %88 = call ptr @strerror(i32 noundef %86) #11
  call void (ptr, ...) @error(ptr noundef nonnull @.str.17, ptr noundef %88) #11
  br label %.loopexit

89:                                               ; preds = %80
  call void (ptr, ...) @debug(ptr noundef nonnull @.str.18) #11
  %90 = load i32, ptr %6, align 4, !tbaa !9
  %91 = icmp sgt i32 %90, 0
  br i1 %91, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %89, %101
  %indvars.iv = phi i64 [ %indvars.iv.next, %101 ], [ 0, %89 ]
  %92 = getelementptr inbounds i32, ptr %.056, i64 %indvars.iv
  %93 = load i32, ptr %92, align 4, !tbaa !9
  %94 = call i32 @do_dup2(ptr noundef nonnull %4, i32 noundef %55, i32 noundef %93)
  %95 = icmp slt i32 %94, 0
  br i1 %95, label %96, label %101

96:                                               ; preds = %.lr.ph
  %97 = load i32, ptr %92, align 4, !tbaa !9
  %98 = tail call ptr @__errno_location() #12
  %99 = load i32, ptr %98, align 4, !tbaa !9
  %100 = call ptr @strerror(i32 noundef %99) #11
  call void (ptr, ...) @error(ptr noundef nonnull @.str.19, i32 noundef %97, ptr noundef %100) #11
  br label %101

101:                                              ; preds = %.lr.ph, %96
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %102 = load i32, ptr %6, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = icmp slt i64 %indvars.iv.next, %103
  br i1 %104, label %.lr.ph, label %.loopexit, !llvm.loop !20

.loopexit:                                        ; preds = %101, %89, %78, %58, %87
  %.1 = phi i32 [ %60, %58 ], [ %.054, %78 ], [ %86, %87 ], [ 0, %89 ], [ 0, %101 ]
  %105 = call ptr @ptrace_syscall_numbers(ptr noundef nonnull %4) #11
  %106 = getelementptr inbounds i8, ptr %105, i64 96
  %107 = load i64, ptr %106, align 8, !tbaa !22
  %108 = and i64 %54, 2147483647
  %109 = call i64 @ptrace_remote_syscall(ptr noundef nonnull %4, i64 noundef %107, i64 noundef %108, i64 noundef 0, i64 noundef 0, i64 noundef 0, i64 noundef 0, i64 noundef 0) #11
  br label %110

110:                                              ; preds = %.loopexit, %57, %46
  %.2 = phi i32 [ %48, %46 ], [ %55, %57 ], [ %.1, %.loopexit ]
  call void @free(ptr noundef nonnull %.056) #11
  br label %111

111:                                              ; preds = %31, %110, %38
  %.3 = phi i32 [ %.2, %110 ], [ %40, %38 ], [ 12, %31 ]
  %112 = load i64, ptr %5, align 8, !tbaa !5
  call void @do_unmap(ptr noundef nonnull %4, i64 noundef %112, i64 noundef %8)
  %113 = call i32 @ptrace_restore_regs(ptr noundef nonnull %4) #11
  %114 = call i32 @ptrace_detach_child(ptr noundef nonnull %4) #11
  %115 = icmp eq i32 %.3, 0
  br i1 %115, label %116, label %120

116:                                              ; preds = %111
  %117 = load i32, ptr %4, align 8, !tbaa !18
  %118 = call i32 @kill(i32 noundef %117, i32 noundef 19) #11
  %119 = load i32, ptr %4, align 8, !tbaa !18
  call void @wait_for_stop(i32 noundef %119, i32 noundef %20)
  br label %120

120:                                              ; preds = %116, %111
  %121 = load i32, ptr %4, align 8, !tbaa !18
  %122 = call i32 @kill(i32 noundef %121, i32 noundef 28) #11
  br label %123

123:                                              ; preds = %27, %120
  %.4 = phi i32 [ %29, %27 ], [ %.3, %120 ]
  %124 = load i32, ptr %4, align 8, !tbaa !18
  %125 = call i32 @kill(i32 noundef %124, i32 noundef 18) #11
  %126 = call i32 @close(i32 noundef %20) #11
  %127 = call i32 @llvm.abs.i32(i32 %.4, i1 true)
  br label %128

128:                                              ; preds = %10, %3, %123, %22, %17
  %.0 = phi i32 [ %26, %22 ], [ %127, %123 ], [ 25, %17 ], [ %9, %3 ], [ %11, %10 ]
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %7) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #11
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %4) #11
  ret i32 %.0
}

declare i32 @check_pgroup(i32 noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #7

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #8

declare ptr @get_child_tty_fds(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
declare hidden i32 @do_dup2(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @do_unmap(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #10

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "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 = { 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 #6 = { 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 #7 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 #10 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #11 = { nounwind }
attributes #12 = { nounwind willreturn memory(none) }
attributes #13 = { nounwind allocsize(0) }
attributes #14 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 16}
!12 = !{!"ptrace_child", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !6, i64 24, !6, i64 32, !13, i64 40}
!13 = !{!"user_regs_struct", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !14, i64 48, !14, i64 56, !14, i64 64, !14, i64 72, !14, i64 80, !14, i64 88, !14, i64 96, !14, i64 104, !14, i64 112, !14, i64 120, !14, i64 128, !14, i64 136, !14, i64 144, !14, i64 152, !14, i64 160, !14, i64 168, !14, i64 176, !14, i64 184, !14, i64 192, !14, i64 200, !14, i64 208}
!14 = !{!"long long", !7, i64 0}
!15 = !{!16, !6, i64 88}
!16 = !{!"syscall_numbers", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152}
!17 = !{!16, !6, i64 24}
!18 = !{!12, !10, i64 0}
!19 = !{!16, !6, i64 104}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!16, !6, i64 96}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass