#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;
  scalar_t__ ai_addr;
  void *sin_family;
  int /*<<< orphan*/ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  void *ai_family;
  struct sockaddr_in *ai_next;
  scalar_t__ ai_flags;
};
struct sockaddr {
  int dummy;
};
struct msghdr {
  int msg_iovlen;
  char *msg_control;
  int msg_controllen;
  struct iovec *msg_iov;
  scalar_t__ msg_namelen;
  int /*<<< orphan*/ *msg_name;
};
struct iovec {
  char *iov_base;
  int iov_len;
};
struct addrinfo {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  scalar_t__ ai_addr;
  void *sin_family;
  int /*<<< orphan*/ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  void *ai_family;
  struct addrinfo *ai_next;
  scalar_t__ ai_flags;
};
typedef int /*<<< orphan*/ str_addr;
typedef int /*<<< orphan*/ socklen_t;
typedef int /*<<< orphan*/ set;
typedef int /*<<< orphan*/ server_sock_addr4;
typedef int /*<<< orphan*/ ecn;

/* Variables and functions */
void *AF_INET;
int EXIT_FAILURE;
int EXIT_SUCCESS;
int INET_ADDRSTRLEN;
int /*<<< orphan*/ IPPROTO_IP;
int /*<<< orphan*/ IPPROTO_UDP;
int /*<<< orphan*/ IP_RECVTOS;
int /*<<< orphan*/ IP_TOS;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ display_msg(struct msghdr *, int);
int getaddrinfo(char *, char *, struct sockaddr_in *, struct sockaddr_in **);
int getsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, void *,
               int /*<<< orphan*/ *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_ntop(void *, TYPE_1__ *, char *, int);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int recvmsg(int, struct msghdr *, int /*<<< orphan*/);
int sendmsg(int, struct msghdr *, int /*<<< orphan*/);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, ...);
int socket(void *, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int sock_fd = -1, ret;
  struct addrinfo hints, *result, *rp;
  struct sockaddr_in server_sock_addr4;
  struct msghdr rcv_msg;
  struct msghdr snd_msg;
  struct iovec rcv_iov[1];
  struct iovec snd_iov[1];
  char rcv_buf[65535];
  char snd_buf[65535];
  char str_addr[INET_ADDRSTRLEN];
  char rcv_ctrl_data[8192];
  socklen_t optlen;
  unsigned char set;
  unsigned int ecn;
  if (argc != 2) {
    printf("Syntax: %s server\n", argv[0]);
    return EXIT_FAILURE;
  }
  memset(&hints, 0, sizeof(struct addrinfo));
  hints.ai_family = AF_INET;
  hints.ai_socktype = SOCK_DGRAM;
  hints.ai_flags = 0;
  hints.ai_protocol = IPPROTO_UDP;
  ret = getaddrinfo(argv[1], "9001", &hints, &result);
  if (ret != 0) {
    perror("getaddrinfo()");
    return EXIT_FAILURE;
  }
  for (rp = result; rp != NULL; rp = rp->ai_next) {
    sock_fd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
    if (sock_fd == -1) {
      perror("socket()");
      continue;
    } else {
      break;
    }
  }
  memset(&server_sock_addr4, 0, sizeof(struct sockaddr_in));
  server_sock_addr4.sin_family = AF_INET;
  server_sock_addr4.sin_addr.s_addr =
      ((struct sockaddr_in *)rp->ai_addr)->sin_addr.s_addr;
  server_sock_addr4.sin_port = htons(9001);
  inet_ntop(AF_INET, &(server_sock_addr4.sin_addr), str_addr, sizeof(str_addr));
  if (connect(sock_fd, (struct sockaddr *)&server_sock_addr4,
              sizeof(server_sock_addr4)) == -1) {
    perror("connect()");
    close(sock_fd);
    return EXIT_FAILURE;
  }
  set = 1;
  ret = setsockopt(sock_fd, IPPROTO_IP, IP_RECVTOS, &set, sizeof(set));
  if (ret == -1) {
    perror("setsockopt()");
    close(sock_fd);
    return EXIT_FAILURE;
  }
  ecn = 0x02;
  ret = setsockopt(sock_fd, IPPROTO_IP, IP_TOS, &ecn, sizeof(ecn));
  if (ret == -1) {
    perror("setsockopt()");
    close(sock_fd);
    return EXIT_FAILURE;
  }
  snd_iov[0].iov_base = snd_buf;
  snd_buf[0] = 'a';
  snd_iov[0].iov_len = 1;
  snd_msg.msg_name = NULL;
  snd_msg.msg_namelen = 0;
  snd_msg.msg_iov = snd_iov;
  snd_msg.msg_iovlen = 1;
  snd_msg.msg_control = 0;
  snd_msg.msg_controllen = 0;
  rcv_iov[0].iov_base = rcv_buf;
  rcv_iov[0].iov_len = 65535;
  rcv_msg.msg_name = NULL;
  rcv_msg.msg_namelen = 0;
  rcv_msg.msg_iov = rcv_iov;
  rcv_msg.msg_iovlen = 1;
  rcv_msg.msg_control = rcv_ctrl_data;
  rcv_msg.msg_controllen = 8192;
  if (sendmsg(sock_fd, &snd_msg, 0) == -1) {
    perror("sendmsg()");
    close(sock_fd);
    return EXIT_FAILURE;
  }
  ret = recvmsg(sock_fd, &rcv_msg, 0);
  if (ret == -1) {
    perror("recvmsg()");
    close(sock_fd);
    return EXIT_FAILURE;
  }
  display_msg(&rcv_msg, ret);
  ret = getsockopt(sock_fd, IPPROTO_IP, IP_TOS, (void *)&ecn, &optlen);
  if (ret == -1) {
    perror("getsockopt()");
    close(sock_fd);
    return EXIT_FAILURE;
  }
  close(sock_fd);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x22150,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
mov    0x2db9(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x22150(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x20128(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x22148(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20130(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1274 <main+0x94>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdac(%rip),%rdi
call   1070 <printf@plt>
mov    0x2d58(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x22140(%rbp)
jmp    16de <main+0x4fe>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x38,%edx
call   1080 <memset@plt>
mov    0x2d5d(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    0x2d37(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
movq   $0x0,-0x20(%rbp)
mov    0x2ceb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x50(%rbp),%rdx
lea    -0x58(%rbp),%rcx
lea    0xd4a(%rip),%rsi
call   10f0 <getaddrinfo@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1302 <main+0x122>
lea    0xd36(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2cca(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x22140(%rbp)
jmp    16de <main+0x4fe>
mov    -0x58(%rbp),%rax
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
je     1364 <main+0x184>
mov    -0x60(%rbp),%rax
mov    0x20(%rax),%rdi
mov    -0x60(%rbp),%rax
mov    0x1c(%rax),%esi
mov    -0x60(%rbp),%rax
mov    0x18(%rax),%edx
call   1100 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    134e <main+0x16e>
lea    0xce2(%rip),%rdi
call   10d0 <perror@plt>
jmp    1353 <main+0x173>
jmp    1364 <main+0x184>
mov    -0x60(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x60(%rbp)
jmp    130a <main+0x12a>
lea    -0x98(%rbp),%rdi
xor    %esi,%esi
mov    $0x38,%edx
call   1080 <memset@plt>
mov    0x2c6a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x88(%rbp)
mov    -0x60(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x98(%rbp)
mov    $0x2329,%edi
call   1060 <htons@plt>
mov    -0x22148(%rbp),%rdx
mov    %eax,%ecx
mov    -0x22150(%rbp),%rax
mov    %ecx,-0x94(%rbp)
mov    0x2c29(%rip),%rcx
mov    (%rcx),%rdi
lea    -0x98(%rbp),%rsi
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
mov    -0x14(%rbp),%edi
lea    -0x98(%rbp),%rsi
mov    $0x38,%edx
call   10e0 <connect@plt>
cmp    $0xffffffff,%eax
jne    141c <main+0x23c>
lea    0xc3b(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
mov    0x2bb0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x22140(%rbp)
jmp    16de <main+0x4fe>
movb   $0x1,-0x22135(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2bb3(%rip),%rax
mov    (%rax),%esi
mov    0x2b7a(%rip),%rax
mov    (%rax),%edx
lea    -0x22135(%rbp),%rcx
mov    $0x1,%r8d
mov    $0x0,%al
call   1050 <setsockopt@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    1488 <main+0x2a8>
lea    0xbd9(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
mov    0x2b44(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x22140(%rbp)
jmp    16de <main+0x4fe>
movl   $0x2,-0x2213c(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2b44(%rip),%rax
mov    (%rax),%esi
mov    0x2b33(%rip),%rax
mov    (%rax),%edx
lea    -0x2213c(%rbp),%rcx
mov    $0x4,%r8d
mov    $0x0,%al
call   1050 <setsockopt@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    14f7 <main+0x317>
lea    0xb6a(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
mov    0x2ad5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x22140(%rbp)
jmp    16de <main+0x4fe>
lea    -0x20120(%rbp),%rax
mov    %rax,-0x120(%rbp)
movb   $0x61,-0x20120(%rbp)
movl   $0x1,-0x118(%rbp)
movq   $0x0,-0xd0(%rbp)
movq   $0x0,-0xd8(%rbp)
lea    -0x120(%rbp),%rax
mov    %rax,-0xe0(%rbp)
movl   $0x1,-0xf8(%rbp)
movq   $0x0,-0xf0(%rbp)
movl   $0x0,-0xe8(%rbp)
lea    -0x10120(%rbp),%rax
mov    %rax,-0x110(%rbp)
movl   $0xffff,-0x108(%rbp)
movq   $0x0,-0xa0(%rbp)
movq   $0x0,-0xa8(%rbp)
lea    -0x110(%rbp),%rax
mov    %rax,-0xb0(%rbp)
movl   $0x1,-0xc8(%rbp)
lea    -0x22130(%rbp),%rax
mov    %rax,-0xc0(%rbp)
movl   $0x2000,-0xb8(%rbp)
mov    -0x14(%rbp),%edi
lea    -0xf8(%rbp),%rsi
xor    %edx,%edx
call   1040 <sendmsg@plt>
cmp    $0xffffffff,%eax
jne    1600 <main+0x420>
lea    0xa6e(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
mov    0x29cc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x22140(%rbp)
jmp    16de <main+0x4fe>
mov    -0x14(%rbp),%edi
lea    -0xc8(%rbp),%rsi
xor    %edx,%edx
call   10c0 <recvmsg@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    164d <main+0x46d>
lea    0xa2b(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
mov    0x297f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x22140(%rbp)
jmp    16de <main+0x4fe>
mov    -0x18(%rbp),%esi
lea    -0xc8(%rbp),%rdi
call   10b0 <display_msg@plt>
mov    -0x14(%rbp),%edi
mov    0x297a(%rip),%rax
mov    (%rax),%esi
mov    0x2969(%rip),%rax
mov    (%rax),%edx
lea    -0x2213c(%rbp),%rcx
lea    -0x22134(%rbp),%r8
call   10a0 <getsockopt@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    16c0 <main+0x4e0>
lea    0x9c2(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
mov    0x290c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x22140(%rbp)
jmp    16de <main+0x4fe>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
mov    0x28d9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x22140(%rbp)
mov    -0x20128(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x22118,%rsp
mov    %rsi,%r14
mov    %rsp,%r13
mov    0x2dbf(%rip),%rax
mov    (%rax),%r15d
mov    %rsp,%rbx
lea    0xf(%r15),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
cmp    $0x2,%edi
jne    12d7 <main+0xf7>
lea    -0x108(%rbp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x38,%edx
call   1080 <memset@plt>
mov    0x2dad(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xe8(%rbp)
mov    0x2d84(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xec(%rbp)
movq   $0x0,-0xd8(%rbp)
mov    0x2d32(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xf0(%rbp)
mov    0x8(%r14),%rdi
lea    0xd9a(%rip),%rsi
lea    -0x48(%rbp),%rcx
mov    %r12,%rdx
call   10f0 <getaddrinfo@plt>
test   %eax,%eax
jne    14e2 <main+0x302>
mov    %r13,-0x38(%rbp)
mov    -0x48(%rbp),%r13
test   %r13,%r13
mov    %r15,-0x40(%rbp)
je     12cc <main+0xec>
lea    0xd81(%rip),%r12
mov    0x20(%r13),%rdi
mov    0x18(%r13),%edx
mov    0x1c(%r13),%esi
call   1100 <socket@plt>
cmp    $0xffffffff,%eax
jne    12f2 <main+0x112>
mov    %r12,%rdi
call   10d0 <perror@plt>
mov    0x28(%r13),%r13
test   %r13,%r13
jne    12a5 <main+0xc5>
xor    %r13d,%r13d
mov    $0xffffffff,%r15d
jmp    12f5 <main+0x115>
mov    (%r14),%rsi
lea    0xd1f(%rip),%rdi
call   1070 <printf@plt>
mov    0x2ccb(%rip),%rax
jmp    14c5 <main+0x2e5>
mov    %eax,%r15d
lea    -0x140(%rbp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x38,%edx
call   1080 <memset@plt>
mov    0x2cd6(%rip),%r14
mov    (%r14),%rax
mov    %rax,-0x130(%rbp)
mov    0x8(%r13),%rax
mov    (%rax),%eax
mov    %eax,-0x140(%rbp)
mov    $0x2329,%edi
call   1060 <htons@plt>
mov    %eax,-0x13c(%rbp)
mov    (%r14),%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    -0x40(%rbp),%rcx
call   1030 <inet_ntop@plt>
mov    %r15d,%edi
mov    %r12,%rsi
mov    $0x38,%edx
call   10e0 <connect@plt>
cmp    $0xffffffff,%eax
mov    %r15d,%ebx
je     14f3 <main+0x313>
movb   $0x1,-0x29(%rbp)
mov    0x2c6f(%rip),%r14
mov    (%r14),%esi
mov    0x2c35(%rip),%rax
mov    (%rax),%edx
lea    -0x29(%rbp),%rcx
mov    $0x1,%r8d
mov    %ebx,%edi
xor    %eax,%eax
call   1050 <setsockopt@plt>
cmp    $0xffffffff,%eax
mov    -0x38(%rbp),%r13
je     14d9 <main+0x2f9>
movl   $0x2,-0x30(%rbp)
mov    (%r14),%esi
mov    0x2c2a(%rip),%r15
mov    (%r15),%edx
lea    -0x30(%rbp),%rcx
mov    $0x4,%r8d
mov    %ebx,%edi
xor    %eax,%eax
call   1050 <setsockopt@plt>
cmp    $0xffffffff,%eax
je     14d9 <main+0x2f9>
lea    -0x12140(%rbp),%rax
mov    %rax,-0x60(%rbp)
movb   $0x61,-0x12140(%rbp)
movl   $0x1,-0x58(%rbp)
xorps  %xmm0,%xmm0
movups %xmm0,-0xb0(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0xb8(%rbp)
movl   $0x1,-0xd0(%rbp)
movq   $0x0,-0xc8(%rbp)
movl   $0x0,-0xc0(%rbp)
lea    -0x22140(%rbp),%rax
mov    %rax,-0x70(%rbp)
movl   $0xffff,-0x68(%rbp)
movups %xmm0,-0x80(%rbp)
lea    -0x70(%rbp),%rax
mov    %rax,-0x88(%rbp)
movl   $0x1,-0xa0(%rbp)
lea    -0x2140(%rbp),%rax
mov    %rax,-0x98(%rbp)
movl   $0x2000,-0x90(%rbp)
lea    -0xd0(%rbp),%rsi
mov    %ebx,%edi
xor    %edx,%edx
call   1040 <sendmsg@plt>
cmp    $0xffffffff,%eax
je     1513 <main+0x333>
lea    -0xa0(%rbp),%rsi
mov    %ebx,%edi
xor    %edx,%edx
call   10c0 <recvmsg@plt>
cmp    $0xffffffff,%eax
je     151c <main+0x33c>
lea    -0xa0(%rbp),%rdi
mov    %eax,%esi
call   10b0 <display_msg@plt>
mov    (%r14),%esi
mov    (%r15),%edx
lea    -0x30(%rbp),%rcx
lea    -0x4c(%rbp),%r8
mov    %ebx,%edi
call   10a0 <getsockopt@plt>
cmp    $0xffffffff,%eax
je     1525 <main+0x345>
mov    %ebx,%edi
call   1090 <close@plt>
mov    0x2ae3(%rip),%rax
mov    (%rax),%eax
mov    %r13,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb59(%rip),%rdi
jmp    152c <main+0x34c>
lea    0xb2f(%rip),%rdi
call   10d0 <perror@plt>
jmp    12e6 <main+0x106>
lea    0xb35(%rip),%rdi
call   10d0 <perror@plt>
mov    %ebx,%edi
call   1090 <close@plt>
mov    0x2aab(%rip),%rax
mov    -0x38(%rbp),%r13
jmp    14c5 <main+0x2e5>
lea    0xb2c(%rip),%rdi
jmp    152c <main+0x34c>
lea    0xb2d(%rip),%rdi
jmp    152c <main+0x34c>
lea    0xb2e(%rip),%rdi
call   10d0 <perror@plt>
mov    %ebx,%edi
call   1090 <close@plt>
jmp    12e6 <main+0x106>

LLVM IR (-O0):
%struct.addrinfo = type { %struct.TYPE_2__, i32, i64, i8*, i32, i32, i8*, %struct.addrinfo*, i64 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i64, i8*, i32, i32, i8*, %struct.sockaddr_in*, i64 }
%struct.msghdr = type { i32, i8*, i32, %struct.iovec*, i64, i32* }
%struct.iovec = type { i8*, i32 }
%struct.sockaddr = type { i32 }
@INET_ADDRSTRLEN = global i32 0
@.str = [19 x i8] c"Syntax: %s server\0A\00"
@EXIT_FAILURE = global i32 0
@AF_INET = global i8* null
@SOCK_DGRAM = global i32 0
@IPPROTO_UDP = global i32 0
@.str.1 = [5 x i8] c"9001\00"
@.str.2 = [14 x i8] c"getaddrinfo()\00"
@.str.3 = [9 x i8] c"socket()\00"
@.str.4 = [10 x i8] c"connect()\00"
@IPPROTO_IP = global i32 0
@IP_RECVTOS = global i32 0
@.str.5 = [13 x i8] c"setsockopt()\00"
@IP_TOS = global i32 0
@.str.6 = [10 x i8] c"sendmsg()\00"
@.str.7 = [10 x i8] c"recvmsg()\00"
@.str.8 = [13 x i8] c"getsockopt()\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.addrinfo
%9 = alloca %struct.addrinfo*
%10 = alloca %struct.addrinfo*
%11 = alloca %struct.sockaddr_in
%12 = alloca %struct.msghdr
%13 = alloca %struct.msghdr
%14 = alloca [1 x %struct.iovec]
%15 = alloca [1 x %struct.iovec]
%16 = alloca [65535 x i8]
%17 = alloca [65535 x i8]
%18 = alloca i8*
%19 = alloca i64
%20 = alloca [8192 x i8]
%21 = alloca i32
%22 = alloca i8
%23 = alloca i32
%24 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %6
%25 = load i32, i32* @INET_ADDRSTRLEN
%26 = zext i32 %25 to i64
%27 = call i8* @llvm.stacksave()
store i8* %27, i8** %18
%28 = alloca i8, i64 %26
store i64 %26, i64* %19
%29 = load i32, i32* %4
%30 = icmp ne i32 %29, 2
br i1 %30, label %31, label %37
31: ; preds = %2
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %34)
%36 = load i32, i32* @EXIT_FAILURE
store i32 %36, i32* %3
store i32 1, i32* %24
br label %199
37: ; preds = %2
%38 = bitcast %struct.addrinfo* %8 to %struct.sockaddr_in*
%39 = call i32 @memset(%struct.sockaddr_in* %38, i32 0, i32 56)
%40 = load i8*, i8** @AF_INET
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 6
store i8* %40, i8** %41
%42 = load i32, i32* @SOCK_DGRAM
%43 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 5
store i32 %42, i32* %43
%44 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 8
store i64 0, i64* %44
%45 = load i32, i32* @IPPROTO_UDP
%46 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %8, i32 0, i32 4
store i32 %45, i32* %46
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 1
%49 = load i8*, i8** %48
%50 = bitcast %struct.addrinfo* %8 to %struct.sockaddr_in*
%51 = bitcast %struct.addrinfo** %9 to %struct.sockaddr_in**
%52 = call i32 @getaddrinfo(i8* %49, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %struct.sockaddr_in* %50, %struct.sockaddr_in** %51)
store i32 %52, i32* %7
%53 = load i32, i32* %7
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %37
%56 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%57 = load i32, i32* @EXIT_FAILURE
store i32 %57, i32* %3
store i32 1, i32* %24
br label %199
58: ; preds = %37
%59 = load %struct.addrinfo*, %struct.addrinfo** %9
store %struct.addrinfo* %59, %struct.addrinfo** %10
br label %60
60: ; preds = %79, %58
%61 = load %struct.addrinfo*, %struct.addrinfo** %10
%62 = icmp ne %struct.addrinfo* %61, null
br i1 %62, label %63, label %83
63: ; preds = %60
%64 = load %struct.addrinfo*, %struct.addrinfo** %10
%65 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %64, i32 0, i32 6
%66 = load i8*, i8** %65
%67 = load %struct.addrinfo*, %struct.addrinfo** %10
%68 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %67, i32 0, i32 5
%69 = load i32, i32* %68
%70 = load %struct.addrinfo*, %struct.addrinfo** %10
%71 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %70, i32 0, i32 4
%72 = load i32, i32* %71
%73 = call i32 @socket(i8* %66, i32 %69, i32 %72)
store i32 %73, i32* %6
%74 = load i32, i32* %6
%75 = icmp eq i32 %74, -1
br i1 %75, label %76, label %78
76: ; preds = %63
%77 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %79
78: ; preds = %63
br label %83
79: ; preds = %76
%80 = load %struct.addrinfo*, %struct.addrinfo** %10
%81 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %80, i32 0, i32 7
%82 = load %struct.addrinfo*, %struct.addrinfo** %81
store %struct.addrinfo* %82, %struct.addrinfo** %10
br label %60
83: ; preds = %78, %60
%84 = call i32 @memset(%struct.sockaddr_in* %11, i32 0, i32 56)
%85 = load i8*, i8** @AF_INET
%86 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 3
store i8* %85, i8** %86
%87 = load %struct.addrinfo*, %struct.addrinfo** %10
%88 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %87, i32 0, i32 2
%89 = load i64, i64* %88
%90 = inttoptr i64 %89 to %struct.sockaddr_in*
%91 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %90, i32 0, i32 0
%92 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %91, i32 0, i32 0
%93 = load i32, i32* %92
%94 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
%95 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %94, i32 0, i32 0
store i32 %93, i32* %95
%96 = call i32 @htons(i32 9001)
%97 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
store i32 %96, i32* %97
%98 = load i8*, i8** @AF_INET
%99 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
%100 = trunc i64 %26 to i32
%101 = call i32 @inet_ntop(i8* %98, %struct.TYPE_2__* %99, i8* %28, i32 %100)
%102 = load i32, i32* %6
%103 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%104 = call i32 @connect(i32 %102, %struct.sockaddr* %103, i32 56)
%105 = icmp eq i32 %104, -1
br i1 %105, label %106, label %111
106: ; preds = %83
%107 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%108 = load i32, i32* %6
%109 = call i32 @close(i32 %108)
%110 = load i32, i32* @EXIT_FAILURE
store i32 %110, i32* %3
store i32 1, i32* %24
br label %199
111: ; preds = %83
store i8 1, i8* %22
%112 = load i32, i32* %6
%113 = load i32, i32* @IPPROTO_IP
%114 = load i32, i32* @IP_RECVTOS
%115 = call i32 (i32, i32, i32, ...) @setsockopt(i32 %112, i32 %113, i32 %114, i8* %22, i64 1)
store i32 %115, i32* %7
%116 = load i32, i32* %7
%117 = icmp eq i32 %116, -1
br i1 %117, label %118, label %123
118: ; preds = %111
%119 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%120 = load i32, i32* %6
%121 = call i32 @close(i32 %120)
%122 = load i32, i32* @EXIT_FAILURE
store i32 %122, i32* %3
store i32 1, i32* %24
br label %199
123: ; preds = %111
store i32 2, i32* %23
%124 = load i32, i32* %6
%125 = load i32, i32* @IPPROTO_IP
%126 = load i32, i32* @IP_TOS
%127 = call i32 (i32, i32, i32, ...) @setsockopt(i32 %124, i32 %125, i32 %126, i32* %23, i64 4)
store i32 %127, i32* %7
%128 = load i32, i32* %7
%129 = icmp eq i32 %128, -1
br i1 %129, label %130, label %135
130: ; preds = %123
%131 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%132 = load i32, i32* %6
%133 = call i32 @close(i32 %132)
%134 = load i32, i32* @EXIT_FAILURE
store i32 %134, i32* %3
store i32 1, i32* %24
br label %199
135: ; preds = %123
%136 = getelementptr inbounds [65535 x i8], [65535 x i8]* %17, i64 0, i64 0
%137 = getelementptr inbounds [1 x %struct.iovec], [1 x %struct.iovec]* %15, i64 0, i64 0
%138 = getelementptr inbounds %struct.iovec, %struct.iovec* %137, i32 0, i32 0
store i8* %136, i8** %138
%139 = getelementptr inbounds [65535 x i8], [65535 x i8]* %17, i64 0, i64 0
store i8 97, i8* %139
%140 = getelementptr inbounds [1 x %struct.iovec], [1 x %struct.iovec]* %15, i64 0, i64 0
%141 = getelementptr inbounds %struct.iovec, %struct.iovec* %140, i32 0, i32 1
store i32 1, i32* %141
%142 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %13, i32 0, i32 5
store i32* null, i32** %142
%143 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %13, i32 0, i32 4
store i64 0, i64* %143
%144 = getelementptr inbounds [1 x %struct.iovec], [1 x %struct.iovec]* %15, i64 0, i64 0
%145 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %13, i32 0, i32 3
store %struct.iovec* %144, %struct.iovec** %145
%146 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %13, i32 0, i32 0
store i32 1, i32* %146
%147 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %13, i32 0, i32 1
store i8* null, i8** %147
%148 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %13, i32 0, i32 2
store i32 0, i32* %148
%149 = getelementptr inbounds [65535 x i8], [65535 x i8]* %16, i64 0, i64 0
%150 = getelementptr inbounds [1 x %struct.iovec], [1 x %struct.iovec]* %14, i64 0, i64 0
%151 = getelementptr inbounds %struct.iovec, %struct.iovec* %150, i32 0, i32 0
store i8* %149, i8** %151
%152 = getelementptr inbounds [1 x %struct.iovec], [1 x %struct.iovec]* %14, i64 0, i64 0
%153 = getelementptr inbounds %struct.iovec, %struct.iovec* %152, i32 0, i32 1
store i32 65535, i32* %153
%154 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 5
store i32* null, i32** %154
%155 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 4
store i64 0, i64* %155
%156 = getelementptr inbounds [1 x %struct.iovec], [1 x %struct.iovec]* %14, i64 0, i64 0
%157 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 3
store %struct.iovec* %156, %struct.iovec** %157
%158 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 0
store i32 1, i32* %158
%159 = getelementptr inbounds [8192 x i8], [8192 x i8]* %20, i64 0, i64 0
%160 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 1
store i8* %159, i8** %160
%161 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %12, i32 0, i32 2
store i32 8192, i32* %161
%162 = load i32, i32* %6
%163 = call i32 @sendmsg(i32 %162, %struct.msghdr* %13, i32 0)
%164 = icmp eq i32 %163, -1
br i1 %164, label %165, label %170
165: ; preds = %135
%166 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%167 = load i32, i32* %6
%168 = call i32 @close(i32 %167)
%169 = load i32, i32* @EXIT_FAILURE
store i32 %169, i32* %3
store i32 1, i32* %24
br label %199
170: ; preds = %135
%171 = load i32, i32* %6
%172 = call i32 @recvmsg(i32 %171, %struct.msghdr* %12, i32 0)
store i32 %172, i32* %7
%173 = load i32, i32* %7
%174 = icmp eq i32 %173, -1
br i1 %174, label %175, label %180
175: ; preds = %170
%176 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%177 = load i32, i32* %6
%178 = call i32 @close(i32 %177)
%179 = load i32, i32* @EXIT_FAILURE
store i32 %179, i32* %3
store i32 1, i32* %24
br label %199
180: ; preds = %170
%181 = load i32, i32* %7
%182 = call i32 @display_msg(%struct.msghdr* %12, i32 %181)
%183 = load i32, i32* %6
%184 = load i32, i32* @IPPROTO_IP
%185 = load i32, i32* @IP_TOS
%186 = bitcast i32* %23 to i8*
%187 = call i32 @getsockopt(i32 %183, i32 %184, i32 %185, i8* %186, i32* %21)
store i32 %187, i32* %7
%188 = load i32, i32* %7
%189 = icmp eq i32 %188, -1
br i1 %189, label %190, label %195
190: ; preds = %180
%191 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%192 = load i32, i32* %6
%193 = call i32 @close(i32 %192)
%194 = load i32, i32* @EXIT_FAILURE
store i32 %194, i32* %3
store i32 1, i32* %24
br label %199
195: ; preds = %180
%196 = load i32, i32* %6
%197 = call i32 @close(i32 %196)
%198 = load i32, i32* @EXIT_SUCCESS
store i32 %198, i32* %3
store i32 1, i32* %24
br label %199
199: ; preds = %195, %190, %175, %165, %130, %118, %106, %55, %31
%200 = load i8*, i8** %18
%201 = load i32, i32* %3
ret i32 %201
}

LLVM IR (-O2):
%struct.addrinfo = type { %struct.TYPE_2__, i32, i64, i8*, i32, i32, i8*, %struct.addrinfo*, i64 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i64, i8*, i32, i32, i8*, %struct.sockaddr_in*, i64 }
%struct.msghdr = type { i32, i8*, i32, %struct.iovec*, i64, i32* }
%struct.iovec = type { i8*, i32 }
%struct.sockaddr = type { i32 }
@INET_ADDRSTRLEN = global i32 0
@.str = [19 x i8] c"Syntax: %s server\0A\00"
@EXIT_FAILURE = global i32 0
@AF_INET = global i8* null
@SOCK_DGRAM = global i32 0
@IPPROTO_UDP = global i32 0
@.str.1 = [5 x i8] c"9001\00"
@.str.2 = [14 x i8] c"getaddrinfo()\00"
@.str.3 = [9 x i8] c"socket()\00"
@.str.4 = [10 x i8] c"connect()\00"
@IPPROTO_IP = global i32 0
@IP_RECVTOS = global i32 0
@.str.5 = [13 x i8] c"setsockopt()\00"
@IP_TOS = global i32 0
@.str.6 = [10 x i8] c"sendmsg()\00"
@.str.7 = [10 x i8] c"recvmsg()\00"
@.str.8 = [13 x i8] c"getsockopt()\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = alloca %struct.sockaddr_in
%6 = alloca %struct.msghdr
%7 = alloca %struct.msghdr
%8 = alloca [1 x %struct.iovec]
%9 = alloca [1 x %struct.iovec]
%10 = alloca [65535 x i8]
%11 = alloca [65535 x i8]
%12 = alloca [8192 x i8]
%13 = alloca i32
%14 = alloca i8
%15 = alloca i32
%16 = bitcast %struct.addrinfo* %3 to i8*
%17 = bitcast %struct.addrinfo** %4 to i8*
%18 = bitcast %struct.sockaddr_in* %5 to i8*
%19 = bitcast %struct.msghdr* %6 to i8*
%20 = bitcast %struct.msghdr* %7 to i8*
%21 = bitcast [1 x %struct.iovec]* %8 to i8*
%22 = bitcast [1 x %struct.iovec]* %9 to i8*
%23 = getelementptr inbounds [65535 x i8], [65535 x i8]* %10, i64 0, i64 0
%24 = getelementptr inbounds [65535 x i8], [65535 x i8]* %11, i64 0, i64 0
%25 = load i32, i32* @INET_ADDRSTRLEN
%26 = zext i32 %25 to i64
%27 = tail call i8* @llvm.stacksave()
%28 = alloca i8, i64 %26
%29 = getelementptr inbounds [8192 x i8], [8192 x i8]* %12, i64 0, i64 0
%30 = bitcast i32* %13 to i8*
%31 = bitcast i32* %15 to i8*
%32 = icmp eq i32 %0, 2
br i1 %32, label %36, label %33
33: ; preds = %2
%34 = load i8*, i8** %1
%35 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %34)
br label %151
36: ; preds = %2
%37 = bitcast %struct.addrinfo* %3 to %struct.sockaddr_in*
%38 = call i32 @memset(%struct.sockaddr_in* %37, i32 0, i32 56)
%39 = load i8*, i8** @AF_INET
%40 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 6
store i8* %39, i8** %40
%41 = load i32, i32* @SOCK_DGRAM
%42 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 5
store i32 %41, i32* %42
%43 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 8
store i64 0, i64* %43
%44 = load i32, i32* @IPPROTO_UDP
%45 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i32 %44, i32* %45
%46 = getelementptr inbounds i8*, i8** %1, i64 1
%47 = load i8*, i8** %46
%48 = bitcast %struct.addrinfo** %4 to %struct.sockaddr_in**
%49 = call i32 @getaddrinfo(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %struct.sockaddr_in* %37, %struct.sockaddr_in** %48)
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %36
%52 = load %struct.addrinfo*, %struct.addrinfo** %4
%53 = icmp eq %struct.addrinfo* %52, null
br i1 %53, label %71, label %56
54: ; preds = %36
%55 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %151
56: ; preds = %51, %66
%57 = phi %struct.addrinfo* [ %69, %66 ], [ %52, %51 ]
%58 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %57, i64 0, i32 6
%59 = load i8*, i8** %58
%60 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %57, i64 0, i32 5
%61 = load i32, i32* %60
%62 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %57, i64 0, i32 4
%63 = load i32, i32* %62
%64 = call i32 @socket(i8* %59, i32 %61, i32 %63)
%65 = icmp eq i32 %64, -1
br i1 %65, label %66, label %71
66: ; preds = %56
%67 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%68 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %57, i64 0, i32 7
%69 = load %struct.addrinfo*, %struct.addrinfo** %68
%70 = icmp eq %struct.addrinfo* %69, null
br i1 %70, label %71, label %56
71: ; preds = %66, %56, %51
%72 = phi %struct.addrinfo* [ null, %51 ], [ %57, %56 ], [ null, %66 ]
%73 = phi i32 [ -1, %51 ], [ %64, %56 ], [ -1, %66 ]
%74 = call i32 @memset(%struct.sockaddr_in* %5, i32 0, i32 56)
%75 = load i8*, i8** @AF_INET
%76 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 3
store i8* %75, i8** %76
%77 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %72, i64 0, i32 2
%78 = load i64, i64* %77
%79 = inttoptr i64 %78 to %struct.sockaddr_in*
%80 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %79, i64 0, i32 0, i32 0
%81 = load i32, i32* %80
%82 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0
%83 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0, i32 0
store i32 %81, i32* %83
%84 = call i32 @htons(i32 9001)
%85 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 1
store i32 %84, i32* %85
%86 = load i8*, i8** @AF_INET
%87 = call i32 @inet_ntop(i8* %86, %struct.TYPE_2__* %82, i8* %28, i32 %25)
%88 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%89 = call i32 @connect(i32 %73, %struct.sockaddr* %88, i32 56)
%90 = icmp eq i32 %89, -1
br i1 %90, label %91, label %94
91: ; preds = %71
%92 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%93 = call i32 @close(i32 %73)
br label %151
94: ; preds = %71
store i8 1, i8* %14
%95 = load i32, i32* @IPPROTO_IP
%96 = load i32, i32* @IP_RECVTOS
%97 = call i32 (i32, i32, i32, ...) @setsockopt(i32 %73, i32 %95, i32 %96, i8* %14, i64 1)
%98 = icmp eq i32 %97, -1
br i1 %98, label %99, label %102
99: ; preds = %94
%100 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%101 = call i32 @close(i32 %73)
br label %151
102: ; preds = %94
store i32 2, i32* %15
%103 = load i32, i32* @IPPROTO_IP
%104 = load i32, i32* @IP_TOS
%105 = call i32 (i32, i32, i32, ...) @setsockopt(i32 %73, i32 %103, i32 %104, i32* %15, i64 4)
%106 = icmp eq i32 %105, -1
br i1 %106, label %107, label %110
107: ; preds = %102
%108 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%109 = call i32 @close(i32 %73)
br label %151
110: ; preds = %102
%111 = getelementptr inbounds [1 x %struct.iovec], [1 x %struct.iovec]* %9, i64 0, i64 0
%112 = getelementptr inbounds [1 x %struct.iovec], [1 x %struct.iovec]* %9, i64 0, i64 0, i32 0
store i8* %24, i8** %112
store i8 97, i8* %24
%113 = getelementptr inbounds [1 x %struct.iovec], [1 x %struct.iovec]* %9, i64 0, i64 0, i32 1
store i32 1, i32* %113
%114 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %7, i64 0, i32 4
%115 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %7, i64 0, i32 3
%116 = bitcast i64* %114 to i8*
store %struct.iovec* %111, %struct.iovec** %115
%117 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %7, i64 0, i32 0
store i32 1, i32* %117
%118 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %7, i64 0, i32 1
store i8* null, i8** %118
%119 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %7, i64 0, i32 2
store i32 0, i32* %119
%120 = getelementptr inbounds [1 x %struct.iovec], [1 x %struct.iovec]* %8, i64 0, i64 0
%121 = getelementptr inbounds [1 x %struct.iovec], [1 x %struct.iovec]* %8, i64 0, i64 0, i32 0
store i8* %23, i8** %121
%122 = getelementptr inbounds [1 x %struct.iovec], [1 x %struct.iovec]* %8, i64 0, i64 0, i32 1
store i32 65535, i32* %122
%123 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 4
%124 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 3
%125 = bitcast i64* %123 to i8*
store %struct.iovec* %120, %struct.iovec** %124
%126 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 0
store i32 1, i32* %126
%127 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 1
store i8* %29, i8** %127
%128 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 2
store i32 8192, i32* %128
%129 = call i32 @sendmsg(i32 %73, %struct.msghdr* %7, i32 0)
%130 = icmp eq i32 %129, -1
br i1 %130, label %131, label %134
131: ; preds = %110
%132 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%133 = call i32 @close(i32 %73)
br label %151
134: ; preds = %110
%135 = call i32 @recvmsg(i32 %73, %struct.msghdr* %6, i32 0)
%136 = icmp eq i32 %135, -1
br i1 %136, label %137, label %140
137: ; preds = %134
%138 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%139 = call i32 @close(i32 %73)
br label %151
140: ; preds = %134
%141 = call i32 @display_msg(%struct.msghdr* %6, i32 %135)
%142 = load i32, i32* @IPPROTO_IP
%143 = load i32, i32* @IP_TOS
%144 = call i32 @getsockopt(i32 %73, i32 %142, i32 %143, i8* %31, i32* %13)
%145 = icmp eq i32 %144, -1
br i1 %145, label %146, label %149
146: ; preds = %140
%147 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%148 = call i32 @close(i32 %73)
br label %151
149: ; preds = %140
%150 = call i32 @close(i32 %73)
br label %151
151: ; preds = %149, %146, %137, %131, %107, %99, %91, %54, %33
%152 = phi i32* [ @EXIT_FAILURE, %33 ], [ @EXIT_FAILURE, %54 ], [ @EXIT_FAILURE, %91 ], [ @EXIT_FAILURE, %99 ], [ @EXIT_FAILURE, %107 ], [ @EXIT_FAILURE, %131 ], [ @EXIT_FAILURE, %137 ], [ @EXIT_FAILURE, %146 ], [ @EXIT_SUCCESS, %149 ]
%153 = load i32, i32* %152
ret i32 %153
}