; LLVM IR from golems/ach :: src (achcat)

; 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.ach_channel = type { %union.anon.4 }
%union.anon.4 = type { [16 x i64] }
%struct.ach_attr = type { %union.anon.0 }
%union.anon.0 = type { [8 x i64] }
%struct.ach_create_attr = type { %union.anon.7 }
%union.anon.7 = type { [16 x i64] }
%struct.anon.8 = type { %union.anon.9, ptr, i32, %union.anon.10 }
%union.anon.9 = type { i32 }
%union.anon.10 = type { i64 }
%struct.anon = type { %union.anon.1, ptr, %union.anon.2 }
%union.anon.1 = type { i32 }
%union.anon.2 = type { i64 }

@g_sub_open = external dso_local global i8, align 1
@opt_chan_name = external dso_local global ptr, align 8
@opt_pub = external dso_local global i32, align 4
@opt_sub = external dso_local global i32, align 4
@stderr = external global ptr, align 8
@fin = external dso_local global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [57 x i8], align 1
@fout = external dso_local global ptr, align 8
@stdin = external global ptr, align 8
@stdout = external global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [9 x i8], align 1
@optarg = external global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [261 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [47 x i8], align 1
@g_pub = external dso_local global %struct.ach_channel, align 8
@g_sub = external dso_local global %struct.ach_channel, align 8
@.str.11 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [10 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [23 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 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 i32 @fprintf(ptr noundef, 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 ptr @publish_loop(ptr noundef) #2

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

declare ptr @ach_result_to_string(i32 noundef) #4

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %struct.ach_attr, align 8
  %10 = alloca %struct.ach_create_attr, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, 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
  %13 = load ptr, ptr @stdin, align 8, !tbaa !9
  store ptr %13, ptr @fin, align 8, !tbaa !9
  %14 = load ptr, ptr @stdout, align 8, !tbaa !9
  store ptr %14, ptr @fout, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  br label %15

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

20:                                               ; preds = %15
  %21 = load i32, ptr %6, align 4, !tbaa !5
  switch i32 %21, label %29 [
    i32 112, label %22
    i32 115, label %24
    i32 86, label %26
    i32 104, label %27
    i32 72, label %27
    i32 63, label %27
  ]

22:                                               ; preds = %20
  store i32 1, ptr @opt_pub, align 4, !tbaa !5
  %23 = load ptr, ptr @optarg, align 8, !tbaa !9
  store ptr %23, ptr @opt_chan_name, align 8, !tbaa !9
  br label %29

24:                                               ; preds = %20
  store i32 1, ptr @opt_sub, align 4, !tbaa !5
  %25 = load ptr, ptr @optarg, align 8, !tbaa !9
  store ptr %25, ptr @opt_chan_name, align 8, !tbaa !9
  br label %29

26:                                               ; preds = %20
  call void @ach_print_version(ptr noundef @.str.7)
  call void @exit(i32 noundef 0) #6
  unreachable

27:                                               ; preds = %20, %20, %20
  %28 = call i32 @puts(ptr noundef @.str.8)
  call void @exit(i32 noundef 0) #6
  unreachable

29:                                               ; preds = %24, %22, %20
  br label %15, !llvm.loop !11

30:                                               ; preds = %15
  %31 = load ptr, ptr @opt_chan_name, align 8, !tbaa !9
  %32 = icmp ne ptr %31, null
  br i1 %32, label %36, label %33

33:                                               ; preds = %30
  %34 = load ptr, ptr @stderr, align 8, !tbaa !9
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef @.str.9) #5
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %145

36:                                               ; preds = %30
  %37 = load i32, ptr @opt_pub, align 4, !tbaa !5
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %45, label %39

39:                                               ; preds = %36
  %40 = load i32, ptr @opt_sub, align 4, !tbaa !5
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %45, label %42

42:                                               ; preds = %39
  %43 = load ptr, ptr @stderr, align 8, !tbaa !9
  %44 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %43, ptr noundef @.str.10) #5
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %145

45:                                               ; preds = %39, %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 64, ptr %9) #5
  call void @ach_attr_init(ptr noundef %9)
  %46 = load i32, ptr @opt_pub, align 4, !tbaa !5
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %58

48:                                               ; preds = %45
  %49 = load i32, ptr @opt_sub, align 4, !tbaa !5
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %58, label %51

51:                                               ; preds = %48
  %52 = load ptr, ptr @opt_chan_name, align 8, !tbaa !9
  %53 = call i32 @ach_open(ptr noundef @g_pub, ptr noundef %52, ptr noundef %9)
  store i32 %53, ptr %8, align 4, !tbaa !5
  %54 = load i32, ptr %8, align 4, !tbaa !5
  %55 = icmp ne i32 0, %54
  br i1 %55, label %56, label %57

56:                                               ; preds = %51
  call void @abort() #6
  unreachable

57:                                               ; preds = %51
  br label %123

58:                                               ; preds = %48, %45
  %59 = load i32, ptr @opt_sub, align 4, !tbaa !5
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %61, label %75

61:                                               ; preds = %58
  %62 = load i32, ptr @opt_pub, align 4, !tbaa !5
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %75, label %64

64:                                               ; preds = %61
  %65 = load ptr, ptr @opt_chan_name, align 8, !tbaa !9
  %66 = call i32 @ach_open(ptr noundef @g_sub, ptr noundef %65, ptr noundef %9)
  store i32 %66, ptr %8, align 4, !tbaa !5
  %67 = load i32, ptr %8, align 4, !tbaa !5
  %68 = icmp ne i32 0, %67
  br i1 %68, label %69, label %74

69:                                               ; preds = %64
  %70 = load ptr, ptr @stderr, align 8, !tbaa !9
  %71 = load i32, ptr %8, align 4, !tbaa !5
  %72 = call ptr @ach_result_to_string(i32 noundef %71)
  %73 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %70, ptr noundef @.str.11, ptr noundef %72) #5
  call void @abort() #6
  unreachable

74:                                               ; preds = %64
  store i8 1, ptr @g_sub_open, align 1, !tbaa !13
  br label %122

75:                                               ; preds = %61, %58
  %76 = load i32, ptr @opt_pub, align 4, !tbaa !5
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %120

78:                                               ; preds = %75
  %79 = load i32, ptr @opt_sub, align 4, !tbaa !5
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %120

81:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 128, ptr %10) #5
  call void @ach_create_attr_init(ptr noundef %10)
  %82 = getelementptr inbounds %struct.ach_create_attr, ptr %10, i32 0, i32 0
  %83 = getelementptr inbounds %struct.anon.8, ptr %82, i32 0, i32 0
  store i32 1, ptr %83, align 8, !tbaa !15
  %84 = load ptr, ptr @opt_chan_name, align 8, !tbaa !9
  %85 = call i32 @ach_create(ptr noundef %84, i64 noundef 10, i64 noundef 512, ptr noundef %10)
  store i32 %85, ptr %8, align 4, !tbaa !5
  %86 = load i32, ptr %8, align 4, !tbaa !5
  %87 = icmp ne i32 0, %86
  br i1 %87, label %88, label %93

88:                                               ; preds = %81
  %89 = load ptr, ptr @stderr, align 8, !tbaa !9
  %90 = load i32, ptr %8, align 4, !tbaa !5
  %91 = call ptr @ach_result_to_string(i32 noundef %90)
  %92 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %89, ptr noundef @.str.12, ptr noundef %91) #5
  call void @exit(i32 noundef 1) #6
  unreachable

93:                                               ; preds = %81
  %94 = getelementptr inbounds %struct.ach_create_attr, ptr %10, i32 0, i32 0
  %95 = getelementptr inbounds %struct.anon.8, ptr %94, i32 0, i32 1
  %96 = load ptr, ptr %95, align 8, !tbaa !15
  %97 = icmp ne ptr %96, null
  br i1 %97, label %98, label %99

98:                                               ; preds = %93
  br label %100

99:                                               ; preds = %93
  call void @__assert_fail(ptr noundef @.str.13, ptr noundef @.str.3, i32 noundef 294, ptr noundef @__PRETTY_FUNCTION__.main) #6
  unreachable

100:                                              ; preds = %98
  %101 = getelementptr inbounds %struct.ach_attr, ptr %9, i32 0, i32 0
  %102 = getelementptr inbounds %struct.anon, ptr %101, i32 0, i32 0
  store i32 1, ptr %102, align 8, !tbaa !15
  %103 = getelementptr inbounds %struct.ach_create_attr, ptr %10, i32 0, i32 0
  %104 = getelementptr inbounds %struct.anon.8, ptr %103, i32 0, i32 1
  %105 = load ptr, ptr %104, align 8, !tbaa !15
  %106 = getelementptr inbounds %struct.ach_attr, ptr %9, i32 0, i32 0
  %107 = getelementptr inbounds %struct.anon, ptr %106, i32 0, i32 1
  store ptr %105, ptr %107, align 8, !tbaa !15
  %108 = load ptr, ptr @opt_chan_name, align 8, !tbaa !9
  %109 = call i32 @ach_open(ptr noundef @g_sub, ptr noundef %108, ptr noundef %9)
  store i32 %109, ptr %8, align 4, !tbaa !5
  %110 = load i32, ptr %8, align 4, !tbaa !5
  %111 = icmp ne i32 0, %110
  br i1 %111, label %112, label %113

112:                                              ; preds = %100
  call void @abort() #6
  unreachable

113:                                              ; preds = %100
  store i8 1, ptr @g_sub_open, align 1, !tbaa !13
  %114 = load ptr, ptr @opt_chan_name, align 8, !tbaa !9
  %115 = call i32 @ach_open(ptr noundef @g_pub, ptr noundef %114, ptr noundef %9)
  store i32 %115, ptr %8, align 4, !tbaa !5
  %116 = load i32, ptr %8, align 4, !tbaa !5
  %117 = icmp ne i32 0, %116
  br i1 %117, label %118, label %119

118:                                              ; preds = %113
  call void @abort() #6
  unreachable

119:                                              ; preds = %113
  call void @llvm.lifetime.end.p0(i64 128, ptr %10) #5
  br label %121

120:                                              ; preds = %78, %75
  call void @__assert_fail(ptr noundef @.str.14, ptr noundef @.str.3, i32 noundef 303, ptr noundef @__PRETTY_FUNCTION__.main) #6
  unreachable

121:                                              ; preds = %119
  br label %122

122:                                              ; preds = %121, %74
  br label %123

123:                                              ; preds = %122, %57
  call void @llvm.lifetime.end.p0(i64 64, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %124 = load i32, ptr @opt_pub, align 4, !tbaa !5
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %126, label %134

126:                                              ; preds = %123
  %127 = load i32, ptr @opt_sub, align 4, !tbaa !5
  %128 = icmp ne i32 %127, 0
  br i1 %128, label %129, label %134

129:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %130 = call i32 @pthread_create(ptr noundef %11, ptr noundef null, ptr noundef @publish_loop, ptr noundef @g_pub) #5
  %131 = call i32 @subscribe(ptr noundef @g_sub)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %132 = load i64, ptr %11, align 8, !tbaa !16
  %133 = call i32 @pthread_join(i64 noundef %132, ptr noundef %12)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %145

134:                                              ; preds = %126, %123
  %135 = load i32, ptr @opt_sub, align 4, !tbaa !5
  %136 = icmp ne i32 %135, 0
  br i1 %136, label %137, label %139

137:                                              ; preds = %134
  %138 = call i32 @subscribe(ptr noundef @g_sub)
  store i32 %138, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %145

139:                                              ; preds = %134
  %140 = load i32, ptr @opt_pub, align 4, !tbaa !5
  %141 = icmp ne i32 %140, 0
  br i1 %141, label %142, label %144

142:                                              ; preds = %139
  %143 = call i32 @publish(ptr noundef @g_pub)
  store i32 %143, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %145

144:                                              ; preds = %139
  call void @__assert_fail(ptr noundef @.str.14, ptr noundef @.str.3, i32 noundef 321, ptr noundef @__PRETTY_FUNCTION__.main) #6
  unreachable

145:                                              ; preds = %142, %137, %129, %42, %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %146 = load i32, ptr %3, align 4
  ret i32 %146
}

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

declare void @ach_print_version(ptr noundef) #4

declare i32 @puts(ptr noundef) #4

declare void @ach_attr_init(ptr noundef) #4

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

; Function Attrs: noreturn nounwind
declare void @abort() #3

declare void @ach_create_attr_init(ptr noundef) #4

declare i32 @ach_create(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #4

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

declare i32 @pthread_join(i64 noundef, ptr noundef) #4

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 = { 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 #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 }
attributes #6 = { noreturn 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 = !{!"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"}
!13 = !{!14, !14, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!7, !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"long", !7, i64 0}


; 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.ach_channel = type { %union.anon.4 }
%union.anon.4 = type { [16 x i64] }
%struct.ach_attr = type { %union.anon.0 }
%union.anon.0 = type { [8 x i64] }
%struct.ach_create_attr = type { %union.anon.7 }
%union.anon.7 = type { [16 x i64] }

@g_sub_open = external dso_local local_unnamed_addr global i8, align 1
@opt_chan_name = external dso_local local_unnamed_addr global ptr, align 8
@opt_pub = external dso_local local_unnamed_addr global i32, align 4
@opt_sub = external dso_local local_unnamed_addr global i32, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@fin = external dso_local local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [57 x i8], align 1
@fout = external dso_local local_unnamed_addr global ptr, align 8
@stdin = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [9 x i8], align 1
@optarg = external local_unnamed_addr global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [261 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [47 x i8], align 1
@g_pub = external dso_local global %struct.ach_channel, align 8
@g_sub = external dso_local global %struct.ach_channel, align 8
@.str.11 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [10 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [23 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 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: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) 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 ptr @publish_loop(ptr noundef) #2

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare ptr @ach_result_to_string(i32 noundef) local_unnamed_addr #4

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #2 {
  %3 = alloca %struct.ach_attr, align 8
  %4 = alloca %struct.ach_create_attr, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = load ptr, ptr @stdin, align 8, !tbaa !5
  store ptr %7, ptr @fin, align 8, !tbaa !5
  br label %.sink.split29

.sink.split29:                                    ; preds = %2, %.sink.split
  %optarg.sink = phi ptr [ @optarg, %.sink.split ], [ @stdout, %2 ]
  %opt_chan_name.sink = phi ptr [ @opt_chan_name, %.sink.split ], [ @fout, %2 ]
  %8 = load ptr, ptr %optarg.sink, align 8, !tbaa !5
  store ptr %8, ptr %opt_chan_name.sink, align 8, !tbaa !5
  br label %9

9:                                                ; preds = %.sink.split29, %9
  %10 = tail call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str.6) #6
  switch i32 %10, label %9 [
    i32 -1, label %14
    i32 112, label %.sink.split.loopexit
    i32 115, label %.sink.split
    i32 86, label %11
    i32 104, label %12
    i32 72, label %12
    i32 63, label %12
  ], !llvm.loop !9

11:                                               ; preds = %9
  tail call void @ach_print_version(ptr noundef nonnull @.str.7) #6
  tail call void @exit(i32 noundef 0) #7
  unreachable

12:                                               ; preds = %9, %9, %9
  %13 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.8)
  tail call void @exit(i32 noundef 0) #7
  unreachable

.sink.split.loopexit:                             ; preds = %9
  br label %.sink.split

.sink.split:                                      ; preds = %9, %.sink.split.loopexit
  %opt_sub.sink = phi ptr [ @opt_pub, %.sink.split.loopexit ], [ @opt_sub, %9 ]
  store i32 1, ptr %opt_sub.sink, align 4, !tbaa !11
  br label %.sink.split29, !llvm.loop !9

14:                                               ; preds = %9
  %15 = load ptr, ptr @opt_chan_name, align 8, !tbaa !5
  %.not22 = icmp eq ptr %15, null
  br i1 %.not22, label %16, label %19

16:                                               ; preds = %14
  %17 = load ptr, ptr @stderr, align 8, !tbaa !5
  %18 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef nonnull @.str.9) #8
  br label %87

19:                                               ; preds = %14
  %20 = load i32, ptr @opt_pub, align 4, !tbaa !11
  %21 = icmp ne i32 %20, 0
  %22 = load i32, ptr @opt_sub, align 4
  %23 = icmp ne i32 %22, 0
  %or.cond = select i1 %21, i1 true, i1 %23
  br i1 %or.cond, label %27, label %24

24:                                               ; preds = %19
  %25 = load ptr, ptr @stderr, align 8, !tbaa !5
  %26 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.10) #8
  br label %87

27:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %3) #6
  call void @ach_attr_init(ptr noundef nonnull %3) #6
  %28 = load i32, ptr @opt_pub, align 4
  %29 = icmp eq i32 %28, 0
  %30 = load i32, ptr @opt_sub, align 4
  %31 = icmp ne i32 %30, 0
  %or.cond3 = select i1 %29, i1 true, i1 %31
  br i1 %or.cond3, label %36, label %32

32:                                               ; preds = %27
  %33 = load ptr, ptr @opt_chan_name, align 8, !tbaa !5
  %34 = call i32 @ach_open(ptr noundef nonnull @g_pub, ptr noundef %33, ptr noundef nonnull %3) #6
  %.not23 = icmp eq i32 %34, 0
  br i1 %.not23, label %70, label %35

35:                                               ; preds = %32
  call void @abort() #7
  unreachable

36:                                               ; preds = %27
  %37 = icmp eq i32 %30, 0
  %38 = icmp ne i32 %28, 0
  %or.cond5 = or i1 %38, %37
  br i1 %or.cond5, label %47, label %39

39:                                               ; preds = %36
  %40 = load ptr, ptr @opt_chan_name, align 8, !tbaa !5
  %41 = call i32 @ach_open(ptr noundef nonnull @g_sub, ptr noundef %40, ptr noundef nonnull %3) #6
  %.not24 = icmp eq i32 %41, 0
  br i1 %.not24, label %46, label %42

42:                                               ; preds = %39
  %43 = load ptr, ptr @stderr, align 8, !tbaa !5
  %44 = call ptr @ach_result_to_string(i32 noundef %41) #6
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %43, ptr noundef nonnull @.str.11, ptr noundef %44) #8
  call void @abort() #7
  unreachable

46:                                               ; preds = %39
  store i8 1, ptr @g_sub_open, align 1, !tbaa !13
  br label %70

47:                                               ; preds = %36
  %or.cond7 = select i1 %38, i1 %31, i1 false
  br i1 %or.cond7, label %48, label %69

48:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %4) #6
  call void @ach_create_attr_init(ptr noundef nonnull %4) #6
  store i32 1, ptr %4, align 8, !tbaa !15
  %49 = load ptr, ptr @opt_chan_name, align 8, !tbaa !5
  %50 = call i32 @ach_create(ptr noundef %49, i64 noundef 10, i64 noundef 512, ptr noundef nonnull %4) #6
  %.not25 = icmp eq i32 %50, 0
  br i1 %.not25, label %55, label %51

51:                                               ; preds = %48
  %52 = load ptr, ptr @stderr, align 8, !tbaa !5
  %53 = call ptr @ach_result_to_string(i32 noundef %50) #6
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %52, ptr noundef nonnull @.str.12, ptr noundef %53) #8
  call void @exit(i32 noundef 1) #7
  unreachable

55:                                               ; preds = %48
  %56 = getelementptr inbounds i8, ptr %4, i64 8
  %57 = load ptr, ptr %56, align 8, !tbaa !15
  %.not26 = icmp eq ptr %57, null
  br i1 %.not26, label %58, label %59

58:                                               ; preds = %55
  call void @__assert_fail(ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.3, i32 noundef 294, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

59:                                               ; preds = %55
  store i32 1, ptr %3, align 8, !tbaa !15
  %60 = getelementptr inbounds i8, ptr %3, i64 8
  store ptr %57, ptr %60, align 8, !tbaa !15
  %61 = load ptr, ptr @opt_chan_name, align 8, !tbaa !5
  %62 = call i32 @ach_open(ptr noundef nonnull @g_sub, ptr noundef %61, ptr noundef nonnull %3) #6
  %.not27 = icmp eq i32 %62, 0
  br i1 %.not27, label %64, label %63

63:                                               ; preds = %59
  call void @abort() #7
  unreachable

64:                                               ; preds = %59
  store i8 1, ptr @g_sub_open, align 1, !tbaa !13
  %65 = load ptr, ptr @opt_chan_name, align 8, !tbaa !5
  %66 = call i32 @ach_open(ptr noundef nonnull @g_pub, ptr noundef %65, ptr noundef nonnull %3) #6
  %.not28 = icmp eq i32 %66, 0
  br i1 %.not28, label %68, label %67

67:                                               ; preds = %64
  call void @abort() #7
  unreachable

68:                                               ; preds = %64
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %4) #6
  br label %70

69:                                               ; preds = %47
  call void @__assert_fail(ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.3, i32 noundef 303, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

70:                                               ; preds = %46, %68, %32
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %3) #6
  %71 = load i32, ptr @opt_pub, align 4, !tbaa !11
  %72 = icmp ne i32 %71, 0
  %73 = load i32, ptr @opt_sub, align 4
  %74 = icmp ne i32 %73, 0
  %or.cond9 = select i1 %72, i1 %74, i1 false
  br i1 %or.cond9, label %75, label %80

75:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %76 = call i32 @pthread_create(ptr noundef nonnull %5, ptr noundef null, ptr noundef nonnull @publish_loop, ptr noundef nonnull @g_pub) #6
  %77 = call i32 @subscribe(ptr noundef nonnull @g_sub)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %78 = load i64, ptr %5, align 8, !tbaa !16
  %79 = call i32 @pthread_join(i64 noundef %78, ptr noundef nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %87

80:                                               ; preds = %70
  br i1 %74, label %81, label %83

81:                                               ; preds = %80
  %82 = call i32 @subscribe(ptr noundef nonnull @g_sub)
  br label %87

83:                                               ; preds = %80
  br i1 %72, label %84, label %86

84:                                               ; preds = %83
  %85 = call i32 @publish(ptr noundef nonnull @g_pub)
  br label %87

86:                                               ; preds = %83
  call void @__assert_fail(ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.3, i32 noundef 321, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

87:                                               ; preds = %84, %81, %75, %24, %16
  %.0 = phi i32 [ 0, %75 ], [ %82, %81 ], [ %85, %84 ], [ 1, %24 ], [ 1, %16 ]
  ret i32 %.0
}

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

declare void @ach_print_version(ptr noundef) local_unnamed_addr #4

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

declare void @ach_attr_init(ptr noundef) local_unnamed_addr #4

declare i32 @ach_open(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #3

declare void @ach_create_attr_init(ptr noundef) local_unnamed_addr #4

declare i32 @ach_create(ptr noundef, i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind
declare i32 @pthread_create(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

declare i32 @pthread_join(i64 noundef, ptr noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #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 "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 = { noreturn nounwind }
attributes #8 = { 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}
!13 = !{!14, !14, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!7, !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"long", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass