; LLVM IR from mbheinen/bpa-ipf-tsp :: ipfsrv (ipfsrv_sub)

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

@nodename = external hidden global [128 x i8], align 16
@sockid = external hidden global i32, align 4
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [47 x i8], align 1
@stdout = external global ptr, align 8
@ipf_socket = external hidden global i32, align 4
@ipc_status = external hidden global i32, align 4
@.str.6 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [12 x i8], align 1
@sockin = external hidden global i32, align 4
@sockout = external hidden global i32, align 4
@status = external hidden global i32, align 4
@done = external hidden global i32, align 4
@cmd_buffer = external hidden global [4096 x i8], align 16
@.str.8 = external hidden unnamed_addr constant [53 x i8], align 1
@data_buffer = external hidden global [4096 x i8], align 16
@.str.9 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [39 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @ipfsrv_sub(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #10
  call void @llvm.memset.p0.i64(ptr align 16 @nodename, i8 0, i64 128, i1 false)
  store i32 1024, ptr @sockid, align 4, !tbaa !5
  store i32 0, ptr %5, align 4, !tbaa !5
  %11 = load i32, ptr %3, align 4, !tbaa !5
  %12 = icmp eq i32 %11, 2
  br i1 %12, label %13, label %18

13:                                               ; preds = %2
  %14 = load ptr, ptr %4, align 8, !tbaa !9
  %15 = getelementptr inbounds ptr, ptr %14, i64 1
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = call i32 @atoi(ptr noundef %16) #11
  store i32 %17, ptr %5, align 4, !tbaa !5
  br label %112

18:                                               ; preds = %2
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %108, %18
  %20 = load i32, ptr %6, align 4, !tbaa !5
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = icmp slt i32 %20, %21
  br i1 %22, label %23, label %111

23:                                               ; preds = %19
  %24 = load ptr, ptr %4, align 8, !tbaa !9
  %25 = load i32, ptr %6, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds ptr, ptr %24, i64 %26
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  store ptr %28, ptr %7, align 8, !tbaa !9
  br label %29

29:                                               ; preds = %69, %23
  %30 = load ptr, ptr %7, align 8, !tbaa !9
  %31 = load i8, ptr %30, align 1, !tbaa !11
  %32 = sext i8 %31 to i32
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %34, label %72

34:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #10
  %35 = load ptr, ptr %7, align 8, !tbaa !9
  %36 = load i8, ptr %35, align 1, !tbaa !11
  %37 = sext i8 %36 to i32
  %38 = call i1 @llvm.is.constant.i32(i32 %37)
  br i1 %38, label %39, label %59

39:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #10
  %40 = load ptr, ptr %7, align 8, !tbaa !9
  %41 = load i8, ptr %40, align 1, !tbaa !11
  %42 = sext i8 %41 to i32
  store i32 %42, ptr %9, align 4, !tbaa !5
  %43 = load i32, ptr %9, align 4, !tbaa !5
  %44 = icmp slt i32 %43, -128
  br i1 %44, label %48, label %45

45:                                               ; preds = %39
  %46 = load i32, ptr %9, align 4, !tbaa !5
  %47 = icmp sgt i32 %46, 255
  br i1 %47, label %48, label %50

48:                                               ; preds = %45, %39
  %49 = load i32, ptr %9, align 4, !tbaa !5
  br label %57

50:                                               ; preds = %45
  %51 = call ptr @__ctype_toupper_loc() #12
  %52 = load ptr, ptr %51, align 8, !tbaa !9
  %53 = load i32, ptr %9, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i32, ptr %52, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %50, %48
  %58 = phi i32 [ %49, %48 ], [ %56, %50 ]
  store i32 %58, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #10
  br label %64

59:                                               ; preds = %34
  %60 = load ptr, ptr %7, align 8, !tbaa !9
  %61 = load i8, ptr %60, align 1, !tbaa !11
  %62 = sext i8 %61 to i32
  %63 = call i32 @toupper(i32 noundef %62) #11
  store i32 %63, ptr %8, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %59, %57
  %65 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %65, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #10
  %66 = load i32, ptr %10, align 4, !tbaa !5
  %67 = trunc i32 %66 to i8
  %68 = load ptr, ptr %7, align 8, !tbaa !9
  store i8 %67, ptr %68, align 1, !tbaa !11
  br label %69

69:                                               ; preds = %64
  %70 = load ptr, ptr %7, align 8, !tbaa !9
  %71 = getelementptr inbounds i8, ptr %70, i32 1
  store ptr %71, ptr %7, align 8, !tbaa !9
  br label %29, !llvm.loop !12

72:                                               ; preds = %29
  %73 = load ptr, ptr %4, align 8, !tbaa !9
  %74 = load i32, ptr %6, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds ptr, ptr %73, i64 %75
  %77 = load ptr, ptr %76, align 8, !tbaa !9
  %78 = call i32 @strncmp(ptr noundef %77, ptr noundef @.str, i64 noundef 5) #11
  %79 = icmp eq i32 %78, 0
  br i1 %79, label %80, label %89

80:                                               ; preds = %72
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %6, align 4, !tbaa !5
  %83 = load ptr, ptr %4, align 8, !tbaa !9
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds ptr, ptr %83, i64 %85
  %87 = load ptr, ptr %86, align 8, !tbaa !9
  %88 = call ptr @strcpy(ptr noundef @nodename, ptr noundef %87) #10
  br label %107

89:                                               ; preds = %72
  %90 = load ptr, ptr %4, align 8, !tbaa !9
  %91 = load i32, ptr %6, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds ptr, ptr %90, i64 %92
  %94 = load ptr, ptr %93, align 8, !tbaa !9
  %95 = call i32 @strncmp(ptr noundef %94, ptr noundef @.str.1, i64 noundef 5) #11
  %96 = icmp eq i32 %95, 0
  br i1 %96, label %97, label %106

97:                                               ; preds = %89
  %98 = load i32, ptr %6, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %6, align 4, !tbaa !5
  %100 = load ptr, ptr %4, align 8, !tbaa !9
  %101 = load i32, ptr %6, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds ptr, ptr %100, i64 %102
  %104 = load ptr, ptr %103, align 8, !tbaa !9
  %105 = call i32 @atoi(ptr noundef %104) #11
  store i32 %105, ptr %5, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %97, %89
  br label %107

107:                                              ; preds = %106, %80
  br label %108

108:                                              ; preds = %107
  %109 = load i32, ptr %6, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %6, align 4, !tbaa !5
  br label %19, !llvm.loop !14

111:                                              ; preds = %19
  br label %112

112:                                              ; preds = %111, %13
  %113 = load i32, ptr %5, align 4, !tbaa !5
  %114 = icmp eq i32 %113, 0
  br i1 %114, label %115, label %123

115:                                              ; preds = %112
  %116 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %117 = load ptr, ptr %4, align 8, !tbaa !9
  %118 = getelementptr inbounds ptr, ptr %117, i64 0
  %119 = load ptr, ptr %118, align 8, !tbaa !9
  %120 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, ptr noundef %119)
  store i32 1024, ptr @sockid, align 4, !tbaa !5
  %121 = load i32, ptr @sockid, align 4, !tbaa !5
  %122 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %121)
  br label %125

123:                                              ; preds = %112
  %124 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %124, ptr @sockid, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %123, %115
  %126 = load i32, ptr @sockid, align 4, !tbaa !5
  %127 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %126)
  %128 = load ptr, ptr @stdout, align 8, !tbaa !9
  %129 = call i32 @fflush(ptr noundef %128)
  %130 = load i32, ptr @sockid, align 4, !tbaa !5
  %131 = call i32 @connect_to_socket(ptr noundef @nodename, i32 noundef %130, ptr noundef @ipf_socket)
  store i32 %131, ptr @ipc_status, align 4, !tbaa !5
  %132 = load i32, ptr @ipc_status, align 4, !tbaa !5
  %133 = icmp ne i32 %132, 0
  br i1 %133, label %134, label %137

134:                                              ; preds = %125
  %135 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  call void @exit(i32 noundef 0) #13
  unreachable

137:                                              ; preds = %125
  %138 = load i32, ptr @ipf_socket, align 4, !tbaa !5
  store i32 %138, ptr @sockin, align 4, !tbaa !5
  %139 = load i32, ptr @ipf_socket, align 4, !tbaa !5
  store i32 %139, ptr @sockout, align 4, !tbaa !5
  br label %140

140:                                              ; preds = %137
  %141 = call i32 @initlz_cw()
  store i32 %141, ptr @status, align 4, !tbaa !5
  call void @pfinit_cw()
  store i32 0, ptr @done, align 4, !tbaa !5
  br label %142

142:                                              ; preds = %161, %140
  %143 = load i32, ptr @done, align 4, !tbaa !5
  %144 = icmp ne i32 %143, 0
  %145 = xor i1 %144, true
  br i1 %145, label %146, label %162

146:                                              ; preds = %142
  %147 = load i32, ptr @sockin, align 4, !tbaa !5
  %148 = call i32 @ipcrecv(ptr noundef @cmd_buffer, i32 noundef %147)
  store i32 %148, ptr @ipc_status, align 4, !tbaa !5
  %149 = load i32, ptr @ipc_status, align 4, !tbaa !5
  %150 = icmp ne i32 %149, 0
  br i1 %150, label %151, label %153

151:                                              ; preds = %146
  %152 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  store i32 -1, ptr @done, align 4, !tbaa !5
  br label %162

153:                                              ; preds = %146
  %154 = call i32 @srv_cmdprs(ptr noundef @cmd_buffer, ptr noundef @data_buffer)
  %155 = load i32, ptr @sockout, align 4, !tbaa !5
  %156 = call i32 @ipcsend(ptr noundef @data_buffer, i32 noundef %155)
  store i32 %156, ptr @ipc_status, align 4, !tbaa !5
  %157 = load i32, ptr @ipc_status, align 4, !tbaa !5
  %158 = icmp ne i32 %157, 0
  br i1 %158, label %159, label %161

159:                                              ; preds = %153
  %160 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  store i32 -1, ptr @done, align 4, !tbaa !5
  br label %162

161:                                              ; preds = %153
  br label %142, !llvm.loop !15

162:                                              ; preds = %159, %151, %142
  %163 = load i32, ptr @ipc_status, align 4, !tbaa !5
  %164 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, i32 noundef %163)
  %165 = load ptr, ptr @stdout, align 8, !tbaa !9
  %166 = call i32 @fflush(ptr noundef %165)
  call void @ipf_fexit_cw()
  call void @exit(i32 noundef 1) #13
  unreachable
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)
declare i1 @llvm.is.constant.i32(i32) #4

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

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

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

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

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #7

declare i32 @printf(ptr noundef, ...) #8

declare i32 @fflush(ptr noundef) #8

declare i32 @connect_to_socket(ptr noundef, i32 noundef, ptr noundef) #8

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

declare i32 @initlz_cw() #8

declare void @pfinit_cw() #8

declare i32 @ipcrecv(ptr noundef, i32 noundef) #8

declare i32 @srv_cmdprs(ptr noundef, ptr noundef) #8

declare i32 @ipcsend(ptr noundef, i32 noundef) #8

declare void @ipf_fexit_cw() #8

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }
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 willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind "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 = { 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 #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(read) }
attributes #12 = { nounwind willreturn memory(none) }
attributes #13 = { 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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}


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

@nodename = external hidden global [128 x i8], align 16
@sockid = external hidden local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [47 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@ipf_socket = external hidden global i32, align 4
@ipc_status = external hidden local_unnamed_addr global i32, align 4
@.str.6 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [12 x i8], align 1
@sockin = external hidden local_unnamed_addr global i32, align 4
@sockout = external hidden local_unnamed_addr global i32, align 4
@status = external hidden local_unnamed_addr global i32, align 4
@done = external hidden local_unnamed_addr global i32, align 4
@cmd_buffer = external hidden global [4096 x i8], align 16
@.str.8 = external hidden unnamed_addr constant [53 x i8], align 1
@data_buffer = external hidden global [4096 x i8], align 16
@.str.9 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [39 x i8], align 1

; Function Attrs: noreturn nounwind uwtable
define dso_local void @ipfsrv_sub(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(128) @nodename, i8 0, i64 128, i1 false)
  store i32 1024, ptr @sockid, align 4, !tbaa !5
  %3 = icmp eq i32 %0, 2
  br i1 %3, label %5, label %.preheader

.preheader:                                       ; preds = %2
  %4 = icmp sgt i32 %0, 1
  br i1 %4, label %.lr.ph47, label %.loopexit42.thread

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %1, i64 8
  %7 = load ptr, ptr %6, align 8, !tbaa !9
  %8 = tail call i32 @atoi(ptr nocapture noundef %7) #8
  br label %.loopexit42

.lr.ph47:                                         ; preds = %.preheader, %37
  %.046 = phi i32 [ %.1, %37 ], [ 0, %.preheader ]
  %.03245 = phi i32 [ %38, %37 ], [ 1, %.preheader ]
  %9 = sext i32 %.03245 to i64
  %10 = getelementptr inbounds ptr, ptr %1, i64 %9
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %12 = load i8, ptr %11, align 1, !tbaa !11
  %.not43 = icmp eq i8 %12, 0
  br i1 %.not43, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph47, %.lr.ph
  %13 = phi i8 [ %18, %.lr.ph ], [ %12, %.lr.ph47 ]
  %.03544 = phi ptr [ %17, %.lr.ph ], [ %11, %.lr.ph47 ]
  %14 = sext i8 %13 to i32
  %15 = tail call i32 @toupper(i32 noundef %14) #8
  %16 = trunc i32 %15 to i8
  store i8 %16, ptr %.03544, align 1, !tbaa !11
  %17 = getelementptr inbounds i8, ptr %.03544, i64 1
  %18 = load i8, ptr %17, align 1, !tbaa !11
  %.not = icmp eq i8 %18, 0
  br i1 %.not, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !12

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load ptr, ptr %10, align 8, !tbaa !9
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.lr.ph47
  %19 = phi ptr [ %.pre, %._crit_edge.loopexit ], [ %11, %.lr.ph47 ]
  %20 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str, i64 noundef 5) #8
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %22, label %28

22:                                               ; preds = %._crit_edge
  %23 = add nsw i32 %.03245, 1
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds ptr, ptr %1, i64 %24
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  %27 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) @nodename, ptr noundef nonnull dereferenceable(1) %26) #9
  br label %37

28:                                               ; preds = %._crit_edge
  %29 = tail call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef 5) #8
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %31, label %37

31:                                               ; preds = %28
  %32 = add nsw i32 %.03245, 1
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds ptr, ptr %1, i64 %33
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  %36 = tail call i32 @atoi(ptr nocapture noundef %35) #8
  br label %37

37:                                               ; preds = %22, %31, %28
  %.133 = phi i32 [ %23, %22 ], [ %32, %31 ], [ %.03245, %28 ]
  %.1 = phi i32 [ %.046, %22 ], [ %36, %31 ], [ %.046, %28 ]
  %38 = add nsw i32 %.133, 1
  %39 = icmp slt i32 %38, %0
  br i1 %39, label %.lr.ph47, label %.loopexit42, !llvm.loop !14

.loopexit42:                                      ; preds = %37, %5
  %.2 = phi i32 [ %8, %5 ], [ %.1, %37 ]
  %40 = icmp eq i32 %.2, 0
  br i1 %40, label %.loopexit42.thread, label %45

.loopexit42.thread:                               ; preds = %.preheader, %.loopexit42
  %41 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %42 = load ptr, ptr %1, align 8, !tbaa !9
  %43 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %42)
  store i32 1024, ptr @sockid, align 4, !tbaa !5
  %44 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef 1024)
  %.pre48 = load i32, ptr @sockid, align 4, !tbaa !5
  br label %46

45:                                               ; preds = %.loopexit42
  store i32 %.2, ptr @sockid, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %45, %.loopexit42.thread
  %47 = phi i32 [ %.2, %45 ], [ %.pre48, %.loopexit42.thread ]
  %48 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %47)
  %49 = load ptr, ptr @stdout, align 8, !tbaa !9
  %50 = tail call i32 @fflush(ptr noundef %49)
  %51 = load i32, ptr @sockid, align 4, !tbaa !5
  %52 = tail call i32 @connect_to_socket(ptr noundef nonnull @nodename, i32 noundef %51, ptr noundef nonnull @ipf_socket) #9
  store i32 %52, ptr @ipc_status, align 4, !tbaa !5
  %.not38 = icmp eq i32 %52, 0
  br i1 %.not38, label %56, label %53

53:                                               ; preds = %46
  %54 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %55 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  tail call void @exit(i32 noundef 0) #10
  unreachable

56:                                               ; preds = %46
  %57 = load i32, ptr @ipf_socket, align 4, !tbaa !5
  store i32 %57, ptr @sockin, align 4, !tbaa !5
  store i32 %57, ptr @sockout, align 4, !tbaa !5
  %58 = tail call i32 @initlz_cw() #9
  store i32 %58, ptr @status, align 4, !tbaa !5
  tail call void @pfinit_cw() #9
  store i32 0, ptr @done, align 4, !tbaa !5
  br label %59

thread-pre-split:                                 ; preds = %62
  %.pr = load i32, ptr @done, align 4, !tbaa !5
  %.not39 = icmp eq i32 %.pr, 0
  br i1 %.not39, label %59, label %.loopexit

59:                                               ; preds = %56, %thread-pre-split
  %60 = load i32, ptr @sockin, align 4, !tbaa !5
  %61 = tail call i32 @ipcrecv(ptr noundef nonnull @cmd_buffer, i32 noundef %60) #9
  store i32 %61, ptr @ipc_status, align 4, !tbaa !5
  %.not40 = icmp eq i32 %61, 0
  br i1 %.not40, label %62, label %.loopexit.sink.split

62:                                               ; preds = %59
  %63 = tail call i32 @srv_cmdprs(ptr noundef nonnull @cmd_buffer, ptr noundef nonnull @data_buffer) #9
  %64 = load i32, ptr @sockout, align 4, !tbaa !5
  %65 = tail call i32 @ipcsend(ptr noundef nonnull @data_buffer, i32 noundef %64) #9
  store i32 %65, ptr @ipc_status, align 4, !tbaa !5
  %.not41 = icmp eq i32 %65, 0
  br i1 %.not41, label %thread-pre-split, label %.loopexit.sink.split, !llvm.loop !15

.loopexit.sink.split:                             ; preds = %62, %59
  %.str.9.sink = phi ptr [ @.str.8, %59 ], [ @.str.9, %62 ]
  %66 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.9.sink)
  store i32 -1, ptr @done, align 4, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %thread-pre-split, %.loopexit.sink.split
  %67 = load i32, ptr @ipc_status, align 4, !tbaa !5
  %68 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, i32 noundef %67)
  %69 = load ptr, ptr @stdout, align 8, !tbaa !9
  %70 = tail call i32 @fflush(ptr noundef %69)
  tail call void @ipf_fexit_cw() #9
  tail call void @exit(i32 noundef 1) #10
  unreachable
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @toupper(i32 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #4

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

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #5

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

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

declare i32 @initlz_cw() local_unnamed_addr #6

declare void @pfinit_cw() local_unnamed_addr #6

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

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

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

declare void @ipf_fexit_cw() local_unnamed_addr #6

attributes #0 = { noreturn 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 nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 #3 = { 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 #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree 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 = { 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 #8 = { nounwind willreturn memory(read) }
attributes #9 = { nounwind }
attributes #10 = { 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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}


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