#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;
typedef int ssize_t;
typedef int /*<<< orphan*/ packet;

/* Variables and functions */
int /*<<< orphan*/ deinit_frame_buffer();
int /*<<< orphan*/ die(char *);
int get_udp_packet(int, char *, int);
int get_udp_socket(int);
int /*<<< orphan*/ init_frame_buffer();
int /*<<< orphan*/ write_pixel_to_screen(int, int, int, int, int, int);
int main(int argc, char *argv[]) {
  uint8_t packet[(8 * 140) + 32];
  ssize_t packet_size;
  uint16_t x, y;
  uint8_t r, g, b, a;
  uint8_t pixellength = 0, protocol, version;
  uint16_t i;
  uint8_t offset = 2;
  int sock_fd = get_udp_socket(5005);
  if (!init_frame_buffer()) {
    die("Failed to init screen buffer.\n");
  }
  while ((packet_size =
              get_udp_packet(sock_fd, (char *)&packet, sizeof(packet))) >= 0) {
    version = packet[1];
    protocol = packet[0];
    switch (protocol) {
    case 0:
      pixellength = 7;
      packet_size = (((offset + (pixellength * 140)) < (packet_size))
                         ? (offset + (pixellength * 140))
                         : (packet_size));
      for (i = offset; i < packet_size; i += pixellength) {
        x = packet[i] | packet[i + 1] << 8;
        y = packet[i + 2] | packet[i + 3] << 8;
        r = packet[i + 4];
        g = packet[i + 5];
        b = packet[i + 6];
        a = 0xFF;
        write_pixel_to_screen(x, y, r, g, b, a);
      }
      break;
    case 1:
      pixellength = 8;
      packet_size = (((offset + (pixellength * 140)) < (packet_size))
                         ? (offset + (pixellength * 140))
                         : (packet_size));
      for (i = offset; i < packet_size; i += pixellength) {
        x = packet[i] | packet[i + 1] << 8;
        y = packet[i + 2] | packet[i + 3] << 8;
        r = packet[i + 4];
        g = packet[i + 5];
        b = packet[i + 6];
        a = packet[i + 7];
        write_pixel_to_screen(x, y, r, g, b, a);
      }
      break;
    case 2:
      pixellength = 6;
      packet_size = (((offset + (pixellength * 140)) < (packet_size))
                         ? (offset + (pixellength * 140))
                         : (packet_size));
      for (i = offset; i < packet_size; i += pixellength) {
        x = packet[i] | (packet[i + 1] & 0xF0) << 4;
        y = (packet[i + 1] & 0x0F) | packet[i + 2] << 4;
        r = packet[i + 3];
        g = packet[i + 4];
        b = packet[i + 5];
        a = 0xFF;
        write_pixel_to_screen(x, y, r, g, b, a);
      }
      break;
    case 3:
      pixellength = 7;
      packet_size = (((offset + (pixellength * 140)) < (packet_size))
                         ? (offset + (pixellength * 140))
                         : (packet_size));
      for (i = offset; i < packet_size; i += pixellength) {
        x = packet[i] | (packet[i + 1] & 0xF0) << 4;
        y = (packet[i + 1] & 0x0F) | packet[i + 2] << 4;
        r = packet[i + 3];
        g = packet[i + 4];
        b = packet[i + 5];
        a = packet[i + 6];
        write_pixel_to_screen(x, y, r, g, b, a);
      }
      break;
    case 4:
      pixellength = 4;
      packet_size = (((offset + (pixellength * 140)) < (packet_size))
                         ? (offset + (pixellength * 140))
                         : (packet_size));
      for (i = offset; i < packet_size; i += pixellength) {
        x = packet[i] | (packet[i + 1] & 0xF0) << 4;
        y = (packet[i + 1] & 0x0F) | packet[i + 2] << 4;
        r = packet[i + 3] & 0xE0;
        g = packet[i + 3] << 3 & 0xE0;
        b = packet[i + 3] << 6 & 0xC0;
        a = 0xFF;
        write_pixel_to_screen(x, y, r, g, b, a);
      }
      break;
    case 5:
      pixellength = 4;
      packet_size = (((offset + (pixellength * 140)) < (packet_size))
                         ? (offset + (pixellength * 140))
                         : (packet_size));
      for (i = offset; i < packet_size; i += pixellength) {
        x = packet[i] | (packet[i + 1] & 0xF0) << 4;
        y = (packet[i + 1] & 0x0F) | packet[i + 2] << 4;
        r = packet[i + 3] & 0xC0;
        g = packet[i + 3] << 2 & 0xC0;
        b = packet[i + 3] << 4 & 0xC0;
        a = packet[i + 3] << 6 & 0xC0;
        write_pixel_to_screen(x, y, r, g, b, a);
      }
      break;
    default:
      break;
    }
  }
  deinit_frame_buffer();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1270,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1230(%rbp)
movl   $0x2,-0x1240(%rbp)
mov    $0x138d,%edi
call   1040 <get_udp_socket@plt>
mov    %eax,-0x1244(%rbp)
mov    $0x0,%al
call   1030 <init_frame_buffer@plt>
cmp    $0x0,%eax
jne    11b9 <main+0x59>
lea    0xe64(%rip),%rdi
call   1070 <die@plt>
jmp    11be <main+0x5e>
mov    -0x1244(%rbp),%edi
lea    -0x1210(%rbp),%rsi
mov    $0x1200,%edx
call   1060 <get_udp_packet@plt>
mov    %eax,-0x1214(%rbp)
cmp    $0x0,%eax
jl     1b54 <main+0x9f4>
mov    -0x120c(%rbp),%eax
mov    %eax,-0x1238(%rbp)
mov    -0x1210(%rbp),%eax
mov    %eax,-0x1234(%rbp)
mov    -0x1234(%rbp),%eax
mov    %rax,-0x1250(%rbp)
sub    $0x5,%rax
ja     1b4a <main+0x9ea>
mov    -0x1250(%rbp),%rax
lea    0xddf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x7,-0x1230(%rbp)
mov    -0x1240(%rbp),%eax
imul   $0x8c,-0x1230(%rbp),%ecx
add    %ecx,%eax
cmp    -0x1214(%rbp),%eax
jge    126f <main+0x10f>
mov    -0x1240(%rbp),%eax
imul   $0x8c,-0x1230(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x1254(%rbp)
jmp    127b <main+0x11b>
mov    -0x1214(%rbp),%eax
mov    %eax,-0x1254(%rbp)
mov    -0x1254(%rbp),%eax
mov    %eax,-0x1214(%rbp)
mov    -0x1240(%rbp),%eax
mov    %eax,-0x123c(%rbp)
mov    -0x123c(%rbp),%eax
cmp    -0x1214(%rbp),%eax
jge    1395 <main+0x235>
movslq -0x123c(%rbp),%rax
mov    -0x1210(%rbp,%rax,4),%eax
mov    -0x123c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    -0x1210(%rbp,%rcx,4),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x1218(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x2,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
mov    -0x123c(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    -0x1210(%rbp,%rcx,4),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x121c(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x4,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
mov    %eax,-0x1220(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x5,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
mov    %eax,-0x1224(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x6,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
mov    %eax,-0x1228(%rbp)
movl   $0xff,-0x122c(%rbp)
mov    -0x1218(%rbp),%edi
mov    -0x121c(%rbp),%esi
mov    -0x1220(%rbp),%edx
mov    -0x1224(%rbp),%ecx
mov    -0x1228(%rbp),%r8d
mov    -0x122c(%rbp),%r9d
call   1050 <write_pixel_to_screen@plt>
mov    -0x1230(%rbp),%eax
add    -0x123c(%rbp),%eax
mov    %eax,-0x123c(%rbp)
jmp    1293 <main+0x133>
jmp    1b4f <main+0x9ef>
movl   $0x8,-0x1230(%rbp)
mov    -0x1240(%rbp),%eax
imul   $0x8c,-0x1230(%rbp),%ecx
add    %ecx,%eax
cmp    -0x1214(%rbp),%eax
jge    13df <main+0x27f>
mov    -0x1240(%rbp),%eax
imul   $0x8c,-0x1230(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x1258(%rbp)
jmp    13eb <main+0x28b>
mov    -0x1214(%rbp),%eax
mov    %eax,-0x1258(%rbp)
mov    -0x1258(%rbp),%eax
mov    %eax,-0x1214(%rbp)
mov    -0x1240(%rbp),%eax
mov    %eax,-0x123c(%rbp)
mov    -0x123c(%rbp),%eax
cmp    -0x1214(%rbp),%eax
jge    1513 <main+0x3b3>
movslq -0x123c(%rbp),%rax
mov    -0x1210(%rbp,%rax,4),%eax
mov    -0x123c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    -0x1210(%rbp,%rcx,4),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x1218(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x2,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
mov    -0x123c(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    -0x1210(%rbp,%rcx,4),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x121c(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x4,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
mov    %eax,-0x1220(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x5,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
mov    %eax,-0x1224(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x6,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
mov    %eax,-0x1228(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x7,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
mov    %eax,-0x122c(%rbp)
mov    -0x1218(%rbp),%edi
mov    -0x121c(%rbp),%esi
mov    -0x1220(%rbp),%edx
mov    -0x1224(%rbp),%ecx
mov    -0x1228(%rbp),%r8d
mov    -0x122c(%rbp),%r9d
call   1050 <write_pixel_to_screen@plt>
mov    -0x1230(%rbp),%eax
add    -0x123c(%rbp),%eax
mov    %eax,-0x123c(%rbp)
jmp    1403 <main+0x2a3>
jmp    1b4f <main+0x9ef>
movl   $0x6,-0x1230(%rbp)
mov    -0x1240(%rbp),%eax
imul   $0x8c,-0x1230(%rbp),%ecx
add    %ecx,%eax
cmp    -0x1214(%rbp),%eax
jge    155d <main+0x3fd>
mov    -0x1240(%rbp),%eax
imul   $0x8c,-0x1230(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x125c(%rbp)
jmp    1569 <main+0x409>
mov    -0x1214(%rbp),%eax
mov    %eax,-0x125c(%rbp)
mov    -0x125c(%rbp),%eax
mov    %eax,-0x1214(%rbp)
mov    -0x1240(%rbp),%eax
mov    %eax,-0x123c(%rbp)
mov    -0x123c(%rbp),%eax
cmp    -0x1214(%rbp),%eax
jge    168c <main+0x52c>
movslq -0x123c(%rbp),%rax
mov    -0x1210(%rbp,%rax,4),%eax
mov    -0x123c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    -0x1210(%rbp,%rcx,4),%ecx
and    $0xf0,%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x1218(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
and    $0xf,%eax
mov    -0x123c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    -0x1210(%rbp,%rcx,4),%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x121c(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x3,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
mov    %eax,-0x1220(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x4,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
mov    %eax,-0x1224(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x5,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
mov    %eax,-0x1228(%rbp)
movl   $0xff,-0x122c(%rbp)
mov    -0x1218(%rbp),%edi
mov    -0x121c(%rbp),%esi
mov    -0x1220(%rbp),%edx
mov    -0x1224(%rbp),%ecx
mov    -0x1228(%rbp),%r8d
mov    -0x122c(%rbp),%r9d
call   1050 <write_pixel_to_screen@plt>
mov    -0x1230(%rbp),%eax
add    -0x123c(%rbp),%eax
mov    %eax,-0x123c(%rbp)
jmp    1581 <main+0x421>
jmp    1b4f <main+0x9ef>
movl   $0x7,-0x1230(%rbp)
mov    -0x1240(%rbp),%eax
imul   $0x8c,-0x1230(%rbp),%ecx
add    %ecx,%eax
cmp    -0x1214(%rbp),%eax
jge    16d6 <main+0x576>
mov    -0x1240(%rbp),%eax
imul   $0x8c,-0x1230(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x1260(%rbp)
jmp    16e2 <main+0x582>
mov    -0x1214(%rbp),%eax
mov    %eax,-0x1260(%rbp)
mov    -0x1260(%rbp),%eax
mov    %eax,-0x1214(%rbp)
mov    -0x1240(%rbp),%eax
mov    %eax,-0x123c(%rbp)
mov    -0x123c(%rbp),%eax
cmp    -0x1214(%rbp),%eax
jge    1813 <main+0x6b3>
movslq -0x123c(%rbp),%rax
mov    -0x1210(%rbp,%rax,4),%eax
mov    -0x123c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    -0x1210(%rbp,%rcx,4),%ecx
and    $0xf0,%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x1218(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
and    $0xf,%eax
mov    -0x123c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    -0x1210(%rbp,%rcx,4),%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x121c(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x3,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
mov    %eax,-0x1220(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x4,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
mov    %eax,-0x1224(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x5,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
mov    %eax,-0x1228(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x6,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
mov    %eax,-0x122c(%rbp)
mov    -0x1218(%rbp),%edi
mov    -0x121c(%rbp),%esi
mov    -0x1220(%rbp),%edx
mov    -0x1224(%rbp),%ecx
mov    -0x1228(%rbp),%r8d
mov    -0x122c(%rbp),%r9d
call   1050 <write_pixel_to_screen@plt>
mov    -0x1230(%rbp),%eax
add    -0x123c(%rbp),%eax
mov    %eax,-0x123c(%rbp)
jmp    16fa <main+0x59a>
jmp    1b4f <main+0x9ef>
movl   $0x4,-0x1230(%rbp)
mov    -0x1240(%rbp),%eax
imul   $0x8c,-0x1230(%rbp),%ecx
add    %ecx,%eax
cmp    -0x1214(%rbp),%eax
jge    185d <main+0x6fd>
mov    -0x1240(%rbp),%eax
imul   $0x8c,-0x1230(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x1264(%rbp)
jmp    1869 <main+0x709>
mov    -0x1214(%rbp),%eax
mov    %eax,-0x1264(%rbp)
mov    -0x1264(%rbp),%eax
mov    %eax,-0x1214(%rbp)
mov    -0x1240(%rbp),%eax
mov    %eax,-0x123c(%rbp)
mov    -0x123c(%rbp),%eax
cmp    -0x1214(%rbp),%eax
jge    19a1 <main+0x841>
movslq -0x123c(%rbp),%rax
mov    -0x1210(%rbp,%rax,4),%eax
mov    -0x123c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    -0x1210(%rbp,%rcx,4),%ecx
and    $0xf0,%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x1218(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
and    $0xf,%eax
mov    -0x123c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    -0x1210(%rbp,%rcx,4),%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x121c(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x3,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
and    $0xe0,%eax
mov    %eax,-0x1220(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x3,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
shl    $0x3,%eax
and    $0xe0,%eax
mov    %eax,-0x1224(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x3,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
shl    $0x6,%eax
and    $0xc0,%eax
mov    %eax,-0x1228(%rbp)
movl   $0xff,-0x122c(%rbp)
mov    -0x1218(%rbp),%edi
mov    -0x121c(%rbp),%esi
mov    -0x1220(%rbp),%edx
mov    -0x1224(%rbp),%ecx
mov    -0x1228(%rbp),%r8d
mov    -0x122c(%rbp),%r9d
call   1050 <write_pixel_to_screen@plt>
mov    -0x1230(%rbp),%eax
add    -0x123c(%rbp),%eax
mov    %eax,-0x123c(%rbp)
jmp    1881 <main+0x721>
jmp    1b4f <main+0x9ef>
movl   $0x4,-0x1230(%rbp)
mov    -0x1240(%rbp),%eax
imul   $0x8c,-0x1230(%rbp),%ecx
add    %ecx,%eax
cmp    -0x1214(%rbp),%eax
jge    19eb <main+0x88b>
mov    -0x1240(%rbp),%eax
imul   $0x8c,-0x1230(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x1268(%rbp)
jmp    19f7 <main+0x897>
mov    -0x1214(%rbp),%eax
mov    %eax,-0x1268(%rbp)
mov    -0x1268(%rbp),%eax
mov    %eax,-0x1214(%rbp)
mov    -0x1240(%rbp),%eax
mov    %eax,-0x123c(%rbp)
mov    -0x123c(%rbp),%eax
cmp    -0x1214(%rbp),%eax
jge    1b45 <main+0x9e5>
movslq -0x123c(%rbp),%rax
mov    -0x1210(%rbp,%rax,4),%eax
mov    -0x123c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    -0x1210(%rbp,%rcx,4),%ecx
and    $0xf0,%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x1218(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
and    $0xf,%eax
mov    -0x123c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    -0x1210(%rbp,%rcx,4),%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,-0x121c(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x3,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
and    $0xc0,%eax
mov    %eax,-0x1220(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x3,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
shl    $0x2,%eax
and    $0xc0,%eax
mov    %eax,-0x1224(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x3,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
shl    $0x4,%eax
and    $0xc0,%eax
mov    %eax,-0x1228(%rbp)
mov    -0x123c(%rbp),%eax
add    $0x3,%eax
cltq
mov    -0x1210(%rbp,%rax,4),%eax
shl    $0x6,%eax
and    $0xc0,%eax
mov    %eax,-0x122c(%rbp)
mov    -0x1218(%rbp),%edi
mov    -0x121c(%rbp),%esi
mov    -0x1220(%rbp),%edx
mov    -0x1224(%rbp),%ecx
mov    -0x1228(%rbp),%r8d
mov    -0x122c(%rbp),%r9d
call   1050 <write_pixel_to_screen@plt>
mov    -0x1230(%rbp),%eax
add    -0x123c(%rbp),%eax
mov    %eax,-0x123c(%rbp)
jmp    1a0f <main+0x8af>
jmp    1b4f <main+0x9ef>
jmp    1b4f <main+0x9ef>
jmp    11be <main+0x5e>
mov    $0x0,%al
call   1080 <deinit_frame_buffer@plt>
xor    %eax,%eax
add    $0x1270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1208,%rsp
mov    $0x138d,%edi
call   1040 <get_udp_socket@plt>
mov    %eax,%r12d
xor    %eax,%eax
call   1030 <init_frame_buffer@plt>
test   %eax,%eax
jne    1195 <main+0x35>
lea    0xe88(%rip),%rdi
call   1070 <die@plt>
mov    %rsp,%rsi
mov    %r12d,%edi
mov    $0x1200,%edx
call   1060 <get_udp_packet@plt>
test   %eax,%eax
js     1467 <main+0x307>
mov    %rsp,%r14
lea    0xe49(%rip),%r15
jmp    11d8 <main+0x78>
nopl   0x0(%rax)
mov    %r12d,%edi
mov    %r14,%rsi
mov    $0x1200,%edx
call   1060 <get_udp_packet@plt>
test   %eax,%eax
js     1467 <main+0x307>
mov    (%rsp),%ecx
cmp    $0x5,%rcx
ja     11c0 <main+0x60>
movslq (%r15,%rcx,4),%rcx
add    %r15,%rcx
jmp    *%rcx
cmp    $0x3d6,%eax
mov    $0x3d6,%ecx
cmovae %ecx,%eax
cmp    $0x3,%eax
jb     11c0 <main+0x60>
mov    %eax,%ebx
mov    $0x2,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x4(%rsp,%rbp,4),%edi
shl    $0x8,%edi
or     (%rsp,%rbp,4),%edi
mov    0xc(%rsp,%rbp,4),%esi
shl    $0x8,%esi
or     0x8(%rsp,%rbp,4),%esi
mov    0x10(%rsp,%rbp,4),%edx
mov    0x14(%rsp,%rbp,4),%ecx
mov    0x18(%rsp,%rbp,4),%r8d
mov    $0xff,%r9d
call   1050 <write_pixel_to_screen@plt>
add    $0x7,%rbp
cmp    %rbx,%rbp
jb     1210 <main+0xb0>
jmp    11c0 <main+0x60>
cmp    $0x462,%eax
mov    $0x462,%ecx
cmovae %ecx,%eax
cmp    $0x3,%eax
jb     11c0 <main+0x60>
mov    %eax,%ebx
mov    $0x2,%ebp
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp,%rbp,4),%edi
shl    $0x8,%edi
or     (%rsp,%rbp,4),%edi
mov    0xc(%rsp,%rbp,4),%esi
shl    $0x8,%esi
or     0x8(%rsp,%rbp,4),%esi
mov    0x10(%rsp,%rbp,4),%edx
mov    0x14(%rsp,%rbp,4),%ecx
mov    0x18(%rsp,%rbp,4),%r8d
mov    0x1c(%rsp,%rbp,4),%r9d
call   1050 <write_pixel_to_screen@plt>
add    $0x8,%rbp
cmp    %rbx,%rbp
jb     1270 <main+0x110>
jmp    11c0 <main+0x60>
cmp    $0x34a,%eax
mov    $0x34a,%ecx
cmovae %ecx,%eax
cmp    $0x3,%eax
jb     11c0 <main+0x60>
mov    %eax,%ebx
mov    $0x2,%ebp
nopw   0x0(%rax,%rax,1)
mov    0x4(%rsp,%rbp,4),%eax
mov    0x8(%rsp,%rbp,4),%esi
mov    %eax,%edi
shl    $0x4,%edi
and    $0xf00,%edi
or     (%rsp,%rbp,4),%edi
and    $0xf,%eax
shl    $0x4,%esi
or     %eax,%esi
mov    0xc(%rsp,%rbp,4),%edx
mov    0x10(%rsp,%rbp,4),%ecx
mov    0x14(%rsp,%rbp,4),%r8d
mov    $0xff,%r9d
call   1050 <write_pixel_to_screen@plt>
add    $0x6,%rbp
cmp    %rbx,%rbp
jb     12d0 <main+0x170>
jmp    11c0 <main+0x60>
cmp    $0x3d6,%eax
mov    $0x3d6,%ecx
cmovae %ecx,%eax
cmp    $0x3,%eax
jb     11c0 <main+0x60>
mov    %eax,%ebx
mov    $0x2,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp,%rbp,4),%eax
mov    %eax,%edi
shl    $0x4,%edi
and    $0xf00,%edi
or     (%rsp,%rbp,4),%edi
mov    0x8(%rsp,%rbp,4),%esi
and    $0xf,%eax
shl    $0x4,%esi
or     %eax,%esi
mov    0xc(%rsp,%rbp,4),%edx
mov    0x10(%rsp,%rbp,4),%ecx
mov    0x14(%rsp,%rbp,4),%r8d
mov    0x18(%rsp,%rbp,4),%r9d
call   1050 <write_pixel_to_screen@plt>
add    $0x7,%rbp
cmp    %rbx,%rbp
jb     1340 <main+0x1e0>
jmp    11c0 <main+0x60>
cmp    $0x232,%eax
mov    $0x232,%ecx
cmovae %ecx,%eax
cmp    $0x3,%eax
jb     11c0 <main+0x60>
mov    %eax,%ebp
mov    $0x2,%ebx
mov    0x4(%rsp,%rbx,4),%eax
mov    0x8(%rsp,%rbx,4),%esi
mov    %eax,%edi
shl    $0x4,%edi
and    $0xf00,%edi
or     (%rsp,%rbx,4),%edi
and    $0xf,%eax
shl    $0x4,%esi
or     %eax,%esi
mov    0xc(%rsp,%rbx,4),%eax
mov    %eax,%edx
and    $0xe0,%edx
mov    %eax,%ecx
and    $0x1c,%ecx
shl    $0x3,%ecx
shl    $0x6,%eax
movzbl %al,%r8d
mov    $0xff,%r9d
call   1050 <write_pixel_to_screen@plt>
add    $0x4,%rbx
cmp    %rbp,%rbx
jb     13a0 <main+0x240>
jmp    11c0 <main+0x60>
cmp    $0x232,%eax
mov    $0x232,%ecx
cmovae %ecx,%eax
cmp    $0x3,%eax
jb     11c0 <main+0x60>
mov    %eax,%r13d
mov    $0x2,%ebp
mov    0x4(%rsp,%rbp,4),%eax
mov    %eax,%edi
shl    $0x4,%edi
and    $0xf00,%edi
or     (%rsp,%rbp,4),%edi
mov    0x8(%rsp,%rbp,4),%esi
and    $0xf,%eax
shl    $0x4,%esi
or     %eax,%esi
mov    0xc(%rsp,%rbp,4),%eax
mov    %eax,%edx
and    $0xc0,%edx
mov    %eax,%ecx
and    $0x30,%ecx
shl    $0x2,%ecx
mov    %eax,%r8d
and    $0xc,%r8d
shl    $0x4,%r8d
shl    $0x6,%eax
movzbl %al,%r9d
call   1050 <write_pixel_to_screen@plt>
add    $0x4,%rbp
cmp    %r13,%rbp
jb     1410 <main+0x2b0>
jmp    11c0 <main+0x60>
xor    %eax,%eax
call   1080 <deinit_frame_buffer@plt>
xor    %eax,%eax
add    $0x1208,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Failed to init screen buffer.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1152 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %14
store i32 2, i32* %18
%20 = call i32 @get_udp_socket(i32 5005)
store i32 %20, i32* %19
%21 = call i32 (...) @init_frame_buffer()
%22 = icmp ne i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %2
%24 = call i32 @die(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %25
25: ; preds = %23, %2
br label %26
26: ; preds = %505, %25
%27 = load i32, i32* %19
%28 = bitcast [1152 x i32]* %6 to i8*
%29 = call i32 @get_udp_packet(i32 %27, i8* %28, i32 4608)
store i32 %29, i32* %7
%30 = icmp sge i32 %29, 0
br i1 %30, label %31, label %506
31: ; preds = %26
%32 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 1
%33 = load i32, i32* %32
store i32 %33, i32* %16
%34 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 0
%35 = load i32, i32* %34
store i32 %35, i32* %15
%36 = load i32, i32* %15
switch i32 %36, label %504 [
i32 0, label %37
i32 1, label %109
i32 2, label %186
i32 3, label %260
i32 4, label %339
i32 5, label %418
]
37: ; preds = %31
store i32 7, i32* %14
%38 = load i32, i32* %18
%39 = load i32, i32* %14
%40 = mul nsw i32 %39, 140
%41 = add nsw i32 %38, %40
%42 = load i32, i32* %7
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %49
44: ; preds = %37
%45 = load i32, i32* %18
%46 = load i32, i32* %14
%47 = mul nsw i32 %46, 140
%48 = add nsw i32 %45, %47
br label %51
49: ; preds = %37
%50 = load i32, i32* %7
br label %51
51: ; preds = %49, %44
%52 = phi i32 [ %48, %44 ], [ %50, %49 ]
store i32 %52, i32* %7
%53 = load i32, i32* %18
store i32 %53, i32* %17
br label %54
54: ; preds = %104, %51
%55 = load i32, i32* %17
%56 = load i32, i32* %7
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %108
58: ; preds = %54
%59 = load i32, i32* %17
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %60
%62 = load i32, i32* %61
%63 = load i32, i32* %17
%64 = add nsw i32 %63, 1
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %65
%67 = load i32, i32* %66
%68 = shl i32 %67, 8
%69 = or i32 %62, %68
store i32 %69, i32* %8
%70 = load i32, i32* %17
%71 = add nsw i32 %70, 2
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %72
%74 = load i32, i32* %73
%75 = load i32, i32* %17
%76 = add nsw i32 %75, 3
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %77
%79 = load i32, i32* %78
%80 = shl i32 %79, 8
%81 = or i32 %74, %80
store i32 %81, i32* %9
%82 = load i32, i32* %17
%83 = add nsw i32 %82, 4
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %84
%86 = load i32, i32* %85
store i32 %86, i32* %10
%87 = load i32, i32* %17
%88 = add nsw i32 %87, 5
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %89
%91 = load i32, i32* %90
store i32 %91, i32* %11
%92 = load i32, i32* %17
%93 = add nsw i32 %92, 6
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %94
%96 = load i32, i32* %95
store i32 %96, i32* %12
store i32 255, i32* %13
%97 = load i32, i32* %8
%98 = load i32, i32* %9
%99 = load i32, i32* %10
%100 = load i32, i32* %11
%101 = load i32, i32* %12
%102 = load i32, i32* %13
%103 = call i32 @write_pixel_to_screen(i32 %97, i32 %98, i32 %99, i32 %100, i32 %101, i32 %102)
br label %104
104: ; preds = %58
%105 = load i32, i32* %14
%106 = load i32, i32* %17
%107 = add nsw i32 %106, %105
store i32 %107, i32* %17
br label %54
108: ; preds = %54
br label %505
109: ; preds = %31
store i32 8, i32* %14
%110 = load i32, i32* %18
%111 = load i32, i32* %14
%112 = mul nsw i32 %111, 140
%113 = add nsw i32 %110, %112
%114 = load i32, i32* %7
%115 = icmp slt i32 %113, %114
br i1 %115, label %116, label %121
116: ; preds = %109
%117 = load i32, i32* %18
%118 = load i32, i32* %14
%119 = mul nsw i32 %118, 140
%120 = add nsw i32 %117, %119
br label %123
121: ; preds = %109
%122 = load i32, i32* %7
br label %123
123: ; preds = %121, %116
%124 = phi i32 [ %120, %116 ], [ %122, %121 ]
store i32 %124, i32* %7
%125 = load i32, i32* %18
store i32 %125, i32* %17
br label %126
126: ; preds = %181, %123
%127 = load i32, i32* %17
%128 = load i32, i32* %7
%129 = icmp slt i32 %127, %128
br i1 %129, label %130, label %185
130: ; preds = %126
%131 = load i32, i32* %17
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %132
%134 = load i32, i32* %133
%135 = load i32, i32* %17
%136 = add nsw i32 %135, 1
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %137
%139 = load i32, i32* %138
%140 = shl i32 %139, 8
%141 = or i32 %134, %140
store i32 %141, i32* %8
%142 = load i32, i32* %17
%143 = add nsw i32 %142, 2
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %144
%146 = load i32, i32* %145
%147 = load i32, i32* %17
%148 = add nsw i32 %147, 3
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %149
%151 = load i32, i32* %150
%152 = shl i32 %151, 8
%153 = or i32 %146, %152
store i32 %153, i32* %9
%154 = load i32, i32* %17
%155 = add nsw i32 %154, 4
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %156
%158 = load i32, i32* %157
store i32 %158, i32* %10
%159 = load i32, i32* %17
%160 = add nsw i32 %159, 5
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %161
%163 = load i32, i32* %162
store i32 %163, i32* %11
%164 = load i32, i32* %17
%165 = add nsw i32 %164, 6
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %166
%168 = load i32, i32* %167
store i32 %168, i32* %12
%169 = load i32, i32* %17
%170 = add nsw i32 %169, 7
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %171
%173 = load i32, i32* %172
store i32 %173, i32* %13
%174 = load i32, i32* %8
%175 = load i32, i32* %9
%176 = load i32, i32* %10
%177 = load i32, i32* %11
%178 = load i32, i32* %12
%179 = load i32, i32* %13
%180 = call i32 @write_pixel_to_screen(i32 %174, i32 %175, i32 %176, i32 %177, i32 %178, i32 %179)
br label %181
181: ; preds = %130
%182 = load i32, i32* %14
%183 = load i32, i32* %17
%184 = add nsw i32 %183, %182
store i32 %184, i32* %17
br label %126
185: ; preds = %126
br label %505
186: ; preds = %31
store i32 6, i32* %14
%187 = load i32, i32* %18
%188 = load i32, i32* %14
%189 = mul nsw i32 %188, 140
%190 = add nsw i32 %187, %189
%191 = load i32, i32* %7
%192 = icmp slt i32 %190, %191
br i1 %192, label %193, label %198
193: ; preds = %186
%194 = load i32, i32* %18
%195 = load i32, i32* %14
%196 = mul nsw i32 %195, 140
%197 = add nsw i32 %194, %196
br label %200
198: ; preds = %186
%199 = load i32, i32* %7
br label %200
200: ; preds = %198, %193
%201 = phi i32 [ %197, %193 ], [ %199, %198 ]
store i32 %201, i32* %7
%202 = load i32, i32* %18
store i32 %202, i32* %17
br label %203
203: ; preds = %255, %200
%204 = load i32, i32* %17
%205 = load i32, i32* %7
%206 = icmp slt i32 %204, %205
br i1 %206, label %207, label %259
207: ; preds = %203
%208 = load i32, i32* %17
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %209
%211 = load i32, i32* %210
%212 = load i32, i32* %17
%213 = add nsw i32 %212, 1
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %214
%216 = load i32, i32* %215
%217 = and i32 %216, 240
%218 = shl i32 %217, 4
%219 = or i32 %211, %218
store i32 %219, i32* %8
%220 = load i32, i32* %17
%221 = add nsw i32 %220, 1
%222 = sext i32 %221 to i64
%223 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %222
%224 = load i32, i32* %223
%225 = and i32 %224, 15
%226 = load i32, i32* %17
%227 = add nsw i32 %226, 2
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %228
%230 = load i32, i32* %229
%231 = shl i32 %230, 4
%232 = or i32 %225, %231
store i32 %232, i32* %9
%233 = load i32, i32* %17
%234 = add nsw i32 %233, 3
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %235
%237 = load i32, i32* %236
store i32 %237, i32* %10
%238 = load i32, i32* %17
%239 = add nsw i32 %238, 4
%240 = sext i32 %239 to i64
%241 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %240
%242 = load i32, i32* %241
store i32 %242, i32* %11
%243 = load i32, i32* %17
%244 = add nsw i32 %243, 5
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %245
%247 = load i32, i32* %246
store i32 %247, i32* %12
store i32 255, i32* %13
%248 = load i32, i32* %8
%249 = load i32, i32* %9
%250 = load i32, i32* %10
%251 = load i32, i32* %11
%252 = load i32, i32* %12
%253 = load i32, i32* %13
%254 = call i32 @write_pixel_to_screen(i32 %248, i32 %249, i32 %250, i32 %251, i32 %252, i32 %253)
br label %255
255: ; preds = %207
%256 = load i32, i32* %14
%257 = load i32, i32* %17
%258 = add nsw i32 %257, %256
store i32 %258, i32* %17
br label %203
259: ; preds = %203
br label %505
260: ; preds = %31
store i32 7, i32* %14
%261 = load i32, i32* %18
%262 = load i32, i32* %14
%263 = mul nsw i32 %262, 140
%264 = add nsw i32 %261, %263
%265 = load i32, i32* %7
%266 = icmp slt i32 %264, %265
br i1 %266, label %267, label %272
267: ; preds = %260
%268 = load i32, i32* %18
%269 = load i32, i32* %14
%270 = mul nsw i32 %269, 140
%271 = add nsw i32 %268, %270
br label %274
272: ; preds = %260
%273 = load i32, i32* %7
br label %274
274: ; preds = %272, %267
%275 = phi i32 [ %271, %267 ], [ %273, %272 ]
store i32 %275, i32* %7
%276 = load i32, i32* %18
store i32 %276, i32* %17
br label %277
277: ; preds = %334, %274
%278 = load i32, i32* %17
%279 = load i32, i32* %7
%280 = icmp slt i32 %278, %279
br i1 %280, label %281, label %338
281: ; preds = %277
%282 = load i32, i32* %17
%283 = sext i32 %282 to i64
%284 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %283
%285 = load i32, i32* %284
%286 = load i32, i32* %17
%287 = add nsw i32 %286, 1
%288 = sext i32 %287 to i64
%289 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %288
%290 = load i32, i32* %289
%291 = and i32 %290, 240
%292 = shl i32 %291, 4
%293 = or i32 %285, %292
store i32 %293, i32* %8
%294 = load i32, i32* %17
%295 = add nsw i32 %294, 1
%296 = sext i32 %295 to i64
%297 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %296
%298 = load i32, i32* %297
%299 = and i32 %298, 15
%300 = load i32, i32* %17
%301 = add nsw i32 %300, 2
%302 = sext i32 %301 to i64
%303 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %302
%304 = load i32, i32* %303
%305 = shl i32 %304, 4
%306 = or i32 %299, %305
store i32 %306, i32* %9
%307 = load i32, i32* %17
%308 = add nsw i32 %307, 3
%309 = sext i32 %308 to i64
%310 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %309
%311 = load i32, i32* %310
store i32 %311, i32* %10
%312 = load i32, i32* %17
%313 = add nsw i32 %312, 4
%314 = sext i32 %313 to i64
%315 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %314
%316 = load i32, i32* %315
store i32 %316, i32* %11
%317 = load i32, i32* %17
%318 = add nsw i32 %317, 5
%319 = sext i32 %318 to i64
%320 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %319
%321 = load i32, i32* %320
store i32 %321, i32* %12
%322 = load i32, i32* %17
%323 = add nsw i32 %322, 6
%324 = sext i32 %323 to i64
%325 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %324
%326 = load i32, i32* %325
store i32 %326, i32* %13
%327 = load i32, i32* %8
%328 = load i32, i32* %9
%329 = load i32, i32* %10
%330 = load i32, i32* %11
%331 = load i32, i32* %12
%332 = load i32, i32* %13
%333 = call i32 @write_pixel_to_screen(i32 %327, i32 %328, i32 %329, i32 %330, i32 %331, i32 %332)
br label %334
334: ; preds = %281
%335 = load i32, i32* %14
%336 = load i32, i32* %17
%337 = add nsw i32 %336, %335
store i32 %337, i32* %17
br label %277
338: ; preds = %277
br label %505
339: ; preds = %31
store i32 4, i32* %14
%340 = load i32, i32* %18
%341 = load i32, i32* %14
%342 = mul nsw i32 %341, 140
%343 = add nsw i32 %340, %342
%344 = load i32, i32* %7
%345 = icmp slt i32 %343, %344
br i1 %345, label %346, label %351
346: ; preds = %339
%347 = load i32, i32* %18
%348 = load i32, i32* %14
%349 = mul nsw i32 %348, 140
%350 = add nsw i32 %347, %349
br label %353
351: ; preds = %339
%352 = load i32, i32* %7
br label %353
353: ; preds = %351, %346
%354 = phi i32 [ %350, %346 ], [ %352, %351 ]
store i32 %354, i32* %7
%355 = load i32, i32* %18
store i32 %355, i32* %17
br label %356
356: ; preds = %413, %353
%357 = load i32, i32* %17
%358 = load i32, i32* %7
%359 = icmp slt i32 %357, %358
br i1 %359, label %360, label %417
360: ; preds = %356
%361 = load i32, i32* %17
%362 = sext i32 %361 to i64
%363 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %362
%364 = load i32, i32* %363
%365 = load i32, i32* %17
%366 = add nsw i32 %365, 1
%367 = sext i32 %366 to i64
%368 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %367
%369 = load i32, i32* %368
%370 = and i32 %369, 240
%371 = shl i32 %370, 4
%372 = or i32 %364, %371
store i32 %372, i32* %8
%373 = load i32, i32* %17
%374 = add nsw i32 %373, 1
%375 = sext i32 %374 to i64
%376 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %375
%377 = load i32, i32* %376
%378 = and i32 %377, 15
%379 = load i32, i32* %17
%380 = add nsw i32 %379, 2
%381 = sext i32 %380 to i64
%382 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %381
%383 = load i32, i32* %382
%384 = shl i32 %383, 4
%385 = or i32 %378, %384
store i32 %385, i32* %9
%386 = load i32, i32* %17
%387 = add nsw i32 %386, 3
%388 = sext i32 %387 to i64
%389 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %388
%390 = load i32, i32* %389
%391 = and i32 %390, 224
store i32 %391, i32* %10
%392 = load i32, i32* %17
%393 = add nsw i32 %392, 3
%394 = sext i32 %393 to i64
%395 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %394
%396 = load i32, i32* %395
%397 = shl i32 %396, 3
%398 = and i32 %397, 224
store i32 %398, i32* %11
%399 = load i32, i32* %17
%400 = add nsw i32 %399, 3
%401 = sext i32 %400 to i64
%402 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %401
%403 = load i32, i32* %402
%404 = shl i32 %403, 6
%405 = and i32 %404, 192
store i32 %405, i32* %12
store i32 255, i32* %13
%406 = load i32, i32* %8
%407 = load i32, i32* %9
%408 = load i32, i32* %10
%409 = load i32, i32* %11
%410 = load i32, i32* %12
%411 = load i32, i32* %13
%412 = call i32 @write_pixel_to_screen(i32 %406, i32 %407, i32 %408, i32 %409, i32 %410, i32 %411)
br label %413
413: ; preds = %360
%414 = load i32, i32* %14
%415 = load i32, i32* %17
%416 = add nsw i32 %415, %414
store i32 %416, i32* %17
br label %356
417: ; preds = %356
br label %505
418: ; preds = %31
store i32 4, i32* %14
%419 = load i32, i32* %18
%420 = load i32, i32* %14
%421 = mul nsw i32 %420, 140
%422 = add nsw i32 %419, %421
%423 = load i32, i32* %7
%424 = icmp slt i32 %422, %423
br i1 %424, label %425, label %430
425: ; preds = %418
%426 = load i32, i32* %18
%427 = load i32, i32* %14
%428 = mul nsw i32 %427, 140
%429 = add nsw i32 %426, %428
br label %432
430: ; preds = %418
%431 = load i32, i32* %7
br label %432
432: ; preds = %430, %425
%433 = phi i32 [ %429, %425 ], [ %431, %430 ]
store i32 %433, i32* %7
%434 = load i32, i32* %18
store i32 %434, i32* %17
br label %435
435: ; preds = %499, %432
%436 = load i32, i32* %17
%437 = load i32, i32* %7
%438 = icmp slt i32 %436, %437
br i1 %438, label %439, label %503
439: ; preds = %435
%440 = load i32, i32* %17
%441 = sext i32 %440 to i64
%442 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %441
%443 = load i32, i32* %442
%444 = load i32, i32* %17
%445 = add nsw i32 %444, 1
%446 = sext i32 %445 to i64
%447 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %446
%448 = load i32, i32* %447
%449 = and i32 %448, 240
%450 = shl i32 %449, 4
%451 = or i32 %443, %450
store i32 %451, i32* %8
%452 = load i32, i32* %17
%453 = add nsw i32 %452, 1
%454 = sext i32 %453 to i64
%455 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %454
%456 = load i32, i32* %455
%457 = and i32 %456, 15
%458 = load i32, i32* %17
%459 = add nsw i32 %458, 2
%460 = sext i32 %459 to i64
%461 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %460
%462 = load i32, i32* %461
%463 = shl i32 %462, 4
%464 = or i32 %457, %463
store i32 %464, i32* %9
%465 = load i32, i32* %17
%466 = add nsw i32 %465, 3
%467 = sext i32 %466 to i64
%468 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %467
%469 = load i32, i32* %468
%470 = and i32 %469, 192
store i32 %470, i32* %10
%471 = load i32, i32* %17
%472 = add nsw i32 %471, 3
%473 = sext i32 %472 to i64
%474 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %473
%475 = load i32, i32* %474
%476 = shl i32 %475, 2
%477 = and i32 %476, 192
store i32 %477, i32* %11
%478 = load i32, i32* %17
%479 = add nsw i32 %478, 3
%480 = sext i32 %479 to i64
%481 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %480
%482 = load i32, i32* %481
%483 = shl i32 %482, 4
%484 = and i32 %483, 192
store i32 %484, i32* %12
%485 = load i32, i32* %17
%486 = add nsw i32 %485, 3
%487 = sext i32 %486 to i64
%488 = getelementptr inbounds [1152 x i32], [1152 x i32]* %6, i64 0, i64 %487
%489 = load i32, i32* %488
%490 = shl i32 %489, 6
%491 = and i32 %490, 192
store i32 %491, i32* %13
%492 = load i32, i32* %8
%493 = load i32, i32* %9
%494 = load i32, i32* %10
%495 = load i32, i32* %11
%496 = load i32, i32* %12
%497 = load i32, i32* %13
%498 = call i32 @write_pixel_to_screen(i32 %492, i32 %493, i32 %494, i32 %495, i32 %496, i32 %497)
br label %499
499: ; preds = %439
%500 = load i32, i32* %14
%501 = load i32, i32* %17
%502 = add nsw i32 %501, %500
store i32 %502, i32* %17
br label %435
503: ; preds = %435
br label %505
504: ; preds = %31
br label %505
505: ; preds = %504, %503, %417, %338, %259, %185, %108
br label %26
506: ; preds = %26
%507 = call i32 (...) @deinit_frame_buffer()
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"Failed to init screen buffer.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1152 x i32]
%4 = bitcast [1152 x i32]* %3 to i8*
%5 = tail call i32 @get_udp_socket(i32 5005)
%6 = tail call i32 (...) @init_frame_buffer()
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @die(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = call i32 @get_udp_packet(i32 %5, i8* %4, i32 4608)
%12 = icmp sgt i32 %11, -1
br i1 %12, label %13, label %233
13: ; preds = %10
%14 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 0
br label %15
15: ; preds = %13, %230
%16 = phi i32 [ %11, %13 ], [ %231, %230 ]
%17 = load i32, i32* %14
switch i32 %17, label %230 [
i32 0, label %18
i32 1, label %53
i32 2, label %91
i32 3, label %125
i32 4, label %162
i32 5, label %195
]
18: ; preds = %15
%19 = icmp ult i32 %16, 982
%20 = select i1 %19, i32 %16, i32 982
%21 = icmp ugt i32 %20, 2
br i1 %21, label %22, label %230
22: ; preds = %18
%23 = zext i32 %20 to i64
br label %24
24: ; preds = %22, %24
%25 = phi i64 [ 2, %22 ], [ %51, %24 ]
%26 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = add nuw nsw i64 %25, 1
%29 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = shl i32 %30, 8
%32 = or i32 %31, %27
%33 = add nuw nsw i64 %25, 2
%34 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = add nuw nsw i64 %25, 3
%37 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = shl i32 %38, 8
%40 = or i32 %39, %35
%41 = add nuw nsw i64 %25, 4
%42 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = add nuw nsw i64 %25, 5
%45 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %44
%46 = load i32, i32* %45
%47 = add nuw nsw i64 %25, 6
%48 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = call i32 @write_pixel_to_screen(i32 %32, i32 %40, i32 %43, i32 %46, i32 %49, i32 255)
%51 = add nuw nsw i64 %25, 7
%52 = icmp ult i64 %51, %23
br i1 %52, label %24, label %230
53: ; preds = %15
%54 = icmp ult i32 %16, 1122
%55 = select i1 %54, i32 %16, i32 1122
%56 = icmp ugt i32 %55, 2
br i1 %56, label %57, label %230
57: ; preds = %53
%58 = zext i32 %55 to i64
br label %59
59: ; preds = %57, %59
%60 = phi i64 [ 2, %57 ], [ %89, %59 ]
%61 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %60
%62 = load i32, i32* %61
%63 = or i64 %60, 1
%64 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %63
%65 = load i32, i32* %64
%66 = shl i32 %65, 8
%67 = or i32 %66, %62
%68 = add nuw nsw i64 %60, 2
%69 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %68
%70 = load i32, i32* %69
%71 = add nuw nsw i64 %60, 3
%72 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %71
%73 = load i32, i32* %72
%74 = shl i32 %73, 8
%75 = or i32 %74, %70
%76 = add nuw nsw i64 %60, 4
%77 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %76
%78 = load i32, i32* %77
%79 = add nuw nsw i64 %60, 5
%80 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %79
%81 = load i32, i32* %80
%82 = add nuw nsw i64 %60, 6
%83 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %82
%84 = load i32, i32* %83
%85 = add nuw nsw i64 %60, 7
%86 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %85
%87 = load i32, i32* %86
%88 = call i32 @write_pixel_to_screen(i32 %67, i32 %75, i32 %78, i32 %81, i32 %84, i32 %87)
%89 = add nuw nsw i64 %60, 8
%90 = icmp ult i64 %89, %58
br i1 %90, label %59, label %230
91: ; preds = %15
%92 = icmp ult i32 %16, 842
%93 = select i1 %92, i32 %16, i32 842
%94 = icmp ugt i32 %93, 2
br i1 %94, label %95, label %230
95: ; preds = %91
%96 = zext i32 %93 to i64
br label %97
97: ; preds = %95, %97
%98 = phi i64 [ 2, %95 ], [ %123, %97 ]
%99 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %98
%100 = load i32, i32* %99
%101 = or i64 %98, 1
%102 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %101
%103 = load i32, i32* %102
%104 = shl i32 %103, 4
%105 = and i32 %104, 3840
%106 = or i32 %105, %100
%107 = and i32 %103, 15
%108 = add nuw nsw i64 %98, 2
%109 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %108
%110 = load i32, i32* %109
%111 = shl i32 %110, 4
%112 = or i32 %111, %107
%113 = add nuw nsw i64 %98, 3
%114 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %113
%115 = load i32, i32* %114
%116 = add nuw nsw i64 %98, 4
%117 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %116
%118 = load i32, i32* %117
%119 = add nuw nsw i64 %98, 5
%120 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %119
%121 = load i32, i32* %120
%122 = call i32 @write_pixel_to_screen(i32 %106, i32 %112, i32 %115, i32 %118, i32 %121, i32 255)
%123 = add nuw nsw i64 %98, 6
%124 = icmp ult i64 %123, %96
br i1 %124, label %97, label %230
125: ; preds = %15
%126 = icmp ult i32 %16, 982
%127 = select i1 %126, i32 %16, i32 982
%128 = icmp ugt i32 %127, 2
br i1 %128, label %129, label %230
129: ; preds = %125
%130 = zext i32 %127 to i64
br label %131
131: ; preds = %129, %131
%132 = phi i64 [ 2, %129 ], [ %160, %131 ]
%133 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %132
%134 = load i32, i32* %133
%135 = add nuw nsw i64 %132, 1
%136 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %135
%137 = load i32, i32* %136
%138 = shl i32 %137, 4
%139 = and i32 %138, 3840
%140 = or i32 %139, %134
%141 = and i32 %137, 15
%142 = add nuw nsw i64 %132, 2
%143 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %142
%144 = load i32, i32* %143
%145 = shl i32 %144, 4
%146 = or i32 %145, %141
%147 = add nuw nsw i64 %132, 3
%148 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %147
%149 = load i32, i32* %148
%150 = add nuw nsw i64 %132, 4
%151 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %150
%152 = load i32, i32* %151
%153 = add nuw nsw i64 %132, 5
%154 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %153
%155 = load i32, i32* %154
%156 = add nuw nsw i64 %132, 6
%157 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %156
%158 = load i32, i32* %157
%159 = call i32 @write_pixel_to_screen(i32 %140, i32 %146, i32 %149, i32 %152, i32 %155, i32 %158)
%160 = add nuw nsw i64 %132, 7
%161 = icmp ult i64 %160, %130
br i1 %161, label %131, label %230
162: ; preds = %15
%163 = icmp ult i32 %16, 562
%164 = select i1 %163, i32 %16, i32 562
%165 = icmp ugt i32 %164, 2
br i1 %165, label %166, label %230
166: ; preds = %162
%167 = zext i32 %164 to i64
br label %168
168: ; preds = %166, %168
%169 = phi i64 [ 2, %166 ], [ %193, %168 ]
%170 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %169
%171 = load i32, i32* %170
%172 = or i64 %169, 1
%173 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %172
%174 = load i32, i32* %173
%175 = shl i32 %174, 4
%176 = and i32 %175, 3840
%177 = or i32 %176, %171
%178 = and i32 %174, 15
%179 = add nuw nsw i64 %169, 2
%180 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %179
%181 = load i32, i32* %180
%182 = shl i32 %181, 4
%183 = or i32 %182, %178
%184 = add nuw nsw i64 %169, 3
%185 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %184
%186 = load i32, i32* %185
%187 = and i32 %186, 224
%188 = shl i32 %186, 3
%189 = and i32 %188, 224
%190 = shl i32 %186, 6
%191 = and i32 %190, 192
%192 = call i32 @write_pixel_to_screen(i32 %177, i32 %183, i32 %187, i32 %189, i32 %191, i32 255)
%193 = add nuw nsw i64 %169, 4
%194 = icmp ult i64 %193, %167
br i1 %194, label %168, label %230
195: ; preds = %15
%196 = icmp ult i32 %16, 562
%197 = select i1 %196, i32 %16, i32 562
%198 = icmp ugt i32 %197, 2
br i1 %198, label %199, label %230
199: ; preds = %195
%200 = zext i32 %197 to i64
br label %201
201: ; preds = %199, %201
%202 = phi i64 [ 2, %199 ], [ %228, %201 ]
%203 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %202
%204 = load i32, i32* %203
%205 = or i64 %202, 1
%206 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %205
%207 = load i32, i32* %206
%208 = shl i32 %207, 4
%209 = and i32 %208, 3840
%210 = or i32 %209, %204
%211 = and i32 %207, 15
%212 = add nuw nsw i64 %202, 2
%213 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %212
%214 = load i32, i32* %213
%215 = shl i32 %214, 4
%216 = or i32 %215, %211
%217 = add nuw nsw i64 %202, 3
%218 = getelementptr inbounds [1152 x i32], [1152 x i32]* %3, i64 0, i64 %217
%219 = load i32, i32* %218
%220 = and i32 %219, 192
%221 = shl i32 %219, 2
%222 = and i32 %221, 192
%223 = shl i32 %219, 4
%224 = and i32 %223, 192
%225 = shl i32 %219, 6
%226 = and i32 %225, 192
%227 = call i32 @write_pixel_to_screen(i32 %210, i32 %216, i32 %220, i32 %222, i32 %224, i32 %226)
%228 = add nuw nsw i64 %202, 4
%229 = icmp ult i64 %228, %200
br i1 %229, label %201, label %230
230: ; preds = %201, %168, %131, %97, %59, %24, %195, %162, %125, %91, %53, %18, %15
%231 = call i32 @get_udp_packet(i32 %5, i8* %4, i32 4608)
%232 = icmp sgt i32 %231, -1
br i1 %232, label %15, label %233
233: ; preds = %230, %10
%234 = call i32 (...) @deinit_frame_buffer()
ret i32 0
}