int slip_recv_packet(char *p, int len) {
  char c;
  int received = 0;
  while (1) {
    c = (219);
    switch (c) {
    case 192:
      if (received)
        return received;
      else
        break;
    case 219:
      c = (219);
      switch (c) {
      case 220:
        c = 192;
        break;
      case 221:
        c = 219;
        break;
      }
    default:
      if (received < len) {
        p[received++] = c;
      }
    }
  }
}


x86 assembly (clang, -O0):
<slip_recv_packet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
movb   $0xdb,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0xc0,%eax
je     1140 <slip_recv_packet+0x40>
jmp    112d <slip_recv_packet+0x2d>
mov    -0x18(%rbp),%eax
sub    $0xdb,%eax
je     1154 <slip_recv_packet+0x54>
jmp    1194 <slip_recv_packet+0x94>
cmpl   $0x0,-0x14(%rbp)
je     114f <slip_recv_packet+0x4f>
mov    -0x14(%rbp),%eax
pop    %rbp
ret
jmp    11bd <slip_recv_packet+0xbd>
movb   $0xdb,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0xdc,%eax
je     1182 <slip_recv_packet+0x82>
jmp    116f <slip_recv_packet+0x6f>
mov    -0x1c(%rbp),%eax
sub    $0xdd,%eax
je     118b <slip_recv_packet+0x8b>
jmp    118f <slip_recv_packet+0x8f>
movb   $0xc0,-0xd(%rbp)
jmp    118f <slip_recv_packet+0x8f>
movb   $0xdb,-0xd(%rbp)
jmp    1194 <slip_recv_packet+0x94>
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b8 <slip_recv_packet+0xb8>
mov    -0xd(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x14(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    11bd <slip_recv_packet+0xbd>
jmp    1112 <slip_recv_packet+0x12>

x86 assembly (clang, -O2):
<slip_recv_packet>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    %esi,%eax
jge    1110 <slip_recv_packet+0x10>
mov    %eax,%ecx
add    $0x1,%eax
movb   $0xdb,(%rdi,%rcx,1)
jmp    1110 <slip_recv_packet+0x10>

LLVM IR (-O0):
define i32 @slip_recv_packet(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %6
br label %7
7: ; preds = %2, %34
store i8 -37, i8* %5
%8 = load i8, i8* %5
%9 = sext i8 %8 to i32
switch i32 %9, label %22 [
i32 192, label %10
i32 219, label %16
]
10: ; preds = %7
%11 = load i32, i32* %6
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = load i32, i32* %6
ret i32 %14
15: ; preds = %10
br label %34
16: ; preds = %7
store i8 -37, i8* %5
%17 = load i8, i8* %5
%18 = sext i8 %17 to i32
switch i32 %18, label %21 [
i32 220, label %19
i32 221, label %20
]
19: ; preds = %16
store i8 -64, i8* %5
br label %21
20: ; preds = %16
store i8 -37, i8* %5
br label %21
21: ; preds = %16, %20, %19
br label %22
22: ; preds = %7, %21
%23 = load i32, i32* %6
%24 = load i32, i32* %4
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %33
26: ; preds = %22
%27 = load i8, i8* %5
%28 = load i8*, i8** %3
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds i8, i8* %28, i64 %31
store i8 %27, i8* %32
br label %33
33: ; preds = %26, %22
br label %34
34: ; preds = %33, %15
br label %7
}

LLVM IR (-O2):
define i32 @slip_recv_packet(i8* nocapture writeonly %0, i32 %1) {
br label %3
3: ; preds = %7, %2
%4 = phi i32 [ %8, %7 ], [ 0, %2 ]
%5 = icmp slt i32 %4, %1
br label %6
6: ; preds = %3, %6
br i1 %5, label %7, label %6
7: ; preds = %6
%8 = add nuw nsw i32 %4, 1
%9 = zext i32 %4 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
store i8 -37, i8* %10
br label %3
}