int __attribute__((__ms_hook_prologue__)) foo() {
  unsigned char *ptr = (unsigned char *)foo;
  if (*ptr++ != 0x8b)
    return 1;
  if (*ptr++ != 0xff)
    return 1;
  if (*ptr++ != 0x55)
    return 1;
  if (*ptr++ != 0x8b)
    return 1;
  if (*ptr++ != 0xec)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%eax
cmp    $0x8b,%eax
je     1138 <foo+0x38>
movl   $0x1,-0x4(%rbp)
jmp    11e1 <foo+0xe1>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%eax
cmp    $0xff,%eax
je     1161 <foo+0x61>
movl   $0x1,-0x4(%rbp)
jmp    11e1 <foo+0xe1>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%eax
cmp    $0x55,%eax
je     1188 <foo+0x88>
movl   $0x1,-0x4(%rbp)
jmp    11e1 <foo+0xe1>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%eax
cmp    $0x8b,%eax
je     11b1 <foo+0xb1>
movl   $0x1,-0x4(%rbp)
jmp    11e1 <foo+0xe1>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%eax
cmp    $0xec,%eax
je     11da <foo+0xda>
movl   $0x1,-0x4(%rbp)
jmp    11e1 <foo+0xe1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    0x2ee1(%rip),%rcx
mov    $0x1,%eax
cmpb   $0x8b,(%rcx)
jne    1117 <foo+0x17>
cmpb   $0xff,0x1(%rcx)
je     1118 <foo+0x18>
ret
cmpb   $0x55,0x2(%rcx)
jne    1117 <foo+0x17>
cmpb   $0x8b,0x3(%rcx)
jne    1117 <foo+0x17>
xor    %eax,%eax
cmpb   $0xec,0x4(%rcx)
setne  %al
ret

LLVM IR (-O0):
define i32 @foo() {
%1 = alloca i32
%2 = alloca i8*
store i8* bitcast (i32 ()* @foo to i8*), i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i32 1
store i8* %4, i8** %2
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = icmp ne i32 %6, 139
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 1, i32* %1
br label %38
9: ; preds = %0
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %2
%12 = load i8, i8* %10
%13 = zext i8 %12 to i32
%14 = icmp ne i32 %13, 255
br i1 %14, label %15, label %16
15: ; preds = %9
store i32 1, i32* %1
br label %38
16: ; preds = %9
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %2
%19 = load i8, i8* %17
%20 = zext i8 %19 to i32
%21 = icmp ne i32 %20, 85
br i1 %21, label %22, label %23
22: ; preds = %16
store i32 1, i32* %1
br label %38
23: ; preds = %16
%24 = load i8*, i8** %2
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %2
%26 = load i8, i8* %24
%27 = zext i8 %26 to i32
%28 = icmp ne i32 %27, 139
br i1 %28, label %29, label %30
29: ; preds = %23
store i32 1, i32* %1
br label %38
30: ; preds = %23
%31 = load i8*, i8** %2
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %2
%33 = load i8, i8* %31
%34 = zext i8 %33 to i32
%35 = icmp ne i32 %34, 236
br i1 %35, label %36, label %37
36: ; preds = %30
store i32 1, i32* %1
br label %38
37: ; preds = %30
store i32 0, i32* %1
br label %38
38: ; preds = %37, %36, %29, %22, %15, %8
%39 = load i32, i32* %1
ret i32 %39
}

LLVM IR (-O2):
define i32 @foo() {
%1 = load i8, i8* bitcast (i32 ()* @foo to i8*)
%2 = icmp eq i8 %1, -117
br i1 %2, label %3, label %16
3: ; preds = %0
%4 = load i8, i8* getelementptr (i8, i8* bitcast (i32 ()* @foo to i8*), i64 1)
%5 = icmp eq i8 %4, -1
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = load i8, i8* getelementptr (i8, i8* bitcast (i32 ()* @foo to i8*), i64 2)
%8 = icmp eq i8 %7, 85
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i8, i8* getelementptr (i8, i8* bitcast (i32 ()* @foo to i8*), i64 3)
%11 = icmp eq i8 %10, -117
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i8, i8* getelementptr (i8, i8* bitcast (i32 ()* @foo to i8*), i64 4)
%14 = icmp ne i8 %13, -20
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %12, %9, %6, %3, %0
%17 = phi i32 [ 1, %0 ], [ 1, %3 ], [ 1, %6 ], [ 1, %9 ], [ %15, %12 ]
ret i32 %17
}