#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 s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct msghdr {
  int msg_namelen;
  int msg_iovlen;
  int msg_controllen;
  struct cmsghdr *msg_control;
  struct iovec *msg_iov;
  struct sockaddr_in *msg_name;
};
struct iovec {
  char *iov_base;
  int iov_len;
};
struct cmsghdr {
  scalar_t__ cmsg_level;
  size_t const cmsg_len;
  int cmsg_type;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ opt_1;
typedef int /*<<< orphan*/ data;
typedef int /*<<< orphan*/ control;
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ addr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
struct cmsghdr *CMSG_FIRSTHDR(struct msghdr *);
struct cmsghdr *CMSG_NXTHDR(struct msghdr *, struct cmsghdr *);
int INADDR_LOOPBACK;
scalar_t__ IPPROTO_IP;
int IP_OPTIONS;
#define IP_PKTINFO 132
#define IP_RECVOPTS 131
int IP_RECVTOS;
int IP_RECVTTL;
#define IP_RETOPTS 130
#define IP_TOS 129
#define IP_TTL 128
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ bind(int /*<<< orphan*/, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ getsockname(int /*<<< orphan*/, struct sockaddr *, int *);
int htonl(int);
int ntohs(int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ print_opts(char *, struct cmsghdr *);
int /*<<< orphan*/ print_pktinfo(struct cmsghdr *);
int /*<<< orphan*/ print_tos(struct cmsghdr *);
int /*<<< orphan*/ print_ttl(struct cmsghdr *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int recvmsg(int /*<<< orphan*/, struct msghdr *, int /*<<< orphan*/);
int send(int, char const *, size_t const, int /*<<< orphan*/);
int /*<<< orphan*/ setsockopt(int, scalar_t__, int, int const *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main(void) {
  int i;
  while ((i = open("/dev/null", O_RDWR)) < 3)
    assert(i >= 0);
  assert(!close(0));
  assert(!close(3));
  if (socket(PF_INET, SOCK_DGRAM, 0)) {
    perror("socket");
    return 77;
  }
  struct sockaddr_in addr = {.sin_family = AF_INET,
                             .sin_addr.s_addr = htonl(INADDR_LOOPBACK)};
  socklen_t len = sizeof(addr);
  assert(!bind(0, (struct sockaddr *)&addr, len));
  assert(!getsockname(0, (struct sockaddr *)&addr, &len));
  assert(socket(PF_INET, SOCK_DGRAM, 0) == 3);
  assert(!connect(3, (struct sockaddr *)&addr, len));
  const int opt_1 = htonl(0x01000000);
  assert(!setsockopt(3, IPPROTO_IP, (IP_OPTIONS), &opt_1, sizeof(opt_1)));
  assert(!setsockopt(0, IPPROTO_IP, (IP_PKTINFO), &opt_1, sizeof(opt_1)));
  assert(!setsockopt(0, IPPROTO_IP, (IP_RECVTTL), &opt_1, sizeof(opt_1)));
  assert(!setsockopt(0, IPPROTO_IP, (IP_RECVTOS), &opt_1, sizeof(opt_1)));
  assert(!setsockopt(0, IPPROTO_IP, (IP_RECVOPTS), &opt_1, sizeof(opt_1)));
  assert(!setsockopt(0, IPPROTO_IP, (IP_RETOPTS), &opt_1, sizeof(opt_1)));
  static const char data[] = "data";
  const size_t size = sizeof(data) - 1;
  assert(send(3, data, size, 0) == (int)size);
  assert(!close(3));
  char buf[size];
  struct iovec iov = {.iov_base = buf, .iov_len = sizeof(buf)};
  struct cmsghdr control[16];
  struct msghdr mh = {.msg_name = &addr,
                      .msg_namelen = len,
                      .msg_iov = &iov,
                      .msg_iovlen = 1,
                      .msg_control = control,
                      .msg_controllen = sizeof(control)};
  assert(recvmsg(0, &mh, 0) == (int)size);
  assert(!close(0));
  printf("recvmsg(0, {msg_name(%u)={sa_family=AF_INET, sin_port=htons(%u)"
         ", sin_addr=inet_addr(\"127.0.0.1\")}, msg_iov(1)=[{\"%s\", %zu}]"
         ", msg_controllen=%zu, [",
         (unsigned)mh.msg_namelen, ntohs(addr.sin_port), data, size,
         mh.msg_controllen);
  struct cmsghdr *c;
  for (c = CMSG_FIRSTHDR(&mh); c; c = CMSG_NXTHDR(&mh, c)) {
    if (IPPROTO_IP != c->cmsg_level)
      continue;
    if (c != control)
      printf(", ");
    printf("{cmsg_len=%zu, cmsg_level=SOL_IP, cmsg_type=", c->cmsg_len);
    switch (c->cmsg_type) {
    case IP_PKTINFO:
      print_pktinfo(c);
      break;
    case IP_TTL:
      print_ttl(c);
      break;
    case IP_TOS:
      print_tos(c);
      break;
    case IP_RECVOPTS:
      print_opts("IP_RECVOPTS", c);
      break;
    case IP_RETOPTS:
      print_opts("IP_RETOPTS", c);
      break;
    default:
      printf("%d", c->cmsg_type);
      break;
    }
    printf("}");
  }
  printf("], msg_flags=0}, 0) = %zu\n", size);
  puts("+++ exited with 0 +++");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2d7f(%rip),%rax
mov    (%rax),%esi
lea    0xda7(%rip),%rdi
call   1110 <open@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x3,%eax
jge    1299 <main+0x49>
cmpl   $0x0,-0x8(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <assert@plt>
jmp    1262 <main+0x12>
xor    %edi,%edi
call   1090 <close@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    $0x3,%edi
call   1090 <close@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    0x2cd3(%rip),%rax
mov    (%rax),%edi
mov    0x2ce2(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1170 <socket@plt>
cmp    $0x0,%eax
je     1308 <main+0xb8>
lea    0xd2c(%rip),%rdi
call   1120 <perror@plt>
movl   $0x4d,-0x4(%rbp)
jmp    17e0 <main+0x590>
movl   $0x0,-0x18(%rbp)
mov    0x2ca2(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,-0x14(%rbp)
mov    0x2cb1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
movl   $0xc,-0x1c(%rbp)
mov    -0x1c(%rbp),%edx
xor    %edi,%edi
mov    %edi,-0x1fc(%rbp)
lea    -0x18(%rbp),%rsi
mov    %rsi,-0x220(%rbp)
call   1100 <bind@plt>
test   %eax,%eax
sete   %al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    -0x220(%rbp),%rsi
mov    -0x1fc(%rbp),%edi
lea    -0x1c(%rbp),%rdx
call   1140 <getsockname@plt>
test   %eax,%eax
sete   %al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    -0x1fc(%rbp),%edx
mov    0x2c1d(%rip),%rax
mov    (%rax),%edi
mov    0x2c2c(%rip),%rax
mov    (%rax),%esi
call   1170 <socket@plt>
sub    $0x3,%eax
sete   %al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    -0x220(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    $0x3,%edi
mov    %edi,-0x1f8(%rbp)
call   1150 <connect@plt>
test   %eax,%eax
sete   %al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    $0x1000000,%edi
call   1080 <htonl@plt>
mov    -0x1f8(%rbp),%edi
mov    %eax,-0x20(%rbp)
mov    0x2bde(%rip),%rax
mov    %rax,-0x208(%rbp)
mov    (%rax),%rsi
mov    0x2bd5(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rcx
mov    %rcx,-0x218(%rbp)
mov    $0x4,%r8d
mov    %r8d,-0x20c(%rbp)
call   1040 <setsockopt@plt>
test   %eax,%eax
sete   %al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    -0x218(%rbp),%rcx
mov    -0x20c(%rbp),%r8d
mov    -0x1fc(%rbp),%edi
mov    -0x208(%rbp),%rax
mov    (%rax),%rsi
mov    $0x84,%edx
call   1040 <setsockopt@plt>
test   %eax,%eax
sete   %al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    -0x218(%rbp),%rcx
mov    -0x20c(%rbp),%r8d
mov    -0x1fc(%rbp),%edi
mov    -0x208(%rbp),%rax
mov    (%rax),%rsi
mov    0x2b5f(%rip),%rax
mov    (%rax),%edx
call   1040 <setsockopt@plt>
test   %eax,%eax
sete   %al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    -0x218(%rbp),%rcx
mov    -0x20c(%rbp),%r8d
mov    -0x1fc(%rbp),%edi
mov    -0x208(%rbp),%rax
mov    (%rax),%rsi
mov    0x2ae6(%rip),%rax
mov    (%rax),%edx
call   1040 <setsockopt@plt>
test   %eax,%eax
sete   %al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    -0x218(%rbp),%rcx
mov    -0x20c(%rbp),%r8d
mov    -0x1fc(%rbp),%edi
mov    -0x208(%rbp),%rax
mov    (%rax),%rsi
mov    $0x83,%edx
call   1040 <setsockopt@plt>
test   %eax,%eax
sete   %al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    -0x218(%rbp),%rcx
mov    -0x20c(%rbp),%r8d
mov    -0x1fc(%rbp),%edi
mov    -0x208(%rbp),%rax
mov    (%rax),%rsi
mov    $0x82,%edx
call   1040 <setsockopt@plt>
test   %eax,%eax
sete   %al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    -0x1fc(%rbp),%ecx
mov    -0x1f8(%rbp),%edi
movq   $0x4,-0x28(%rbp)
lea    0xac1(%rip),%rsi
mov    $0x4,%edx
call   1060 <send@plt>
sub    $0x4,%eax
sete   %al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    -0x1f8(%rbp),%edi
call   1090 <close@plt>
test   %eax,%eax
sete   %al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    %rsp,%rax
mov    %rax,-0x30(%rbp)
mov    %rsp,%rax
add    $0xfffffffffffffff0,%rax
mov    %rax,%rsp
mov    %rax,-0x40(%rbp)
movl   $0x4,-0x38(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x1e8(%rbp)
movl   $0x1,-0x1e4(%rbp)
movl   $0x180,-0x1e0(%rbp)
lea    -0x1c0(%rbp),%rax
mov    %rax,-0x1d8(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0x1d0(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x1c8(%rbp)
xor    %edx,%edx
lea    -0x1e8(%rbp),%rsi
mov    %edx,%edi
call   10e0 <recvmsg@plt>
cmp    $0x4,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <assert@plt>
xor    %edi,%edi
call   1090 <close@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   10b0 <assert@plt>
mov    -0x1e8(%rbp),%eax
mov    %eax,-0x1f4(%rbp)
mov    -0x18(%rbp),%edi
call   10f0 <ntohs@plt>
mov    -0x1f4(%rbp),%esi
mov    %eax,%edx
mov    -0x1e0(%rbp),%r9d
lea    0x9e7(%rip),%rdi
lea    0x9ca(%rip),%rcx
mov    $0x4,%r8d
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x1e8(%rbp),%rdi
call   1160 <CMSG_FIRSTHDR@plt>
mov    %rax,-0x1f0(%rbp)
cmpq   $0x0,-0x1f0(%rbp)
je     17b3 <main+0x563>
mov    0x2949(%rip),%rax
mov    (%rax),%rax
mov    -0x1f0(%rbp),%rcx
cmp    (%rcx),%rax
je     1697 <main+0x447>
jmp    1794 <main+0x544>
mov    -0x1f0(%rbp),%rax
lea    -0x1c0(%rbp),%rcx
cmp    %rcx,%rax
je     16bc <main+0x46c>
lea    0xa08(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x1f0(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0x9f2(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    -0x1f0(%rbp),%rax
mov    0x10(%rax),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x228(%rbp)
sub    $0x4,%eax
ja     176e <main+0x51e>
mov    -0x228(%rbp),%rax
lea    0x8fe(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x1f0(%rbp),%rdi
call   1050 <print_pktinfo@plt>
jmp    1786 <main+0x536>
mov    -0x1f0(%rbp),%rdi
call   10a0 <print_ttl@plt>
jmp    1786 <main+0x536>
mov    -0x1f0(%rbp),%rdi
call   1130 <print_tos@plt>
jmp    1786 <main+0x536>
mov    -0x1f0(%rbp),%rsi
lea    0x9a1(%rip),%rdi
call   10c0 <print_opts@plt>
jmp    1786 <main+0x536>
mov    -0x1f0(%rbp),%rsi
lea    0x995(%rip),%rdi
call   10c0 <print_opts@plt>
jmp    1786 <main+0x536>
mov    -0x1f0(%rbp),%rax
mov    0x10(%rax),%esi
lea    0x985(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0x97a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x1f0(%rbp),%rsi
lea    -0x1e8(%rbp),%rdi
call   10d0 <CMSG_NXTHDR@plt>
mov    %rax,-0x1f0(%rbp)
jmp    166a <main+0x41a>
lea    0x94f(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0x957(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x30(%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    $0x1d8,%rsp
mov    0x2d6d(%rip),%r14
mov    (%r14),%esi
lea    0xd94(%rip),%rdi
call   1120 <open@plt>
cmp    $0x2,%eax
jg     12bc <main+0x5c>
lea    0xd83(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
not    %eax
shr    $0x1f,%eax
mov    %eax,%edi
call   10c0 <assert@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1120 <open@plt>
cmp    $0x3,%eax
jl     12a0 <main+0x40>
xor    %edi,%edi
call   10a0 <close@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   10c0 <assert@plt>
mov    $0x3,%edi
call   10a0 <close@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   10c0 <assert@plt>
mov    0x2cba(%rip),%r14
mov    (%r14),%edi
mov    0x2cc8(%rip),%rbx
mov    (%rbx),%esi
xor    %edx,%edx
call   1180 <socket@plt>
test   %eax,%eax
jne    16a7 <main+0x447>
movl   $0x0,-0x40(%rbp)
mov    0x2ca1(%rip),%rax
mov    (%rax),%edi
call   1090 <htonl@plt>
mov    %eax,-0x3c(%rbp)
mov    0x2cb0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
movl   $0xc,-0x2c(%rbp)
lea    -0x40(%rbp),%r15
xor    %edi,%edi
mov    %r15,%rsi
mov    $0xc,%edx
call   1110 <bind@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   10c0 <assert@plt>
lea    -0x2c(%rbp),%rdx
xor    %edi,%edi
mov    %r15,%rsi
call   1150 <getsockname@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   10c0 <assert@plt>
mov    (%r14),%edi
mov    (%rbx),%esi
xor    %edx,%edx
call   1180 <socket@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   10c0 <assert@plt>
mov    -0x2c(%rbp),%edx
mov    $0x3,%edi
mov    %r15,%rsi
call   1160 <connect@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   10c0 <assert@plt>
mov    $0x1000000,%edi
call   1090 <htonl@plt>
mov    %eax,-0x30(%rbp)
mov    0x2c0e(%rip),%r14
mov    (%r14),%rsi
mov    0x2c0c(%rip),%rax
mov    (%rax),%edx
lea    -0x30(%rbp),%rbx
mov    $0x3,%edi
mov    %rbx,%rcx
mov    $0x4,%r8d
call   1050 <setsockopt@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   10c0 <assert@plt>
mov    (%r14),%rsi
xor    %edi,%edi
mov    $0x84,%edx
mov    %rbx,%rcx
mov    $0x4,%r8d
call   1050 <setsockopt@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   10c0 <assert@plt>
mov    (%r14),%rsi
mov    0x2bc7(%rip),%rax
mov    (%rax),%edx
xor    %edi,%edi
mov    %rbx,%rcx
mov    $0x4,%r8d
call   1050 <setsockopt@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   10c0 <assert@plt>
mov    (%r14),%rsi
mov    0x2b5e(%rip),%rax
mov    (%rax),%edx
xor    %edi,%edi
mov    %rbx,%rcx
mov    $0x4,%r8d
call   1050 <setsockopt@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   10c0 <assert@plt>
mov    (%r14),%rsi
xor    %edi,%edi
mov    $0x83,%edx
mov    %rbx,%rcx
mov    $0x4,%r8d
call   1050 <setsockopt@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   10c0 <assert@plt>
mov    (%r14),%rsi
xor    %edi,%edi
mov    $0x82,%edx
mov    %rbx,%rcx
mov    $0x4,%r8d
call   1050 <setsockopt@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   10c0 <assert@plt>
lea    0xb62(%rip),%r13
mov    $0x4,%edx
mov    $0x3,%edi
mov    %r13,%rsi
xor    %ecx,%ecx
call   1070 <send@plt>
xor    %edi,%edi
cmp    $0x4,%eax
sete   %dil
call   10c0 <assert@plt>
mov    $0x3,%edi
call   10a0 <close@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   10c0 <assert@plt>
mov    %rsp,-0x48(%rbp)
mov    %rsp,%rax
add    $0xfffffffffffffff0,%rax
mov    %rax,%rsp
mov    %rax,-0x80(%rbp)
movl   $0x4,-0x78(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x70(%rbp)
movabs $0x18000000001,%rax
mov    %rax,-0x6c(%rbp)
lea    -0x200(%rbp),%rax
mov    %rax,-0x60(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    %r15,-0x50(%rbp)
lea    -0x70(%rbp),%r15
xor    %edi,%edi
mov    %r15,%rsi
xor    %edx,%edx
call   10f0 <recvmsg@plt>
xor    %edi,%edi
cmp    $0x4,%eax
sete   %dil
call   10c0 <assert@plt>
xor    %edi,%edi
call   10a0 <close@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   10c0 <assert@plt>
mov    -0x70(%rbp),%ebx
mov    -0x40(%rbp),%edi
call   1100 <ntohs@plt>
mov    -0x68(%rbp),%r9d
lea    0xab3(%rip),%rdi
mov    $0x4,%r8d
mov    %ebx,%esi
mov    %eax,%edx
mov    %r13,%rcx
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r15,%rdi
call   1170 <CMSG_FIRSTHDR@plt>
test   %rax,%rax
je     1673 <main+0x413>
mov    %rax,%rbx
lea    0xb1a(%rip),%r15
lea    0xa53(%rip),%r12
lea    -0x70(%rbp),%r13
jmp    15f1 <main+0x391>
lea    0xb4a(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x7d,%edi
call   1030 <putchar@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   10e0 <CMSG_NXTHDR@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1673 <main+0x413>
mov    (%r14),%rax
cmp    (%rbx),%rax
jne    15da <main+0x37a>
lea    -0x200(%rbp),%rax
cmp    %rax,%rbx
je     1613 <main+0x3b3>
lea    0xab1(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x8(%rbx),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x10(%rbx),%esi
lea    -0x80(%rsi),%eax
cmp    $0x4,%eax
ja     15b3 <main+0x353>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
mov    %rbx,%rdi
call   10b0 <print_ttl@plt>
jmp    15d0 <main+0x370>
mov    %rbx,%rdi
call   1140 <print_tos@plt>
jmp    15d0 <main+0x370>
lea    0xaa9(%rip),%rdi
jmp    1659 <main+0x3f9>
lea    0xa94(%rip),%rdi
mov    %rbx,%rsi
call   10d0 <print_opts@plt>
jmp    15d0 <main+0x370>
mov    %rbx,%rdi
call   1060 <print_pktinfo@plt>
jmp    15d0 <main+0x370>
lea    0xa8d(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xa95(%rip),%rdi
call   1040 <puts@plt>
mov    -0x48(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x975(%rip),%rdi
call   1130 <perror@plt>
mov    $0x4d,%eax
jmp    1698 <main+0x438>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.iovec = type { i8*, i32 }
%struct.cmsghdr = type { i64, i64, i32 }
%struct.msghdr = type { i32, i32, i32, %struct.cmsghdr*, %struct.iovec*, %struct.sockaddr_in* }
%struct.sockaddr = type { i32 }
@.str = [10 x i8] c"/dev/null\00"
@O_RDWR = global i32 0
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.1 = [7 x i8] c"socket\00"
@INADDR_LOOPBACK = global i32 0
@AF_INET = global i32 0
@IPPROTO_IP = global i64 0
@IP_OPTIONS = global i32 0
@IP_RECVTTL = global i32 0
@IP_RECVTOS = global i32 0
@main.data = internal constant [5 x i8] c"data\00"
@.str.2 = [147 x i8] c"recvmsg(0, {msg_name(%u)={sa_family=AF_INET, sin_port=htons(%u), sin_addr=inet_addr(\22127.0.0.1\22)}, msg_iov(1)=[{\22%s\22, %zu}], msg_controllen=%zu, [\00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [45 x i8] c"{cmsg_len=%zu, cmsg_level=SOL_IP, cmsg_type=\00"
@.str.5 = [12 x i8] c"IP_RECVOPTS\00"
@.str.6 = [11 x i8] c"IP_RETOPTS\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [2 x i8] c"}\00"
@.str.9 = [27 x i8] c"], msg_flags=0}, 0) = %zu\0A\00"
@.str.10 = [22 x i8] c"+++ exited with 0 +++\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
%7 = alloca i8*
%8 = alloca %struct.iovec
%9 = alloca [16 x %struct.cmsghdr]
%10 = alloca %struct.msghdr
%11 = alloca %struct.cmsghdr*
store i32 0, i32* %1
br label %12
12: ; preds = %16, %0
%13 = load i32, i32* @O_RDWR
%14 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %13)
store i32 %14, i32* %2
%15 = icmp slt i32 %14, 3
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i32, i32* %2
%18 = icmp sge i32 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
br label %12
21: ; preds = %12
%22 = call i32 @close(i32 0)
%23 = icmp ne i32 %22, 0
%24 = xor i1 %23, true
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = call i32 @close(i32 3)
%28 = icmp ne i32 %27, 0
%29 = xor i1 %28, true
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = load i32, i32* @PF_INET
%33 = load i32, i32* @SOCK_DGRAM
%34 = call i32 @socket(i32 %32, i32 %33, i32 0)
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %21
%37 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i32 77, i32* %1
br label %204
38: ; preds = %21
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 0
store i32 0, i32* %39
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 1
%41 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %40, i32 0, i32 0
%42 = load i32, i32* @INADDR_LOOPBACK
%43 = call i32 @htonl(i32 %42)
store i32 %43, i32* %41
%44 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 2
%45 = load i32, i32* @AF_INET
store i32 %45, i32* %44
store i32 12, i32* %4
%46 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%47 = load i32, i32* %4
%48 = call i32 @bind(i32 0, %struct.sockaddr* %46, i32 %47)
%49 = icmp ne i32 %48, 0
%50 = xor i1 %49, true
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
%53 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%54 = call i32 @getsockname(i32 0, %struct.sockaddr* %53, i32* %4)
%55 = icmp ne i32 %54, 0
%56 = xor i1 %55, true
%57 = zext i1 %56 to i32
%58 = call i32 @assert(i32 %57)
%59 = load i32, i32* @PF_INET
%60 = load i32, i32* @SOCK_DGRAM
%61 = call i32 @socket(i32 %59, i32 %60, i32 0)
%62 = icmp eq i32 %61, 3
%63 = zext i1 %62 to i32
%64 = call i32 @assert(i32 %63)
%65 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%66 = load i32, i32* %4
%67 = call i32 @connect(i32 3, %struct.sockaddr* %65, i32 %66)
%68 = icmp ne i32 %67, 0
%69 = xor i1 %68, true
%70 = zext i1 %69 to i32
%71 = call i32 @assert(i32 %70)
%72 = call i32 @htonl(i32 16777216)
store i32 %72, i32* %5
%73 = load i64, i64* @IPPROTO_IP
%74 = load i32, i32* @IP_OPTIONS
%75 = call i32 @setsockopt(i32 3, i64 %73, i32 %74, i32* %5, i32 4)
%76 = icmp ne i32 %75, 0
%77 = xor i1 %76, true
%78 = zext i1 %77 to i32
%79 = call i32 @assert(i32 %78)
%80 = load i64, i64* @IPPROTO_IP
%81 = call i32 @setsockopt(i32 0, i64 %80, i32 132, i32* %5, i32 4)
%82 = icmp ne i32 %81, 0
%83 = xor i1 %82, true
%84 = zext i1 %83 to i32
%85 = call i32 @assert(i32 %84)
%86 = load i64, i64* @IPPROTO_IP
%87 = load i32, i32* @IP_RECVTTL
%88 = call i32 @setsockopt(i32 0, i64 %86, i32 %87, i32* %5, i32 4)
%89 = icmp ne i32 %88, 0
%90 = xor i1 %89, true
%91 = zext i1 %90 to i32
%92 = call i32 @assert(i32 %91)
%93 = load i64, i64* @IPPROTO_IP
%94 = load i32, i32* @IP_RECVTOS
%95 = call i32 @setsockopt(i32 0, i64 %93, i32 %94, i32* %5, i32 4)
%96 = icmp ne i32 %95, 0
%97 = xor i1 %96, true
%98 = zext i1 %97 to i32
%99 = call i32 @assert(i32 %98)
%100 = load i64, i64* @IPPROTO_IP
%101 = call i32 @setsockopt(i32 0, i64 %100, i32 131, i32* %5, i32 4)
%102 = icmp ne i32 %101, 0
%103 = xor i1 %102, true
%104 = zext i1 %103 to i32
%105 = call i32 @assert(i32 %104)
%106 = load i64, i64* @IPPROTO_IP
%107 = call i32 @setsockopt(i32 0, i64 %106, i32 130, i32* %5, i32 4)
%108 = icmp ne i32 %107, 0
%109 = xor i1 %108, true
%110 = zext i1 %109 to i32
%111 = call i32 @assert(i32 %110)
store i64 4, i64* %6
%112 = call i32 @send(i32 3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @main.data, i64 0, i64 0), i64 4, i32 0)
%113 = icmp eq i32 %112, 4
%114 = zext i1 %113 to i32
%115 = call i32 @assert(i32 %114)
%116 = call i32 @close(i32 3)
%117 = icmp ne i32 %116, 0
%118 = xor i1 %117, true
%119 = zext i1 %118 to i32
%120 = call i32 @assert(i32 %119)
%121 = call i8* @llvm.stacksave()
store i8* %121, i8** %7
%122 = alloca i8, i64 4
%123 = getelementptr inbounds %struct.iovec, %struct.iovec* %8, i32 0, i32 0
store i8* %122, i8** %123
%124 = getelementptr inbounds %struct.iovec, %struct.iovec* %8, i32 0, i32 1
store i32 4, i32* %124
%125 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %10, i32 0, i32 0
%126 = load i32, i32* %4
store i32 %126, i32* %125
%127 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %10, i32 0, i32 1
store i32 1, i32* %127
%128 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %10, i32 0, i32 2
store i32 384, i32* %128
%129 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %10, i32 0, i32 3
%130 = getelementptr inbounds [16 x %struct.cmsghdr], [16 x %struct.cmsghdr]* %9, i64 0, i64 0
store %struct.cmsghdr* %130, %struct.cmsghdr** %129
%131 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %10, i32 0, i32 4
store %struct.iovec* %8, %struct.iovec** %131
%132 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %10, i32 0, i32 5
store %struct.sockaddr_in* %3, %struct.sockaddr_in** %132
%133 = call i32 @recvmsg(i32 0, %struct.msghdr* %10, i32 0)
%134 = icmp eq i32 %133, 4
%135 = zext i1 %134 to i32
%136 = call i32 @assert(i32 %135)
%137 = call i32 @close(i32 0)
%138 = icmp ne i32 %137, 0
%139 = xor i1 %138, true
%140 = zext i1 %139 to i32
%141 = call i32 @assert(i32 %140)
%142 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %10, i32 0, i32 0
%143 = load i32, i32* %142
%144 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 0
%145 = load i32, i32* %144
%146 = call i32 @ntohs(i32 %145)
%147 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %10, i32 0, i32 2
%148 = load i32, i32* %147
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str.2, i64 0, i64 0), i32 %143, i32 %146, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @main.data, i64 0, i64 0), i64 4, i32 %148)
%150 = call %struct.cmsghdr* @CMSG_FIRSTHDR(%struct.msghdr* %10)
store %struct.cmsghdr* %150, %struct.cmsghdr** %11
br label %151
151: ; preds = %197, %38
%152 = load %struct.cmsghdr*, %struct.cmsghdr** %11
%153 = icmp ne %struct.cmsghdr* %152, null
br i1 %153, label %154, label %200
154: ; preds = %151
%155 = load i64, i64* @IPPROTO_IP
%156 = load %struct.cmsghdr*, %struct.cmsghdr** %11
%157 = getelementptr inbounds %struct.cmsghdr, %struct.cmsghdr* %156, i32 0, i32 0
%158 = load i64, i64* %157
%159 = icmp ne i64 %155, %158
br i1 %159, label %160, label %161
160: ; preds = %154
br label %197
161: ; preds = %154
%162 = load %struct.cmsghdr*, %struct.cmsghdr** %11
%163 = getelementptr inbounds [16 x %struct.cmsghdr], [16 x %struct.cmsghdr]* %9, i64 0, i64 0
%164 = icmp ne %struct.cmsghdr* %162, %163
br i1 %164, label %165, label %167
165: ; preds = %161
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %167
167: ; preds = %165, %161
%168 = load %struct.cmsghdr*, %struct.cmsghdr** %11
%169 = getelementptr inbounds %struct.cmsghdr, %struct.cmsghdr* %168, i32 0, i32 1
%170 = load i64, i64* %169
%171 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), i64 %170)
%172 = load %struct.cmsghdr*, %struct.cmsghdr** %11
%173 = getelementptr inbounds %struct.cmsghdr, %struct.cmsghdr* %172, i32 0, i32 2
%174 = load i32, i32* %173
switch i32 %174, label %190 [
i32 132, label %175
i32 128, label %178
i32 129, label %181
i32 131, label %184
i32 130, label %187
]
175: ; preds = %167
%176 = load %struct.cmsghdr*, %struct.cmsghdr** %11
%177 = call i32 @print_pktinfo(%struct.cmsghdr* %176)
br label %195
178: ; preds = %167
%179 = load %struct.cmsghdr*, %struct.cmsghdr** %11
%180 = call i32 @print_ttl(%struct.cmsghdr* %179)
br label %195
181: ; preds = %167
%182 = load %struct.cmsghdr*, %struct.cmsghdr** %11
%183 = call i32 @print_tos(%struct.cmsghdr* %182)
br label %195
184: ; preds = %167
%185 = load %struct.cmsghdr*, %struct.cmsghdr** %11
%186 = call i32 @print_opts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), %struct.cmsghdr* %185)
br label %195
187: ; preds = %167
%188 = load %struct.cmsghdr*, %struct.cmsghdr** %11
%189 = call i32 @print_opts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), %struct.cmsghdr* %188)
br label %195
190: ; preds = %167
%191 = load %struct.cmsghdr*, %struct.cmsghdr** %11
%192 = getelementptr inbounds %struct.cmsghdr, %struct.cmsghdr* %191, i32 0, i32 2
%193 = load i32, i32* %192
%194 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 %193)
br label %195
195: ; preds = %190, %187, %184, %181, %178, %175
%196 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %197
197: ; preds = %195, %160
%198 = load %struct.cmsghdr*, %struct.cmsghdr** %11
%199 = call %struct.cmsghdr* @CMSG_NXTHDR(%struct.msghdr* %10, %struct.cmsghdr* %198)
store %struct.cmsghdr* %199, %struct.cmsghdr** %11
br label %151
200: ; preds = %151
%201 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i64 4)
%202 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %1
%203 = load i8*, i8** %7
br label %204
204: ; preds = %200, %36
%205 = load i32, i32* %1
ret i32 %205
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.iovec = type { i8*, i32 }
%struct.cmsghdr = type { i64, i64, i32 }
%struct.msghdr = type { i32, i32, i32, %struct.cmsghdr*, %struct.iovec*, %struct.sockaddr_in* }
%struct.sockaddr = type { i32 }
@.str = [10 x i8] c"/dev/null\00"
@O_RDWR = global i32 0
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.1 = [7 x i8] c"socket\00"
@INADDR_LOOPBACK = global i32 0
@AF_INET = global i32 0
@IPPROTO_IP = global i64 0
@IP_OPTIONS = global i32 0
@IP_RECVTTL = global i32 0
@IP_RECVTOS = global i32 0
@main.data = internal constant [5 x i8] c"data\00"
@.str.2 = [147 x i8] c"recvmsg(0, {msg_name(%u)={sa_family=AF_INET, sin_port=htons(%u), sin_addr=inet_addr(\22127.0.0.1\22)}, msg_iov(1)=[{\22%s\22, %zu}], msg_controllen=%zu, [\00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [45 x i8] c"{cmsg_len=%zu, cmsg_level=SOL_IP, cmsg_type=\00"
@.str.5 = [12 x i8] c"IP_RECVOPTS\00"
@.str.6 = [11 x i8] c"IP_RETOPTS\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.9 = [27 x i8] c"], msg_flags=0}, 0) = %zu\0A\00"
@.str.10 = [22 x i8] c"+++ exited with 0 +++\00"
define i32 @main() {
%1 = alloca %struct.sockaddr_in
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.iovec
%5 = alloca [16 x %struct.cmsghdr]
%6 = alloca %struct.msghdr
%7 = load i32, i32* @O_RDWR
%8 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = icmp slt i32 %8, 3
br i1 %9, label %10, label %18
10: ; preds = %0, %10
%11 = phi i32 [ %16, %10 ], [ %8, %0 ]
%12 = xor i32 %11, -1
%13 = lshr i32 %12, 31
%14 = tail call i32 @assert(i32 %13)
%15 = load i32, i32* @O_RDWR
%16 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = icmp slt i32 %16, 3
br i1 %17, label %10, label %18
18: ; preds = %10, %0
%19 = tail call i32 @close(i32 0)
%20 = icmp eq i32 %19, 0
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
%23 = tail call i32 @close(i32 3)
%24 = icmp eq i32 %23, 0
%25 = zext i1 %24 to i32
%26 = tail call i32 @assert(i32 %25)
%27 = load i32, i32* @PF_INET
%28 = load i32, i32* @SOCK_DGRAM
%29 = tail call i32 @socket(i32 %27, i32 %28, i32 0)
%30 = icmp eq i32 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %18
%32 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %172
33: ; preds = %18
%34 = bitcast %struct.sockaddr_in* %1 to i8*
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0
store i32 0, i32* %35
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1, i32 0
%37 = load i32, i32* @INADDR_LOOPBACK
%38 = tail call i32 @htonl(i32 %37)
store i32 %38, i32* %36
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
%40 = load i32, i32* @AF_INET
store i32 %40, i32* %39
%41 = bitcast i32* %2 to i8*
store i32 12, i32* %2
%42 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%43 = call i32 @bind(i32 0, %struct.sockaddr* %42, i32 12)
%44 = icmp eq i32 %43, 0
%45 = zext i1 %44 to i32
%46 = call i32 @assert(i32 %45)
%47 = call i32 @getsockname(i32 0, %struct.sockaddr* %42, i32* %2)
%48 = icmp eq i32 %47, 0
%49 = zext i1 %48 to i32
%50 = call i32 @assert(i32 %49)
%51 = load i32, i32* @PF_INET
%52 = load i32, i32* @SOCK_DGRAM
%53 = call i32 @socket(i32 %51, i32 %52, i32 0)
%54 = icmp eq i32 %53, 3
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
%57 = load i32, i32* %2
%58 = call i32 @connect(i32 3, %struct.sockaddr* %42, i32 %57)
%59 = icmp eq i32 %58, 0
%60 = zext i1 %59 to i32
%61 = call i32 @assert(i32 %60)
%62 = bitcast i32* %3 to i8*
%63 = call i32 @htonl(i32 16777216)
store i32 %63, i32* %3
%64 = load i64, i64* @IPPROTO_IP
%65 = load i32, i32* @IP_OPTIONS
%66 = call i32 @setsockopt(i32 3, i64 %64, i32 %65, i32* %3, i32 4)
%67 = icmp eq i32 %66, 0
%68 = zext i1 %67 to i32
%69 = call i32 @assert(i32 %68)
%70 = load i64, i64* @IPPROTO_IP
%71 = call i32 @setsockopt(i32 0, i64 %70, i32 132, i32* %3, i32 4)
%72 = icmp eq i32 %71, 0
%73 = zext i1 %72 to i32
%74 = call i32 @assert(i32 %73)
%75 = load i64, i64* @IPPROTO_IP
%76 = load i32, i32* @IP_RECVTTL
%77 = call i32 @setsockopt(i32 0, i64 %75, i32 %76, i32* %3, i32 4)
%78 = icmp eq i32 %77, 0
%79 = zext i1 %78 to i32
%80 = call i32 @assert(i32 %79)
%81 = load i64, i64* @IPPROTO_IP
%82 = load i32, i32* @IP_RECVTOS
%83 = call i32 @setsockopt(i32 0, i64 %81, i32 %82, i32* %3, i32 4)
%84 = icmp eq i32 %83, 0
%85 = zext i1 %84 to i32
%86 = call i32 @assert(i32 %85)
%87 = load i64, i64* @IPPROTO_IP
%88 = call i32 @setsockopt(i32 0, i64 %87, i32 131, i32* %3, i32 4)
%89 = icmp eq i32 %88, 0
%90 = zext i1 %89 to i32
%91 = call i32 @assert(i32 %90)
%92 = load i64, i64* @IPPROTO_IP
%93 = call i32 @setsockopt(i32 0, i64 %92, i32 130, i32* %3, i32 4)
%94 = icmp eq i32 %93, 0
%95 = zext i1 %94 to i32
%96 = call i32 @assert(i32 %95)
%97 = call i32 @send(i32 3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @main.data, i64 0, i64 0), i64 4, i32 0)
%98 = icmp eq i32 %97, 4
%99 = zext i1 %98 to i32
%100 = call i32 @assert(i32 %99)
%101 = call i32 @close(i32 3)
%102 = icmp eq i32 %101, 0
%103 = zext i1 %102 to i32
%104 = call i32 @assert(i32 %103)
%105 = call i8* @llvm.stacksave()
%106 = alloca [4 x i8]
%107 = getelementptr inbounds [4 x i8], [4 x i8]* %106, i64 0, i64 0
%108 = bitcast %struct.iovec* %4 to i8*
%109 = getelementptr inbounds %struct.iovec, %struct.iovec* %4, i64 0, i32 0
store i8* %107, i8** %109
%110 = getelementptr inbounds %struct.iovec, %struct.iovec* %4, i64 0, i32 1
store i32 4, i32* %110
%111 = bitcast [16 x %struct.cmsghdr]* %5 to i8*
%112 = bitcast %struct.msghdr* %6 to i8*
%113 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 0
%114 = load i32, i32* %2
store i32 %114, i32* %113
%115 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 1
store i32 1, i32* %115
%116 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 2
store i32 384, i32* %116
%117 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 3
%118 = getelementptr inbounds [16 x %struct.cmsghdr], [16 x %struct.cmsghdr]* %5, i64 0, i64 0
store %struct.cmsghdr* %118, %struct.cmsghdr** %117
%119 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 4
store %struct.iovec* %4, %struct.iovec** %119
%120 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 5
store %struct.sockaddr_in* %1, %struct.sockaddr_in** %120
%121 = call i32 @recvmsg(i32 0, %struct.msghdr* %6, i32 0)
%122 = icmp eq i32 %121, 4
%123 = zext i1 %122 to i32
%124 = call i32 @assert(i32 %123)
%125 = call i32 @close(i32 0)
%126 = icmp eq i32 %125, 0
%127 = zext i1 %126 to i32
%128 = call i32 @assert(i32 %127)
%129 = load i32, i32* %113
%130 = load i32, i32* %35
%131 = call i32 @ntohs(i32 %130)
%132 = load i32, i32* %116
%133 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([147 x i8], [147 x i8]* @.str.2, i64 0, i64 0), i32 %129, i32 %131, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @main.data, i64 0, i64 0), i64 4, i32 %132)
%134 = call %struct.cmsghdr* @CMSG_FIRSTHDR(%struct.msghdr* %6)
%135 = icmp eq %struct.cmsghdr* %134, null
br i1 %135, label %169, label %136
136: ; preds = %33, %166
%137 = phi %struct.cmsghdr* [ %167, %166 ], [ %134, %33 ]
%138 = load i64, i64* @IPPROTO_IP
%139 = getelementptr inbounds %struct.cmsghdr, %struct.cmsghdr* %137, i64 0, i32 0
%140 = load i64, i64* %139
%141 = icmp eq i64 %138, %140
br i1 %141, label %142, label %166
142: ; preds = %136
%143 = icmp eq %struct.cmsghdr* %137, %118
br i1 %143, label %146, label %144
144: ; preds = %142
%145 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %146
146: ; preds = %144, %142
%147 = getelementptr inbounds %struct.cmsghdr, %struct.cmsghdr* %137, i64 0, i32 1
%148 = load i64, i64* %147
%149 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), i64 %148)
%150 = getelementptr inbounds %struct.cmsghdr, %struct.cmsghdr* %137, i64 0, i32 2
%151 = load i32, i32* %150
switch i32 %151, label %162 [
i32 132, label %152
i32 128, label %154
i32 129, label %156
i32 131, label %158
i32 130, label %160
]
152: ; preds = %146
%153 = call i32 @print_pktinfo(%struct.cmsghdr* %137)
br label %164
154: ; preds = %146
%155 = call i32 @print_ttl(%struct.cmsghdr* %137)
br label %164
156: ; preds = %146
%157 = call i32 @print_tos(%struct.cmsghdr* %137)
br label %164
158: ; preds = %146
%159 = call i32 @print_opts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), %struct.cmsghdr* %137)
br label %164
160: ; preds = %146
%161 = call i32 @print_opts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), %struct.cmsghdr* %137)
br label %164
162: ; preds = %146
%163 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 %151)
br label %164
164: ; preds = %162, %160, %158, %156, %154, %152
%165 = call i32 @putchar(i32 125)
br label %166
166: ; preds = %136, %164
%167 = call %struct.cmsghdr* @CMSG_NXTHDR(%struct.msghdr* %6, %struct.cmsghdr* %137)
%168 = icmp eq %struct.cmsghdr* %167, null
br i1 %168, label %169, label %136
169: ; preds = %166, %33
%170 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i64 4)
%171 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
br label %172
172: ; preds = %169, %31
%173 = phi i32 [ 77, %31 ], [ 0, %169 ]
ret i32 %173
}