#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 uint32_t;

/* Variables and functions */
int user_byte(int /*<<< orphan*/);
bool instruction_has_stack_argument(uint32_t addr) {
  uint32_t types = user_byte(addr++);
  for (int i = 6; i >= 0; i -= 2) {
    switch ((types >> i) & 0x03) {
    case 0:
      addr += 2;
      break;
    case 1:
      addr++;
      break;
    case 2:
      if (user_byte(addr++) == 0) {
        return true;
      }
      break;
    default:
      return false;
    }
  }
  return false;
}


x86 assembly (clang, -O0):
<instruction_has_stack_argument>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
call   1030 <user_byte@plt>
mov    %eax,-0xc(%rbp)
movl   $0x6,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     11df <instruction_has_stack_argument+0xcf>
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%cl
sar    %cl,%eax
and    $0x3,%eax
mov    %eax,-0x14(%rbp)
je     117a <instruction_has_stack_argument+0x6a>
jmp    1158 <instruction_has_stack_argument+0x48>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
je     1188 <instruction_has_stack_argument+0x78>
jmp    1169 <instruction_has_stack_argument+0x59>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1196 <instruction_has_stack_argument+0x86>
jmp    11c0 <instruction_has_stack_argument+0xb0>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    11cc <instruction_has_stack_argument+0xbc>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11cc <instruction_has_stack_argument+0xbc>
mov    -0x8(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
call   1030 <user_byte@plt>
cmp    $0x0,%eax
jne    11bb <instruction_has_stack_argument+0xab>
movl   $0x1,-0x4(%rbp)
jmp    11e6 <instruction_has_stack_argument+0xd6>
jmp    11cc <instruction_has_stack_argument+0xbc>
movl   $0x0,-0x4(%rbp)
jmp    11e6 <instruction_has_stack_argument+0xd6>
jmp    11d1 <instruction_has_stack_argument+0xc1>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x10(%rbp)
jmp    1135 <instruction_has_stack_argument+0x25>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<instruction_has_stack_argument>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x1(%rbx),%ebp
call   1030 <user_byte@plt>
mov    %eax,%r15d
shr    $0x6,%eax
xor    %r14d,%r14d
and    $0x3,%eax
je     113b <instruction_has_stack_argument+0x2b>
cmp    $0x2,%eax
je     113f <instruction_has_stack_argument+0x2f>
cmp    $0x1,%eax
je     114a <instruction_has_stack_argument+0x3a>
jmp    11b8 <instruction_has_stack_argument+0xa8>
mov    %ebp,%ebx
jmp    114a <instruction_has_stack_argument+0x3a>
mov    %ebp,%edi
call   1030 <user_byte@plt>
test   %eax,%eax
je     11b2 <instruction_has_stack_argument+0xa2>
mov    %r15d,%eax
shr    $0x4,%eax
and    $0x3,%eax
je     1170 <instruction_has_stack_argument+0x60>
cmp    $0x1,%eax
je     116b <instruction_has_stack_argument+0x5b>
cmp    $0x2,%eax
jne    11b8 <instruction_has_stack_argument+0xa8>
lea    0x2(%rbx),%edi
call   1030 <user_byte@plt>
test   %eax,%eax
je     11b2 <instruction_has_stack_argument+0xa2>
add    $0x3,%ebx
jmp    1173 <instruction_has_stack_argument+0x63>
add    $0x4,%ebx
mov    %r15d,%eax
shr    $0x2,%eax
and    $0x3,%eax
je     1198 <instruction_has_stack_argument+0x88>
cmp    $0x1,%eax
je     1193 <instruction_has_stack_argument+0x83>
cmp    $0x2,%eax
jne    11b8 <instruction_has_stack_argument+0xa8>
mov    %ebx,%edi
call   1030 <user_byte@plt>
test   %eax,%eax
je     11b2 <instruction_has_stack_argument+0xa2>
add    $0x1,%ebx
jmp    119b <instruction_has_stack_argument+0x8b>
add    $0x2,%ebx
and    $0x3,%r15d
cmp    $0x2,%r15d
jb     11b8 <instruction_has_stack_argument+0xa8>
jne    11b8 <instruction_has_stack_argument+0xa8>
mov    %ebx,%edi
call   1030 <user_byte@plt>
test   %eax,%eax
jne    11b8 <instruction_has_stack_argument+0xa8>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @instruction_has_stack_argument(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 = add nsw i32 %6, 1
store i32 %7, i32* %3
%8 = call i32 @user_byte(i32 %6)
store i32 %8, i32* %4
store i32 6, i32* %5
br label %9
9: ; preds = %32, %1
%10 = load i32, i32* %5
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %35
12: ; preds = %9
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = ashr i32 %13, %14
%16 = and i32 %15, 3
switch i32 %16, label %30 [
i32 0, label %17
i32 1, label %20
i32 2, label %23
]
17: ; preds = %12
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 2
store i32 %19, i32* %3
br label %31
20: ; preds = %12
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %31
23: ; preds = %12
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
%26 = call i32 @user_byte(i32 %24)
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %23
store i32 1, i32* %2
br label %36
29: ; preds = %23
br label %31
30: ; preds = %12
store i32 0, i32* %2
br label %36
31: ; preds = %29, %20, %17
br label %32
32: ; preds = %31
%33 = load i32, i32* %5
%34 = sub nsw i32 %33, 2
store i32 %34, i32* %5
br label %9
35: ; preds = %9
store i32 0, i32* %2
br label %36
36: ; preds = %35, %30, %28
%37 = load i32, i32* %2
ret i32 %37
}

LLVM IR (-O2):
define i32 @instruction_has_stack_argument(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = tail call i32 @user_byte(i32 %0)
%4 = lshr i32 %3, 6
%5 = and i32 %4, 3
switch i32 %5, label %42 [
i32 0, label %10
i32 1, label %6
i32 2, label %7
]
6: ; preds = %1
br label %10
7: ; preds = %1
%8 = tail call i32 @user_byte(i32 %2)
%9 = icmp eq i32 %8, 0
br i1 %9, label %42, label %10
10: ; preds = %1, %6, %7
%11 = phi i32 [ %0, %7 ], [ %0, %6 ], [ %2, %1 ]
%12 = lshr i32 %3, 4
%13 = and i32 %12, 3
switch i32 %13, label %42 [
i32 0, label %21
i32 1, label %19
i32 2, label %14
]
14: ; preds = %10
%15 = add nsw i32 %11, 2
%16 = add nsw i32 %11, 3
%17 = tail call i32 @user_byte(i32 %15)
%18 = icmp eq i32 %17, 0
br i1 %18, label %42, label %23
19: ; preds = %10
%20 = add nsw i32 %11, 3
br label %23
21: ; preds = %10
%22 = add nsw i32 %11, 4
br label %23
23: ; preds = %21, %19, %14
%24 = phi i32 [ %16, %14 ], [ %20, %19 ], [ %22, %21 ]
%25 = lshr i32 %3, 2
%26 = and i32 %25, 3
switch i32 %26, label %42 [
i32 0, label %33
i32 1, label %31
i32 2, label %27
]
27: ; preds = %23
%28 = add nsw i32 %24, 1
%29 = tail call i32 @user_byte(i32 %24)
%30 = icmp eq i32 %29, 0
br i1 %30, label %42, label %35
31: ; preds = %23
%32 = add nsw i32 %24, 1
br label %35
33: ; preds = %23
%34 = add nsw i32 %24, 2
br label %35
35: ; preds = %33, %31, %27
%36 = phi i32 [ %28, %27 ], [ %32, %31 ], [ %34, %33 ]
%37 = and i32 %3, 3
switch i32 %37, label %42 [
i32 0, label %41
i32 1, label %41
i32 2, label %38
]
38: ; preds = %35
%39 = tail call i32 @user_byte(i32 %36)
%40 = icmp eq i32 %39, 0
br i1 %40, label %42, label %41
41: ; preds = %35, %35, %38
br label %42
42: ; preds = %41, %38, %35, %27, %23, %14, %10, %1, %7
%43 = phi i32 [ 0, %1 ], [ 1, %7 ], [ 0, %10 ], [ 1, %14 ], [ 0, %23 ], [ 1, %27 ], [ 0, %35 ], [ 1, %38 ], [ 0, %41 ]
ret i32 %43
}