int missingMaterial(int p_id, int m_id) {
  if (p_id == 0) {
    return 0;
  }
  if (p_id == 1) {
    if (m_id = 0)
      return 1;
    else
      return 0;
  }
  if (p_id == 2) {
    if (m_id = 0)
      return 2;
    else
      return 0;
  }
  if (p_id == 3) {
    return 1;
  }
  if (p_id == 4) {
    if (m_id == 1)
      return 2;
    else
      return 1;
  }
  if (p_id == 5) {
    return 2;
  } else
    return -1;
}


x86 assembly (clang, -O0):
<missingMaterial>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1120 <missingMaterial+0x20>
movl   $0x0,-0x4(%rbp)
jmp    11ef <missingMaterial+0xef>
cmpl   $0x1,-0x8(%rbp)
jne    1158 <missingMaterial+0x58>
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    1140 <missingMaterial+0x40>
jmp    114c <missingMaterial+0x4c>
movl   $0x1,-0x4(%rbp)
jmp    11ef <missingMaterial+0xef>
movl   $0x0,-0x4(%rbp)
jmp    11ef <missingMaterial+0xef>
cmpl   $0x2,-0x8(%rbp)
jne    1190 <missingMaterial+0x90>
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    1178 <missingMaterial+0x78>
jmp    1184 <missingMaterial+0x84>
movl   $0x2,-0x4(%rbp)
jmp    11ef <missingMaterial+0xef>
movl   $0x0,-0x4(%rbp)
jmp    11ef <missingMaterial+0xef>
cmpl   $0x3,-0x8(%rbp)
jne    11a6 <missingMaterial+0xa6>
movl   $0x1,-0x4(%rbp)
jmp    11ef <missingMaterial+0xef>
cmpl   $0x4,-0x8(%rbp)
jne    11d2 <missingMaterial+0xd2>
cmpl   $0x1,-0xc(%rbp)
jne    11c6 <missingMaterial+0xc6>
movl   $0x2,-0x4(%rbp)
jmp    11ef <missingMaterial+0xef>
movl   $0x1,-0x4(%rbp)
jmp    11ef <missingMaterial+0xef>
cmpl   $0x5,-0x8(%rbp)
jne    11e8 <missingMaterial+0xe8>
movl   $0x2,-0x4(%rbp)
jmp    11ef <missingMaterial+0xef>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<missingMaterial>:
cmp    $0x5,%edi
ja     111a <missingMaterial+0x1a>
xor    %eax,%eax
mov    %edi,%ecx
lea    0xef0(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
ret
mov    $0xffffffff,%eax
ret
mov    $0x1,%eax
ret
mov    $0x2,%eax
ret
xor    %eax,%eax
cmp    $0x1,%esi
sete   %al
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @missingMaterial(i32 %0, i32 %1) {
switch i32 %0, label %8 [
i32 0, label %9
i32 1, label %9
i32 2, label %9
i32 3, label %3
i32 4, label %4
i32 5, label %7
]
3: ; preds = %2
br label %9
4: ; preds = %2
%5 = icmp eq i32 %1, 1
%6 = select i1 %5, i32 2, i32 1
br label %9
7: ; preds = %2
br label %9
8: ; preds = %2
br label %9
9: ; preds = %2, %2, %2, %4, %8, %7, %3
%10 = phi i32 [ 1, %3 ], [ 2, %7 ], [ -1, %8 ], [ 0, %2 ], [ 0, %2 ], [ 0, %2 ], [ %6, %4 ]
ret i32 %10
}