#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 */
typedef double uint8_t;
typedef double uint32_t;
typedef double uint16_t;
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
  TYPE_1__ sin_addr;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ server;
typedef double int8_t;
typedef double int32_t;
typedef double int16_t;
typedef int /*<<< orphan*/ XDR;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ XDR_DECODE;
int /*<<< orphan*/ XDR_ENCODE;
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
scalar_t__ recv(int, char *, int, int /*<<< orphan*/);
scalar_t__ send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ xdr_char(int /*<<< orphan*/ *, double *);
int /*<<< orphan*/ xdr_destroy(int /*<<< orphan*/ *);
int /*<<< orphan*/ xdr_double(int /*<<< orphan*/ *, double *);
int /*<<< orphan*/ xdr_float(int /*<<< orphan*/ *, float *);
int /*<<< orphan*/ xdr_int(int /*<<< orphan*/ *, double *);
int /*<<< orphan*/ xdr_short(int /*<<< orphan*/ *, double *);
int /*<<< orphan*/ xdr_u_char(int /*<<< orphan*/ *, double *);
int /*<<< orphan*/ xdr_u_int(int /*<<< orphan*/ *, double *);
int /*<<< orphan*/ xdr_u_short(int /*<<< orphan*/ *, double *);
int /*<<< orphan*/ xdrmem_create(int /*<<< orphan*/ *, char *, int,
                                 int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int8_t d_i8, r_i8;
  uint8_t d_u8, r_u8;
  int16_t d_i16, r_i16;
  uint16_t d_u16, r_u16;
  int32_t d_i32, r_i32;
  uint32_t d_u32, r_u32;
  float d_f32, r_f32;
  double d_f64, r_f64;
  XDR xdr;
  int sock;
  struct sockaddr_in server;
  char message[36], server_reply[36];
  d_i8 = -1;
  d_u8 = 1;
  d_i16 = -256;
  d_u16 = 512;
  d_i32 = -0x0FFFAAAA;
  d_u32 = 0xDEADBEEF;
  d_f32 = 8.800f;
  d_f64 = 6.66;
  xdrmem_create(&xdr, message, 36, XDR_ENCODE);
  xdr_u_char(&xdr, &d_u8);
  xdr_char(&xdr, &d_i8);
  xdr_u_short(&xdr, &d_u16);
  xdr_short(&xdr, &d_i16);
  xdr_u_int(&xdr, &d_u32);
  xdr_int(&xdr, &d_i32);
  xdr_float(&xdr, &d_f32);
  xdr_double(&xdr, &d_f64);
  xdr_destroy(&xdr);
  sock = socket(AF_INET, SOCK_STREAM, 0);
  if (sock == -1) {
    printf("Could not create socket");
  }
  puts("Socket created");
  server.sin_addr.s_addr = inet_addr("127.0.0.1");
  server.sin_family = AF_INET;
  server.sin_port = htons(9123);
  if (connect(sock, (struct sockaddr *)&server, sizeof(server)) < 0) {
    perror("connect failed. Error");
    return 1;
  }
  puts("Connected\n");
  while (1) {
    if (send(sock, message, 36, 0) < 0) {
      puts("Send failed");
      return 1;
    }
    if (recv(sock, server_reply, 36, 0) < 0) {
      puts("recv failed");
      break;
    }
    xdrmem_create(&xdr, server_reply, 36, XDR_DECODE);
    xdr_u_char(&xdr, &r_u8);
    xdr_char(&xdr, &r_i8);
    xdr_u_short(&xdr, &r_u16);
    xdr_short(&xdr, &r_i16);
    xdr_u_int(&xdr, &r_u32);
    xdr_int(&xdr, &r_i32);
    xdr_float(&xdr, &r_f32);
    xdr_double(&xdr, &r_f64);
    {
      if (d_i8 != r_i8) {
        printf("%s failed(%"
               "i"
               " != %"
               "i"
               ")\n",
               "i8", d_i8, r_i8);
      }
    };
    {
      if (d_u8 != r_u8) {
        printf("%s failed(%"
               "u"
               " != %"
               "u"
               ")\n",
               "u8", d_u8, r_u8);
      }
    };
    {
      if (d_i16 != r_i16) {
        printf("%s failed(%"
               "i"
               " != %"
               "i"
               ")\n",
               "i16", d_i16, r_i16);
      }
    };
    {
      if (d_u16 != r_u16) {
        printf("%s failed(%"
               "u"
               " != %"
               "u"
               ")\n",
               "u16", d_u16, r_u16);
      }
    };
    {
      if (d_i32 != r_i32) {
        printf("%s failed(%"
               "i"
               " != %"
               "i"
               ")\n",
               "i32", d_i32, r_i32);
      }
    };
    {
      if (d_u32 != r_u32) {
        printf("%s failed(%"
               "u"
               " != %"
               "u"
               ")\n",
               "u32", d_u32, r_u32);
      }
    };
    {
      if (d_f32 != r_f32) {
        printf("%s failed(%"
               "f"
               " != %"
               "f"
               ")\n",
               "f32", d_f32, r_f32);
      }
    };
    {
      if (d_f64 != r_f64) {
        printf("%s failed(%"
               "f"
               " != %"
               "f"
               ")\n",
               "f64", d_f64, r_f64);
      }
    };
    break;
  }
  close(sock);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xdcf(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xdba(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xda5(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xd90(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xd7b(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xd66(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movss  0xd89(%rip),%xmm0
movss  %xmm0,-0x74(%rbp)
movsd  0xd44(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
lea    -0xd0(%rbp),%rsi
mov    0x2d09(%rip),%rax
mov    (%rax),%ecx
lea    -0x8c(%rbp),%rdi
mov    $0x24,%edx
call   1140 <xdrmem_create@plt>
lea    -0x8c(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1100 <xdr_u_char@plt>
lea    -0x8c(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   10c0 <xdr_char@plt>
lea    -0x8c(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   10a0 <xdr_u_short@plt>
lea    -0x8c(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   10d0 <xdr_short@plt>
lea    -0x8c(%rbp),%rdi
lea    -0x68(%rbp),%rsi
call   1130 <xdr_u_int@plt>
lea    -0x8c(%rbp),%rdi
lea    -0x58(%rbp),%rsi
call   10e0 <xdr_int@plt>
lea    -0x8c(%rbp),%rdi
lea    -0x74(%rbp),%rsi
call   1150 <xdr_float@plt>
lea    -0x8c(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1120 <xdr_double@plt>
lea    -0x8c(%rbp),%rdi
call   10b0 <xdr_destroy@plt>
mov    0x2c6b(%rip),%rax
mov    (%rax),%edi
mov    0x2c4a(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1160 <socket@plt>
mov    %eax,-0x90(%rbp)
cmpl   $0xffffffff,-0x90(%rbp)
jne    13a8 <main+0x168>
lea    0xc9b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xca5(%rip),%rdi
call   1040 <puts@plt>
lea    0xca8(%rip),%rdi
call   1090 <inet_addr@plt>
mov    %eax,-0x98(%rbp)
mov    0x2c13(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x9c(%rbp)
mov    $0x23a3,%edi
call   1050 <htons@plt>
mov    %eax,-0xa0(%rbp)
mov    -0x90(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    $0xc,%edx
call   1110 <connect@plt>
cmp    $0x0,%rax
jge    141e <main+0x1de>
lea    0xc60(%rip),%rdi
call   10f0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1731 <main+0x4f1>
lea    0xc5e(%rip),%rdi
call   1040 <puts@plt>
mov    -0x90(%rbp),%edi
lea    -0xd0(%rbp),%rsi
mov    $0x24,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0x0,%rax
jge    1465 <main+0x225>
lea    0xc3a(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1731 <main+0x4f1>
mov    -0x90(%rbp),%edi
lea    -0x100(%rbp),%rsi
mov    $0x24,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cmp    $0x0,%rax
jge    1499 <main+0x259>
lea    0xc0b(%rip),%rdi
call   1040 <puts@plt>
jmp    171f <main+0x4df>
lea    -0x100(%rbp),%rsi
mov    0x2b49(%rip),%rax
mov    (%rax),%ecx
lea    -0x8c(%rbp),%rdi
mov    $0x24,%edx
call   1140 <xdrmem_create@plt>
lea    -0x8c(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1100 <xdr_u_char@plt>
lea    -0x8c(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   10c0 <xdr_char@plt>
lea    -0x8c(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   10a0 <xdr_u_short@plt>
lea    -0x8c(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   10d0 <xdr_short@plt>
lea    -0x8c(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1130 <xdr_u_int@plt>
lea    -0x8c(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   10e0 <xdr_int@plt>
lea    -0x8c(%rbp),%rdi
lea    -0x78(%rbp),%rsi
call   1150 <xdr_float@plt>
lea    -0x8c(%rbp),%rdi
lea    -0x88(%rbp),%rsi
call   1120 <xdr_double@plt>
movsd  -0x18(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jne    1558 <main+0x318>
jp     1558 <main+0x318>
jmp    1577 <main+0x337>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xb3d(%rip),%rdi
lea    0xb4b(%rip),%rsi
mov    $0x2,%al
call   1070 <printf@plt>
movsd  -0x28(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jne    1592 <main+0x352>
jp     1592 <main+0x352>
jmp    15b1 <main+0x371>
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
lea    0xb1b(%rip),%rdi
lea    0xb29(%rip),%rsi
mov    $0x2,%al
call   1070 <printf@plt>
movsd  -0x38(%rbp),%xmm0
ucomisd -0x40(%rbp),%xmm0
jne    15cc <main+0x38c>
jp     15cc <main+0x38c>
jmp    15eb <main+0x3ab>
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
lea    0xac9(%rip),%rdi
lea    0xaf2(%rip),%rsi
mov    $0x2,%al
call   1070 <printf@plt>
movsd  -0x48(%rbp),%xmm0
ucomisd -0x50(%rbp),%xmm0
jne    1606 <main+0x3c6>
jp     1606 <main+0x3c6>
jmp    1625 <main+0x3e5>
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
lea    0xaa7(%rip),%rdi
lea    0xabc(%rip),%rsi
mov    $0x2,%al
call   1070 <printf@plt>
movsd  -0x58(%rbp),%xmm0
ucomisd -0x60(%rbp),%xmm0
jne    1640 <main+0x400>
jp     1640 <main+0x400>
jmp    165f <main+0x41f>
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
lea    0xa55(%rip),%rdi
lea    0xa86(%rip),%rsi
mov    $0x2,%al
call   1070 <printf@plt>
movsd  -0x68(%rbp),%xmm0
ucomisd -0x70(%rbp),%xmm0
jne    167a <main+0x43a>
jp     167a <main+0x43a>
jmp    1699 <main+0x459>
movsd  -0x68(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
lea    0xa33(%rip),%rdi
lea    0xa50(%rip),%rsi
mov    $0x2,%al
call   1070 <printf@plt>
movss  -0x74(%rbp),%xmm0
ucomiss -0x78(%rbp),%xmm0
jne    16b3 <main+0x473>
jp     16b3 <main+0x473>
jmp    16da <main+0x49a>
movss  -0x74(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x78(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xa1a(%rip),%rdi
lea    0xa28(%rip),%rsi
mov    $0x2,%al
call   1070 <printf@plt>
movsd  -0x80(%rbp),%xmm0
ucomisd -0x88(%rbp),%xmm0
ff
jne    16f8 <main+0x4b8>
jp     16f8 <main+0x4b8>
jmp    171a <main+0x4da>
movsd  -0x80(%rbp),%xmm0
movsd  -0x88(%rbp),%xmm1
ff
lea    0x9da(%rip),%rdi
lea    0x9ec(%rip),%rsi
mov    $0x2,%al
call   1070 <printf@plt>
jmp    171f <main+0x4df>
mov    -0x90(%rbp),%edi
call   1080 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0xe8,%rsp
movabs $0xbff0000000000000,%rax
mov    %rax,0x40(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x38(%rsp)
movabs $0xc070000000000000,%rax
mov    %rax,0x30(%rsp)
movabs $0x4080000000000000,%rax
mov    %rax,0x28(%rsp)
movabs $0xc1afff5554000000,%rax
ff af c1
mov    %rax,0x20(%rsp)
movabs $0x41ebd5b7dde00000,%rax
d5 eb 41
mov    %rax,0x18(%rsp)
movl   $0x410ccccd,0x4(%rsp)
41
movabs $0x401aa3d70a3d70a4,%rax
a3 1a 40
mov    %rax,0x10(%rsp)
mov    0x2d17(%rip),%rax
mov    (%rax),%ecx
lea    0x8(%rsp),%rbx
lea    0xc0(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x24,%edx
call   1140 <xdrmem_create@plt>
lea    0x38(%rsp),%rsi
mov    %rbx,%rdi
call   1100 <xdr_u_char@plt>
lea    0x40(%rsp),%rsi
mov    %rbx,%rdi
call   10c0 <xdr_char@plt>
lea    0x28(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <xdr_u_short@plt>
lea    0x30(%rsp),%rsi
mov    %rbx,%rdi
call   10d0 <xdr_short@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1130 <xdr_u_int@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   10e0 <xdr_int@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1150 <xdr_float@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1120 <xdr_double@plt>
mov    %rbx,%rdi
call   10b0 <xdr_destroy@plt>
mov    0x2c8c(%rip),%rbx
mov    (%rbx),%edi
mov    0x2c6b(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1160 <socket@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
jne    137b <main+0x13b>
lea    0xc8c(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xc96(%rip),%rdi
call   1040 <puts@plt>
lea    0xc99(%rip),%rdi
call   1090 <inet_addr@plt>
mov    %eax,0x50(%rsp)
mov    (%rbx),%eax
mov    %eax,0x4c(%rsp)
mov    $0x23a3,%edi
call   1050 <htons@plt>
mov    %eax,0x48(%rsp)
lea    0x48(%rsp),%rsi
mov    %ebp,%edi
mov    $0xc,%edx
call   1110 <connect@plt>
test   %rax,%rax
js     1629 <main+0x3e9>
lea    0xc7b(%rip),%rdi
call   1040 <puts@plt>
lea    0xc0(%rsp),%rsi
mov    %ebp,%edi
mov    $0x24,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
test   %rax,%rax
js     15f7 <main+0x3b7>
lea    0x90(%rsp),%rsi
mov    %ebp,%edi
mov    $0x24,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %rax,%rax
js     160a <main+0x3ca>
mov    0x2bda(%rip),%rax
mov    (%rax),%ecx
lea    0x8(%rsp),%rbx
lea    0x90(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x24,%edx
call   1140 <xdrmem_create@plt>
lea    0x80(%rsp),%rsi
mov    %rbx,%rdi
call   1100 <xdr_u_char@plt>
lea    0x88(%rsp),%rsi
mov    %rbx,%rdi
call   10c0 <xdr_char@plt>
lea    0x70(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <xdr_u_short@plt>
lea    0x78(%rsp),%rsi
mov    %rbx,%rdi
call   10d0 <xdr_short@plt>
lea    0x60(%rsp),%rsi
mov    %rbx,%rdi
call   1130 <xdr_u_int@plt>
lea    0x68(%rsp),%rsi
mov    %rbx,%rdi
call   10e0 <xdr_int@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1150 <xdr_float@plt>
lea    0x58(%rsp),%rsi
mov    %rbx,%rdi
call   1120 <xdr_double@plt>
movsd  0x40(%rsp),%xmm0
movsd  0x88(%rsp),%xmm1
ucomisd %xmm1,%xmm0
jne    14b7 <main+0x277>
jnp    14cc <main+0x28c>
lea    0xbac(%rip),%rdi
lea    0xbba(%rip),%rsi
mov    $0x2,%al
call   1070 <printf@plt>
movsd  0x38(%rsp),%xmm0
movsd  0x80(%rsp),%xmm1
ucomisd %xmm1,%xmm0
jne    14e3 <main+0x2a3>
jnp    14f8 <main+0x2b8>
lea    0xb98(%rip),%rdi
lea    0xba6(%rip),%rsi
mov    $0x2,%al
call   1070 <printf@plt>
movsd  0x30(%rsp),%xmm0
movsd  0x78(%rsp),%xmm1
ucomisd %xmm1,%xmm0
jne    150c <main+0x2cc>
jnp    1521 <main+0x2e1>
lea    0xb57(%rip),%rdi
lea    0xb80(%rip),%rsi
mov    $0x2,%al
call   1070 <printf@plt>
movsd  0x28(%rsp),%xmm0
movsd  0x70(%rsp),%xmm1
ucomisd %xmm1,%xmm0
jne    1535 <main+0x2f5>
jnp    154a <main+0x30a>
lea    0xb46(%rip),%rdi
lea    0xb5b(%rip),%rsi
mov    $0x2,%al
call   1070 <printf@plt>
movsd  0x20(%rsp),%xmm0
movsd  0x68(%rsp),%xmm1
ucomisd %xmm1,%xmm0
jne    155e <main+0x31e>
jnp    1573 <main+0x333>
lea    0xb05(%rip),%rdi
lea    0xb36(%rip),%rsi
mov    $0x2,%al
call   1070 <printf@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x60(%rsp),%xmm1
ucomisd %xmm1,%xmm0
jne    1587 <main+0x347>
jnp    159c <main+0x35c>
lea    0xaf4(%rip),%rdi
lea    0xb11(%rip),%rsi
mov    $0x2,%al
call   1070 <printf@plt>
movss  0x4(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
ucomiss %xmm1,%xmm0
jne    15af <main+0x36f>
jnp    15cc <main+0x38c>
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xaec(%rip),%rdi
lea    0xafa(%rip),%rsi
mov    $0x2,%al
call   1070 <printf@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x58(%rsp),%xmm1
ucomisd %xmm1,%xmm0
jne    15e0 <main+0x3a0>
jnp    1616 <main+0x3d6>
lea    0xac3(%rip),%rdi
lea    0xad5(%rip),%rsi
mov    $0x2,%al
call   1070 <printf@plt>
jmp    1616 <main+0x3d6>
lea    0xa54(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
jmp    161f <main+0x3df>
lea    0xa4d(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%edi
call   1080 <close@plt>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xa01(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%eax
jmp    161f <main+0x3df>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@XDR_ENCODE = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [24 x i8] c"Could not create socket\00"
@.str.1 = [15 x i8] c"Socket created\00"
@.str.2 = [10 x i8] c"127.0.0.1\00"
@.str.3 = [22 x i8] c"connect failed. Error\00"
@.str.4 = [11 x i8] c"Connected\0A\00"
@.str.5 = [12 x i8] c"Send failed\00"
@.str.6 = [12 x i8] c"recv failed\00"
@XDR_DECODE = global i32 0
@.str.7 = [21 x i8] c"%s failed(%i != %i)\0A\00"
@.str.8 = [3 x i8] c"i8\00"
@.str.9 = [21 x i8] c"%s failed(%u != %u)\0A\00"
@.str.10 = [3 x i8] c"u8\00"
@.str.11 = [4 x i8] c"i16\00"
@.str.12 = [4 x i8] c"u16\00"
@.str.13 = [4 x i8] c"i32\00"
@.str.14 = [4 x i8] c"u32\00"
@.str.15 = [21 x i8] c"%s failed(%f != %f)\0A\00"
@.str.16 = [4 x i8] c"f32\00"
@.str.17 = [4 x i8] c"f64\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca float
%19 = alloca float
%20 = alloca double
%21 = alloca double
%22 = alloca i32
%23 = alloca i32
%24 = alloca %struct.sockaddr_in
%25 = alloca [36 x i8]
%26 = alloca [36 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double -1.000000e+00, double* %6
store double 1.000000e+00, double* %8
store double -2.560000e+02, double* %10
store double 5.120000e+02, double* %12
store double 0xC1AFFF5554000000, double* %14
store double 0x41EBD5B7DDE00000, double* %16
store float 0x40219999A0000000, float* %18
store double 6.660000e+00, double* %20
%27 = getelementptr inbounds [36 x i8], [36 x i8]* %25, i64 0, i64 0
%28 = load i32, i32* @XDR_ENCODE
%29 = call i32 @xdrmem_create(i32* %22, i8* %27, i32 36, i32 %28)
%30 = call i32 @xdr_u_char(i32* %22, double* %8)
%31 = call i32 @xdr_char(i32* %22, double* %6)
%32 = call i32 @xdr_u_short(i32* %22, double* %12)
%33 = call i32 @xdr_short(i32* %22, double* %10)
%34 = call i32 @xdr_u_int(i32* %22, double* %16)
%35 = call i32 @xdr_int(i32* %22, double* %14)
%36 = call i32 @xdr_float(i32* %22, float* %18)
%37 = call i32 @xdr_double(i32* %22, double* %20)
%38 = call i32 @xdr_destroy(i32* %22)
%39 = load i32, i32* @AF_INET
%40 = load i32, i32* @SOCK_STREAM
%41 = call i32 @socket(i32 %39, i32 %40, i32 0)
store i32 %41, i32* %23
%42 = load i32, i32* %23
%43 = icmp eq i32 %42, -1
br i1 %43, label %44, label %46
44: ; preds = %2
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %46
46: ; preds = %44, %2
%47 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%48 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%49 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %24, i32 0, i32 2
%50 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %49, i32 0, i32 0
store i32 %48, i32* %50
%51 = load i32, i32* @AF_INET
%52 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %24, i32 0, i32 1
store i32 %51, i32* %52
%53 = call i32 @htons(i32 9123)
%54 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %24, i32 0, i32 0
store i32 %53, i32* %54
%55 = load i32, i32* %23
%56 = bitcast %struct.sockaddr_in* %24 to %struct.sockaddr*
%57 = call i64 @connect(i32 %55, %struct.sockaddr* %56, i32 12)
%58 = icmp slt i64 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %46
%60 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %158
61: ; preds = %46
%62 = call i32 @puts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %63
63: ; preds = %61
%64 = load i32, i32* %23
%65 = getelementptr inbounds [36 x i8], [36 x i8]* %25, i64 0, i64 0
%66 = call i64 @send(i32 %64, i8* %65, i32 36, i32 0)
%67 = icmp slt i64 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %63
%69 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %158
70: ; preds = %63
%71 = load i32, i32* %23
%72 = getelementptr inbounds [36 x i8], [36 x i8]* %26, i64 0, i64 0
%73 = call i64 @recv(i32 %71, i8* %72, i32 36, i32 0)
%74 = icmp slt i64 %73, 0
br i1 %74, label %75, label %77
75: ; preds = %70
%76 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
br label %155
77: ; preds = %70
%78 = getelementptr inbounds [36 x i8], [36 x i8]* %26, i64 0, i64 0
%79 = load i32, i32* @XDR_DECODE
%80 = call i32 @xdrmem_create(i32* %22, i8* %78, i32 36, i32 %79)
%81 = call i32 @xdr_u_char(i32* %22, double* %9)
%82 = call i32 @xdr_char(i32* %22, double* %7)
%83 = call i32 @xdr_u_short(i32* %22, double* %13)
%84 = call i32 @xdr_short(i32* %22, double* %11)
%85 = call i32 @xdr_u_int(i32* %22, double* %17)
%86 = call i32 @xdr_int(i32* %22, double* %15)
%87 = call i32 @xdr_float(i32* %22, float* %19)
%88 = call i32 @xdr_double(i32* %22, double* %21)
%89 = load double, double* %6
%90 = load double, double* %7
%91 = fcmp une double %89, %90
br i1 %91, label %92, label %96
92: ; preds = %77
%93 = load double, double* %6
%94 = load double, double* %7
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), double %93, double %94)
br label %96
96: ; preds = %92, %77
%97 = load double, double* %8
%98 = load double, double* %9
%99 = fcmp une double %97, %98
br i1 %99, label %100, label %104
100: ; preds = %96
%101 = load double, double* %8
%102 = load double, double* %9
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), double %101, double %102)
br label %104
104: ; preds = %100, %96
%105 = load double, double* %10
%106 = load double, double* %11
%107 = fcmp une double %105, %106
br i1 %107, label %108, label %112
108: ; preds = %104
%109 = load double, double* %10
%110 = load double, double* %11
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), double %109, double %110)
br label %112
112: ; preds = %108, %104
%113 = load double, double* %12
%114 = load double, double* %13
%115 = fcmp une double %113, %114
br i1 %115, label %116, label %120
116: ; preds = %112
%117 = load double, double* %12
%118 = load double, double* %13
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double %117, double %118)
br label %120
120: ; preds = %116, %112
%121 = load double, double* %14
%122 = load double, double* %15
%123 = fcmp une double %121, %122
br i1 %123, label %124, label %128
124: ; preds = %120
%125 = load double, double* %14
%126 = load double, double* %15
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), double %125, double %126)
br label %128
128: ; preds = %124, %120
%129 = load double, double* %16
%130 = load double, double* %17
%131 = fcmp une double %129, %130
br i1 %131, label %132, label %136
132: ; preds = %128
%133 = load double, double* %16
%134 = load double, double* %17
%135 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), double %133, double %134)
br label %136
136: ; preds = %132, %128
%137 = load float, float* %18
%138 = load float, float* %19
%139 = fcmp une float %137, %138
br i1 %139, label %140, label %146
140: ; preds = %136
%141 = load float, float* %18
%142 = fpext float %141 to double
%143 = load float, float* %19
%144 = fpext float %143 to double
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), double %142, double %144)
br label %146
146: ; preds = %140, %136
%147 = load double, double* %20
%148 = load double, double* %21
%149 = fcmp une double %147, %148
br i1 %149, label %150, label %154
150: ; preds = %146
%151 = load double, double* %20
%152 = load double, double* %21
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), double %151, double %152)
br label %154
154: ; preds = %150, %146
br label %155
155: ; preds = %154, %75
%156 = load i32, i32* %23
%157 = call i32 @close(i32 %156)
store i32 0, i32* %3
br label %158
158: ; preds = %155, %68, %59
%159 = load i32, i32* %3
ret i32 %159
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@XDR_ENCODE = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [24 x i8] c"Could not create socket\00"
@.str.1 = [15 x i8] c"Socket created\00"
@.str.2 = [10 x i8] c"127.0.0.1\00"
@.str.3 = [22 x i8] c"connect failed. Error\00"
@.str.4 = [11 x i8] c"Connected\0A\00"
@.str.5 = [12 x i8] c"Send failed\00"
@.str.6 = [12 x i8] c"recv failed\00"
@XDR_DECODE = global i32 0
@.str.7 = [21 x i8] c"%s failed(%i != %i)\0A\00"
@.str.8 = [3 x i8] c"i8\00"
@.str.9 = [21 x i8] c"%s failed(%u != %u)\0A\00"
@.str.10 = [3 x i8] c"u8\00"
@.str.11 = [4 x i8] c"i16\00"
@.str.12 = [4 x i8] c"u16\00"
@.str.13 = [4 x i8] c"i32\00"
@.str.14 = [4 x i8] c"u32\00"
@.str.15 = [21 x i8] c"%s failed(%f != %f)\0A\00"
@.str.16 = [4 x i8] c"f32\00"
@.str.17 = [4 x i8] c"f64\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca float
%16 = alloca float
%17 = alloca double
%18 = alloca double
%19 = alloca i32
%20 = alloca %struct.sockaddr_in
%21 = alloca [36 x i8]
%22 = alloca [36 x i8]
%23 = bitcast double* %3 to i8*
%24 = bitcast double* %4 to i8*
%25 = bitcast double* %5 to i8*
%26 = bitcast double* %6 to i8*
%27 = bitcast double* %7 to i8*
%28 = bitcast double* %8 to i8*
%29 = bitcast double* %9 to i8*
%30 = bitcast double* %10 to i8*
%31 = bitcast double* %11 to i8*
%32 = bitcast double* %12 to i8*
%33 = bitcast double* %13 to i8*
%34 = bitcast double* %14 to i8*
%35 = bitcast float* %15 to i8*
%36 = bitcast float* %16 to i8*
%37 = bitcast double* %17 to i8*
%38 = bitcast double* %18 to i8*
%39 = bitcast i32* %19 to i8*
%40 = bitcast %struct.sockaddr_in* %20 to i8*
%41 = getelementptr inbounds [36 x i8], [36 x i8]* %21, i64 0, i64 0
%42 = getelementptr inbounds [36 x i8], [36 x i8]* %22, i64 0, i64 0
store double -1.000000e+00, double* %3
store double 1.000000e+00, double* %5
store double -2.560000e+02, double* %7
store double 5.120000e+02, double* %9
store double 0xC1AFFF5554000000, double* %11
store double 0x41EBD5B7DDE00000, double* %13
store float 0x40219999A0000000, float* %15
store double 6.660000e+00, double* %17
%43 = load i32, i32* @XDR_ENCODE
%44 = call i32 @xdrmem_create(i32* %19, i8* %41, i32 36, i32 %43)
%45 = call i32 @xdr_u_char(i32* %19, double* %5)
%46 = call i32 @xdr_char(i32* %19, double* %3)
%47 = call i32 @xdr_u_short(i32* %19, double* %9)
%48 = call i32 @xdr_short(i32* %19, double* %7)
%49 = call i32 @xdr_u_int(i32* %19, double* %13)
%50 = call i32 @xdr_int(i32* %19, double* %11)
%51 = call i32 @xdr_float(i32* %19, float* %15)
%52 = call i32 @xdr_double(i32* %19, double* %17)
%53 = call i32 @xdr_destroy(i32* %19)
%54 = load i32, i32* @AF_INET
%55 = load i32, i32* @SOCK_STREAM
%56 = call i32 @socket(i32 %54, i32 %55, i32 0)
%57 = icmp eq i32 %56, -1
br i1 %57, label %58, label %60
58: ; preds = %2
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %60
60: ; preds = %58, %2
%61 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%62 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%63 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %20, i64 0, i32 2, i32 0
store i32 %62, i32* %63
%64 = load i32, i32* @AF_INET
%65 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %20, i64 0, i32 1
store i32 %64, i32* %65
%66 = call i32 @htons(i32 9123)
%67 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %20, i64 0, i32 0
store i32 %66, i32* %67
%68 = bitcast %struct.sockaddr_in* %20 to %struct.sockaddr*
%69 = call i64 @connect(i32 %56, %struct.sockaddr* %68, i32 12)
%70 = icmp slt i64 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %60
%72 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %146
73: ; preds = %60
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%75 = call i64 @send(i32 %56, i8* %41, i32 36, i32 0)
%76 = icmp slt i64 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %73
%78 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
br label %146
79: ; preds = %73
%80 = call i64 @recv(i32 %56, i8* %42, i32 36, i32 0)
%81 = icmp slt i64 %80, 0
br i1 %81, label %82, label %84
82: ; preds = %79
%83 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
br label %144
84: ; preds = %79
%85 = load i32, i32* @XDR_DECODE
%86 = call i32 @xdrmem_create(i32* %19, i8* %42, i32 36, i32 %85)
%87 = call i32 @xdr_u_char(i32* %19, double* %6)
%88 = call i32 @xdr_char(i32* %19, double* %4)
%89 = call i32 @xdr_u_short(i32* %19, double* %10)
%90 = call i32 @xdr_short(i32* %19, double* %8)
%91 = call i32 @xdr_u_int(i32* %19, double* %14)
%92 = call i32 @xdr_int(i32* %19, double* %12)
%93 = call i32 @xdr_float(i32* %19, float* %16)
%94 = call i32 @xdr_double(i32* %19, double* %18)
%95 = load double, double* %3
%96 = load double, double* %4
%97 = fcmp une double %95, %96
br i1 %97, label %98, label %100
98: ; preds = %84
%99 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), double %95, double %96)
br label %100
100: ; preds = %98, %84
%101 = load double, double* %5
%102 = load double, double* %6
%103 = fcmp une double %101, %102
br i1 %103, label %104, label %106
104: ; preds = %100
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), double %101, double %102)
br label %106
106: ; preds = %104, %100
%107 = load double, double* %7
%108 = load double, double* %8
%109 = fcmp une double %107, %108
br i1 %109, label %110, label %112
110: ; preds = %106
%111 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), double %107, double %108)
br label %112
112: ; preds = %110, %106
%113 = load double, double* %9
%114 = load double, double* %10
%115 = fcmp une double %113, %114
br i1 %115, label %116, label %118
116: ; preds = %112
%117 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), double %113, double %114)
br label %118
118: ; preds = %116, %112
%119 = load double, double* %11
%120 = load double, double* %12
%121 = fcmp une double %119, %120
br i1 %121, label %122, label %124
122: ; preds = %118
%123 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), double %119, double %120)
br label %124
124: ; preds = %122, %118
%125 = load double, double* %13
%126 = load double, double* %14
%127 = fcmp une double %125, %126
br i1 %127, label %128, label %130
128: ; preds = %124
%129 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), double %125, double %126)
br label %130
130: ; preds = %128, %124
%131 = load float, float* %15
%132 = load float, float* %16
%133 = fcmp une float %131, %132
br i1 %133, label %134, label %138
134: ; preds = %130
%135 = fpext float %131 to double
%136 = fpext float %132 to double
%137 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), double %135, double %136)
br label %138
138: ; preds = %134, %130
%139 = load double, double* %17
%140 = load double, double* %18
%141 = fcmp une double %139, %140
br i1 %141, label %142, label %144
142: ; preds = %138
%143 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), double %139, double %140)
br label %144
144: ; preds = %138, %142, %82
%145 = call i32 @close(i32 %56)
br label %146
146: ; preds = %144, %77, %71
%147 = phi i32 [ 1, %71 ], [ 1, %77 ], [ 0, %144 ]
ret i32 %147
}