#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 /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int recv(int, int *, int, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int recv_magic(int fd) {
  int magic;
  int rlen;
  rlen = recv(fd, &magic, sizeof(int), 0);
  switch (magic) {
  case 0x18fabe0d:
  case 0xdc3bae7b:
  case 0x582da3c1:
  case 0xe67cba2d:
    return magic;
    break;
  default:
    fprintf(stderr, "(Master) Not magic: %x\n", magic);
    return -1;
  }
}


x86 assembly (clang, -O0):
<recv_magic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0xc(%rbp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0xdc3bae7b,%eax
je     1190 <recv_magic+0x70>
jmp    1157 <recv_magic+0x37>
mov    -0x14(%rbp),%eax
sub    $0xe67cba2d,%eax
je     1190 <recv_magic+0x70>
jmp    116a <recv_magic+0x4a>
mov    -0x14(%rbp),%eax
sub    $0x18fabe0d,%eax
je     1190 <recv_magic+0x70>
jmp    117d <recv_magic+0x5d>
mov    -0x14(%rbp),%eax
sub    $0x582da3c1,%eax
jne    119b <recv_magic+0x7b>
jmp    1190 <recv_magic+0x70>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11ba <recv_magic+0x9a>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe52(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recv_magic>:
push   %rax
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    0x4(%rsp),%eax
cmp    $0x18fabe0c,%eax
jg     114d <recv_magic+0x2d>
cmp    $0xdc3bae7b,%eax
je     114b <recv_magic+0x2b>
cmp    $0xe67cba2d,%eax
jne    115b <recv_magic+0x3b>
pop    %rcx
ret
cmp    $0x18fabe0d,%eax
je     114b <recv_magic+0x2b>
cmp    $0x582da3c1,%eax
je     114b <recv_magic+0x2b>
mov    0x2e7e(%rip),%rcx
mov    (%rcx),%edi
lea    0xe95(%rip),%rsi
mov    %eax,%edx
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"(Master) Not magic: %x\0A\00"
define i32 @recv_magic(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @recv(i32 %6, i32* %4, i32 4, i32 0)
store i32 %7, i32* %5
%8 = load i32, i32* %4
switch i32 %8, label %11 [
i32 419085837, label %9
i32 -600068485, label %9
i32 1479386049, label %9
i32 -428033491, label %9
]
9: ; preds = %1, %1, %1, %1
%10 = load i32, i32* %4
store i32 %10, i32* %2
br label %15
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = load i32, i32* %4
%14 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %13)
store i32 -1, i32* %2
br label %15
15: ; preds = %11, %9
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"(Master) Not magic: %x\0A\00"
define i32 @recv_magic(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @recv(i32 %0, i32* %2, i32 4, i32 0)
%5 = load i32, i32* %2
switch i32 %5, label %6 [
i32 419085837, label %9
i32 -600068485, label %9
i32 1479386049, label %9
i32 -428033491, label %9
]
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %9
9: ; preds = %1, %1, %1, %1, %6
%10 = phi i32 [ -1, %6 ], [ %5, %1 ], [ %5, %1 ], [ %5, %1 ], [ %5, %1 ]
ret i32 %10
}