; LLVM IR from golems/ach :: src/test (achstress)

; 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.__sigset_t = type { [16 x i64] }

@.str = external hidden unnamed_addr constant [13 x i8], align 1
@optarg = external global ptr, align 8
@opt_n_pub = external hidden global i64, align 8
@opt_n_sub = external hidden global i64, align 8
@opt_n_sig = external hidden global i64, align 8
@opt_n_chan = external hidden global i64, align 8
@opt_verbosity = external hidden global i32, align 4
@opt_map = external hidden global i32, align 4
@opt_poll = external hidden global i8, align 1
@.str.1 = external hidden unnamed_addr constant [593 x i8], align 1
@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [24 x i8], align 1
@g_pid_pub = external hidden global ptr, align 8
@g_pid_sub = external hidden global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @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 i32, align 4
  %7 = alloca %struct.__sigset_t, align 8
  %8 = alloca %struct.__sigset_t, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 128, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 128, ptr %8) #7
  br label %14

14:                                               ; preds = %45, %2
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = load ptr, ptr %5, align 8, !tbaa !9
  %17 = call i32 @getopt(i32 noundef %15, ptr noundef %16, ptr noundef @.str) #7
  store i32 %17, ptr %6, align 4, !tbaa !5
  %18 = icmp ne i32 %17, -1
  br i1 %18, label %19, label %46

19:                                               ; preds = %14
  %20 = load i32, ptr %6, align 4, !tbaa !5
  switch i32 %20, label %45 [
    i32 112, label %21
    i32 115, label %25
    i32 105, label %29
    i32 99, label %33
    i32 118, label %37
    i32 107, label %40
    i32 117, label %41
    i32 80, label %42
    i32 63, label %43
    i32 104, label %43
    i32 72, label %43
  ]

21:                                               ; preds = %19
  %22 = load ptr, ptr @optarg, align 8, !tbaa !9
  %23 = call i32 @atoi(ptr noundef %22) #8
  %24 = sext i32 %23 to i64
  store i64 %24, ptr @opt_n_pub, align 8, !tbaa !11
  br label %45

25:                                               ; preds = %19
  %26 = load ptr, ptr @optarg, align 8, !tbaa !9
  %27 = call i32 @atoi(ptr noundef %26) #8
  %28 = sext i32 %27 to i64
  store i64 %28, ptr @opt_n_sub, align 8, !tbaa !11
  br label %45

29:                                               ; preds = %19
  %30 = load ptr, ptr @optarg, align 8, !tbaa !9
  %31 = call i32 @atoi(ptr noundef %30) #8
  %32 = sext i32 %31 to i64
  store i64 %32, ptr @opt_n_sig, align 8, !tbaa !11
  br label %45

33:                                               ; preds = %19
  %34 = load ptr, ptr @optarg, align 8, !tbaa !9
  %35 = call i32 @atoi(ptr noundef %34) #8
  %36 = sext i32 %35 to i64
  store i64 %36, ptr @opt_n_chan, align 8, !tbaa !11
  br label %45

37:                                               ; preds = %19
  %38 = load i32, ptr @opt_verbosity, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr @opt_verbosity, align 4, !tbaa !5
  br label %45

40:                                               ; preds = %19
  store i32 3, ptr @opt_map, align 4, !tbaa !5
  br label %45

41:                                               ; preds = %19
  store i32 2, ptr @opt_map, align 4, !tbaa !5
  br label %45

42:                                               ; preds = %19
  store i8 1, ptr @opt_poll, align 1, !tbaa !13
  br label %45

43:                                               ; preds = %19, %19, %19
  %44 = call i32 @puts(ptr noundef @.str.1)
  call void @exit(i32 noundef 0) #9
  unreachable

45:                                               ; preds = %42, %41, %40, %37, %33, %29, %25, %21, %19
  br label %14, !llvm.loop !15

46:                                               ; preds = %14
  %47 = load i32, ptr @opt_verbosity, align 4, !tbaa !5
  %48 = icmp sle i32 1, %47
  br i1 %48, label %49, label %53

49:                                               ; preds = %46
  %50 = load ptr, ptr @stderr, align 8, !tbaa !9
  %51 = load i64, ptr @opt_n_pub, align 8, !tbaa !11
  %52 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef @.str.2, i64 noundef %51) #7
  br label %53

53:                                               ; preds = %49, %46
  %54 = load i32, ptr @opt_verbosity, align 4, !tbaa !5
  %55 = icmp sle i32 1, %54
  br i1 %55, label %56, label %60

56:                                               ; preds = %53
  %57 = load ptr, ptr @stderr, align 8, !tbaa !9
  %58 = load i64, ptr @opt_n_sub, align 8, !tbaa !11
  %59 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef @.str.3, i64 noundef %58) #7
  br label %60

60:                                               ; preds = %56, %53
  %61 = load i32, ptr @opt_verbosity, align 4, !tbaa !5
  %62 = icmp sle i32 1, %61
  br i1 %62, label %63, label %67

63:                                               ; preds = %60
  %64 = load ptr, ptr @stderr, align 8, !tbaa !9
  %65 = load i64, ptr @opt_n_sig, align 8, !tbaa !11
  %66 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %64, ptr noundef @.str.4, i64 noundef %65) #7
  br label %67

67:                                               ; preds = %63, %60
  %68 = load i32, ptr @opt_verbosity, align 4, !tbaa !5
  %69 = icmp sle i32 1, %68
  br i1 %69, label %70, label %74

70:                                               ; preds = %67
  %71 = load ptr, ptr @stderr, align 8, !tbaa !9
  %72 = load i64, ptr @opt_n_chan, align 8, !tbaa !11
  %73 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %71, ptr noundef @.str.5, i64 noundef %72) #7
  br label %74

74:                                               ; preds = %70, %67
  %75 = load i32, ptr @opt_verbosity, align 4, !tbaa !5
  %76 = icmp sle i32 1, %75
  br i1 %76, label %77, label %81

77:                                               ; preds = %74
  %78 = load ptr, ptr @stderr, align 8, !tbaa !9
  %79 = load i32, ptr @opt_map, align 4, !tbaa !5
  %80 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %78, ptr noundef @.str.6, i32 noundef %79) #7
  br label %81

81:                                               ; preds = %77, %74
  call void @create_channels()
  call void @sighandler_install(i32 noundef 2, ptr noundef @sighandler_nop)
  call void @sighandler_install(i32 noundef 17, ptr noundef @sighandler_nop)
  call void @sighandler_install(i32 noundef 10, ptr noundef @sighandler_ready)
  %82 = call i32 @sigemptyset(ptr noundef %7) #7
  call void @check_errno(ptr noundef @.str.7, i32 noundef %82)
  %83 = call i32 @sigemptyset(ptr noundef %8) #7
  call void @check_errno(ptr noundef @.str.7, i32 noundef %83)
  %84 = call i32 @sigaddset(ptr noundef %7, i32 noundef 17) #7
  call void @check_errno(ptr noundef @.str.8, i32 noundef %84)
  %85 = call i32 @sigaddset(ptr noundef %7, i32 noundef 10) #7
  call void @check_errno(ptr noundef @.str.8, i32 noundef %85)
  %86 = call i32 @sigprocmask(i32 noundef 2, ptr noundef %7, ptr noundef null) #7
  call void @check_errno(ptr noundef @.str.9, i32 noundef %86)
  call void @start_workers()
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  br label %87

87:                                               ; preds = %149, %81
  %88 = load i32, ptr %9, align 4, !tbaa !5
  %89 = zext i32 %88 to i64
  %90 = load i64, ptr @opt_n_pub, align 8, !tbaa !11
  %91 = load i64, ptr @opt_n_sig, align 8, !tbaa !11
  %92 = add i64 %90, %91
  %93 = load i64, ptr @opt_n_sig, align 8, !tbaa !11
  %94 = add i64 %92, %93
  %95 = icmp ult i64 %89, %94
  br i1 %95, label %96, label %150

96:                                               ; preds = %87
  %97 = call i32 @sigsuspend(ptr noundef %8)
  %98 = call ptr @__errno_location() #10
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = icmp ne i32 4, %99
  br i1 %100, label %101, label %102

101:                                              ; preds = %96
  call void @perror(ptr noundef @.str.10)
  store i32 7, ptr %12, align 4
  br label %158

102:                                              ; preds = %96
  br label %103

103:                                              ; preds = %148, %102
  %104 = call i32 @waitpid(i32 noundef -1, ptr noundef %10, i32 noundef 1)
  store i32 %104, ptr %11, align 4, !tbaa !5
  %105 = icmp slt i32 0, %104
  br i1 %105, label %106, label %149

106:                                              ; preds = %103
  %107 = load i32, ptr @opt_verbosity, align 4, !tbaa !5
  %108 = icmp sle i32 1, %107
  br i1 %108, label %109, label %113

109:                                              ; preds = %106
  %110 = load ptr, ptr @stderr, align 8, !tbaa !9
  %111 = load i32, ptr %11, align 4, !tbaa !5
  %112 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %110, ptr noundef @.str.11, i32 noundef %111) #7
  br label %113

113:                                              ; preds = %109, %106
  %114 = load i32, ptr %10, align 4, !tbaa !5
  %115 = and i32 %114, 127
  %116 = add nsw i32 %115, 1
  %117 = trunc i32 %116 to i8
  %118 = sext i8 %117 to i32
  %119 = ashr i32 %118, 1
  %120 = icmp sgt i32 %119, 0
  br i1 %120, label %121, label %129

121:                                              ; preds = %113
  %122 = load ptr, ptr @stderr, align 8, !tbaa !9
  %123 = load i32, ptr %10, align 4, !tbaa !5
  %124 = and i32 %123, 127
  %125 = call ptr @strsignal(i32 noundef %124) #7
  %126 = load i32, ptr %10, align 4, !tbaa !5
  %127 = and i32 %126, 127
  %128 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %122, ptr noundef @.str.12, ptr noundef %125, i32 noundef %127) #7
  store i32 7, ptr %12, align 4
  br label %158

129:                                              ; preds = %113
  %130 = load i32, ptr %10, align 4, !tbaa !5
  %131 = and i32 %130, 127
  %132 = icmp eq i32 %131, 0
  br i1 %132, label %133, label %148

133:                                              ; preds = %129
  %134 = load i32, ptr %9, align 4, !tbaa !5
  %135 = add i32 %134, 1
  store i32 %135, ptr %9, align 4, !tbaa !5
  %136 = load i32, ptr %10, align 4, !tbaa !5
  %137 = and i32 %136, 65280
  %138 = ashr i32 %137, 8
  %139 = icmp ne i32 %138, 0
  br i1 %139, label %140, label %147

140:                                              ; preds = %133
  %141 = load ptr, ptr @stderr, align 8, !tbaa !9
  %142 = load i32, ptr %11, align 4, !tbaa !5
  %143 = load i32, ptr %10, align 4, !tbaa !5
  %144 = and i32 %143, 65280
  %145 = ashr i32 %144, 8
  %146 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %141, ptr noundef @.str.13, i32 noundef %142, i32 noundef %145) #7
  store i32 7, ptr %12, align 4
  br label %158

147:                                              ; preds = %133
  br label %148

148:                                              ; preds = %147, %129
  br label %103, !llvm.loop !17

149:                                              ; preds = %103
  br label %87, !llvm.loop !18

150:                                              ; preds = %87
  %151 = load i32, ptr @opt_verbosity, align 4, !tbaa !5
  %152 = icmp sle i32 1, %151
  br i1 %152, label %153, label %157

153:                                              ; preds = %150
  %154 = load ptr, ptr @stderr, align 8, !tbaa !9
  %155 = load i32, ptr %9, align 4, !tbaa !5
  %156 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %154, ptr noundef @.str.14, i32 noundef %155) #7
  br label %157

157:                                              ; preds = %153, %150
  store i32 0, ptr %12, align 4
  br label %158

158:                                              ; preds = %157, %140, %121, %101
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  %159 = load i32, ptr %12, align 4
  switch i32 %159, label %186 [
    i32 0, label %160
    i32 7, label %161
  ]

160:                                              ; preds = %158
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %186

161:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  store i64 0, ptr %13, align 8, !tbaa !11
  br label %162

162:                                              ; preds = %166, %161
  %163 = load i64, ptr %13, align 8, !tbaa !11
  %164 = load i64, ptr @opt_n_pub, align 8, !tbaa !11
  %165 = icmp ult i64 %163, %164
  br i1 %165, label %166, label %173

166:                                              ; preds = %162
  %167 = load ptr, ptr @g_pid_pub, align 8, !tbaa !9
  %168 = load i64, ptr %13, align 8, !tbaa !11
  %169 = add i64 %168, 1
  store i64 %169, ptr %13, align 8, !tbaa !11
  %170 = getelementptr inbounds i32, ptr %167, i64 %168
  %171 = load i32, ptr %170, align 4, !tbaa !5
  %172 = call i32 @kill(i32 noundef %171, i32 noundef 15) #7
  br label %162, !llvm.loop !19

173:                                              ; preds = %162
  store i64 0, ptr %13, align 8, !tbaa !11
  br label %174

174:                                              ; preds = %178, %173
  %175 = load i64, ptr %13, align 8, !tbaa !11
  %176 = load i64, ptr @opt_n_sub, align 8, !tbaa !11
  %177 = icmp ult i64 %175, %176
  br i1 %177, label %178, label %185

178:                                              ; preds = %174
  %179 = load ptr, ptr @g_pid_sub, align 8, !tbaa !9
  %180 = load i64, ptr %13, align 8, !tbaa !11
  %181 = add i64 %180, 1
  store i64 %181, ptr %13, align 8, !tbaa !11
  %182 = getelementptr inbounds i32, ptr %179, i64 %180
  %183 = load i32, ptr %182, align 4, !tbaa !5
  %184 = call i32 @kill(i32 noundef %183, i32 noundef 15) #7
  br label %174, !llvm.loop !20

185:                                              ; preds = %174
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  store i32 1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %186

186:                                              ; preds = %185, %160, %158
  call void @llvm.lifetime.end.p0(i64 128, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 128, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %187 = load i32, ptr %3, align 4
  ret i32 %187
}

; 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 i32 @getopt(i32 noundef, ptr noundef, ptr noundef) #2

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #3

declare i32 @puts(ptr noundef) #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #5

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

; Function Attrs: nounwind uwtable
declare hidden void @create_channels() #0

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

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

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

declare void @check_errno(ptr noundef, i32 noundef) #4

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @start_workers() #0

declare i32 @sigsuspend(ptr noundef) #4

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

declare void @perror(ptr noundef) #4

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

; Function Attrs: nounwind
declare ptr @strsignal(i32 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
declare i32 @kill(i32 noundef, i32 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 = { inlinehint nounwind willreturn memory(read) 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 #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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind 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 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { noreturn nounwind }
attributes #10 = { 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 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16}


; 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.__sigset_t = type { [16 x i64] }

@.str = external hidden unnamed_addr constant [13 x i8], align 1
@optarg = external local_unnamed_addr global ptr, align 8
@opt_n_pub = external hidden local_unnamed_addr global i64, align 8
@opt_n_sub = external hidden local_unnamed_addr global i64, align 8
@opt_n_sig = external hidden local_unnamed_addr global i64, align 8
@opt_n_chan = external hidden local_unnamed_addr global i64, align 8
@opt_verbosity = external hidden local_unnamed_addr global i32, align 4
@opt_map = external hidden local_unnamed_addr global i32, align 4
@opt_poll = external hidden local_unnamed_addr global i8, align 1
@.str.1 = external hidden unnamed_addr constant [593 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [24 x i8], align 1
@g_pid_pub = external hidden local_unnamed_addr global ptr, align 8
@g_pid_sub = external hidden local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.__sigset_t, align 8
  %4 = alloca %struct.__sigset_t, align 8
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %4) #8
  br label %6

6:                                                ; preds = %.backedge, %2
  %7 = tail call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str) #8
  switch i32 %7, label %.backedge [
    i32 -1, label %32
    i32 112, label %8
    i32 115, label %12
    i32 105, label %16
    i32 99, label %20
    i32 118, label %24
    i32 107, label %27
    i32 117, label %28
    i32 80, label %29
    i32 63, label %30
    i32 104, label %30
    i32 72, label %30
  ]

.backedge:                                        ; preds = %6, %29, %28, %27, %24, %20, %16, %12, %8
  br label %6, !llvm.loop !5

8:                                                ; preds = %6
  %9 = load ptr, ptr @optarg, align 8, !tbaa !7
  %10 = tail call i32 @atoi(ptr nocapture noundef %9) #9
  %11 = sext i32 %10 to i64
  store i64 %11, ptr @opt_n_pub, align 8, !tbaa !11
  br label %.backedge

12:                                               ; preds = %6
  %13 = load ptr, ptr @optarg, align 8, !tbaa !7
  %14 = tail call i32 @atoi(ptr nocapture noundef %13) #9
  %15 = sext i32 %14 to i64
  store i64 %15, ptr @opt_n_sub, align 8, !tbaa !11
  br label %.backedge

16:                                               ; preds = %6
  %17 = load ptr, ptr @optarg, align 8, !tbaa !7
  %18 = tail call i32 @atoi(ptr nocapture noundef %17) #9
  %19 = sext i32 %18 to i64
  store i64 %19, ptr @opt_n_sig, align 8, !tbaa !11
  br label %.backedge

20:                                               ; preds = %6
  %21 = load ptr, ptr @optarg, align 8, !tbaa !7
  %22 = tail call i32 @atoi(ptr nocapture noundef %21) #9
  %23 = sext i32 %22 to i64
  store i64 %23, ptr @opt_n_chan, align 8, !tbaa !11
  br label %.backedge

24:                                               ; preds = %6
  %25 = load i32, ptr @opt_verbosity, align 4, !tbaa !13
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr @opt_verbosity, align 4, !tbaa !13
  br label %.backedge

27:                                               ; preds = %6
  store i32 3, ptr @opt_map, align 4, !tbaa !13
  br label %.backedge

28:                                               ; preds = %6
  store i32 2, ptr @opt_map, align 4, !tbaa !13
  br label %.backedge

29:                                               ; preds = %6
  store i8 1, ptr @opt_poll, align 1, !tbaa !15
  br label %.backedge

30:                                               ; preds = %6, %6, %6
  %31 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
  tail call void @exit(i32 noundef 0) #10
  unreachable

32:                                               ; preds = %6
  %33 = load i32, ptr @opt_verbosity, align 4, !tbaa !13
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %35, label %.thread28

35:                                               ; preds = %32
  %36 = load ptr, ptr @stderr, align 8, !tbaa !7
  %37 = load i64, ptr @opt_n_pub, align 8, !tbaa !11
  %38 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef nonnull @.str.2, i64 noundef %37) #11
  %.pr = load i32, ptr @opt_verbosity, align 4, !tbaa !13
  %39 = icmp sgt i32 %.pr, 0
  br i1 %39, label %40, label %.thread28

40:                                               ; preds = %35
  %41 = load ptr, ptr @stderr, align 8, !tbaa !7
  %42 = load i64, ptr @opt_n_sub, align 8, !tbaa !11
  %43 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %41, ptr noundef nonnull @.str.3, i64 noundef %42) #11
  %.pr22 = load i32, ptr @opt_verbosity, align 4, !tbaa !13
  %44 = icmp sgt i32 %.pr22, 0
  br i1 %44, label %.thread23, label %.thread28

.thread23:                                        ; preds = %40
  %45 = load ptr, ptr @stderr, align 8, !tbaa !7
  %46 = load i64, ptr @opt_n_sig, align 8, !tbaa !11
  %47 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.4, i64 noundef %46) #11
  %.pr24.pr = load i32, ptr @opt_verbosity, align 4, !tbaa !13
  %48 = icmp sgt i32 %.pr24.pr, 0
  br i1 %48, label %49, label %.thread28

49:                                               ; preds = %.thread23
  %50 = load ptr, ptr @stderr, align 8, !tbaa !7
  %51 = load i64, ptr @opt_n_chan, align 8, !tbaa !11
  %52 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef nonnull @.str.5, i64 noundef %51) #11
  %.pr26 = load i32, ptr @opt_verbosity, align 4, !tbaa !13
  %53 = icmp sgt i32 %.pr26, 0
  br i1 %53, label %54, label %.thread28

54:                                               ; preds = %49
  %55 = load ptr, ptr @stderr, align 8, !tbaa !7
  %56 = load i32, ptr @opt_map, align 4, !tbaa !13
  %57 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef nonnull @.str.6, i32 noundef %56) #11
  br label %.thread28

.thread28:                                        ; preds = %35, %32, %40, %.thread23, %54, %49
  tail call void @create_channels()
  tail call void @sighandler_install(i32 noundef 2, ptr noundef nonnull @sighandler_nop)
  tail call void @sighandler_install(i32 noundef 17, ptr noundef nonnull @sighandler_nop)
  tail call void @sighandler_install(i32 noundef 10, ptr noundef nonnull @sighandler_ready)
  %58 = call i32 @sigemptyset(ptr noundef nonnull %3) #8
  call void @check_errno(ptr noundef nonnull @.str.7, i32 noundef %58) #8
  %59 = call i32 @sigemptyset(ptr noundef nonnull %4) #8
  call void @check_errno(ptr noundef nonnull @.str.7, i32 noundef %59) #8
  %60 = call i32 @sigaddset(ptr noundef nonnull %3, i32 noundef 17) #8
  call void @check_errno(ptr noundef nonnull @.str.8, i32 noundef %60) #8
  %61 = call i32 @sigaddset(ptr noundef nonnull %3, i32 noundef 10) #8
  call void @check_errno(ptr noundef nonnull @.str.8, i32 noundef %61) #8
  %62 = call i32 @sigprocmask(i32 noundef 2, ptr noundef nonnull %3, ptr noundef null) #8
  call void @check_errno(ptr noundef nonnull @.str.9, i32 noundef %62) #8
  call void @start_workers()
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %63 = load i64, ptr @opt_n_pub, align 8, !tbaa !11
  %64 = load i64, ptr @opt_n_sig, align 8, !tbaa !11
  %reass.add47 = shl i64 %64, 1
  %65 = sub i64 0, %63
  %.not = icmp eq i64 %reass.add47, %65
  br i1 %.not, label %._crit_edge, label %.lr.ph49

.loopexit35:                                      ; preds = %103, %.preheader34
  %.116.lcssa = phi i32 [ %.01548, %.preheader34 ], [ %.2, %103 ]
  %66 = zext i32 %.116.lcssa to i64
  %67 = load i64, ptr @opt_n_pub, align 8, !tbaa !11
  %68 = load i64, ptr @opt_n_sig, align 8, !tbaa !11
  %reass.add = shl i64 %68, 1
  %69 = add i64 %reass.add, %67
  %70 = icmp ugt i64 %69, %66
  br i1 %70, label %.lr.ph49, label %._crit_edge, !llvm.loop !17

.lr.ph49:                                         ; preds = %.thread28, %.loopexit35
  %.01548 = phi i32 [ %.116.lcssa, %.loopexit35 ], [ 0, %.thread28 ]
  %71 = call i32 @sigsuspend(ptr noundef nonnull %4) #8
  %72 = tail call ptr @__errno_location() #12
  %73 = load i32, ptr %72, align 4, !tbaa !13
  %.not20 = icmp eq i32 %73, 4
  br i1 %.not20, label %.preheader34, label %76

.preheader34:                                     ; preds = %.lr.ph49
  %74 = call i32 @waitpid(i32 noundef -1, ptr noundef nonnull %5, i32 noundef 1) #8
  %75 = icmp sgt i32 %74, 0
  br i1 %75, label %.lr.ph, label %.loopexit35

76:                                               ; preds = %.lr.ph49
  call void @perror(ptr noundef nonnull @.str.10) #13
  br label %111

.lr.ph:                                           ; preds = %.preheader34, %103
  %77 = phi i32 [ %104, %103 ], [ %74, %.preheader34 ]
  %.11646 = phi i32 [ %.2, %103 ], [ %.01548, %.preheader34 ]
  %78 = load i32, ptr @opt_verbosity, align 4, !tbaa !13
  %79 = icmp sgt i32 %78, 0
  br i1 %79, label %80, label %83

80:                                               ; preds = %.lr.ph
  %81 = load ptr, ptr @stderr, align 8, !tbaa !7
  %82 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %81, ptr noundef nonnull @.str.11, i32 noundef %77) #11
  br label %83

83:                                               ; preds = %80, %.lr.ph
  %84 = load i32, ptr %5, align 4, !tbaa !13
  %85 = and i32 %84, 127
  %86 = shl nuw nsw i32 %85, 24
  %sext = add nuw i32 %86, 16777216
  %87 = icmp sgt i32 %sext, 33554431
  br i1 %87, label %88, label %94

88:                                               ; preds = %83
  %89 = load ptr, ptr @stderr, align 8, !tbaa !7
  %90 = call ptr @strsignal(i32 noundef %85) #8
  %91 = load i32, ptr %5, align 4, !tbaa !13
  %92 = and i32 %91, 127
  %93 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %89, ptr noundef nonnull @.str.12, ptr noundef %90, i32 noundef %92) #11
  br label %111

94:                                               ; preds = %83
  %95 = icmp eq i32 %85, 0
  br i1 %95, label %96, label %103

96:                                               ; preds = %94
  %97 = add i32 %.11646, 1
  %98 = lshr i32 %84, 8
  %99 = and i32 %98, 255
  %.not21 = icmp eq i32 %99, 0
  br i1 %.not21, label %103, label %100

100:                                              ; preds = %96
  %101 = load ptr, ptr @stderr, align 8, !tbaa !7
  %102 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %101, ptr noundef nonnull @.str.13, i32 noundef %77, i32 noundef %99) #11
  br label %111

103:                                              ; preds = %96, %94
  %.2 = phi i32 [ %97, %96 ], [ %.11646, %94 ]
  %104 = call i32 @waitpid(i32 noundef -1, ptr noundef nonnull %5, i32 noundef 1) #8
  %105 = icmp sgt i32 %104, 0
  br i1 %105, label %.lr.ph, label %.loopexit35, !llvm.loop !18

._crit_edge:                                      ; preds = %.loopexit35, %.thread28
  %.015.lcssa = phi i32 [ 0, %.thread28 ], [ %.116.lcssa, %.loopexit35 ]
  %106 = load i32, ptr @opt_verbosity, align 4, !tbaa !13
  %107 = icmp sgt i32 %106, 0
  br i1 %107, label %108, label %.thread30

108:                                              ; preds = %._crit_edge
  %109 = load ptr, ptr @stderr, align 8, !tbaa !7
  %110 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %109, ptr noundef nonnull @.str.14, i32 noundef %.015.lcssa) #11
  br label %.thread30

.thread30:                                        ; preds = %108, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  br label %.loopexit

111:                                              ; preds = %100, %88, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  %112 = load i64, ptr @opt_n_pub, align 8, !tbaa !11
  %.not56 = icmp eq i64 %112, 0
  br i1 %.not56, label %.preheader, label %.lr.ph53

.preheader:                                       ; preds = %.lr.ph53, %111
  %113 = load i64, ptr @opt_n_sub, align 8, !tbaa !11
  %.not57 = icmp eq i64 %113, 0
  br i1 %.not57, label %.loopexit, label %.lr.ph55

.lr.ph53:                                         ; preds = %111, %.lr.ph53
  %.051 = phi i64 [ %115, %.lr.ph53 ], [ 0, %111 ]
  %114 = load ptr, ptr @g_pid_pub, align 8, !tbaa !7
  %115 = add nuw i64 %.051, 1
  %116 = getelementptr inbounds i32, ptr %114, i64 %.051
  %117 = load i32, ptr %116, align 4, !tbaa !13
  %118 = call i32 @kill(i32 noundef %117, i32 noundef 15) #8
  %119 = load i64, ptr @opt_n_pub, align 8, !tbaa !11
  %120 = icmp ult i64 %115, %119
  br i1 %120, label %.lr.ph53, label %.preheader, !llvm.loop !19

.lr.ph55:                                         ; preds = %.preheader, %.lr.ph55
  %.154 = phi i64 [ %122, %.lr.ph55 ], [ 0, %.preheader ]
  %121 = load ptr, ptr @g_pid_sub, align 8, !tbaa !7
  %122 = add nuw i64 %.154, 1
  %123 = getelementptr inbounds i32, ptr %121, i64 %.154
  %124 = load i32, ptr %123, align 4, !tbaa !13
  %125 = call i32 @kill(i32 noundef %124, i32 noundef 15) #8
  %126 = load i64, ptr @opt_n_sub, align 8, !tbaa !11
  %127 = icmp ult i64 %122, %126
  br i1 %127, label %.lr.ph55, label %.loopexit, !llvm.loop !20

.loopexit:                                        ; preds = %.lr.ph55, %.preheader, %.thread30
  %.014 = phi i32 [ 0, %.thread30 ], [ 1, %.preheader ], [ 1, %.lr.ph55 ]
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %3) #8
  ret i32 %.014
}

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

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #3

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5

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

; Function Attrs: nounwind uwtable
declare hidden void @create_channels() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @sighandler_install(i32 noundef, ptr noundef) local_unnamed_addr #0

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

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

declare void @check_errno(ptr noundef, i32 noundef) local_unnamed_addr #6

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @start_workers() local_unnamed_addr #0

declare i32 @sigsuspend(ptr noundef) local_unnamed_addr #6

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

; Function Attrs: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #4

declare i32 @waitpid(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #6

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

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

; Function Attrs: nounwind
declare i32 @kill(i32 noundef, i32 noundef) local_unnamed_addr #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 = { mustprogress 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 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 #4 = { 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 #5 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { "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 = { 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 #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { noreturn nounwind }
attributes #11 = { cold nounwind }
attributes #12 = { nounwind willreturn memory(none) }
attributes #13 = { cold }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !9, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !9, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"_Bool", !9, i64 0}
!17 = distinct !{!17, !6}
!18 = distinct !{!18, !6}
!19 = distinct !{!19, !6}
!20 = distinct !{!20, !6}


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