#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);
scalar_t__ 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);
  if (bind(0, (struct sockaddr *)&addr, len)) {
    perror("bind");
    return 77;
  }
  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    17ee <main+0x59e>
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)
lea    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
xor    %edi,%edi
call   1100 <bind@plt>
cmp    $0x0,%rax
je     1363 <main+0x113>
lea    0xcd8(%rip),%rdi
call   1120 <perror@plt>
movl   $0x4d,-0x4(%rbp)
jmp    17ee <main+0x59e>
xor    %edi,%edi
mov    %edi,-0x1fc(%rbp)
lea    -0x18(%rbp),%rsi
mov    %rsi,-0x220(%rbp)
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    0x2c0f(%rip),%rax
mov    (%rax),%edi
mov    0x2c1e(%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    0x2bd0(%rip),%rax
mov    %rax,-0x208(%rbp)
mov    (%rax),%rsi
mov    0x2bc7(%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    0x2b51(%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    0x2ad8(%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    0xab3(%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    0x9de(%rip),%rdi
lea    0x9bc(%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     17c1 <main+0x571>
mov    0x293b(%rip),%rax
mov    (%rax),%rax
mov    -0x1f0(%rbp),%rcx
cmp    (%rcx),%rax
je     16a5 <main+0x455>
jmp    17a2 <main+0x552>
mov    -0x1f0(%rbp),%rax
lea    -0x1c0(%rbp),%rcx
cmp    %rcx,%rax
je     16ca <main+0x47a>
lea    0x9ff(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x1f0(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0x9e9(%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     177c <main+0x52c>
mov    -0x228(%rbp),%rax
lea    0x8f0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x1f0(%rbp),%rdi
call   1050 <print_pktinfo@plt>
jmp    1794 <main+0x544>
mov    -0x1f0(%rbp),%rdi
call   10a0 <print_ttl@plt>
jmp    1794 <main+0x544>
mov    -0x1f0(%rbp),%rdi
call   1130 <print_tos@plt>
jmp    1794 <main+0x544>
mov    -0x1f0(%rbp),%rsi
lea    0x998(%rip),%rdi
call   10c0 <print_opts@plt>
jmp    1794 <main+0x544>
mov    -0x1f0(%rbp),%rsi
lea    0x98c(%rip),%rdi
call   10c0 <print_opts@plt>
jmp    1794 <main+0x544>
mov    -0x1f0(%rbp),%rax
mov    0x10(%rax),%esi
lea    0x97c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0x971(%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    1678 <main+0x428>
lea    0x946(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0x94e(%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    1697 <main+0x437>
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>
test   %rax,%rax
jne    16a0 <main+0x440>
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    0x2c12(%rip),%r14
mov    (%r14),%rsi
mov    0x2c10(%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    0x2bcb(%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    0x2b62(%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    0xb66(%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    0xabc(%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     1663 <main+0x403>
mov    %rax,%rbx
lea    0xb23(%rip),%r15
lea    0xa57(%rip),%r12
lea    -0x70(%rbp),%r13
jmp    15e1 <main+0x381>
lea    0xb53(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
nopl   (%rax)
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     1663 <main+0x403>
mov    (%r14),%rax
cmp    (%rbx),%rax
jne    15ca <main+0x36a>
lea    -0x200(%rbp),%rax
cmp    %rax,%rbx
je     1603 <main+0x3a3>
lea    0xac6(%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     15af <main+0x34f>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
mov    %rbx,%rdi
call   10b0 <print_ttl@plt>
jmp    15c0 <main+0x360>
mov    %rbx,%rdi
call   1140 <print_tos@plt>
jmp    15c0 <main+0x360>
lea    0xabe(%rip),%rdi
jmp    1649 <main+0x3e9>
lea    0xaa9(%rip),%rdi
mov    %rbx,%rsi
call   10d0 <print_opts@plt>
jmp    15c0 <main+0x360>
mov    %rbx,%rdi
call   1060 <print_pktinfo@plt>
jmp    15c0 <main+0x360>
lea    0xaa2(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xaaa(%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    0x985(%rip),%rdi
jmp    16a7 <main+0x447>
lea    0x983(%rip),%rdi
call   1130 <perror@plt>
mov    $0x4d,%eax
jmp    1688 <main+0x428>

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
@.str.2 = [5 x i8] c"bind\00"
@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.3 = [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.4 = [3 x i8] c", \00"
@.str.5 = [45 x i8] c"{cmsg_len=%zu, cmsg_level=SOL_IP, cmsg_type=\00"
@.str.6 = [12 x i8] c"IP_RECVOPTS\00"
@.str.7 = [11 x i8] c"IP_RETOPTS\00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [2 x i8] c"}\00"
@.str.10 = [27 x i8] c"], msg_flags=0}, 0) = %zu\0A\00"
@.str.11 = [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 i64 @bind(i32 0, %struct.sockaddr* %46, i32 %47)
%49 = icmp ne i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %38
%51 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i32 77, i32* %1
br label %204
52: ; preds = %38
%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.3, 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, %52
%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.4, 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.5, 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.6, 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.7, 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.8, 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.9, 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.10, i64 0, i64 0), i64 4)
%202 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %1
%203 = load i8*, i8** %7
br label %204
204: ; preds = %200, %50, %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
@.str.2 = [5 x i8] c"bind\00"
@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.3 = [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.4 = [3 x i8] c", \00"
@.str.5 = [45 x i8] c"{cmsg_len=%zu, cmsg_level=SOL_IP, cmsg_type=\00"
@.str.6 = [12 x i8] c"IP_RECVOPTS\00"
@.str.7 = [11 x i8] c"IP_RETOPTS\00"
@.str.8 = [3 x i8] c"%d\00"
@.str.10 = [27 x i8] c"], msg_flags=0}, 0) = %zu\0A\00"
@.str.11 = [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 %175
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 i64 @bind(i32 0, %struct.sockaddr* %42, i32 12)
%44 = icmp eq i64 %43, 0
br i1 %44, label %47, label %45
45: ; preds = %33
%46 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %173
47: ; preds = %33
%48 = call i32 @getsockname(i32 0, %struct.sockaddr* %42, i32* %2)
%49 = icmp eq i32 %48, 0
%50 = zext i1 %49 to i32
%51 = call i32 @assert(i32 %50)
%52 = load i32, i32* @PF_INET
%53 = load i32, i32* @SOCK_DGRAM
%54 = call i32 @socket(i32 %52, i32 %53, i32 0)
%55 = icmp eq i32 %54, 3
%56 = zext i1 %55 to i32
%57 = call i32 @assert(i32 %56)
%58 = load i32, i32* %2
%59 = call i32 @connect(i32 3, %struct.sockaddr* %42, i32 %58)
%60 = icmp eq i32 %59, 0
%61 = zext i1 %60 to i32
%62 = call i32 @assert(i32 %61)
%63 = bitcast i32* %3 to i8*
%64 = call i32 @htonl(i32 16777216)
store i32 %64, i32* %3
%65 = load i64, i64* @IPPROTO_IP
%66 = load i32, i32* @IP_OPTIONS
%67 = call i32 @setsockopt(i32 3, i64 %65, i32 %66, i32* %3, i32 4)
%68 = icmp eq i32 %67, 0
%69 = zext i1 %68 to i32
%70 = call i32 @assert(i32 %69)
%71 = load i64, i64* @IPPROTO_IP
%72 = call i32 @setsockopt(i32 0, i64 %71, i32 132, i32* %3, i32 4)
%73 = icmp eq i32 %72, 0
%74 = zext i1 %73 to i32
%75 = call i32 @assert(i32 %74)
%76 = load i64, i64* @IPPROTO_IP
%77 = load i32, i32* @IP_RECVTTL
%78 = call i32 @setsockopt(i32 0, i64 %76, i32 %77, i32* %3, i32 4)
%79 = icmp eq i32 %78, 0
%80 = zext i1 %79 to i32
%81 = call i32 @assert(i32 %80)
%82 = load i64, i64* @IPPROTO_IP
%83 = load i32, i32* @IP_RECVTOS
%84 = call i32 @setsockopt(i32 0, i64 %82, i32 %83, i32* %3, i32 4)
%85 = icmp eq i32 %84, 0
%86 = zext i1 %85 to i32
%87 = call i32 @assert(i32 %86)
%88 = load i64, i64* @IPPROTO_IP
%89 = call i32 @setsockopt(i32 0, i64 %88, i32 131, i32* %3, i32 4)
%90 = icmp eq i32 %89, 0
%91 = zext i1 %90 to i32
%92 = call i32 @assert(i32 %91)
%93 = load i64, i64* @IPPROTO_IP
%94 = call i32 @setsockopt(i32 0, i64 %93, i32 130, i32* %3, i32 4)
%95 = icmp eq i32 %94, 0
%96 = zext i1 %95 to i32
%97 = call i32 @assert(i32 %96)
%98 = call i32 @send(i32 3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @main.data, i64 0, i64 0), i64 4, i32 0)
%99 = icmp eq i32 %98, 4
%100 = zext i1 %99 to i32
%101 = call i32 @assert(i32 %100)
%102 = call i32 @close(i32 3)
%103 = icmp eq i32 %102, 0
%104 = zext i1 %103 to i32
%105 = call i32 @assert(i32 %104)
%106 = call i8* @llvm.stacksave()
%107 = alloca [4 x i8]
%108 = getelementptr inbounds [4 x i8], [4 x i8]* %107, i64 0, i64 0
%109 = bitcast %struct.iovec* %4 to i8*
%110 = getelementptr inbounds %struct.iovec, %struct.iovec* %4, i64 0, i32 0
store i8* %108, i8** %110
%111 = getelementptr inbounds %struct.iovec, %struct.iovec* %4, i64 0, i32 1
store i32 4, i32* %111
%112 = bitcast [16 x %struct.cmsghdr]* %5 to i8*
%113 = bitcast %struct.msghdr* %6 to i8*
%114 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 0
%115 = load i32, i32* %2
store i32 %115, i32* %114
%116 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 1
store i32 1, i32* %116
%117 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 2
store i32 384, i32* %117
%118 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 3
%119 = getelementptr inbounds [16 x %struct.cmsghdr], [16 x %struct.cmsghdr]* %5, i64 0, i64 0
store %struct.cmsghdr* %119, %struct.cmsghdr** %118
%120 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 4
store %struct.iovec* %4, %struct.iovec** %120
%121 = getelementptr inbounds %struct.msghdr, %struct.msghdr* %6, i64 0, i32 5
store %struct.sockaddr_in* %1, %struct.sockaddr_in** %121
%122 = call i32 @recvmsg(i32 0, %struct.msghdr* %6, i32 0)
%123 = icmp eq i32 %122, 4
%124 = zext i1 %123 to i32
%125 = call i32 @assert(i32 %124)
%126 = call i32 @close(i32 0)
%127 = icmp eq i32 %126, 0
%128 = zext i1 %127 to i32
%129 = call i32 @assert(i32 %128)
%130 = load i32, i32* %114
%131 = load i32, i32* %35
%132 = call i32 @ntohs(i32 %131)
%133 = load i32, i32* %117
%134 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([147 x i8], [147 x i8]* @.str.3, i64 0, i64 0), i32 %130, i32 %132, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @main.data, i64 0, i64 0), i64 4, i32 %133)
%135 = call %struct.cmsghdr* @CMSG_FIRSTHDR(%struct.msghdr* %6)
%136 = icmp eq %struct.cmsghdr* %135, null
br i1 %136, label %170, label %137
137: ; preds = %47, %167
%138 = phi %struct.cmsghdr* [ %168, %167 ], [ %135, %47 ]
%139 = load i64, i64* @IPPROTO_IP
%140 = getelementptr inbounds %struct.cmsghdr, %struct.cmsghdr* %138, i64 0, i32 0
%141 = load i64, i64* %140
%142 = icmp eq i64 %139, %141
br i1 %142, label %143, label %167
143: ; preds = %137
%144 = icmp eq %struct.cmsghdr* %138, %119
br i1 %144, label %147, label %145
145: ; preds = %143
%146 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %147
147: ; preds = %145, %143
%148 = getelementptr inbounds %struct.cmsghdr, %struct.cmsghdr* %138, i64 0, i32 1
%149 = load i64, i64* %148
%150 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i64 %149)
%151 = getelementptr inbounds %struct.cmsghdr, %struct.cmsghdr* %138, i64 0, i32 2
%152 = load i32, i32* %151
switch i32 %152, label %163 [
i32 132, label %153
i32 128, label %155
i32 129, label %157
i32 131, label %159
i32 130, label %161
]
153: ; preds = %147
%154 = call i32 @print_pktinfo(%struct.cmsghdr* %138)
br label %165
155: ; preds = %147
%156 = call i32 @print_ttl(%struct.cmsghdr* %138)
br label %165
157: ; preds = %147
%158 = call i32 @print_tos(%struct.cmsghdr* %138)
br label %165
159: ; preds = %147
%160 = call i32 @print_opts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), %struct.cmsghdr* %138)
br label %165
161: ; preds = %147
%162 = call i32 @print_opts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), %struct.cmsghdr* %138)
br label %165
163: ; preds = %147
%164 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 %152)
br label %165
165: ; preds = %163, %161, %159, %157, %155, %153
%166 = call i32 @putchar(i32 125)
br label %167
167: ; preds = %137, %165
%168 = call %struct.cmsghdr* @CMSG_NXTHDR(%struct.msghdr* %6, %struct.cmsghdr* %138)
%169 = icmp eq %struct.cmsghdr* %168, null
br i1 %169, label %170, label %137
170: ; preds = %167, %47
%171 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i64 4)
%172 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
br label %173
173: ; preds = %170, %45
%174 = phi i32 [ 77, %45 ], [ 0, %170 ]
br label %175
175: ; preds = %173, %31
%176 = phi i32 [ 77, %31 ], [ %174, %173 ]
ret i32 %176
}