#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 timespec {
  int tv_nsec;
  int tv_sec;
};
struct addrinfo {
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ ai_addr;
  scalar_t__ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
  int /*<<< orphan*/ ai_flags;
};
typedef int /*<<< orphan*/ readbuf;
typedef int /*<<< orphan*/ int8_t;
typedef int int16_t;
typedef int /*<<< orphan*/ hints;

/* Variables and functions */
int /*<<< orphan*/ AF_UNSPEC;
int /*<<< orphan*/ AI_ADDRCONFIG;
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ TIMER_ABSTIME;
int /*<<< orphan*/ alaw_encode(int);
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ clock_nanosleep(int /*<<< orphan*/, int /*<<< orphan*/,
                                   struct timespec *, int /*<<< orphan*/ *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ getaddrinfo(char *, char *, struct addrinfo *,
                               struct addrinfo **);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ puts(int /*<<< orphan*/);
int read(int, int *, int);
int sendto(int, int /*<<< orphan*/ *, int, int /*<<< orphan*/,
           int /*<<< orphan*/, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, scalar_t__);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int main(int argc, char **argv) {
  struct addrinfo hints;
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_DGRAM;
  hints.ai_protocol = 0;
  hints.ai_flags = AI_ADDRCONFIG;
  struct addrinfo *res = 0;
  getaddrinfo("127.0.0.1", "4001", &hints, &res);
  int fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
  if (fd == -1) {
    puts(strerror(errno));
    return -1;
  }
  int readfd = open(argv[1], O_RDONLY);
  if (!readfd) {
    perror("could not open file");
  }
  struct timespec t_next_send;
  clock_gettime(CLOCK_MONOTONIC, &t_next_send);
  int frame_inteval_us = 1000000 / 8000;
  int frames_per_packet = 64;
  int packet_interval_us = frames_per_packet * frame_inteval_us;
  int16_t readbuf[64];
  int8_t sendbuf[64];
  while (1) {
    int bytes_read = read(readfd, readbuf, sizeof(readbuf));
    if (bytes_read <= 0) {
      break;
    }
    int i;
    for (i = 0; i < 64; i++) {
      sendbuf[i] = alaw_encode(readbuf[i] / 8);
    }
    if (sendto(fd, sendbuf, bytes_read / 2, 0, res->ai_addr, res->ai_addrlen) ==
        -1) {
      puts(strerror(errno));
      break;
    }
    t_next_send.tv_nsec += 1000 * packet_interval_us;
    while (t_next_send.tv_nsec > 1000000000UL) {
      t_next_send.tv_nsec -= 1000000000UL;
      t_next_send.tv_sec += 1;
    }
    clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &t_next_send, NULL);
  }
  close(readfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x270,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
mov    0x2dd8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2dbc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    0x2d88(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
movq   $0x0,-0x38(%rbp)
lea    0xdcc(%rip),%rdi
lea    0xdcf(%rip),%rsi
lea    -0x30(%rbp),%rdx
lea    -0x38(%rbp),%rcx
call   10d0 <getaddrinfo@plt>
mov    -0x38(%rbp),%rax
mov    0x14(%rax),%edi
mov    -0x38(%rbp),%rax
mov    0x10(%rax),%esi
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%rdx
call   10f0 <socket@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0xffffffff,-0x3c(%rbp)
jne    1291 <main+0xc1>
mov    0x2d41(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %eax,%edi
call   1030 <puts@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    142c <main+0x25c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2d48(%rip),%rax
mov    (%rax),%esi
call   10a0 <open@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jne    12c0 <main+0xf0>
lea    0xd54(%rip),%rdi
call   10b0 <perror@plt>
mov    0x2d09(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
call   1040 <clock_gettime@plt>
movl   $0x7d,-0x4c(%rbp)
movl   $0x40,-0x50(%rbp)
mov    -0x50(%rbp),%eax
imul   -0x4c(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x40(%rbp),%edi
lea    -0x160(%rbp),%rsi
mov    $0x100,%edx
call   1080 <read@plt>
mov    %eax,-0x264(%rbp)
cmpl   $0x0,-0x264(%rbp)
jg     1316 <main+0x146>
jmp    141d <main+0x24d>
movl   $0x0,-0x268(%rbp)
cmpl   $0x40,-0x268(%rbp)
jge    136e <main+0x19e>
movslq -0x268(%rbp),%rax
mov    -0x160(%rbp,%rax,4),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1090 <alaw_encode@plt>
mov    %eax,%ecx
movslq -0x268(%rbp),%rax
mov    %ecx,-0x260(%rbp,%rax,4)
mov    -0x268(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x268(%rbp)
jmp    1320 <main+0x150>
mov    -0x3c(%rbp),%edi
lea    -0x260(%rbp),%rsi
mov    -0x264(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%r8d
mov    -0x38(%rbp),%rax
mov    (%rax),%r9d
xor    %ecx,%ecx
call   1060 <sendto@plt>
cmp    $0xffffffff,%eax
jne    13c1 <main+0x1f1>
mov    0x2c0a(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %eax,%edi
call   1030 <puts@plt>
jmp    141d <main+0x24d>
imul   $0x3e8,-0x54(%rbp),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x48(%rbp)
movslq -0x48(%rbp),%rax
cmp    $0x3b9aca00,%rax
jbe    13f9 <main+0x229>
movslq -0x48(%rbp),%rax
sub    $0x3b9aca00,%rax
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    13ce <main+0x1fe>
mov    0x2bd0(%rip),%rax
mov    (%rax),%edi
mov    0x2bd7(%rip),%rax
mov    (%rax),%esi
lea    -0x48(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   10c0 <clock_nanosleep@plt>
jmp    12ea <main+0x11a>
mov    -0x40(%rbp),%edi
call   1070 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x238,%rsp
mov    %rsi,%rbx
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
mov    0x2dd9(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x24(%rsp)
mov    0x2dbc(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
movq   $0x0,0x18(%rsp)
mov    0x2d86(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
movq   $0x0,0x8(%rsp)
lea    0xdc8(%rip),%rdi
lea    0xdcb(%rip),%rsi
lea    0x8(%rsp),%rcx
mov    %rbp,%rdx
call   10d0 <getaddrinfo@plt>
mov    0x8(%rsp),%rax
mov    0x14(%rax),%edi
mov    0x10(%rax),%esi
mov    0x8(%rax),%rdx
call   10f0 <socket@plt>
cmp    $0xffffffff,%eax
je     13ac <main+0x1dc>
mov    %eax,%r13d
mov    0x8(%rbx),%rdi
mov    0x2d71(%rip),%rax
mov    (%rax),%esi
call   10a0 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
je     13f8 <main+0x228>
mov    0x2d41(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1040 <clock_gettime@plt>
lea    0x30(%rsp),%rsi
mov    %ebx,%edi
mov    $0x100,%edx
call   1080 <read@plt>
test   %eax,%eax
jle    13dd <main+0x20d>
mov    %eax,%ebp
lea    0x130(%rsp),%r14
lea    0x30(%rsp),%r12
jmp    1305 <main+0x135>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x2cf9(%rip),%rax
mov    (%rax),%edi
mov    0x2d00(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
xor    %ecx,%ecx
call   10c0 <clock_nanosleep@plt>
mov    %ebx,%edi
mov    %r12,%rsi
mov    $0x100,%edx
call   1080 <read@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    13dd <main+0x20d>
xor    %r15d,%r15d
nopl   0x0(%rax,%rax,1)
mov    0x30(%rsp,%r15,4),%eax
lea    0x7(%rax),%edi
test   %eax,%eax
cmovns %eax,%edi
sar    $0x3,%edi
call   1090 <alaw_encode@plt>
mov    %eax,0x130(%rsp,%r15,4)
add    $0x1,%r15
cmp    $0x40,%r15
jne    1310 <main+0x140>
mov    %ebp,%edx
shr    $0x1f,%edx
add    %ebp,%edx
sar    %edx
mov    0x8(%rsp),%rax
mov    (%rax),%r9d
mov    0x4(%rax),%r8d
mov    %r13d,%edi
mov    %r14,%rsi
xor    %ecx,%ecx
call   1060 <sendto@plt>
cmp    $0xffffffff,%eax
je     13c8 <main+0x1f8>
mov    (%rsp),%eax
lea    0x7a1200(%rax),%ecx
mov    %ecx,(%rsp)
cmp    $0x3b9aca01,%ecx
jb     12d0 <main+0x100>
mov    0x4(%rsp),%ecx
lea    -0x3b20b801(%rax),%edx
shr    $0x9,%edx
imul   $0x44b83,%rdx,%rdx
shr    $0x27,%rdx
imul   $0xc4653600,%edx,%esi
add    %esi,%eax
add    $0xc4df4800,%eax
add    %edx,%ecx
add    $0x1,%ecx
mov    %eax,(%rsp)
mov    %ecx,0x4(%rsp)
jmp    12d0 <main+0x100>
mov    0x2c05(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %eax,%edi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
jmp    13e6 <main+0x216>
mov    0x2be9(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %eax,%edi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1070 <close@plt>
xor    %eax,%eax
add    $0x238,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc10(%rip),%rdi
call   10b0 <perror@plt>
jmp    1288 <main+0xb8>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32, i64, i32, i32, i32 }
%struct.timespec = type { i32, i32 }
@AF_UNSPEC = global i32 0
@SOCK_DGRAM = global i32 0
@AI_ADDRCONFIG = global i32 0
@.str = [10 x i8] c"127.0.0.1\00"
@.str.1 = [5 x i8] c"4001\00"
@errno = global i32 0
@O_RDONLY = global i32 0
@.str.2 = [20 x i8] c"could not open file\00"
@CLOCK_MONOTONIC = global i32 0
@TIMER_ABSTIME = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.addrinfo
%7 = alloca %struct.addrinfo*
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.timespec
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca [64 x i32]
%15 = alloca [64 x i32]
%16 = alloca i32
%17 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%18 = call i32 @memset(%struct.addrinfo* %6, i32 0, i32 32)
%19 = load i32, i32* @AF_UNSPEC
%20 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 4
store i32 %19, i32* %20
%21 = load i32, i32* @SOCK_DGRAM
%22 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 3
store i32 %21, i32* %22
%23 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 2
store i64 0, i64* %23
%24 = load i32, i32* @AI_ADDRCONFIG
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 5
store i32 %24, i32* %25
store %struct.addrinfo* null, %struct.addrinfo** %7
%26 = call i32 @getaddrinfo(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %struct.addrinfo* %6, %struct.addrinfo** %7)
%27 = load %struct.addrinfo*, %struct.addrinfo** %7
%28 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %27, i32 0, i32 4
%29 = load i32, i32* %28
%30 = load %struct.addrinfo*, %struct.addrinfo** %7
%31 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %30, i32 0, i32 3
%32 = load i32, i32* %31
%33 = load %struct.addrinfo*, %struct.addrinfo** %7
%34 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %33, i32 0, i32 2
%35 = load i64, i64* %34
%36 = call i32 @socket(i32 %29, i32 %32, i64 %35)
store i32 %36, i32* %8
%37 = load i32, i32* %8
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %43
39: ; preds = %2
%40 = load i32, i32* @errno
%41 = call i32 @strerror(i32 %40)
%42 = call i32 @puts(i32 %41)
store i32 -1, i32* %3
br label %127
43: ; preds = %2
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
%47 = load i32, i32* @O_RDONLY
%48 = call i32 @open(i8* %46, i32 %47)
store i32 %48, i32* %9
%49 = load i32, i32* %9
%50 = icmp ne i32 %49, 0
br i1 %50, label %53, label %51
51: ; preds = %43
%52 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %53
53: ; preds = %51, %43
%54 = load i32, i32* @CLOCK_MONOTONIC
%55 = call i32 @clock_gettime(i32 %54, %struct.timespec* %10)
store i32 125, i32* %11
store i32 64, i32* %12
%56 = load i32, i32* %12
%57 = load i32, i32* %11
%58 = mul nsw i32 %56, %57
store i32 %58, i32* %13
br label %59
59: ; preds = %53, %120
%60 = load i32, i32* %9
%61 = getelementptr inbounds [64 x i32], [64 x i32]* %14, i64 0, i64 0
%62 = call i32 @read(i32 %60, i32* %61, i32 256)
store i32 %62, i32* %16
%63 = load i32, i32* %16
%64 = icmp sle i32 %63, 0
br i1 %64, label %65, label %66
65: ; preds = %59
br label %124
66: ; preds = %59
store i32 0, i32* %17
br label %67
67: ; preds = %80, %66
%68 = load i32, i32* %17
%69 = icmp slt i32 %68, 64
br i1 %69, label %70, label %83
70: ; preds = %67
%71 = load i32, i32* %17
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [64 x i32], [64 x i32]* %14, i64 0, i64 %72
%74 = load i32, i32* %73
%75 = sdiv i32 %74, 8
%76 = call i32 @alaw_encode(i32 %75)
%77 = load i32, i32* %17
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [64 x i32], [64 x i32]* %15, i64 0, i64 %78
store i32 %76, i32* %79
br label %80
80: ; preds = %70
%81 = load i32, i32* %17
%82 = add nsw i32 %81, 1
store i32 %82, i32* %17
br label %67
83: ; preds = %67
%84 = load i32, i32* %8
%85 = getelementptr inbounds [64 x i32], [64 x i32]* %15, i64 0, i64 0
%86 = load i32, i32* %16
%87 = sdiv i32 %86, 2
%88 = load %struct.addrinfo*, %struct.addrinfo** %7
%89 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %88, i32 0, i32 1
%90 = load i32, i32* %89
%91 = load %struct.addrinfo*, %struct.addrinfo** %7
%92 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %91, i32 0, i32 0
%93 = load i32, i32* %92
%94 = call i32 @sendto(i32 %84, i32* %85, i32 %87, i32 0, i32 %90, i32 %93)
%95 = icmp eq i32 %94, -1
br i1 %95, label %96, label %100
96: ; preds = %83
%97 = load i32, i32* @errno
%98 = call i32 @strerror(i32 %97)
%99 = call i32 @puts(i32 %98)
br label %124
100: ; preds = %83
%101 = load i32, i32* %13
%102 = mul nsw i32 1000, %101
%103 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 0
%104 = load i32, i32* %103
%105 = add nsw i32 %104, %102
store i32 %105, i32* %103
br label %106
106: ; preds = %111, %100
%107 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 0
%108 = load i32, i32* %107
%109 = sext i32 %108 to i64
%110 = icmp ugt i64 %109, 1000000000
br i1 %110, label %111, label %120
111: ; preds = %106
%112 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 0
%113 = load i32, i32* %112
%114 = sext i32 %113 to i64
%115 = sub i64 %114, 1000000000
%116 = trunc i64 %115 to i32
store i32 %116, i32* %112
%117 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 1
%118 = load i32, i32* %117
%119 = add nsw i32 %118, 1
store i32 %119, i32* %117
br label %106
120: ; preds = %106
%121 = load i32, i32* @CLOCK_MONOTONIC
%122 = load i32, i32* @TIMER_ABSTIME
%123 = call i32 @clock_nanosleep(i32 %121, i32 %122, %struct.timespec* %10, i32* null)
br label %59
124: ; preds = %96, %65
%125 = load i32, i32* %9
%126 = call i32 @close(i32 %125)
store i32 0, i32* %3
br label %127
127: ; preds = %124, %39
%128 = load i32, i32* %3
ret i32 %128
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, i64, i32, i32, i32 }
%struct.timespec = type { i32, i32 }
@AF_UNSPEC = global i32 0
@SOCK_DGRAM = global i32 0
@AI_ADDRCONFIG = global i32 0
@.str = [10 x i8] c"127.0.0.1\00"
@.str.1 = [5 x i8] c"4001\00"
@errno = global i32 0
@O_RDONLY = global i32 0
@.str.2 = [20 x i8] c"could not open file\00"
@CLOCK_MONOTONIC = global i32 0
@TIMER_ABSTIME = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = alloca %struct.timespec
%6 = alloca [64 x i32]
%7 = alloca [64 x i32]
%8 = bitcast %struct.addrinfo* %3 to i8*
%9 = call i32 @memset(%struct.addrinfo* %3, i32 0, i32 32)
%10 = load i32, i32* @AF_UNSPEC
%11 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i32 %10, i32* %11
%12 = load i32, i32* @SOCK_DGRAM
%13 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 3
store i32 %12, i32* %13
%14 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 2
store i64 0, i64* %14
%15 = load i32, i32* @AI_ADDRCONFIG
%16 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 5
store i32 %15, i32* %16
%17 = bitcast %struct.addrinfo** %4 to i8*
store %struct.addrinfo* null, %struct.addrinfo** %4
%18 = call i32 @getaddrinfo(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %struct.addrinfo* %3, %struct.addrinfo** %4)
%19 = load %struct.addrinfo*, %struct.addrinfo** %4
%20 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %19, i64 0, i32 4
%21 = load i32, i32* %20
%22 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %19, i64 0, i32 3
%23 = load i32, i32* %22
%24 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %19, i64 0, i32 2
%25 = load i64, i64* %24
%26 = call i32 @socket(i32 %21, i32 %23, i64 %25)
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %32
28: ; preds = %2
%29 = load i32, i32* @errno
%30 = call i32 @strerror(i32 %29)
%31 = call i32 @puts(i32 %30)
br label %98
32: ; preds = %2
%33 = getelementptr inbounds i8*, i8** %1, i64 1
%34 = load i8*, i8** %33
%35 = load i32, i32* @O_RDONLY
%36 = call i32 @open(i8* %34, i32 %35)
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %32
%39 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %40
40: ; preds = %38, %32
%41 = bitcast %struct.timespec* %5 to i8*
%42 = load i32, i32* @CLOCK_MONOTONIC
%43 = call i32 @clock_gettime(i32 %42, %struct.timespec* %5)
%44 = bitcast [64 x i32]* %6 to i8*
%45 = bitcast [64 x i32]* %7 to i8*
%46 = getelementptr inbounds [64 x i32], [64 x i32]* %6, i64 0, i64 0
%47 = call i32 @read(i32 %36, i32* %46, i32 256)
%48 = icmp slt i32 %47, 1
br i1 %48, label %96, label %49
49: ; preds = %40
%50 = getelementptr inbounds [64 x i32], [64 x i32]* %7, i64 0, i64 0
%51 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i64 0, i32 0
%52 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i64 0, i32 1
br label %53
53: ; preds = %49, %90
%54 = phi i32 [ %47, %49 ], [ %94, %90 ]
br label %55
55: ; preds = %53, %55
%56 = phi i64 [ 0, %53 ], [ %62, %55 ]
%57 = getelementptr inbounds [64 x i32], [64 x i32]* %6, i64 0, i64 %56
%58 = load i32, i32* %57
%59 = sdiv i32 %58, 8
%60 = call i32 @alaw_encode(i32 %59)
%61 = getelementptr inbounds [64 x i32], [64 x i32]* %7, i64 0, i64 %56
store i32 %60, i32* %61
%62 = add nuw nsw i64 %56, 1
%63 = icmp eq i64 %62, 64
br i1 %63, label %64, label %55
64: ; preds = %55
%65 = sdiv i32 %54, 2
%66 = load %struct.addrinfo*, %struct.addrinfo** %4
%67 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %66, i64 0, i32 1
%68 = load i32, i32* %67
%69 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %66, i64 0, i32 0
%70 = load i32, i32* %69
%71 = call i32 @sendto(i32 %26, i32* %50, i32 %65, i32 0, i32 %68, i32 %70)
%72 = icmp eq i32 %71, -1
br i1 %72, label %73, label %77
73: ; preds = %64
%74 = load i32, i32* @errno
%75 = call i32 @strerror(i32 %74)
%76 = call i32 @puts(i32 %75)
br label %96
77: ; preds = %64
%78 = load i32, i32* %51
%79 = add nsw i32 %78, 8000000
store i32 %79, i32* %51
%80 = icmp ugt i32 %79, 1000000000
br i1 %80, label %81, label %90
81: ; preds = %77
%82 = load i32, i32* %52
%83 = add i32 %78, -992000001
%84 = udiv i32 %83, 1000000000
%85 = mul i32 %84, -1000000000
%86 = add i32 %82, 1
%87 = add i32 %78, -992000000
%88 = add i32 %85, %87
%89 = add i32 %86, %84
store i32 %88, i32* %51
store i32 %89, i32* %52
br label %90
90: ; preds = %81, %77
%91 = load i32, i32* @CLOCK_MONOTONIC
%92 = load i32, i32* @TIMER_ABSTIME
%93 = call i32 @clock_nanosleep(i32 %91, i32 %92, %struct.timespec* %5, i32* null)
%94 = call i32 @read(i32 %36, i32* %46, i32 256)
%95 = icmp slt i32 %94, 1
br i1 %95, label %96, label %53
96: ; preds = %90, %40, %73
%97 = call i32 @close(i32 %36)
br label %98
98: ; preds = %96, %28
%99 = phi i32 [ -1, %28 ], [ 0, %96 ]
ret i32 %99
}