; LLVM IR from ihucos/plash :: chroot (chroot_main)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [47 x i8], align 1
@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [16 x i8], align 1
@environ = external global ptr, align 8
@.str.19 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

; Function Attrs: nounwind
declare noalias ptr @strdup(ptr noundef) #2

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #3

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @chroot_main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca [3 x ptr], align 8
  %14 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = icmp slt i32 %15, 2
  br i1 %16, label %17, label %20

17:                                               ; preds = %2
  %18 = load ptr, ptr @stderr, align 8, !tbaa !9
  %19 = call i32 @fputs(ptr noundef @.str.1, ptr noundef %18)
  store i32 1, ptr %3, align 4
  br label %129

20:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %21 = load ptr, ptr %5, align 8, !tbaa !9
  %22 = getelementptr inbounds ptr, ptr %21, i64 1
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  store ptr %23, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %24 = call ptr @get_current_dir_name() #6
  store ptr %24, ptr %7, align 8, !tbaa !9
  call void (...) @pl_unshare_mount()
  %25 = load ptr, ptr %6, align 8, !tbaa !9
  %26 = call i32 @chdir(ptr noundef %25) #6
  %27 = icmp eq i32 %26, -1
  br i1 %27, label %28, label %31

28:                                               ; preds = %20
  %29 = load ptr, ptr %6, align 8, !tbaa !9
  %30 = call i32 (ptr, ...) @pl_fatal(ptr noundef @.str.2, ptr noundef %29)
  br label %31

31:                                               ; preds = %28, %20
  call void @pl_bind_mount(ptr noundef @.str.3, ptr noundef @.str.4)
  call void @pl_bind_mount(ptr noundef @.str.5, ptr noundef @.str.6)
  call void @pl_bind_mount(ptr noundef @.str.7, ptr noundef @.str.8)
  call void @pl_bind_mount(ptr noundef @.str.9, ptr noundef @.str.10)
  call void @pl_bind_mount(ptr noundef @.str.11, ptr noundef @.str.12)
  call void @pl_bind_mount(ptr noundef @.str.13, ptr noundef @.str.14)
  call void @pl_bind_mount(ptr noundef @.str.15, ptr noundef @.str.16)
  call void @pl_bind_mount(ptr noundef @.str.17, ptr noundef @.str.18)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %32 = load ptr, ptr @environ, align 8, !tbaa !9
  store ptr %32, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %33 = call ptr @getenv(ptr noundef @.str.19) #6
  store ptr %33, ptr %11, align 8, !tbaa !9
  %34 = load ptr, ptr %11, align 8, !tbaa !9
  %35 = icmp ne ptr %34, null
  br i1 %35, label %37, label %36

36:                                               ; preds = %31
  store ptr @.str.20, ptr %11, align 8, !tbaa !9
  br label %37

37:                                               ; preds = %36, %31
  br label %38

38:                                               ; preds = %89, %37
  %39 = load ptr, ptr %8, align 8, !tbaa !9
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  %41 = icmp ne ptr %40, null
  br i1 %41, label %42, label %92

42:                                               ; preds = %38
  %43 = load ptr, ptr %8, align 8, !tbaa !9
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  %45 = call i32 (ptr, ptr, ...) @asprintf(ptr noundef %10, ptr noundef @.str.21, ptr noundef %44) #6
  %46 = icmp eq i32 %45, -1
  br i1 %46, label %47, label %49

47:                                               ; preds = %42
  %48 = call i32 (ptr, ...) @pl_fatal(ptr noundef @.str.22)
  br label %49

49:                                               ; preds = %47, %42
  %50 = load ptr, ptr %10, align 8, !tbaa !9
  %51 = call i32 @putenv(ptr noundef %50) #6
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %55

53:                                               ; preds = %49
  %54 = call i32 (ptr, ...) @pl_fatal(ptr noundef @.str.23)
  br label %55

55:                                               ; preds = %53, %49
  %56 = load ptr, ptr %8, align 8, !tbaa !9
  %57 = load ptr, ptr %56, align 8, !tbaa !9
  %58 = call noalias ptr @strdup(ptr noundef %57) #6
  %59 = call ptr @strtok(ptr noundef %58, ptr noundef @.str.24) #6
  store ptr %59, ptr %9, align 8, !tbaa !9
  %60 = load ptr, ptr %9, align 8, !tbaa !9
  %61 = icmp eq ptr %60, null
  br i1 %61, label %62, label %64

62:                                               ; preds = %55
  %63 = call i32 (ptr, ...) @pl_fatal(ptr noundef @.str.25)
  br label %64

64:                                               ; preds = %62, %55
  %65 = load ptr, ptr %9, align 8, !tbaa !9
  %66 = call i32 @strcmp(ptr noundef %65, ptr noundef @.str.26) #7
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %89, label %68

68:                                               ; preds = %64
  %69 = load ptr, ptr %9, align 8, !tbaa !9
  %70 = call i32 @strcmp(ptr noundef %69, ptr noundef @.str.27) #7
  %71 = icmp eq i32 %70, 0
  br i1 %71, label %89, label %72

72:                                               ; preds = %68
  %73 = load ptr, ptr %9, align 8, !tbaa !9
  %74 = call i32 @strcmp(ptr noundef %73, ptr noundef @.str.28) #7
  %75 = icmp eq i32 %74, 0
  br i1 %75, label %89, label %76

76:                                               ; preds = %72
  %77 = load ptr, ptr %11, align 8, !tbaa !9
  %78 = load ptr, ptr %9, align 8, !tbaa !9
  %79 = call i32 @is_delimited_substring2(ptr noundef %77, ptr noundef %78, ptr noundef @.str)
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %89, label %81

81:                                               ; preds = %76
  %82 = load ptr, ptr %9, align 8, !tbaa !9
  %83 = call i32 @unsetenv(ptr noundef %82) #6
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %87

85:                                               ; preds = %81
  %86 = call i32 (ptr, ...) @pl_fatal(ptr noundef @.str.29)
  br label %87

87:                                               ; preds = %85, %81
  %88 = load ptr, ptr %9, align 8, !tbaa !9
  call void @free(ptr noundef %88) #6
  br label %89

89:                                               ; preds = %87, %76, %72, %68, %64
  %90 = load ptr, ptr %8, align 8, !tbaa !9
  %91 = getelementptr inbounds ptr, ptr %90, i32 1
  store ptr %91, ptr %8, align 8, !tbaa !9
  br label %38, !llvm.loop !11

92:                                               ; preds = %38
  %93 = call i32 @chroot(ptr noundef @.str.30) #6
  %94 = icmp ne i32 %93, -1
  br i1 %94, label %98, label %95

95:                                               ; preds = %92
  %96 = call i32 (ptr, ...) @pl_fatal(ptr noundef @.str.31)
  %97 = icmp ne i32 %96, 0
  br label %98

98:                                               ; preds = %95, %92
  %99 = phi i1 [ true, %92 ], [ %97, %95 ]
  %100 = zext i1 %99 to i32
  %101 = load ptr, ptr %7, align 8, !tbaa !9
  call void @pl_chdir(ptr noundef %101)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %102 = load ptr, ptr %5, align 8, !tbaa !9
  %103 = getelementptr inbounds ptr, ptr %102, i64 2
  store ptr %103, ptr %12, align 8, !tbaa !9
  %104 = load ptr, ptr %12, align 8, !tbaa !9
  %105 = load ptr, ptr %104, align 8, !tbaa !9
  %106 = icmp eq ptr %105, null
  br i1 %106, label %107, label %112

107:                                              ; preds = %98
  %108 = call ptr (...) @pl_get_default_root_shell()
  store ptr %108, ptr %13, align 8, !tbaa !9
  %109 = getelementptr inbounds ptr, ptr %13, i64 1
  store ptr @.str.32, ptr %109, align 8, !tbaa !9
  %110 = getelementptr inbounds ptr, ptr %13, i64 2
  store ptr null, ptr %110, align 8, !tbaa !9
  %111 = getelementptr inbounds [3 x ptr], ptr %13, i64 0, i64 0
  store ptr %111, ptr %12, align 8, !tbaa !9
  br label %112

112:                                              ; preds = %107, %98
  %113 = load ptr, ptr %12, align 8, !tbaa !9
  %114 = load ptr, ptr %113, align 8, !tbaa !9
  %115 = load ptr, ptr %12, align 8, !tbaa !9
  %116 = call i32 @execvp(ptr noundef %114, ptr noundef %115) #6
  %117 = call ptr @__errno_location() #8
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = icmp eq i32 %118, 2
  br i1 %119, label %120, label %125

120:                                              ; preds = %112
  %121 = load ptr, ptr @stderr, align 8, !tbaa !9
  %122 = load ptr, ptr %12, align 8, !tbaa !9
  %123 = load ptr, ptr %122, align 8, !tbaa !9
  %124 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %121, ptr noundef @.str.33, ptr noundef %123) #6
  store i32 127, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %127

125:                                              ; preds = %112
  %126 = call i32 (ptr, ...) @pl_fatal(ptr noundef @.str.34)
  store i32 0, ptr %14, align 4
  br label %127

127:                                              ; preds = %125, %120
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %128 = load i32, ptr %14, align 4
  switch i32 %128, label %131 [
    i32 0, label %129
    i32 1, label %129
  ]

129:                                              ; preds = %127, %127, %17
  %130 = load i32, ptr %3, align 4
  ret i32 %130

131:                                              ; preds = %127
  unreachable
}

declare i32 @fputs(ptr noundef, ptr noundef) #4

; Function Attrs: nounwind
declare ptr @get_current_dir_name() #2

declare void @pl_unshare_mount(...) #4

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

declare i32 @pl_fatal(ptr noundef, ...) #4

declare void @pl_bind_mount(ptr noundef, ptr noundef) #4

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

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

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

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

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

declare void @pl_chdir(ptr noundef) #4

declare ptr @pl_get_default_root_shell(...) #4

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

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { "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 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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { nounwind willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [47 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [16 x i8], align 1
@environ = external local_unnamed_addr global ptr, align 8
@.str.19 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @is_delimited_substring2(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #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 nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias ptr @strdup(ptr nocapture noundef readonly) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn
declare ptr @strtok(ptr noundef, ptr nocapture noundef readonly) local_unnamed_addr #3

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

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 1, 128) i32 @chroot_main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca ptr, align 8
  %4 = alloca [3 x ptr], align 8
  %5 = icmp slt i32 %0, 2
  br i1 %5, label %6, label %9

6:                                                ; preds = %2
  %7 = load ptr, ptr @stderr, align 8, !tbaa !5
  %8 = tail call i32 @fputs(ptr noundef nonnull @.str.1, ptr noundef %7) #11
  br label %81

9:                                                ; preds = %2
  %10 = getelementptr inbounds i8, ptr %1, i64 8
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = tail call ptr @get_current_dir_name() #12
  tail call void (...) @pl_unshare_mount() #12
  %13 = tail call i32 @chdir(ptr noundef %11) #12
  %14 = icmp eq i32 %13, -1
  br i1 %14, label %15, label %17

15:                                               ; preds = %9
  %16 = tail call i32 (ptr, ...) @pl_fatal(ptr noundef nonnull @.str.2, ptr noundef %11) #12
  br label %17

17:                                               ; preds = %15, %9
  tail call void @pl_bind_mount(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4) #12
  tail call void @pl_bind_mount(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.6) #12
  tail call void @pl_bind_mount(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.8) #12
  tail call void @pl_bind_mount(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.10) #12
  tail call void @pl_bind_mount(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.12) #12
  tail call void @pl_bind_mount(ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.14) #12
  tail call void @pl_bind_mount(ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.16) #12
  tail call void @pl_bind_mount(ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.18) #12
  %18 = load ptr, ptr @environ, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #12
  %19 = tail call ptr @getenv(ptr noundef nonnull @.str.19) #12
  %.not = icmp eq ptr %19, null
  %spec.store.select = select i1 %.not, ptr @.str.20, ptr %19
  %20 = load ptr, ptr %18, align 8, !tbaa !5
  %.not2631 = icmp eq ptr %20, null
  br i1 %.not2631, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %17, %54
  %21 = phi ptr [ %56, %54 ], [ %20, %17 ]
  %.02432 = phi ptr [ %55, %54 ], [ %18, %17 ]
  %22 = call i32 (ptr, ptr, ...) @asprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.21, ptr noundef nonnull %21) #12
  %23 = icmp eq i32 %22, -1
  br i1 %23, label %24, label %26

24:                                               ; preds = %.lr.ph
  %25 = call i32 (ptr, ...) @pl_fatal(ptr noundef nonnull @.str.22) #12
  br label %26

26:                                               ; preds = %24, %.lr.ph
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = call i32 @putenv(ptr noundef %27) #12
  %.not28 = icmp eq i32 %28, 0
  br i1 %.not28, label %31, label %29

29:                                               ; preds = %26
  %30 = call i32 (ptr, ...) @pl_fatal(ptr noundef nonnull @.str.23) #12
  br label %31

31:                                               ; preds = %29, %26
  %32 = load ptr, ptr %.02432, align 8, !tbaa !5
  %33 = call noalias ptr @strdup(ptr noundef %32) #12
  %34 = call ptr @strtok(ptr noundef %33, ptr noundef nonnull @.str.24) #12
  %35 = icmp eq ptr %34, null
  br i1 %35, label %36, label %38

36:                                               ; preds = %31
  %37 = call i32 (ptr, ...) @pl_fatal(ptr noundef nonnull @.str.25) #12
  br label %38

38:                                               ; preds = %36, %31
  %39 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %34, ptr noundef nonnull dereferenceable(1) @.str.26) #13
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %54, label %41

41:                                               ; preds = %38
  %42 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %34, ptr noundef nonnull dereferenceable(1) @.str.27) #13
  %43 = icmp eq i32 %42, 0
  br i1 %43, label %54, label %44

44:                                               ; preds = %41
  %45 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %34, ptr noundef nonnull dereferenceable(1) @.str.28) #13
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %54, label %47

47:                                               ; preds = %44
  %48 = call i32 @is_delimited_substring2(ptr noundef nonnull %spec.store.select, ptr noundef %34, ptr noundef nonnull @.str)
  %.not29 = icmp eq i32 %48, 0
  br i1 %.not29, label %49, label %54

49:                                               ; preds = %47
  %50 = call i32 @unsetenv(ptr noundef %34) #12
  %.not30 = icmp eq i32 %50, 0
  br i1 %.not30, label %53, label %51

51:                                               ; preds = %49
  %52 = call i32 (ptr, ...) @pl_fatal(ptr noundef nonnull @.str.29) #12
  br label %53

53:                                               ; preds = %51, %49
  call void @free(ptr noundef %34) #12
  br label %54

54:                                               ; preds = %53, %47, %44, %41, %38
  %55 = getelementptr inbounds i8, ptr %.02432, i64 8
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  %.not26 = icmp eq ptr %56, null
  br i1 %.not26, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %54, %17
  %57 = call i32 @chroot(ptr noundef nonnull @.str.30) #12
  %.not27 = icmp eq i32 %57, -1
  br i1 %.not27, label %58, label %60

58:                                               ; preds = %._crit_edge
  %59 = call i32 (ptr, ...) @pl_fatal(ptr noundef nonnull @.str.31) #12
  br label %60

60:                                               ; preds = %58, %._crit_edge
  call void @pl_chdir(ptr noundef %12) #12
  %61 = getelementptr inbounds i8, ptr %1, i64 16
  %62 = load ptr, ptr %61, align 8, !tbaa !5
  %63 = icmp eq ptr %62, null
  br i1 %63, label %64, label %68

64:                                               ; preds = %60
  %65 = call ptr (...) @pl_get_default_root_shell() #12
  store ptr %65, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %4, i64 8
  store ptr @.str.32, ptr %66, align 8, !tbaa !5
  %67 = getelementptr inbounds i8, ptr %4, i64 16
  store ptr null, ptr %67, align 8, !tbaa !5
  br label %68

68:                                               ; preds = %64, %60
  %69 = phi ptr [ %65, %64 ], [ %62, %60 ]
  %.0 = phi ptr [ %4, %64 ], [ %61, %60 ]
  %70 = call i32 @execvp(ptr noundef %69, ptr noundef nonnull %.0) #12
  %71 = tail call ptr @__errno_location() #14
  %72 = load i32, ptr %71, align 4, !tbaa !11
  %73 = icmp eq i32 %72, 2
  br i1 %73, label %74, label %78

74:                                               ; preds = %68
  %75 = load ptr, ptr @stderr, align 8, !tbaa !5
  %76 = load ptr, ptr %.0, align 8, !tbaa !5
  %77 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %75, ptr noundef nonnull @.str.33, ptr noundef %76) #15
  br label %80

78:                                               ; preds = %68
  %79 = call i32 (ptr, ...) @pl_fatal(ptr noundef nonnull @.str.34) #12
  br label %80

80:                                               ; preds = %78, %74
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #12
  br label %81

81:                                               ; preds = %80, %6
  %.1 = phi i32 [ 1, %6 ], [ 127, %80 ]
  ret i32 %.1
}

; Function Attrs: nofree nounwind
declare noundef i32 @fputs(ptr nocapture noundef readonly, ptr nocapture noundef) local_unnamed_addr #6

; Function Attrs: nounwind
declare ptr @get_current_dir_name() local_unnamed_addr #7

declare void @pl_unshare_mount(...) local_unnamed_addr #8

; Function Attrs: nounwind
declare i32 @chdir(ptr noundef) local_unnamed_addr #7

declare i32 @pl_fatal(ptr noundef, ...) local_unnamed_addr #8

declare void @pl_bind_mount(ptr noundef, ptr noundef) local_unnamed_addr #8

; Function Attrs: nofree nounwind memory(read)
declare noundef ptr @getenv(ptr nocapture noundef) local_unnamed_addr #9

; Function Attrs: nounwind
declare i32 @asprintf(ptr noundef, ptr noundef, ...) local_unnamed_addr #7

; Function Attrs: nounwind
declare i32 @putenv(ptr noundef) local_unnamed_addr #7

; Function Attrs: nofree nounwind
declare noundef i32 @unsetenv(ptr nocapture noundef readonly) local_unnamed_addr #6

; Function Attrs: nounwind
declare i32 @chroot(ptr noundef) local_unnamed_addr #7

declare void @pl_chdir(ptr noundef) local_unnamed_addr #8

declare ptr @pl_get_default_root_shell(...) local_unnamed_addr #8

; Function Attrs: nofree nounwind
declare i32 @execvp(ptr noundef, ptr noundef) local_unnamed_addr #6

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

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #6

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn 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 #3 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress 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 #6 = { 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 #7 = { 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 = { "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 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 #10 = { 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 #11 = { cold }
attributes #12 = { nounwind }
attributes #13 = { nounwind willreturn memory(read) }
attributes #14 = { nounwind willreturn memory(none) }
attributes #15 = { cold nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}


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