#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;
typedef int /*<<< orphan*/ sockaddr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ IPPROTO_UDP;
int /*<<< orphan*/ PF_INET;
int RAND_MAX;
int /*<<< orphan*/ SOCK_DGRAM;
int atoi(char *);
int /*<<< orphan*/ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
scalar_t__ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int getpid();
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ rand();
int /*<<< orphan*/ recvfrom(int, void *, int, int /*<<< orphan*/,
                            struct sockaddr *, int /*<<< orphan*/ *);
int /*<<< orphan*/ sendto(int, void *, int, int /*<<< orphan*/,
                          struct sockaddr *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ srand(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int time(int /*<<< orphan*/ *);
int /*<<< orphan*/ wait(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  int i, nb_proc, total, sock;
  struct sockaddr_in sockaddr;
  if (argc != 2 || !strcmp(argv[1], "-h")) {
    fprintf(stderr, "usage: %s NB_THREADS\n", argv[0]);
    return EXIT_FAILURE;
  }
  nb_proc = atoi(argv[1]);
  total = 0;
  sockaddr.sin_family = AF_INET;
  sockaddr.sin_port = htons(5000);
  sockaddr.sin_addr.s_addr = inet_addr("127.0.0.1");
  for (i = 0; i < nb_proc; ++i) {
    if (fork() == 0) {
      srand(time(NULL) ^ (getpid() << 16));
      int rand_val = (int)(10 * (float)rand() / RAND_MAX);
      sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
      printf("oh\n");
      sendto(sock, (void *)&rand_val, sizeof(int), 0,
             (struct sockaddr *)&sockaddr, sizeof(sockaddr));
      close(sock);
      return EXIT_SUCCESS;
    }
  }
  sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
  bind(sock, (struct sockaddr *)&sockaddr, sizeof(sockaddr));
  printf("eh\n");
  for (i = 0; i < nb_proc; ++i) {
    int buf;
    socklen_t socklen;
    struct sockaddr_in emitter;
    recvfrom(sock, (void *)&buf, sizeof(int), 0, (struct sockaddr *)&emitter,
             &socklen);
    total += buf;
  }
  for (i = 0; i < nb_proc; ++i)
    wait(NULL);
  printf("total = %d\n", total);
  close(sock);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    124d <main+0x3d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdc5(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
jne    127a <main+0x6a>
mov    0x2d74(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xda3(%rip),%rsi
call   10b0 <fprintf@plt>
mov    0x2d48(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    147b <main+0x26b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10f0 <atoi@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    0x2d50(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    $0x1388,%edi
call   1040 <htons@plt>
mov    %eax,-0x2c(%rbp)
lea    0xd6c(%rip),%rdi
call   1090 <inet_addr@plt>
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    13a5 <main+0x195>
mov    $0x0,%al
call   1110 <fork@plt>
cmp    $0x0,%rax
jne    1392 <main+0x182>
xor    %eax,%eax
mov    %eax,%edi
call   10c0 <time@plt>
mov    %eax,-0x4c(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x4c(%rbp),%edi
shl    $0x10,%eax
xor    %eax,%edi
call   1080 <srand@plt>
mov    $0x0,%al
call   1120 <rand@plt>
cvtsi2ss %rax,%xmm1
movss  0xcef(%rip),%xmm0
mulss  %xmm1,%xmm0
mov    0x2cc4(%rip),%rax
cvtsi2ssl (%rax),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x34(%rbp)
mov    0x2c8e(%rip),%rax
mov    (%rax),%edi
mov    0x2c9d(%rip),%rax
mov    (%rax),%esi
mov    0x2c5c(%rip),%rax
mov    (%rax),%edx
call   1130 <socket@plt>
mov    %eax,-0x20(%rbp)
lea    0xcd2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%edi
lea    -0x34(%rbp),%rsi
lea    -0x30(%rbp),%r8
mov    $0x4,%edx
xor    %ecx,%ecx
mov    $0xc,%r9d
call   1060 <sendto@plt>
mov    -0x20(%rbp),%edi
call   1070 <close@plt>
mov    0x2c28(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    147b <main+0x26b>
jmp    1397 <main+0x187>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12c0 <main+0xb0>
mov    0x2c14(%rip),%rax
mov    (%rax),%edi
mov    0x2c23(%rip),%rax
mov    (%rax),%esi
mov    0x2be2(%rip),%rax
mov    (%rax),%edx
call   1130 <socket@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0xc,%edx
call   10e0 <bind@plt>
lea    0xc4b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    142c <main+0x21c>
mov    -0x20(%rbp),%edi
lea    -0x38(%rbp),%rsi
lea    -0x48(%rbp),%r8
mov    $0x4,%edx
xor    %ecx,%ecx
lea    -0x3c(%rbp),%r9
call   10d0 <recvfrom@plt>
mov    -0x38(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    13ee <main+0x1de>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1456 <main+0x246>
xor    %eax,%eax
mov    %eax,%edi
call   1100 <wait@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1433 <main+0x223>
mov    -0x1c(%rbp),%esi
lea    0xbcf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%edi
call   1070 <close@plt>
mov    0x2b3a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    1365 <main+0x145>
mov    0x8(%rbx),%rbp
lea    0xdbf(%rip),%rsi
mov    %rbp,%rdi
call   10b0 <strcmp@plt>
test   %eax,%eax
je     1365 <main+0x145>
mov    %rbp,%rdi
call   1100 <atoi@plt>
mov    %eax,%r15d
mov    0x2d81(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
mov    $0x1388,%edi
call   1050 <htons@plt>
mov    %eax,0xc(%rsp)
lea    0xd9b(%rip),%rdi
call   10a0 <inet_addr@plt>
mov    %eax,0x8(%rsp)
test   %r15d,%r15d
jle    12b5 <main+0x95>
mov    %r15d,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1120 <fork@plt>
test   %rax,%rax
je     1389 <main+0x169>
add    $0xffffffff,%ebx
jne    12a0 <main+0x80>
mov    0x2d04(%rip),%rax
mov    (%rax),%edi
mov    0x2d13(%rip),%rax
mov    (%rax),%esi
mov    0x2cd2(%rip),%rax
mov    (%rax),%edx
call   1140 <socket@plt>
mov    %eax,%r14d
lea    0x8(%rsp),%rsi
mov    %eax,%edi
mov    $0xc,%edx
call   10f0 <bind@plt>
lea    0xd43(%rip),%rdi
call   1030 <puts@plt>
xor    %ebp,%ebp
test   %r15d,%r15d
jle    134d <main+0x12d>
lea    0x18(%rsp),%r12
lea    0x24(%rsp),%r13
mov    %r15d,%ebx
nopl   0x0(%rax)
mov    %r14d,%edi
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
mov    %r12,%r8
mov    %r13,%r9
call   10e0 <recvfrom@plt>
add    0x4(%rsp),%ebp
add    $0xffffffff,%ebx
jne    1310 <main+0xf0>
test   %r15d,%r15d
jle    134d <main+0x12d>
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
call   1110 <wait@plt>
add    $0xffffffff,%r15d
jne    1340 <main+0x120>
lea    0xcd3(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14d,%edi
jmp    141e <main+0x1fe>
mov    0x2c5c(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xc8f(%rip),%rsi
call   10c0 <fprintf@plt>
mov    0x2c34(%rip),%rax
jmp    142a <main+0x20a>
xor    %edi,%edi
call   10d0 <time@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
shl    $0x10,%eax
xor    %eax,%ebx
mov    %ebx,%edi
call   1090 <srand@plt>
xor    %eax,%eax
call   1130 <rand@plt>
cvtsi2ss %rax,%xmm0
mulss  0xc47(%rip),%xmm0
mov    0x2c20(%rip),%rax
cvtsi2ssl (%rax),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,0x18(%rsp)
mov    0x2be9(%rip),%rax
mov    (%rax),%edi
mov    0x2bf8(%rip),%rax
mov    (%rax),%esi
mov    0x2bb7(%rip),%rax
mov    (%rax),%edx
call   1140 <socket@plt>
mov    %eax,%ebx
lea    0xc3d(%rip),%rdi
call   1030 <puts@plt>
lea    0x18(%rsp),%rsi
lea    0x8(%rsp),%r8
mov    %ebx,%edi
mov    $0x4,%edx
xor    %ecx,%ecx
mov    $0xc,%r9d
call   1070 <sendto@plt>
mov    %ebx,%edi
call   1080 <close@plt>
mov    0x2b86(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [3 x i8] c"-h\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"usage: %s NB_THREADS\0A\00"
@EXIT_FAILURE = global i32 0
@AF_INET = global i32 0
@.str.2 = [10 x i8] c"127.0.0.1\00"
@RAND_MAX = global i32 0
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@IPPROTO_UDP = global i32 0
@.str.3 = [4 x i8] c"oh\0A\00"
@EXIT_SUCCESS = global i32 0
@.str.4 = [4 x i8] c"eh\0A\00"
@.str.5 = [12 x i8] c"total = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.sockaddr_in
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca %struct.sockaddr_in
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 2
br i1 %16, label %23, label %17
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @strcmp(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%22 = icmp ne i32 %21, 0
br i1 %22, label %30, label %23
23: ; preds = %17, %2
%24 = load i32, i32* @stderr
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
%28 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = load i32, i32* @EXIT_FAILURE
store i32 %29, i32* %3
br label %118
30: ; preds = %17
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @atoi(i8* %33)
store i32 %34, i32* %7
store i32 0, i32* %8
%35 = load i32, i32* @AF_INET
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 2
store i32 %35, i32* %36
%37 = call i32 @htons(i32 5000)
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
store i32 %37, i32* %38
%39 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%41 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %40, i32 0, i32 0
store i32 %39, i32* %41
store i32 0, i32* %6
br label %42
42: ; preds = %75, %30
%43 = load i32, i32* %6
%44 = load i32, i32* %7
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %78
46: ; preds = %42
%47 = call i64 (...) @fork()
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %74
49: ; preds = %46
%50 = call i32 @time(i32* null)
%51 = call i32 (...) @getpid()
%52 = shl i32 %51, 16
%53 = xor i32 %50, %52
%54 = call i32 @srand(i32 %53)
%55 = call i64 (...) @rand()
%56 = sitofp i64 %55 to float
%57 = fmul float 1.000000e+01, %56
%58 = load i32, i32* @RAND_MAX
%59 = sitofp i32 %58 to float
%60 = fdiv float %57, %59
%61 = fptosi float %60 to i32
store i32 %61, i32* %11
%62 = load i32, i32* @PF_INET
%63 = load i32, i32* @SOCK_DGRAM
%64 = load i32, i32* @IPPROTO_UDP
%65 = call i32 @socket(i32 %62, i32 %63, i32 %64)
store i32 %65, i32* %9
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%67 = load i32, i32* %9
%68 = bitcast i32* %11 to i8*
%69 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%70 = call i32 @sendto(i32 %67, i8* %68, i32 4, i32 0, %struct.sockaddr* %69, i32 12)
%71 = load i32, i32* %9
%72 = call i32 @close(i32 %71)
%73 = load i32, i32* @EXIT_SUCCESS
store i32 %73, i32* %3
br label %118
74: ; preds = %46
br label %75
75: ; preds = %74
%76 = load i32, i32* %6
%77 = add nsw i32 %76, 1
store i32 %77, i32* %6
br label %42
78: ; preds = %42
%79 = load i32, i32* @PF_INET
%80 = load i32, i32* @SOCK_DGRAM
%81 = load i32, i32* @IPPROTO_UDP
%82 = call i32 @socket(i32 %79, i32 %80, i32 %81)
store i32 %82, i32* %9
%83 = load i32, i32* %9
%84 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%85 = call i32 @bind(i32 %83, %struct.sockaddr* %84, i32 12)
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %6
br label %87
87: ; preds = %99, %78
%88 = load i32, i32* %6
%89 = load i32, i32* %7
%90 = icmp slt i32 %88, %89
br i1 %90, label %91, label %102
91: ; preds = %87
%92 = load i32, i32* %9
%93 = bitcast i32* %12 to i8*
%94 = bitcast %struct.sockaddr_in* %14 to %struct.sockaddr*
%95 = call i32 @recvfrom(i32 %92, i8* %93, i32 4, i32 0, %struct.sockaddr* %94, i32* %13)
%96 = load i32, i32* %12
%97 = load i32, i32* %8
%98 = add nsw i32 %97, %96
store i32 %98, i32* %8
br label %99
99: ; preds = %91
%100 = load i32, i32* %6
%101 = add nsw i32 %100, 1
store i32 %101, i32* %6
br label %87
102: ; preds = %87
store i32 0, i32* %6
br label %103
103: ; preds = %109, %102
%104 = load i32, i32* %6
%105 = load i32, i32* %7
%106 = icmp slt i32 %104, %105
br i1 %106, label %107, label %112
107: ; preds = %103
%108 = call i32 @wait(i32* null)
br label %109
109: ; preds = %107
%110 = load i32, i32* %6
%111 = add nsw i32 %110, 1
store i32 %111, i32* %6
br label %103
112: ; preds = %103
%113 = load i32, i32* %8
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %113)
%115 = load i32, i32* %9
%116 = call i32 @close(i32 %115)
%117 = load i32, i32* @EXIT_SUCCESS
store i32 %117, i32* %3
br label %118
118: ; preds = %112, %49, %23
%119 = load i32, i32* %3
ret i32 %119
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [3 x i8] c"-h\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"usage: %s NB_THREADS\0A\00"
@EXIT_FAILURE = global i32 0
@AF_INET = global i32 0
@.str.2 = [10 x i8] c"127.0.0.1\00"
@RAND_MAX = global i32 0
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@IPPROTO_UDP = global i32 0
@EXIT_SUCCESS = global i32 0
@.str.5 = [12 x i8] c"total = %d\0A\00"
@str = [3 x i8] c"eh\00"
@str.6 = [3 x i8] c"oh\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.sockaddr_in
%8 = bitcast %struct.sockaddr_in* %3 to i8*
%9 = icmp eq i32 %0, 2
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @strcmp(i8* dereferenceable(1) %12, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %10, %2
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %1
%18 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i32, i32* @EXIT_FAILURE
br label %91
20: ; preds = %10
%21 = tail call i32 @atoi(i8* %12)
%22 = load i32, i32* @AF_INET
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %22, i32* %23
%24 = tail call i32 @htons(i32 5000)
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %24, i32* %25
%26 = tail call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i32 %26, i32* %27
%28 = icmp sgt i32 %21, 0
br i1 %28, label %31, label %59
29: ; preds = %31
%30 = icmp eq i32 %35, %21
br i1 %30, label %59, label %31
31: ; preds = %20, %29
%32 = phi i32 [ %35, %29 ], [ 0, %20 ]
%33 = tail call i64 (...) @fork()
%34 = icmp eq i64 %33, 0
%35 = add nuw nsw i32 %32, 1
br i1 %34, label %36, label %29
36: ; preds = %31
%37 = tail call i32 @time(i32* null)
%38 = tail call i32 (...) @getpid()
%39 = shl i32 %38, 16
%40 = xor i32 %39, %37
%41 = tail call i32 @srand(i32 %40)
%42 = bitcast i32* %4 to i8*
%43 = tail call i64 (...) @rand()
%44 = sitofp i64 %43 to float
%45 = fmul float %44, 1.000000e+01
%46 = load i32, i32* @RAND_MAX
%47 = sitofp i32 %46 to float
%48 = fdiv float %45, %47
%49 = fptosi float %48 to i32
store i32 %49, i32* %4
%50 = load i32, i32* @PF_INET
%51 = load i32, i32* @SOCK_DGRAM
%52 = load i32, i32* @IPPROTO_UDP
%53 = tail call i32 @socket(i32 %50, i32 %51, i32 %52)
%54 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.6, i64 0, i64 0))
%55 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%56 = call i32 @sendto(i32 %53, i8* %42, i32 4, i32 0, %struct.sockaddr* %55, i32 12)
%57 = call i32 @close(i32 %53)
%58 = load i32, i32* @EXIT_SUCCESS
br label %91
59: ; preds = %29, %20
%60 = load i32, i32* @PF_INET
%61 = load i32, i32* @SOCK_DGRAM
%62 = load i32, i32* @IPPROTO_UDP
%63 = tail call i32 @socket(i32 %60, i32 %61, i32 %62)
%64 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%65 = call i32 @bind(i32 %63, %struct.sockaddr* %64, i32 12)
%66 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br i1 %28, label %67, label %86
67: ; preds = %59
%68 = bitcast i32* %5 to i8*
%69 = bitcast i32* %6 to i8*
%70 = bitcast %struct.sockaddr_in* %7 to i8*
%71 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
br label %73
72: ; preds = %73
br i1 %28, label %81, label %86
73: ; preds = %67, %73
%74 = phi i32 [ 0, %67 ], [ %78, %73 ]
%75 = phi i32 [ 0, %67 ], [ %79, %73 ]
%76 = call i32 @recvfrom(i32 %63, i8* %68, i32 4, i32 0, %struct.sockaddr* %71, i32* %6)
%77 = load i32, i32* %5
%78 = add nsw i32 %77, %74
%79 = add nuw nsw i32 %75, 1
%80 = icmp eq i32 %79, %21
br i1 %80, label %72, label %73
81: ; preds = %72, %81
%82 = phi i32 [ %84, %81 ], [ 0, %72 ]
%83 = call i32 @wait(i32* null)
%84 = add nuw nsw i32 %82, 1
%85 = icmp eq i32 %84, %21
br i1 %85, label %86, label %81
86: ; preds = %81, %59, %72
%87 = phi i32 [ %78, %72 ], [ 0, %59 ], [ %78, %81 ]
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %87)
%89 = call i32 @close(i32 %63)
%90 = load i32, i32* @EXIT_SUCCESS
br label %91
91: ; preds = %86, %36, %15
%92 = phi i32 [ %19, %15 ], [ %58, %36 ], [ %90, %86 ]
ret i32 %92
}