#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_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ servaddr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int BUFSIZ;
int /*<<< orphan*/ SOCK_DGRAM;
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
int recvfrom(int, char *, int, int /*<<< orphan*/, int /*<<< orphan*/ *,
             int /*<<< orphan*/ *);
int /*<<< orphan*/ sendto(int, char *, int /*<<< orphan*/, int /*<<< orphan*/,
                          struct sockaddr *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strlen(char *);
int main(int argc, char **argv) {
  int sockfd, n;
  struct sockaddr_in servaddr, cliaddr;
  char sendline[1000000];
  char recvline[1000000];
  char buf[BUFSIZ];
  if (argc != 2) {
    printf("usage: ex04c <IP address>\n");
    exit(1);
  }
  sockfd = socket(AF_INET, SOCK_DGRAM, 0);
  memset(&servaddr, 0, sizeof(servaddr));
  servaddr.sin_family = AF_INET;
  servaddr.sin_addr.s_addr = inet_addr(argv[1]);
  servaddr.sin_port = htons(32000);
  while (fgets(buf, BUFSIZ, stdin) != NULL) {
    int i, n;
    n = atoi(buf) - 1;
    for (i = 0; i < n; i++) {
      sendline[i] = 'a' + i % 26;
    }
    sendline[i] = '\n';
    i++;
    sendline[i] = 0;
    sendto(sockfd, sendline, strlen(sendline), 0, (struct sockaddr *)&servaddr,
           sizeof(servaddr));
    n = recvfrom(sockfd, recvline, 1000000, 0, NULL, NULL);
    recvline[n] = 0;
    fputs(recvline, stdout);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1e84f0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2de8(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x1e84c8(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1e84e0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x1e84d0(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     122e <main+0x6e>
lea    0xde1(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x2db3(%rip),%rax
mov    (%rax),%edi
mov    0x2d9a(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,-0x14(%rbp)
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
mov    0x2d87(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <inet_addr@plt>
mov    %eax,-0x24(%rbp)
mov    $0x7d00,%edi
call   1040 <htons@plt>
mov    %eax,-0x28(%rbp)
mov    -0x1e84e0(%rbp),%rdi
mov    0x2d37(%rip),%rax
mov    (%rax),%esi
mov    0x2d46(%rip),%rax
mov    (%rax),%edx
call   1090 <fgets@plt>
cmp    $0x0,%rax
je     13ce <main+0x20e>
mov    -0x1e84e0(%rbp),%rdi
call   10c0 <atoi@plt>
sub    $0x1,%eax
mov    %eax,-0x1e84d8(%rbp)
movl   $0x0,-0x1e84d4(%rbp)
mov    -0x1e84d4(%rbp),%eax
cmp    -0x1e84d8(%rbp),%eax
jge    1311 <main+0x151>
mov    -0x1e84d4(%rbp),%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x61,%edx
mov    %dl,%cl
movslq -0x1e84d4(%rbp),%rax
mov    %cl,-0xf4280(%rbp,%rax,1)
mov    -0x1e84d4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e84d4(%rbp)
jmp    12ca <main+0x10a>
movslq -0x1e84d4(%rbp),%rax
movb   $0xa,-0xf4280(%rbp,%rax,1)
0a
mov    -0x1e84d4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e84d4(%rbp)
movslq -0x1e84d4(%rbp),%rax
movb   $0x0,-0xf4280(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1e84ec(%rbp)
lea    -0xf4280(%rbp),%rax
mov    %rax,-0x1e84e8(%rbp)
lea    -0xf4280(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x1e84ec(%rbp),%edi
mov    -0x1e84e8(%rbp),%rsi
mov    %eax,%edx
lea    -0x28(%rbp),%r8
xor    %ecx,%ecx
mov    $0xc,%r9d
call   1080 <sendto@plt>
mov    -0x14(%rbp),%edi
lea    -0x1e84c0(%rbp),%rsi
mov    $0xf4240,%edx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%r8
call   10b0 <recvfrom@plt>
mov    %eax,-0x1e84d8(%rbp)
movslq -0x1e84d8(%rbp),%rax
movb   $0x0,-0x1e84c0(%rbp,%rax,1)
lea    -0x1e84c0(%rbp),%rdi
mov    0x2bfe(%rip),%rax
mov    (%rax),%esi
call   1060 <fputs@plt>
jmp    1283 <main+0xc3>
mov    -0x1e84c8(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1e8498,%rsp
mov    %rsp,-0x40(%rbp)
mov    0x2de9(%rip),%r13
mov    0x0(%r13),%eax
mov    %rsp,%r12
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
cmp    $0x2,%edi
jne    185c <main+0x69c>
mov    %rsi,%r15
mov    0x2de1(%rip),%rbx
mov    (%rbx),%edi
mov    0x2dc8(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,%r14d
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
mov    (%rbx),%eax
mov    %eax,-0x30(%rbp)
mov    0x8(%r15),%rdi
call   10a0 <inet_addr@plt>
mov    %eax,-0x34(%rbp)
mov    $0x7d00,%edi
call   1050 <htons@plt>
mov    %eax,-0x38(%rbp)
mov    0x0(%r13),%esi
mov    0x2d8b(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
call   1090 <fgets@plt>
test   %rax,%rax
je     1847 <main+0x687>
mov    %r13,%rbx
lea    -0xf4280(%rbp),%r15
lea    -0x1e84c0(%rbp),%r13
jmp    1305 <main+0x145>
xchg   %ax,%ax
mov    %eax,%ecx
mov    0x2d3f(%rip),%rbx
mov    %ecx,%eax
movw   $0xa,-0xf4280(%rbp,%rax,1)
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %r14d,%edi
mov    %r15,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
lea    -0x38(%rbp),%r8
mov    $0xc,%r9d
call   1080 <sendto@plt>
mov    %r14d,%edi
mov    %r13,%rsi
mov    $0xf4240,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   10b0 <recvfrom@plt>
cltq
movb   $0x0,-0x1e84c0(%rbp,%rax,1)
mov    0x2ce1(%rip),%rax
mov    (%rax),%esi
mov    %r13,%rdi
call   1060 <fputs@plt>
mov    (%rbx),%esi
mov    0x2cee(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
call   1090 <fgets@plt>
test   %rax,%rax
je     1847 <main+0x687>
mov    %r12,%rdi
call   10c0 <atoi@plt>
mov    $0x0,%ecx
cmp    $0x2,%eax
jl     1289 <main+0xc9>
add    $0xffffffff,%eax
mov    %eax,%r8d
cmp    $0x10,%eax
jae    1330 <main+0x170>
xor    %edx,%edx
jmp    17cb <main+0x60b>
nopl   (%rax)
mov    %r8d,%edx
and    $0xfffffff0,%edx
lea    -0x10(%rdx),%rsi
mov    %rsi,%rbx
shr    $0x4,%rbx
add    $0x1,%rbx
test   %rsi,%rsi
movdqa 0xcef(%rip),%xmm10
movdqa 0xcf6(%rip),%xmm11
movdqa 0xcfd(%rip),%xmm12
movdqa 0xd04(%rip),%xmm13
movdqa 0xd0b(%rip),%xmm14
je     1815 <main+0x655>
mov    %rbx,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %esi,%esi
movdqa 0xca3(%rip),%xmm8
movdqa 0xc8a(%rip),%xmm9
movdqa 0xc72(%rip),%xmm0
movdqa 0xc5a(%rip),%xmm3
cs nopw 0x0(%rax,%rax,1)
movdqa %xmm0,%xmm4
pmuludq %xmm10,%xmm4
pshufd $0xed,%xmm4,%xmm4
pshufd $0xf5,%xmm0,%xmm5
pmuludq %xmm10,%xmm5
pshufd $0xed,%xmm5,%xmm5
punpckldq %xmm5,%xmm4
psrld  $0x3,%xmm4
pshufd $0xf5,%xmm4,%xmm5
pmuludq %xmm11,%xmm4
pshufd $0xe8,%xmm4,%xmm6
pmuludq %xmm11,%xmm5
pshufd $0xe8,%xmm5,%xmm4
punpckldq %xmm4,%xmm6
movdqa %xmm0,%xmm4
psubd  %xmm6,%xmm4
movdqa %xmm3,%xmm5
pmuludq %xmm10,%xmm5
pshufd $0xed,%xmm5,%xmm5
pshufd $0xf5,%xmm3,%xmm6
pmuludq %xmm10,%xmm6
pshufd $0xed,%xmm6,%xmm6
punpckldq %xmm6,%xmm5
psrld  $0x3,%xmm5
pshufd $0xf5,%xmm5,%xmm6
pmuludq %xmm11,%xmm5
pshufd $0xe8,%xmm5,%xmm5
pmuludq %xmm11,%xmm6
pshufd $0xe8,%xmm6,%xmm6
punpckldq %xmm6,%xmm5
movdqa %xmm3,%xmm6
psubd  %xmm5,%xmm6
packuswb %xmm6,%xmm4
movdqa %xmm8,%xmm5
pmuludq %xmm10,%xmm5
pshufd $0xed,%xmm5,%xmm5
pshufd $0xf5,%xmm8,%xmm6
pmuludq %xmm10,%xmm6
pshufd $0xed,%xmm6,%xmm6
punpckldq %xmm6,%xmm5
psrld  $0x3,%xmm5
pshufd $0xf5,%xmm5,%xmm6
pmuludq %xmm11,%xmm5
pshufd $0xe8,%xmm5,%xmm5
pmuludq %xmm11,%xmm6
pshufd $0xe8,%xmm6,%xmm6
punpckldq %xmm6,%xmm5
movdqa %xmm8,%xmm6
psubd  %xmm5,%xmm6
movdqa %xmm9,%xmm5
pmuludq %xmm10,%xmm5
pshufd $0xed,%xmm5,%xmm5
pshufd $0xf5,%xmm9,%xmm7
pmuludq %xmm10,%xmm7
pshufd $0xed,%xmm7,%xmm7
punpckldq %xmm7,%xmm5
psrld  $0x3,%xmm5
pshufd $0xf5,%xmm5,%xmm7
pmuludq %xmm11,%xmm5
pshufd $0xe8,%xmm5,%xmm5
pmuludq %xmm11,%xmm7
pshufd $0xe8,%xmm7,%xmm7
punpckldq %xmm7,%xmm5
movdqa %xmm9,%xmm7
psubd  %xmm5,%xmm7
packuswb %xmm7,%xmm6
packuswb %xmm4,%xmm6
paddb  %xmm12,%xmm6
movdqa %xmm6,-0xf4280(%rbp,%rsi,1)
f0 ff
movdqa %xmm9,%xmm5
paddd  %xmm13,%xmm5
movdqa %xmm8,%xmm4
paddd  %xmm13,%xmm4
movdqa %xmm3,%xmm7
paddd  %xmm13,%xmm7
movdqa %xmm0,%xmm2
paddd  %xmm13,%xmm2
movdqa %xmm2,%xmm6
pmuludq %xmm10,%xmm6
pshufd $0xed,%xmm6,%xmm6
pshufd $0xf5,%xmm2,%xmm1
pmuludq %xmm10,%xmm1
pshufd $0xed,%xmm1,%xmm1
punpckldq %xmm1,%xmm6
psrld  $0x3,%xmm6
pshufd $0xf5,%xmm6,%xmm1
pmuludq %xmm11,%xmm6
pshufd $0xe8,%xmm6,%xmm6
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
punpckldq %xmm1,%xmm6
psubd  %xmm6,%xmm2
movdqa %xmm7,%xmm1
pmuludq %xmm10,%xmm1
pshufd $0xed,%xmm1,%xmm1
pshufd $0xf5,%xmm7,%xmm6
pmuludq %xmm10,%xmm6
pshufd $0xed,%xmm6,%xmm6
punpckldq %xmm6,%xmm1
psrld  $0x3,%xmm1
pshufd $0xf5,%xmm1,%xmm6
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm11,%xmm6
pshufd $0xe8,%xmm6,%xmm6
punpckldq %xmm6,%xmm1
psubd  %xmm1,%xmm7
packuswb %xmm7,%xmm2
movdqa %xmm4,%xmm1
pmuludq %xmm10,%xmm1
pshufd $0xed,%xmm1,%xmm1
pshufd $0xf5,%xmm4,%xmm6
pmuludq %xmm10,%xmm6
pshufd $0xed,%xmm6,%xmm6
punpckldq %xmm6,%xmm1
psrld  $0x3,%xmm1
pshufd $0xf5,%xmm1,%xmm6
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm11,%xmm6
pshufd $0xe8,%xmm6,%xmm6
punpckldq %xmm6,%xmm1
psubd  %xmm1,%xmm4
movdqa %xmm5,%xmm1
pmuludq %xmm10,%xmm1
pshufd $0xed,%xmm1,%xmm1
pshufd $0xf5,%xmm5,%xmm6
pmuludq %xmm10,%xmm6
pshufd $0xed,%xmm6,%xmm6
punpckldq %xmm6,%xmm1
psrld  $0x3,%xmm1
pshufd $0xf5,%xmm1,%xmm6
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm11,%xmm6
pshufd $0xe8,%xmm6,%xmm6
punpckldq %xmm6,%xmm1
psubd  %xmm1,%xmm5
packuswb %xmm5,%xmm4
packuswb %xmm2,%xmm4
paddb  %xmm12,%xmm4
movdqa %xmm4,-0xf4270(%rbp,%rsi,1)
f0 ff
add    $0x20,%rsi
paddd  %xmm14,%xmm8
paddd  %xmm14,%xmm9
paddd  %xmm14,%xmm0
paddd  %xmm14,%xmm3
add    $0xfffffffffffffffe,%rdi
jne    13b0 <main+0x1f0>
test   $0x1,%bl
je     17c2 <main+0x602>
movdqa %xmm0,%xmm1
pmuludq %xmm10,%xmm1
pshufd $0xed,%xmm1,%xmm1
pshufd $0xf5,%xmm0,%xmm2
pmuludq %xmm10,%xmm2
pshufd $0xed,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
psrld  $0x3,%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm11,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
psubd  %xmm1,%xmm0
movdqa %xmm3,%xmm1
pmuludq %xmm10,%xmm1
pshufd $0xed,%xmm1,%xmm1
pshufd $0xf5,%xmm3,%xmm2
pmuludq %xmm10,%xmm2
pshufd $0xed,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
psrld  $0x3,%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm11,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
psubd  %xmm1,%xmm3
packuswb %xmm3,%xmm0
movdqa %xmm8,%xmm1
pmuludq %xmm10,%xmm1
pshufd $0xed,%xmm1,%xmm1
pshufd $0xf5,%xmm8,%xmm2
pmuludq %xmm10,%xmm2
pshufd $0xed,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
psrld  $0x3,%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm11,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
psubd  %xmm1,%xmm8
movdqa %xmm9,%xmm1
pmuludq %xmm10,%xmm1
pshufd $0xed,%xmm1,%xmm1
pshufd $0xf5,%xmm9,%xmm2
pmuludq %xmm10,%xmm2
pshufd $0xed,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
psrld  $0x3,%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm11,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
psubd  %xmm1,%xmm9
packuswb %xmm9,%xmm8
packuswb %xmm0,%xmm8
paddb  %xmm12,%xmm8
movdqa %xmm8,-0xf4280(%rbp,%rsi,1)
bd f0 ff
cmp    %r8,%rdx
je     1280 <main+0xc0>
lea    0x61(%rdx),%esi
mov    %rdx,%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %edx,%ebx
imul   $0x4ec4ec4f,%rbx,%rbx
shr    $0x23,%rbx
lea    (%rbx,%rbx,4),%ecx
lea    (%rcx,%rcx,4),%ecx
add    %ebx,%ecx
mov    %esi,%ebx
sub    %cl,%bl
mov    %bl,-0xf4280(%rbp,%rdi,1)
add    $0x1,%rdi
add    $0x1,%sil
add    $0x1,%edx
cmp    %rdi,%r8
jne    17e0 <main+0x620>
jmp    1280 <main+0xc0>
xor    %esi,%esi
movdqa 0x810(%rip),%xmm8
movdqa 0x7f7(%rip),%xmm9
movdqa 0x7df(%rip),%xmm0
movdqa 0x7c7(%rip),%xmm3
test   $0x1,%bl
jne    1683 <main+0x4c3>
jmp    17c2 <main+0x602>
mov    -0x40(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x82d(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@BUFSIZ = global i32 0
@.str = [27 x i8] c"usage: ex04c <IP address>\0A\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@stdin = global i32 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.sockaddr_in
%9 = alloca %struct.sockaddr_in
%10 = alloca [1000000 x i8]
%11 = alloca [1000000 x i8]
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* @BUFSIZ
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %12
%19 = alloca i8, i64 %17
store i64 %17, i64* %13
%20 = load i32, i32* %4
%21 = icmp ne i32 %20, 2
br i1 %21, label %22, label %25
22: ; preds = %2
%23 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %2
%26 = load i32, i32* @AF_INET
%27 = load i32, i32* @SOCK_DGRAM
%28 = call i32 @socket(i32 %26, i32 %27, i32 0)
store i32 %28, i32* %6
%29 = call i32 @memset(%struct.sockaddr_in* %8, i32 0, i32 12)
%30 = load i32, i32* @AF_INET
%31 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i32 %30, i32* %31
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i32 @inet_addr(i8* %34)
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
%37 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %36, i32 0, i32 0
store i32 %35, i32* %37
%38 = call i32 @htons(i32 32000)
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
store i32 %38, i32* %39
br label %40
40: ; preds = %63, %25
%41 = load i32, i32* @BUFSIZ
%42 = load i32, i32* @stdin
%43 = call i32* @fgets(i8* %19, i32 %41, i32 %42)
%44 = icmp ne i32* %43, null
br i1 %44, label %45, label %87
45: ; preds = %40
%46 = call i32 @atoi(i8* %19)
%47 = sub nsw i32 %46, 1
store i32 %47, i32* %15
store i32 0, i32* %14
br label %48
48: ; preds = %60, %45
%49 = load i32, i32* %14
%50 = load i32, i32* %15
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %63
52: ; preds = %48
%53 = load i32, i32* %14
%54 = srem i32 %53, 26
%55 = add nsw i32 97, %54
%56 = trunc i32 %55 to i8
%57 = load i32, i32* %14
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %10, i64 0, i64 %58
store i8 %56, i8* %59
br label %60
60: ; preds = %52
%61 = load i32, i32* %14
%62 = add nsw i32 %61, 1
store i32 %62, i32* %14
br label %48
63: ; preds = %48
%64 = load i32, i32* %14
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %10, i64 0, i64 %65
store i8 10, i8* %66
%67 = load i32, i32* %14
%68 = add nsw i32 %67, 1
store i32 %68, i32* %14
%69 = load i32, i32* %14
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %10, i64 0, i64 %70
store i8 0, i8* %71
%72 = load i32, i32* %6
%73 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %10, i64 0, i64 0
%74 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %10, i64 0, i64 0
%75 = call i32 @strlen(i8* %74)
%76 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%77 = call i32 @sendto(i32 %72, i8* %73, i32 %75, i32 0, %struct.sockaddr* %76, i32 12)
%78 = load i32, i32* %6
%79 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %11, i64 0, i64 0
%80 = call i32 @recvfrom(i32 %78, i8* %79, i32 1000000, i32 0, i32* null, i32* null)
store i32 %80, i32* %15
%81 = load i32, i32* %15
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %11, i64 0, i64 %82
store i8 0, i8* %83
%84 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %11, i64 0, i64 0
%85 = load i32, i32* @stdout
%86 = call i32 @fputs(i8* %84, i32 %85)
br label %40
87: ; preds = %40
%88 = load i8*, i8** %12
%89 = load i32, i32* %3
ret i32 %89
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@BUFSIZ = global i32 0
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@stdin = global i32 0
@stdout = global i32 0
@str = [26 x i8] c"usage: ex04c <IP address>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [1000000 x i8]
%5 = alloca [1000000 x i8]
%6 = bitcast %struct.sockaddr_in* %3 to i8*
%7 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %5, i64 0, i64 0
%9 = load i32, i32* @BUFSIZ
%10 = zext i32 %9 to i64
%11 = tail call i8* @llvm.stacksave()
%12 = alloca i8, i64 %10
%13 = icmp eq i32 %0, 2
br i1 %13, label %17, label %14
14: ; preds = %2
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = load i32, i32* @AF_INET
%19 = load i32, i32* @SOCK_DGRAM
%20 = tail call i32 @socket(i32 %18, i32 %19, i32 0)
%21 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%22 = load i32, i32* @AF_INET
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %22, i32* %23
%24 = getelementptr inbounds i8*, i8** %1, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @inet_addr(i8* %25)
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %26, i32* %27
%28 = call i32 @htons(i32 32000)
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %28, i32* %29
%30 = load i32, i32* @BUFSIZ
%31 = load i32, i32* @stdin
%32 = call i32* @fgets(i8* %12, i32 %30, i32 %31)
%33 = icmp eq i32* %32, null
br i1 %33, label %113, label %34
34: ; preds = %17
%35 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
br label %36
36: ; preds = %34, %95
%37 = call i32 @atoi(i8* %12)
%38 = add i32 %37, -1
%39 = icmp sgt i32 %37, 1
br i1 %39, label %40, label %95
40: ; preds = %36
%41 = zext i32 %38 to i64
%42 = icmp ult i32 %38, 16
br i1 %42, label %84, label %43
43: ; preds = %40
%44 = and i64 %41, 4294967280
%45 = add nsw i64 %44, -16
%46 = lshr exact i64 %45, 4
%47 = add nuw nsw i64 %46, 1
%48 = and i64 %47, 1
%49 = icmp eq i64 %45, 0
br i1 %49, label %72, label %50
50: ; preds = %43
%51 = and i64 %47, 2305843009213693950
br label %52
52: ; preds = %52, %50
%53 = phi i64 [ 0, %50 ], [ %68, %52 ]
%54 = phi <16 x i32> [ <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>, %50 ], [ %69, %52 ]
%55 = phi i64 [ 0, %50 ], [ %70, %52 ]
%56 = urem <16 x i32> %54, <i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26>
%57 = trunc <16 x i32> %56 to <16 x i8>
%58 = add nuw nsw <16 x i8> %57, <i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97>
%59 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %4, i64 0, i64 %53
%60 = bitcast i8* %59 to <16 x i8>*
store <16 x i8> %58, <16 x i8>* %60
%61 = or i64 %53, 16
%62 = add <16 x i32> %54, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
%63 = urem <16 x i32> %62, <i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26>
%64 = trunc <16 x i32> %63 to <16 x i8>
%65 = add nuw nsw <16 x i8> %64, <i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97>
%66 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %4, i64 0, i64 %61
%67 = bitcast i8* %66 to <16 x i8>*
store <16 x i8> %65, <16 x i8>* %67
%68 = add nuw i64 %53, 32
%69 = add <16 x i32> %54, <i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32>
%70 = add i64 %55, 2
%71 = icmp eq i64 %70, %51
br i1 %71, label %72, label %52
72: ; preds = %52, %43
%73 = phi i64 [ 0, %43 ], [ %68, %52 ]
%74 = phi <16 x i32> [ <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>, %43 ], [ %69, %52 ]
%75 = icmp eq i64 %48, 0
br i1 %75, label %82, label %76
76: ; preds = %72
%77 = urem <16 x i32> %74, <i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26>
%78 = trunc <16 x i32> %77 to <16 x i8>
%79 = add nuw nsw <16 x i8> %78, <i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97>
%80 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %4, i64 0, i64 %73
%81 = bitcast i8* %80 to <16 x i8>*
store <16 x i8> %79, <16 x i8>* %81
br label %82
82: ; preds = %72, %76
%83 = icmp eq i64 %44, %41
br i1 %83, label %95, label %84
84: ; preds = %40, %82
%85 = phi i64 [ 0, %40 ], [ %44, %82 ]
br label %86
86: ; preds = %84, %86
%87 = phi i64 [ %93, %86 ], [ %85, %84 ]
%88 = trunc i64 %87 to i32
%89 = urem i32 %88, 26
%90 = trunc i32 %89 to i8
%91 = add nuw nsw i8 %90, 97
%92 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %4, i64 0, i64 %87
store i8 %91, i8* %92
%93 = add nuw nsw i64 %87, 1
%94 = icmp eq i64 %93, %41
br i1 %94, label %95, label %86
95: ; preds = %86, %82, %36
%96 = phi i32 [ 0, %36 ], [ %38, %82 ], [ %38, %86 ]
%97 = zext i32 %96 to i64
%98 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %4, i64 0, i64 %97
store i8 10, i8* %98
%99 = add nuw nsw i32 %96, 1
%100 = zext i32 %99 to i64
%101 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %4, i64 0, i64 %100
store i8 0, i8* %101
%102 = call i32 @strlen(i8* %7)
%103 = call i32 @sendto(i32 %20, i8* %7, i32 %102, i32 0, %struct.sockaddr* %35, i32 12)
%104 = call i32 @recvfrom(i32 %20, i8* %8, i32 1000000, i32 0, i32* null, i32* null)
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %5, i64 0, i64 %105
store i8 0, i8* %106
%107 = load i32, i32* @stdout
%108 = call i32 @fputs(i8* %8, i32 %107)
%109 = load i32, i32* @BUFSIZ
%110 = load i32, i32* @stdin
%111 = call i32* @fgets(i8* %12, i32 %109, i32 %110)
%112 = icmp eq i32* %111, null
br i1 %112, label %113, label %36
113: ; preds = %95, %17
ret i32 0
}