#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_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct in_addr {
  void *s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  struct in_addr sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct TYPE_4__ {
  void *s_addr;
};
struct TYPE_3__ {
  void *s_addr;
};
struct ip_mreq {
  TYPE_2__ imr_interface;
  TYPE_1__ imr_multiaddr;
};
struct hostent {
  int /*<<< orphan*/ h_length;
  int /*<<< orphan*/ *h_addr_list;
};
typedef int /*<<< orphan*/ servAddr;
typedef int /*<<< orphan*/ mreq;
typedef int /*<<< orphan*/ cliAddr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ IN_MULTICAST(int /*<<< orphan*/);
int /*<<< orphan*/ IPPROTO_IP;
int /*<<< orphan*/ IP_ADD_MEMBERSHIP;
int /*<<< orphan*/ SOCK_DGRAM;
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
struct hostent *gethostbyname(char *);
void *htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
char *inet_ntoa(struct in_addr);
int /*<<< orphan*/ memcpy(struct in_addr *, int /*<<< orphan*/,
                          int /*<<< orphan*/);
int /*<<< orphan*/ ntohl(void *);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, void *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int sd, rc, n, cliLen;
  struct ip_mreq mreq;
  struct sockaddr_in cliAddr, servAddr;
  struct in_addr mcastAddr;
  struct hostent *h;
  char msg[100];
  if (argc != 2) {
    printf("usage : %s <mcast address>\n", argv[0]);
    exit(0);
  }
  h = gethostbyname(argv[1]);
  if (h == NULL) {
    printf("%s : unknown group '%s'\n", argv[0], argv[1]);
    exit(1);
  }
  memcpy(&mcastAddr, h->h_addr_list[0], h->h_length);
  if (!IN_MULTICAST(ntohl(mcastAddr.s_addr))) {
    printf("%s : given address '%s' is not multicast\n", argv[0],
           inet_ntoa(mcastAddr));
    exit(1);
  }
  sd = socket(AF_INET, SOCK_DGRAM, 0);
  if (sd < 0) {
    printf("%s : cannot create socket\n", argv[0]);
    exit(1);
  }
  servAddr.sin_family = AF_INET;
  servAddr.sin_addr.s_addr = htonl(INADDR_ANY);
  servAddr.sin_port = htons(1500);
  if (bind(sd, (struct sockaddr *)&servAddr, sizeof(servAddr)) < 0) {
    printf("%s : cannot bind port %d \n", argv[0], 1500);
    exit(1);
  }
  mreq.imr_multiaddr.s_addr = mcastAddr.s_addr;
  mreq.imr_interface.s_addr = htonl(INADDR_ANY);
  rc = setsockopt(sd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (void *)&mreq,
                  sizeof(mreq));
  if (rc < 0) {
    printf("%s : cannot join multicast group '%s'", argv[0],
           inet_ntoa(mcastAddr));
    exit(1);
  } else {
    printf("%s : listening to mgroup %s:%d\n", argv[0], inet_ntoa(mcastAddr),
           1500);
    while (1) {
      cliLen = sizeof(cliAddr);
      n = recvfrom(sd, msg, 100, 0, (struct sockaddr *)&cliAddr, &cliLen);
      if (n < n) {
        printf("%s : cannot receive data\n", argv[0]);
        continue;
      }
      printf("%s : from %s:%d on %s : %s\n", argv[0],
             inet_ntoa(cliAddr.sin_addr), ntohs(cliAddr.sin_port), argv[1],
             msg);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     121f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <gethostbyname@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
jne    1262 <main+0x82>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdcb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x70(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%esi
mov    -0x70(%rbp),%rax
mov    (%rax),%edx
lea    -0x68(%rbp),%rdi
call   10a0 <memcpy@plt>
mov    -0x68(%rbp),%rdi
call   10f0 <ntohl@plt>
mov    %eax,%edi
call   1080 <IN_MULTICAST@plt>
cmp    $0x0,%eax
jne    12cd <main+0xed>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xe8(%rbp)
mov    -0x68(%rbp),%rdi
call   1040 <inet_ntoa@plt>
mov    -0xe8(%rbp),%rsi
mov    %rax,%rdx
lea    0xd79(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2d0c(%rip),%rax
mov    (%rax),%edi
mov    0x2ceb(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1312 <main+0x132>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd5e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2cc7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    0x2cab(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %rax,-0x58(%rbp)
mov    $0x5dc,%edi
call   1050 <htons@plt>
mov    %eax,-0x60(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0x18,%edx
call   10d0 <bind@plt>
cmp    $0x0,%rax
jge    137c <main+0x19c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd14(%rip),%rdi
mov    $0x5dc,%edx
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x68(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    0x2c45(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2c38(%rip),%rax
mov    (%rax),%esi
mov    0x2c3f(%rip),%rax
mov    (%rax),%edx
lea    -0x30(%rbp),%rcx
mov    $0x10,%r8d
call   1030 <setsockopt@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1400 <main+0x220>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xf0(%rbp)
mov    -0x68(%rbp),%rdi
call   1040 <inet_ntoa@plt>
mov    -0xf0(%rbp),%rsi
mov    %rax,%rdx
lea    0xca6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xf8(%rbp)
mov    -0x68(%rbp),%rdi
call   1040 <inet_ntoa@plt>
mov    -0xf8(%rbp),%rsi
mov    %rax,%rdx
lea    0xc93(%rip),%rdi
mov    $0x5dc,%ecx
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x18,-0x20(%rbp)
mov    -0x14(%rbp),%edi
lea    -0xe0(%rbp),%rsi
lea    -0x48(%rbp),%r8
mov    $0x64,%edx
xor    %ecx,%ecx
lea    -0x20(%rbp),%r9
call   10b0 <recvfrom@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1482 <main+0x2a2>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xc65(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1434 <main+0x254>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x108(%rbp)
mov    -0x40(%rbp),%rdi
call   1040 <inet_ntoa@plt>
mov    %rax,-0x100(%rbp)
mov    -0x48(%rbp),%edi
call   10c0 <ntohs@plt>
mov    -0x108(%rbp),%rsi
mov    -0x100(%rbp),%rdx
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%r8
lea    -0xe0(%rbp),%r9
lea    0xc27(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1434 <main+0x254>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    %rsi,%r12
cmp    $0x2,%edi
jne    1379 <main+0x199>
mov    0x8(%r12),%rdi
call   1090 <gethostbyname@plt>
test   %rax,%rax
je     1392 <main+0x1b2>
mov    0x8(%rax),%rcx
mov    (%rcx),%esi
mov    (%rax),%edx
mov    %rsp,%rdi
call   10a0 <memcpy@plt>
mov    (%rsp),%rdi
call   10f0 <ntohl@plt>
mov    %eax,%edi
call   1080 <IN_MULTICAST@plt>
test   %eax,%eax
je     13a4 <main+0x1c4>
mov    0x2da1(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2d7f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
test   %eax,%eax
js     13bd <main+0x1dd>
mov    %eax,%ebx
mov    0x0(%rbp),%eax
mov    %eax,0x30(%rsp)
mov    0x2d66(%rip),%rbp
mov    0x0(%rbp),%edi
call   1070 <htonl@plt>
mov    %rax,0x28(%rsp)
mov    $0x5dc,%edi
call   1050 <htons@plt>
mov    %eax,0x20(%rsp)
lea    0x20(%rsp),%rsi
mov    %ebx,%edi
mov    $0x18,%edx
call   10d0 <bind@plt>
test   %rax,%rax
js     13d9 <main+0x1f9>
mov    (%rsp),%rax
mov    %rax,0x18(%rsp)
mov    0x0(%rbp),%edi
call   1070 <htonl@plt>
mov    %rax,0x10(%rsp)
mov    0x2d1c(%rip),%rax
mov    (%rax),%esi
mov    0x2d23(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rcx
mov    %ebx,%edi
mov    $0x10,%r8d
call   1030 <setsockopt@plt>
mov    %eax,%ebp
mov    (%r12),%r15
mov    (%rsp),%rdi
call   1040 <inet_ntoa@plt>
test   %ebp,%ebp
js     13fa <main+0x21a>
lea    0xdc4(%rip),%rdi
mov    %r15,%rsi
mov    %rax,%rdx
mov    $0x5dc,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x50(%rsp),%rbp
lea    0xdc6(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nop
movl   $0x18,0xc(%rsp)
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
lea    0x38(%rsp),%r8
lea    0xc(%rsp),%r9
call   10b0 <recvfrom@plt>
mov    (%r12),%r14
mov    0x40(%rsp),%rdi
call   1040 <inet_ntoa@plt>
mov    %rax,%r15
mov    0x38(%rsp),%edi
call   10c0 <ntohs@plt>
mov    0x8(%r12),%r8
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %eax,%ecx
mov    %rbp,%r9
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1320 <main+0x140>
mov    (%r12),%rsi
lea    0xc7c(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
mov    (%r12),%rsi
mov    0x8(%r12),%rdx
lea    0xc7a(%rip),%rdi
jmp    1407 <main+0x227>
mov    (%r12),%rbx
mov    (%rsp),%rdi
call   1040 <inet_ntoa@plt>
lea    0xc7d(%rip),%rdi
mov    %rbx,%rsi
jmp    1404 <main+0x224>
mov    (%r12),%rsi
lea    0xc97(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    (%r12),%rsi
lea    0xc96(%rip),%rdi
mov    $0x5dc,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    0xc94(%rip),%rdi
mov    %r15,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.ip_mreq = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i8* }
%struct.TYPE_3__ = type { i8* }
%struct.sockaddr_in = type { i32, %struct.in_addr, i32 }
%struct.in_addr = type { i8* }
%struct.hostent = type { i32, i32* }
%struct.sockaddr = type { i32 }
@.str = [28 x i8] c"usage : %s <mcast address>\0A\00"
@.str.1 = [25 x i8] c"%s : unknown group '%s'\0A\00"
@.str.2 = [42 x i8] c"%s : given address '%s' is not multicast\0A\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.3 = [27 x i8] c"%s : cannot create socket\0A\00"
@INADDR_ANY = global i32 0
@.str.4 = [27 x i8] c"%s : cannot bind port %d \0A\00"
@IPPROTO_IP = global i32 0
@IP_ADD_MEMBERSHIP = global i32 0
@.str.5 = [38 x i8] c"%s : cannot join multicast group '%s'\00"
@.str.6 = [32 x i8] c"%s : listening to mgroup %s:%d\0A\00"
@.str.7 = [26 x i8] c"%s : cannot receive data\0A\00"
@.str.8 = [28 x i8] c"%s : from %s:%d on %s : %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.ip_mreq
%11 = alloca %struct.sockaddr_in
%12 = alloca %struct.sockaddr_in
%13 = alloca %struct.in_addr
%14 = alloca %struct.hostent*
%15 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 2
br i1 %17, label %18, label %24
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = call i32 @exit(i32 0)
unreachable
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call %struct.hostent* @gethostbyname(i8* %27)
store %struct.hostent* %28, %struct.hostent** %14
%29 = load %struct.hostent*, %struct.hostent** %14
%30 = icmp eq %struct.hostent* %29, null
br i1 %30, label %31, label %40
31: ; preds = %24
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %34, i8* %37)
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %24
%41 = load %struct.hostent*, %struct.hostent** %14
%42 = getelementptr inbounds %struct.hostent, %struct.hostent* %41, i32 0, i32 1
%43 = load i32*, i32** %42
%44 = getelementptr inbounds i32, i32* %43, i64 0
%45 = load i32, i32* %44
%46 = load %struct.hostent*, %struct.hostent** %14
%47 = getelementptr inbounds %struct.hostent, %struct.hostent* %46, i32 0, i32 0
%48 = load i32, i32* %47
%49 = call i32 @memcpy(%struct.in_addr* %13, i32 %45, i32 %48)
%50 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %13, i32 0, i32 0
%51 = load i8*, i8** %50
%52 = call i32 @ntohl(i8* %51)
%53 = call i32 @IN_MULTICAST(i32 %52)
%54 = icmp ne i32 %53, 0
br i1 %54, label %64, label %55
55: ; preds = %40
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 0
%58 = load i8*, i8** %57
%59 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %13, i32 0, i32 0
%60 = load i8*, i8** %59
%61 = call i8* @inet_ntoa(i8* %60)
%62 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* %58, i8* %61)
%63 = call i32 @exit(i32 1)
unreachable
64: ; preds = %40
%65 = load i32, i32* @AF_INET
%66 = load i32, i32* @SOCK_DGRAM
%67 = call i32 @socket(i32 %65, i32 %66, i32 0)
store i32 %67, i32* %6
%68 = load i32, i32* %6
%69 = icmp slt i32 %68, 0
br i1 %69, label %70, label %76
70: ; preds = %64
%71 = load i8**, i8*** %5
%72 = getelementptr inbounds i8*, i8** %71, i64 0
%73 = load i8*, i8** %72
%74 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %73)
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %64
%77 = load i32, i32* @AF_INET
%78 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %12, i32 0, i32 2
store i32 %77, i32* %78
%79 = load i32, i32* @INADDR_ANY
%80 = call i8* @htonl(i32 %79)
%81 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %12, i32 0, i32 1
%82 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %81, i32 0, i32 0
store i8* %80, i8** %82
%83 = call i32 @htons(i32 1500)
%84 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %12, i32 0, i32 0
store i32 %83, i32* %84
%85 = load i32, i32* %6
%86 = bitcast %struct.sockaddr_in* %12 to %struct.sockaddr*
%87 = call i64 @bind(i32 %85, %struct.sockaddr* %86, i32 24)
%88 = icmp slt i64 %87, 0
br i1 %88, label %89, label %95
89: ; preds = %76
%90 = load i8**, i8*** %5
%91 = getelementptr inbounds i8*, i8** %90, i64 0
%92 = load i8*, i8** %91
%93 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %92, i32 1500)
%94 = call i32 @exit(i32 1)
unreachable
95: ; preds = %76
%96 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %13, i32 0, i32 0
%97 = load i8*, i8** %96
%98 = getelementptr inbounds %struct.ip_mreq, %struct.ip_mreq* %10, i32 0, i32 1
%99 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %98, i32 0, i32 0
store i8* %97, i8** %99
%100 = load i32, i32* @INADDR_ANY
%101 = call i8* @htonl(i32 %100)
%102 = getelementptr inbounds %struct.ip_mreq, %struct.ip_mreq* %10, i32 0, i32 0
%103 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %102, i32 0, i32 0
store i8* %101, i8** %103
%104 = load i32, i32* %6
%105 = load i32, i32* @IPPROTO_IP
%106 = load i32, i32* @IP_ADD_MEMBERSHIP
%107 = bitcast %struct.ip_mreq* %10 to i8*
%108 = call i32 @setsockopt(i32 %104, i32 %105, i32 %106, i8* %107, i32 16)
store i32 %108, i32* %7
%109 = load i32, i32* %7
%110 = icmp slt i32 %109, 0
br i1 %110, label %111, label %120
111: ; preds = %95
%112 = load i8**, i8*** %5
%113 = getelementptr inbounds i8*, i8** %112, i64 0
%114 = load i8*, i8** %113
%115 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %13, i32 0, i32 0
%116 = load i8*, i8** %115
%117 = call i8* @inet_ntoa(i8* %116)
%118 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i8* %114, i8* %117)
%119 = call i32 @exit(i32 1)
unreachable
120: ; preds = %95
%121 = load i8**, i8*** %5
%122 = getelementptr inbounds i8*, i8** %121, i64 0
%123 = load i8*, i8** %122
%124 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %13, i32 0, i32 0
%125 = load i8*, i8** %124
%126 = call i8* @inet_ntoa(i8* %125)
%127 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* %123, i8* %126, i32 1500)
br label %128
128: ; preds = %120, %136, %141
store i32 24, i32* %9
%129 = load i32, i32* %6
%130 = getelementptr inbounds [100 x i8], [100 x i8]* %15, i64 0, i64 0
%131 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%132 = call i32 @recvfrom(i32 %129, i8* %130, i32 100, i32 0, %struct.sockaddr* %131, i32* %9)
store i32 %132, i32* %8
%133 = load i32, i32* %8
%134 = load i32, i32* %8
%135 = icmp slt i32 %133, %134
br i1 %135, label %136, label %141
136: ; preds = %128
%137 = load i8**, i8*** %5
%138 = getelementptr inbounds i8*, i8** %137, i64 0
%139 = load i8*, i8** %138
%140 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %139)
br label %128
141: ; preds = %128
%142 = load i8**, i8*** %5
%143 = getelementptr inbounds i8*, i8** %142, i64 0
%144 = load i8*, i8** %143
%145 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
%146 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %145, i32 0, i32 0
%147 = load i8*, i8** %146
%148 = call i8* @inet_ntoa(i8* %147)
%149 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
%150 = load i32, i32* %149
%151 = call i32 @ntohs(i32 %150)
%152 = load i8**, i8*** %5
%153 = getelementptr inbounds i8*, i8** %152, i64 1
%154 = load i8*, i8** %153
%155 = getelementptr inbounds [100 x i8], [100 x i8]* %15, i64 0, i64 0
%156 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8* %144, i8* %148, i32 %151, i8* %154, i8* %155)
br label %128
}

LLVM IR (-O2):
%struct.ip_mreq = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i8* }
%struct.TYPE_3__ = type { i8* }
%struct.sockaddr_in = type { i32, %struct.in_addr, i32 }
%struct.in_addr = type { i8* }
%struct.hostent = type { i32, i32* }
%struct.sockaddr = type { i32 }
@.str = [28 x i8] c"usage : %s <mcast address>\0A\00"
@.str.1 = [25 x i8] c"%s : unknown group '%s'\0A\00"
@.str.2 = [42 x i8] c"%s : given address '%s' is not multicast\0A\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.3 = [27 x i8] c"%s : cannot create socket\0A\00"
@INADDR_ANY = global i32 0
@.str.4 = [27 x i8] c"%s : cannot bind port %d \0A\00"
@IPPROTO_IP = global i32 0
@IP_ADD_MEMBERSHIP = global i32 0
@.str.5 = [38 x i8] c"%s : cannot join multicast group '%s'\00"
@.str.6 = [32 x i8] c"%s : listening to mgroup %s:%d\0A\00"
@.str.8 = [28 x i8] c"%s : from %s:%d on %s : %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.ip_mreq
%5 = alloca %struct.sockaddr_in
%6 = alloca %struct.sockaddr_in
%7 = alloca %struct.in_addr
%8 = alloca [100 x i8]
%9 = bitcast i32* %3 to i8*
%10 = bitcast %struct.ip_mreq* %4 to i8*
%11 = bitcast %struct.sockaddr_in* %5 to i8*
%12 = bitcast %struct.sockaddr_in* %6 to i8*
%13 = bitcast %struct.in_addr* %7 to i8*
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%15 = icmp eq i32 %0, 2
br i1 %15, label %20, label %16
16: ; preds = %2
%17 = load i8*, i8** %1
%18 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = tail call i32 @exit(i32 0)
unreachable
20: ; preds = %2
%21 = getelementptr inbounds i8*, i8** %1, i64 1
%22 = load i8*, i8** %21
%23 = tail call %struct.hostent* @gethostbyname(i8* %22)
%24 = icmp eq %struct.hostent* %23, null
br i1 %24, label %25, label %30
25: ; preds = %20
%26 = load i8*, i8** %1
%27 = load i8*, i8** %21
%28 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %26, i8* %27)
%29 = tail call i32 @exit(i32 1)
unreachable
30: ; preds = %20
%31 = getelementptr inbounds %struct.hostent, %struct.hostent* %23, i64 0, i32 1
%32 = load i32*, i32** %31
%33 = load i32, i32* %32
%34 = getelementptr inbounds %struct.hostent, %struct.hostent* %23, i64 0, i32 0
%35 = load i32, i32* %34
%36 = call i32 @memcpy(%struct.in_addr* %7, i32 %33, i32 %35)
%37 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %7, i64 0, i32 0
%38 = load i8*, i8** %37
%39 = call i32 @ntohl(i8* %38)
%40 = call i32 @IN_MULTICAST(i32 %39)
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %48
42: ; preds = %30
%43 = load i8*, i8** %1
%44 = load i8*, i8** %37
%45 = call i8* @inet_ntoa(i8* %44)
%46 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* %43, i8* %45)
%47 = call i32 @exit(i32 1)
unreachable
48: ; preds = %30
%49 = load i32, i32* @AF_INET
%50 = load i32, i32* @SOCK_DGRAM
%51 = call i32 @socket(i32 %49, i32 %50, i32 0)
%52 = icmp slt i32 %51, 0
br i1 %52, label %53, label %57
53: ; preds = %48
%54 = load i8*, i8** %1
%55 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %54)
%56 = call i32 @exit(i32 1)
unreachable
57: ; preds = %48
%58 = load i32, i32* @AF_INET
%59 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 2
store i32 %58, i32* %59
%60 = load i32, i32* @INADDR_ANY
%61 = call i8* @htonl(i32 %60)
%62 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 1, i32 0
store i8* %61, i8** %62
%63 = call i32 @htons(i32 1500)
%64 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 0
store i32 %63, i32* %64
%65 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%66 = call i64 @bind(i32 %51, %struct.sockaddr* %65, i32 24)
%67 = icmp slt i64 %66, 0
br i1 %67, label %68, label %72
68: ; preds = %57
%69 = load i8*, i8** %1
%70 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %69, i32 1500)
%71 = call i32 @exit(i32 1)
unreachable
72: ; preds = %57
%73 = load i8*, i8** %37
%74 = getelementptr inbounds %struct.ip_mreq, %struct.ip_mreq* %4, i64 0, i32 1, i32 0
store i8* %73, i8** %74
%75 = load i32, i32* @INADDR_ANY
%76 = call i8* @htonl(i32 %75)
%77 = getelementptr inbounds %struct.ip_mreq, %struct.ip_mreq* %4, i64 0, i32 0, i32 0
store i8* %76, i8** %77
%78 = load i32, i32* @IPPROTO_IP
%79 = load i32, i32* @IP_ADD_MEMBERSHIP
%80 = call i32 @setsockopt(i32 %51, i32 %78, i32 %79, i8* %10, i32 16)
%81 = icmp slt i32 %80, 0
%82 = load i8*, i8** %1
%83 = load i8*, i8** %37
%84 = call i8* @inet_ntoa(i8* %83)
br i1 %81, label %85, label %88
85: ; preds = %72
%86 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i8* %82, i8* %84)
%87 = call i32 @exit(i32 1)
unreachable
88: ; preds = %72
%89 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* %82, i8* %84, i32 1500)
%90 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%91 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 1, i32 0
%92 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0
br label %93
93: ; preds = %93, %88
store i32 24, i32* %3
%94 = call i32 @recvfrom(i32 %51, i8* %14, i32 100, i32 0, %struct.sockaddr* %90, i32* %3)
%95 = load i8*, i8** %1
%96 = load i8*, i8** %91
%97 = call i8* @inet_ntoa(i8* %96)
%98 = load i32, i32* %92
%99 = call i32 @ntohs(i32 %98)
%100 = load i8*, i8** %21
%101 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8* %95, i8* %97, i32 %99, i8* %100, i8* %14)
br label %93
}