#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 {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ servaddr;
typedef int /*<<< orphan*/ sendline;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int /*<<< orphan*/ exit(int);
int getpid();
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sendto(int, char *, int, int /*<<< orphan*/,
                          struct sockaddr *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char **argv) {
  int sockfd, c = 0, pid;
  struct sockaddr_in servaddr;
  char sendline[1400];
  if (argc != 2) {
    printf("usage:  udp-client <IP address>\n");
    exit(1);
  }
  sockfd = socket(AF_INET, SOCK_DGRAM, 0);
  bzero(&servaddr, sizeof(servaddr));
  servaddr.sin_family = AF_INET;
  servaddr.sin_addr.s_addr = inet_addr(argv[1]);
  servaddr.sin_port = htons(32000);
  pid = getpid();
  while (1) {
    c++;
    snprintf((char *)&sendline, sizeof(sendline),
             "+wys9i9fPAzx0MvRzwe0ZqoNv1fYoqjWbGFTNE97KfewSJXsrDnWb4GX/"
             "5NbCsSS7e/O6NptAR9e "
             "oKnX0cQvji4BoGNIkm1hQ3Ux3eb0jcy7zQkdVgSGwP691a9QWzSJpE96V4Klid1se"
             "32SPHfDmAZN "
             "leapTKjCeusG2ryGtJJtUh78gl12RAWKMYu7xmL4J41zR96HHsSEEE0o2xqS4rvK7"
             "fZP92nDWRrt "
             "LDGj9eRXVulOQxUbnKS/adC2/"
             "bwgu5PNPfnfW850UXeiSUyhl1COUpy6jdDKScSUA6mPlcGGNfUq "
             "c5FZbqT6Xi9iMQ5NLjf2Umrgjr3YCrshORqSZFz6PYm3LDESwf++dFWvjTTNI/"
             "1wrEW4WyHbKQI/ "
             "UbCT+yaznys5M+"
             "vyDGCnVz5rDLVjraFEgoSyLEt6xNUtyTTPNA9j6AUXAulxpc3C4gPAGCtG4fyg "
             "AqgwETJp5BkOURWxzcUTgkc48EhS9w4Nh9jM9bU8cugROeEBl3ttgZa/"
             "PWDI8OQndF45wckOjfKA "
             "Ws/"
             "6P3xqIes41MPABHzxTiCjW6xDT2qrOM1io4RlmNEhzVPPj7c1iwAH6PhqW4ByCOLk"
             "idFi9q3D "
             "S7MF0mALxzenjrzs764p8PkalLYkYvM8RoRMNSVJh3v2I525kZrRA/"
             "hvS5h9r+Cs5q1OiBQ5TXz3 "
             "hke6Q1lTiFyVOXBxQT31HqykLBj9xbEezUAP9kvgT/"
             "Jmd8L2Aswg3aqu1wInbu2K8mwOqC/djhn5 "
             "H7qtjGLZ1cphEIVauDoOTaq17ecHwWK8Rn8CdbMBBDT6OKX517g3oO/"
             "VdqimmPl0fu7VSKmqVnF3 "
             "UqKbdJ6Ytqsu1b5YHoujjPnRdd25wryDAv36WLUl76UyVFdChHzd12U1OwdNposwD"
             "Ua+nzaYJTMa "
             "a2aqsPu3gXmC1oiu/una66EA4MpV078WU1RM2szXcBXWjoFXrNl/"
             "YqRIralWhuJjFI6IF5lvupzJ : %09d",
             c);
    sendto(sockfd, sendline, sizeof(sendline), 0, (struct sockaddr *)&servaddr,
           sizeof(servaddr));
    if ((c % 1000000) == 0) {
      printf("[%d] Packets Sent: %d \n", pid, c);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x5a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11d2 <main+0x42>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
mov    0x2dfe(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10b0 <socket@plt>
mov    %eax,-0x14(%rbp)
lea    -0x28(%rbp),%rdi
mov    $0xc,%esi
call   1090 <bzero@plt>
mov    0x2de5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <inet_addr@plt>
mov    %eax,-0x24(%rbp)
mov    $0x7d00,%edi
call   1040 <htons@plt>
mov    %eax,-0x28(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
lea    -0x5a0(%rbp),%rdi
mov    -0x18(%rbp),%ecx
mov    $0x578,%esi
lea    0xdd3(%rip),%rdx
call   1060 <snprintf@plt>
mov    -0x14(%rbp),%edi
lea    -0x5a0(%rbp),%rsi
lea    -0x28(%rbp),%r8
mov    $0x578,%edx
xor    %ecx,%ecx
mov    $0xc,%r9d
call   1070 <sendto@plt>
mov    -0x18(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    129b <main+0x10b>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0x117d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    122f <main+0x9f>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x598,%rsp
cmp    $0x2,%edi
jne    1295 <main+0xf5>
mov    %rsi,%rbx
mov    0x2e24(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2e12(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10c0 <socket@plt>
mov    %eax,%r13d
lea    0x10(%rsp),%rdi
mov    $0xc,%esi
call   10a0 <bzero@plt>
mov    0x0(%rbp),%eax
mov    %eax,0x18(%rsp)
mov    0x8(%rbx),%rdi
call   1090 <inet_addr@plt>
mov    %eax,0x14(%rsp)
mov    $0x7d00,%edi
call   1050 <htons@plt>
mov    %eax,0x10(%rsp)
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %eax,0xc(%rsp)
mov    $0xffffffff,%r15d
mov    $0x1,%ebp
lea    0xdd8(%rip),%r12
lea    0x20(%rsp),%rbx
jmp    1237 <main+0x97>
nop
add    $0xffffffff,%r15d
add    $0x1,%ebp
mov    %ebp,%eax
imul   $0x431bde83,%rax,%rax
shr    $0x32,%rax
imul   $0xf4240,%eax,%r14d
mov    %rbx,%rdi
mov    $0x578,%esi
mov    %r12,%rdx
mov    %ebp,%ecx
call   1070 <snprintf@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    $0x578,%edx
xor    %ecx,%ecx
lea    0x10(%rsp),%r8
mov    $0xc,%r9d
call   1080 <sendto@plt>
add    %r15d,%r14d
jne    1230 <main+0x90>
lea    0x116a(%rip),%rdi
mov    0xc(%rsp),%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1230 <main+0x90>
lea    0x116c(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [33 x i8] c"usage: udp-client <IP address>\0A\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.1 = [1008 x i8] c"+wys9i9fPAzx0MvRzwe0ZqoNv1fYoqjWbGFTNE97KfewSJXsrDnWb4GX/5NbCsSS7e/O6NptAR9e oKnX0cQvji4BoGNIkm1hQ3Ux3eb0jcy7zQkdVgSGwP691a9QWzSJpE96V4Klid1se32SPHfDmAZN leapTKjCeusG2ryGtJJtUh78gl12RAWKMYu7xmL4J41zR96HHsSEEE0o2xqS4rvK7fZP92nDWRrt LDGj9eRXVulOQxUbnKS/adC2/bwgu5PNPfnfW850UXeiSUyhl1COUpy6jdDKScSUA6mPlcGGNfUq c5FZbqT6Xi9iMQ5NLjf2Umrgjr3YCrshORqSZFz6PYm3LDESwf++dFWvjTTNI/1wrEW4WyHbKQI/ UbCT+yaznys5M+vyDGCnVz5rDLVjraFEgoSyLEt6xNUtyTTPNA9j6AUXAulxpc3C4gPAGCtG4fyg AqgwETJp5BkOURWxzcUTgkc48EhS9w4Nh9jM9bU8cugROeEBl3ttgZa/PWDI8OQndF45wckOjfKA Ws/6P3xqIes41MPABHzxTiCjW6xDT2qrOM1io4RlmNEhzVPPj7c1iwAH6PhqW4ByCOLkidFi9q3D S7MF0mALxzenjrzs764p8PkalLYkYvM8RoRMNSVJh3v2I525kZrRA/hvS5h9r+Cs5q1OiBQ5TXz3 hke6Q1lTiFyVOXBxQT31HqykLBj9xbEezUAP9kvgT/Jmd8L2Aswg3aqu1wInbu2K8mwOqC/djhn5 H7qtjGLZ1cphEIVauDoOTaq17ecHwWK8Rn8CdbMBBDT6OKX517g3oO/VdqimmPl0fu7VSKmqVnF3 UqKbdJ6Ytqsu1b5YHoujjPnRdd25wryDAv36WLUl76UyVFdChHzd12U1OwdNposwDUa+nzaYJTMa a2aqsPu3gXmC1oiu/una66EA4MpV078WU1RM2szXcBXWjoFXrNl/YqRIralWhuJjFI6IF5lvupzJ : %09d\00"
@.str.2 = [24 x i8] c"[%d] Packets Sent: %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 %struct.sockaddr_in
%10 = alloca [1400 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = load i32, i32* @AF_INET
%18 = load i32, i32* @SOCK_DGRAM
%19 = call i32 @socket(i32 %17, i32 %18, i32 0)
store i32 %19, i32* %6
%20 = call i32 @bzero(%struct.sockaddr_in* %9, i32 12)
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
store i32 %21, i32* %22
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @inet_addr(i8* %25)
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
%28 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %27, i32 0, i32 0
store i32 %26, i32* %28
%29 = call i32 @htons(i32 32000)
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
store i32 %29, i32* %30
%31 = call i32 (...) @getpid()
store i32 %31, i32* %8
br label %32
32: ; preds = %16, %49
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
%35 = bitcast [1400 x i8]* %10 to i8*
%36 = load i32, i32* %7
%37 = call i32 @snprintf(i8* %35, i32 1400, i8* getelementptr inbounds ([1008 x i8], [1008 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %6
%39 = getelementptr inbounds [1400 x i8], [1400 x i8]* %10, i64 0, i64 0
%40 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%41 = call i32 @sendto(i32 %38, i8* %39, i32 1400, i32 0, %struct.sockaddr* %40, i32 12)
%42 = load i32, i32* %7
%43 = srem i32 %42, 1000000
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %49
45: ; preds = %32
%46 = load i32, i32* %8
%47 = load i32, i32* %7
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %46, i32 %47)
br label %49
49: ; preds = %45, %32
br label %32
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.1 = [1008 x i8] c"+wys9i9fPAzx0MvRzwe0ZqoNv1fYoqjWbGFTNE97KfewSJXsrDnWb4GX/5NbCsSS7e/O6NptAR9e oKnX0cQvji4BoGNIkm1hQ3Ux3eb0jcy7zQkdVgSGwP691a9QWzSJpE96V4Klid1se32SPHfDmAZN leapTKjCeusG2ryGtJJtUh78gl12RAWKMYu7xmL4J41zR96HHsSEEE0o2xqS4rvK7fZP92nDWRrt LDGj9eRXVulOQxUbnKS/adC2/bwgu5PNPfnfW850UXeiSUyhl1COUpy6jdDKScSUA6mPlcGGNfUq c5FZbqT6Xi9iMQ5NLjf2Umrgjr3YCrshORqSZFz6PYm3LDESwf++dFWvjTTNI/1wrEW4WyHbKQI/ UbCT+yaznys5M+vyDGCnVz5rDLVjraFEgoSyLEt6xNUtyTTPNA9j6AUXAulxpc3C4gPAGCtG4fyg AqgwETJp5BkOURWxzcUTgkc48EhS9w4Nh9jM9bU8cugROeEBl3ttgZa/PWDI8OQndF45wckOjfKA Ws/6P3xqIes41MPABHzxTiCjW6xDT2qrOM1io4RlmNEhzVPPj7c1iwAH6PhqW4ByCOLkidFi9q3D S7MF0mALxzenjrzs764p8PkalLYkYvM8RoRMNSVJh3v2I525kZrRA/hvS5h9r+Cs5q1OiBQ5TXz3 hke6Q1lTiFyVOXBxQT31HqykLBj9xbEezUAP9kvgT/Jmd8L2Aswg3aqu1wInbu2K8mwOqC/djhn5 H7qtjGLZ1cphEIVauDoOTaq17ecHwWK8Rn8CdbMBBDT6OKX517g3oO/VdqimmPl0fu7VSKmqVnF3 UqKbdJ6Ytqsu1b5YHoujjPnRdd25wryDAv36WLUl76UyVFdChHzd12U1OwdNposwDUa+nzaYJTMa a2aqsPu3gXmC1oiu/una66EA4MpV078WU1RM2szXcBXWjoFXrNl/YqRIralWhuJjFI6IF5lvupzJ : %09d\00"
@.str.2 = [24 x i8] c"[%d] Packets Sent: %d \0A\00"
@str = [32 x i8] c"usage: udp-client <IP address>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [1400 x i8]
%5 = bitcast %struct.sockaddr_in* %3 to i8*
%6 = getelementptr inbounds [1400 x i8], [1400 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 2
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = load i32, i32* @AF_INET
%13 = load i32, i32* @SOCK_DGRAM
%14 = tail call i32 @socket(i32 %12, i32 %13, i32 0)
%15 = call i32 @bzero(%struct.sockaddr_in* %3, i32 12)
%16 = load i32, i32* @AF_INET
%17 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %16, i32* %17
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = tail call i32 @inet_addr(i8* %19)
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %20, i32* %21
%22 = tail call i32 @htons(i32 32000)
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %22, i32* %23
%24 = tail call i32 (...) @getpid()
%25 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
br label %26
26: ; preds = %35, %11
%27 = phi i32 [ 0, %11 ], [ %28, %35 ]
%28 = add nuw nsw i32 %27, 1
%29 = call i32 @snprintf(i8* %6, i32 1400, i8* getelementptr inbounds ([1008 x i8], [1008 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = call i32 @sendto(i32 %14, i8* %6, i32 1400, i32 0, %struct.sockaddr* %25, i32 12)
%31 = urem i32 %28, 1000000
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %26
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %24, i32 %28)
br label %35
35: ; preds = %33, %26
br label %26
}