#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 */

/* Type definitions */
struct sockaddr_storage {
  int dummy;
};
struct sockaddr {
  int dummy;
};
struct addrinfo {
  int ai_flags;
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ ai_addr;
  struct addrinfo *ai_next;
  scalar_t__ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
};
typedef int ssize_t;
typedef int socklen_t;
typedef int /*<<< orphan*/ rsz;
typedef int /*<<< orphan*/ from;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ AF_INET6;
int AI_ALL;
int AI_PASSIVE;
int AI_V4MAPPED;
int /*<<< orphan*/ EXIT_FAILURE;
int NI_MAXHOST;
int NI_MAXSERV;
int NI_NUMERICHOST;
int NI_NUMERICSERV;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_RCVBUF;
int bind(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
int getaddrinfo(int /*<<< orphan*/ *, char *, struct addrinfo *,
                struct addrinfo **);
int getnameinfo(struct sockaddr *, int, char *, int, char *, int, int);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int sfd, s, rsz, r;
  struct addrinfo hints;
  struct addrinfo *result, *rp;
  ssize_t nrecv;
  char buf[100000];
  struct sockaddr_storage from;
  socklen_t fromlen;
  char host[NI_MAXHOST], service[NI_MAXSERV];
  if (argc != 2) {
    printf("Usage: %s port\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  memset(&hints, 0, sizeof(struct addrinfo));
  hints.ai_family = AF_INET6;
  hints.ai_socktype = SOCK_DGRAM;
  hints.ai_flags = AI_PASSIVE;
  hints.ai_flags |= AI_V4MAPPED | AI_ALL;
  hints.ai_protocol = 0;
  s = getaddrinfo(NULL, argv[1], &hints, &result);
  if (s != 0) {
    fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(s));
    exit(EXIT_FAILURE);
  }
  for (rp = result; rp != NULL; rp = rp->ai_next) {
    sfd = socket(AF_INET6, SOCK_DGRAM, 0);
    if (sfd == -1)
      continue;
    r = bind(sfd, rp->ai_addr, rp->ai_addrlen);
    if (r == 0)
      break;
    close(sfd);
  }
  if (rp == NULL) {
    perror("bind");
    exit(EXIT_FAILURE);
  }
  freeaddrinfo(result);
  rsz = 80000;
  if (setsockopt(sfd, SOL_SOCKET, SO_RCVBUF, &rsz, sizeof(rsz)) == 0)
    printf("SO_RCVBUF apres forcage: %d octets\n", rsz);
  else
    perror("setsockopt SO_RCVBUF");
  for (;;) {
    fromlen = sizeof(from);
    nrecv =
        recvfrom(sfd, buf, sizeof(buf), 0, (struct sockaddr *)&from, &fromlen);
    if (nrecv == -1) {
      perror("Erreur en lecture socket\n");
      exit(EXIT_FAILURE);
    }
    printf("Recu %zd octets\n", nrecv);
    s = getnameinfo((struct sockaddr *)&from, fromlen, host, NI_MAXHOST,
                    service, NI_MAXSERV, NI_NUMERICHOST | NI_NUMERICSERV);
    if (s == 0)
      printf("Emetteur '%s'  Port '%s'\n", host, service);
    else
      printf("Erreur: %s\n", gai_strerror(s));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x18740,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2d80(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18718(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x18738(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18720(%rbp)
mov    0x2d93(%rip),%rax
mov    (%rax),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x18730(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18728(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1286 <main+0xa6>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d09(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
lea    -0x48(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1060 <memset@plt>
mov    0x2d1b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2d17(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2d1b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    0x2d17(%rip),%rax
mov    (%rax),%eax
mov    0x2cde(%rip),%rcx
or     (%rcx),%eax
or     -0x48(%rbp),%eax
mov    %eax,-0x48(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    -0x48(%rbp),%rdx
lea    -0x50(%rbp),%rcx
call   10e0 <getaddrinfo@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     133a <main+0x15a>
mov    0x2c91(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1873c(%rbp)
mov    -0x18(%rbp),%edi
call   1050 <gai_strerror@plt>
mov    -0x1873c(%rbp),%edi
mov    %rax,%rdx
lea    0xce9(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2c55(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
mov    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
je     13b9 <main+0x1d9>
mov    0x2c64(%rip),%rax
mov    (%rax),%edi
mov    0x2c63(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1378 <main+0x198>
jmp    13a8 <main+0x1c8>
mov    -0x14(%rbp),%edi
mov    -0x58(%rbp),%rax
mov    0x8(%rax),%esi
mov    -0x58(%rbp),%rax
mov    0x4(%rax),%edx
call   10b0 <bind@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    13a0 <main+0x1c0>
jmp    13b9 <main+0x1d9>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
mov    -0x58(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x58(%rbp)
jmp    1342 <main+0x162>
cmpq   $0x0,-0x58(%rbp)
jne    13de <main+0x1fe>
lea    0xc56(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2bb1(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
mov    -0x50(%rbp),%rdi
call   10f0 <freeaddrinfo@plt>
movl   $0x13880,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2be8(%rip),%rax
mov    (%rax),%esi
mov    0x2b9f(%rip),%rax
mov    (%rax),%edx
lea    -0x1c(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0x0,%rax
jne    1432 <main+0x252>
mov    -0x1c(%rbp),%esi
lea    0xc00(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    143e <main+0x25e>
lea    0xc11(%rip),%rdi
call   10c0 <perror@plt>
jmp    1443 <main+0x263>
movl   $0x4,-0x1870c(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x18700(%rbp),%rsi
lea    -0x18708(%rbp),%r8
mov    $0x186a0,%edx
xor    %ecx,%ecx
lea    -0x1870c(%rbp),%r9
call   10a0 <recvfrom@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0xffffffff,-0x5c(%rbp)
jne    1498 <main+0x2b8>
lea    0xbda(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2af7(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
mov    -0x5c(%rbp),%esi
lea    0xbd7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18738(%rbp),%rdx
mov    -0x18730(%rbp),%r8
lea    -0x18708(%rbp),%rdi
mov    -0x1870c(%rbp),%esi
mov    0x2ab5(%rip),%rax
mov    (%rax),%ecx
mov    0x2af4(%rip),%rax
mov    (%rax),%r9d
mov    0x2ab2(%rip),%rax
mov    (%rax),%eax
mov    0x2b01(%rip),%r10
or     (%r10),%eax
sub    $0x10,%rsp
mov    %eax,(%rsp)
call   1080 <getnameinfo@plt>
add    $0x10,%rsp
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1528 <main+0x348>
mov    -0x18730(%rbp),%rdx
mov    -0x18738(%rbp),%rsi
lea    0xb6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1541 <main+0x361>
mov    -0x18(%rbp),%edi
call   1050 <gai_strerror@plt>
mov    %rax,%rsi
lea    0xb6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1443 <main+0x263>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x186e8,%rsp
mov    %rsi,%r14
mov    0x2d82(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    0x2db0(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r15
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
cmp    $0x2,%edi
jne    12eb <main+0x10b>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1060 <memset@plt>
mov    0x2d6d(%rip),%r13
mov    0x0(%r13),%eax
mov    %eax,-0x4c(%rbp)
mov    0x2d67(%rip),%r12
mov    0x2d70(%rip),%rax
mov    0x2d71(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    (%r12),%eax
mov    0x2d32(%rip),%rdx
or     (%rdx),%ecx
mov    %eax,-0x50(%rbp)
mov    %ecx,-0x70(%rbp)
movq   $0x0,-0x58(%rbp)
mov    0x8(%r14),%rsi
lea    -0x40(%rbp),%rcx
xor    %edi,%edi
lea    -0x70(%rbp),%rdx
call   10e0 <getaddrinfo@plt>
test   %eax,%eax
jne    12fe <main+0x11e>
mov    %rbx,-0x48(%rbp)
mov    -0x40(%rbp),%r14
jmp    12b4 <main+0xd4>
nopw   0x0(%rax,%rax,1)
mov    0x10(%r14),%r14
test   %r14,%r14
je     1321 <main+0x141>
mov    0x0(%r13),%edi
mov    (%r12),%esi
xor    %edx,%edx
call   1100 <socket@plt>
cmp    $0xffffffff,%eax
je     12b0 <main+0xd0>
mov    %eax,%ebx
mov    0x4(%r14),%edx
mov    0x8(%r14),%esi
mov    %eax,%edi
call   10b0 <bind@plt>
test   %eax,%eax
je     133b <main+0x15b>
mov    %ebx,%edi
call   1070 <close@plt>
jmp    12b0 <main+0xd0>
mov    (%r14),%rsi
lea    0xd0b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    132d <main+0x14d>
mov    0x2c93(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1050 <gai_strerror@plt>
lea    0xcfb(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1090 <fprintf@plt>
jmp    132d <main+0x14d>
lea    0xcf9(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2c54(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
mov    -0x40(%rbp),%rdi
call   10f0 <freeaddrinfo@plt>
movl   $0x13880,-0x30(%rbp)
mov    0x2c8e(%rip),%rax
mov    (%rax),%esi
mov    0x2c45(%rip),%rax
mov    (%rax),%edx
lea    -0x30(%rbp),%rcx
mov    %ebx,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %rax,%rax
je     147a <main+0x29a>
lea    0xccc(%rip),%rdi
call   10c0 <perror@plt>
mov    0x2bf6(%rip),%r14
movl   $0x4,-0x2c(%rbp)
lea    -0x18710(%rbp),%rsi
lea    -0x38(%rbp),%r8
lea    -0x2c(%rbp),%r9
mov    %ebx,%edi
mov    $0x186a0,%edx
xor    %ecx,%ecx
call   10a0 <recvfrom@plt>
cmp    $0xffffffff,%eax
jne    13bf <main+0x1df>
lea    0xca5(%rip),%rdi
jmp    1328 <main+0x148>
lea    -0x38(%rbp),%r13
mov    -0x48(%rbp),%r12
jmp    1410 <main+0x230>
nopl   0x0(%rax)
mov    %eax,%edi
call   1050 <gai_strerror@plt>
lea    0xcc6(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x4,-0x2c(%rbp)
mov    %ebx,%edi
lea    -0x18710(%rbp),%rsi
mov    $0x186a0,%edx
xor    %ecx,%ecx
mov    %r13,%r8
lea    -0x2c(%rbp),%r9
call   10a0 <recvfrom@plt>
cmp    $0xffffffff,%eax
je     13b3 <main+0x1d3>
lea    0xc62(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x2c(%rbp),%esi
mov    (%r14),%ecx
mov    0x2b9b(%rip),%rax
mov    (%rax),%r9d
mov    0x2bb1(%rip),%rax
mov    (%rax),%eax
mov    0x2b50(%rip),%rdx
or     (%rdx),%eax
sub    $0x8,%rsp
mov    %r13,%rdi
mov    %r12,%rdx
mov    %r15,%r8
push   %rax
call   1080 <getnameinfo@plt>
add    $0x10,%rsp
test   %eax,%eax
jne    13d0 <main+0x1f0>
lea    0xc22(%rip),%rdi
mov    %r12,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    13e8 <main+0x208>
mov    -0x30(%rbp),%esi
lea    0xba2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1383 <main+0x1a3>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32, i32, %struct.addrinfo*, i64, i32, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
@NI_MAXHOST = global i32 0
@NI_MAXSERV = global i32 0
@.str = [16 x i8] c"Usage: %s port\0A\00"
@EXIT_FAILURE = global i32 0
@AF_INET6 = global i32 0
@SOCK_DGRAM = global i32 0
@AI_PASSIVE = global i32 0
@AI_V4MAPPED = global i32 0
@AI_ALL = global i32 0
@stderr = global i32 0
@.str.1 = [17 x i8] c"getaddrinfo: %s\0A\00"
@.str.2 = [5 x i8] c"bind\00"
@SOL_SOCKET = global i32 0
@SO_RCVBUF = global i32 0
@.str.3 = [36 x i8] c"SO_RCVBUF apres forcage: %d octets\0A\00"
@.str.4 = [21 x i8] c"setsockopt SO_RCVBUF\00"
@.str.5 = [26 x i8] c"Erreur en lecture socket\0A\00"
@.str.6 = [17 x i8] c"Recu %zd octets\0A\00"
@NI_NUMERICHOST = global i32 0
@NI_NUMERICSERV = global i32 0
@.str.7 = [26 x i8] c"Emetteur '%s' Port '%s'\0A\00"
@.str.8 = [12 x i8] c"Erreur: %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.addrinfo
%11 = alloca %struct.addrinfo*
%12 = alloca %struct.addrinfo*
%13 = alloca i32
%14 = alloca [100000 x i8]
%15 = alloca %struct.sockaddr_storage
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i64
%19 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = load i32, i32* @NI_MAXHOST
%21 = zext i32 %20 to i64
%22 = call i8* @llvm.stacksave()
store i8* %22, i8** %17
%23 = alloca i8, i64 %21
store i64 %21, i64* %18
%24 = load i32, i32* @NI_MAXSERV
%25 = zext i32 %24 to i64
%26 = alloca i8, i64 %25
store i64 %25, i64* %19
%27 = load i32, i32* %4
%28 = icmp ne i32 %27, 2
br i1 %28, label %29, label %36
29: ; preds = %2
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %32)
%34 = load i32, i32* @EXIT_FAILURE
%35 = call i32 @exit(i32 %34)
unreachable
36: ; preds = %2
%37 = call i32 @memset(%struct.addrinfo* %10, i32 0, i32 40)
%38 = load i32, i32* @AF_INET6
%39 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %10, i32 0, i32 6
store i32 %38, i32* %39
%40 = load i32, i32* @SOCK_DGRAM
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %10, i32 0, i32 5
store i32 %40, i32* %41
%42 = load i32, i32* @AI_PASSIVE
%43 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %10, i32 0, i32 0
store i32 %42, i32* %43
%44 = load i32, i32* @AI_V4MAPPED
%45 = load i32, i32* @AI_ALL
%46 = or i32 %44, %45
%47 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %10, i32 0, i32 0
%48 = load i32, i32* %47
%49 = or i32 %48, %46
store i32 %49, i32* %47
%50 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %10, i32 0, i32 4
store i64 0, i64* %50
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 1
%53 = load i8*, i8** %52
%54 = call i32 @getaddrinfo(i32* null, i8* %53, %struct.addrinfo* %10, %struct.addrinfo** %11)
store i32 %54, i32* %7
%55 = load i32, i32* %7
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %64
57: ; preds = %36
%58 = load i32, i32* @stderr
%59 = load i32, i32* %7
%60 = call i8* @gai_strerror(i32 %59)
%61 = call i32 @fprintf(i32 %58, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %60)
%62 = load i32, i32* @EXIT_FAILURE
%63 = call i32 @exit(i32 %62)
unreachable
64: ; preds = %36
%65 = load %struct.addrinfo*, %struct.addrinfo** %11
store %struct.addrinfo* %65, %struct.addrinfo** %12
br label %66
66: ; preds = %91, %64
%67 = load %struct.addrinfo*, %struct.addrinfo** %12
%68 = icmp ne %struct.addrinfo* %67, null
br i1 %68, label %69, label %95
69: ; preds = %66
%70 = load i32, i32* @AF_INET6
%71 = load i32, i32* @SOCK_DGRAM
%72 = call i32 @socket(i32 %70, i32 %71, i32 0)
store i32 %72, i32* %6
%73 = load i32, i32* %6
%74 = icmp eq i32 %73, -1
br i1 %74, label %75, label %76
75: ; preds = %69
br label %91
76: ; preds = %69
%77 = load i32, i32* %6
%78 = load %struct.addrinfo*, %struct.addrinfo** %12
%79 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %78, i32 0, i32 2
%80 = load i32, i32* %79
%81 = load %struct.addrinfo*, %struct.addrinfo** %12
%82 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %81, i32 0, i32 1
%83 = load i32, i32* %82
%84 = call i32 @bind(i32 %77, i32 %80, i32 %83)
store i32 %84, i32* %9
%85 = load i32, i32* %9
%86 = icmp eq i32 %85, 0
br i1 %86, label %87, label %88
87: ; preds = %76
br label %95
88: ; preds = %76
%89 = load i32, i32* %6
%90 = call i32 @close(i32 %89)
br label %91
91: ; preds = %88, %75
%92 = load %struct.addrinfo*, %struct.addrinfo** %12
%93 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %92, i32 0, i32 3
%94 = load %struct.addrinfo*, %struct.addrinfo** %93
store %struct.addrinfo* %94, %struct.addrinfo** %12
br label %66
95: ; preds = %87, %66
%96 = load %struct.addrinfo*, %struct.addrinfo** %12
%97 = icmp eq %struct.addrinfo* %96, null
br i1 %97, label %98, label %102
98: ; preds = %95
%99 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%100 = load i32, i32* @EXIT_FAILURE
%101 = call i32 @exit(i32 %100)
unreachable
102: ; preds = %95
%103 = load %struct.addrinfo*, %struct.addrinfo** %11
%104 = call i32 @freeaddrinfo(%struct.addrinfo* %103)
store i32 80000, i32* %8
%105 = load i32, i32* %6
%106 = load i32, i32* @SOL_SOCKET
%107 = load i32, i32* @SO_RCVBUF
%108 = call i64 @setsockopt(i32 %105, i32 %106, i32 %107, i32* %8, i32 4)
%109 = icmp eq i64 %108, 0
br i1 %109, label %110, label %113
110: ; preds = %102
%111 = load i32, i32* %8
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %111)
br label %115
113: ; preds = %102
%114 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %115
115: ; preds = %113, %110
br label %116
116: ; preds = %146, %115
store i32 4, i32* %16
%117 = load i32, i32* %6
%118 = getelementptr inbounds [100000 x i8], [100000 x i8]* %14, i64 0, i64 0
%119 = bitcast %struct.sockaddr_storage* %15 to %struct.sockaddr*
%120 = call i32 @recvfrom(i32 %117, i8* %118, i32 100000, i32 0, %struct.sockaddr* %119, i32* %16)
store i32 %120, i32* %13
%121 = load i32, i32* %13
%122 = icmp eq i32 %121, -1
br i1 %122, label %123, label %127
123: ; preds = %116
%124 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%125 = load i32, i32* @EXIT_FAILURE
%126 = call i32 @exit(i32 %125)
unreachable
127: ; preds = %116
%128 = load i32, i32* %13
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i32 %128)
%130 = bitcast %struct.sockaddr_storage* %15 to %struct.sockaddr*
%131 = load i32, i32* %16
%132 = load i32, i32* @NI_MAXHOST
%133 = load i32, i32* @NI_MAXSERV
%134 = load i32, i32* @NI_NUMERICHOST
%135 = load i32, i32* @NI_NUMERICSERV
%136 = or i32 %134, %135
%137 = call i32 @getnameinfo(%struct.sockaddr* %130, i32 %131, i8* %23, i32 %132, i8* %26, i32 %133, i32 %136)
store i32 %137, i32* %7
%138 = load i32, i32* %7
%139 = icmp eq i32 %138, 0
br i1 %139, label %140, label %142
140: ; preds = %127
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %23, i8* %26)
br label %146
142: ; preds = %127
%143 = load i32, i32* %7
%144 = call i8* @gai_strerror(i32 %143)
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %144)
br label %146
146: ; preds = %142, %140
br label %116
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, i32, %struct.addrinfo*, i64, i32, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
@NI_MAXHOST = global i32 0
@NI_MAXSERV = global i32 0
@.str = [16 x i8] c"Usage: %s port\0A\00"
@EXIT_FAILURE = global i32 0
@AF_INET6 = global i32 0
@SOCK_DGRAM = global i32 0
@AI_PASSIVE = global i32 0
@AI_V4MAPPED = global i32 0
@AI_ALL = global i32 0
@stderr = global i32 0
@.str.1 = [17 x i8] c"getaddrinfo: %s\0A\00"
@.str.2 = [5 x i8] c"bind\00"
@SOL_SOCKET = global i32 0
@SO_RCVBUF = global i32 0
@.str.3 = [36 x i8] c"SO_RCVBUF apres forcage: %d octets\0A\00"
@.str.4 = [21 x i8] c"setsockopt SO_RCVBUF\00"
@.str.5 = [26 x i8] c"Erreur en lecture socket\0A\00"
@.str.6 = [17 x i8] c"Recu %zd octets\0A\00"
@NI_NUMERICHOST = global i32 0
@NI_NUMERICSERV = global i32 0
@.str.7 = [26 x i8] c"Emetteur '%s' Port '%s'\0A\00"
@.str.8 = [12 x i8] c"Erreur: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.addrinfo
%5 = alloca %struct.addrinfo*
%6 = alloca [100000 x i8]
%7 = alloca %struct.sockaddr_storage
%8 = alloca i32
%9 = bitcast i32* %3 to i8*
%10 = bitcast %struct.addrinfo* %4 to i8*
%11 = bitcast %struct.addrinfo** %5 to i8*
%12 = getelementptr inbounds [100000 x i8], [100000 x i8]* %6, i64 0, i64 0
%13 = bitcast %struct.sockaddr_storage* %7 to i8*
%14 = bitcast i32* %8 to i8*
%15 = load i32, i32* @NI_MAXHOST
%16 = zext i32 %15 to i64
%17 = alloca i8, i64 %16
%18 = load i32, i32* @NI_MAXSERV
%19 = zext i32 %18 to i64
%20 = alloca i8, i64 %19
%21 = icmp eq i32 %0, 2
br i1 %21, label %27, label %22
22: ; preds = %2
%23 = load i8*, i8** %1
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = load i32, i32* @EXIT_FAILURE
%26 = tail call i32 @exit(i32 %25)
unreachable
27: ; preds = %2
%28 = call i32 @memset(%struct.addrinfo* %4, i32 0, i32 40)
%29 = load i32, i32* @AF_INET6
%30 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 6
store i32 %29, i32* %30
%31 = load i32, i32* @SOCK_DGRAM
%32 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 5
store i32 %31, i32* %32
%33 = load i32, i32* @AI_PASSIVE
%34 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 0
%35 = load i32, i32* @AI_V4MAPPED
%36 = load i32, i32* @AI_ALL
%37 = or i32 %35, %33
%38 = or i32 %37, %36
store i32 %38, i32* %34
%39 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 4
store i64 0, i64* %39
%40 = getelementptr inbounds i8*, i8** %1, i64 1
%41 = load i8*, i8** %40
%42 = call i32 @getaddrinfo(i32* null, i8* %41, %struct.addrinfo* %4, %struct.addrinfo** %5)
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %27
%45 = load %struct.addrinfo*, %struct.addrinfo** %5
%46 = icmp eq %struct.addrinfo* %45, null
br i1 %46, label %72, label %53
47: ; preds = %27
%48 = load i32, i32* @stderr
%49 = call i8* @gai_strerror(i32 %42)
%50 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %49)
%51 = load i32, i32* @EXIT_FAILURE
%52 = call i32 @exit(i32 %51)
unreachable
53: ; preds = %44, %68
%54 = phi %struct.addrinfo* [ %70, %68 ], [ %45, %44 ]
%55 = load i32, i32* @AF_INET6
%56 = load i32, i32* @SOCK_DGRAM
%57 = call i32 @socket(i32 %55, i32 %56, i32 0)
%58 = icmp eq i32 %57, -1
br i1 %58, label %68, label %59
59: ; preds = %53
%60 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %54, i64 0, i32 2
%61 = load i32, i32* %60
%62 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %54, i64 0, i32 1
%63 = load i32, i32* %62
%64 = call i32 @bind(i32 %57, i32 %61, i32 %63)
%65 = icmp eq i32 %64, 0
br i1 %65, label %76, label %66
66: ; preds = %59
%67 = call i32 @close(i32 %57)
br label %68
68: ; preds = %53, %66
%69 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %54, i64 0, i32 3
%70 = load %struct.addrinfo*, %struct.addrinfo** %69
%71 = icmp eq %struct.addrinfo* %70, null
br i1 %71, label %72, label %53
72: ; preds = %68, %44
%73 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%74 = load i32, i32* @EXIT_FAILURE
%75 = call i32 @exit(i32 %74)
unreachable
76: ; preds = %59
%77 = load %struct.addrinfo*, %struct.addrinfo** %5
%78 = call i32 @freeaddrinfo(%struct.addrinfo* %77)
store i32 80000, i32* %3
%79 = load i32, i32* @SOL_SOCKET
%80 = load i32, i32* @SO_RCVBUF
%81 = call i64 @setsockopt(i32 %57, i32 %79, i32 %80, i32* %3, i32 4)
%82 = icmp eq i64 %81, 0
br i1 %82, label %83, label %86
83: ; preds = %76
%84 = load i32, i32* %3
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %84)
br label %88
86: ; preds = %76
%87 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %88
88: ; preds = %86, %83
%89 = bitcast %struct.sockaddr_storage* %7 to %struct.sockaddr*
store i32 4, i32* %8
%90 = call i32 @recvfrom(i32 %57, i8* %12, i32 100000, i32 0, %struct.sockaddr* %89, i32* %8)
%91 = icmp eq i32 %90, -1
br i1 %91, label %92, label %96
92: ; preds = %112, %88
%93 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%94 = load i32, i32* @EXIT_FAILURE
%95 = call i32 @exit(i32 %94)
unreachable
96: ; preds = %88, %112
%97 = phi i32 [ %113, %112 ], [ %90, %88 ]
%98 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i32 %97)
%99 = load i32, i32* %8
%100 = load i32, i32* @NI_MAXHOST
%101 = load i32, i32* @NI_MAXSERV
%102 = load i32, i32* @NI_NUMERICHOST
%103 = load i32, i32* @NI_NUMERICSERV
%104 = or i32 %103, %102
%105 = call i32 @getnameinfo(%struct.sockaddr* %89, i32 %99, i8* %17, i32 %100, i8* %20, i32 %101, i32 %104)
%106 = icmp eq i32 %105, 0
br i1 %106, label %107, label %109
107: ; preds = %96
%108 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %17, i8* %20)
br label %112
109: ; preds = %96
%110 = call i8* @gai_strerror(i32 %105)
%111 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %110)
br label %112
112: ; preds = %109, %107
store i32 4, i32* %8
%113 = call i32 @recvfrom(i32 %57, i8* %12, i32 100000, i32 0, %struct.sockaddr* %89, i32* %8)
%114 = icmp eq i32 %113, -1
br i1 %114, label %92, label %96
}