#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 int uint8_t;
struct spi_ioc_transfer {
  unsigned long tx_buf;
  unsigned long rx_buf;
  int len;
  int speed_hz;
  int bits_per_word;
  int /*<<< orphan*/ member_0;
};
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
  int /*<<< orphan*/ member_0;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ server_address;
typedef int /*<<< orphan*/ client_address;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ MSG_DONTWAIT;
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int /*<<< orphan*/ SPI_IOC_MESSAGE(int);
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ atoi(char *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, struct spi_ioc_transfer *);
int listen(int, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, int *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send(int, unsigned char *, unsigned int, int /*<<< orphan*/);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int status;
  if (argc < 2) {
    printf("%s [tcp port number]", argv[0]);
    exit(1);
  }
  int spi_fd;
  spi_fd = open("/dev/spidev0.0", O_RDWR);
  if (spi_fd < 0)
    error("open() SPI error");
  int server_socket;
  server_socket = socket(AF_INET, SOCK_STREAM, 0);
  if (server_socket == 0)
    error("socket() error");
  int yes = 1;
  if (setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) <
      0) {
    perror("setsockopt");
  }
  struct sockaddr_in server_address = {0};
  server_address.sin_family = AF_INET;
  server_address.sin_addr.s_addr = INADDR_ANY;
  server_address.sin_port = htons(atoi(argv[1]));
  status = bind(server_socket, (struct sockaddr *)&server_address,
                sizeof(server_address));
  if (status == -1)
    error("bind() error");
  int client_socket;
  struct sockaddr_in client_address;
  socklen_t address_size = sizeof(client_address);
  printf("Waiting for connection.\n");
  status = listen(server_socket, 5);
  if (status == -1)
    error("listen() error");
  client_socket =
      accept(server_socket, (struct sockaddr *)&client_address, &address_size);
  if (client_socket == -1)
    printf("Acception error.");
  else
    printf("Connection accepted.\n");
  uint8_t txdata;
  uint8_t rxdata;
  struct spi_ioc_transfer tr = {0};
  tr.tx_buf = (unsigned long)&txdata;
  tr.rx_buf = (unsigned long)&rxdata;
  tr.len = 1;
  tr.speed_hz = 245000;
  tr.bits_per_word = 8;
  enum State {
    Message_Start,
    UBX_Sync2,
    UBX_Class,
    UBX_ID,
    UBX_Length_LSB,
    UBX_Length_MSB,
    UBX_Payload,
    UBX_CK_A,
    UBX_CK_B,
    NMEA_Message
  };
  int state = Message_Start;
  unsigned char message[1024];
  unsigned int position = 0;
  unsigned short ubx_payload_length;
  while (1) {
    status = recv(client_socket, &txdata, 1, MSG_DONTWAIT);
    if (status == 0) {
      printf("Client disconnected.\n");
      printf("Waiting for connection.\n");
      listen(server_socket, 5);
      client_socket = accept(server_socket, (struct sockaddr *)&client_address,
                             &address_size);
      if (client_socket == -1)
        fprintf(stderr, "accept() error.");
      else
        printf("Connection accepted.\n");
    }
    if (status < 0)
      txdata = 0x00;
    ioctl(spi_fd, SPI_IOC_MESSAGE(1), &tr);
    message[position++] = rxdata;
    switch (state) {
    case Message_Start:
      if (rxdata == 0xb5) {
        state = UBX_Sync2;
      } else if (rxdata == '$') {
        state = NMEA_Message;
      } else {
        state = Message_Start;
        position = 0;
      }
      break;
    case UBX_Sync2:
      if (rxdata == 0x62)
        state = UBX_Class;
      else if (rxdata == 0xb5) {
        state = Message_Start;
        position = 1;
      } else {
        state = Message_Start;
        position = 0;
      }
      break;
    case UBX_Class:
      state = UBX_ID;
      break;
    case UBX_ID:
      state = UBX_Length_LSB;
      break;
    case UBX_Length_LSB:
      ubx_payload_length = rxdata;
      state = UBX_Length_MSB;
      break;
    case UBX_Length_MSB:
      ubx_payload_length += rxdata << 8;
      state = UBX_Payload;
      break;
    case UBX_Payload:
      if (position == ubx_payload_length + 6)
        state = UBX_CK_A;
      if (position >= 1022) {
        state = Message_Start;
        position = 0;
      }
      break;
    case UBX_CK_A:
      state = UBX_CK_B;
      break;
    case UBX_CK_B:
      send(client_socket, message, 6 + ubx_payload_length + 2, 0);
      state = Message_Start;
      position = 0;
      break;
    case NMEA_Message:
      if (rxdata == '\n')
        send(client_socket, message, position, 0);
      if (rxdata == '\n' || position >= 80) {
        state = Message_Start;
        position = 0;
      }
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1262 <main+0x42>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    0x2d7f(%rip),%rax
mov    (%rax),%esi
lea    0xdcb(%rip),%rdi
call   10f0 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1290 <main+0x70>
lea    0xdc1(%rip),%rdi
call   10e0 <error@plt>
mov    0x2d41(%rip),%rax
mov    (%rax),%edi
mov    0x2d18(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    12c2 <main+0xa2>
lea    0xda0(%rip),%rdi
call   10e0 <error@plt>
movl   $0x1,-0x20(%rbp)
mov    -0x1c(%rbp),%edi
mov    0x2d0d(%rip),%rax
mov    (%rax),%esi
mov    0x2ccc(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rcx
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
cmp    $0x0,%rax
jge    1303 <main+0xe3>
lea    0xd6e(%rip),%rdi
call   1100 <perror@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1080 <memset@plt>
mov    0x2cbe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2caa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1120 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %eax,-0x30(%rbp)
mov    -0x1c(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x10,%edx
call   10d0 <bind@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    136c <main+0x14c>
lea    0xd10(%rip),%rdi
call   10e0 <error@plt>
movl   $0x10,-0x4c(%rbp)
lea    0xd0a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x1c(%rbp),%edi
mov    $0x5,%esi
call   10c0 <listen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    13a7 <main+0x187>
lea    0xcfb(%rip),%rdi
call   10e0 <error@plt>
mov    -0x1c(%rbp),%edi
lea    -0x48(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
call   1110 <accept@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    13d7 <main+0x1b7>
lea    0xce1(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    13e5 <main+0x1c5>
lea    0xcdf(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x78(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <memset@plt>
lea    -0x50(%rbp),%rax
mov    %rax,-0x78(%rbp)
lea    -0x54(%rbp),%rax
mov    %rax,-0x70(%rbp)
movl   $0x1,-0x68(%rbp)
movl   $0x3bd08,-0x64(%rbp)
movl   $0x8,-0x60(%rbp)
movl   $0x0,-0x7c(%rbp)
movl   $0x0,-0x484(%rbp)
mov    -0x34(%rbp),%edi
mov    0x2b7b(%rip),%rax
mov    (%rax),%ecx
lea    -0x50(%rbp),%rsi
mov    $0x1,%edx
call   1030 <recv@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    14c5 <main+0x2a5>
lea    0xc7a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xc1d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x1c(%rbp),%edi
mov    $0x5,%esi
call   10c0 <listen@plt>
mov    -0x1c(%rbp),%edi
lea    -0x48(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
call   1110 <accept@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    14b2 <main+0x292>
mov    0x2b21(%rip),%rax
mov    (%rax),%edi
lea    0xc41(%rip),%rsi
call   10b0 <fprintf@plt>
jmp    14c0 <main+0x2a0>
lea    0xc04(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    14c5 <main+0x2a5>
cmpl   $0x0,-0x14(%rbp)
jge    14d6 <main+0x2b6>
movl   $0x0,-0x50(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x494(%rbp)
mov    $0x1,%edi
call   1090 <SPI_IOC_MESSAGE@plt>
mov    -0x494(%rbp),%edi
mov    %eax,%esi
lea    -0x78(%rbp),%rdx
call   10a0 <ioctl@plt>
mov    -0x54(%rbp),%cl
mov    -0x484(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x484(%rbp)
mov    %cl,-0x480(%rbp,%rax,1)
mov    -0x7c(%rbp),%eax
mov    %rax,-0x490(%rbp)
sub    $0x9,%rax
ja     1701 <main+0x4e1>
mov    -0x490(%rbp),%rax
lea    0xac9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmpl   $0xb5,-0x54(%rbp)
jne    1559 <main+0x339>
movl   $0x1,-0x7c(%rbp)
jmp    1585 <main+0x365>
cmpl   $0x24,-0x54(%rbp)
jne    156f <main+0x34f>
movl   $0x9,-0x7c(%rbp)
jmp    1580 <main+0x360>
movl   $0x0,-0x7c(%rbp)
movl   $0x0,-0x484(%rbp)
jmp    1585 <main+0x365>
jmp    1701 <main+0x4e1>
cmpl   $0x62,-0x54(%rbp)
jne    15a0 <main+0x380>
movl   $0x2,-0x7c(%rbp)
jmp    15d9 <main+0x3b9>
cmpl   $0xb5,-0x54(%rbp)
jne    15c3 <main+0x3a3>
movl   $0x0,-0x7c(%rbp)
movl   $0x1,-0x484(%rbp)
jmp    15d4 <main+0x3b4>
movl   $0x0,-0x7c(%rbp)
movl   $0x0,-0x484(%rbp)
jmp    15d9 <main+0x3b9>
jmp    1701 <main+0x4e1>
movl   $0x3,-0x7c(%rbp)
jmp    1701 <main+0x4e1>
movl   $0x4,-0x7c(%rbp)
jmp    1701 <main+0x4e1>
mov    -0x54(%rbp),%eax
mov    %ax,-0x486(%rbp)
movl   $0x5,-0x7c(%rbp)
jmp    1701 <main+0x4e1>
mov    -0x54(%rbp),%ecx
shl    $0x8,%ecx
movzwl -0x486(%rbp),%eax
add    %ecx,%eax
mov    %ax,-0x486(%rbp)
movl   $0x6,-0x7c(%rbp)
jmp    1701 <main+0x4e1>
mov    -0x484(%rbp),%eax
movzwl -0x486(%rbp),%ecx
add    $0x6,%ecx
cmp    %ecx,%eax
jne    164d <main+0x42d>
movl   $0x7,-0x7c(%rbp)
cmpl   $0x3fe,-0x484(%rbp)
jb     166e <main+0x44e>
movl   $0x0,-0x7c(%rbp)
movl   $0x0,-0x484(%rbp)
jmp    1701 <main+0x4e1>
movl   $0x8,-0x7c(%rbp)
jmp    1701 <main+0x4e1>
mov    -0x34(%rbp),%edi
lea    -0x480(%rbp),%rsi
movzwl -0x486(%rbp),%edx
add    $0x6,%edx
add    $0x2,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
movl   $0x0,-0x7c(%rbp)
movl   $0x0,-0x484(%rbp)
jmp    1701 <main+0x4e1>
cmpl   $0xa,-0x54(%rbp)
jne    16d4 <main+0x4b4>
mov    -0x34(%rbp),%edi
lea    -0x480(%rbp),%rsi
mov    -0x484(%rbp),%edx
xor    %ecx,%ecx
call   1060 <send@plt>
cmpl   $0xa,-0x54(%rbp)
je     16eb <main+0x4cb>
cmpl   $0x50,-0x484(%rbp)
jb     16fc <main+0x4dc>
movl   $0x0,-0x7c(%rbp)
movl   $0x0,-0x484(%rbp)
jmp    1701 <main+0x4e1>
jmp    142b <main+0x20b>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x468,%rsp
mov    %rsi,%r14
cmp    $0x1,%edi
jle    15e9 <main+0x3c9>
mov    0x2da4(%rip),%rax
mov    (%rax),%esi
lea    0xdf0(%rip),%rdi
call   10f0 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1264 <main+0x44>
lea    0xded(%rip),%rdi
call   10e0 <error@plt>
mov    0x2d6d(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2d43(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,%r15d
test   %eax,%eax
jne    1291 <main+0x71>
lea    0xdd1(%rip),%rdi
call   10e0 <error@plt>
movl   $0x1,0x1c(%rsp)
mov    0x2d40(%rip),%rax
mov    (%rax),%esi
mov    0x2cff(%rip),%rax
mov    (%rax),%edx
lea    0x1c(%rsp),%rcx
mov    %r15d,%edi
mov    $0x4,%r8d
call   1050 <setsockopt@plt>
test   %rax,%rax
js     15d8 <main+0x3b8>
movl   $0x0,0x2c(%rsp)
mov    0x0(%rbp),%eax
mov    %eax,0x28(%rsp)
mov    0x2cf3(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x24(%rsp)
mov    0x8(%r14),%rdi
call   1120 <atoi@plt>
mov    %eax,%edi
call   1060 <htons@plt>
mov    %eax,0x20(%rsp)
lea    0x20(%rsp),%rsi
mov    %r15d,%edi
mov    $0x10,%edx
call   10d0 <bind@plt>
cmp    $0xffffffff,%eax
jne    131a <main+0xfa>
lea    0xd62(%rip),%rdi
call   10e0 <error@plt>
movl   $0x10,0x14(%rsp)
lea    0xda0(%rip),%rdi
call   1040 <puts@plt>
mov    %r15d,%edi
mov    $0x5,%esi
call   10c0 <listen@plt>
cmp    $0xffffffff,%eax
jne    134c <main+0x12c>
lea    0xd3d(%rip),%rdi
call   10e0 <error@plt>
lea    0x50(%rsp),%rsi
lea    0x14(%rsp),%rdx
mov    %r15d,%edi
call   1110 <accept@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
mov    %r15d,0x18(%rsp)
je     1378 <main+0x158>
lea    0xd70(%rip),%rdi
call   1040 <puts@plt>
jmp    1386 <main+0x166>
lea    0xd14(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
movq   $0x0,0x48(%rsp)
lea    0x10(%rsp),%rax
mov    %rax,0x30(%rsp)
lea    0xc(%rsp),%rax
mov    %rax,0x38(%rsp)
movabs $0x3bd0800000001,%rax
mov    %rax,0x40(%rsp)
movl   $0x8,0x48(%rsp)
lea    0xc3f(%rip),%r14
xor    %r12d,%r12d
xor    %r13d,%r13d
jmp    13d6 <main+0x1b6>
nopl   0x0(%rax)
mov    $0x5,%r12d
mov    %eax,0x8(%rsp)
nopw   0x0(%rax,%rax,1)
mov    %r13d,%r15d
mov    0x2bc6(%rip),%rax
mov    (%rax),%ecx
mov    %ebp,%edi
lea    0x10(%rsp),%rsi
mov    $0x1,%edx
call   1030 <recv@plt>
test   %eax,%eax
je     1410 <main+0x1f0>
jns    1480 <main+0x260>
movl   $0x0,0x10(%rsp)
jmp    1480 <main+0x260>
nopl   (%rax)
lea    0xc9d(%rip),%rdi
call   1040 <puts@plt>
lea    0xca6(%rip),%rdi
call   1040 <puts@plt>
mov    0x18(%rsp),%ebp
mov    %ebp,%edi
mov    $0x5,%esi
call   10c0 <listen@plt>
mov    %ebp,%edi
lea    0x50(%rsp),%rsi
lea    0x14(%rsp),%rdx
call   1110 <accept@plt>
cmp    $0xffffffff,%eax
je     145e <main+0x23e>
mov    %eax,%ebp
lea    0xc8a(%rip),%rdi
call   1040 <puts@plt>
jmp    1480 <main+0x260>
mov    0x2b5b(%rip),%rax
mov    (%rax),%edi
lea    0xc36(%rip),%rsi
call   10b0 <fprintf@plt>
mov    $0xffffffff,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1090 <SPI_IOC_MESSAGE@plt>
mov    %ebx,%edi
mov    %eax,%esi
lea    0x30(%rsp),%rdx
call   10a0 <ioctl@plt>
mov    0xc(%rsp),%eax
lea    0x1(%r15),%r13d
mov    %r15d,%ecx
mov    %al,0x60(%rsp,%rcx,1)
cmp    $0x9,%r12d
ja     13e0 <main+0x1c0>
mov    %r12d,%ecx
movslq (%r14,%rcx,4),%rcx
add    %r14,%rcx
jmp    *%rcx
mov    $0x1,%r12d
cmp    $0xb5,%eax
je     13e0 <main+0x1c0>
cmp    $0x24,%eax
jne    15cd <main+0x3ad>
mov    $0x9,%r12d
jmp    13e0 <main+0x1c0>
cmp    $0xa,%eax
jne    14fc <main+0x2dc>
mov    %ebp,%edi
lea    0x60(%rsp),%rsi
mov    %r13d,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
mov    0xc(%rsp),%eax
cmp    $0xa,%eax
sete   %al
cmp    $0x50,%r13d
setae  %cl
or     %al,%cl
mov    %ecx,%eax
xor    $0x1,%al
movzbl %al,%eax
lea    (%rax,%rax,8),%r12d
test   %cl,%cl
mov    $0x0,%eax
cmovne %eax,%r13d
jmp    13e0 <main+0x1c0>
mov    $0x3,%r12d
jmp    13e0 <main+0x1c0>
mov    $0x4,%r12d
jmp    13e0 <main+0x1c0>
mov    $0x8,%r12d
jmp    13e0 <main+0x1c0>
mov    $0x2,%r12d
cmp    $0x62,%eax
je     13e0 <main+0x1c0>
cmp    $0xb5,%eax
jne    15cd <main+0x3ad>
mov    $0x1,%r13d
xor    %r12d,%r12d
jmp    13e0 <main+0x1c0>
shl    $0x8,%eax
add    %eax,0x8(%rsp)
mov    $0x6,%r12d
jmp    13e0 <main+0x1c0>
movzwl 0x8(%rsp),%eax
add    $0x5,%eax
xor    %r12d,%r12d
cmp    %eax,%r15d
sete   %r12b
or     $0x6,%r12d
cmp    $0x3fe,%r13d
mov    $0x0,%eax
cmovae %eax,%r12d
cmovae %eax,%r13d
jmp    13e0 <main+0x1c0>
movzwl 0x8(%rsp),%edx
add    $0x8,%edx
xor    %r12d,%r12d
mov    %ebp,%edi
lea    0x60(%rsp),%rsi
xor    %ecx,%ecx
call   1070 <send@plt>
xor    %r13d,%r13d
jmp    13e0 <main+0x1c0>
xor    %r12d,%r12d
xor    %r13d,%r13d
jmp    13e0 <main+0x1c0>
lea    0xa8d(%rip),%rdi
call   1100 <perror@plt>
jmp    12c7 <main+0xa7>
mov    (%r14),%rsi
lea    0xa35(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.spi_ioc_transfer = type { i64, i64, i32, i32, i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [21 x i8] c"%s [tcp port number]\00"
@.str.1 = [15 x i8] c"/dev/spidev0.0\00"
@O_RDWR = global i32 0
@.str.2 = [17 x i8] c"open() SPI error\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.3 = [15 x i8] c"socket() error\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.4 = [11 x i8] c"setsockopt\00"
@INADDR_ANY = global i32 0
@.str.5 = [13 x i8] c"bind() error\00"
@.str.6 = [25 x i8] c"Waiting for connection.\0A\00"
@.str.7 = [15 x i8] c"listen() error\00"
@.str.8 = [17 x i8] c"Acception error.\00"
@.str.9 = [22 x i8] c"Connection accepted.\0A\00"
@MSG_DONTWAIT = global i32 0
@.str.10 = [22 x i8] c"Client disconnected.\0A\00"
@stderr = global i32 0
@.str.11 = [16 x i8] c"accept() error.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.sockaddr_in
%11 = alloca i32
%12 = alloca %struct.sockaddr_in
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca %struct.spi_ioc_transfer
%17 = alloca i32
%18 = alloca [1024 x i8]
%19 = alloca i32
%20 = alloca i16
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 2
br i1 %22, label %23, label %29
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %26)
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %2
%30 = load i32, i32* @O_RDWR
%31 = call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %30)
store i32 %31, i32* %7
%32 = load i32, i32* %7
%33 = icmp slt i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %29
%35 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %36
36: ; preds = %34, %29
%37 = load i32, i32* @AF_INET
%38 = load i32, i32* @SOCK_STREAM
%39 = call i32 @socket(i32 %37, i32 %38, i32 0)
store i32 %39, i32* %8
%40 = load i32, i32* %8
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %36
%43 = call i32 @error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %44
44: ; preds = %42, %36
store i32 1, i32* %9
%45 = load i32, i32* %8
%46 = load i32, i32* @SOL_SOCKET
%47 = load i32, i32* @SO_REUSEADDR
%48 = call i64 @setsockopt(i32 %45, i32 %46, i32 %47, i32* %9, i32 4)
%49 = icmp slt i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %44
%51 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %52
52: ; preds = %50, %44
%53 = bitcast %struct.sockaddr_in* %10 to i8*
%54 = load i32, i32* @AF_INET
%55 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 2
store i32 %54, i32* %55
%56 = load i32, i32* @INADDR_ANY
%57 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
%58 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %57, i32 0, i32 0
store i32 %56, i32* %58
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 1
%61 = load i8*, i8** %60
%62 = call i32 @atoi(i8* %61)
%63 = call i32 @htons(i32 %62)
%64 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
store i32 %63, i32* %64
%65 = load i32, i32* %8
%66 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%67 = call i32 @bind(i32 %65, %struct.sockaddr* %66, i32 16)
store i32 %67, i32* %6
%68 = load i32, i32* %6
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %72
70: ; preds = %52
%71 = call i32 @error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %72
72: ; preds = %70, %52
store i32 16, i32* %13
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
%74 = load i32, i32* %8
%75 = call i32 @listen(i32 %74, i32 5)
store i32 %75, i32* %6
%76 = load i32, i32* %6
%77 = icmp eq i32 %76, -1
br i1 %77, label %78, label %80
78: ; preds = %72
%79 = call i32 @error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
br label %80
80: ; preds = %78, %72
%81 = load i32, i32* %8
%82 = bitcast %struct.sockaddr_in* %12 to %struct.sockaddr*
%83 = call i32 @accept(i32 %81, %struct.sockaddr* %82, i32* %13)
store i32 %83, i32* %11
%84 = load i32, i32* %11
%85 = icmp eq i32 %84, -1
br i1 %85, label %86, label %88
86: ; preds = %80
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
br label %90
88: ; preds = %80
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
br label %90
90: ; preds = %88, %86
%91 = bitcast %struct.spi_ioc_transfer* %16 to i8*
%92 = ptrtoint i32* %14 to i64
%93 = getelementptr inbounds %struct.spi_ioc_transfer, %struct.spi_ioc_transfer* %16, i32 0, i32 0
store i64 %92, i64* %93
%94 = ptrtoint i32* %15 to i64
%95 = getelementptr inbounds %struct.spi_ioc_transfer, %struct.spi_ioc_transfer* %16, i32 0, i32 1
store i64 %94, i64* %95
%96 = getelementptr inbounds %struct.spi_ioc_transfer, %struct.spi_ioc_transfer* %16, i32 0, i32 2
store i32 1, i32* %96
%97 = getelementptr inbounds %struct.spi_ioc_transfer, %struct.spi_ioc_transfer* %16, i32 0, i32 3
store i32 245000, i32* %97
%98 = getelementptr inbounds %struct.spi_ioc_transfer, %struct.spi_ioc_transfer* %16, i32 0, i32 4
store i32 8, i32* %98
store i32 0, i32* %17
store i32 0, i32* %19
br label %99
99: ; preds = %90, %207
%100 = load i32, i32* %11
%101 = load i32, i32* @MSG_DONTWAIT
%102 = call i32 @recv(i32 %100, i32* %14, i32 1, i32 %101)
store i32 %102, i32* %6
%103 = load i32, i32* %6
%104 = icmp eq i32 %103, 0
br i1 %104, label %105, label %121
105: ; preds = %99
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
%108 = load i32, i32* %8
%109 = call i32 @listen(i32 %108, i32 5)
%110 = load i32, i32* %8
%111 = bitcast %struct.sockaddr_in* %12 to %struct.sockaddr*
%112 = call i32 @accept(i32 %110, %struct.sockaddr* %111, i32* %13)
store i32 %112, i32* %11
%113 = load i32, i32* %11
%114 = icmp eq i32 %113, -1
br i1 %114, label %115, label %118
115: ; preds = %105
%116 = load i32, i32* @stderr
%117 = call i32 @fprintf(i32 %116, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
br label %120
118: ; preds = %105
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
br label %120
120: ; preds = %118, %115
br label %121
121: ; preds = %120, %99
%122 = load i32, i32* %6
%123 = icmp slt i32 %122, 0
br i1 %123, label %124, label %125
124: ; preds = %121
store i32 0, i32* %14
br label %125
125: ; preds = %124, %121
%126 = load i32, i32* %7
%127 = call i32 @SPI_IOC_MESSAGE(i32 1)
%128 = call i32 @ioctl(i32 %126, i32 %127, %struct.spi_ioc_transfer* %16)
%129 = load i32, i32* %15
%130 = trunc i32 %129 to i8
%131 = load i32, i32* %19
%132 = add i32 %131, 1
store i32 %132, i32* %19
%133 = zext i32 %131 to i64
%134 = getelementptr inbounds [1024 x i8], [1024 x i8]* %18, i64 0, i64 %133
store i8 %130, i8* %134
%135 = load i32, i32* %17
switch i32 %135, label %207 [
i32 0, label %136
i32 1, label %147
i32 2, label %158
i32 3, label %159
i32 4, label %160
i32 5, label %163
i32 6, label %170
i32 7, label %182
i32 8, label %183
i32 9, label %191
]
136: ; preds = %125
%137 = load i32, i32* %15
%138 = icmp eq i32 %137, 181
br i1 %138, label %139, label %140
139: ; preds = %136
store i32 1, i32* %17
br label %146
140: ; preds = %136
%141 = load i32, i32* %15
%142 = icmp eq i32 %141, 36
br i1 %142, label %143, label %144
143: ; preds = %140
store i32 9, i32* %17
br label %145
144: ; preds = %140
store i32 0, i32* %17
store i32 0, i32* %19
br label %145
145: ; preds = %144, %143
br label %146
146: ; preds = %145, %139
br label %207
147: ; preds = %125
%148 = load i32, i32* %15
%149 = icmp eq i32 %148, 98
br i1 %149, label %150, label %151
150: ; preds = %147
store i32 2, i32* %17
br label %157
151: ; preds = %147
%152 = load i32, i32* %15
%153 = icmp eq i32 %152, 181
br i1 %153, label %154, label %155
154: ; preds = %151
store i32 0, i32* %17
store i32 1, i32* %19
br label %156
155: ; preds = %151
store i32 0, i32* %17
store i32 0, i32* %19
br label %156
156: ; preds = %155, %154
br label %157
157: ; preds = %156, %150
br label %207
158: ; preds = %125
store i32 3, i32* %17
br label %207
159: ; preds = %125
store i32 4, i32* %17
br label %207
160: ; preds = %125
%161 = load i32, i32* %15
%162 = trunc i32 %161 to i16
store i16 %162, i16* %20
store i32 5, i32* %17
br label %207
163: ; preds = %125
%164 = load i32, i32* %15
%165 = shl i32 %164, 8
%166 = load i16, i16* %20
%167 = zext i16 %166 to i32
%168 = add nsw i32 %167, %165
%169 = trunc i32 %168 to i16
store i16 %169, i16* %20
store i32 6, i32* %17
br label %207
170: ; preds = %125
%171 = load i32, i32* %19
%172 = load i16, i16* %20
%173 = zext i16 %172 to i32
%174 = add nsw i32 %173, 6
%175 = icmp eq i32 %171, %174
br i1 %175, label %176, label %177
176: ; preds = %170
store i32 7, i32* %17
br label %177
177: ; preds = %176, %170
%178 = load i32, i32* %19
%179 = icmp uge i32 %178, 1022
br i1 %179, label %180, label %181
180: ; preds = %177
store i32 0, i32* %17
store i32 0, i32* %19
br label %181
181: ; preds = %180, %177
br label %207
182: ; preds = %125
store i32 8, i32* %17
br label %207
183: ; preds = %125
%184 = load i32, i32* %11
%185 = getelementptr inbounds [1024 x i8], [1024 x i8]* %18, i64 0, i64 0
%186 = load i16, i16* %20
%187 = zext i16 %186 to i32
%188 = add nsw i32 6, %187
%189 = add nsw i32 %188, 2
%190 = call i32 @send(i32 %184, i8* %185, i32 %189, i32 0)
store i32 0, i32* %17
store i32 0, i32* %19
br label %207
191: ; preds = %125
%192 = load i32, i32* %15
%193 = icmp eq i32 %192, 10
br i1 %193, label %194, label %199
194: ; preds = %191
%195 = load i32, i32* %11
%196 = getelementptr inbounds [1024 x i8], [1024 x i8]* %18, i64 0, i64 0
%197 = load i32, i32* %19
%198 = call i32 @send(i32 %195, i8* %196, i32 %197, i32 0)
br label %199
199: ; preds = %194, %191
%200 = load i32, i32* %15
%201 = icmp eq i32 %200, 10
br i1 %201, label %205, label %202
202: ; preds = %199
%203 = load i32, i32* %19
%204 = icmp uge i32 %203, 80
br i1 %204, label %205, label %206
205: ; preds = %202, %199
store i32 0, i32* %17
store i32 0, i32* %19
br label %206
206: ; preds = %205, %202
br label %207
207: ; preds = %125, %206, %183, %182, %181, %163, %160, %159, %158, %157, %146
br label %99
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.spi_ioc_transfer = type { i64, i64, i32, i32, i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [21 x i8] c"%s [tcp port number]\00"
@.str.1 = [15 x i8] c"/dev/spidev0.0\00"
@O_RDWR = global i32 0
@.str.2 = [17 x i8] c"open() SPI error\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.3 = [15 x i8] c"socket() error\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.4 = [11 x i8] c"setsockopt\00"
@INADDR_ANY = global i32 0
@.str.5 = [13 x i8] c"bind() error\00"
@.str.7 = [15 x i8] c"listen() error\00"
@.str.8 = [17 x i8] c"Acception error.\00"
@MSG_DONTWAIT = global i32 0
@stderr = global i32 0
@.str.11 = [16 x i8] c"accept() error.\00"
@str.13 = [21 x i8] c"Client disconnected.\00"
@str.14 = [24 x i8] c"Waiting for connection.\00"
@str.15 = [21 x i8] c"Connection accepted.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.sockaddr_in
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.spi_ioc_transfer
%10 = alloca [1024 x i8]
%11 = icmp slt i32 %0, 2
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = load i8*, i8** %1
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = load i32, i32* @O_RDWR
%18 = tail call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = tail call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20, %16
%23 = load i32, i32* @AF_INET
%24 = load i32, i32* @SOCK_STREAM
%25 = tail call i32 @socket(i32 %23, i32 %24, i32 0)
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = tail call i32 @error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %27, %22
%30 = bitcast i32* %3 to i8*
store i32 1, i32* %3
%31 = load i32, i32* @SOL_SOCKET
%32 = load i32, i32* @SO_REUSEADDR
%33 = call i64 @setsockopt(i32 %25, i32 %31, i32 %32, i32* %3, i32 4)
%34 = icmp slt i64 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %29
%36 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %37
37: ; preds = %35, %29
%38 = bitcast %struct.sockaddr_in* %4 to i8*
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 3
store i32 0, i32* %39
%40 = load i32, i32* @AF_INET
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %40, i32* %41
%42 = load i32, i32* @INADDR_ANY
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1, i32 0
store i32 %42, i32* %43
%44 = getelementptr inbounds i8*, i8** %1, i64 1
%45 = load i8*, i8** %44
%46 = call i32 @atoi(i8* %45)
%47 = call i32 @htons(i32 %46)
%48 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
store i32 %47, i32* %48
%49 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%50 = call i32 @bind(i32 %25, %struct.sockaddr* %49, i32 16)
%51 = icmp eq i32 %50, -1
br i1 %51, label %52, label %54
52: ; preds = %37
%53 = call i32 @error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %54
54: ; preds = %52, %37
%55 = bitcast %struct.sockaddr_in* %5 to i8*
%56 = bitcast i32* %6 to i8*
store i32 16, i32* %6
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.14, i64 0, i64 0))
%58 = call i32 @listen(i32 %25, i32 5)
%59 = icmp eq i32 %58, -1
br i1 %59, label %60, label %62
60: ; preds = %54
%61 = call i32 @error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
br label %62
62: ; preds = %60, %54
%63 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%64 = call i32 @accept(i32 %25, %struct.sockaddr* %63, i32* %6)
%65 = icmp eq i32 %64, -1
br i1 %65, label %66, label %68
66: ; preds = %62
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
br label %70
68: ; preds = %62
%69 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.15, i64 0, i64 0))
br label %70
70: ; preds = %68, %66
%71 = bitcast i32* %7 to i8*
%72 = bitcast i32* %8 to i8*
%73 = bitcast %struct.spi_ioc_transfer* %9 to i8*
%74 = getelementptr inbounds %struct.spi_ioc_transfer, %struct.spi_ioc_transfer* %9, i64 0, i32 4
%75 = bitcast i32* %74 to i64*
store i64 0, i64* %75
%76 = ptrtoint i32* %7 to i64
%77 = getelementptr inbounds %struct.spi_ioc_transfer, %struct.spi_ioc_transfer* %9, i64 0, i32 0
store i64 %76, i64* %77
%78 = ptrtoint i32* %8 to i64
%79 = getelementptr inbounds %struct.spi_ioc_transfer, %struct.spi_ioc_transfer* %9, i64 0, i32 1
store i64 %78, i64* %79
%80 = getelementptr inbounds %struct.spi_ioc_transfer, %struct.spi_ioc_transfer* %9, i64 0, i32 2
store i32 1, i32* %80
%81 = getelementptr inbounds %struct.spi_ioc_transfer, %struct.spi_ioc_transfer* %9, i64 0, i32 3
store i32 245000, i32* %81
%82 = getelementptr inbounds %struct.spi_ioc_transfer, %struct.spi_ioc_transfer* %9, i64 0, i32 4
store i32 8, i32* %82
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
br label %84
84: ; preds = %137, %70
%85 = phi i32 [ %64, %70 ], [ %107, %137 ]
%86 = phi i32 [ 0, %70 ], [ %138, %137 ]
%87 = phi i32 [ 0, %70 ], [ %139, %137 ]
%88 = phi i16 [ undef, %70 ], [ %140, %137 ]
%89 = load i32, i32* @MSG_DONTWAIT
%90 = call i32 @recv(i32 %85, i32* %7, i32 1, i32 %89)
%91 = icmp eq i32 %90, 0
br i1 %91, label %92, label %103
92: ; preds = %84
%93 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.13, i64 0, i64 0))
%94 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.14, i64 0, i64 0))
%95 = call i32 @listen(i32 %25, i32 5)
%96 = call i32 @accept(i32 %25, %struct.sockaddr* %63, i32* %6)
%97 = icmp eq i32 %96, -1
br i1 %97, label %98, label %101
98: ; preds = %92
%99 = load i32, i32* @stderr
%100 = call i32 @fprintf(i32 %99, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
br label %106
101: ; preds = %92
%102 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.15, i64 0, i64 0))
br label %106
103: ; preds = %84
%104 = icmp slt i32 %90, 0
br i1 %104, label %105, label %106
105: ; preds = %103
store i32 0, i32* %7
br label %106
106: ; preds = %101, %98, %105, %103
%107 = phi i32 [ %85, %105 ], [ %85, %103 ], [ %96, %101 ], [ -1, %98 ]
%108 = call i32 @SPI_IOC_MESSAGE(i32 1)
%109 = call i32 @ioctl(i32 %18, i32 %108, %struct.spi_ioc_transfer* %9)
%110 = load i32, i32* %8
%111 = trunc i32 %110 to i8
%112 = add i32 %87, 1
%113 = zext i32 %87 to i64
%114 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 %113
store i8 %111, i8* %114
switch i32 %86, label %137 [
i32 0, label %115
i32 1, label %118
i32 2, label %121
i32 3, label %122
i32 4, label %123
i32 5, label %125
i32 6, label %129
i32 7, label %141
i32 8, label %142
i32 9, label %146
]
115: ; preds = %106
switch i32 %110, label %117 [
i32 181, label %137
i32 36, label %116
]
116: ; preds = %115
br label %137
117: ; preds = %115
br label %137
118: ; preds = %106
switch i32 %110, label %120 [
i32 98, label %137
i32 181, label %119
]
119: ; preds = %118
br label %137
120: ; preds = %118
br label %137
121: ; preds = %106
br label %137
122: ; preds = %106
br label %137
123: ; preds = %106
%124 = trunc i32 %110 to i16
br label %137
125: ; preds = %106
%126 = trunc i32 %110 to i16
%127 = shl i16 %126, 8
%128 = add i16 %127, %88
br label %137
129: ; preds = %106
%130 = zext i16 %88 to i32
%131 = add nuw nsw i32 %130, 5
%132 = icmp eq i32 %87, %131
%133 = select i1 %132, i32 7, i32 6
%134 = icmp ugt i32 %112, 1021
%135 = select i1 %134, i32 0, i32 %133
%136 = select i1 %134, i32 0, i32 %112
br label %137
137: ; preds = %129, %151, %118, %115, %120, %119, %117, %116, %106, %142, %141, %125, %123, %122, %121
%138 = phi i32 [ %135, %129 ], [ %156, %151 ], [ 2, %118 ], [ 1, %115 ], [ 0, %120 ], [ 0, %119 ], [ 0, %117 ], [ 9, %116 ], [ %86, %106 ], [ 0, %142 ], [ 8, %141 ], [ 6, %125 ], [ 5, %123 ], [ 4, %122 ], [ 3, %121 ]
%139 = phi i32 [ %136, %129 ], [ %157, %151 ], [ %112, %118 ], [ %112, %115 ], [ 0, %120 ], [ 1, %119 ], [ 0, %117 ], [ %112, %116 ], [ %112, %106 ], [ 0, %142 ], [ %112, %141 ], [ %112, %125 ], [ %112, %123 ], [ %112, %122 ], [ %112, %121 ]
%140 = phi i16 [ %88, %129 ], [ %88, %151 ], [ %88, %118 ], [ %88, %115 ], [ %88, %120 ], [ %88, %119 ], [ %88, %117 ], [ %88, %116 ], [ %88, %106 ], [ %88, %142 ], [ %88, %141 ], [ %128, %125 ], [ %124, %123 ], [ %88, %122 ], [ %88, %121 ]
br label %84
141: ; preds = %106
br label %137
142: ; preds = %106
%143 = zext i16 %88 to i32
%144 = add nuw nsw i32 %143, 8
%145 = call i32 @send(i32 %107, i8* %83, i32 %144, i32 0)
br label %137
146: ; preds = %106
%147 = icmp eq i32 %110, 10
br i1 %147, label %148, label %151
148: ; preds = %146
%149 = call i32 @send(i32 %107, i8* %83, i32 %112, i32 0)
%150 = load i32, i32* %8
br label %151
151: ; preds = %148, %146
%152 = phi i32 [ %150, %148 ], [ %110, %146 ]
%153 = icmp eq i32 %152, 10
%154 = icmp ugt i32 %112, 79
%155 = select i1 %153, i1 true, i1 %154
%156 = select i1 %155, i32 0, i32 9
%157 = select i1 %155, i32 0, i32 %112
br label %137
}