#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 TYPE_4__ {
  void *s_addr;
};
struct TYPE_3__ {
  void *s_addr;
};
struct sockaddr_in {
  TYPE_2__ imr_interface;
  int /*<<< orphan*/ imr_multiaddr;
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct ip_mreq {
  TYPE_2__ imr_interface;
  int /*<<< orphan*/ imr_multiaddr;
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ jasotzailea_helb;
typedef int /*<<< orphan*/ imr;
typedef int /*<<< orphan*/ bidaltzailea_helb;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ IPPROTO_IP;
int /*<<< orphan*/ IP_ADD_MEMBERSHIP;
int /*<<< orphan*/ IP_DROP_MEMBERSHIP;
int /*<<< orphan*/ SOCK_DGRAM;
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
void *htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_aton(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
scalar_t__ sendto(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
               struct sockaddr_in *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int main() {
  int sock, n, ertamaina;
  struct sockaddr_in jasotzailea_helb, bidaltzailea_helb;
  socklen_t helb_tam;
  char buf[1024], erantzun[1024];
  struct ip_mreq imr;
  if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
    perror("Errorea socketa sortzean");
    exit(1);
  }
  memset(&jasotzailea_helb, 0, sizeof(jasotzailea_helb));
  jasotzailea_helb.sin_family = AF_INET;
  jasotzailea_helb.sin_addr.s_addr = htonl(INADDR_ANY);
  jasotzailea_helb.sin_port = htons(50007);
  if (bind(sock, (struct sockaddr *)&jasotzailea_helb,
           sizeof(jasotzailea_helb)) < 0) {
    perror("Errorea socketari helbide bat esleitzean");
    exit(1);
  }
  memset(&imr, 0, sizeof(imr));
  inet_aton("224.0.0.11", &imr.imr_multiaddr);
  imr.imr_interface.s_addr = htonl(INADDR_ANY);
  if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &imr, sizeof(imr)) ==
      -1) {
    printf("errorea multicast helbidea esleitzerakoan");
    exit(1);
  }
  helb_tam = sizeof(bidaltzailea_helb);
  if ((n = recvfrom(sock, buf, 1024, 0, (struct sockaddr *)&bidaltzailea_helb,
                    &helb_tam)) < 0) {
    perror("Errorea datuak jasotzean");
    exit(1);
  }
  strcpy(erantzun, buf);
  strcat(erantzun, "Telmo eta Karlos");
  ertamaina = strlen(erantzun);
  while (strncmp(buf, "OK", 2) != 0) {
    if (sendto(sock, erantzun, ertamaina, 0,
               (struct sockaddr *)&bidaltzailea_helb, helb_tam) < 0) {
      perror("Errorea datuak bidaltzean");
      exit(1);
    }
    if ((recvfrom(sock, buf, 1024, 0, (struct sockaddr *)&bidaltzailea_helb,
                  &helb_tam)) < 0) {
      printf("Errorea datuak jasotzean");
      exit(1);
    }
    buf[2] = 0;
    printf("iritsi da mezua (Kodea) : %s ", buf);
  }
  if (setsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, &imr, sizeof(imr)) ==
      -1) {
    printf("errorea multicast helbidea esleitzerakoan");
    exit(1);
  }
  close(sock);
  printf("\n-- PROGRAMA AMAITU DA!!! ----\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x880,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2db7(%rip),%rax
mov    (%rax),%edi
mov    0x2d96(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jge    125d <main+0x4d>
lea    0xdb2(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   10a0 <memset@plt>
mov    0x2d6c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2d50(%rip),%rax
mov    (%rax),%edi
call   1090 <htonl@plt>
mov    %rax,-0x20(%rbp)
mov    $0xc357,%edi
call   1070 <htons@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x20,%edx
call   10f0 <bind@plt>
cmp    $0x0,%rax
jge    12c9 <main+0xb9>
lea    0xd5f(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
lea    -0x880(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   10a0 <memset@plt>
lea    -0x880(%rbp),%rsi
add    $0x8,%rsi
lea    0xd54(%rip),%rdi
call   10d0 <inet_aton@plt>
mov    0x2cd6(%rip),%rax
mov    (%rax),%edi
call   1090 <htonl@plt>
mov    %rax,-0x880(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2cc6(%rip),%rax
mov    (%rax),%esi
mov    0x2ccd(%rip),%rax
mov    (%rax),%edx
lea    -0x880(%rbp),%rcx
mov    $0x20,%r8d
call   1050 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    1350 <main+0x140>
lea    0xd0e(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
movl   $0x20,-0x54(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x460(%rbp),%rsi
lea    -0x50(%rbp),%r8
mov    $0x400,%edx
xor    %ecx,%ecx
lea    -0x54(%rbp),%r9
call   10e0 <recvfrom@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jge    1397 <main+0x187>
lea    0xcef(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
lea    -0x860(%rbp),%rdi
lea    -0x460(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x860(%rbp),%rdi
lea    0xcd8(%rip),%rsi
call   1110 <strcat@plt>
lea    -0x860(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x10(%rbp)
lea    -0x460(%rbp),%rdi
lea    0xcc7(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     148a <main+0x27a>
mov    -0x8(%rbp),%edi
lea    -0x860(%rbp),%rsi
mov    -0x10(%rbp),%edx
lea    -0x50(%rbp),%r8
mov    -0x54(%rbp),%r9d
xor    %ecx,%ecx
call   10b0 <sendto@plt>
cmp    $0x0,%rax
jge    142a <main+0x21a>
lea    0xc89(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x8(%rbp),%edi
lea    -0x460(%rbp),%rsi
lea    -0x50(%rbp),%r8
mov    $0x400,%edx
xor    %ecx,%ecx
lea    -0x54(%rbp),%r9
call   10e0 <recvfrom@plt>
cmp    $0x0,%eax
jge    1469 <main+0x259>
lea    0xc1f(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
movb   $0x0,-0x45e(%rbp)
lea    -0x460(%rbp),%rsi
lea    0xc40(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    13cc <main+0x1bc>
mov    -0x8(%rbp),%edi
mov    0x2b44(%rip),%rax
mov    (%rax),%esi
mov    0x2b1b(%rip),%rax
mov    (%rax),%edx
lea    -0x880(%rbp),%rcx
mov    $0x20,%r8d
call   1050 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    14d2 <main+0x2c2>
lea    0xb8c(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x8(%rbp),%edi
call   10c0 <close@plt>
lea    0xbfb(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x880,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x878,%rsp
mov    0x2da8(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2d86(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
test   %eax,%eax
js     1498 <main+0x278>
mov    %eax,%r15d
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   10b0 <memset@plt>
mov    0x0(%rbp),%eax
mov    %eax,0x48(%rsp)
mov    0x2d58(%rip),%rbp
mov    0x0(%rbp),%edi
call   10a0 <htonl@plt>
mov    %rax,0x40(%rsp)
mov    $0xc357,%edi
call   1080 <htons@plt>
mov    %eax,0x3c(%rsp)
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x20,%edx
call   1100 <bind@plt>
test   %rax,%rax
js     14a1 <main+0x281>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   10b0 <memset@plt>
lea    0x18(%rsp),%rsi
lea    0xd76(%rip),%rdi
call   10e0 <inet_aton@plt>
mov    0x0(%rbp),%edi
call   10a0 <htonl@plt>
mov    %rax,0x10(%rsp)
mov    0x2cf3(%rip),%rax
mov    (%rax),%esi
mov    0x2cfa(%rip),%rax
mov    (%rax),%edx
mov    %r15d,%edi
mov    %rbx,%rcx
mov    $0x20,%r8d
call   1060 <setsockopt@plt>
cmp    $0xffffffff,%eax
je     148f <main+0x26f>
movl   $0x20,0xc(%rsp)
lea    0x70(%rsp),%rsi
lea    0x50(%rsp),%r8
lea    0xc(%rsp),%r9
mov    %r15d,%edi
mov    $0x400,%edx
xor    %ecx,%ecx
call   10f0 <recvfrom@plt>
test   %eax,%eax
js     14aa <main+0x28a>
lea    0x470(%rsp),%rbx
lea    0x70(%rsp),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
lea    0xd39(%rip),%rsi
mov    %rbx,%rdi
call   1120 <strcat@plt>
mov    %rbx,%rdi
call   1070 <strlen@plt>
mov    %eax,%r12d
lea    0xd30(%rip),%rsi
mov    %rbp,%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     140f <main+0x1ef>
lea    0x50(%rsp),%rbx
lea    0x70(%rsp),%rbp
lea    0xd26(%rip),%r14
lea    0xd02(%rip),%r13
nop
mov    0xc(%rsp),%r9d
mov    %r15d,%edi
lea    0x470(%rsp),%rsi
mov    %r12d,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
call   10c0 <sendto@plt>
test   %rax,%rax
js     1461 <main+0x241>
mov    %r15d,%edi
mov    %rbp,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
lea    0xc(%rsp),%r9
call   10f0 <recvfrom@plt>
test   %eax,%eax
js     1477 <main+0x257>
movb   $0x0,0x72(%rsp)
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    13a0 <main+0x180>
mov    0x2bc2(%rip),%rax
mov    (%rax),%esi
mov    0x2b99(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rcx
mov    %r15d,%edi
mov    $0x20,%r8d
call   1060 <setsockopt@plt>
cmp    $0xffffffff,%eax
je     148f <main+0x26f>
mov    %r15d,%edi
call   10d0 <close@plt>
lea    0xc94(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x878,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc3c(%rip),%rdi
call   1110 <perror@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
lea    0xbf9(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
lea    0xbb7(%rip),%rdi
jmp    147e <main+0x25e>
lea    0xb61(%rip),%rdi
jmp    1468 <main+0x248>
lea    0xb71(%rip),%rdi
jmp    1468 <main+0x248>
lea    0xbc6(%rip),%rdi
jmp    1468 <main+0x248>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_4__, i32, i32, %struct.TYPE_3__, i32 }
%struct.TYPE_4__ = type { i8* }
%struct.TYPE_3__ = type { i8* }
%struct.ip_mreq = type { %struct.TYPE_4__, i32, i32, %struct.TYPE_3__, i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str = [25 x i8] c"Errorea socketa sortzean\00"
@INADDR_ANY = global i32 0
@.str.1 = [41 x i8] c"Errorea socketari helbide bat esleitzean\00"
@.str.2 = [11 x i8] c"224.0.0.11\00"
@IPPROTO_IP = global i32 0
@IP_ADD_MEMBERSHIP = global i32 0
@.str.3 = [42 x i8] c"errorea multicast helbidea esleitzerakoan\00"
@.str.4 = [25 x i8] c"Errorea datuak jasotzean\00"
@.str.5 = [17 x i8] c"Telmo eta Karlos\00"
@.str.6 = [3 x i8] c"OK\00"
@.str.7 = [26 x i8] c"Errorea datuak bidaltzean\00"
@.str.8 = [30 x i8] c"iritsi da mezua (Kodea) : %s \00"
@IP_DROP_MEMBERSHIP = global i32 0
@.str.9 = [32 x i8] c"\0A-- PROGRAMA AMAITU DA!!! ----\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.sockaddr_in
%6 = alloca %struct.sockaddr_in
%7 = alloca i32
%8 = alloca [1024 x i8]
%9 = alloca [1024 x i8]
%10 = alloca %struct.ip_mreq
store i32 0, i32* %1
%11 = load i32, i32* @AF_INET
%12 = load i32, i32* @SOCK_DGRAM
%13 = call i32 @socket(i32 %11, i32 %12, i32 0)
store i32 %13, i32* %2
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %0
%16 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %0
%19 = call i32 @memset(%struct.sockaddr_in* %5, i32 0, i32 32)
%20 = load i32, i32* @AF_INET
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 4
store i32 %20, i32* %21
%22 = load i32, i32* @INADDR_ANY
%23 = call i8* @htonl(i32 %22)
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 3
%25 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %24, i32 0, i32 0
store i8* %23, i8** %25
%26 = call i32 @htons(i32 50007)
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 2
store i32 %26, i32* %27
%28 = load i32, i32* %2
%29 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%30 = call i64 @bind(i32 %28, %struct.sockaddr* %29, i32 32)
%31 = icmp slt i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %18
%33 = call i32 @perror(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %18
%36 = bitcast %struct.ip_mreq* %10 to %struct.sockaddr_in*
%37 = call i32 @memset(%struct.sockaddr_in* %36, i32 0, i32 32)
%38 = getelementptr inbounds %struct.ip_mreq, %struct.ip_mreq* %10, i32 0, i32 1
%39 = call i32 @inet_aton(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32* %38)
%40 = load i32, i32* @INADDR_ANY
%41 = call i8* @htonl(i32 %40)
%42 = getelementptr inbounds %struct.ip_mreq, %struct.ip_mreq* %10, i32 0, i32 0
%43 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %42, i32 0, i32 0
store i8* %41, i8** %43
%44 = load i32, i32* %2
%45 = load i32, i32* @IPPROTO_IP
%46 = load i32, i32* @IP_ADD_MEMBERSHIP
%47 = bitcast %struct.ip_mreq* %10 to %struct.sockaddr_in*
%48 = call i32 @setsockopt(i32 %44, i32 %45, i32 %46, %struct.sockaddr_in* %47, i32 32)
%49 = icmp eq i32 %48, -1
br i1 %49, label %50, label %53
50: ; preds = %35
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%52 = call i32 @exit(i32 1)
unreachable
53: ; preds = %35
store i32 32, i32* %7
%54 = load i32, i32* %2
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%56 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%57 = call i32 @recvfrom(i32 %54, i8* %55, i32 1024, i32 0, %struct.sockaddr* %56, i32* %7)
store i32 %57, i32* %3
%58 = icmp slt i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %53
%60 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %53
%63 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%64 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%65 = call i32 @strcpy(i8* %63, i8* %64)
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%67 = call i32 @strcat(i8* %66, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%69 = call i32 @strlen(i8* %68)
store i32 %69, i32* %4
br label %70
70: ; preds = %94, %62
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%72 = call i64 @strncmp(i8* %71, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%73 = icmp ne i64 %72, 0
br i1 %73, label %74, label %98
74: ; preds = %70
%75 = load i32, i32* %2
%76 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%77 = load i32, i32* %4
%78 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%79 = load i32, i32* %7
%80 = call i64 @sendto(i32 %75, i8* %76, i32 %77, i32 0, %struct.sockaddr* %78, i32 %79)
%81 = icmp slt i64 %80, 0
br i1 %81, label %82, label %85
82: ; preds = %74
%83 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
%84 = call i32 @exit(i32 1)
unreachable
85: ; preds = %74
%86 = load i32, i32* %2
%87 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%88 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%89 = call i32 @recvfrom(i32 %86, i8* %87, i32 1024, i32 0, %struct.sockaddr* %88, i32* %7)
%90 = icmp slt i32 %89, 0
br i1 %90, label %91, label %94
91: ; preds = %85
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%93 = call i32 @exit(i32 1)
unreachable
94: ; preds = %85
%95 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 2
store i8 0, i8* %95
%96 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i8* %96)
br label %70
98: ; preds = %70
%99 = load i32, i32* %2
%100 = load i32, i32* @IPPROTO_IP
%101 = load i32, i32* @IP_DROP_MEMBERSHIP
%102 = bitcast %struct.ip_mreq* %10 to %struct.sockaddr_in*
%103 = call i32 @setsockopt(i32 %99, i32 %100, i32 %101, %struct.sockaddr_in* %102, i32 32)
%104 = icmp eq i32 %103, -1
br i1 %104, label %105, label %108
105: ; preds = %98
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%107 = call i32 @exit(i32 1)
unreachable
108: ; preds = %98
%109 = load i32, i32* %2
%110 = call i32 @close(i32 %109)
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0))
%112 = load i32, i32* %1
ret i32 %112
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_4__, i32, i32, %struct.TYPE_3__, i32 }
%struct.TYPE_4__ = type { i8* }
%struct.TYPE_3__ = type { i8* }
%struct.ip_mreq = type { %struct.TYPE_4__, i32, i32, %struct.TYPE_3__, i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str = [25 x i8] c"Errorea socketa sortzean\00"
@INADDR_ANY = global i32 0
@.str.1 = [41 x i8] c"Errorea socketari helbide bat esleitzean\00"
@.str.2 = [11 x i8] c"224.0.0.11\00"
@IPPROTO_IP = global i32 0
@IP_ADD_MEMBERSHIP = global i32 0
@.str.3 = [42 x i8] c"errorea multicast helbidea esleitzerakoan\00"
@.str.4 = [25 x i8] c"Errorea datuak jasotzean\00"
@.str.5 = [17 x i8] c"Telmo eta Karlos\00"
@.str.6 = [3 x i8] c"OK\00"
@.str.7 = [26 x i8] c"Errorea datuak bidaltzean\00"
@.str.8 = [30 x i8] c"iritsi da mezua (Kodea) : %s \00"
@IP_DROP_MEMBERSHIP = global i32 0
@str = [31 x i8] c"\0A-- PROGRAMA AMAITU DA!!! ----\00"
define i32 @main() {
%1 = alloca %struct.sockaddr_in
%2 = alloca %struct.sockaddr_in
%3 = alloca i32
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = alloca %struct.ip_mreq
%7 = bitcast %struct.sockaddr_in* %1 to i8*
%8 = bitcast %struct.sockaddr_in* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%12 = bitcast %struct.ip_mreq* %6 to i8*
%13 = load i32, i32* @AF_INET
%14 = load i32, i32* @SOCK_DGRAM
%15 = tail call i32 @socket(i32 %13, i32 %14, i32 0)
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %0
%18 = tail call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %0
%21 = call i32 @memset(%struct.sockaddr_in* %1, i32 0, i32 32)
%22 = load i32, i32* @AF_INET
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 4
store i32 %22, i32* %23
%24 = load i32, i32* @INADDR_ANY
%25 = call i8* @htonl(i32 %24)
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 3, i32 0
store i8* %25, i8** %26
%27 = call i32 @htons(i32 50007)
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
store i32 %27, i32* %28
%29 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%30 = call i64 @bind(i32 %15, %struct.sockaddr* %29, i32 32)
%31 = icmp slt i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %20
%33 = call i32 @perror(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %20
%36 = bitcast %struct.ip_mreq* %6 to %struct.sockaddr_in*
%37 = call i32 @memset(%struct.sockaddr_in* %36, i32 0, i32 32)
%38 = getelementptr inbounds %struct.ip_mreq, %struct.ip_mreq* %6, i64 0, i32 1
%39 = call i32 @inet_aton(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32* %38)
%40 = load i32, i32* @INADDR_ANY
%41 = call i8* @htonl(i32 %40)
%42 = getelementptr inbounds %struct.ip_mreq, %struct.ip_mreq* %6, i64 0, i32 0, i32 0
store i8* %41, i8** %42
%43 = load i32, i32* @IPPROTO_IP
%44 = load i32, i32* @IP_ADD_MEMBERSHIP
%45 = call i32 @setsockopt(i32 %15, i32 %43, i32 %44, %struct.sockaddr_in* %36, i32 32)
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %50
47: ; preds = %35
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %35
store i32 32, i32* %3
%51 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%52 = call i32 @recvfrom(i32 %15, i8* %10, i32 1024, i32 0, %struct.sockaddr* %51, i32* %3)
%53 = icmp slt i32 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %50
%55 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%56 = call i32 @exit(i32 1)
unreachable
57: ; preds = %50
%58 = call i32 @strcpy(i8* %11, i8* %10)
%59 = call i32 @strcat(i8* %11, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%60 = call i32 @strlen(i8* %11)
%61 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%62 = icmp eq i64 %61, 0
br i1 %62, label %82, label %63
63: ; preds = %57
%64 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 2
br label %65
65: ; preds = %63, %78
%66 = load i32, i32* %3
%67 = call i64 @sendto(i32 %15, i8* %11, i32 %60, i32 0, %struct.sockaddr* %51, i32 %66)
%68 = icmp slt i64 %67, 0
br i1 %68, label %69, label %72
69: ; preds = %65
%70 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
%71 = call i32 @exit(i32 1)
unreachable
72: ; preds = %65
%73 = call i32 @recvfrom(i32 %15, i8* %10, i32 1024, i32 0, %struct.sockaddr* %51, i32* %3)
%74 = icmp slt i32 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %72
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%77 = call i32 @exit(i32 1)
unreachable
78: ; preds = %72
store i8 0, i8* %64
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i8* %10)
%80 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%81 = icmp eq i64 %80, 0
br i1 %81, label %82, label %65
82: ; preds = %78, %57
%83 = load i32, i32* @IPPROTO_IP
%84 = load i32, i32* @IP_DROP_MEMBERSHIP
%85 = call i32 @setsockopt(i32 %15, i32 %83, i32 %84, %struct.sockaddr_in* %36, i32 32)
%86 = icmp eq i32 %85, -1
br i1 %86, label %87, label %90
87: ; preds = %82
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%89 = call i32 @exit(i32 1)
unreachable
90: ; preds = %82
%91 = call i32 @close(i32 %15)
%92 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret i32 0
}