#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 */

/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ udp_msg_buffer;
struct timespec {
  int dummy;
};
struct addrinfo {
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ ai_addr;
  scalar_t__ ai_next;
  int /*<<< orphan*/ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ CLOCK_MONOTONIC;
int EAI_SYSTEM;
int /*<<< orphan*/ IPPROTO_UDP;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ assert(int);
int atoi(int /*<<< orphan*/);
int clock_gettime(int /*<<< orphan*/, struct timespec *);
scalar_t__ connect(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
char *gai_strerror(int);
int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
size_t optind;
int /*<<< orphan*/ perror(char *);
int send(int, unsigned char **, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int opt, count, max_count = 0;
  int udp_socket, ret;
  struct addrinfo *result;
  struct addrinfo resolver_hints = {.ai_family = AF_INET,
                                    .ai_socktype = SOCK_DGRAM,
                                    .ai_protocol = IPPROTO_UDP};
  uint32_t dest_addr;
  unsigned char udp_msg_buffer[64];
  assert(64 > sizeof(struct timespec));
  while ((opt = getopt(argc, argv, "n:")) != -1) {
    switch (opt) {
    case 'n':
      max_count = atoi(optarg);
      break;
    default:
      return 1;
    }
  }
  if (!argv[optind]) {
    fputs("need target address as first parameter\n", stderr);
    return 1;
  }
  ret = getaddrinfo(argv[optind], "1492", &resolver_hints, &result);
  if (ret != 0) {
    if (ret == EAI_SYSTEM) {
      perror("getaddrinfo");
    } else {
      fprintf(stderr, "error in getaddrinfo: %s\n", gai_strerror(ret));
    }
    return 1;
  }
  udp_socket = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
  if (udp_socket < 0) {
    perror("error creating udp socket");
    return 1;
  }
  if (result->ai_next)
    fputs("more than one address records found, using the first one\n", stderr);
  if (connect(udp_socket, result->ai_addr, result->ai_addrlen)) {
    perror("error connecting udp socket");
    return 1;
  }
  for (count = 0; !max_count || count < max_count; count++) {
    ret = clock_gettime(CLOCK_MONOTONIC, (struct timespec *)&udp_msg_buffer);
    if (ret < 0)
      perror("error upon clock_gettime");
    ret = send(udp_socket, &udp_msg_buffer, sizeof(udp_msg_buffer), 0);
    if (ret < 0)
      perror("error upon UDP send");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x4c(%rbp)
movq   $0x0,-0x48(%rbp)
mov    0x2d9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x2dbf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2dcb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    $0x1,%edi
call   1070 <assert@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdce(%rip),%rdx
call   10a0 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     127b <main+0xbb>
mov    -0x14(%rbp),%eax
sub    $0x6e,%eax
jne    126a <main+0xaa>
jmp    1254 <main+0x94>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
call   10b0 <atoi@plt>
mov    %eax,-0x1c(%rbp)
jmp    1276 <main+0xb6>
movl   $0x1,-0x4(%rbp)
jmp    148e <main+0x2ce>
jmp    1224 <main+0x64>
mov    -0x10(%rbp),%rax
mov    0x2d3a(%rip),%rcx
mov    (%rcx),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    12b5 <main+0xf5>
mov    0x2d15(%rip),%rax
mov    (%rax),%esi
lea    0xd5f(%rip),%rdi
call   1060 <fputs@plt>
movl   $0x1,-0x4(%rbp)
jmp    148e <main+0x2ce>
mov    -0x10(%rbp),%rax
mov    0x2d00(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xd5d(%rip),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   10d0 <getaddrinfo@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1343 <main+0x183>
mov    -0x24(%rbp),%eax
mov    0x2cde(%rip),%rcx
cmp    (%rcx),%eax
jne    130b <main+0x14b>
lea    0xd2f(%rip),%rdi
call   1090 <perror@plt>
jmp    1337 <main+0x177>
mov    0x2c9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa4(%rbp)
mov    -0x24(%rbp),%edi
call   1050 <gai_strerror@plt>
mov    -0xa4(%rbp),%edi
mov    %rax,%rdx
lea    0xd0a(%rip),%rsi
call   1080 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    148e <main+0x2ce>
mov    0x2c5e(%rip),%rax
mov    (%rax),%edi
mov    0x2c75(%rip),%rax
mov    (%rax),%esi
mov    0x2c3c(%rip),%rax
mov    (%rax),%edx
call   10e0 <socket@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    1388 <main+0x1c8>
lea    0xcdf(%rip),%rdi
call   1090 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    148e <main+0x2ce>
mov    -0x30(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     13ac <main+0x1ec>
mov    0x2c12(%rip),%rax
mov    (%rax),%esi
lea    0xcc9(%rip),%rdi
call   1060 <fputs@plt>
mov    -0x20(%rbp),%edi
mov    -0x30(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
call   10c0 <connect@plt>
cmp    $0x0,%rax
je     13e3 <main+0x223>
lea    0xcd8(%rip),%rdi
call   1090 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    148e <main+0x2ce>
movl   $0x0,-0x18(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0xa5(%rbp)
je     140b <main+0x24b>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
setl   %al
mov    %al,-0xa5(%rbp)
mov    -0xa5(%rbp),%al
test   $0x1,%al
jne    141e <main+0x25e>
jmp    148e <main+0x2ce>
mov    0x2bb3(%rip),%rax
mov    (%rax),%edi
lea    -0xa0(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    144c <main+0x28c>
lea    0xc7f(%rip),%rdi
call   1090 <perror@plt>
mov    -0x20(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    $0x40,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    147b <main+0x2bb>
lea    0xc69(%rip),%rdi
call   1090 <perror@plt>
jmp    1480 <main+0x2c0>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    13ea <main+0x22a>
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
mov    0x2db6(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
mov    0x2dd9(%rip),%r12
mov    (%r12),%eax
mov    %eax,0x24(%rsp)
mov    0x2de2(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
mov    $0x1,%edi
call   1070 <assert@plt>
xor    %r13d,%r13d
lea    0xde8(%rip),%r14
mov    0x2dd9(%rip),%r15
nop
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %r14,%rdx
call   10a0 <getopt@plt>
cmp    $0x6e,%eax
jne    123f <main+0x7f>
mov    (%r15),%edi
call   10b0 <atoi@plt>
mov    %eax,%r13d
jmp    1220 <main+0x60>
cmp    $0xffffffff,%eax
jne    12b9 <main+0xf9>
mov    0x2d75(%rip),%rax
mov    (%rax),%rax
mov    0x0(%rbp,%rax,8),%rdi
test   %rdi,%rdi
je     12a4 <main+0xe4>
lea    0xdcc(%rip),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   10d0 <getaddrinfo@plt>
test   %eax,%eax
je     12cd <main+0x10d>
mov    0x2d57(%rip),%rcx
cmp    (%rcx),%eax
je     13a6 <main+0x1e6>
mov    0x2d28(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1050 <gai_strerror@plt>
lea    0xda4(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1080 <fprintf@plt>
jmp    12b9 <main+0xf9>
mov    0x2d05(%rip),%rax
mov    (%rax),%esi
lea    0xd4f(%rip),%rdi
call   1060 <fputs@plt>
mov    $0x1,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cd4(%rip),%rax
mov    (%rax),%edi
mov    (%r12),%esi
mov    0x2cb7(%rip),%rax
mov    (%rax),%edx
call   10e0 <socket@plt>
test   %eax,%eax
js     13b7 <main+0x1f7>
mov    %eax,%r14d
mov    0x8(%rsp),%rax
cmpq   $0x0,0x8(%rax)
je     1319 <main+0x159>
mov    0x2caa(%rip),%rax
mov    (%rax),%esi
lea    0xd61(%rip),%rdi
call   1060 <fputs@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%edx
mov    0x4(%rax),%esi
mov    %r14d,%edi
call   10c0 <connect@plt>
test   %rax,%rax
jne    13c8 <main+0x208>
test   %r13d,%r13d
js     139f <main+0x1df>
mov    $0x1,%eax
mov    0x2c98(%rip),%rbx
lea    0x30(%rsp),%rbp
lea    0xd93(%rip),%r12
nopl   0x0(%rax)
mov    %eax,%r15d
mov    (%rbx),%edi
mov    %rbp,%rsi
call   1030 <clock_gettime@plt>
test   %eax,%eax
js     1387 <main+0x1c7>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    $0x40,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
test   %eax,%eax
js     1395 <main+0x1d5>
lea    0x1(%r15),%eax
test   %r13d,%r13d
je     1350 <main+0x190>
cmp    %r13d,%r15d
jl     1350 <main+0x190>
jmp    139f <main+0x1df>
lea    0xd38(%rip),%rdi
call   1090 <perror@plt>
jmp    1361 <main+0x1a1>
mov    %r12,%rdi
call   1090 <perror@plt>
jmp    1377 <main+0x1b7>
xor    %eax,%eax
jmp    12be <main+0xfe>
lea    0xc83(%rip),%rdi
call   1090 <perror@plt>
jmp    12b9 <main+0xf9>
lea    0xc98(%rip),%rdi
call   1090 <perror@plt>
jmp    12b9 <main+0xf9>
lea    0xcdb(%rip),%rdi
call   1090 <perror@plt>
jmp    12b9 <main+0xf9>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32, i64, i32, i32, i32 }
%struct.timespec = type { i32 }
@IPPROTO_UDP = global i32 0
@SOCK_DGRAM = global i32 0
@AF_INET = global i32 0
@.str = [3 x i8] c"n:\00"
@optarg = global i32 0
@optind = global i64 0
@.str.1 = [40 x i8] c"need target address as first parameter\0A\00"
@stderr = global i32 0
@.str.2 = [5 x i8] c"1492\00"
@EAI_SYSTEM = global i32 0
@.str.3 = [12 x i8] c"getaddrinfo\00"
@.str.4 = [26 x i8] c"error in getaddrinfo: %s\0A\00"
@PF_INET = global i32 0
@.str.5 = [26 x i8] c"error creating udp socket\00"
@.str.6 = [58 x i8] c"more than one address records found, using the first one\0A\00"
@.str.7 = [28 x i8] c"error connecting udp socket\00"
@CLOCK_MONOTONIC = global i32 0
@.str.8 = [25 x i8] c"error upon clock_gettime\00"
@.str.9 = [20 x i8] c"error upon UDP send\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 i32
%11 = alloca %struct.addrinfo*
%12 = alloca %struct.addrinfo
%13 = alloca i32
%14 = alloca [64 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
%15 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %12, i32 0, i32 0
store i32 0, i32* %15
%16 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %12, i32 0, i32 1
store i32 0, i32* %16
%17 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %12, i32 0, i32 2
store i64 0, i64* %17
%18 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %12, i32 0, i32 3
%19 = load i32, i32* @IPPROTO_UDP
store i32 %19, i32* %18
%20 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %12, i32 0, i32 4
%21 = load i32, i32* @SOCK_DGRAM
store i32 %21, i32* %20
%22 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %12, i32 0, i32 5
%23 = load i32, i32* @AF_INET
store i32 %23, i32* %22
%24 = call i32 @assert(i32 1)
br label %25
25: ; preds = %36, %2
%26 = load i32, i32* %4
%27 = load i8**, i8*** %5
%28 = call i32 @getopt(i32 %26, i8** %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %28, i32* %6
%29 = icmp ne i32 %28, -1
br i1 %29, label %30, label %37
30: ; preds = %25
%31 = load i32, i32* %6
switch i32 %31, label %35 [
i32 110, label %32
]
32: ; preds = %30
%33 = load i32, i32* @optarg
%34 = call i32 @atoi(i32 %33)
store i32 %34, i32* %8
br label %36
35: ; preds = %30
store i32 1, i32* %3
br label %125
36: ; preds = %32
br label %25
37: ; preds = %25
%38 = load i8**, i8*** %5
%39 = load i64, i64* @optind
%40 = getelementptr inbounds i8*, i8** %38, i64 %39
%41 = load i8*, i8** %40
%42 = icmp ne i8* %41, null
br i1 %42, label %46, label %43
43: ; preds = %37
%44 = load i32, i32* @stderr
%45 = call i32 @fputs(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %44)
store i32 1, i32* %3
br label %125
46: ; preds = %37
%47 = load i8**, i8*** %5
%48 = load i64, i64* @optind
%49 = getelementptr inbounds i8*, i8** %47, i64 %48
%50 = load i8*, i8** %49
%51 = call i32 @getaddrinfo(i8* %50, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %struct.addrinfo* %12, %struct.addrinfo** %11)
store i32 %51, i32* %10
%52 = load i32, i32* %10
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %66
54: ; preds = %46
%55 = load i32, i32* %10
%56 = load i32, i32* @EAI_SYSTEM
%57 = icmp eq i32 %55, %56
br i1 %57, label %58, label %60
58: ; preds = %54
%59 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %65
60: ; preds = %54
%61 = load i32, i32* @stderr
%62 = load i32, i32* %10
%63 = call i8* @gai_strerror(i32 %62)
%64 = call i32 @fprintf(i32 %61, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %63)
br label %65
65: ; preds = %60, %58
store i32 1, i32* %3
br label %125
66: ; preds = %46
%67 = load i32, i32* @PF_INET
%68 = load i32, i32* @SOCK_DGRAM
%69 = load i32, i32* @IPPROTO_UDP
%70 = call i32 @socket(i32 %67, i32 %68, i32 %69)
store i32 %70, i32* %9
%71 = load i32, i32* %9
%72 = icmp slt i32 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %66
%74 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %125
75: ; preds = %66
%76 = load %struct.addrinfo*, %struct.addrinfo** %11
%77 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %76, i32 0, i32 2
%78 = load i64, i64* %77
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %83
80: ; preds = %75
%81 = load i32, i32* @stderr
%82 = call i32 @fputs(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.6, i64 0, i64 0), i32 %81)
br label %83
83: ; preds = %80, %75
%84 = load i32, i32* %9
%85 = load %struct.addrinfo*, %struct.addrinfo** %11
%86 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %85, i32 0, i32 1
%87 = load i32, i32* %86
%88 = load %struct.addrinfo*, %struct.addrinfo** %11
%89 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %88, i32 0, i32 0
%90 = load i32, i32* %89
%91 = call i64 @connect(i32 %84, i32 %87, i32 %90)
%92 = icmp ne i64 %91, 0
br i1 %92, label %93, label %95
93: ; preds = %83
%94 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %3
br label %125
95: ; preds = %83
store i32 0, i32* %7
br label %96
96: ; preds = %122, %95
%97 = load i32, i32* %8
%98 = icmp ne i32 %97, 0
br i1 %98, label %99, label %103
99: ; preds = %96
%100 = load i32, i32* %7
%101 = load i32, i32* %8
%102 = icmp slt i32 %100, %101
br label %103
103: ; preds = %99, %96
%104 = phi i1 [ true, %96 ], [ %102, %99 ]
br i1 %104, label %105, label %125
105: ; preds = %103
%106 = load i32, i32* @CLOCK_MONOTONIC
%107 = bitcast [64 x i8]* %14 to %struct.timespec*
%108 = call i32 @clock_gettime(i32 %106, %struct.timespec* %107)
store i32 %108, i32* %10
%109 = load i32, i32* %10
%110 = icmp slt i32 %109, 0
br i1 %110, label %111, label %113
111: ; preds = %105
%112 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
br label %113
113: ; preds = %111, %105
%114 = load i32, i32* %9
%115 = bitcast [64 x i8]* %14 to i8**
%116 = call i32 @send(i32 %114, i8** %115, i32 64, i32 0)
store i32 %116, i32* %10
%117 = load i32, i32* %10
%118 = icmp slt i32 %117, 0
br i1 %118, label %119, label %121
119: ; preds = %113
%120 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
br label %121
121: ; preds = %119, %113
br label %122
122: ; preds = %121
%123 = load i32, i32* %7
%124 = add nsw i32 %123, 1
store i32 %124, i32* %7
br label %96
125: ; preds = %35, %43, %65, %73, %93, %103
%126 = load i32, i32* %3
ret i32 %126
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, i64, i32, i32, i32 }
%struct.timespec = type { i32 }
@IPPROTO_UDP = global i32 0
@SOCK_DGRAM = global i32 0
@AF_INET = global i32 0
@.str = [3 x i8] c"n:\00"
@optarg = global i32 0
@optind = global i64 0
@.str.1 = [40 x i8] c"need target address as first parameter\0A\00"
@stderr = global i32 0
@.str.2 = [5 x i8] c"1492\00"
@EAI_SYSTEM = global i32 0
@.str.3 = [12 x i8] c"getaddrinfo\00"
@.str.4 = [26 x i8] c"error in getaddrinfo: %s\0A\00"
@PF_INET = global i32 0
@.str.5 = [26 x i8] c"error creating udp socket\00"
@.str.6 = [58 x i8] c"more than one address records found, using the first one\0A\00"
@.str.7 = [28 x i8] c"error connecting udp socket\00"
@CLOCK_MONOTONIC = global i32 0
@.str.8 = [25 x i8] c"error upon clock_gettime\00"
@.str.9 = [20 x i8] c"error upon UDP send\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.addrinfo*
%4 = alloca %struct.addrinfo
%5 = alloca [64 x i8]
%6 = bitcast %struct.addrinfo** %3 to i8*
%7 = bitcast %struct.addrinfo* %4 to i8*
%8 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 3
%9 = bitcast %struct.addrinfo* %4 to i8*
%10 = load i32, i32* @IPPROTO_UDP
store i32 %10, i32* %8
%11 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 4
%12 = load i32, i32* @SOCK_DGRAM
store i32 %12, i32* %11
%13 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 5
%14 = load i32, i32* @AF_INET
store i32 %14, i32* %13
%15 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%16 = tail call i32 @assert(i32 1)
br label %17
17: ; preds = %20, %2
%18 = phi i32 [ 0, %2 ], [ %22, %20 ]
%19 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %19, label %92 [
i32 -1, label %23
i32 110, label %20
]
20: ; preds = %17
%21 = load i32, i32* @optarg
%22 = tail call i32 @atoi(i32 %21)
br label %17
23: ; preds = %17
%24 = load i64, i64* @optind
%25 = getelementptr inbounds i8*, i8** %1, i64 %24
%26 = load i8*, i8** %25
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = load i32, i32* @stderr
%30 = tail call i32 @fputs(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %29)
br label %92
31: ; preds = %23
%32 = call i32 @getaddrinfo(i8* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %struct.addrinfo* %4, %struct.addrinfo** %3)
%33 = icmp eq i32 %32, 0
br i1 %33, label %43, label %34
34: ; preds = %31
%35 = load i32, i32* @EAI_SYSTEM
%36 = icmp eq i32 %32, %35
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %92
39: ; preds = %34
%40 = load i32, i32* @stderr
%41 = call i8* @gai_strerror(i32 %32)
%42 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %41)
br label %92
43: ; preds = %31
%44 = load i32, i32* @PF_INET
%45 = load i32, i32* @SOCK_DGRAM
%46 = load i32, i32* @IPPROTO_UDP
%47 = call i32 @socket(i32 %44, i32 %45, i32 %46)
%48 = icmp slt i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %43
%50 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
br label %92
51: ; preds = %43
%52 = load %struct.addrinfo*, %struct.addrinfo** %3
%53 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %52, i64 0, i32 2
%54 = load i64, i64* %53
%55 = icmp eq i64 %54, 0
br i1 %55, label %60, label %56
56: ; preds = %51
%57 = load i32, i32* @stderr
%58 = call i32 @fputs(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.6, i64 0, i64 0), i32 %57)
%59 = load %struct.addrinfo*, %struct.addrinfo** %3
br label %60
60: ; preds = %56, %51
%61 = phi %struct.addrinfo* [ %59, %56 ], [ %52, %51 ]
%62 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %61, i64 0, i32 1
%63 = load i32, i32* %62
%64 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %61, i64 0, i32 0
%65 = load i32, i32* %64
%66 = call i64 @connect(i32 %47, i32 %63, i32 %65)
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %74
68: ; preds = %60
%69 = icmp eq i32 %18, 0
%70 = icmp sgt i32 %18, -1
br i1 %70, label %71, label %92
71: ; preds = %68
%72 = bitcast [64 x i8]* %5 to %struct.timespec*
%73 = bitcast [64 x i8]* %5 to i8**
br label %76
74: ; preds = %60
%75 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
br label %92
76: ; preds = %71, %88
%77 = phi i32 [ 0, %71 ], [ %89, %88 ]
%78 = load i32, i32* @CLOCK_MONOTONIC
%79 = call i32 @clock_gettime(i32 %78, %struct.timespec* %72)
%80 = icmp slt i32 %79, 0
br i1 %80, label %81, label %83
81: ; preds = %76
%82 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
br label %83
83: ; preds = %81, %76
%84 = call i32 @send(i32 %47, i8** %73, i32 64, i32 0)
%85 = icmp slt i32 %84, 0
br i1 %85, label %86, label %88
86: ; preds = %83
%87 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
br label %88
88: ; preds = %83, %86
%89 = add nuw nsw i32 %77, 1
%90 = icmp slt i32 %89, %18
%91 = select i1 %69, i1 true, i1 %90
br i1 %91, label %76, label %92
92: ; preds = %17, %88, %68, %37, %39, %74, %49, %28
%93 = phi i32 [ 1, %49 ], [ 1, %74 ], [ 1, %28 ], [ 1, %39 ], [ 1, %37 ], [ 0, %68 ], [ 0, %88 ], [ 1, %17 ]
ret i32 %93
}