; LLVM IR from nubot-nudt/simatch :: src/robot_code/world_model/rtdb/comm.ll (Z17receiveDataThreadPv)

; 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._agent = type { i8, i8, i8, %struct.timeval, i32, i32, [10 x i8], i32 }
%struct.timeval = type { i64, i64 }
%struct.RTDBconf_var = type { i32, i32, i32 }
%struct._frameHeader = type { i8, i32, [10 x i8], i32 }

@end = external dso_local global i32, align 4
@lostPackets = external dso_local global [10 x i32], align 16
@myNumber = external dso_local global i32, align 4
@agent = external dso_local global [10 x %struct._agent], align 16
@.str = external hidden unnamed_addr constant [98 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [93 x i8], align 1
@__FUNCTION__._Z17receiveDataThreadPv = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z11sync_ratdmai(i32 noundef) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_Z17receiveDataThreadPv(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca [5000 x i8], align 16
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %struct.RTDBconf_var, align 4
  %9 = alloca i32, align 4
  %10 = alloca %struct._frameHeader, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 5000, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  br label %12

12:                                               ; preds = %162, %44, %1
  %13 = load i32, ptr @end, align 4, !tbaa !9
  %14 = icmp ne i32 %13, 0
  %15 = xor i1 %14, true
  br i1 %15, label %16, label %163

16:                                               ; preds = %12
  %17 = getelementptr inbounds [5000 x i8], ptr %4, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %17, i8 0, i64 5000, i1 false)
  store i32 0, ptr %5, align 4, !tbaa !9
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = load i32, ptr %18, align 4, !tbaa !9
  %20 = getelementptr inbounds [5000 x i8], ptr %4, i64 0, i64 0
  %21 = call noundef i32 @_Z11receiveDataiPvi(i32 noundef %19, ptr noundef %20, i32 noundef 5000)
  store i32 %21, ptr %3, align 4, !tbaa !9
  %22 = load i32, ptr %3, align 4, !tbaa !9
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %24, label %162

24:                                               ; preds = %16
  %25 = getelementptr inbounds [5000 x i8], ptr %4, i64 0, i64 0
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds i8, ptr %25, i64 %27
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 1 %28, i64 24, i1 false)
  %29 = load i32, ptr %5, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = add i64 %30, 24
  %32 = trunc i64 %31 to i32
  store i32 %32, ptr %5, align 4, !tbaa !9
  %33 = getelementptr inbounds %struct._frameHeader, ptr %10, i32 0, i32 0
  %34 = load i8, ptr %33, align 4, !tbaa !11
  %35 = zext i8 %34 to i32
  store i32 %35, ptr %6, align 4, !tbaa !9
  %36 = load i32, ptr %6, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [10 x %struct._agent], ptr @agent, i64 0, i64 %37
  %39 = getelementptr inbounds %struct._agent, ptr %38, i32 0, i32 3
  %40 = call i32 @gettimeofday(ptr noundef %39, ptr noundef null) #7
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = load i32, ptr @myNumber, align 4, !tbaa !9
  %43 = icmp eq i32 %41, %42
  br i1 %43, label %44, label %45

44:                                               ; preds = %24
  br label %12, !llvm.loop !13

45:                                               ; preds = %24
  %46 = load i32, ptr %6, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [10 x %struct._agent], ptr @agent, i64 0, i64 %47
  %49 = getelementptr inbounds %struct._agent, ptr %48, i32 0, i32 5
  %50 = load i32, ptr %49, align 4, !tbaa !15
  %51 = add i32 %50, 1
  %52 = getelementptr inbounds %struct._frameHeader, ptr %10, i32 0, i32 1
  %53 = load i32, ptr %52, align 4, !tbaa !19
  %54 = icmp ne i32 %51, %53
  br i1 %54, label %55, label %68

55:                                               ; preds = %45
  %56 = getelementptr inbounds %struct._frameHeader, ptr %10, i32 0, i32 1
  %57 = load i32, ptr %56, align 4, !tbaa !19
  %58 = load i32, ptr %6, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [10 x %struct._agent], ptr @agent, i64 0, i64 %59
  %61 = getelementptr inbounds %struct._agent, ptr %60, i32 0, i32 5
  %62 = load i32, ptr %61, align 4, !tbaa !15
  %63 = add i32 %62, 1
  %64 = sub i32 %57, %63
  %65 = load i32, ptr %6, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [10 x i32], ptr @lostPackets, i64 0, i64 %66
  store i32 %64, ptr %67, align 4, !tbaa !9
  br label %68

68:                                               ; preds = %55, %45
  %69 = getelementptr inbounds %struct._frameHeader, ptr %10, i32 0, i32 1
  %70 = load i32, ptr %69, align 4, !tbaa !19
  %71 = load i32, ptr %6, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [10 x %struct._agent], ptr @agent, i64 0, i64 %72
  %74 = getelementptr inbounds %struct._agent, ptr %73, i32 0, i32 5
  store i32 %70, ptr %74, align 4, !tbaa !15
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %75

75:                                               ; preds = %91, %68
  %76 = load i32, ptr %7, align 4, !tbaa !9
  %77 = icmp slt i32 %76, 10
  br i1 %77, label %78, label %94

78:                                               ; preds = %75
  %79 = getelementptr inbounds %struct._frameHeader, ptr %10, i32 0, i32 2
  %80 = load i32, ptr %7, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [10 x i8], ptr %79, i64 0, i64 %81
  %83 = load i8, ptr %82, align 1, !tbaa !20
  %84 = load i32, ptr %6, align 4, !tbaa !9
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [10 x %struct._agent], ptr @agent, i64 0, i64 %85
  %87 = getelementptr inbounds %struct._agent, ptr %86, i32 0, i32 6
  %88 = load i32, ptr %7, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [10 x i8], ptr %87, i64 0, i64 %89
  store i8 %83, ptr %90, align 1, !tbaa !20
  br label %91

91:                                               ; preds = %78
  %92 = load i32, ptr %7, align 4, !tbaa !9
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %7, align 4, !tbaa !9
  br label %75, !llvm.loop !21

94:                                               ; preds = %75
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %95

95:                                               ; preds = %156, %94
  %96 = load i32, ptr %7, align 4, !tbaa !9
  %97 = getelementptr inbounds %struct._frameHeader, ptr %10, i32 0, i32 3
  %98 = load i32, ptr %97, align 4, !tbaa !22
  %99 = icmp slt i32 %96, %98
  br i1 %99, label %100, label %159

100:                                              ; preds = %95
  %101 = getelementptr inbounds %struct.RTDBconf_var, ptr %8, i32 0, i32 0
  %102 = getelementptr inbounds [5000 x i8], ptr %4, i64 0, i64 0
  %103 = load i32, ptr %5, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds i8, ptr %102, i64 %104
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %101, ptr align 1 %105, i64 4, i1 false)
  %106 = load i32, ptr %5, align 4, !tbaa !9
  %107 = sext i32 %106 to i64
  %108 = add i64 %107, 4
  %109 = trunc i64 %108 to i32
  store i32 %109, ptr %5, align 4, !tbaa !9
  %110 = getelementptr inbounds %struct.RTDBconf_var, ptr %8, i32 0, i32 1
  %111 = getelementptr inbounds [5000 x i8], ptr %4, i64 0, i64 0
  %112 = load i32, ptr %5, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds i8, ptr %111, i64 %113
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %110, ptr align 1 %114, i64 4, i1 false)
  %115 = load i32, ptr %5, align 4, !tbaa !9
  %116 = sext i32 %115 to i64
  %117 = add i64 %116, 4
  %118 = trunc i64 %117 to i32
  store i32 %118, ptr %5, align 4, !tbaa !9
  %119 = getelementptr inbounds [5000 x i8], ptr %4, i64 0, i64 0
  %120 = load i32, ptr %5, align 4, !tbaa !9
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds i8, ptr %119, i64 %121
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 1 %122, i64 4, i1 false)
  %123 = load i32, ptr %5, align 4, !tbaa !9
  %124 = sext i32 %123 to i64
  %125 = add i64 %124, 4
  %126 = trunc i64 %125 to i32
  store i32 %126, ptr %5, align 4, !tbaa !9
  %127 = load i32, ptr %9, align 4, !tbaa !9
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %9, align 4, !tbaa !9
  %129 = load i32, ptr %6, align 4, !tbaa !9
  %130 = getelementptr inbounds %struct.RTDBconf_var, ptr %8, i32 0, i32 0
  %131 = load i32, ptr %130, align 4, !tbaa !23
  %132 = getelementptr inbounds %struct.RTDBconf_var, ptr %8, i32 0, i32 1
  %133 = load i32, ptr %132, align 4, !tbaa !25
  %134 = getelementptr inbounds [5000 x i8], ptr %4, i64 0, i64 0
  %135 = load i32, ptr %5, align 4, !tbaa !9
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds i8, ptr %134, i64 %136
  %138 = load i32, ptr %9, align 4, !tbaa !9
  %139 = call noundef i32 @_Z11DB_comm_putiiiPvi(i32 noundef %129, i32 noundef %131, i32 noundef %133, ptr noundef %137, i32 noundef %138)
  store i32 %139, ptr %11, align 4, !tbaa !9
  %140 = getelementptr inbounds %struct.RTDBconf_var, ptr %8, i32 0, i32 1
  %141 = load i32, ptr %140, align 4, !tbaa !25
  %142 = icmp ne i32 %139, %141
  br i1 %142, label %143, label %151

143:                                              ; preds = %100
  %144 = load i32, ptr %6, align 4, !tbaa !9
  %145 = getelementptr inbounds %struct.RTDBconf_var, ptr %8, i32 0, i32 0
  %146 = load i32, ptr %145, align 4, !tbaa !23
  %147 = getelementptr inbounds %struct.RTDBconf_var, ptr %8, i32 0, i32 1
  %148 = load i32, ptr %147, align 4, !tbaa !25
  %149 = load i32, ptr %11, align 4, !tbaa !9
  %150 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.1, ptr noundef @__FUNCTION__._Z17receiveDataThreadPv, i32 noundef %144, i32 noundef %146, i32 noundef %148, i32 noundef %149)
  br label %159

151:                                              ; preds = %100
  %152 = getelementptr inbounds %struct.RTDBconf_var, ptr %8, i32 0, i32 1
  %153 = load i32, ptr %152, align 4, !tbaa !25
  %154 = load i32, ptr %5, align 4, !tbaa !9
  %155 = add nsw i32 %154, %153
  store i32 %155, ptr %5, align 4, !tbaa !9
  br label %156

156:                                              ; preds = %151
  %157 = load i32, ptr %7, align 4, !tbaa !9
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %7, align 4, !tbaa !9
  br label %95, !llvm.loop !26

159:                                              ; preds = %143, %95
  %160 = load i32, ptr %6, align 4, !tbaa !9
  %161 = call noundef i32 @_Z11sync_ratdmai(i32 noundef %160)
  br label %162

162:                                              ; preds = %159, %16
  br label %12, !llvm.loop !13

163:                                              ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 5000, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  ret ptr null
}

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: nounwind
declare i32 @gettimeofday(ptr noundef, ptr noundef) #6

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

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

attributes #0 = { mustprogress 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 = { mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !7, i64 0}
!12 = !{!"_ZTS12_frameHeader", !7, i64 0, !10, i64 4, !7, i64 8, !10, i64 20}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !10, i64 28}
!16 = !{!"_ZTS6_agent", !7, i64 0, !7, i64 1, !7, i64 2, !17, i64 8, !10, i64 24, !10, i64 28, !7, i64 32, !10, i64 44}
!17 = !{!"_ZTS7timeval", !18, i64 0, !18, i64 8}
!18 = !{!"long", !7, i64 0}
!19 = !{!12, !10, i64 4}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !14}
!22 = !{!12, !10, i64 20}
!23 = !{!24, !10, i64 0}
!24 = !{!"_ZTS12RTDBconf_var", !10, i64 0, !10, i64 4, !10, i64 8}
!25 = !{!24, !10, i64 4}
!26 = distinct !{!26, !14}


; 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._agent = type { i8, i8, i8, %struct.timeval, i32, i32, [10 x i8], i32 }
%struct.timeval = type { i64, i64 }

@end = external dso_local local_unnamed_addr global i32, align 4
@lostPackets = external dso_local local_unnamed_addr global [10 x i32], align 16
@myNumber = external dso_local local_unnamed_addr global i32, align 4
@agent = external dso_local global [10 x %struct._agent], align 16
@.str = external hidden unnamed_addr constant [98 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [93 x i8], align 1
@__FUNCTION__._Z17receiveDataThreadPv = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z11sync_ratdmai(i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local noalias noundef ptr @_Z17receiveDataThreadPv(ptr nocapture noundef readonly %0) local_unnamed_addr #2 {
  %2 = alloca [5000 x i8], align 16
  %.sroa.5 = alloca [10 x i8], align 4
  call void @llvm.lifetime.start.p0(i64 5000, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %.sroa.5)
  %3 = load i32, ptr @end, align 4, !tbaa !5
  %.not44 = icmp eq i32 %3, 0
  br i1 %.not44, label %.lr.ph45, label %._crit_edge

.lr.ph45:                                         ; preds = %1
  %.sroa.451.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 4
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  %.sroa.652.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 20
  br label %4

4:                                                ; preds = %.lr.ph45, %.backedge
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(5000) %2, i8 0, i64 5000, i1 false)
  %5 = load i32, ptr %0, align 4, !tbaa !5
  %6 = call noundef i32 @_Z11receiveDataiPvi(i32 noundef %5, ptr noundef nonnull %2, i32 noundef 5000)
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %8, label %.backedge

8:                                                ; preds = %4
  %.sroa.0.0.copyload50 = load i8, ptr %2, align 16
  %.sroa.451.0.copyload = load i32, ptr %.sroa.451.0..sroa_idx, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(10) %.sroa.5, ptr noundef nonnull align 8 dereferenceable(10) %.sroa.5.0..sroa_idx, i64 10, i1 false)
  %.sroa.652.0.copyload = load i32, ptr %.sroa.652.0..sroa_idx, align 4
  %9 = zext i8 %.sroa.0.0.copyload50 to i32
  %10 = zext i8 %.sroa.0.0.copyload50 to i64
  %11 = getelementptr inbounds [10 x %struct._agent], ptr @agent, i64 0, i64 %10
  %12 = getelementptr inbounds i8, ptr %11, i64 8
  %13 = call i32 @gettimeofday(ptr noundef nonnull %12, ptr noundef null) #7
  %14 = load i32, ptr @myNumber, align 4, !tbaa !5
  %15 = icmp eq i32 %14, %9
  br i1 %15, label %.backedge, label %16

16:                                               ; preds = %8
  %17 = getelementptr inbounds i8, ptr %11, i64 28
  %18 = load i32, ptr %17, align 4, !tbaa !9
  %19 = add i32 %18, 1
  %.not39 = icmp eq i32 %19, %.sroa.451.0.copyload
  br i1 %.not39, label %.preheader, label %20

20:                                               ; preds = %16
  %21 = sub i32 %.sroa.451.0.copyload, %19
  %22 = getelementptr inbounds [10 x i32], ptr @lostPackets, i64 0, i64 %10
  store i32 %21, ptr %22, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %20, %16
  store i32 %.sroa.451.0.copyload, ptr %17, align 4, !tbaa !9
  %23 = getelementptr inbounds i8, ptr %11, i64 32
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(10) %23, ptr noundef nonnull align 4 dereferenceable(10) %.sroa.5, i64 10, i1 false), !tbaa !13
  %24 = icmp sgt i32 %.sroa.652.0.copyload, 0
  br i1 %24, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader, %40
  %.043 = phi i32 [ %41, %40 ], [ 24, %.preheader ]
  %.142 = phi i32 [ %42, %40 ], [ 0, %.preheader ]
  %25 = sext i32 %.043 to i64
  %26 = getelementptr inbounds i8, ptr %2, i64 %25
  %.sroa.0.0.copyload = load i32, ptr %26, align 1
  %27 = add i32 %.043, 4
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds i8, ptr %2, i64 %28
  %.sroa.5.4.copyload = load i32, ptr %29, align 1
  %30 = add i32 %.043, 8
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds i8, ptr %2, i64 %31
  %.0.copyload = load i32, ptr %32, align 1
  %33 = add i32 %.043, 12
  %34 = add nsw i32 %.0.copyload, 1
  %35 = sext i32 %33 to i64
  %36 = getelementptr inbounds i8, ptr %2, i64 %35
  %37 = call noundef i32 @_Z11DB_comm_putiiiPvi(i32 noundef %9, i32 noundef %.sroa.0.0.copyload, i32 noundef %.sroa.5.4.copyload, ptr noundef nonnull %36, i32 noundef %34)
  %.not40 = icmp eq i32 %37, %.sroa.5.4.copyload
  br i1 %.not40, label %40, label %38

38:                                               ; preds = %.lr.ph
  %39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @__FUNCTION__._Z17receiveDataThreadPv, i32 noundef %9, i32 noundef %.sroa.0.0.copyload, i32 noundef %.sroa.5.4.copyload, i32 noundef %37)
  br label %.loopexit

40:                                               ; preds = %.lr.ph
  %41 = add nsw i32 %.sroa.5.4.copyload, %33
  %42 = add nuw nsw i32 %.142, 1
  %exitcond.not = icmp eq i32 %42, %.sroa.652.0.copyload
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph, !llvm.loop !14

.loopexit:                                        ; preds = %40, %.preheader, %38
  %43 = call noundef i32 @_Z11sync_ratdmai(i32 noundef %9)
  br label %.backedge

.backedge:                                        ; preds = %4, %.loopexit, %8
  %44 = load i32, ptr @end, align 4, !tbaa !5
  %.not = icmp eq i32 %44, 0
  br i1 %.not, label %4, label %._crit_edge, !llvm.loop !16

._crit_edge:                                      ; preds = %.backedge, %1
  call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %.sroa.5)
  call void @llvm.lifetime.end.p0(i64 5000, ptr nonnull %2) #7
  ret ptr null
}

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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

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

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

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

!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++ TBAA"}
!9 = !{!10, !6, i64 28}
!10 = !{!"_ZTS6_agent", !7, i64 0, !7, i64 1, !7, i64 2, !11, i64 8, !6, i64 24, !6, i64 28, !7, i64 32, !6, i64 44}
!11 = !{!"_ZTS7timeval", !12, i64 0, !12, i64 8}
!12 = !{!"long", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass