#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 */
typedef char sockaddr;
struct addrinfo {
  int /*<<< orphan*/ ai_addr;
  scalar_t__ ai_addrlen;
  int /*<<< orphan*/ ai_flags;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
};
typedef int ssize_t;
typedef scalar_t__ socklen_t;
typedef int /*<<< orphan*/ ai_hints;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ AI_NUMERICSERV;
int EINTR;
int ENAMETOOLONG;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ abort();
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
scalar_t__ getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
scalar_t__ gethostname(char *, int);
char *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, int /*<<< orphan*/, size_t);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int sendto(int, char *, int, int /*<<< orphan*/, char *, scalar_t__);
scalar_t__ sleep(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int strlen(char *);
int main(int argc, char **argv) {
  ssize_t hostnamelen = 1;
  char *hostname = malloc(hostnamelen);
  if (hostname == NULL) {
    do {
      int _errno = errno;
      fprintf(stderr, "malloc hates me.\n");
      errno = _errno;
      perror("File: "
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/"
             "master/sayhello.c"
             "\nLine: "
             "46");
      abort();
    } while (0);
  }
  while (gethostname(hostname, hostnamelen)) {
    if (errno != ENAMETOOLONG) {
      do {
        int _errno = errno;
        fprintf(stderr, "gethostname fail.\n");
        errno = _errno;
        perror("File: "
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/"
               "heads/master/sayhello.c"
               "\nLine: "
               "50");
        abort();
      } while (0);
    }
    hostnamelen <<= 1;
    free(hostname);
    hostname = malloc(hostnamelen);
    if (hostname == NULL) {
      do {
        int _errno = errno;
        fprintf(stderr, "malloc hates me.\n");
        errno = _errno;
        perror("File: "
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/"
               "heads/master/sayhello.c"
               "\nLine: "
               "56");
        abort();
      } while (0);
    }
  }
  hostnamelen = strlen(hostname) + 1;
  socklen_t addrlen;
  struct sockaddr *addr;
  struct addrinfo ai_hints, *ai_lookup;
  memset(&ai_hints, 0, sizeof(ai_hints));
  ai_hints.ai_family = PF_INET;
  ai_hints.ai_socktype = SOCK_DGRAM;
  ai_hints.ai_flags = AI_NUMERICSERV;
  if (getaddrinfo("tigger", "8087", &ai_hints, &ai_lookup)) {
    do {
      int _errno = errno;
      fprintf(stderr, "Looking up 'tigger' failed.\n");
      errno = _errno;
      perror("File: "
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/"
             "master/sayhello.c"
             "\nLine: "
             "70");
      abort();
    } while (0);
  }
  addrlen = ai_lookup->ai_addrlen;
  addr = malloc((size_t)addrlen);
  if (addr == NULL) {
    do {
      int _errno = errno;
      fprintf(stderr, "malloc hates me.\n");
      errno = _errno;
      perror("File: "
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/"
             "master/sayhello.c"
             "\nLine: "
             "75");
      abort();
    } while (0);
  }
  memcpy(addr, ai_lookup->ai_addr, (size_t)addrlen);
  freeaddrinfo(ai_lookup);
  int s = socket(AF_INET, SOCK_DGRAM, 0);
  if (s == -1) {
    do {
      int _errno = errno;
      fprintf(stderr, "Can't get a udp4 socket.\n");
      errno = _errno;
      perror("File: "
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/"
             "master/sayhello.c"
             "\nLine: "
             "82");
      abort();
    } while (0);
  }
  for (;;) {
    ssize_t r = sendto(s, hostname, hostnamelen, 0, addr, addrlen);
    if (r != hostnamelen) {
      do {
        if (errno == EINTR) {
          goto stopped;
        }
        do {
          int _errno = errno;
          fprintf(stderr, "sendto returned %zd.\n", r);
          errno = _errno;
          perror("File: "
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/"
                 "refs/heads/master/sayhello.c"
                 "\nLine: "
                 "88");
          abort();
        } while (0);
      } while (0);
    }
    if (sleep(5)) {
      do {
        if (errno == EINTR) {
          goto stopped;
        }
        do {
          int _errno = errno;
          fprintf(stderr, "nightmare\n");
          errno = _errno;
          perror("File: "
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/"
                 "refs/heads/master/sayhello.c"
                 "\nLine: "
                 "91");
          abort();
        } while (0);
      } while (0);
    }
  }
stopped:
  free(addr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movslq -0x14(%rbp),%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    125f <main+0x7f>
jmp    121d <main+0x3d>
mov    0x2d9c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2d98(%rip),%rax
mov    (%rax),%edi
lea    0xdc7(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x24(%rbp),%ecx
mov    0x2d76(%rip),%rax
mov    %ecx,(%rax)
lea    0xdbf(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
jmp    1264 <main+0x84>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10c0 <gethostname@plt>
cmp    $0x0,%rax
je     134f <main+0x16f>
mov    0x2d3f(%rip),%rax
mov    (%rax),%eax
mov    0x2d1e(%rip),%rcx
cmp    (%rcx),%eax
je     12d9 <main+0xf9>
jmp    1297 <main+0xb7>
mov    0x2d22(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2d1e(%rip),%rax
mov    (%rax),%edi
lea    0xdfd(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x28(%rbp),%ecx
mov    0x2cfc(%rip),%rax
mov    %ecx,(%rax)
lea    0xdf6(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movslq -0x14(%rbp),%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    134a <main+0x16a>
jmp    1308 <main+0x128>
mov    0x2cb1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2cad(%rip),%rax
mov    (%rax),%edi
lea    0xcdc(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x2c(%rbp),%ecx
mov    0x2c8b(%rip),%rax
mov    %ecx,(%rax)
lea    0xe23(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
jmp    1264 <main+0x84>
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1060 <memset@plt>
mov    0x2c43(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    0x2c57(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    0x2c6b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
lea    0xe66(%rip),%rdi
lea    0xe66(%rip),%rsi
lea    -0x60(%rbp),%rdx
lea    -0x68(%rbp),%rcx
call   10d0 <getaddrinfo@plt>
cmp    $0x0,%rax
je     13fe <main+0x21e>
jmp    13bc <main+0x1dc>
mov    0x2bfd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    0x2bf9(%rip),%rax
mov    (%rax),%edi
lea    0xe33(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x6c(%rbp),%ecx
mov    0x2bd7(%rip),%rax
mov    %ecx,(%rax)
lea    0xe36(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x68(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1469 <main+0x289>
jmp    1427 <main+0x247>
mov    0x2b92(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x70(%rbp)
mov    0x2b8e(%rip),%rax
mov    (%rax),%edi
lea    0xbbd(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x70(%rbp),%ecx
mov    0x2b6c(%rip),%rax
mov    %ecx,(%rax)
lea    0xe69(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x40(%rbp),%rdi
mov    -0x68(%rbp),%rax
mov    (%rax),%esi
mov    -0x38(%rbp),%rdx
call   1090 <memcpy@plt>
mov    -0x68(%rbp),%rdi
call   10f0 <freeaddrinfo@plt>
mov    0x2b54(%rip),%rax
mov    (%rax),%edi
mov    0x2b43(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
mov    %eax,-0x74(%rbp)
cmpl   $0xffffffff,-0x74(%rbp)
jne    14f2 <main+0x312>
jmp    14b0 <main+0x2d0>
mov    0x2b09(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x78(%rbp)
mov    0x2b05(%rip),%rax
mov    (%rax),%edi
lea    0xe98(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x78(%rbp),%ecx
mov    0x2ae3(%rip),%rax
mov    %ecx,(%rax)
lea    0xe98(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
jmp    14f7 <main+0x317>
mov    -0x74(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x40(%rbp),%r8
mov    -0x38(%rbp),%r9
xor    %ecx,%ecx
call   1070 <sendto@plt>
mov    %eax,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     158b <main+0x3ab>
jmp    1524 <main+0x344>
mov    0x2a95(%rip),%rax
mov    (%rax),%eax
mov    0x2a7c(%rip),%rcx
cmp    (%rcx),%eax
jne    1541 <main+0x361>
jmp    1613 <main+0x433>
jmp    1546 <main+0x366>
mov    0x2a73(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x80(%rbp)
mov    0x2a6f(%rip),%rax
mov    (%rax),%edi
mov    -0x7c(%rbp),%edx
lea    0xeb7(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x80(%rbp),%ecx
mov    0x2a4a(%rip),%rax
mov    %ecx,(%rax)
lea    0xeb3(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    $0x5,%edi
call   10e0 <sleep@plt>
cmp    $0x0,%rax
je     160e <main+0x42e>
jmp    15a4 <main+0x3c4>
mov    0x2a15(%rip),%rax
mov    (%rax),%eax
mov    0x29fc(%rip),%rcx
cmp    (%rcx),%eax
jne    15c1 <main+0x3e1>
jmp    1613 <main+0x433>
jmp    15c6 <main+0x3e6>
mov    0x29f3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    0x29ec(%rip),%rax
mov    (%rax),%edi
lea    0xeeb(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x84(%rbp),%ecx
mov    0x29c7(%rip),%rax
mov    %ecx,(%rax)
lea    0xed9(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
jmp    14f7 <main+0x317>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    $0x1,%edi
call   10a0 <malloc@plt>
test   %rax,%rax
je     1400 <main+0x220>
mov    %rax,%r13
mov    $0x1,%ebp
mov    0x2db0(%rip),%r15
mov    0x2d91(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %ebp,%esi
call   10c0 <gethostname@plt>
test   %rax,%rax
je     127b <main+0x9b>
mov    (%r15),%ebx
cmp    (%r14),%ebx
jne    13d3 <main+0x1f3>
add    %ebp,%ebp
mov    %r13,%rdi
call   1030 <free@plt>
movslq %ebp,%rdi
call   10a0 <malloc@plt>
mov    %rax,%r13
test   %rax,%rax
jne    1220 <main+0x40>
mov    0x2d6c(%rip),%rax
mov    (%rax),%edi
lea    0xd9b(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %ebx,(%r15)
lea    0xeeb(%rip),%rdi
jmp    13f4 <main+0x214>
mov    %r13,%rdi
call   1050 <strlen@plt>
mov    %eax,%r12d
lea    0x8(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1060 <memset@plt>
mov    0x2d17(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
mov    0x2d2a(%rip),%rbx
mov    (%rbx),%eax
mov    %eax,0x1c(%rsp)
mov    0x2d3d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
lea    0xf37(%rip),%rdi
lea    0xf37(%rip),%rsi
mov    %rsp,%rcx
mov    %rbp,%rdx
call   10d0 <getaddrinfo@plt>
test   %rax,%rax
jne    142b <main+0x24b>
mov    (%rsp),%rbp
mov    0x8(%rbp),%r15
mov    %r15,%rdi
call   10a0 <malloc@plt>
test   %rax,%rax
je     1458 <main+0x278>
mov    %rax,%r14
mov    0x0(%rbp),%esi
mov    %rax,%rdi
mov    %r15,%rdx
call   1090 <memcpy@plt>
mov    (%rsp),%rdi
call   10f0 <freeaddrinfo@plt>
mov    0x2cc3(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%esi
xor    %edx,%edx
call   1100 <socket@plt>
cmp    $0xffffffff,%eax
je     1488 <main+0x2a8>
mov    %eax,%ebp
add    $0x1,%r12d
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r13,%rsi
mov    %r12d,%edx
xor    %ecx,%ecx
mov    %r14,%r8
mov    %r15,%r9
call   1070 <sendto@plt>
cmp    %r12d,%eax
jne    13a1 <main+0x1c1>
mov    $0x5,%edi
call   10e0 <sleep@plt>
test   %rax,%rax
je     1340 <main+0x160>
mov    0x2c50(%rip),%rbp
mov    0x0(%rbp),%ebx
mov    0x2c36(%rip),%rax
cmp    (%rax),%ebx
je     13ba <main+0x1da>
mov    0x2c43(%rip),%rax
mov    (%rax),%edi
lea    0x1142(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %ebx,0x0(%rbp)
lea    0x113c(%rip),%rdi
jmp    13f4 <main+0x214>
mov    0x2c18(%rip),%rbp
mov    0x0(%rbp),%ebx
mov    0x2bfe(%rip),%rcx
cmp    (%rcx),%ebx
jne    14b8 <main+0x2d8>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bee(%rip),%rax
mov    (%rax),%edi
lea    0xccd(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %ebx,(%r15)
lea    0xccf(%rip),%rdi
call   10b0 <perror@plt>
xor    %eax,%eax
call   1040 <abort@plt>
mov    0x2bb9(%rip),%rbx
mov    (%rbx),%ebp
mov    0x2bb8(%rip),%rax
mov    (%rax),%edi
lea    0xbe7(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %ebp,(%rbx)
lea    0xbe9(%rip),%rdi
jmp    13f4 <main+0x214>
mov    0x2b8e(%rip),%rbp
mov    0x0(%rbp),%ebx
mov    0x2b8c(%rip),%rax
mov    (%rax),%edi
lea    0xdc6(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %ebx,0x0(%rbp)
lea    0xdd2(%rip),%rdi
jmp    13f4 <main+0x214>
mov    0x2b61(%rip),%rbp
mov    0x0(%rbp),%ebx
mov    0x2b5f(%rip),%rax
mov    (%rax),%edi
lea    0xb8e(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %ebx,0x0(%rbp)
lea    0xe43(%rip),%rdi
jmp    13f4 <main+0x214>
mov    0x2b31(%rip),%rbp
mov    0x0(%rbp),%ebx
mov    0x2b2f(%rip),%rax
mov    (%rax),%edi
lea    0xec2(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %ebx,0x0(%rbp)
lea    0xecb(%rip),%rdi
jmp    13f4 <main+0x214>
mov    0x2b09(%rip),%rcx
mov    (%rcx),%edi
lea    0xf54(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %ebx,0x0(%rbp)
lea    0xf57(%rip),%rdi
jmp    13f4 <main+0x214>

LLVM IR (-O0):
%struct.sockaddr = type opaque
%struct.addrinfo = type { i32, i64, i32, i32, i32 }
@errno = global i32 0
@stderr = global i32 0
@.str = [18 x i8] c"malloc hates me.\0A\00"
@.str.1 = [158 x i8] c"File: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/master/sayhello.c\0ALine: 46\00"
@ENAMETOOLONG = global i32 0
@.str.2 = [19 x i8] c"gethostname fail.\0A\00"
@.str.3 = [158 x i8] c"File: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/master/sayhello.c\0ALine: 50\00"
@.str.4 = [158 x i8] c"File: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/master/sayhello.c\0ALine: 56\00"
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@AI_NUMERICSERV = global i32 0
@.str.5 = [7 x i8] c"tigger\00"
@.str.6 = [5 x i8] c"8087\00"
@.str.7 = [29 x i8] c"Looking up 'tigger' failed.\0A\00"
@.str.8 = [158 x i8] c"File: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/master/sayhello.c\0ALine: 70\00"
@.str.9 = [158 x i8] c"File: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/master/sayhello.c\0ALine: 75\00"
@AF_INET = global i32 0
@.str.10 = [26 x i8] c"Can't get a udp4 socket.\0A\00"
@.str.11 = [158 x i8] c"File: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/master/sayhello.c\0ALine: 82\00"
@EINTR = global i32 0
@.str.12 = [22 x i8] c"sendto returned %zd.\0A\00"
@.str.13 = [158 x i8] c"File: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/master/sayhello.c\0ALine: 88\00"
@.str.14 = [11 x i8] c"nightmare\0A\00"
@.str.15 = [158 x i8] c"File: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/master/sayhello.c\0ALine: 91\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca %struct.sockaddr*
%13 = alloca %struct.addrinfo
%14 = alloca %struct.addrinfo*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = call i8* @malloc(i64 %23)
store i8* %24, i8** %7
%25 = load i8*, i8** %7
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %36
27: ; preds = %2
br label %28
28: ; preds = %27
%29 = load i32, i32* @errno
store i32 %29, i32* %8
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%32 = load i32, i32* %8
store i32 %32, i32* @errno
%33 = call i32 @perror(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.1, i64 0, i64 0))
%34 = call i32 (...) @abort()
unreachable
35: ; No predecessors!
br label %36
36: ; preds = %35, %2
br label %37
37: ; preds = %74, %36
%38 = load i8*, i8** %7
%39 = load i32, i32* %6
%40 = call i64 @gethostname(i8* %38, i32 %39)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %75
42: ; preds = %37
%43 = load i32, i32* @errno
%44 = load i32, i32* @ENAMETOOLONG
%45 = icmp ne i32 %43, %44
br i1 %45, label %46, label %55
46: ; preds = %42
br label %47
47: ; preds = %46
%48 = load i32, i32* @errno
store i32 %48, i32* %9
%49 = load i32, i32* @stderr
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%51 = load i32, i32* %9
store i32 %51, i32* @errno
%52 = call i32 @perror(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.3, i64 0, i64 0))
%53 = call i32 (...) @abort()
unreachable
54: ; No predecessors!
br label %55
55: ; preds = %54, %42
%56 = load i32, i32* %6
%57 = shl i32 %56, 1
store i32 %57, i32* %6
%58 = load i8*, i8** %7
%59 = call i32 @free(i8* %58)
%60 = load i32, i32* %6
%61 = sext i32 %60 to i64
%62 = call i8* @malloc(i64 %61)
store i8* %62, i8** %7
%63 = load i8*, i8** %7
%64 = icmp eq i8* %63, null
br i1 %64, label %65, label %74
65: ; preds = %55
br label %66
66: ; preds = %65
%67 = load i32, i32* @errno
store i32 %67, i32* %10
%68 = load i32, i32* @stderr
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%70 = load i32, i32* %10
store i32 %70, i32* @errno
%71 = call i32 @perror(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.4, i64 0, i64 0))
%72 = call i32 (...) @abort()
unreachable
73: ; No predecessors!
br label %74
74: ; preds = %73, %55
br label %37
75: ; preds = %37
%76 = load i8*, i8** %7
%77 = call i32 @strlen(i8* %76)
%78 = add nsw i32 %77, 1
store i32 %78, i32* %6
%79 = call i32 @memset(%struct.addrinfo* %13, i32 0, i32 32)
%80 = load i32, i32* @PF_INET
%81 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %13, i32 0, i32 4
store i32 %80, i32* %81
%82 = load i32, i32* @SOCK_DGRAM
%83 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %13, i32 0, i32 3
store i32 %82, i32* %83
%84 = load i32, i32* @AI_NUMERICSERV
%85 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %13, i32 0, i32 2
store i32 %84, i32* %85
%86 = call i64 @getaddrinfo(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), %struct.addrinfo* %13, %struct.addrinfo** %14)
%87 = icmp ne i64 %86, 0
br i1 %87, label %88, label %97
88: ; preds = %75
br label %89
89: ; preds = %88
%90 = load i32, i32* @errno
store i32 %90, i32* %15
%91 = load i32, i32* @stderr
%92 = call i32 (i32, i8*, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%93 = load i32, i32* %15
store i32 %93, i32* @errno
%94 = call i32 @perror(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.8, i64 0, i64 0))
%95 = call i32 (...) @abort()
unreachable
96: ; No predecessors!
br label %97
97: ; preds = %96, %75
%98 = load %struct.addrinfo*, %struct.addrinfo** %14
%99 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %98, i32 0, i32 1
%100 = load i64, i64* %99
store i64 %100, i64* %11
%101 = load i64, i64* %11
%102 = call i8* @malloc(i64 %101)
%103 = bitcast i8* %102 to %struct.sockaddr*
store %struct.sockaddr* %103, %struct.sockaddr** %12
%104 = load %struct.sockaddr*, %struct.sockaddr** %12
%105 = icmp eq %struct.sockaddr* %104, null
br i1 %105, label %106, label %115
106: ; preds = %97
br label %107
107: ; preds = %106
%108 = load i32, i32* @errno
store i32 %108, i32* %16
%109 = load i32, i32* @stderr
%110 = call i32 (i32, i8*, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%111 = load i32, i32* %16
store i32 %111, i32* @errno
%112 = call i32 @perror(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.9, i64 0, i64 0))
%113 = call i32 (...) @abort()
unreachable
114: ; No predecessors!
br label %115
115: ; preds = %114, %97
%116 = load %struct.sockaddr*, %struct.sockaddr** %12
%117 = bitcast %struct.sockaddr* %116 to i8*
%118 = load %struct.addrinfo*, %struct.addrinfo** %14
%119 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %118, i32 0, i32 0
%120 = load i32, i32* %119
%121 = load i64, i64* %11
%122 = call i32 @memcpy(i8* %117, i32 %120, i64 %121)
%123 = load %struct.addrinfo*, %struct.addrinfo** %14
%124 = call i32 @freeaddrinfo(%struct.addrinfo* %123)
%125 = load i32, i32* @AF_INET
%126 = load i32, i32* @SOCK_DGRAM
%127 = call i32 @socket(i32 %125, i32 %126, i32 0)
store i32 %127, i32* %17
%128 = load i32, i32* %17
%129 = icmp eq i32 %128, -1
br i1 %129, label %130, label %139
130: ; preds = %115
br label %131
131: ; preds = %130
%132 = load i32, i32* @errno
store i32 %132, i32* %18
%133 = load i32, i32* @stderr
%134 = call i32 (i32, i8*, ...) @fprintf(i32 %133, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0))
%135 = load i32, i32* %18
store i32 %135, i32* @errno
%136 = call i32 @perror(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.11, i64 0, i64 0))
%137 = call i32 (...) @abort()
unreachable
138: ; No predecessors!
br label %139
139: ; preds = %138, %115
br label %140
140: ; preds = %187, %139
%141 = load i32, i32* %17
%142 = load i8*, i8** %7
%143 = load i32, i32* %6
%144 = load %struct.sockaddr*, %struct.sockaddr** %12
%145 = bitcast %struct.sockaddr* %144 to i8*
%146 = load i64, i64* %11
%147 = call i32 @sendto(i32 %141, i8* %142, i32 %143, i32 0, i8* %145, i64 %146)
store i32 %147, i32* %19
%148 = load i32, i32* %19
%149 = load i32, i32* %6
%150 = icmp ne i32 %148, %149
br i1 %150, label %151, label %168
151: ; preds = %140
br label %152
152: ; preds = %151
%153 = load i32, i32* @errno
%154 = load i32, i32* @EINTR
%155 = icmp eq i32 %153, %154
br i1 %155, label %156, label %157
156: ; preds = %152
br label %188
157: ; preds = %152
br label %158
158: ; preds = %157
%159 = load i32, i32* @errno
store i32 %159, i32* %20
%160 = load i32, i32* @stderr
%161 = load i32, i32* %19
%162 = call i32 (i32, i8*, ...) @fprintf(i32 %160, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i32 %161)
%163 = load i32, i32* %20
store i32 %163, i32* @errno
%164 = call i32 @perror(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.13, i64 0, i64 0))
%165 = call i32 (...) @abort()
unreachable
166: ; No predecessors!
br label %167
167: ; preds = %166
br label %168
168: ; preds = %167, %140
%169 = call i64 @sleep(i32 5)
%170 = icmp ne i64 %169, 0
br i1 %170, label %171, label %187
171: ; preds = %168
br label %172
172: ; preds = %171
%173 = load i32, i32* @errno
%174 = load i32, i32* @EINTR
%175 = icmp eq i32 %173, %174
br i1 %175, label %176, label %177
176: ; preds = %172
br label %188
177: ; preds = %172
br label %178
178: ; preds = %177
%179 = load i32, i32* @errno
store i32 %179, i32* %21
%180 = load i32, i32* @stderr
%181 = call i32 (i32, i8*, ...) @fprintf(i32 %180, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0))
%182 = load i32, i32* %21
store i32 %182, i32* @errno
%183 = call i32 @perror(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.15, i64 0, i64 0))
%184 = call i32 (...) @abort()
unreachable
185: ; No predecessors!
br label %186
186: ; preds = %185
br label %187
187: ; preds = %186, %168
br label %140
188: ; preds = %176, %156
%189 = load %struct.sockaddr*, %struct.sockaddr** %12
%190 = bitcast %struct.sockaddr* %189 to i8*
%191 = call i32 @free(i8* %190)
ret i32 0
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i64, i32, i32, i32 }
@errno = global i32 0
@stderr = global i32 0
@.str = [18 x i8] c"malloc hates me.\0A\00"
@.str.1 = [158 x i8] c"File: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/master/sayhello.c\0ALine: 46\00"
@ENAMETOOLONG = global i32 0
@.str.2 = [19 x i8] c"gethostname fail.\0A\00"
@.str.3 = [158 x i8] c"File: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/master/sayhello.c\0ALine: 50\00"
@.str.4 = [158 x i8] c"File: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/master/sayhello.c\0ALine: 56\00"
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@AI_NUMERICSERV = global i32 0
@.str.5 = [7 x i8] c"tigger\00"
@.str.6 = [5 x i8] c"8087\00"
@.str.7 = [29 x i8] c"Looking up 'tigger' failed.\0A\00"
@.str.8 = [158 x i8] c"File: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/master/sayhello.c\0ALine: 70\00"
@.str.9 = [158 x i8] c"File: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/master/sayhello.c\0ALine: 75\00"
@AF_INET = global i32 0
@.str.10 = [26 x i8] c"Can't get a udp4 socket.\0A\00"
@.str.11 = [158 x i8] c"File: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/master/sayhello.c\0ALine: 82\00"
@EINTR = global i32 0
@.str.12 = [22 x i8] c"sendto returned %zd.\0A\00"
@.str.13 = [158 x i8] c"File: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/master/sayhello.c\0ALine: 88\00"
@.str.14 = [11 x i8] c"nightmare\0A\00"
@.str.15 = [158 x i8] c"File: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RichardBarrell/snippets/refs/heads/master/sayhello.c\0ALine: 91\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = tail call dereferenceable_or_null(1) i8* @malloc(i64 1)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* @errno
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 %8, i32* @errno
%11 = tail call i32 @perror(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 (...) @abort()
unreachable
13: ; preds = %2, %27
%14 = phi i8* [ %31, %27 ], [ %5, %2 ]
%15 = phi i32 [ %28, %27 ], [ 1, %2 ]
%16 = tail call i64 @gethostname(i8* %14, i32 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %38, label %18
18: ; preds = %13
%19 = load i32, i32* @errno
%20 = load i32, i32* @ENAMETOOLONG
%21 = icmp eq i32 %19, %20
br i1 %21, label %27, label %22
22: ; preds = %18
%23 = load i32, i32* @stderr
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 %19, i32* @errno
%25 = tail call i32 @perror(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.3, i64 0, i64 0))
%26 = tail call i32 (...) @abort()
unreachable
27: ; preds = %18
%28 = shl i32 %15, 1
%29 = tail call i32 @free(i8* %14)
%30 = sext i32 %28 to i64
%31 = tail call i8* @malloc(i64 %30)
%32 = icmp eq i8* %31, null
br i1 %32, label %33, label %13
33: ; preds = %27
%34 = load i32, i32* @stderr
%35 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 %19, i32* @errno
%36 = tail call i32 @perror(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.4, i64 0, i64 0))
%37 = tail call i32 (...) @abort()
unreachable
38: ; preds = %13
%39 = tail call i32 @strlen(i8* %14)
%40 = add nsw i32 %39, 1
%41 = bitcast %struct.addrinfo* %3 to i8*
%42 = bitcast %struct.addrinfo** %4 to i8*
%43 = call i32 @memset(%struct.addrinfo* %3, i32 0, i32 32)
%44 = load i32, i32* @PF_INET
%45 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i32 %44, i32* %45
%46 = load i32, i32* @SOCK_DGRAM
%47 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 3
store i32 %46, i32* %47
%48 = load i32, i32* @AI_NUMERICSERV
%49 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 2
store i32 %48, i32* %49
%50 = call i64 @getaddrinfo(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), %struct.addrinfo* %3, %struct.addrinfo** %4)
%51 = icmp eq i64 %50, 0
br i1 %51, label %58, label %52
52: ; preds = %38
%53 = load i32, i32* @errno
%54 = load i32, i32* @stderr
%55 = call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
store i32 %53, i32* @errno
%56 = call i32 @perror(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.8, i64 0, i64 0))
%57 = call i32 (...) @abort()
unreachable
58: ; preds = %38
%59 = load %struct.addrinfo*, %struct.addrinfo** %4
%60 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %59, i64 0, i32 1
%61 = load i64, i64* %60
%62 = call i8* @malloc(i64 %61)
%63 = icmp eq i8* %62, null
br i1 %63, label %64, label %70
64: ; preds = %58
%65 = load i32, i32* @errno
%66 = load i32, i32* @stderr
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 %65, i32* @errno
%68 = call i32 @perror(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.9, i64 0, i64 0))
%69 = call i32 (...) @abort()
unreachable
70: ; preds = %58
%71 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %59, i64 0, i32 0
%72 = load i32, i32* %71
%73 = call i32 @memcpy(i8* %62, i32 %72, i64 %61)
%74 = load %struct.addrinfo*, %struct.addrinfo** %4
%75 = call i32 @freeaddrinfo(%struct.addrinfo* %74)
%76 = load i32, i32* @AF_INET
%77 = load i32, i32* @SOCK_DGRAM
%78 = call i32 @socket(i32 %76, i32 %77, i32 0)
%79 = icmp eq i32 %78, -1
br i1 %79, label %80, label %86
80: ; preds = %70
%81 = load i32, i32* @errno
%82 = load i32, i32* @stderr
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0))
store i32 %81, i32* @errno
%84 = call i32 @perror(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.11, i64 0, i64 0))
%85 = call i32 (...) @abort()
unreachable
86: ; preds = %70, %98
%87 = call i32 @sendto(i32 %78, i8* %14, i32 %40, i32 0, i8* %62, i64 %61)
%88 = icmp eq i32 %87, %40
br i1 %88, label %98, label %89
89: ; preds = %86
%90 = load i32, i32* @errno
%91 = load i32, i32* @EINTR
%92 = icmp eq i32 %90, %91
br i1 %92, label %110, label %93
93: ; preds = %89
%94 = load i32, i32* @stderr
%95 = call i32 (i32, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i32 %87)
store i32 %90, i32* @errno
%96 = call i32 @perror(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.13, i64 0, i64 0))
%97 = call i32 (...) @abort()
unreachable
98: ; preds = %86
%99 = call i64 @sleep(i32 5)
%100 = icmp eq i64 %99, 0
br i1 %100, label %86, label %101
101: ; preds = %98
%102 = load i32, i32* @errno
%103 = load i32, i32* @EINTR
%104 = icmp eq i32 %102, %103
br i1 %104, label %110, label %105
105: ; preds = %101
%106 = load i32, i32* @stderr
%107 = call i32 (i32, i8*, ...) @fprintf(i32 %106, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0))
store i32 %102, i32* @errno
%108 = call i32 @perror(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.15, i64 0, i64 0))
%109 = call i32 (...) @abort()
unreachable
110: ; preds = %101, %89
%111 = call i32 @free(i8* %62)
ret i32 0
}